本文整理汇总了PHP中TranslationProxy::get_custom_fields_data方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationProxy::get_custom_fields_data方法的具体用法?PHP TranslationProxy::get_custom_fields_data怎么用?PHP TranslationProxy::get_custom_fields_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslationProxy
的用法示例。
在下文中一共展示了TranslationProxy::get_custom_fields_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translation_service_authentication
function translation_service_authentication()
{
$active_service = TranslationProxy::get_current_service();
$custom_fields = TranslationProxy::get_custom_fields($active_service->id);
$auth_content[] = '<div class="js-service-authentication">';
$auth_content[] = '<ul>';
if (TranslationProxy::service_requires_authentication($active_service)) {
$auth_content[] = '<input type="hidden" name="service_id" id="service_id" value="' . $active_service->id . '" />';
$custom_fields_data = TranslationProxy::get_custom_fields_data();
if (!$custom_fields_data) {
$auth_content[] = '<li>';
$auth_content[] = '<p>';
$auth_content[] = sprintf(__('%s is active, but requires authentication data.', 'wpml-translation-management'), $active_service->name);
$auth_content[] = '</p>';
$auth_content[] = '</li>';
$auth_content[] = '<li>';
$auth_content[] = '<strong>';
$auth_content[] = '<a href="#" class="js-authenticate-service" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">';
$auth_content[] = __('Click here to authenticate.', 'wpml-translation-management');
$auth_content[] = '</a>';
$auth_content[] = '</strong>';
$auth_content[] = wp_nonce_field('authenticate_service', 'authenticate_service_nonce', true, false);
$auth_content[] = '<input type="hidden" name="custom_fields_serialized" id="custom_fields_serialized" value="" />';
$auth_content[] = '</li>';
} else {
$auth_content[] = '<li>';
$auth_content[] = '<p>';
$auth_content[] = sprintf(__('%s is authorized.', 'wpml-translation-management'), $active_service->name) . ' ';
$auth_content[] = '</p>';
$auth_content[] = '</li>';
$auth_content[] = '<li>';
$auth_content[] = '<strong>';
$auth_content[] = '<a href="#" class="js-invalidate-service" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">';
$auth_content[] = __('Click here to de-authorize.', 'wpml-translation-management');
$auth_content[] = '</a>';
$auth_content[] = '</strong>';
$auth_content[] = wp_nonce_field('invalidate_service', 'invalidate_service_nonce', true, false);
$auth_content[] = '</li>';
}
}
if (!defined('WPML_TP_DEFAULT_SUID')) {
$auth_content[] = '<li>';
$auth_content[] = '<strong>';
$auth_content[] = '<a href="#" class="js-deactivate-service" data-id="' . $active_service->id . '" data-custom-fields="' . esc_attr(wp_json_encode($custom_fields)) . '">';
$auth_content[] = __('Click here to deactivate.', 'wpml-translation-management');
$auth_content[] = '</a>';
$auth_content[] = '</strong>';
$auth_content[] = '</li>';
}
$auth_content[] = '</ul>';
$auth_content[] = '</div>';
$auth_content_full = implode("\n", $auth_content);
ICL_AdminNotifier::display_instant_message($auth_content_full);
}
示例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;
}