本文整理汇总了PHP中TranslationProxy::has_custom_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationProxy::has_custom_fields方法的具体用法?PHP TranslationProxy::has_custom_fields怎么用?PHP TranslationProxy::has_custom_fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslationProxy
的用法示例。
在下文中一共展示了TranslationProxy::has_custom_fields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load()
{
global $pagenow;
self::ensure_includes();
$this->activate_embedded_modules();
global $sitepress;
$this->plugin_localization();
add_action('wp_ajax_basket_extra_fields_refresh', array($this, 'basket_extra_fields_refresh'));
// Check if WPML is active. If not display warning message and not load Sticky links
if (!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE) {
if (!function_exists('is_multisite') || !is_multisite()) {
add_action('admin_notices', array($this, '_no_wpml_warning'));
}
return false;
} elseif (!$sitepress->get_setting('setup_complete')) {
add_action('admin_notices', array($this, '_wpml_not_installed_warning'));
return false;
} elseif (version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) {
add_action('admin_notices', array($this, '_old_wpml_warning'));
return false;
}
if (isset($_GET['icl_action'])) {
if ($_GET['icl_action'] == 'reminder_popup') {
add_action('init', array('TranslationProxy_Popup', 'display'));
} elseif ($_GET['icl_action'] == 'dismiss_help') {
$sitepress->set_setting('dont_show_help_admin_notice', true);
$sitepress->save_settings();
}
}
if (is_admin() || defined('XMLRPC_REQUEST')) {
global $ICL_Pro_Translation;
$ICL_Pro_Translation = new WPML_Pro_Translation();
}
if (is_admin()) {
$this->automatic_service_selection();
add_action('translation_service_authentication', array($this, 'translation_service_authentication'));
add_filter('translation_service_js_data', array($this, 'translation_service_js_data'));
add_filter('wpml_string_status_text', array('WPML_Remote_String_Translation', 'string_status_text_filter'), 10, 3);
add_action('wp_ajax_translation_service_authentication', array($this, 'translation_service_authentication_ajax'));
add_action('wp_ajax_translation_service_toggle', array($this, 'translation_service_toggle_ajax'));
add_action('trashed_post', array($this, 'trashed_post_actions'), 10, 2);
add_action('wp_ajax_icl_get_jobs_table', 'icl_get_jobs_table');
add_action('wp_ajax_icl_cancel_translation_jobs', 'icl_cancel_translation_jobs');
add_action('wp_ajax_icl_populate_translations_pickup_box', 'icl_populate_translations_pickup_box');
add_action('wp_ajax_icl_pickup_translations', 'icl_pickup_translations');
add_action('wp_ajax_icl_get_job_original_field_content', 'icl_get_job_original_field_content');
add_action('wp_ajax_icl_get_blog_users_not_translators', 'icl_get_blog_users_not_translators');
add_action('wp_ajax_get_translator_status', array('TranslationProxy_Translator', 'get_translator_status_ajax'));
add_action('wpml_updated_translation_status', array('TranslationProxy_Batch', 'maybe_assign_generic_batch'), 10, 2);
add_action('wpml_added_local_translation_job', array('WPML_Translation_Job_Terms', 'set_translated_term_values'), 10, 2);
if (!defined('DOING_AJAX')) {
$has_custom_fields = TranslationProxy::has_custom_fields();
$custom_fields_data = TranslationProxy::get_custom_fields_data();
$current_service_name = TranslationProxy::get_current_service_name();
if ($has_custom_fields && $current_service_name && !$custom_fields_data && !$this->is_services_tab()) {
if (defined('WPML_TP_DEFAULT_SUID')) {
$service_tab_name = TranslationProxy::get_current_service_name();
} else {
$service_tab_name = __('Translators', 'wpml-translation-management');
}
$services_url = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=translators";
$href_open = '<strong><a href="' . $services_url . '">';
$href_close = '</a></strong>';
$services_link = $href_open . $service_tab_name . ' Tab' . $href_close;
$service_authentication_link = '<strong>' . __('Click here to authenticate', 'wpml-translation-management') . '</strong>';
$service_deactivation_link = '<strong>' . __('Click here to deactivate', 'wpml-translation-management') . '</strong>';
if (defined('WPML_TP_DEFAULT_SUID')) {
$authentication_message = __("You are using a translation service which requires authentication.", 'wpml-translation-management');
$authentication_message .= '<ul>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("Please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_authentication_link);
$authentication_message .= '</li>';
} else {
$authentication_message = __("You have selected a translation service which requires authentication.", 'wpml-translation-management');
$authentication_message .= '<ul>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("If you wish to use %s, please go to %s and use the link %s.", 'wpml-translation-management'), '<strong>' . $current_service_name . '</strong>', $services_link, $service_authentication_link);
$authentication_message .= '</li>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("If you wish to use only local translators, please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_deactivation_link);
$authentication_message .= '</li>';
$authentication_message .= '</ul>';
}
$args = array('id' => 'current_service_authentication_required', 'group' => 'current_service_authentication', 'msg' => $authentication_message, 'type' => 'error', 'admin_notice' => true, 'hide' => false, 'limit_to_page' => array(WPML_TM_FOLDER . '/menu/main.php'));
ICL_AdminNotifier::add_message($args);
} else {
ICL_AdminNotifier::remove_message('current_service_authentication_required');
}
if ($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == WPML_TM_FOLDER . '/menu/main.php' && (!isset($_GET['sm']) || $_GET['sm'] === 'dashboard')) {
$this->show_3_2_upgrade_notice();
}
}
do_action('wpml_tm_init');
if ($pagenow != 'customize.php') {
// stop TM scripts from messing up theme customizer
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
add_action('admin_print_styles', array($this, 'admin_print_styles'));
}
add_action('icl_wpml_top_menu_added', array($this, '_icl_hook_top_menu'));
add_action('admin_menu', array($this, 'menu'));
//.........这里部分代码省略.........
示例2: is_service_authenticated
/**
* Return true if $service has been succesfully authenticated
* Services that do not require authentication are by default authenticated
*
* @param bool $service
*
* @return bool
*/
public static function is_service_authenticated($service = false)
{
if (!$service) {
$service = self::get_current_service();
}
if (!$service) {
return false;
}
if (!TranslationProxy::service_requires_authentication($service)) {
return true;
}
$has_custom_fields = TranslationProxy::has_custom_fields();
$custom_fields_data = TranslationProxy::get_custom_fields_data();
if ($has_custom_fields && $custom_fields_data) {
return true;
}
return false;
}
示例3: service_requires_authentication
private function service_requires_authentication()
{
$result = false;
$service_has_translators = TranslationProxy::translator_selection_available();
if (!$service_has_translators) {
$has_custom_fields = TranslationProxy::has_custom_fields();
$custom_fields_data = TranslationProxy::get_custom_fields_data();
$result = $has_custom_fields && !$custom_fields_data;
}
return $result;
}