/** * Display tag cloud. * * The text size is set by the 'smallest' and 'largest' arguments, which will * use the 'unit' argument value for the CSS text size unit. The 'format' * argument can be 'flat' (default), 'list', or 'array'. The flat value for the * 'format' argument will separate tags with spaces. The list value for the * 'format' argument will format the tags in a UL HTML list. The array value for * the 'format' argument will return in PHP array type format. * * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'. * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'. * * The 'number' argument is how many tags to return. By default, the limit will * be to return the top 45 tags in the tag cloud list. * * The 'topic_count_text_callback' argument is a function, which, given the count * of the posts with that tag, returns a text for the tooltip of the tag link. * * The 'exclude' and 'include' arguments are used for the {@link get_tags()} * function. Only one should be used, because only one will be used and the * other ignored, if they are both set. * * @since 2.3.0 * * @param array|string $args Optional. Override default arguments. * @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument. */ function nxt_tag_cloud($args = '') { $defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true); $args = nxt_parse_args($args, $defaults); $tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC'))); // Always query top tags if (empty($tags) || is_nxt_error($tags)) { return; } foreach ($tags as $key => $tag) { if ('edit' == $args['link']) { $link = get_edit_tag_link($tag->term_id, $tag->taxonomy); } else { $link = get_term_link(intval($tag->term_id), $tag->taxonomy); } if (is_nxt_error($link)) { return false; } $tags[$key]->link = $link; $tags[$key]->id = $tag->term_id; } $return = nxt_generate_tag_cloud($tags, $args); // Here's where those top tags get sorted according to $args $return = apply_filters('nxt_tag_cloud', $return, $args); if ('array' == $args['format'] || empty($args['echo'])) { return $return; } echo $return; }
} else { die('0'); } $tags = get_terms($taxonomy, array('number' => 45, 'orderby' => 'count', 'order' => 'DESC')); if (empty($tags)) { die(isset($tax->no_tagcloud) ? $tax->no_tagcloud : __('No tags found!')); } if (is_nxt_error($tags)) { die($tags->get_error_message()); } foreach ($tags as $key => $tag) { $tags[$key]->link = '#'; $tags[$key]->id = $tag->term_id; } // We need raw tag names here, so don't filter the output $return = nxt_generate_tag_cloud($tags, array('filter' => 0)); if (empty($return)) { die('0'); } echo $return; exit; break; case 'get-comments': check_ajax_referer($action); set_current_screen('edit-comments'); $nxt_list_table = _get_list_table('nxt_Post_Comments_List_Table'); if (!current_user_can('edit_post', $post_id)) { die('-1'); } $nxt_list_table->prepare_items(); if (!$nxt_list_table->has_items()) {
function install_dashboard() { ?> <p><?php printf(__('Plugins extend and expand the functionality of NXTClass. You may automatically install plugins from the <a href="http://nxtclass.org/extend/plugins/">NXTClass Plugin Directory</a> or upload a plugin in .zip format via <a href="%s">this page</a>.'), self_admin_url('plugin-install.php?tab=upload')); ?> </p> <h4><?php _e('Search'); ?> </h4> <p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.'); ?> </p> <?php install_search_form(); ?> <h4><?php _e('Popular tags'); ?> </h4> <p class="install-help"><?php _e('You may also browse based on the most popular tags in the Plugin Directory:'); ?> </p> <?php $api_tags = install_popular_tags(); echo '<p class="popular-tags">'; if (is_nxt_error($api_tags)) { echo $api_tags->get_error_message(); } else { //Set up the tags in a way which can be interpreted by nxt_generate_tag_cloud() $tags = array(); foreach ((array) $api_tags as $tag) { $tags[$tag['name']] = (object) array('link' => esc_url(self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name']))), 'name' => $tag['name'], 'id' => sanitize_title_with_dashes($tag['name']), 'count' => $tag['count']); } echo nxt_generate_tag_cloud($tags, array('single_text' => __('%s plugin'), 'multiple_text' => __('%s plugins'))); } echo '</p><br class="clear" />'; }