/** @see WP_Widget::form */ function form($instance) { nktagcloud_load_translation_file(); $defaults = nktagcloud_defaults(); // get default values $instance = wp_parse_args((array) $instance, $defaults['config']); $title = esc_attr($instance['title']); ?> <p> <?php $this->nktagcloud_input(__('Title', 'nktagcloud'), 'title', 15, $title); ?> <br /> <?php $this->nktagcloud_input(__('Taxonomy', 'nktagcloud'), 'taxonomy', 15, $instance['taxonomy']); ?> <br /> <?php $this->nktagcloud_input(__('Smallest font size', 'nktagcloud'), 'smallest', 4, $instance['smallest']); ?> <?php $this->nktagcloud_input(__('Largest font size', 'nktagcloud'), 'largest', 4, $instance['largest']); ?> <?php $this->nktagcloud_select(__('Unit', 'nktagcloud'), 'unit', array('pt', 'px', '%', 'em', 'ex', 'mm'), $instance['unit']); ?> <br /> <?php $this->nktagcloud_input(__('Numbers of tags to show', 'nktagcloud'), 'number', 4, $instance['number']); ?> <br /> <?php $this->nktagcloud_select(__('Format', 'nktagcloud'), 'format', array('flat', 'list'), $instance['format']); ?> <br /> <?php $this->nktagcloud_select(__('Order', 'nktagcloud'), 'order', array('ASC', 'DESC', 'RAND'), $instance['order']); ?> <?php $this->nktagcloud_select(__('Orderby', 'nktagcloud'), 'orderby', array('name', 'count', 'both'), $instance['orderby']); ?> <p> <?php _e("The 'both' option of <tt>Orderby</tt> will sort by post count first and then by name. It doesn't exist in the default tag cloud and will ignore the <tt>Order</tt> option.", 'nktagcloud'); ?> </p> <?php $this->nktagcloud_select(__('Add post count to tags?', 'nktagcloud'), 'inject_count', array('No', 'Yes'), $instance['inject_count']); ?> <?php $this->nktagcloud_select(__('Put the post count outside of the hyperlink?', 'nktagcloud'), 'inject_count_outside', array('No', 'Yes'), $instance['inject_count_outside']); ?> <br /> <?php $this->nktagcloud_input(__('Show only tags that have been used at least so many times:', 'nktagcloud'), 'mincount', 4, $instance['mincount']); ?> <br /> <?php $this->nktagcloud_select(__('Add categories to tag cloud?', 'nktagcloud'), 'categories', array('No', 'Yes'), $instance['categories']); ?> <br /> <?php $this->nktagcloud_select(__('Force tags with multiple words on one line?', 'nktagcloud'), 'replace', array('No', 'Yes'), $instance['replace']); ?> <br /> <?php $this->nktagcloud_input(__('Tag separator', 'nktagcloud'), 'separator', 4, $instance['separator']); ?> <?php $this->nktagcloud_select(__('Hide the last separator?', 'nktagcloud'), 'hidelastseparator', array('No', 'Yes'), $instance['hidelastseparator']); ?> <br /> <?php $this->nktagcloud_select(__('Add the nofollow attribute?', 'nktagcloud'), 'nofollow', array('No', 'Yes'), $instance['nofollow']); ?> <br /> <h3><?php _e('Exclude/Include tags', 'nktagcloud'); ?> </h3> <p> <?php _e('Comma separated list of tags (term_id) to exclude or include. For example, <tt>exclude=5,27</tt> means that tags that have the <tt>term_id</tt> 5 or 27 will NOT be displayed. See <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud">Template Tags/wp tag cloud</a>.', 'nktagcloud'); ?> </p> <?php $this->nktagcloud_input(__('Exclude Tags', 'nktagcloud'), 'exclude', 40, $instance['exclude']); ?> <br /> <?php $this->nktagcloud_input(__('Include Tags', 'nktagcloud'), 'include', 40, $instance['include']); ?> <br /> </p> <?php }
/** * The configuration page * * TODO this is messy... */ function nktagcloud_options_page() { nktagcloud_load_translation_file(); #echo '<pre>'; var_dump( $_POST ); echo '</pre>'; echo '<hr>'; if (current_user_can('manage_options')) { if ($_POST['config']) { #function_exists( 'check_admin_referer ') ? check_admin_referer( 'nktagcloud' ) : null; $nonce = $_POST['_wpnonce']; if (!wp_verify_nonce($nonce, 'nktagcloud-config')) { die('Security check'); } $option = get_option('nktagcloud'); $option['config'] = $_POST['config']; update_option('nktagcloud', $option); $config = $option['config']; } elseif ($_POST['reset']) { function_exists('check_admin_referer ') ? check_admin_referer('nktagcloud') : null; $nonce = $_POST['_wpnonce']; if (!wp_verify_nonce($nonce, 'nktagcloud-reset')) { die('Security check'); } nktagcloud_reset(); } $option = get_option('nktagcloud'); $config = $option['config']; ?> <div id="nkuttler" class="wrap" > <h2><?php _e('Better Tag Cloud', 'nktagcloud'); ?> </h2> <?php require_once 'nkuttler.php'; ?> <?php nkuttler0_2_4_links('nktagcloud', 'http://www.nkuttler.de/wordpress-plugin/a-better-tag-cloud-widget/'); ?> <p> <?php _e('The default tag cloud widget that comes with wordpress is very simple. This plugin makes the options for wp_tag_cloud() available to this new tag cloud widget and a shortcode. It has new features as well.', 'nktagcloud'); ?> </p> <p> <?php _e('<strong>New</strong> It is now possible to insert a tag cloud into any post or page. Just put the <tt>[nktagcloud]</tt> shortcode into any post or page.', 'nktagcloud'); ?> </p> <h2><?php _e('Tag cloud Configuration', 'nktagcloud'); ?> </h2> <p> <?php _e('Please see <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud" target="_blank">the wp_tag_cloud() page</a> for a detailed description of the options.', 'nktagcloud'); ?> </p> <form action="" method="post"> <?php function_exists('wp_nonce_field') ? wp_nonce_field('nktagcloud-config') : null; ?> <h2><?php _e('Deprecated settings, please use the new widget', 'nktagcloud'); ?> </h2> <h3><?php _e('CSS settings', 'nktagcloud'); ?> </h3> <p> <?php _e("By default this plugin includes CSS to make the list look like a normal cloud. The CSS settings may or may not work on your template, depending on it's CSS.", 'nktagcloud'); ?> </p> <?php nktagcloud_select(__('Remove CSS for list format that displays the tags inline?', 'nktagcloud'), 'rmcss', array('No', 'Yes'), false); ?> <?php nktagcloud_select(__('Tag link decoration', 'nktagcloud'), 'decor', array('underline', 'none', 'don\'t touch'), false); ?> <br /> <?php nktagcloud_select(__('Use automatic colors for the tag cloud?', 'nktagcloud'), 'colorize', array('No', 'Yes'), false); ?> <br /> <?php nktagcloud_select(__('Hide the widget header markup if the widget title is empty?', 'nktagcloud'), 'hideemptywidgetheader', array('No', 'Yes'), false); ?> <br /> <?php nktagcloud_select(__('Remove link to plugin website?', 'nktagcloud'), 'homelink', array('No', 'Yes'), false); ?> <br /> <?php nktagcloud_submit(__('Save changes', 'nktagcloud'), 'button-primary', false); ?> <?php nktagcloud_input(__('Title', 'nktagcloud'), 'title', 15, $config['title']); ?> <br /> <?php nktagcloud_input(__('Taxonomy', 'nktagcloud'), 'taxonomy', 15, $config['taxonomy']); ?> <br /> <?php nktagcloud_input(__('Smallest font size', 'nktagcloud'), 'smallest', 4, $config['smallest']); ?> <?php nktagcloud_input(__('Largest font size', 'nktagcloud'), 'largest', 4, $config['largest']); ?> <?php nktagcloud_select(__('Unit', 'nktagcloud'), 'unit', array('pt', 'px', '%', 'em', 'ex', 'mm')); ?> <br /> <?php nktagcloud_input(__('Numbers of tags to show', 'nktagcloud'), 'number', 4, $config['number']); ?> <br /> <?php nktagcloud_select(__('Format', 'nktagcloud'), 'format', array('flat', 'list')); ?> <br /> <?php nktagcloud_select(__('Order', 'nktagcloud'), 'order', array('ASC', 'DESC', 'RAND')); ?> <?php nktagcloud_select(__('Orderby', 'nktagcloud'), 'orderby', array('name', 'count', 'both')); ?> <p> <?php _e("The 'both' option of <tt>Orderby</tt> will sort by post count first and then by name. It doesn't exist in the default tag cloud and will ignore the <tt>Order</tt> option.", 'nktagcloud'); ?> </p> <?php nktagcloud_select(__('Add post count to tags?', 'nktagcloud'), 'inject_count', array('No', 'Yes')); ?> <?php nktagcloud_select(__('Put the post count outside of the hyperlink?', 'nktagcloud'), 'inject_count_outside', array('No', 'Yes')); ?> <br /> <?php nktagcloud_input(__('Show only tags that have been used at least so many times:', 'nktagcloud'), 'mincount', 4, $config['mincount']); ?> <br /> <?php nktagcloud_select(__('Add categories to tag cloud?', 'nktagcloud'), 'categories', array('No', 'Yes')); ?> <br /> <?php nktagcloud_select(__('Force tags with multiple words on one line?', 'nktagcloud'), 'replace', array('No', 'Yes')); ?> <br /> <?php nktagcloud_input(__('Tag separator', 'nktagcloud'), 'separator', 4, $config['separator']); ?> <?php nktagcloud_select(__('Hide the last separator?', 'nktagcloud'), 'hidelastseparator', array('No', 'Yes')); ?> <br /> <?php nktagcloud_select(__('Add the nofollow attribute?', 'nktagcloud'), 'nofollow', array('No', 'Yes')); ?> <br /> <?php nktagcloud_submit(__('Save changes', 'nktagcloud')); ?> <h3><?php _e('Exclude/Include tags', 'nktagcloud'); ?> </h3> <p> <?php _e('Comma separated list of tags (term_id) to exclude or include. For example, <tt>exclude=5,27</tt> means that tags that have the <tt>term_id</tt> 5 or 27 will NOT be displayed. See <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud">Template Tags/wp tag cloud</a>.', 'nktagcloud'); ?> </p> <?php nktagcloud_input(__('Exclude Tags', 'nktagcloud'), 'exclude', 40, $config['exclude']); ?> <br /> <?php nktagcloud_input(__('Include Tags', 'nktagcloud'), 'include', 40, $config['include']); ?> <br /> <?php nktagcloud_submit(__('Save changes', 'nktagcloud')); ?> </form> <h3><?php _e('Reset the tag cloud', 'nktagcloud'); ?> </h3> <p> <?php _e('Use this if you want to delete your configuration and restore the defaults.', 'nktagcloud'); ?> </p> <form action="" method="post" > <?php function_exists('wp_nonce_field') ? wp_nonce_field('nktagcloud-reset') : null; ?> <input type="hidden" name="reset" value="ihatephp" /> <?php nktagcloud_submit(__('Reset the tag cloud', 'nktagcloud'), 'button-secondary'); ?> </form> </div> <?php } }