本文整理汇总了PHP中wpml_load_core_tm函数的典型用法代码示例。如果您正苦于以下问题:PHP wpml_load_core_tm函数的具体用法?PHP wpml_load_core_tm怎么用?PHP wpml_load_core_tm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpml_load_core_tm函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpml_tm_load_ui
function wpml_tm_load_ui()
{
if (version_compare(ICL_SITEPRESS_VERSION, '3.3.1', '>=')) {
global $sitepress, $wpdb, $WPML_Translation_Management;
$core_translation_management = wpml_load_core_tm();
$tm_loader = new WPML_TM_Loader();
$WPML_Translation_Management = new WPML_Translation_Management($sitepress, $tm_loader, $core_translation_management);
$WPML_Translation_Management->load();
$wpml_wp_api = new WPML_WP_API();
$TranslationProxy = new WPML_Translation_Proxy_API();
new WPML_TM_Troubleshooting_Reset_Pro_Trans_Config($sitepress, $TranslationProxy, $wpml_wp_api, $wpdb);
new WPML_TM_Troubleshooting_Clear_TS($wpml_wp_api);
}
}
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:14,代码来源:plugin.php
示例2: get_custom_fields_translation_settings
static function get_custom_fields_translation_settings($translation_actions = array(0))
{
$iclTranslationManagement = wpml_load_core_tm();
$section = 'custom_fields_translation';
$result = array();
$tm_settings = $iclTranslationManagement->settings;
if (isset($tm_settings[$section])) {
foreach ($tm_settings[$section] as $meta_key => $translation_type) {
if (in_array($translation_type, $translation_actions)) {
$result[] = $meta_key;
}
}
}
return $result;
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:15,代码来源:wpml-config.class.php
示例3: wpml_tm_init_mail_notifications
/**
* @return WPML_TM_Mail_Notification
*/
function wpml_tm_init_mail_notifications()
{
global $wpml_tm_mailer, $sitepress, $wpdb, $iclTranslationManagement, $wpml_translation_job_factory;
if (!isset($wpml_tm_mailer)) {
require WPML_TM_PATH . '/inc/local-translation/wpml-tm-mail-notification.class.php';
$blog_translators = new WPML_TM_Blog_Translators($wpdb);
$iclTranslationManagement = $iclTranslationManagement ? $iclTranslationManagement : wpml_load_core_tm();
if (empty($iclTranslationManagement->settings)) {
$iclTranslationManagement->init();
}
$settings = isset($iclTranslationManagement->settings['notification']) ? $iclTranslationManagement->settings['notification'] : array();
$wpml_tm_mailer = new WPML_TM_Mail_Notification($sitepress, $wpdb, $wpml_translation_job_factory, $blog_translators, $settings);
}
$wpml_tm_mailer->init();
return $wpml_tm_mailer;
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:19,代码来源:functions-load.php
示例4: wpml_tm_load_ui
function wpml_tm_load_ui()
{
require_once WPML_TM_PATH . '/menu/basket-tab/sitepress-table-basket.class.php';
require_once WPML_TM_PATH . '/menu/dashboard/wpml-tm-dashboard.class.php';
require_once WPML_TM_PATH . '/menu/wpml-tm-menus.class.php';
require_once WPML_TM_PATH . '/menu/wpml-translator-settings.class.php';
if (version_compare(ICL_SITEPRESS_VERSION, '3.3.1', '>=')) {
global $sitepress, $wpdb, $WPML_Translation_Management;
$core_translation_management = wpml_load_core_tm();
$tm_loader = new WPML_TM_Loader();
$wpml_tp_translator = new WPML_TP_Translator();
$WPML_Translation_Management = new WPML_Translation_Management($sitepress, $tm_loader, $core_translation_management, $wpml_tp_translator);
$WPML_Translation_Management->load();
if (is_admin()) {
$wpml_wp_api = new WPML_WP_API();
$TranslationProxy = new WPML_Translation_Proxy_API();
new WPML_TM_Troubleshooting_Reset_Pro_Trans_Config($sitepress, $TranslationProxy, $wpml_wp_api, $wpdb);
new WPML_TM_Troubleshooting_Clear_TS($wpml_wp_api);
new WPML_TM_Promotions($wpml_wp_api);
}
}
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:22,代码来源:plugin.php
示例5: duplicate_comments
private function duplicate_comments($master_post_id, $translated_id)
{
global $sitepress;
remove_filter('comments_clauses', array($sitepress, 'comments_clauses'), 10);
$comments_on_master = get_comments(array('post_id' => $master_post_id));
$comments_on_translation = get_comments(array('post_id' => $translated_id, 'status' => 'any'));
add_filter('comments_clauses', array($sitepress, 'comments_clauses'), 10, 2);
foreach ($comments_on_translation as $comment) {
wp_delete_comment($comment->comment_ID, true);
clean_comment_cache($comment->comment_ID);
}
$iclTranslationManagement = wpml_load_core_tm();
foreach ($comments_on_master as $comment) {
$iclTranslationManagement->duplication_insert_comment($comment->comment_ID);
clean_comment_cache($comment->comment_ID);
}
wp_update_comment_count_now($master_post_id);
wp_update_comment_count_now($translated_id);
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:19,代码来源:wpml-post-duplication.class.php
示例6: wpml_admin_make_post_duplicates_action
/**
* Build or update duplicated posts from a master post.
* To be used only for admin backend actions
* @see $iclTranslationManagement in \SitePress:: __construct
*
* @param int $master_post_id The ID of the post to duplicate from.
* The ID can be that of a post, page or custom post
* Master post doesn't need to be in the default language.
*
* @uses SitePress
* @uses TranslationManagement
* @since 3.2
* @use \SitePress::api_hooks
*/
function wpml_admin_make_post_duplicates_action($master_post_id)
{
$post = get_post($master_post_id);
$post_type = $post->post_type;
if ($post->post_status == 'auto-draft' || $post->post_type == 'revision') {
return;
}
global $sitepress;
$iclTranslationManagement = wpml_load_core_tm();
if ($sitepress->is_translated_post_type($post_type)) {
$iclTranslationManagement->make_duplicates_all($master_post_id);
}
}
开发者ID:pcuervo,项目名称:odc,代码行数:27,代码来源:functions.php
示例7: __construct
//.........这里部分代码省略.........
add_action('set_object_terms', array('WPML_Terms_Translations', 'set_object_terms_action'), 10, 6);
// AJAX Actions for the post edit screen
add_action('wp_ajax_wpml_save_term', array('WPML_Post_Edit_Ajax', 'wpml_save_term'));
add_action('wp_ajax_wpml_switch_post_language', array('WPML_Post_Edit_Ajax', 'wpml_switch_post_language'));
add_action('wp_ajax_wpml_set_post_edit_lang', array('WPML_Post_Edit_Ajax', 'wpml_set_post_edit_lang'));
add_action('wp_ajax_wpml_get_default_lang', array('WPML_Post_Edit_Ajax', 'wpml_get_default_lang'));
//AJAX Actions for the taxonomy translation screen
add_action('wp_ajax_wpml_get_table_taxonomies', array('WPML_Taxonomy_Translation_Table_Display', 'wpml_get_table_taxonomies'));
add_action('wp_ajax_wpml_get_terms_and_labels_for_taxonomy_table', array('WPML_Taxonomy_Translation_Table_Display', 'wpml_get_terms_and_labels_for_taxonomy_table'));
// Ajax Action for the updating of term names on the troubleshooting page
add_action('wp_ajax_wpml_update_term_names_troubleshoot', array('WPML_Troubleshooting_Terms_Menu', 'wpml_update_term_names_troubleshoot'));
// short circuit get default category
add_filter('pre_option_default_category', array($this, 'pre_option_default_category'));
add_filter('update_option_default_category', array($this, 'update_option_default_category'), 1, 2);
// custom hook for adding the language selector to the template
//@deprecated see 'wpml_add_language_selector' action in $this->api_hooks();)
add_action('icl_language_selector', array($this, 'language_selector'));
// front end js
add_action('wp_head', array($this, 'front_end_js'));
add_action('wp_head', array($this, 'rtl_fix'));
add_action('admin_print_styles', array($this, 'rtl_fix'));
add_action('restrict_manage_posts', array($this, 'restrict_manage_posts'));
// adjacent posts links
add_filter('get_previous_post_join', array($this, 'get_adjacent_post_join'));
add_filter('get_next_post_join', array($this, 'get_adjacent_post_join'));
add_filter('get_previous_post_where', array($this, 'get_adjacent_post_where'));
add_filter('get_next_post_where', array($this, 'get_adjacent_post_where'));
// feeds links
add_filter('feed_link', array($this, 'feed_link'));
// commenting links
add_filter('post_comments_feed_link', array($this, 'post_comments_feed_link'));
add_filter('trackback_url', array($this, 'trackback_url'));
add_filter('user_trailingslashit', array($this, 'user_trailingslashit'), 1, 2);
// date based archives
add_filter('year_link', array($this, 'archives_link'));
add_filter('month_link', array($this, 'archives_link'));
add_filter('day_link', array($this, 'archives_link'));
add_filter('getarchives_join', array($this, 'getarchives_join'));
add_filter('getarchives_where', array($this, 'getarchives_where'));
add_filter('pre_option_home', array($this, 'pre_option_home'));
if (!is_admin()) {
add_filter('attachment_link', array($this, 'attachment_link_filter'), 10, 2);
}
// Filter custom type archive link (since WP 3.1)
add_filter('post_type_archive_link', array($this, 'post_type_archive_link_filter'), 10, 2);
add_filter('author_link', array($this, 'author_link'));
// language negotiation
add_action('query_vars', array($this, 'query_vars'));
add_filter('language_attributes', array($this, 'language_attributes'));
add_filter('locale', array($this, 'locale'), 10, 1);
add_filter('pre_option_page_on_front', array($this, 'pre_option_page_on_front'));
add_filter('pre_option_page_for_posts', array($this, 'pre_option_page_for_posts'));
add_filter('pre_option_sticky_posts', array($this, 'option_sticky_posts'), 10, 2);
add_action('wp_head', array($this, 'set_wp_query'));
add_action('show_user_profile', array($this, 'show_user_options'));
add_action('personal_options_update', array($this, 'save_user_options'));
// column with links to translations (or add translation) - low priority
add_action('init', array($this, 'configure_custom_column'), 1010);
// accommodate Types init@999
if (!is_admin()) {
add_action('wp_head', array($this, 'meta_generator_tag'));
}
require_once ICL_PLUGIN_PATH . '/inc/wp-nav-menus/iclNavMenu.class.php';
new iclNavMenu($this, $wpdb, $wpml_post_translations, $wpml_term_translations);
if (is_admin() || defined('XMLRPC_REQUEST') || preg_match('#wp-comments-post\\.php$#', $_SERVER['REQUEST_URI'])) {
global $iclTranslationManagement;
$iclTranslationManagement = wpml_load_core_tm();
}
add_action('wp_login', array($this, 'reset_admin_language_cookie'));
if ($this->settings['seo']['head_langs']) {
add_action('wp_head', array($this, 'head_langs'));
}
/**
* add extra debug information
*/
add_filter('icl_get_extra_debug_info', array($this, 'add_extra_debug_info'));
}
//end if the initial language is set - existing_content_language_verified
add_action('wp_dashboard_setup', array($this, 'dashboard_widget_setup'));
add_filter('core_version_check_locale', array($this, 'wp_upgrade_locale'));
if ($pagenow === 'post.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && isset($_GET['post'])) {
add_action('init', '_icl_trash_restore_prompt');
}
add_action('init', array($this, 'js_load'), 2);
// enqueue scripts - higher priority
add_filter('url_to_postid', array($this, 'url_to_postid'));
//cron job to update WPML config index file from CDN
add_action('update_wpml_config_index', array($this, 'update_wpml_config_index_event'));
//update WPML config files
add_action('wp_ajax_update_wpml_config_index', array($this, 'update_wpml_config_index_event_ajax'));
add_action('after_switch_theme', array($this, 'update_wpml_config_index_event'));
add_action('activated_plugin', array($this, 'update_wpml_config_index_event'));
add_action('core_upgrade_preamble', array($this, 'update_index_screen'));
add_shortcode('wpml_language_selector_widget', 'icl_language_selector');
add_shortcode('wpml_language_selector_footer', 'icl_language_selector_footer');
add_filter('get_search_form', array($this, 'get_search_form_filter'));
$this->api_hooks();
add_action('wpml_loaded', array($this, 'load_dependencies'), 10000);
do_action('wpml_after_startup');
}
开发者ID:phucanh92,项目名称:vietlong,代码行数:101,代码来源:sitepress.class.php
示例8: update_tm_settings
private static function update_tm_settings($config, $section_singular, $section_plural)
{
$config['wpml-config'] = array_filter($config['wpml-config']);
if (!isset($config['wpml-config'][$section_plural]) || !isset($config['wpml-config'][$section_plural][$section_singular])) {
return false;
}
$iclTranslationManagement = wpml_load_core_tm();
$read_only_section = $section_plural . '_readonly_config';
self::sync_settings($config, $section_singular, $section_plural, $read_only_section);
// taxonomies - check what's been removed
if (!empty($iclTranslationManagement->settings[$read_only_section])) {
$config_values = array();
foreach ($config['wpml-config'][$section_plural][$section_singular] as $config_value) {
$config_values[$config_value['value']] = $config_value['attr']['translate'];
}
foreach ($iclTranslationManagement->settings[$read_only_section] as $key => $translation_option) {
if (!isset($config_values[$key])) {
unset($iclTranslationManagement->settings[$read_only_section][$key]);
}
}
$iclTranslationManagement->save_settings();
}
}
开发者ID:pcuervo,项目名称:odc,代码行数:23,代码来源:wpml-config.class.php
示例9: sync_post_and_taxonomy_terms_language
/**
* @param $post_id
* @param $taxonomy
* Synchronizes a posts taxonomy term's languages with the posts language for all translations of the post.
*
*/
public static function sync_post_and_taxonomy_terms_language($post_id, $taxonomy)
{
global $sitepress;
$post = get_post($post_id);
$post_type = $post->post_type;
$post_trid = $sitepress->get_element_trid($post_id, 'post_' . $post_type);
$post_translations = $sitepress->get_element_translations($post_trid, 'post_' . $post_type);
$terms_from_original_post = wp_get_post_terms($post_id, $taxonomy);
$is_original = true;
if ($sitepress->get_original_element_id($post_id, 'post_' . $post_type) != $post_id) {
$is_original = false;
}
foreach ($post_translations as $post_language => $translated_post) {
$translated_post_id = $translated_post->element_id;
if (!$translated_post_id) {
continue;
}
$terms_from_translated_post = wp_get_post_terms($translated_post_id, $taxonomy);
if ($is_original) {
/** @var $iclTranslationManagement TranslationManagement */
$iclTranslationManagement = wpml_load_core_tm();
$duplicates = $iclTranslationManagement->get_duplicates($post_id);
if (in_array($translated_post_id, $duplicates)) {
$terms = array_merge($terms_from_original_post, $terms_from_translated_post);
} else {
$terms = $terms_from_translated_post;
}
} else {
$terms = $terms_from_translated_post;
}
foreach ((array) $terms as $term) {
$term_original_tax_id = $term->term_taxonomy_id;
$original_term_language_object = $sitepress->get_element_language_details($term_original_tax_id, 'tax_' . $term->taxonomy);
if ($original_term_language_object && isset($original_term_language_object->language_code)) {
$original_term_language = $original_term_language_object->language_code;
} else {
$original_term_language = $post_language;
}
if ($original_term_language != $post_language) {
$term_trid = $sitepress->get_element_trid($term_original_tax_id, 'tax_' . $term->taxonomy);
$translated_terms = $sitepress->get_element_translations($term_trid, 'tax_' . $term->taxonomy, false, false, true);
$term_id = $term->term_id;
wp_remove_object_terms($translated_post_id, (int) $term_id, $taxonomy);
if (isset($translated_terms[$post_language])) {
$term_in_correct_language = $translated_terms[$post_language];
wp_set_post_terms($translated_post_id, array((int) $term_in_correct_language->term_id), $taxonomy, true);
}
if (isset($term->term_taxonomy_id)) {
wp_update_term_count($term->term_taxonomy_id, $taxonomy);
}
}
wp_update_term_count($term_original_tax_id, $taxonomy);
}
}
}
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:61,代码来源:wpml-term-translations.class.php
示例10: load_core_tm
/**
* Load \TranslationManagement class.
*/
public function load_core_tm()
{
$iclTranslationManagement = wpml_load_core_tm();
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:7,代码来源:sitepress.class.php
示例11: get_tm_instance
public function get_tm_instance()
{
return wpml_load_core_tm();
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:4,代码来源:wpml-tm-action-helper.class.php
示例12: __construct
function __construct(&$networking)
{
wpml_load_core_tm();
$this->networking = $networking;
}
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:5,代码来源:wpml-icl-migration.class.php
注:本文中的wpml_load_core_tm函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论