本文整理汇总了PHP中SitePress类的典型用法代码示例。如果您正苦于以下问题:PHP SitePress类的具体用法?PHP SitePress怎么用?PHP SitePress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SitePress类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
global $cms_nav_ie_ver, $sitepress;
if (!isset($sitepress)) {
$sitepress = new SitePress();
$sitepress->initialize_cache();
}
$sitepress_settings = $sitepress->get_settings();
$this->settings = $sitepress_settings['modules']['cms-navigation'];
$cms_nav_user_agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('#MSIE ([0-9]+)\\.[0-9]#', $cms_nav_user_agent, $matches)) {
$cms_nav_ie_ver = $matches[1];
}
add_action('icl_navigation_breadcrumb', array($this, 'cms_navigation_breadcrumb'));
add_action('icl_navigation_menu', array($this, 'cms_navigation_menu_nav'));
add_action('icl_navigation_sidebar', array($this, 'cms_navigation_page_navigation'));
add_action('save_post', array($this, 'cms_navigation_update_post_settings'));
add_action('admin_head', array($this, 'cms_navigation_page_edit_options'));
add_action('admin_head', array($this, 'cms_navigation_js'));
add_action('init', array($this, 'cms_navigation_css'));
add_action('plugins_loaded', array($this, 'sidebar_navigation_widget_init'));
add_filter('page_link', array($this, 'rewrite_page_link'), 15, 2);
add_action('parse_query', array($this, 'redirect_offsite_urls'));
add_filter('permalink_structure_changed', array($this, 'clear_cache'));
add_filter('update_option_show_on_front', array($this, 'clear_cache'));
add_filter('update_option_page_on_front', array($this, 'clear_cache'));
add_filter('update_option_page_for_posts', array($this, 'clear_cache'));
add_action('delete_post', array($this, 'clear_cache'));
add_action('delete_category', array($this, 'clear_cache'));
add_action('create_category', array($this, 'clear_cache'));
add_action('edited_category', array($this, 'clear_cache'));
// not needed - save_post handles this
//add_action('trashed_post', array($this,'clear_cache'));
//add_action('untrashed_post', array($this,'clear_cache'));
}
开发者ID:winyatasenjaya,项目名称:sitepress-multilingual-cms,代码行数:35,代码来源:cms-navigation.php
示例2: __construct
/**
* @param SitePress $sitepress
* @param WPML_Query_Filter $query_filter
*/
public function __construct(&$sitepress, &$query_filter)
{
$wpdb = $sitepress->wpdb();
$post_translation = $sitepress->post_translations();
$term_translation = $sitepress->term_translations();
parent::__construct($sitepress, $wpdb, $post_translation, $term_translation);
$this->query_filter =& $query_filter;
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:12,代码来源:class-wpml-query-parser.php
示例3: __construct
/**
* WPML_TM_Translation_Status_Display constructor.
*
* @param wpdb $wpdb
* @param SitePress $sitepress
* @param WPML_Post_Status $status_helper
* @param WPML_Translation_Job_Factory $job_factory
* @param WPML_TM_API $tm_api
*/
public function __construct(&$wpdb, &$sitepress, &$status_helper, &$job_factory, &$tm_api)
{
$post_translation = $sitepress->post_translations();
parent::__construct($wpdb, $sitepress, $post_translation);
$this->status_helper =& $status_helper;
$this->job_factory =& $job_factory;
$this->tm_api =& $tm_api;
}
开发者ID:agiper,项目名称:wordpress,代码行数:17,代码来源:class-wpml-tm-translation-status-display.php
示例4: __construct
/**
* @param SitePress $sitepress
* @param WPML_Terms_Translations $term_utils
* @param string $taxonomy
*/
public function __construct(&$sitepress, &$term_utils, $taxonomy)
{
$wpdb = $sitepress->wpdb();
parent::__construct($wpdb, $sitepress);
$this->term_utils = $term_utils;
$this->taxonomy = $taxonomy;
$this->data = $this->set_affected_ids();
$this->prepare_missing_terms_data();
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:14,代码来源:class-wpml-term-language-synchronization.php
示例5: __construct
/**
* WPML_Translations_Queue_Jobs_Model constructor.
*
* @param SitePress $sitepress
* @param TranslationManagement $tm_instance
* @param WPML_TM_API $tm_api
* @param WPML_TM_Post_Link_Factory $post_link_factory
* @param array $translation_jobs
*/
public function __construct($sitepress, &$tm_instance, &$tm_api, &$post_link_factory, array $translation_jobs)
{
parent::__construct($tm_instance);
$this->translation_jobs = $translation_jobs;
$this->tm_api =& $tm_api;
$this->post_link_factory =& $post_link_factory;
$this->post_types = $sitepress->get_translatable_documents(true);
$this->post_types = apply_filters('wpml_get_translatable_types', $this->post_types);
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:18,代码来源:class-wpml-translations-queue-jobs-model.php
示例6: get_current_lang
/**
* get current language
*/
public static function get_current_lang()
{
self::validate_wpml_exists();
$wpml = new SitePress();
if (is_admin()) {
$lang = $wpml->get_default_language();
} else {
$lang = self::get_current_lang_code();
}
return $lang;
}
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:14,代码来源:wpml.class.php
示例7: getFlagUrl
/**
* get flag url
*/
public static function getFlagUrl($code)
{
self::validateWpmlExists();
$wpml = new SitePress();
if (empty($code) || $code == "all") {
$url = ICL_PLUGIN_URL . '/res/img/icon16.png';
} else {
$url = $wpml->get_flag_url($code);
}
//default: show all
if (empty($url)) {
$url = ICL_PLUGIN_URL . '/res/img/icon16.png';
}
return $url;
}
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:18,代码来源:wpml.class.php
示例8: get_job_id_from_request
public static function get_job_id_from_request()
{
/**
* @var TranslationManagement $iclTranslationManagement
* @var WPML_Post_Translation $wpml_post_translations
*/
global $iclTranslationManagement, $wpml_post_translations, $wpml_translation_job_factory, $sitepress, $wpdb;
$job_id = filter_input(INPUT_GET, 'job_id', FILTER_SANITIZE_NUMBER_INT);
$trid = filter_input(INPUT_GET, 'trid', FILTER_SANITIZE_NUMBER_INT);
$language_code = filter_input(INPUT_GET, 'language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$source_language_code = filter_input(INPUT_GET, 'source_language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if (!$job_id && $trid && $language_code) {
$job_id = $iclTranslationManagement->get_translation_job_id($trid, $language_code);
if (!$job_id) {
if (!$source_language_code) {
$post_id = SitePress::get_original_element_id_by_trid($trid);
} else {
$posts_in_trid = $wpml_post_translations->get_element_translations(false, $trid);
$post_id = isset($posts_in_trid[$source_language_code]) ? $posts_in_trid[$source_language_code] : false;
}
$blog_translators = wpml_tm_load_blog_translators();
$args = array('lang_from' => $source_language_code, 'lang_to' => $language_code, 'job_id' => $job_id);
if ($post_id && $blog_translators->is_translator($sitepress->get_current_user()->ID, $args)) {
$job_id = $wpml_translation_job_factory->create_local_post_job($post_id, $language_code);
}
}
}
return $job_id;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:29,代码来源:wpml-translation-editor.class.php
示例9: get_job_id_from_request
public static function get_job_id_from_request()
{
/**
* @var TranslationManagement $iclTranslationManagement
* @var WPML_Post_Translation $wpml_post_translations
*/
global $iclTranslationManagement, $wpml_post_translations, $wpml_translation_job_factory;
$job_id = filter_input(INPUT_GET, 'job_id', FILTER_SANITIZE_NUMBER_INT);
$trid = filter_input(INPUT_GET, 'trid', FILTER_SANITIZE_NUMBER_INT);
$language_code = filter_input(INPUT_GET, 'language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$source_language_code = filter_input(INPUT_GET, 'source_language_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if (!$job_id && $trid && $language_code) {
$job_id = $iclTranslationManagement->get_translation_job_id($trid, $language_code);
if (!$job_id) {
if (!$source_language_code) {
$post_id = SitePress::get_original_element_id_by_trid($trid);
} else {
$posts_in_trid = $wpml_post_translations->get_element_translations(false, $trid);
$post_id = isset($posts_in_trid[$source_language_code]) ? $posts_in_trid[$source_language_code] : false;
}
if ($post_id && current_user_can('manage_options', $post_id)) {
$job_id = $wpml_translation_job_factory->create_local_post_job($post_id, $language_code);
}
}
}
return $job_id;
}
开发者ID:ryuqing,项目名称:cake,代码行数:27,代码来源:wpml-translation-editor.class.php
示例10: _st_warnings
static function _st_warnings()
{
if (!class_exists('ICL_AdminNotifier')) {
return;
}
global $sitepress, $sitepress_settings;
if (!isset($sitepress)) {
return;
}
if (method_exists($sitepress, 'check_settings_integrity') && !SitePress::check_settings_integrity()) {
return;
}
if (!isset($sitepress_settings['st']['strings_language'])) {
$sitepress_settings = $sitepress->get_settings();
}
if (isset($sitepress_settings['st']['strings_language'])) {
if ($sitepress->get_default_language() != $sitepress_settings['st']['strings_language']) {
self::_st_default_language_warning();
} elseif ($sitepress_settings['st']['strings_language'] != 'en') {
self::_st_default_and_st_language_warning();
} else {
ICL_AdminNotifier::removeMessage('_st_default_and_st_language_warning');
ICL_AdminNotifier::removeMessage('_st_default_language_warning');
}
}
}
开发者ID:Calraiser,项目名称:flux,代码行数:26,代码来源:wpml-string-translation.class.php
示例11: em_ml_admin_original_event_link
public static function em_ml_admin_original_event_link($link)
{
global $EM_Event;
if (empty($EM_Event->event_id) && !empty($_REQUEST['trid'])) {
$post_id = SitePress::get_original_element_id_by_trid($_REQUEST['trid']);
$original_event_link = em_get_event($post_id, 'post_id')->get_edit_url();
}
return $link;
}
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:9,代码来源:em-wpml-admin.php
示例12: wpml_get_table_taxonomies
public static function wpml_get_table_taxonomies(SitePress $sitepress)
{
$taxonomies = $sitepress->get_wp_api()->get_taxonomies(array(), 'objects');
$result = array("taxonomies" => array(), "activeLanguages" => array(), "allLanguages" => array());
$sitepress->set_admin_language();
$active_langs = $sitepress->get_active_languages();
$default_lang = $sitepress->get_default_language();
$result["activeLanguages"][$default_lang] = array("label" => $active_langs[$default_lang]['display_name'], "flag" => $sitepress->get_flag_url($default_lang));
foreach ($active_langs as $code => $lang) {
if ($code !== $default_lang) {
$result["activeLanguages"][$code] = array("label" => $lang['display_name'], "flag" => $sitepress->get_flag_url($code));
}
}
$all_languages = $sitepress->get_languages();
foreach ($all_languages as $code => $lang) {
$result["allLanguages"][$code] = array("label" => $lang['display_name'], "flag" => $sitepress->get_flag_url($code));
}
foreach ($taxonomies as $key => $tax) {
if ($sitepress->is_translated_taxonomy($key)) {
$result["taxonomies"][$key] = array("label" => $tax->label, "singularLabel" => $tax->labels->singular_name, "hierarchical" => $tax->hierarchical, "name" => $key);
}
}
return $result;
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:24,代码来源:taxonomy-translation-display.class.php
示例13: single_taxonomy_meta_box
/**
* Print the Single Taxonomy Metabox
*
* @author Andrea Grillo <[email protected]>
* @since 1.0.0
*
* @param $taxonomy string Taxonomy Name
* @param $taxonomy_box string Taxonomy Box
*
* @return void
*/
public function single_taxonomy_meta_box($taxonomy, $taxonomy_box)
{
$taxonomy_label = YITH_Vendors()->get_vendors_taxonomy_label();
$vendor = yith_get_vendor('current', 'product');
$vendor_id = 0;
$wpml_vendor = null;
/* WPML Support */
global $sitepress, $pagenow;
if ($vendor->is_valid()) {
if (isset($sitepress)) {
$vendor_id = yit_wpml_object_id($vendor->id, YITH_Vendors()->get_taxonomy_name(), true);
$wpml_vendor = get_term_by('id', $vendor_id, $vendor->term->taxonomy);
$vendor_id = $wpml_vendor->term_id;
} else {
$vendor_id = $vendor->id;
}
} elseif (isset($sitepress) && $vendor->is_super_user() && 'post-new.php' == $pagenow && !empty($_GET['trid'])) {
$original_product_id = SitePress::get_original_element_id_by_trid($_GET['trid']);
$original_vendor = yith_get_vendor($original_product_id, 'product');
if ($original_vendor->is_valid()) {
$vendor_id = yit_wpml_object_id($original_vendor->id, YITH_Vendors()->get_taxonomy_name(), true);
$wpml_vendor = get_term_by('id', $vendor_id, $original_vendor->term->taxonomy);
$vendor_id = $wpml_vendor->term_id;
}
}
$args = array('id' => 'tax-input-yith_shop_vendor', 'name' => 'tax_input[yith_shop_vendor]', 'taxonomy' => $this->_taxonomy_name, 'show_option_none' => !$vendor->is_super_user() ? '' : sprintf(__('No %s'), strtolower($taxonomy_label['singular_name'])), 'hide_empty' => !$vendor->is_super_user(), 'selected' => $vendor_id, 'walker' => YITH_Walker_CategoryDropdown(), 'option_none_value' => '');
$vendor = yith_get_vendor('current', 'user');
if ($vendor->is_valid() && $vendor->has_limited_access() && $vendor->is_user_admin()) {
echo is_null($wpml_vendor) ? $vendor->name : $wpml_vendor->name;
} else {
wp_dropdown_categories($args);
}
}
开发者ID:kanhaiyasharma,项目名称:Bestswiss,代码行数:44,代码来源:class.yith-vendors-admin.php
示例14: set_language
public function set_language($domain, $lang)
{
$this->language_of_domain[$domain] = $lang;
$string_settings = $this->sitepress->get_setting('st');
$string_settings['lang_of_domain'] = $this->language_of_domain;
$this->sitepress->set_setting('st', $string_settings, true);
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:7,代码来源:class-wpml-language-of-domain.php
示例15: estimate_custom_field_word_count
private function estimate_custom_field_word_count()
{
$sitepress_settings = $this->sitepress->get_settings();
if (!isset($this->language_code) || !isset($this->id) || !$this->is_registered_type()) {
return 0;
}
$words = 0;
$post_id = $this->id;
if (!empty($sitepress_settings['translation-management']['custom_fields_translation']) && is_array($sitepress_settings['translation-management']['custom_fields_translation'])) {
$custom_fields = array();
foreach ($sitepress_settings['translation-management']['custom_fields_translation'] as $cf => $op) {
if (WPML_TRANSLATE_CUSTOM_FIELD === (int) $op) {
$custom_fields[] = $cf;
}
}
foreach ($custom_fields as $cf) {
$custom_fields_value = get_post_meta($post_id, $cf);
if ($custom_fields_value && is_scalar($custom_fields_value)) {
// only support scalar values fo rnow
$words += $this->get_string_words_count($this->language_code, $custom_fields_value);
} else {
foreach ($custom_fields_value as $custom_fields_value_item) {
if ($custom_fields_value_item && is_scalar($custom_fields_value_item)) {
// only support scalar values fo rnow
$words += $this->get_string_words_count($this->language_code, $custom_fields_value_item);
}
}
}
}
}
return (int) $words;
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:32,代码来源:class-wpml-tm-post.php
示例16: load_icl_migration
public function load_icl_migration()
{
if (!$this->sitepress || (bool) $this->sitepress->get_setting('wpml_icl_migration_completed') === false) {
require_once WPML_ICLM_PATH . '/menu/wpml-icl-migration-menu.class.php';
$migration_menu = new WPML_ICL_Migration_Display();
$migration_menu->init();
}
}
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:8,代码来源:wpml-iclm-loader.class.php
示例17:
function language_selector_widget_init()
{
if ($this->sitepress->get_setting('setup_complete')) {
register_widget('ICL_Language_Switcher');
}
add_action('template_redirect', 'icl_lang_sel_nav_ob_start', 0);
add_action('wp_head', 'icl_lang_sel_nav_ob_end');
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:8,代码来源:language-switcher.php
示例18: get_source_lang
/**
* @param $name
* @param $domain
*
* @return string
*/
public function get_source_lang($name, $domain)
{
$domain_lang = $this->lang_of_domain->get_language($domain);
if (!$domain_lang) {
$flag = 0 === strpos($domain, 'admin_texts_') || 'Tagline' === $name || 'Blog Title' === $name;
$domain_lang = $flag ? $this->sitepress->get_user_admin_language(get_current_user_id()) : 'en';
}
return $domain_lang;
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:15,代码来源:class-wpml-autoregister-save-strings.php
示例19: __construct
public function __construct($id, &$sitepress, &$wpdb)
{
parent::__construct($id);
$this->wpdb =& $wpdb;
$this->sitepress =& $sitepress;
$this->wp_post = get_post($id);
$this->element_type = 'post_' . $this->wp_post->post_type;
$this->language_code = $this->sitepress->get_language_for_element($id, $this->element_type);
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:9,代码来源:class-wpml-tm-post.php
示例20: get_status_array
/**
* @return array containing strings displayed in the translation service polling status box
*/
public function get_status_array()
{
$data = $this->filter_obsolete($this->project->jobs());
$button_text = __('Get completed translations', 'sitepress');
if (($job_in_progress = $this->in_progress_count($data)) == 1) {
$jobs_in_progress_text = __('1 job has been sent to the translation service.', 'sitepress');
} else {
$jobs_in_progress_text = sprintf(__('%d jobs have been sent to the translation service.', 'sitepress'), $job_in_progress);
}
$last_picked_up = $this->sitepress->get_setting('last_picked_up');
$last_time_picked_up = !empty($last_picked_up) ? date_i18n('Y, F jS @g:i a', $last_picked_up) : __('never', 'sitepress');
$last_pickup_text = sprintf(__('Last time translations were picked up: %s', 'sitepress'), $last_time_picked_up);
return array('jobs_in_progress_text' => $jobs_in_progress_text, 'button_text' => $button_text, 'last_pickup_text' => $last_pickup_text, 'polling_data' => $this->filter_known_pending($data));
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:17,代码来源:class-wpml-tp-polling-status.php
注:本文中的SitePress类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论