本文整理匯總了PHP中is_textdomain_loaded函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_textdomain_loaded函數的具體用法?PHP is_textdomain_loaded怎麽用?PHP is_textdomain_loaded使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_textdomain_loaded函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wpcf7_load_textdomain
function wpcf7_load_textdomain($locale = null)
{
global $l10n;
$domain = 'contact-form-7';
if (get_locale() == $locale) {
$locale = null;
}
if (empty($locale)) {
if (is_textdomain_loaded($domain)) {
return true;
} else {
return load_plugin_textdomain($domain, false, $domain . '/languages');
}
} else {
$mo_orig = $l10n[$domain];
unload_textdomain($domain);
$mofile = $domain . '-' . $locale . '.mo';
$path = WP_PLUGIN_DIR . '/' . $domain . '/languages';
if ($loaded = load_textdomain($domain, $path . '/' . $mofile)) {
return $loaded;
} else {
$mofile = WP_LANG_DIR . '/plugins/' . $mofile;
return load_textdomain($domain, $mofile);
}
$l10n[$domain] = $mo_orig;
}
return false;
}
示例2: init
public function init()
{
$this->title($this->tab);
if (!is_textdomain_loaded('debug-bar-actions-and-filters-addon')) {
load_plugin_textdomain('debug-bar-actions-and-filters-addon', false, dirname(plugin_basename(__FILE__)) . '/languages');
}
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
}
開發者ID:butuzov,項目名稱:wp-debug-bar-actions-and-filters-addon,代碼行數:9,代碼來源:class-debug-bar-action-and-filters-addon.php
示例3: __construct
function __construct()
{
//@see https://core.trac.wordpress.org/ticket/10527
if (!is_textdomain_loaded('breadcrumb-navxt')) {
load_plugin_textdomain('breadcrumb-navxt', false, 'breadcrumb-navxt/languages');
}
$ops = array('classname' => 'widget_breadcrumb_navxt', 'description' => __('Adds a breadcrumb trail to your sidebar', 'breadcrumb-navxt'));
parent::__construct('bcn_widget', 'Breadcrumb NavXT', $ops);
}
示例4: test_is_textdomain_loaded_for_no_translations
/**
* @ticket 21319
*/
function test_is_textdomain_loaded_for_no_translations()
{
$this->assertFalse(load_textdomain('wp-tests-domain', DIR_TESTDATA . '/non-existent-file'));
$this->assertFalse(is_textdomain_loaded('wp-tests-domain'));
$this->assertInstanceOf('NOOP_Translations', get_translations_for_domain('wp-tests-domain'));
// Ensure that we don't confuse NOOP_Translations to be a loaded text domain.
$this->assertFalse(is_textdomain_loaded('wp-tests-domain'));
$this->assertFalse(unload_textdomain('wp-tests-domain'));
}
示例5: __construct
public function __construct()
{
//@see https://core.trac.wordpress.org/ticket/10527
if (!is_textdomain_loaded('breadcrumb-navxt')) {
load_plugin_textdomain('breadcrumb-navxt', false, 'breadcrumb-navxt/languages');
}
$this->trail =& $this->breadcrumbs;
//Initilize with default option values
$this->opt = array('bmainsite_display' => true, 'Hmainsite_template' => bcn_breadcrumb::get_default_template(), 'Hmainsite_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'bhome_display' => true, 'Hhome_template' => bcn_breadcrumb::get_default_template(), 'Hhome_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'bblog_display' => true, 'Hblog_template' => bcn_breadcrumb::get_default_template(), 'Hblog_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'hseparator' => ' > ', 'blimit_title' => false, 'amax_title_length' => 20, 'bcurrent_item_linked' => false, 'Hpost_page_template' => bcn_breadcrumb::get_default_template(), 'Hpost_page_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'apost_page_root' => get_option('page_on_front'), 'Hpaged_template' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Page %htitle%</span><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'bpaged_display' => false, 'Hpost_post_template' => bcn_breadcrumb::get_default_template(), 'Hpost_post_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'apost_post_root' => get_option('page_for_posts'), 'bpost_post_taxonomy_display' => true, 'Spost_post_taxonomy_type' => 'category', 'Hpost_attachment_template' => bcn_breadcrumb::get_default_template(), 'Hpost_attachment_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'H404_template' => bcn_breadcrumb::default_template_no_anchor, 'S404_title' => __('404', 'breadcrumb-navxt'), 'Hsearch_template' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Search results for '<a property="item" typeof="WebPage" title="Go to the first page of search results for %title%." href="%link%" class="%type%">%htitle%</a>'</span><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Hsearch_template_no_anchor' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Search results for '%htitle%'</span><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Htax_post_tag_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% tag archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Htax_post_tag_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'Htax_post_format_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Htax_post_format_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'Hauthor_template' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Articles by: <a title="Go to the first page of posts by %title%." href="%link%" class="%type%">%htitle%</a>', 'breadcrumb-navxt'), 'Hauthor_template_no_anchor' => __('<span property="itemListElement" typeof="ListItem"><span property="name">Articles by: %htitle%</span><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Sauthor_name' => 'display_name', 'Htax_category_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% category archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Htax_category_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor, 'Hdate_template' => __('<span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" title="Go to the %title% archives." href="%link%" class="%type%"><span property="name">%htitle%</span></a><meta property="position" content="%position%"></span>', 'breadcrumb-navxt'), 'Hdate_template_no_anchor' => bcn_breadcrumb::default_template_no_anchor);
}
示例6: test_load_unload_textdomain
function test_load_unload_textdomain()
{
$this->assertFalse(is_textdomain_loaded('wp-tests-domain'));
$this->assertFalse(unload_textdomain('wp-tests-domain'));
$file = DIR_TESTDATA . '/pomo/simple.mo';
$this->assertTrue(load_textdomain('wp-tests-domain', $file));
$this->assertTrue(is_textdomain_loaded('wp-tests-domain'));
$this->assertTrue(unload_textdomain('wp-tests-domain'));
$this->assertFalse(is_textdomain_loaded('wp-tests-domain'));
}
示例7: test_theme_translation_should_be_translated_without_calling_load_theme_textdomain
/**
* @ticket 34114
*/
public function test_theme_translation_should_be_translated_without_calling_load_theme_textdomain()
{
add_filter('locale', array($this, 'filter_set_locale_to_german'));
switch_theme('internationalized-theme');
include_once get_stylesheet_directory() . '/functions.php';
$is_textdomain_loaded_before = is_textdomain_loaded('internationalized-theme');
$expected_output = i18n_theme_test();
$is_textdomain_loaded_after = is_textdomain_loaded('internationalized-theme');
unload_textdomain('internationalized-theme');
remove_filter('locale', array($this, 'filter_set_locale_to_german'));
$this->assertFalse($is_textdomain_loaded_before);
$this->assertSame('Das ist ein Dummy Theme', $expected_output);
$this->assertTrue($is_textdomain_loaded_after);
}
示例8: bogo_languages
function bogo_languages()
{
static $languages = array();
static $textdomain_loaded = false;
if ($languages && $textdomain_loaded) {
return apply_filters('bogo_languages', $languages);
}
$languages = array('af' => __('Afrikaans', 'bogo'), 'am' => __('Amharic', 'bogo'), 'an' => __('Aragonese', 'bogo'), 'ar' => __('Arabic', 'bogo'), 'as' => __('Assamese', 'bogo'), 'az' => __('Azerbaijani', 'bogo'), 'be_BY' => __('Belarusian', 'bogo'), 'bg_BG' => __('Bulgarian', 'bogo'), 'bn_BD' => __('Bangla', 'bogo'), 'bn_IN' => __('Indian Bengali', 'bogo'), 'bo' => __('Tibetan', 'bogo'), 'bs_BA' => __('Bosnian', 'bogo'), 'ca' => __('Catalan', 'bogo'), 'ckb' => __('Central Kurdish', 'bogo'), 'co' => __('Corsican', 'bogo'), 'cs_CZ' => __('Czech', 'bogo'), 'cy' => __('Welsh', 'bogo'), 'da_DK' => __('Danish', 'bogo'), 'de_DE' => __('German', 'bogo'), 'de_DE_formal' => __('German (Formal)', 'bogo'), 'de_CH' => __('German (Switzerland)', 'bogo'), 'dv' => __('Dhivehi', 'bogo'), 'el' => __('Greek', 'bogo'), 'en_US' => __('English (United States)', 'bogo'), 'en_AU' => __('English (Australia)', 'bogo'), 'en_CA' => __('English (Canada)', 'bogo'), 'en_GB' => __('English (UK)', 'bogo'), 'eo' => __('Esperanto', 'bogo'), 'es_ES' => __('Spanish (Spain)', 'bogo'), 'es_CL' => __('Spanish (Chile)', 'bogo'), 'es_CO' => __('Spanish (Colombia)', 'bogo'), 'es_MX' => __('Spanish (Mexico)', 'bogo'), 'es_PE' => __('Spanish (Peru)', 'bogo'), 'es_VE' => __('Spanish (Venezuela)', 'bogo'), 'et' => __('Estonian', 'bogo'), 'eu' => __('Basque', 'bogo'), 'fa_IR' => __('Persian', 'bogo'), 'fi' => __('Finnish', 'bogo'), 'fo' => __('Faroese', 'bogo'), 'fr_FR' => __('French (France)', 'bogo'), 'fy' => __('Frisian', 'bogo'), 'ga' => __('Irish', 'bogo'), 'gd' => __('Scottish Gaelic', 'bogo'), 'gl_ES' => __('Galician', 'bogo'), 'gu' => __('Gujarati', 'bogo'), 'haz' => __('Hazaragi', 'bogo'), 'he_IL' => __('Hebrew', 'bogo'), 'hi_IN' => __('Hindi', 'bogo'), 'hr' => __('Croatian', 'bogo'), 'ht' => __('Haitian', 'bogo'), 'hu_HU' => __('Hungarian', 'bogo'), 'hy' => __('Armenian', 'bogo'), 'id_ID' => __('Indonesian', 'bogo'), 'is_IS' => __('Icelandic', 'bogo'), 'it_IT' => __('Italian', 'bogo'), 'ja' => __('Japanese', 'bogo'), 'jv_ID' => __('Javanese', 'bogo'), 'ka_GE' => __('Georgian', 'bogo'), 'kk' => __('Kazakh', 'bogo'), 'km_KH' => __('Khmer', 'bogo'), 'kn' => __('Kannada', 'bogo'), 'ko_KR' => __('Korean', 'bogo'), 'li' => __('Limburgish', 'bogo'), 'lo' => __('Lao', 'bogo'), 'lt_LT' => __('Lithuanian', 'bogo'), 'lv' => __('Latvian', 'bogo'), 'mg_MG' => __('Malagasy', 'bogo'), 'mk_MK' => __('Macedonian', 'bogo'), 'ml_IN' => __('Malayalam', 'bogo'), 'mn' => __('Mongolian', 'bogo'), 'mr' => __('Marathi', 'bogo'), 'ms_MY' => __('Malay', 'bogo'), 'mt_MT' => __('Maltese', 'bogo'), 'my_MM' => __('Burmese', 'bogo'), 'nb_NO' => __('Norwegian (Bokmål)', 'bogo'), 'ne_NP' => __('Nepali', 'bogo'), 'ni_ID' => __('Nias', 'bogo'), 'nl_NL' => __('Dutch', 'bogo'), 'nn_NO' => __('Norwegian (Nynorsk)', 'bogo'), 'oci' => __('Occitan', 'bogo'), 'os' => __('Ossetic', 'bogo'), 'pa_IN' => __('Punjabi', 'bogo'), 'pl_PL' => __('Polish', 'bogo'), 'ps' => __('Pashto', 'bogo'), 'pt_BR' => __('Portuguese (Brazil)', 'bogo'), 'pt_PT' => __('Portuguese (Portugal)', 'bogo'), 'ro_RO' => __('Romanian', 'bogo'), 'ru_RU' => __('Russian', 'bogo'), 'sa_IN' => __('Sanskrit', 'bogo'), 'si_LK' => __('Sinhala', 'bogo'), 'sk_SK' => __('Slovak', 'bogo'), 'sl_SI' => __('Slovenian', 'bogo'), 'so_SO' => __('Somali', 'bogo'), 'sq' => __('Albanian', 'bogo'), 'sr_RS' => __('Serbian', 'bogo'), 'sv_SE' => __('Swedish', 'bogo'), 'su_ID' => __('Sundanese', 'bogo'), 'sw' => __('Swahili', 'bogo'), 'ta_IN' => __('Tamil', 'bogo'), 'te' => __('Telugu', 'bogo'), 'tg' => __('Tajik', 'bogo'), 'th' => __('Thai', 'bogo'), 'tl' => __('Tagalog', 'bogo'), 'tr_TR' => __('Turkish', 'bogo'), 'tt_RU' => __('Tatar', 'bogo'), 'ug_CN' => __('Uighur', 'bogo'), 'uk' => __('Ukrainian', 'bogo'), 'ur' => __('Urdu', 'bogo'), 'uz_UZ' => __('Uzbek', 'bogo'), 'vi' => __('Vietnamese', 'bogo'), 'zh_CN' => __('Chinese (China)', 'bogo'), 'zh_TW' => __('Chinese (Taiwan)', 'bogo'));
if (is_textdomain_loaded('bogo')) {
$textdomain_loaded = true;
}
asort($languages, SORT_STRING);
return apply_filters('bogo_languages', $languages);
}
示例9: __construct
private function __construct()
{
if (defined('DOING_CRON') || !current_user_can('backwpup') || !is_admin_bar_showing() || !get_site_option('backwpup_cfg_showadminbar')) {
return;
}
//load text domain
if (!is_textdomain_loaded('backwpup')) {
load_plugin_textdomain('backwpup', FALSE, BackWPup::get_plugin_data('BaseName') . '/languages');
}
//add admin bar. Works only in init
add_action('admin_bar_menu', array($this, 'adminbar'), 100);
//admin css
add_action('wp_head', array('BackWPup_Admin', 'admin_head'));
}
示例10: init
/**
* Constructor.
*/
public function init()
{
if (!class_exists('Debug_Bar_Pretty_Output') && class_exists('Debug_Bar_Panel')) {
require_once plugin_dir_path(__FILE__) . 'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php';
}
if (!class_exists('Debug_Bar_List_PHP_Classes')) {
require_once plugin_dir_path(__FILE__) . 'inc/debug-bar-pretty-output/class-debug-bar-list-php-classes.php';
}
if (!is_textdomain_loaded(self::DBC_NAME)) {
load_plugin_textdomain(self::DBC_NAME, false, dirname(plugin_basename(__FILE__)) . '/languages');
}
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
}
示例11: fix_woocommerce
/**
* Fix for WooCommerce so it can handle custom admin language without breaking non-admin pages.
*
* @return bool If true set_language will use site language, otherwise custom language.
*/
public function fix_woocommerce()
{
// Check if WooCommerce is active.
$active_plugins = get_option('active_plugins');
if (is_multisite()) {
$active_plugins = array_merge($active_plugins, array_keys(get_site_option('active_sitewide_plugins')));
}
if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', $active_plugins), true)) {
return false;
}
if (function_exists('is_ajax') && is_ajax() || !empty($_GET['wc-ajax'])) {
return true;
}
// @codingStandardsIgnoreStart - Ignore rule against processing postdata without nonce
if (isset($_POST['wc_order_action'])) {
return true;
}
// @codingStandardsIgnoreEnd
// Do not translate WooCommerce when creating pages or upgrade langs
if (!empty($_GET['page']) && $_GET['page'] === 'wc-settings' && !empty($_GET['install_woocommerce_pages']) || !empty($_GET['page']) && $_GET['page'] === 'wc-status' && !empty($_GET['action']) && $_GET['action'] === 'install_pages' || !empty($_GET['page']) && $_GET['page'] === 'wc-status' && !empty($_GET['action']) && $_GET['action'] === 'translation_upgrade') {
return true;
}
// Set WooCommerce permalinks to site language if not set. Will otherwise break permalinks.
$this->return_original = true;
$permalinks = get_option('woocommerce_permalinks');
if (empty($permalinks)) {
$permalinks = [];
}
$was_loaded = false;
if (empty($permalinks['category_base']) || empty($permalinks['tag_base'])) {
if (is_textdomain_loaded('woocommerce')) {
$was_loaded = true;
}
load_plugin_textdomain('woocommerce', false, WP_PLUGIN_DIR . '/woocommerce/i18n/languages');
if (empty($permalinks['category_base'])) {
$permalinks['category_base'] = _x('product-category', 'slug', 'woocommerce');
}
if (empty($permalinks['tag_base'])) {
$permalinks['tag_base'] = _x('product-tag', 'slug', 'woocommerce');
}
update_option('woocommerce_permalinks', $permalinks);
unload_textdomain('woocommerce');
}
$this->return_original = false;
// Reload WooCommerce textdomain
if ($was_loaded) {
load_plugin_textdomain('woocommerce', false, WP_PLUGIN_DIR . '/woocommerce/i18n/languages');
}
}
示例12: init
public function init()
{
// bail if the plugin is in network mode
if ($this->args['network']) {
return;
}
// gPlugin Local:
// if ( ! is_textdomain_loaded( GPLUGIN_TEXTDOMAIN ) )
// load_plugin_textdomain( GPLUGIN_TEXTDOMAIN, FALSE, 'gplugin/languages' );
// Parent Plugin Local:
if (!is_textdomain_loaded($this->args['domain'])) {
$this->load_textdomain();
}
// init here to help filtering the templates
if (isset($this->constants['class_mustache'])) {
call_user_func(array($this->constants['class_mustache'], 'init'));
}
}
示例13: __construct
/**
*
* Set needed filters and actions and load all needed
*
* @return \BackWPup_Admin
*/
public function __construct()
{
//Load text domain
if (!is_textdomain_loaded('backwpup')) {
load_plugin_textdomain('backwpup', FALSE, BackWPup::get_plugin_data('BaseName') . '/languages');
}
//Add menu pages
add_filter('backwpup_admin_pages', array($this, 'admin_page_jobs'), 2);
add_filter('backwpup_admin_pages', array($this, 'admin_page_editjob'), 3);
add_filter('backwpup_admin_pages', array($this, 'admin_page_logs'), 4);
add_filter('backwpup_admin_pages', array($this, 'admin_page_backups'), 5);
add_filter('backwpup_admin_pages', array($this, 'admin_page_settings'), 6);
add_filter('backwpup_admin_pages', array($this, 'admin_page_about'), 20);
//Add Menu
if (is_multisite()) {
add_action('network_admin_menu', array($this, 'admin_menu'));
} else {
add_action('admin_menu', array($this, 'admin_menu'));
}
//add Plugin links
add_filter('plugin_row_meta', array($this, 'plugin_links'), 10, 2);
//add more actions
add_action('admin_init', array($this, 'admin_init'));
//add more actions
add_action('admin_head', array($this, 'admin_head'));
//Save Form posts general
add_action('admin_post_backwpup', array($this, 'save_post_form'));
//Admin Footer Text replacement
add_filter('admin_footer_text', array($this, 'admin_footer_text'), 100);
add_filter('update_footer', array($this, 'update_footer'), 100);
//User Profile fields
add_action('show_user_profile', array($this, 'user_profile_fields'));
add_action('edit_user_profile', array($this, 'user_profile_fields'));
add_action('profile_update', array($this, 'save_profile_update'));
add_filter('editable_roles', array($this, 'editable_roles'));
add_filter('manage_users_columns', array($this, 'manage_users_columns'));
add_filter('manage_users_custom_column', array($this, 'manage_users_custom_column'), 10, 3);
//Change Backup message on core updates
add_filter('gettext', array($this, 'gettext'), 10, 3);
//Plugin banner free
/*if ( ! class_exists( 'BackWPup_Pro', FALSE ) )
add_action( 'admin_notices', array( $this, 'get_pro_banner' ) );*/
}
示例14: create
//.........這裏部分代碼省略.........
$this->log_level = 'normal_translated';
}
//create log file
$head = '';
$info = '';
$head .= "<!DOCTYPE html>" . PHP_EOL;
$head .= "<html lang=\"" . str_replace('_', '-', get_locale()) . "\">" . PHP_EOL;
$head .= "<head>" . PHP_EOL;
$head .= "<meta charset=\"" . get_bloginfo('charset') . "\" />" . PHP_EOL;
$head .= "<title>" . sprintf(__('BackWPup log for %1$s from %2$s at %3$s', 'backwpup'), $this->job['name'], date_i18n(get_option('date_format')), date_i18n(get_option('time_format'))) . "</title>" . PHP_EOL;
$head .= "<meta name=\"robots\" content=\"noindex, nofollow\" />" . PHP_EOL;
$head .= "<meta name=\"copyright\" content=\"Copyright © 2012 - " . date('Y') . " Inpsyde GmbH\" />" . PHP_EOL;
$head .= "<meta name=\"author\" content=\"Inpsyde GmbH\" />" . PHP_EOL;
$head .= "<meta name=\"generator\" content=\"BackWPup " . BackWPup::get_plugin_data('Version') . "\" />" . PHP_EOL;
$head .= "<meta http-equiv=\"cache-control\" content=\"no-cache\" />" . PHP_EOL;
$head .= "<meta http-equiv=\"pragma\" content=\"no-cache\" />" . PHP_EOL;
$head .= "<meta name=\"date\" content=\"" . date('c') . "\" />" . PHP_EOL;
$head .= str_pad('<meta name="backwpup_errors" content="0" />', 100) . PHP_EOL;
$head .= str_pad('<meta name="backwpup_warnings" content="0" />', 100) . PHP_EOL;
$head .= "<meta name=\"backwpup_jobid\" content=\"" . $this->job['jobid'] . "\" />" . PHP_EOL;
$head .= "<meta name=\"backwpup_jobname\" content=\"" . esc_attr($this->job['name']) . "\" />" . PHP_EOL;
$head .= "<meta name=\"backwpup_jobtype\" content=\"" . implode('+', $this->job['type']) . "\" />" . PHP_EOL;
$head .= str_pad('<meta name="backwpup_backupfilesize" content="0" />', 100) . PHP_EOL;
$head .= str_pad('<meta name="backwpup_jobruntime" content="0" />', 100) . PHP_EOL;
$head .= '</head>' . PHP_EOL;
$head .= '<body style="margin:0;padding:3px;font-family:monospace;font-size:12px;line-height:15px;background-color:black;color:#c0c0c0;white-space:nowrap;">' . PHP_EOL;
$info .= sprintf(_x('[INFO] %1$s %2$s; A project of Inpsyde GmbH', 'Plugin name; Plugin Version; plugin url', 'backwpup'), BackWPup::get_plugin_data('name'), BackWPup::get_plugin_data('Version'), __('http://backwpup.com', 'backwpup')) . '<br />' . PHP_EOL;
$info .= sprintf(_x('[INFO] WordPress %1$s on %2$s', 'WordPress Version; Blog url', 'backwpup'), BackWPup::get_plugin_data('wp_version'), esc_attr(site_url('/'))) . '<br />' . PHP_EOL;
$level = __('Normal', 'backwpup');
$translated = '';
if ($this->is_debug()) {
$level = __('Debug', 'backwpup');
}
if (is_textdomain_loaded('backwpup')) {
$translated = __('(translated)', 'backwpup');
}
$info .= sprintf(__('[INFO] Log Level: %1$s %2$s', 'backwpup'), $level, $translated) . '<br />' . PHP_EOL;
$job_name = esc_attr($this->job['name']);
if ($this->is_debug()) {
$job_name .= '; ' . implode('+', $this->job['type']);
}
$info .= sprintf(__('[INFO] BackWPup job: %1$s', 'backwpup'), $job_name) . '<br />' . PHP_EOL;
if ($this->is_debug()) {
$current_user = wp_get_current_user();
$info .= sprintf(__('[INFO] Runs with user: %1$s (%2$d) ', 'backwpup'), $current_user->user_login, $current_user->ID) . '<br />' . PHP_EOL;
}
if ($this->job['activetype'] === 'wpcron') {
//check next run
$cron_next = wp_next_scheduled('backwpup_cron', array('id' => $this->job['jobid']));
if (!$cron_next || $cron_next < time()) {
wp_unschedule_event($cron_next, 'backwpup_cron', array('id' => $this->job['jobid']));
$cron_next = BackWPup_Cron::cron_next($this->job['cron']);
wp_schedule_single_event($cron_next, 'backwpup_cron', array('id' => $this->job['jobid']));
$cron_next = wp_next_scheduled('backwpup_cron', array('id' => $this->job['jobid']));
}
//output scheduling
if ($this->is_debug()) {
if (!$cron_next) {
$cron_next = __('Not scheduled!', 'backwpup');
} else {
$cron_next = date_i18n('D, j M Y @ H:i', $cron_next + get_option('gmt_offset') * 3600, true);
}
$info .= sprintf(__('[INFO] Cron: %s; Next: %s ', 'backwpup'), $this->job['cron'], $cron_next) . '<br />' . PHP_EOL;
}
} elseif ($this->job['activetype'] == 'link' && $this->is_debug()) {
$info .= __('[INFO] BackWPup job start with link is active', 'backwpup') . '<br />' . PHP_EOL;
示例15: load_text_domain
/**
* Load Plugin Translation
*
* @return bool Text domain loaded
*/
public static function load_text_domain()
{
if (is_textdomain_loaded('backwpup')) {
return TRUE;
}
return load_plugin_textdomain('backwpup', false, dirname(plugin_basename(__FILE__)) . '/languages');
}