当前位置: 首页>>代码示例>>PHP>>正文


PHP load_default_textdomain函数代码示例

本文整理汇总了PHP中load_default_textdomain函数的典型用法代码示例。如果您正苦于以下问题:PHP load_default_textdomain函数的具体用法?PHP load_default_textdomain怎么用?PHP load_default_textdomain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了load_default_textdomain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpbc_check_locale_for_ajax

function wpbc_check_locale_for_ajax()
{
    add_bk_filter('wpdev_check_for_active_language', 'wpdev_check_for_active_language');
    // Add Hook for ability  to check  the content for active lanaguges
    if (isset($_POST['wpdev_active_locale'])) {
        // Reload locale according request parameter
        global $l10n;
        if (isset($l10n['booking'])) {
            unset($l10n['booking']);
        }
        if (!defined('WPDEV_BK_LOCALE_RELOAD')) {
            define('WPDEV_BK_LOCALE_RELOAD', $_POST['wpdev_active_locale']);
        }
        // Reload locale settings, its required for the correct  dates format
        if (isset($l10n['default'])) {
            unset($l10n['default']);
        }
        // Unload locale
        add_filter('locale', 'getBookingLocale', 999);
        // Set filter to load the locale of the Booking Calendar
        load_default_textdomain();
        // Load default locale
        global $wp_locale;
        $wp_locale = new WP_Locale();
        // Reload class
        loadLocale(WPDEV_BK_LOCALE_RELOAD);
    }
}
开发者ID:ahmedalaahagag,项目名称:HospitalManagementSystem,代码行数:28,代码来源:wpbc-ajax.php

示例2: __construct

 public function __construct()
 {
     add_shortcode('jQuery Archive List', array($this, 'filter'));
     add_filter('widget_text', 'do_shortcode');
     if (function_exists("load_plugin_textdomain")) {
         load_plugin_textdomain('jalw_i18n', null, basename(dirname(__FILE__)) . '/lang');
     }
     load_default_textdomain();
     parent::WP_Widget('jal_widget', 'jQuery Archive List Widget', array('description' => __(__('A widget for displaying an archive list with some effects.', 'jalw_i18n'))));
 }
开发者ID:slavic18,项目名称:cats,代码行数:10,代码来源:jquery-archive-list-widget.php

示例3: set_language

 public function set_language($lang)
 {
     global $sitepress, $woocommerce;
     $sitepress->switch_lang($lang, true);
     $this->locale = $sitepress->get_locale($lang);
     add_filter('plugin_locale', array($this, 'set_locale'), 10, 2);
     unload_textdomain('woocommerce');
     unload_textdomain('woocommerce-germanized');
     unload_textdomain('woocommerce-germanized-pro');
     unload_textdomain('default');
     $woocommerce->load_plugin_textdomain();
     WC_germanized()->load_plugin_textdomain();
     do_action('woocommerce_gzd_wpml_lang_changed', $lang);
     load_default_textdomain();
     global $wp_locale;
     $wp_locale = new WP_Locale();
 }
开发者ID:ronzeiller,项目名称:woocommerce-germanized,代码行数:17,代码来源:class-wc-gzd-wpml-helper.php

示例4: __construct

 /**
  * Init all the things!
  */
 public function __construct()
 {
     // Init Localisation
     load_default_textdomain();
     load_plugin_textdomain($this::TEXT_DOMAIN, false, dirname(plugin_basename(dirname(__FILE__))) . '/lang');
     // Add admin menu pages
     add_action('admin_menu', [&$this, 'addMenuItems']);
     add_action('admin_init', ['Recras\\Settings', 'registerSettings']);
     add_action('admin_init', ['Recras\\Editor', 'addButtons']);
     add_action('init', [&$this, 'setBaseUrl']);
     add_filter('mce_external_languages', ['Recras\\Editor', 'loadTranslations']);
     add_action('admin_enqueue_scripts', [$this, 'loadAdminScripts']);
     add_action('wp_enqueue_scripts', [$this, 'loadScripts']);
     // Clear caches
     add_action('admin_post_clear_arrangement_cache', ['Recras\\Arrangement', 'clearCache']);
     add_action('admin_post_clear_contactform_cache', ['Recras\\ContactForm', 'clearCache']);
     add_action('admin_post_clear_product_cache', ['Recras\\Products', 'clearCache']);
     $this->addShortcodes();
 }
