本文整理汇总了PHP中Tags::get_by_frequency方法的典型用法代码示例。如果您正苦于以下问题:PHP Tags::get_by_frequency方法的具体用法?PHP Tags::get_by_frequency怎么用?PHP Tags::get_by_frequency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::get_by_frequency方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: default_options
/**
* function default_options
*
* returns defaults for the plugin
* @return array default options array
*/
private static function default_options()
{
$home_keys = array();
$tags = Tags::get_by_frequency(50, 'entry');
foreach ($tags as $tag) {
$home_keys[] = Utils::htmlspecialchars(strip_tags($tag->term_display));
}
return array('home_desc' => Utils::htmlspecialchars(strip_tags(Options::get('tagline'))), 'home_keywords' => $home_keys, 'home_index' => true, 'home_follow' => true, 'posts_index' => true, 'posts_follow' => true, 'archives_index' => false, 'archives_follow' => true);
}
示例2: ajax_tags
/**
* Handles AJAX from /admin/tags
* Used to search for, delete and rename tags
*/
public function ajax_tags()
{
Utils::check_request_method(array('POST', 'HEAD'));
$this->create_theme();
$params = $_POST['query'];
// Get a usable array with filter parameters from the odd syntax we received from the faceted search
$fetch_params = array();
if (isset($params)) {
foreach ($params as $param) {
$key = key($param);
// Revert translation
if ($key != 'text') {
$key = self::$facets[$key];
}
$value = current($param);
if (array_key_exists($key, $fetch_params)) {
$fetch_params[$key] = Utils::single_array($fetch_params[$key]);
$fetch_params[$key][] = $value;
} else {
$fetch_params[$key] = $value;
}
}
}
// Grab facets / params
$search = array_key_exists('text', $fetch_params) ? $fetch_params['text'] : null;
$min = array_key_exists('morethan', $fetch_params) ? $fetch_params['morethan'] + 1 : 0;
$max = array_key_exists('lessthan', $fetch_params) ? $fetch_params['lessthan'] - 1 : null;
$orderby_code = array_key_exists('orderby', $fetch_params) ? $fetch_params['orderby'] : null;
$orderby = isset($orderby_code) ? explode('_', self::$facet_values['orderby'][$orderby_code]) : ['alphabetical', 'asc'];
$this->theme->tags = Tags::get_by_frequency(null, null, $min, $max, $search, self::$orderby_translate[$orderby[0]], $orderby[1] == 'asc');
// Create FormUI elements (list items) from the filtered tag list
$this->theme->max = Tags::vocabulary()->max_count();
$this->theme->min = Tags::vocabulary()->min_count();
$output = '';
if (count($this->theme->tags) > 0) {
$listitems = $this->get_tag_listitems();
// Get HTML from FormUI
foreach ($listitems as $listitem) {
$output .= $listitem->get($this->theme);
}
}
$ar = new AjaxResponse();
$ar->html('#tag_collection', $output);
$ar->out();
}