当前位置: 首页>>代码示例>>PHP>>正文


PHP TranslationManagement::get_blog_not_translators方法代码示例

本文整理汇总了PHP中TranslationManagement::get_blog_not_translators方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationManagement::get_blog_not_translators方法的具体用法?PHP TranslationManagement::get_blog_not_translators怎么用?PHP TranslationManagement::get_blog_not_translators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TranslationManagement的用法示例。


在下文中一共展示了TranslationManagement::get_blog_not_translators方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: icl_get_blog_users_not_translators

function icl_get_blog_users_not_translators()
{
    $translator_drop_down_options = array();
    $nonce = filter_input(INPUT_POST, 'get_users_not_trans_nonce');
    if (!wp_verify_nonce($nonce, 'get_users_not_trans_nonce')) {
        die('Wrong Nonce');
    }
    $blog_users_nt = TranslationManagement::get_blog_not_translators();
    foreach ((array) $blog_users_nt as $u) {
        $label = $u->display_name . ' (' . $u->user_login . ')';
        $value = esc_attr($u->display_name);
        $translator_drop_down_options[] = array('label' => $label, 'value' => $value, 'id' => $u->ID);
    }
    wp_send_json_success($translator_drop_down_options);
}
开发者ID:agiper,项目名称:wordpress,代码行数:15,代码来源:ajax.php

示例2: icl_local_edit_translator_form

    /**
     * Add/edit local translator form
     *
     * @param string $action add|edit
     * @param int|object $selected_translator
     *
     * @global object $sitepress
     * @return mixed
     */
    private function icl_local_edit_translator_form($action = 'add', $selected_translator = 0)
    {
        global $sitepress;
        $blog_users_nt = TranslationManagement::get_blog_not_translators();
        $output = '';
        $return['name'] = __('Local', 'wpml-translation-management');
        $return['description'] = __('Your own translators', 'wpml-translation-management');
        if ($action == 'add' && empty($blog_users_nt)) {
            $alert_message = '<p>';
            $alert_message .= __('All WordPress users are already translators. To add more translators, first create accounts for them.', 'wpml-translation-management');
            $alert_message .= '</p>';
            $return['content'] = '';
            $return['messages'] = ICL_AdminNotifier::display_instant_message($alert_message, 'information', false, true);
            return $return;
        }
        $output .= '<div id="icl_tm_add_user_errors">
        <span class="icl_tm_no_to">' . __('Select user.', 'wpml-translation-management') . '</span>
    </div>
    <input type="hidden" name="icl_tm_action" value="' . $action . '_translator" />' . wp_nonce_field($action . '_translator', $action . '_translator_nonce', true, false);
        if (!$selected_translator) {
            $output .= '<input type="hidden" id="icl_tm_selected_user" name="user_id" />';
            $output .= '<input type="text" id="icl_quick_src_users" placeholder="' . esc_attr__('search', 'wpml-translation-management') . '" />';
            $output .= '&nbsp;<span id="icl_user_src_nf"></span>';
            $output .= '<img style="display:none;margin-left:3px;" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" class="waiting" alt="" />';
            $output .= '<p>' . __('To add translators, they must first have accounts in WordPress. Translators can have any editing privileges, including subscriber.') . '</p>';
        } else {
            $output .= '<span class="updated fade" style="padding:4px">' . sprintf(__('Editing language pairs for <strong>%s</strong>', 'wpml-translation-management'), esc_html($selected_translator->display_name) . ' (' . $selected_translator->user_login . ')') . '</span>';
            $output .= '<input type="hidden" name="user_id" value="' . $selected_translator->ID . '" />';
        }
        if ($selected_translator) {
            $output .= '<br />

      <div class="icl_tm_lang_pairs"';
            if ($selected_translator) {
                $output .= ' style="display:block"';
            }
            $output .= '>
          <ul>';
            $languages = $sitepress->get_active_languages();
            foreach ($languages as $from_lang) {
                $lang_from_selected = false;
                if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) {
                    $lang_from_selected = true;
                }
                $output .= '<li class="js-icl-tm-lang-from';
                if ($lang_from_selected) {
                    $output .= ' js-lang-from-selected';
                }
                $output .= '">';
                $output .= '<label><input class="icl_tm_from_lang" type="checkbox"';
                if ($lang_from_selected) {
                    $output .= ' checked="checked"';
                }
                $output .= ' />&nbsp;';
                $output .= sprintf(__('From %s', 'wpml-translation-management'), $from_lang['display_name']) . '</label>
              <div class="icl_tm_lang_pairs_to"';
                if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) {
                    $output .= ' style="display:block"';
                }
                $output .= '>
                  <small>' . __('to', 'wpml-translation-management') . '</small>
                  <ul>';
                foreach ($sitepress->get_active_languages() as $to_lang) {
                    if ($from_lang['code'] == $to_lang['code']) {
                        continue;
                    }
                    $lang_selected = false;
                    if ($selected_translator->ID && isset($selected_translator->language_pairs[$from_lang['code']][$to_lang['code']])) {
                        $lang_selected = true;
                    }
                    $output .= '<li class="js-icl-tm-lang-pair';
                    if ($lang_selected) {
                        $output .= ' js-lang-pair-selected';
                    }
                    $output .= '">
                      <label><input class="icl_tm_to_lang" type="checkbox" name="lang_pairs[' . $from_lang['code'] . '][' . $to_lang['code'] . ']" value="1"';
                    if ($lang_selected) {
                        $output .= ' checked="checked"';
                    }
                    $output .= ' />&nbsp;';
                    $output .= $to_lang['display_name'] . '</label>&nbsp;
                      </li>';
                }
                $output .= '</ul>
              </div>
              </li>';
            }
            $output .= '</ul>';
            $output .= '
      <input class="button-primary" type="submit" value="';
            $output .= $selected_translator ? esc_attr(__('Update', 'wpml-translation-management')) : esc_attr(__('Add as translator', 'wpml-translation-management'));