开发者ID:recras,项目名称:recras-wordpress-plugin,代码行数:22,代码来源:Plugin.php

示例5: switchLanguage

 /**
  * Reload text domains with order locale.
  *
  * @param string $language Language slug (e.g. en, de )
  */
 public function switchLanguage($language)
 {
     if (class_exists('Polylang')) {
         global $locale, $polylang, $woocommerce;
         static $cache;
         // Polylang string translations cache object to avoid loading the same translations object several times
         // Cache object not found. Create one...
         if (empty($cache)) {
             $cache = new \PLL_Cache();
         }
         //$current_language = pll_current_language( 'locale' );
         // unload plugin's textdomains
         unload_textdomain('default');
         unload_textdomain('woocommerce');
         // set locale to order locale
         $locale = apply_filters('locale', $language);
         $polylang->curlang->locale = $language;
         // Cache miss
         if (false === ($mo = $cache->get($language))) {
             $mo = new \PLL_MO();
             $mo->import_from_db($GLOBALS['polylang']->model->get_language($language));
             $GLOBALS['l10n']['pll_string'] =& $mo;
             // Add to cache
             $cache->set($language, $mo);
         }
         // (re-)load plugin's textdomain with order locale
         load_default_textdomain($language);
         $woocommerce->load_plugin_textdomain();
         $wp_locale = new \WP_Locale();
     }
 }
开发者ID:hyyan,项目名称:woo-poly-integration,代码行数:36,代码来源:Emails.php

示例6: wpdev_bk_ajax_responder

function wpdev_bk_ajax_responder()
{
    global $wpdb;
    $action = $_POST['ajax_action'];
    if (isset($_POST['wpdev_active_locale'])) {
        // Reload locale according request parameter
        global $l10n;
        if (isset($l10n['wpdev-booking'])) {
            unset($l10n['wpdev-booking']);
        }
        if (!defined('WPDEV_BK_LOCALE_RELOAD')) {
            define('WPDEV_BK_LOCALE_RELOAD', $_POST['wpdev_active_locale']);
        }
        // Reload locale settings, its required for the correct  dates format
        if (isset($l10n['default'])) {
            unset($l10n['default']);
        }
        // Unload locale
        add_filter('locale', 'getBookingLocale', 999);
        // Set filter to load the locale of the Booking Calendar
        load_default_textdomain();
        // Load default locale
        global $wp_locale;
        $wp_locale = new WP_Locale();
        // Reload class
        loadLocale(WPDEV_BK_LOCALE_RELOAD);
    }
    switch ($action) {
        case 'INSERT_INTO_TABLE':
            wpdev_check_nonce_in_admin_panel($action);
            wpdev_bk_insert_new_booking();
            die;
            break;
        case 'UPDATE_READ_UNREAD':
            wpdev_check_nonce_in_admin_panel();
            make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id']);
            $is_read_or_unread = $_POST["is_read_or_unread"];
            if ($is_read_or_unread == 1) {
                $is_new = '1';
            } else {
                $is_new = '0';
            }
            $id_of_new_bookings = $_POST["booking_id"];
            $arrayof_bookings_id = explode('|', $id_of_new_bookings);
            $user_id = $_POST["user_id"];
            renew_NumOfNewBookings($arrayof_bookings_id, $is_new, $user_id);
            //debuge($arrayof_bookings_id, 'all_array');
            ?>
  <script type="text/javascript">
                    <?php 
            foreach ($arrayof_bookings_id as $bk_id) {
                if ($bk_id == 'all') {
                    $bk_id = 0;
                }
                if ($is_new == '1') {
                    ?>
                                set_booking_row_unread(<?php 
                    echo $bk_id;
                    ?>
);
                            <?php 
                } else {
                    ?>
                                set_booking_row_read(<?php 
                    echo $bk_id;
                    ?>
);                                
                            <?php 
                }
                ?>
                    <?php 
            }
            ?>
                    <?php 
            if ($is_new == '1') {
                ?>
                    //    var my_num = parseInt(jQuery('.bk-update-count').text()) + parseInt(1<?php 
                echo '*' . count($arrayof_bookings_id);
                ?>
);
                    <?php 
            } else {
                ?>
                    //    var my_num = parseInt(jQuery('.bk-update-count').text()) - parseInt(1<?php 
                echo '*' . count($arrayof_bookings_id);
                ?>
);
                    <?php 
            }
            ?>
                    //jQuery('.bk-update-count').html( my_num );
                    document.getElementById('ajax_message').innerHTML = '<?php 
            if ($is_new == '1') {
                echo __('Set as Read', 'wpdev-booking');
            } else {
                echo __('Set as Unread', 'wpdev-booking');
            }
            ?>
