/** * Load our plugin textdomain */ public static function load_our_textdomain() { $loaded = load_plugin_textdomain('wp-libre-form', false, dirname(plugin_basename(__FILE__)) . '/lang/'); if (!$loaded) { $loaded = load_muplugin_textdomain('wp-libre-form', dirname(plugin_basename(__FILE__)) . '/lang/'); } }
/** * PHP5 Constructor * **/ function __construct() { // get number of field sets $this->fields = isset($_GET['fields']) ? $_GET['fields'] : ''; // default to 15 field sets if ($this->fields == '') { $this->fields = 15; } // no more than 50 fields sets if ($this->fields > 50) { $this->fields = 50; } // activate or upgrade if (isset($_GET['page']) && $_GET['page'] == 'add-new-users') { $this->make_current(); } // add admin menu page add_action('admin_menu', array(&$this, 'plug_pages')); // load text domain if (defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . '/add-new-users.php')) { load_muplugin_textdomain('add_new_users', 'add-new-users-files/languages'); } else { load_plugin_textdomain('add_new_users', false, dirname(plugin_basename(__FILE__)) . '/add-new-users-files/languages'); } }
function load_textdomain() { if (preg_match('/mu\\-plugin/', PLUGINDIR) > 0) { load_muplugin_textdomain('postindexer', false, dirname(dirname(plugin_basename(__FILE__))) . '/languages/'); } else { load_plugin_textdomain('postindexer', false, dirname(dirname(plugin_basename(__FILE__))) . '/languages/'); } }
public static function loadTextdomain() { // Load translations first from the languages directory $locale = apply_filters('plugin_locale', get_locale(), $domain); load_textdomain($domain, WP_LANG_DIR . '/my-plugin/' . self::$domain . '-' . $locale . '.mo'); // And then from this plugin folder load_muplugin_textdomain('wpp', basename(dirname(__FILE__)) . '/languages'); }
static function register() { if (defined('EM_VERSION')) { return; } load_muplugin_textdomain('redelivre', 'agenda/languages'); register_post_type('agenda', array('labels' => array('name' => _x('Evento', 'post type general name', 'redelivre'), 'singular_name' => _x('Evento', 'post type singular name', 'redelivre'), 'add_new' => _x('Adicionar novo', 'image', 'redelivre'), 'add_new_item' => __('Adicionar novo evento', 'redelivre'), 'edit_item' => __('Editar evento', 'redelivre'), 'new_item' => __('Novo evento', 'redelivre'), 'view_item' => __('Ver evento', 'redelivre'), 'search_items' => __('Buscar eventos', 'redelivre'), 'not_found' => __('Nenhum evento encontrado', 'redelivre'), 'not_found_in_trash' => __('Nenhum evento encontrado na lixeira', 'redelivre'), 'parent_item_colon' => ''), 'public' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 10, 'has_archive' => true, 'supports' => array('title', 'editor', 'thumbnail'))); }
public function bootstrap() { if ($this->is_mu_plugin) { load_muplugin_textdomain('wp-js-plugin'); } else { load_plugin_textdomain('wp-js-plugin'); } $core = WP_JS_Plugin_Core::instance(); add_action('init', array($core, 'maybe_bootstrap_admin')); add_action('rest_api_init', array($core, 'bootstrap_api'), 10, 1); }
/** * Loads the plugin text domain for translation */ public function plugin_textdomain() { $domain = 'acfsync'; $locale = apply_filters('plugin_locale', get_locale(), $domain); load_textdomain($domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo'); if (false !== strpos(__FILE__, basename(WPMU_PLUGIN_DIR))) { load_muplugin_textdomain($domain, dirname(plugin_basename(__FILE__)) . '/lang/'); } else { load_plugin_textdomain($domain, FALSE, dirname(plugin_basename(__FILE__)) . '/lang/'); } }
function incsub_support_init() { global $wpdb, $ticket_status, $ticket_priority, $incsub_support_page, $incsub_support_page_long; if (preg_match('/mu\\-plugin/', __FILE__) > 0) { load_muplugin_textdomain(INCSUB_SUPPORT_LANG_DOMAIN, dirname(plugin_basename(__FILE__)) . '/languages'); } else { load_plugin_textdomain(INCSUB_SUPPORT_LANG_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/languages'); } if (is_admin()) { wp_register_style('incsub_support_admin_css', plugins_url('incsub-support/css/wp_admin.css'), array(), INCSUB_SUPPORT_VERSION); wp_register_script('incsub_support_admin_js', plugins_url('incsub-support/js/wp_admin.js'), array('jquery'), INCSUB_SUPPORT_VERSION, true); } $wpdb->tickets = incsub_support_tablename('tickets'); $wpdb->tickets_messages = incsub_support_tablename('tickets_messages'); $wpdb->tickets_cats = incsub_support_tablename('tickets_cats'); $wpdb->faq = incsub_support_tablename('faq'); $wpdb->faq_cats = incsub_support_tablename('faq_cats'); $ticket_priority = array(0 => __("Low", INCSUB_SUPPORT_LANG_DOMAIN), 1 => __("Normal", INCSUB_SUPPORT_LANG_DOMAIN), 2 => __("Elevated", INCSUB_SUPPORT_LANG_DOMAIN), 3 => __("High", INCSUB_SUPPORT_LANG_DOMAIN), 4 => __("Critical", INCSUB_SUPPORT_LANG_DOMAIN)); $ticket_status = array(0 => __("New", INCSUB_SUPPORT_LANG_DOMAIN), 1 => __("In progress", INCSUB_SUPPORT_LANG_DOMAIN), 2 => __("Waiting on User to reply", INCSUB_SUPPORT_LANG_DOMAIN), 3 => __("Waiting on Admin to reply", INCSUB_SUPPORT_LANG_DOMAIN), 4 => __("Stalled", INCSUB_SUPPORT_LANG_DOMAIN), 5 => __("Closed", INCSUB_SUPPORT_LANG_DOMAIN)); $incsub_support_imap = get_site_option('incsub_support_imap', array('host' => 'imap.gmail.com', 'port' => '993', 'ssl' => '/ssl', 'mailbox' => 'INBOX', 'username' => '', 'password' => '')); if (isset($_POST['incsub_support_menu_name'])) { update_site_option('incsub_support_menu_name', $_POST['incsub_support_menu_name']); } if (isset($_POST['incsub_support_from_name'])) { update_site_option('incsub_support_from_name', $_POST['incsub_support_from_name']); } if (isset($_POST['incsub_support_from_mail'])) { update_site_option('incsub_support_from_mail', $_POST['incsub_support_from_mail']); } if (isset($_POST['incsub_support_fetch_imap'])) { update_site_option('incsub_support_fetch_imap', $_POST['incsub_support_fetch_imap']); if (get_site_option('incsub_support_imap_frequency', '') != $_POST['incsub_support_imap_frequency']) { if (wp_reschedule_event(0, $_POST['incsub_support_imap_frequency'], 'incsub_support_fetch_imap') === false) { wp_schedule_event(0, $_POST['incsub_support_imap_frequency'], 'incsub_support_fetch_imap'); } update_site_option('incsub_support_imap_frequency', $_POST['incsub_support_imap_frequency']); } if (empty($_POST['incsub_support_imap']['password'])) { $_POST['incsub_support_imap']['password'] = $incsub_support_imap['password']; } update_site_option('incsub_support_imap', $_POST['incsub_support_imap']); if (isset($_POST['test']) && $_POST['incsub_support_fetch_imap'] == "enabled") { if (incsub_support_fetch_imap()) { wp_redirect("{$incsub_support_settings_page}?page=support-options&updated=true&tested=true"); } else { wp_redirect("{$incsub_support_settings_page}?page=support-options&updated=true&tested=false"); } } else { wp_redirect("{$incsub_support_settings_page}?page=support-options&updated=true"); } } }
public function loadTextDomain($domain = null, $path = null) { /** @var PluginInterface $this */ $domain = $domain !== null ? $domain : $this->getTextDomain(); $path = $path !== null ? $path : $this->getDomainPath(); $file = wp_normalize_path($this->getFile()); $muPluginDir = wp_normalize_path(WPMU_PLUGIN_DIR); if (strpos($file, $muPluginDir) === 0) { $path = basename($this->getDirectory()) . $path; return load_muplugin_textdomain($domain, $path); } return load_plugin_textdomain($domain, false, $path); }
/** * PHP 5 constructor **/ function __construct() { add_action('login_init', array($this, 'clean_redirect')); add_filter('wp_logout', array(&$this, 'redirect')); add_action('wpmu_options', array(&$this, 'network_option')); add_action('update_wpmu_options', array(&$this, 'update_network_option')); add_action('admin_init', array(&$this, 'add_settings_field')); // load text domain if (defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . '/logout-redirect.php')) { load_muplugin_textdomain('logout_redirect', 'logout-redirect-files/languages'); } else { load_plugin_textdomain('logout_redirect', false, dirname(plugin_basename(__FILE__)) . '/logout-redirect-files/languages'); } }
/** * PHP 5 Constructor * * @since 1.0 */ function __construct() { global $wp_version; if (defined('WPMU_PLUGIN_DIR') && strpos(__FILE__, WPMU_PLUGIN_DIR) === false) { $this->thispluginpath = WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)) . '/'; $this->thispluginurl = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/'; load_plugin_textdomain($this->localization_domain, false, dirname(plugin_basename(__FILE__)) . '/languages/'); } else { $this->thispluginpath = WPMU_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)) . '/'; $this->thispluginurl = WPMU_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/'; load_muplugin_textdomain($this->localization_domain, '/blogtemplatesfiles/languages/'); } $this->currenturl_with_querystring = is_ssl() ? 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; // Initialize the options $this->get_options(); // Add the super admin page if (version_compare($wp_version, '3.0.9', '>')) { add_action('network_admin_menu', array($this, 'network_admin_page')); } else { add_action('admin_menu', array($this, 'pre_3_1_network_admin_page')); } // Admin notices and data processing add_action('network_admin_notices', array($this, 'admin_options_page_posted')); add_action('admin_notices', array($this, 'admin_options_page_posted')); // Actions $action_order = defined('NBT_APPLY_TEMPLATE_ACTION_ORDER') && NBT_APPLY_TEMPLATE_ACTION_ORDER ? NBT_APPLY_TEMPLATE_ACTION_ORDER : 9999; add_action('wpmu_new_blog', array($this, 'set_blog_defaults'), apply_filters('blog_templates-actions-action_order', $action_order), 6); // Set to *very high* so this runs after every other action; also, accepts 6 params so we can get to meta add_action('admin_footer', array($this, 'add_template_dd')); add_action('wp_enqueue_scripts', create_function('', 'wp_enqueue_script("jquery");')); // Special features for Multi-Domains add_action('add_multi_domain_form_field', array($this, 'multi_domain_form_field')); // add field to domain addition form add_action('edit_multi_domain_form_field', array($this, 'multi_domain_form_field')); // add field to domain edition form add_filter('md_update_domain', array($this, 'multi_domain_update_domain'), 10, 2); // saves blog template value on domain update add_filter('manage_multi_domains_columns', array($this, 'manage_multi_domains_columns')); // add column to multi domain table add_action('manage_multi_domains_custom_column', array($this, 'manage_multi_domains_custom_column'), 10, 2); // populate blog template column in multi domain table add_action('blogs_directory_blogs_list', array($this, 'blogs_directory_blogs_list')); // Signup: WordPress add_action('signup_blogform', array($this, 'registration_template_selection')); add_filter('add_signup_meta', array($this, 'registration_template_selection_add_meta')); // Signup: BuddyPress add_action('bp_after_blog_details_fields', array($this, 'registration_template_selection')); add_filter('bp_signup_usermeta', array($this, 'registration_template_selection_add_meta')); }
/** * Load CMB text domain * @since 2.0.0 */ public function l10ni18n() { $loaded = load_plugin_textdomain('cmb2', false, '/languages/'); if (!$loaded) { $loaded = load_muplugin_textdomain('cmb2', '/languages/'); } if (!$loaded) { $loaded = load_theme_textdomain('cmb2', '/languages/'); } if (!$loaded) { $locale = apply_filters('plugin_locale', get_locale(), 'cmb2'); $mofile = dirname(__FILE__) . '/languages/cmb2-' . $locale . '.mo'; load_textdomain('cmb2', $mofile); } }
/** * Load translation file */ private function load_plugin_textdomain($lang_dir = 'languages') { // Check load static $loaded; if (isset($loaded)) { return; } $loaded = true; // Check if this plugin is placed in wp-content/mu-plugins directory or subdirectory if (('mu-plugins' == basename(dirname(__FILE__)) || 'mu-plugins' == basename(dirname(dirname(__FILE__)))) && function_exists('load_muplugin_textdomain')) { load_muplugin_textdomain($this->key, ('mu-plugins' == basename(dirname(__FILE__)) ? '' : basename(dirname(__FILE__)) . '/') . $lang_dir); // Usual wp-content/plugins directory location } else { load_plugin_textdomain($this->key, false, basename(dirname(__FILE__)) . '/' . $lang_dir); } }
function __construct() { global $wp_version; include_once 'external/wpmudev-dash-notification.php'; if (!function_exists('is_plugin_active_for_network')) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } //Check for backwards compatibility $uploaddir = $this->upload_dir(); $login_image_old = $this->get_option('ub_login_image_url', false); $login_image = $this->get_option('ub_login_image', false); // Check for backwards compatibility if (!isset($login_image_old) || $login_image_old == '') { //there is no any old record if (!$login_image) { //add default image if not exists $response = wp_remote_head(admin_url() . 'images/wordpress-logo.svg'); if (!is_wp_error($response) && !empty($response['response']['code']) && $response['response']['code'] == '200') { //support for 3.8+ $this->update_option('ub_login_image', admin_url() . 'images/wordpress-logo.svg'); } else { $this->update_option('ub_login_image', admin_url() . 'images/wordpress-logo.png'); // for older version } } } else { //there IS an OLD RECORD $this->update_option('ub_login_image', $login_image_old); //we will assume that file is in place $this->update_option('ub_login_image_url', ''); } add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueues')); add_action('admin_menu', array(&$this, 'add_admin_page')); add_action('network_admin_menu', array(&$this, 'add_network_admin_page')); if (defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . '/login-image.php')) { load_muplugin_textdomain('login_image', 'languages'); } else { load_plugin_textdomain('login_image', false, dirname(plugin_basename(__FILE__)) . '/languages'); } add_action('admin_init', array(&$this, 'process')); // Login interface add_action('login_head', array(&$this, 'stylesheet'), 99); if (!is_multisite()) { add_filter('login_headerurl', array(&$this, 'home_url')); } }
function localization() { // Load up the localization file if we're using WordPress in a different language // Place it in this plugin's "languages" folder and name it "tc-[value in wp-config].mo" if ($this->location == 'mu-plugins') { load_muplugin_textdomain('tc-mollie', 'languages/'); } else { if ($this->location == 'subfolder-plugins') { //load_plugin_textdomain( 'tc-mollie', false, $this->plugin_dir . '/languages/' ); load_plugin_textdomain('tc-mollie', false, dirname(plugin_basename(__FILE__)) . '/languages/'); } else { if ($this->location == 'plugins') { load_plugin_textdomain('tc-mollie', false, 'languages/'); } else { } } } $temp_locales = explode('_', get_locale()); $this->language = $temp_locales[0] ? $temp_locales[0] : 'en'; }
public function boot(Devaloka $devaloka, ContainerInterface $container) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; $file = $container->get('devaloka.file'); $pluginData = get_plugin_data($file, false, false); $directory = dirname($file); if ($pluginData['TextDomain'] !== '') { $textDomain = $pluginData['TextDomain']; } else { $textDomain = basename($directory); } if ($pluginData['DomainPath'] !== '') { $domainPath = $pluginData['DomainPath']; } else { $domainPath = '/languages'; } load_muplugin_textdomain($textDomain, dirname(plugin_basename($file)) . $domainPath); $locale = get_locale(); $localeFile = $directory . $domainPath . '/' . $locale . '.php'; if (is_readable($localeFile)) { require_once $localeFile; } }
function _wds_init() { /** * Load textdomain. */ if (defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . '/wpmu-dev-seo.php')) { load_muplugin_textdomain('wds', dirname(plugin_basename(__FILE__)) . '/wds-files/languages'); } else { load_plugin_textdomain('wds', false, dirname(plugin_basename(__FILE__)) . '/wds-files/languages'); } require_once WDS_PLUGIN_DIR . 'wds-core/wds-core-wpabstraction.php'; require_once WDS_PLUGIN_DIR . 'wds-core/wds-core.php'; global $wds_options; $wds_options = get_wds_options(); if (is_admin()) { require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-admin.php'; require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-config.php'; // Sanity check first! if (!get_option('blog_public')) { add_action('admin_notices', 'wds_blog_not_public_notice'); } require_once WDS_PLUGIN_DIR . 'wds-autolinks/wds-autolinks-settings.php'; require_once WDS_PLUGIN_DIR . 'wds-seomoz/wds-seomoz-settings.php'; require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps.php'; require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps-settings.php'; require_once WDS_PLUGIN_DIR . 'wds-onpage/wds-onpage-settings.php'; if (@$wds_options['sitemap-dashboard-widget']) { require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps-dashboard-widget.php'; } if (isset($wds_options['seomoz']) && $wds_options['seomoz'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-seomoz/wds-seomoz-results.php'; require_once WDS_PLUGIN_DIR . 'wds-seomoz/wds-seomoz-dashboard-widget.php'; } if (isset($wds_options['onpage']) && $wds_options['onpage'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-metabox.php'; require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-taxonomy.php'; } } else { if (isset($wds_options['autolinks']) && $wds_options['autolinks'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-autolinks/wds-autolinks.php'; } if (isset($wds_options['sitemap']) && $wds_options['sitemap'] == 'on') { // Changed '=' to '=='. Also, changed plural to singular. require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps.php'; require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps-settings.php'; // This is to propagate defaults without admin visiting the dashboard. } if (isset($wds_options['onpage']) && $wds_options['onpage'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-onpage/wds-onpage.php'; } if (defined('WDS_EXPERIMENTAL_FEATURES_ON') && WDS_EXPERIMENTAL_FEATURES_ON) { require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-video_sitemaps.php'; } } }
/** * Load localization */ function localization() { load_muplugin_textdomain('term-image', dirname(plugin_basename(__FILE__)) . '/assets/lang/'); }
/** * Localisation */ public function localize() { load_muplugin_textdomain('csv-exporter', dirname(dirname(dirname(plugin_basename(__FILE__)))) . '/assets/languages/'); }
function localization() { // Load up the localization file if we're using WordPress in a different language // Place it in this plugin's "languages" folder and name it "psts-[value in wp-config].mo" if ($this->location == 'plugins') { load_plugin_textdomain('psts', false, '/pro-sites/pro-sites-files/languages/'); } else { if ($this->location == 'mu-plugins') { load_muplugin_textdomain('psts', '/pro-sites-files/languages/'); } } //setup language code for jquery datepicker translation $temp_locales = explode('_', get_locale()); $this->language = $temp_locales[0] ? $temp_locales[0] : 'en'; }
/** * Load localization */ function localization() { load_muplugin_textdomain('post-type-archive-settings', dirname(plugin_basename(__FILE__)) . '/assets/lang/'); }
/** * Loads the plugin's translated strings. * * @access public * @return void */ public function load_plugin_textdomain() { $loaded = load_plugin_textdomain('gravityview', false, dirname(plugin_basename(__FILE__)) . '/languages/'); if (!$loaded) { $loaded = load_muplugin_textdomain('gravityview', '/languages/'); } if (!$loaded) { $loaded = load_theme_textdomain('gravityview', '/languages/'); } if (!$loaded) { $locale = apply_filters('plugin_locale', get_locale(), 'gravityview'); $mofile = dirname(__FILE__) . '/languages/gravityview-' . $locale . '.mo'; load_textdomain('gravityview', $mofile); } }
// Make sure it's wordpress if (!defined('ABSPATH')) { die('Forbidden'); } // System plugin dir define('GD_SYSTEM_PLUGIN_DIR', trailingslashit(realpath(dirname(__FILE__))) . 'gd-system-plugin/'); // GD system url // @codeCoverageIgnoreStart if (is_ssl()) { define('GD_SYSTEM_PLUGIN_URL', trailingslashit(str_ireplace('http://', 'https://', WPMU_PLUGIN_URL))); } else { define('GD_SYSTEM_PLUGIN_URL', trailingslashit(WPMU_PLUGIN_URL)); } // @codeCoverageIgnoreEnd // Load the language load_muplugin_textdomain('gd_system', 'gd-system-plugin/lang'); // Register the autoloader spl_autoload_register('gd_system_autoload'); // Load the config lib $gd_system_config = new GD_System_Plugin_Config(); // Set the WP101 key $__conf = $gd_system_config->get_config(); if (is_array($__conf) && array_key_exists('wp101_key', $__conf) && is_string($__conf['wp101_key'])) { define('GD_WP101_API_KEY', $__conf['wp101_key']); } // Stop 404 loops on images $gd_system_404s = new GD_System_Plugin_404(); // Load the logging lib $gd_system_logger = new GD_System_Plugin_Logger(); // Load the admin-menu helper $gd_admin_menu = new GD_System_Plugin_Admin_Menu();
/** * Load localization */ function localization() { load_muplugin_textdomain('widget-customizable', dirname(plugin_basename(__FILE__)) . '/assets/lang/'); }
/** * Load CMB text domain * @since 2.0.0 */ public function l10ni18n() { $loaded = load_plugin_textdomain('crystalskull', false, '/languages/'); if (!$loaded) { $loaded = load_muplugin_textdomain('crystalskull', '/languages/'); } if (!$loaded) { $loaded = load_theme_textdomain('crystalskull', '/languages/'); } if (!$loaded) { $locale = apply_filters('plugin_locale', get_locale(), 'crystalskull'); $mofile = get_template_directory() . '/addons/wp-owl-carousel/CMB2/languages/cmb2-' . $locale . '.mo'; load_textdomain('crystalskull', $mofile); } }
/** * Initialize the plugin * * @see http://codex.wordpress.org/Plugin_API/Action_Reference * @see http://adambrown.info/p/wp_hooks/hook/init */ function init() { global $wpdb, $wp_rewrite, $current_user, $blog_id; if (preg_match('/mu\\-plugin/', PLUGINDIR) > 0) { load_muplugin_textdomain($this->translation_domain, dirname(plugin_basename(__FILE__)) . '/languages'); } else { load_plugin_textdomain($this->translation_domain, false, dirname(plugin_basename(__FILE__)) . '/languages'); } wp_register_script('incsub_wiki_js', plugins_url('wordpress-wiki-plugin/js/wiki-utils.js'), null, $this->current_version); $labels = array('name' => __('Wikis', $this->translation_domain), 'singular_name' => __('Wiki', $this->translation_domain), 'add_new' => __('Add WIki', $this->translation_domain), 'add_new_item' => __('Add New Wiki', $this->translation_domain), 'edit_item' => __('Edit Wiki', $this->translation_domain), 'new_item' => __('New Wiki', $this->translation_domain), 'view_item' => __('View Wiki', $this->translation_domain), 'search_items' => __('Search Wiki', $this->translation_domain), 'not_found' => __('No Wiki found', $this->translation_domain), 'not_found_in_trash' => __('No wikis found in Trash', $this->translation_domain), 'menu_name' => __('Wikis', $this->translation_domain)); $supports = array('title', 'editor', 'author', 'revisions', 'comments', 'page-attributes'); register_post_type('incsub_wiki', array('labels' => $labels, 'public' => true, 'show_ui' => true, 'publicly_queryable' => true, 'capability_type' => 'wiki', 'hierarchical' => true, 'map_meta_cap' => true, 'query_var' => true, 'supports' => $supports, 'rewrite' => false)); $wiki_structure = '/' . $this->_options['default']['slug'] . '/%wiki%'; $wp_rewrite->add_rewrite_tag("%wiki%", '(.+?)', "incsub_wiki="); $wp_rewrite->add_permastruct('incsub_wiki', $wiki_structure, false); if (isset($_REQUEST['subscribe']) && wp_verify_nonce($_REQUEST['_wpnonce'], "wiki-subscribe-wiki_{$_REQUEST['post_id']}")) { if (isset($_REQUEST['email'])) { if ($wpdb->insert("{$this->db_prefix}wiki_subscriptions", array('blog_id' => $blog_id, 'wiki_id' => $_REQUEST['post_id'], 'email' => $_REQUEST['email']))) { setcookie('incsub_wiki_email', $_REQUEST['email'], time() + 3600 * 24 * 365, '/'); wp_redirect(get_permalink($_REQUEST['post_id'])); exit; } } else { if (is_user_logged_in()) { if ($wpdb->insert("{$this->db_prefix}wiki_subscriptions", array('blog_id' => $blog_id, 'wiki_id' => $_REQUEST['post_id'], 'user_id' => $current_user->ID))) { wp_redirect(get_permalink($_REQUEST['post_id'])); exit; } } } } if (isset($_GET['action']) && $_GET['action'] == 'cancel-wiki-subscription') { if ($wpdb->query("DELETE FROM {$this->db_prefix}wiki_subscriptions WHERE ID = " . intval($_GET['sid']) . ";")) { wp_redirect(get_option('siteurl')); exit; } } }
/** * Load plugin textdomain. * * @return void */ public function load_textdomain() { $lang_path = plugin_basename(dirname(__FILE__)) . '/languages'; $loaded = load_muplugin_textdomain('cmb2-admin-extension', $lang_path); if (strpos(__FILE__, basename(WPMU_PLUGIN_DIR)) === false) { $loaded = load_plugin_textdomain('cmb2-admin-extension', false, $lang_path); } if (!$loaded) { $loaded = load_theme_textdomain('cmb2-admin-extension', get_stylesheet_directory() . '/languages'); } if (!$loaded) { $locale = apply_filters('plugin_locale', get_locale(), 'cmb2-admin-extension'); $mofile = dirname(__FILE__) . '/languages/cmb2-admin-extension-' . $locale . '.mo'; load_textdomain('cmb2-admin-extension', $mofile); } }
/** * Load translations */ function wpseo_load_textdomain() { $wpseo_path = str_replace('\\', '/', WPSEO_PATH); $mu_path = str_replace('\\', '/', WPMU_PLUGIN_DIR); if (false !== stripos($wpseo_path, $mu_path)) { load_muplugin_textdomain('wordpress-seo', dirname(WPSEO_BASENAME) . '/languages/'); } else { load_plugin_textdomain('wordpress-seo', false, dirname(WPSEO_BASENAME) . '/languages/'); } }
/** * Load text domain for translations. * * Plugins need to call this function anytime * strings can be translated in a function. Themes * should usually call this function once in a * hook_after_setup_theme() function. * * @package mgs_core * @since 1 */ public final function domain() { if ('plugin' == $this->type && realpath(dirname($this->file)) !== realpath(WPMU_PLUGIN_DIR)) { load_muplugin_textdomain($this->name, $this->dir . '/' . $this->name . '-includes/languages'); } elseif ('plugin' == $this->type) { load_plugin_textdomain($this->name, $this->dir . '/' . $this->name . '-includes/languages', dirname($this->base)); } elseif ('theme' == $this->type) { load_theme_textdomain($this->name, $this->dir . '/' . 'languages'); $l = get_locale(); $lf = $this->dir . "/languages/{$l}.php"; if (is_readable($lf)) { require_once $lf; } } else { return false; } }
/** * @ticket 38485 */ public function test_load_muplugin_textdomain_user_locale() { set_current_screen('dashboard'); wp_set_current_user(self::$user_id); load_muplugin_textdomain('wp-tests-domain'); set_current_screen('front'); $this->assertSame(get_user_locale(), $this->locale); }