本文整理汇总了PHP中Tags::max_count方法的典型用法代码示例。如果您正苦于以下问题:PHP Tags::max_count方法的具体用法?PHP Tags::max_count怎么用?PHP Tags::max_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::max_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Produce HTML output for all this fieldset and all contained controls
*
* @param boolean $forvalidation True if this control should render error information based on validation.
* @return string HTML that will render this control in the form
*/
function get($forvalidation = true)
{
$theme = $this->get_theme($forvalidation, $this);
$max = Tags::max_count();
$tag = $this->tag;
$theme->class = 'tag_' . $tag->slug;
$theme->id = $tag->id;
$theme->weight = $max > 0 ? round($tag->count * 10 / $max) : 0;
$theme->caption = $tag->tag;
$theme->count = $tag->count;
return $theme->fetch('tabcontrol_tag', true);
}
示例2: ajax_tags
/**
* Handles AJAX from /admin/tags
* Used to delete and rename tags
*/
public function ajax_tags($handler_vars)
{
Utils::check_request_method(array('POST'));
$wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']);
if ($handler_vars['digest'] != $wsse['digest']) {
Session::error(_t('WSSE authentication failed.'));
echo Session::messages_get(true, array('Format', 'json_messages'));
return;
}
$tag_names = array();
$action = $this->handler_vars['action'];
switch ($action) {
case 'delete':
foreach ($_POST as $id => $delete) {
// skip POST elements which are not tag ids
if (preg_match('/^tag_\\d+/', $id) && $delete) {
$id = substr($id, 4);
$tag = Tags::get_by_id($id);
$tag_names[] = $tag->tag;
Tags::delete($tag);
}
}
$msg_status = sprintf(_n('Tag %s has been deleted.', 'Tags %s have been deleted.', count($tag_names)), implode($tag_names, ', '));
Session::notice($msg_status);
echo Session::messages_get(true, array('Format', 'json_messages'));
break;
case 'rename':
if (isset($this->handler_vars['master'])) {
$theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', TRUE));
$this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir);
$master = $this->handler_vars['master'];
$tag_names = array();
foreach ($_POST as $id => $rename) {
// skip POST elements which are not tag ids
if (preg_match('/^tag_\\d+/', $id) && $rename) {
$id = substr($id, 4);
$tag = Tags::get_by_id($id);
$tag_names[] = $tag->tag;
}
}
Tags::rename($master, $tag_names);
$msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master);
Session::notice($msg_status);
$this->theme->tags = Tags::get();
$this->theme->max = Tags::max_count();
echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection')));
}
break;
}
}
示例3: build_cloud
private function build_cloud()
{
$tags = Tags::get();
$max = Tags::max_count();
$hide = $this->get_hide_tag_list();
$this->step = $max / Options::get('fluffytag__steps');
$this->prefix = explode(',', Options::get('fluffytag__prefix'));
//$tags = array_filter($tags, create_function( '$a' 'return $a->slug == ' );
$tags = array_filter($tags, array($this, 'add_count'));
//print_r( $tags );
return $tags;
}