';
                    jQuery('#ajax_message').fadeOut(1000);
//.........这里部分代码省略.........
开发者ID:dev-lav,项目名称:htdocs,代码行数:101,代码来源:wpdev-booking-ajax.php

示例7: get_i18n_strings_for_domains

 /**
  * Get all possible translations for a String based on the given Languages and Domains
  *
  * WARNING: This function is slow because it deals with files, so don't overuse it!
  * Differently from the `get_i18n_strings` method this will not use any domain that's not specified.
  *
  * @todo Include support for the `load_theme_textdomain` + `load_muplugin_textdomain`
  *
  * @param  array  $strings          An array of strings (required)
  * @param  array  $languages        Which l10n to fetch the string (required)
  * @param  array  $domains          Possible Domains to re-load
  *
  * @return array                    A multi level array with the possible translations for the given strings
  */
 public function get_i18n_strings_for_domains($strings, $languages, $domains = array('default'))
 {
     foreach ($languages as $language) {
         $this->_locale = $language;
         foreach ((array) $domains as $domain => $file) {
             // Configure the language
             add_filter('locale', array($this, '_set_locale'));
             // Reload it with the correct language
             unload_textdomain($domain);
             if ('default' === $domain) {
                 load_default_textdomain();
             } else {
                 Tribe__Main::instance()->load_text_domain($domain, $file);
             }
             // Loop on the strings the build the possible translations
             foreach ($strings as $key => $value) {
                 $value = is_array($value) ? reset($value) : $value;
                 if (!is_string($value)) {
                     continue;
                 }
                 // Make sure we have an Array
                 $strings[$key] = (array) $strings[$key];
                 // Grab the possible strings for Default and Any other domain
                 if ('default' === $domain) {
                     $strings[$key][] = __($value);
                     $strings[$key][] = __(strtolower($value));
                     $strings[$key][] = __(ucfirst($value));
                 } else {
                     $strings[$key][] = __($value, $domain);
                     $strings[$key][] = __(strtolower($value), $domain);
                     $strings[$key][] = __(ucfirst($value), $domain);
                 }
             }
             // Set back to the default language
             remove_filter('locale', array($this, '_set_locale'));
             // Reload it with the correct language
             unload_textdomain($domain);
             if ('default' === $domain) {
                 load_default_textdomain();
             } else {
                 Tribe__Main::instance()->load_text_domain($domain, $file);
             }
         }
     }
     // Prevent Empty Strings and Duplicates
     foreach ($strings as $key => $value) {
         $strings[$key] = array_filter(array_unique(array_map('sanitize_title_with_dashes', (array) $value)));
     }
     return $strings;
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:64,代码来源:Main.php

示例8: site_language_fix_2

 /**
  * Site language fix 2. Runs after language dropdown.
  * Sets the `return_original` to false.
  */
 public function site_language_fix_2()
 {
     $this->return_original = false;
     load_default_textdomain(get_locale());
 }
开发者ID:rasmusbe,项目名称:custom-admin-language,代码行数:9,代码来源:custom-admin-language.php

示例9: _redirect_to_about_wordpress

/**
 * Redirect to the About WordPress page after a successful upgrade.
 *
 * This function is only needed when the existing install is older than 3.4.0.
 *
 * @since 3.3.0
 *
 * @global string $wp_version
 * @global string $pagenow
 * @global string $action
 *
 * @param string $new_version
 */
function _redirect_to_about_wordpress($new_version)
{
    global $wp_version, $pagenow, $action;
    if (version_compare($wp_version, '3.4-RC1', '>=')) {
        return;
    }
    // Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
    if ('update-core.php' != $pagenow) {
        return;
    }
    if ('do-core-upgrade' != $action && 'do-core-reinstall' != $action) {
        return;
    }
    // Load the updated default text localization domain for new strings.
    load_default_textdomain();
    // See do_core_upgrade()
    show_message(__('WordPress updated successfully'));
    // self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional.
    show_message('<span class="hide-if-no-js">' . sprintf(__('Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.'), $new_version, 'about.php?updated') . '</span>');
    show_message('<span class="hide-if-js">' . sprintf(__('Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.'), $new_version, 'about.php?updated') . '</span>');
    echo '</div>';
    ?>
<script type="text/javascript">
window.location = 'about.php?updated';
</script>
	<?php 
    // Include admin-footer.php and exit.
    include ABSPATH . 'wp-admin/admin-footer.php';
    exit;
}
开发者ID:rlgod,项目名称:WordPress,代码行数:43,代码来源:update-core.php

示例10: _e

</p>

<h1><?php 
        _e('Information needed');
        ?>
</h1>
<p><?php 
        _e('Please provide the following information. Don&#8217;t worry, you can always change these settings later.');
        ?>
</p>

<?php 
        display_setup_form();
        break;
    case 2:
        if (!empty($language) && load_default_textdomain($language)) {
            $loaded_language = $language;
            $GLOBALS['wp_locale'] = new WP_Locale();
        } else {
            $loaded_language = 'en_US';
        }
        if (!empty($wpdb->error)) {
            wp_die($wpdb->error->get_error_message());
        }
        display_header();
        // Fill in the data we gathered
        $weblog_title = isset($_POST['weblog_title']) ? trim(wp_unslash($_POST['weblog_title'])) : '';
        $user_name = isset($_POST['user_name']) ? trim(wp_unslash($_POST['user_name'])) : '';
        $admin_password = isset($_POST['admin_password']) ? wp_unslash($_POST['admin_password']) : '';
        $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash($_POST['admin_password2']) : '';
        $admin_email = isset($_POST['admin_email']) ? trim(wp_unslash($_POST['admin_email'])) : '';
开发者ID:Didox,项目名称:beminfinito,代码行数:31,代码来源:install.php

示例11: get_i18n_strings

 /**
  * Get all possible translations for a String based on the given Languages and Domains
  *
  * WARNING: This function is slow because it deals with files, so don't overuse it!
  *
  * @todo Include support for the `load_theme_textdomain` + `load_muplugin_textdomain`
  *
  * @param  array  $strings          An array of strings (required)
  * @param  array  $languages        Which l10n to fetch the string (required)
  * @param  array  $domains          Possible Domains to re-load
  * @param  string $default_language The default language to avoid re-doing that
  *
  * @return array                    A multi level array with the possible translations for the given strings
  */
 public function get_i18n_strings($strings, $languages, $domains = array(), $default_language = 'en_US')
 {
     $domains = wp_parse_args($domains, array('default' => true, 'the-events-calendar' => $this->pluginDir . 'lang/'));
     foreach ($languages as $language) {
         foreach ((array) $domains as $domain => $file) {
             // Configure the language
             $this->_locale = $language;
             add_filter('locale', array($this, '_set_locale'));
             // Reload it with the correct language
             unload_textdomain($domain);
             if ('default' === $domain) {
                 load_default_textdomain();
             } else {
                 load_plugin_textdomain($domain, false, $file);
             }
             // Loop on the strings the build the possible translations
             foreach ($strings as $key => $value) {
                 $value = is_array($value) ? reset($value) : $value;
                 if (!is_string($value)) {
                     continue;
                 }
                 // Make sure we have an Array
                 $strings[$key] = (array) $strings[$key];
                 // Grab the possible strings for Default and Any other domain
                 if ('default' === $domain) {
                     $strings[$key][] = __($value);
                     $strings[$key][] = __(strtolower($value));
                     $strings[$key][] = __(ucfirst($value));
                 } else {
                     $strings[$key][] = __($value, $domain);
                     $strings[$key][] = __(strtolower($value), $domain);
                     $strings[$key][] = __(ucfirst($value), $domain);
                 }
             }
             // Set back to the default language
             remove_filter('locale', array($this, '_set_locale'));
             // Reload it with the correct language
             unload_textdomain($domain);
             if ('default' === $domain) {
                 load_default_textdomain();
             } else {
                 load_plugin_textdomain($domain, false, $file);
             }
         }
     }
     // Prevent Empty Strings and Duplicates
     foreach ($strings as $key => $value) {
         $strings[$key] = array_filter(array_unique(array_map('sanitize_title_with_dashes', $value)));
     }
     return $strings;
 }
开发者ID:kevinaxu,项目名称:99boulders,代码行数:65,代码来源:Main.php

示例12: change_email_language

 function change_email_language($lang)
 {
     global $sitepress, $woocommerce;
     $sitepress->switch_lang($lang, true);
     $this->locale = $sitepress->get_locale($lang);
     unload_textdomain('woocommerce');
     unload_textdomain('default');
     $woocommerce->load_plugin_textdomain();
     load_default_textdomain();
     global $wp_locale;
     $wp_locale = new WP_Locale();
 }
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:12,代码来源:emails.class.php

示例13: trim

             if (!is_array($value)) {
                 $value = trim($value);
             }
             $value = wp_unslash($value);
         }
         update_option($option, $value);
     }
     /*
      * Switch translation in case WPLANG was changed.
      * The global $locale is used in get_locale() which is
      * used as a fallback in get_user_locale().
      */
     unset($GLOBALS['locale']);
     $user_language_new = get_user_locale();
     if ($user_language_old !== $user_language_new) {
         load_default_textdomain($user_language_new);
     }
 }
 /**
  * Handle settings errors and return to options page
  */
 // If no settings errors were registered add a general 'updated' message.
 if (!count(get_settings_errors())) {
     add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
 }
 set_transient('settings_errors', get_settings_errors(), 30);
 /**
  * Redirect back to the settings page that was submitted
  */
 $goback = add_query_arg('settings-updated', 'true', wp_get_referer());
 wp_redirect($goback);
