Server : Apache System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33.7 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system Directory : /nas/content/live/attorneyexperi/wp-content/plugins/wp-rocket/inc/functions/ |
<?php /** * Get an URL with one of CNAMES added in options * * @since 2.1 * * @param string $url The URL to parse. * @param array $zone (default: array( 'all' )). Deprecated. * @return string */ function get_rocket_cdn_url( $url, $zone = [ 'all' ] ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals, Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed $container = apply_filters( 'rocket_container', '' ); $cdn = $container->get( 'cdn' ); return $cdn->rewrite_url( $url ); } /** * Wrapper of get_rocket_cdn_url() and print result * * @since 2.1 * * @param string $url The URL to parse. * @param array $zone (default: array( 'all' )). Deprecated. */ function rocket_cdn_url( $url, $zone = [ 'all' ] ) { echo esc_url( get_rocket_cdn_url( $url, $zone ) ); } /** * Get all CNAMES. * * @since 2.1 * @since 3.0 Don't check for WP Rocket CDN option activated to be able to use the function on Hosting with CDN auto-enabled. * * @param string $zone List of zones. Default is 'all'. * @return array List of CNAMES */ function get_rocket_cdn_cnames( $zone = 'all' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals $hosts = []; $cnames = get_rocket_option( 'cdn_cnames', [] ); if ( $cnames ) { $cnames_zone = get_rocket_option( 'cdn_zone', [] ); $zone = (array) $zone; foreach ( $cnames as $k => $_urls ) { if ( ! in_array( $cnames_zone[ $k ], $zone, true ) ) { continue; } $_urls = explode( ',', $_urls ); $_urls = array_map( 'trim', $_urls ); foreach ( $_urls as $url ) { $hosts[] = $url; } } } /** * Filter all CNAMES. * * @since 2.7 * * @param array $hosts List of CNAMES. * @param array $zone Array of CDN zones. */ $hosts = (array) apply_filters( 'rocket_cdn_cnames', $hosts, $zone ); $hosts = array_filter( $hosts ); $hosts = array_flip( array_flip( $hosts ) ); $hosts = array_values( $hosts ); return $hosts; } /** * Check if the current URL is for a live site (not local, not staging). * * @since 3.5 * @author Remy Perona * * @return bool True if live, false otherwise. */ function rocket_is_live_site() { if ( rocket_get_constant( 'WP_ROCKET_DEBUG' ) ) { return true; } $host = wp_parse_url( home_url(), PHP_URL_HOST ); if ( ! $host ) { return false; } // Check for local development sites. $local_tlds = [ '127.0.0.1', 'localhost', '.local', '.test', '.docksal', '.docksal.site', '.dev.cc', '.lndo.site', ]; foreach ( $local_tlds as $local_tld ) { if ( $host === $local_tld ) { return false; } // Check the TLD. if ( substr( $host, -strlen( $local_tld ) ) === $local_tld ) { return false; } } $default_staging = []; /** * Get the list of staging domains from SaaS * * @param array $default_staging default result in case there isn't. */ $staging = apply_filters( 'rocket_staging_list', $default_staging ); if ( ! is_array( $staging ) ) { $staging = $default_staging; } foreach ( $staging as $partial_host ) { if ( strpos( $host, $partial_host ) ) { return false; } } return true; } /** * Checks if importing * * @return bool */ function rocket_is_importing() { /** * Filter use to determine if we are currently importing data into the WordPress. * Bails out if this filter returns true. * * @param boolean Tells if we are importing or not. */ return (bool) apply_filters( 'rocket_is_importing', rocket_get_constant( 'WP_IMPORTING' ) ); }