本文整理匯總了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;
}