开发者ID:johnpbloch,项目名称:wordpress,代码行数:31,代码来源:options.php

示例14: load_translations

 /**
  * Load translations for a given locale.
  *
  * When switching to a locale, translations for this locale must be loaded from scratch.
  *
  * @since 4.7.0
  * @access private
  *
  * @global Mo[] $l10n An array of all currently loaded text domains.
  *
  * @param string $locale The locale to load translations for.
  */
 private function load_translations($locale)
 {
     global $l10n;
     $domains = $l10n ? array_keys($l10n) : array();
     load_default_textdomain($locale);
     foreach ($domains as $domain) {
         if ('default' === $domain) {
             continue;
         }
         $mofile = $l10n[$domain]->get_filename();
         unload_textdomain($domain);
         if ($mofile) {
             load_textdomain($domain, $mofile);
         }
         get_translations_for_domain($domain);
     }
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:29,代码来源:class-wp-locale-switcher.php

示例15: bbl_load_content_textdomain

/**
 * Load the textdomain for Babble's content language.
 *
 */
function bbl_load_content_textdomain()
{
    load_default_textdomain(bbl_get_current_content_lang_code());
    $GLOBALS['wp_locale'] = new WP_Locale();
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:9,代码来源:miscellaneous.php


注:本文中的load_default_textdomain函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。