//.........这里部分代码省略.........
开发者ID:ryuqing,项目名称:cake,代码行数:101,代码来源:wpml-translator-settings.class.php

示例3: icl_local_edit_translator_form

/**
 * Add/edit local translator form
 *
 * @global object $sitepress
 * @param string $action add|edit
 * @param object $selected_translator
 * @return mixed
 */
function icl_local_edit_translator_form($action = 'add', $selected_translator = 0)
{
    global $sitepress, $iclTranslationManagement, $sitepress_settings;
    $blog_users_nt = TranslationManagement::get_blog_not_translators();
    $blog_users_t = TranslationManagement::get_blog_translators();
    $output = '';
    $return['name'] = __('Local', 'wpml-translation-management');
    $return['description'] = __('Your own translators', 'wpml-translation-management');
    if ($action == 'add' && empty($blog_users_nt)) {
        $output .= '<span class="updated fade" style="padding:4px">' . __('All WordPress users are already translators. To add more translators, first create accounts for them.', 'wpml-translation-management') . '</span>';
        $return['content'] = $output;
        return $return;
    }
    $output .= '<div id="icl_tm_add_user_errors">
        <span class="icl_tm_no_to">' . __('Select user.', 'wpml-translation-management') . '</span>
    </div>
    <input type="hidden" name="icl_tm_action" value="' . $action . '_translator" />' . wp_nonce_field($action . '_translator', $action . '_translator_nonce', true, false);
    if (!$selected_translator) {
        $output .= '<input type="hidden" id="icl_tm_selected_user" name="user_id" />';
        $output .= '<input type="text" id="icl_quick_src_users" placeholder="' . esc_attr__('search', 'sitepress') . '" />';
        $output .= '<img style="display:none;margin-left:3px;" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" class="waiting" alt="" />';
        if (count($blog_users_nt) <= 10) {
            $cssheight = 20 * count($blog_users_nt) + 5;
            $output .= '<select size="10" class="icl_tm_auto_suggest_dd" style="visibility:hidden;height:' . $cssheight . 'px">';
            foreach ($blog_users_nt as $u) {
                $output .= '<option value="' . $u->ID . '|' . esc_attr($u->display_name) . '">' . $u->display_name . ' (' . $u->user_login . ')' . '</option>';
            }
            $output .= '</select>';
        }
        $output .= '<p>' . __('To add translators, they must first have accounts in WordPress. Translators can have any editing privileges, including subscriber.') . '</p>';
    } else {
        $output .= '<span class="updated fade" style="padding:4px">' . sprintf(__('Editing language pairs for <strong>%s</strong>', 'wpml-translation-management'), esc_html($selected_translator->display_name) . ' (' . $selected_translator->user_login . ')') . '</span>';
        $output .= '<input type="hidden" name="user_id" value="' . $selected_translator->ID . '" />';
    }
    if ($selected_translator) {
        $output .= '<br />

      <div class="icl_tm_lang_pairs"';
        if ($selected_translator) {
            $output .= ' style="display:block"';
        }
        $output .= '>
          <ul>';
        $languages = $sitepress->get_active_languages();
        if (defined('WPML_ST_VERSION') && isset($sitepress_settings['st']['strings_language']) && !isset($languages[$sitepress_settings['st']['strings_language']])) {
            $languages[$sitepress_settings['st']['strings_language']] = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
            $languages[$sitepress_settings['st']['strings_language']]['display_name'] .= ' ' . __('(only for strings)', 'wpml-translation-management');
        }
        foreach ($languages as $from_lang) {
            $output .= '<li>
              <label><input class="icl_tm_from_lang" type="checkbox"';
            if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) {
                $output .= ' checked="checked"';
            }
            $output .= ' />&nbsp;';
            $output .= sprintf(__('From %s', 'wpml-translation-management'), $from_lang['display_name']) . '</label>
              <div class="icl_tm_lang_pairs_to"';
            if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) {
                $output .= ' style="display:block"';
            }
            $output .= '>
                  <small>' . __('to', 'wpml-translation-management') . '</small>
                  <ul>';
            foreach ($sitepress->get_active_languages() as $to_lang) {
                if ($from_lang['code'] == $to_lang['code']) {
                    continue;
                }
                $output .= '<li>
                      <label><input class="icl_tm_to_lang" type="checkbox" name="lang_pairs[' . $from_lang['code'] . '][' . $to_lang['code'] . ']" value="1"';
                if ($selected_translator->ID && isset($selected_translator->language_pairs[$from_lang['code']][$to_lang['code']])) {
                    $output .= ' checked="checked"';
                }
                $output .= ' />&nbsp;';
                $output .= $to_lang['display_name'] . '</label>&nbsp;
                      </li>';
            }
            $output .= '</ul>
              </div>
              </li>';
        }
        $output .= '</ul>';
        $output .= '
      <input class="button-primary" type="submit" value="';
        $output .= $selected_translator ? esc_attr(__('Update', 'wpml-translation-management')) : esc_attr(__('Add as translator', 'wpml-translation-management'));
        $output .= '" />&nbsp;<input type="submit" value="' . __('Cancel', 'wpml-translation-management') . '" name="cancel" class="button-secondary" onclick="history.go(-1); return false;" />';
    }
    $return['content'] = $output;
    return $action == 'edit' ? $output : $return;
}
开发者ID:StudioCreate,项目名称:Uncle-Hummer-WordPress-Theme,代码行数:97,代码来源:translators.php

