本文整理汇总了PHP中WPSEO_Taxonomy_Meta::get_keyword_usage方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Taxonomy_Meta::get_keyword_usage方法的具体用法?PHP WPSEO_Taxonomy_Meta::get_keyword_usage怎么用?PHP WPSEO_Taxonomy_Meta::get_keyword_usage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Taxonomy_Meta
的用法示例。
在下文中一共展示了WPSEO_Taxonomy_Meta::get_keyword_usage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: item_to_response
/**
* Convert the given term into a analyzable object.
*
* @param mixed $item The term for which to build the analyzer data.
*
* @return array
*/
protected function item_to_response($item)
{
$focus_keyword = $this->get_focus_keyword($item);
$title = str_replace(' %%page%% ', ' ', $this->get_title($item));
$meta = $this->get_meta_description($item);
$description = $item->description;
/**
* Filter the term description for recalculation.
*
* @param string $description Content of the term. Modify to reflect front-end content.
* @oaram WP_Term $item The term the description comes from.
*/
$description = apply_filters('wpseo_term_description_for_recalculation', $description, $item);
return array('term_id' => $item->term_id, 'taxonomy' => $item->taxonomy, 'text' => $description, 'keyword' => $focus_keyword, 'url' => urldecode($item->slug), 'pageTitle' => apply_filters('wpseo_title', wpseo_replace_vars($title, $item, array('page'))), 'meta' => apply_filters('wpseo_metadesc', wpseo_replace_vars($meta, $item)), 'keyword_usage' => array($focus_keyword => WPSEO_Taxonomy_Meta::get_keyword_usage($focus_keyword, $item->term_id, $item->taxonomy)));
}
示例2: localize_term_scraper_script
/**
* Pass variables to js for use with the term-scraper
*
* @return array
*/
public function localize_term_scraper_script()
{
$translations = $this->get_scraper_translations();
$term_id = filter_input(INPUT_GET, 'tag_ID');
$term = get_term_by('id', $term_id, $this->get_taxonomy());
$focuskw = WPSEO_Taxonomy_Meta::get_term_meta($term, $term->taxonomy, 'focuskw');
$taxonomy = get_taxonomy($term->taxonomy);
$options = WPSEO_Options::get_all();
$base_url = home_url('/', null);
if (!$options['stripcategorybase']) {
$base_url = trailingslashit($base_url . $taxonomy->rewrite['slug']);
}
return array('translations' => $translations, 'base_url' => $base_url, 'taxonomy' => $term->taxonomy, 'keyword_usage' => WPSEO_Taxonomy_Meta::get_keyword_usage($focuskw, $term->term_id, $term->taxonomy), 'search_url' => admin_url('edit-tags.php?taxonomy=' . $term->taxonomy . '&seo_kw_filter={keyword}'), 'post_edit_url' => admin_url('edit-tags.php?action=edit&taxonomy=' . $term->taxonomy . '&tag_ID={id}'), 'title_template' => WPSEO_Taxonomy::get_title_template($term), 'metadesc_template' => WPSEO_Taxonomy::get_metadesc_template($term), 'contentTab' => __('Content:', 'wordpress-seo'));
}
示例3: ajax_get_term_keyword_usage
/**
* Retrieves the keyword for the keyword doubles of the termpages.
*/
function ajax_get_term_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
$taxonomy = filter_input(INPUT_POST, 'taxonomy');
wp_die(WPSEO_Utils::json_encode(WPSEO_Taxonomy_Meta::get_keyword_usage($keyword, $post_id, $taxonomy)));
}
示例4: ajax_get_term_keyword_usage
/**
* Retrieves the keyword for the keyword doubles of the termpages.
*/
function ajax_get_term_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
$taxonomyName = filter_input(INPUT_POST, 'taxonomy');
$taxonomy = get_taxonomy($taxonomyName);
if (!$taxonomy) {
wp_die(0);
}
if (!current_user_can($taxonomy->cap->edit_terms)) {
wp_die(-1);
}
$usage = WPSEO_Taxonomy_Meta::get_keyword_usage($keyword, $post_id, $taxonomyName);
// Normalize the result so it it the same as the post keyword usage AJAX request.
$usage = $usage[$keyword];
wp_die(wp_json_encode($usage));
}
示例5: get_focus_keyword_usage
/**
* Counting the number of given keyword used for other term than given term_id
*
* @return array
*/
private function get_focus_keyword_usage()
{
$focuskw = WPSEO_Taxonomy_Meta::get_term_meta($this->term, $this->term->taxonomy, 'focuskw');
return WPSEO_Taxonomy_Meta::get_keyword_usage($focuskw, $this->term->term_id, $this->term->taxonomy);
}
示例6: ajax_get_term_keyword_usage
/**
* Retrieves the keyword for the keyword doubles of the termpages.
*/
function ajax_get_term_keyword_usage()
{
$post_id = filter_input(INPUT_POST, 'post_id');
$keyword = filter_input(INPUT_POST, 'keyword');
$taxonomy = filter_input(INPUT_POST, 'taxonomy');
if (!current_user_can('edit_terms')) {
die('-1');
}
$usage = WPSEO_Taxonomy_Meta::get_keyword_usage($keyword, $post_id, $taxonomy);
// Normalize the result so it it the same as the post keyword usage AJAX request.
$usage = $usage[$keyword];
wp_die(WPSEO_Utils::json_encode($usage));
}