本文整理汇总了PHP中TranslationProxy::services方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationProxy::services方法的具体用法?PHP TranslationProxy::services怎么用?PHP TranslationProxy::services使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslationProxy
的用法示例。
在下文中一共展示了TranslationProxy::services方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_content_translation_services
public function build_content_translation_services()
{
$has_errors = false;
$reload = filter_input(INPUT_GET, 'reload_services', FILTER_VALIDATE_BOOLEAN);
$services = TranslationProxy::services($reload);
$has_errors |= icl_handle_error($services);
if (TranslationProxy::$errors) {
$has_errors |= true;
foreach (TranslationProxy::$errors as $error) {
icl_handle_error($error);
}
}
$active_service = TranslationProxy::get_current_service();
if (is_wp_error($active_service)) {
$has_errors |= icl_handle_error($active_service);
$active_service = false;
}
$service_activation_button_class = 'button-primary';
if ($active_service) {
$service_activation_button_class = 'button-secondary';
}
?>
<div class="js-available-services">
<?php
if (!TranslationProxy::get_tp_default_suid()) {
echo $this->wpml_refresh_translation_services_button();
}
if ($this->translation_service_has_translators($active_service)) {
echo $this->flush_website_details_cache_button();
}
if (!$has_errors) {
?>
<div class="icl-current-service">
<?php
if ($active_service) {
?>
<div class="img-wrap">
<img src="<?php
echo $active_service->logo_url;
?>
"
alt="<?php
echo $active_service->name;
?>
"/>
</div>
<div class="desc">
<?php
if (!TranslationProxy::get_tp_default_suid()) {
?>
<h3><?php
_e('Current service', 'wpml-translation-management');
?>
</h3>
<?php
}
?>
<h4><?php
echo $active_service->name;
?>
</h4>
<p>
<?php
echo $active_service->description;
?>
</p>
<?php
echo translation_service_details($active_service, true);
do_action('translation_service_authentication');
?>
</div>
<?php
}
?>
</div>
<?php
if (!TranslationProxy::get_tp_default_suid() && !empty($services)) {
?>
<ul class="icl-available-services">
<?php
foreach ($services as $service) {
$state = $active_service && $service->id == $active_service->id ? "active" : "inactive";
if ($state === 'inactive') {
?>
<li>
<div class="img-wrap js-activate-service"
data-target-id="<?php
echo $service->id;
?>
">
<img src="<?php
echo $service->logo_url;
?>
"
alt="<?php
echo $service->name;
?>
"/>
//.........这里部分代码省略.........
示例2: build_content_translation_services
public function build_content_translation_services()
{
$reload = filter_input(INPUT_GET, 'reload_services', FILTER_VALIDATE_BOOLEAN);
$services = TranslationProxy::services($reload);
icl_handle_error($services);
$active_service = TranslationProxy::get_current_service();
if (is_wp_error($active_service)) {
icl_handle_error($active_service);
$active_service = false;
}
?>
<div class="js-available-services">
<?php
if (!defined('WPML_TP_DEFAULT_SUID') || !WPML_TP_DEFAULT_SUID) {
echo $this->wpml_refresh_translation_services_button();
}
?>
<div class="icl-current-service">
<?php
if ($active_service) {
?>
<div class="img-wrap">
<img src="<?php
echo $active_service->logo_url;
?>
" alt="<?php
echo $active_service->name;
?>
"/>
</div>
<div class="desc">
<?php
if (!defined('WPML_TP_DEFAULT_SUID')) {
?>
<h3><?php
_e('Current service', 'wpml-translation-management');
?>
</h3>
<?php
}
?>
<h4><?php
echo $active_service->name;
?>
</h4>
<p>
<?php
echo $active_service->description;
?>
</p>
<?php
echo translation_service_details($active_service, true);
do_action('translation_service_authentication');
?>
</div>
<?php
}
?>
</div>
<?php
if (!defined('WPML_TP_DEFAULT_SUID') && !empty($services)) {
?>
<ul class="icl-available-services">
<?php
foreach ($services as $service) {
$state = $active_service && $service->id == $active_service->id ? "active" : "inactive";
if ($state === 'inactive') {
?>
<li>
<div class="img-wrap js-activate-service" data-target-id="<?php
echo $service->id;
?>
">
<img src="<?php
echo $service->logo_url;
?>
" alt="<?php
echo $service->name;
?>
"/>
</div>
<h4><?php
echo $service->name;
?>
</h4>
<p>
<?php
echo $service->description;
?>
<?php
echo translation_service_details($active_service, true);
?>
</p>
<p>
<button type="submit" class="js-activate-service-id"
data-id="<?php
//.........这里部分代码省略.........
示例3: regenerate_wrong_service_data
private function regenerate_wrong_service_data()
{
global $wpdb;
remove_filter('otgs_translation_get_services', 'filter_tp_services');
TranslationProxy::services(true);
$translators = $this->get_icl_translators();
$local_translators = TranslationManagement::get_blog_translators();
$icl_translator_ids = array();
$local_translator_ids = array();
foreach ($translators as $translator) {
$icl_translator_ids[] = $translator['id'];
}
foreach ($local_translators as $translator) {
$local_translator_ids[] = $translator->ID;
}
if ((bool) $icl_translator_ids === true) {
$icl_translators_snippet = " AND translator_id IN (" . wpml_prepare_in($icl_translator_ids) . ") ";
$local_translators_snippet = (bool) $local_translator_ids === true ? " AND translator_id NOT IN (" . wpml_prepare_in($local_translator_ids) . ') ' : '';
$wpdb->query($wpdb->prepare("\tUPDATE {$wpdb->prefix}icl_translation_status s\n\t\t\t\t\t\t\t\t\t\tSET s.translation_service = 'icl'\n\t\t\t\t\t\t\t\t\t\tWHERE s.status = %d\n\t\t\t\t\t\t\t\t\t\t\tAND s.translation_service != %d\n\t\t\t\t\t\t\t\t\t\t\t{$icl_translators_snippet}\n\t\t\t\t\t\t\t\t\t\t\t{$local_translators_snippet}", ICL_TM_IN_PROGRESS, $this->get_icl_service_id()));
}
}