mes", or "core"' ); } if ( did_action( 'wp_default_scripts' ) && // Don't complain during plugin activation. ! defined( 'WP_SANDBOX_SCRAPING' ) ) { _doing_it_wrong( __METHOD__, sprintf( /* translators: 1: wp_default_scripts. 2: Name of the domain being aliased. */ esc_html__( 'Textdomain aliases should be registered before the %1$s hook. This notice was triggered by the %2$s domain.', 'jetpack-assets' ), 'wp_default_scripts', '' . esc_html( $from ) . '' ), '' ); } if ( empty( self::$domain_map[ $from ] ) ) { self::init_domain_map_hooks( $from, array() === self::$domain_map ); self::$domain_map[ $from ] = array( $to, $totype, $ver, $path ); } elseif ( Semver::compare( $ver, self::$domain_map[ $from ][2] ) > 0 ) { self::$domain_map[ $from ] = array( $to, $totype, $ver, $path ); } } /** * Register textdomain aliases from a mapping file. * * The mapping file is simply a PHP file that returns an array * with the following properties: * - 'domain': String, `$to` * - 'type': String, `$totype` * - 'packages': Array, mapping `$from` to `array( 'path' => $path, 'ver' => $ver )` (or to the string `$ver` for back compat). * * @since 1.15.0 * @param string $file Mapping file. */ public static function alias_textdomains_from_file( $file ) { $data = require $file; foreach ( $data['packages'] as $from => $fromdata ) { if ( ! is_array( $fromdata ) ) { $fromdata = array( 'path' => '', 'ver' => $fromdata, ); } self::alias_textdomain( $from, $data['domain'], $data['type'], $fromdata['ver'], $fromdata['path'] ); } } /** * Register the hooks for textdomain aliasing. * * @param string $domain Domain to alias. * @param bool $firstcall If this is the first call. */ private static function init_domain_map_hooks( $domain, $firstcall ) { // If WordPress's plugin API is available already, use it. If not, // drop data into `$wp_filter` for `WP_Hook::build_preinitialized_hooks()`. if ( function_exists( 'add_filter' ) ) { $add_filter = 'add_filter'; } else { $add_filter = function ( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { global $wp_filter; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $wp_filter[ $hook_name ][ $priority ][] = array( 'accepted_args' => $accepted_args, 'function' => $callback, ); }; } $add_filter( "gettext_{$domain}", array( self::class, 'filter_gettext' ), 10, 3 ); $add_filter( "ngettext_{$domain}", array( self::class, 'filter_ngettext' ), 10, 5 ); $add_filter( "gettext_with_context_{$domain}", array( self::class, 'filter_gettext_with_context' ), 10, 4 ); $add_filter( "ngettext_with_context_{$domain}", array( self::class, 'filter_ngettext_with_context' ), 10, 6 ); if ( $firstcall ) { $add_filter( 'load_script_translation_file', array( self::class, 'filter_load_script_translation_file' ), 10, 3 ); } } /** * Filter for `gettext`. * * @since 1.15.0 * @param string $translation Translated text. * @param string $text Text to translate. * @param string $domain Text domain. * @return string Translated text. */ public static function filter_gettext( $translation, $text, $domain ) { if ( $translation === $text ) { // phpcs:ignore WordPress.WP.I18n -- This is a filter hook to map the text domains from our Composer packages to the domain for a containing plugin. See https://wp.me/p2gHKz-oRh#problem-6-text-domains-in-composer-packages $newtext = __( $text, self::$domain_map[ $domain ][0] ); if ( $newtext !== $text ) { return $newtext; } } return $translation; } /** * Filter for `ngettext`. * * @since 1.15.0 * @param string $translation Translated text. * @param string $single The text to be used if the number is singular. * @param string $plural The text to be used if the number is plural. * @param string $number The number to compare against to use either the singular or plural form. * @param string $domain Text domain. * @return string Translated text. */ public static function filter_ngettext( $translation, $single, $plural, $number, $domain ) { if ( $translation === $single || $translation === $plural ) { // phpcs:ignore WordPress.WP.I18n -- This is a filter hook to map the text domains from our Composer packages to the domain for a containing plugin. See https://wp.me/p2gHKz-oRh#problem-6-text-domains-in-composer-packages $translation = _n( $single, $plural, $number, self::$domain_map[ $domain ][0] ); } return $translation; } /** * Filter for `gettext_with_context`. * * @since 1.15.0 * @param string $translation Translated text. * @param string $text Text to translate. * @param string $context Context information for the translators. * @param string $domain Text domain. * @return string Translated text. */ public static function filter_gettext_with_context( $translation, $text, $context, $domain ) { if ( $translation === $text ) { // phpcs:ignore WordPress.WP.I18n -- This is a filter hook to map the text domains from our Composer packages to the domain for a containing plugin. See https://wp.me/p2gHKz-oRh#problem-6-text-domains-in-composer-packages $translation = _x( $text, $context, self::$domain_map[ $domain ][0] ); } return $translation; } /** * Filter for `ngettext_with_context`. * * @since 1.15.0 * @param string $translation Translated text. * @param string $single The text to be used if the number is singular. * @param string $plural The text to be used if the number is plural. * @param string $number The number to compare against to use either the singular or plural form. * @param string $context Context information for the translators. * @param string $domain Text domain. * @return string Translated text. */ public static function filter_ngettext_with_context( $translation, $single, $plural, $number, $context, $domain ) { if ( $translation === $single || $translation === $plural ) { // phpcs:ignore WordPress.WP.I18n -- This is a filter hook to map the text domains from our Composer packages to the domain for a containing plugin. See https://wp.me/p2gHKz-oRh#problem-6-text-domains-in-composer-packages $translation = _nx( $single, $plural, $number, $context, self::$domain_map[ $domain ][0] ); } return $translation; } /** * Filter for `load_script_translation_file`. * * @since 1.15.0 * @param string|false $file Path to the translation file to load. False if there isn't one. * @param string $handle Name of the script to register a translation domain to. * @param string $domain The text domain. */ public static function filter_load_script_translation_file( $file, $handle, $domain ) { if ( false !== $file && isset( self::$domain_map[ $domain ] ) && ! is_readable( $file ) ) { // Determine the part of the filename after the domain. $suffix = basename( $file ); $l = strlen( $domain ); if ( substr( $suffix, 0, $l ) !== $domain || '-' !== $suffix[ $l ] ) { return $file; } $suffix = substr( $suffix, $l ); $lang_dir = Jetpack_Constants::get_constant( 'WP_LANG_DIR' ); // Look for replacement files. list( $newdomain, $type ) = self::$domain_map[ $domain ]; $newfile = $lang_dir . ( 'core' === $type ? '/' : "/{$type}/" ) . $newdomain . $suffix; if ( is_readable( $newfile ) ) { return $newfile; } } return $file; } // endregion . } // Enable section folding in vim: // vim: foldmarker=//\ region,//\ endregion foldmethod=marker // . Komentar di: Taat Prokes dan Vaksinasi Efektif Tekan kasus Covid-19 Jelang Ramadhan https://lsisi.id/taat-prokes-dan-vaksinasi-efektif-tekan-kasus-covid-19-jelang-ramadhan/ mengurai sengkarut kabar Thu, 24 Mar 2022 02:12:06 +0000 hourly 1