示例4: esc_attr

                if (isset($button['setup_url'])) {
                    echo '<input type="hidden" id="' . $service . '_setup_url" name="' . $service . '_setup_url" value="' . $button['setup_url'] . '" />' . "\r\n";
                }
                echo '</div>';
            }
            echo '<br style="clear:both;" />';
            echo '<input id="icl_add_translator_submit" class="button-primary" type="submit" value="' . esc_attr(__('Add translator', 'wpml-translation-management')) . '" />' . "\r\n";
            echo '</form>' . "\r\n";
            echo '</div>' . "\r\n";
        } else {
            _e('No add translator interface available', 'wpml-translation-management');
        }
    }
    // Translators lists
    // Local translators
    $blog_users_nt = TranslationManagement::get_blog_not_translators();
    $blog_users_t = TranslationManagement::get_blog_translators();
    $other_service_translators = TranslationManagement::icanlocalize_translators_list();
    ?>
        
        <?php 
    if (!empty($blog_users_t) || !empty($other_service_translators)) {
        ?>
            <h3><?php 
        _e('Current translators', 'wpml-translation-management');
        ?>
</h3>
            <table class="widefat fixed" cellspacing="0">
            <thead>
            <tr class="thead">
                <th><?php 
开发者ID:ViktorLinnasaar,项目名称:hanset,代码行数:31,代码来源:translators.php


注:本文中的TranslationManagement::get_blog_not_translators方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。