Example #1
0
	function widget( $args, $instance ) {
		extract( $args );
		
		// Set values and clean it
		foreach ( (array) $this->getFields() as $field => $field_value ) {
			${$field} = trim( $instance[$field] );
		}
		
		$param = '';
		
		// Selection
		$param .= ( !empty($selectionby) ) ? '&selectionby='.$selectionby : '&selectionby=count';
		$param .= ( !empty($selection) )   ? '&selection='.$selection	 : '&selection=desc';
		
		// Order
		$param .= ( !empty($orderby) ) ? '&orderby='.$orderby : '&orderby=random';
		$param .= ( !empty($order) )   ? '&order='.$order	 : '&order=asc';
		
		// Max tags
		if ( (int) $max != 0 ) $param .= '&number='.$max;
		
		// Size Mini
		if ( (int) $smini != 0 ) $param .= '&smallest='.$smini;
		
		// Size Maxi
		if ( (int) $smax != 0 ) $param .= '&largest='.$smax;
		
		// Unit
		if ( !empty($unit) ) $param .= '&unit='.$unit;
		
		// Format
		if ( !empty($format) ) $param .= '&format='.$format;
		
		// Use color ?
		if ( (int) $color == 0 ) $param .= '&color=false';
		
		// Color mini
		if ( !empty($cmini) ) $param .= '&mincolor='.$cmini;
		
		// Color Max
		if ( !empty($cmax) ) $param .= '&maxcolor='.$cmax;
		
		// Xformat
		if ( !empty($xformat) ) $param .= '&xformat='.$xformat;
		
		echo $before_widget;
		echo $before_title . apply_filters( 'widget_title', $title ) . $after_title;
			st_tag_cloud( apply_filters( 'simple-tags-widget', 'title='.$param, $instance ) ); // Use Widgets title and no ST title !!
		echo $after_widget;
	}
    /**
     * Method for build the page HTML manage tags
     *
     * @return void
     * @author Amaury Balmer
     */
    function pageManageTags()
    {
        global $simple_tags;
        // Control Post data
        if (isset($_POST['term_action'])) {
            if (!wp_verify_nonce($_POST['term_nonce'], 'simpletags_admin')) {
                // Origination and intention
                $this->message = __('Security problem. Try again. If this problem persist, contact <a href="mailto:amaury@wordpress-fr.net">plugin author</a>.', 'simpletags');
                $this->status = 'error';
            } elseif (!isset($this->taxonomy) || !taxonomy_exists($this->taxonomy)) {
                // Valid taxo ?
                $this->message = __('Missing valid taxonomy for work... Try again. If this problem persist, contact <a href="mailto:amaury@wordpress-fr.net">plugin author</a>.', 'simpletags');
                $this->status = 'error';
            } elseif ($_POST['term_action'] == 'renameterm') {
                $oldtag = isset($_POST['renameterm_old']) ? $_POST['renameterm_old'] : '';
                $newtag = isset($_POST['renameterm_new']) ? $_POST['renameterm_new'] : '';
                $this->renameTerms($this->taxonomy, $oldtag, $newtag);
            } elseif ($_POST['term_action'] == 'deleteterm') {
                $todelete = isset($_POST['deleteterm_name']) ? $_POST['deleteterm_name'] : '';
                $this->deleteTermsByTermList($this->taxonomy, $todelete);
            } elseif ($_POST['term_action'] == 'addterm') {
                $matchtag = isset($_POST['addterm_match']) ? $_POST['addterm_match'] : '';
                $newtag = isset($_POST['addterm_new']) ? $_POST['addterm_new'] : '';
                $this->addMatchTerms($this->taxonomy, $matchtag, $newtag);
            } elseif ($_POST['term_action'] == 'remove-rarelyterms') {
                $this->removeRarelyUsed($this->taxonomy, (int) $_POST['number-rarely']);
            }
            /* elseif ( $_POST['term_action'] == 'editslug'  ) {
            				
            				$matchtag = (isset($_POST['tagname_match'])) ? $_POST['tagname_match'] : '';
            				$newslug  = (isset($_POST['tagslug_new'])) ? $_POST['tagslug_new'] : '';
            				$this->editTermSlug( $this->taxonomy, $matchtag, $newslug );
            			
            			}*/
        }
        // Default order
        if (!isset($_GET['order'])) {
            $_GET['order'] = 'name-asc';
        }
        $this->displayMessage();
        ?>
		<div class="wrap st_wrap">
			<?php 
        $this->boxSelectorTaxonomy('st_manage');
        ?>
			
			<h2><?php 
        _e('Simple Tags: Manage Terms', 'simpletags');
        ?>
</h2>
			<p><?php 
        _e('Visit the <a href="http://redmine.beapi.fr/wiki/simple-tags/Theme_integration">plugin\'s homepage</a> for further details. If you find a bug, or have a fantastic idea for this plugin, <a href="mailto:amaury@wordpress-fr.net">ask me</a> !', 'simpletags');
        ?>
</p>
			
			<div class="clear"></div>
			<div id="term-list">
				<h3><?php 
        _e('Click terms list:', 'simpletags');
        ?>
</h3>
				<form action="" method="get">
					<div>
						<input type="hidden" name="page" value="st_manage" />
						<input type="hidden" name="taxo" value="<?php 
        echo esc_attr($this->taxonomy);
        ?>
" />
						<input type="hidden" name="cpt" value="<?php 
        echo esc_attr($this->post_type);
        ?>
" />
						
						<select name="order">
							<option <?php 
        selected($_GET['order'], 'count-asc');
        ?>
 value="count-asc"><?php 
        _e('Least used', 'simpletags');
        ?>
</option>
							<option <?php 
        selected($_GET['order'], 'count-desc');
        ?>
 value="count-desc"><?php 
        _e('Most popular', 'simpletags');
        ?>
</option>
							<option <?php 
        selected($_GET['order'], 'name-asc');
        ?>
 value="name-asc"><?php 
        _e('Alphabetical (default)', 'simpletags');
        ?>
</option>
							<option <?php 
        selected($_GET['order'], 'name-desc');
        ?>
 value="name-desc"><?php 
        _e('Inverse Alphabetical', 'simpletags');
        ?>
</option>
							<option <?php 
        selected($_GET['order'], 'random');
        ?>
 value="random"><?php 
        _e('Random', 'simpletags');
        ?>
</option>
						</select>
						<input class="button" type="submit" value="<?php 
        _e('Sort', 'simpletags');
        ?>
" />
					</div>
				</form>
				
				<div id="term-list-inner">
					<?php 
        if (isset($_GET['order'])) {
            $order = explode('-', stripslashes($_GET['order']));
            if (!isset($order[1])) {
                $order[1] = '';
            }
            // for skip notice on random...
            $order = '&selectionby=' . $order[0] . '&selection=' . $order[1] . '&orderby=' . $order[0] . '&order=' . $order[1];
        } else {
            $order = '&selectionby=name&selection=asc&orderby=name&order=asc';
        }
        st_tag_cloud('hide_empty=false&number=&color=false&get=all&title=' . $order . '&taxonomy=' . $this->taxonomy);
        ?>
				</div>
			</div>
			
			<table id="manage-table-terms" class="form-table">
				<tr valign="top">
					<th scope="row"><strong><?php 
        _e('Rename/Merge Terms', 'simpletags');
        ?>
</strong></th>
					<td>
						<p><?php 
        _e('Enter the term to rename and its new value. You can use this feature to merge terms too. Click "Rename" and all posts which use this term will be updated.', 'simpletags');
        ?>
</p>
						<p><?php 
        _e('You can specify multiple terms to rename by separating them with commas.', 'simpletags');
        ?>
</p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="taxo" value="<?php 
        echo esc_attr($this->taxonomy);
        ?>
" />
								<input type="hidden" name="cpt" value="<?php 
        echo esc_attr($this->post_type);
        ?>
" />
								
								<input type="hidden" name="term_action" value="renameterm" />
								<input type="hidden" name="term_nonce" value="<?php 
        echo wp_create_nonce('simpletags_admin');
        ?>
" />
								
								<p>
									<label for="renameterm_old"><?php 
        _e('Term(s) to rename:', 'simpletags');
        ?>
</label>
									<br />
									<input type="text" class="autocomplete-input" id="renameterm_old" name="renameterm_old" value="" size="40" />
								</p>
								
								<p>
									<label for="renameterm_new"><?php 
        _e('New term name(s):', 'simpletags');
        ?>
									<br />
									<input type="text" class="autocomplete-input" id="renameterm_new" name="renameterm_new" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="rename" value="<?php 
        _e('Rename', 'simpletags');
        ?>
" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php 
        _e('Delete Terms', 'simpletags');
        ?>
</strong></th>
					<td>
						<p><?php 
        _e('Enter the name of terms to delete. Terms will be removed from all posts.', 'simpletags');
        ?>
</p>
						<p><?php 
        _e('You can specify multiple terms to delete by separating them with commas', 'simpletags');
        ?>
.</p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="taxo" value="<?php 
        echo esc_attr($this->taxonomy);
        ?>
" />
								<input type="hidden" name="cpt" value="<?php 
        echo esc_attr($this->post_type);
        ?>
" />
								
								<input type="hidden" name="term_action" value="deleteterm" />
								<input type="hidden" name="term_nonce" value="<?php 
        echo wp_create_nonce('simpletags_admin');
        ?>
" />
								
								<p>
									<label for="deleteterm_name"><?php 
        _e('Term(s) to delete:', 'simpletags');
        ?>
</label>
									<br />
									<input type="text" class="autocomplete-input" id="deleteterm_name" name="deleteterm_name" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="delete" value="<?php 
        _e('Delete', 'simpletags');
        ?>
" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php 
        _e('Add Terms', 'simpletags');
        ?>
</strong></th>
					<td>
						<p><?php 
        _e('This feature lets you add one or more new terms to all posts which match any of the terms given.', 'simpletags');
        ?>
</p>
						<p><?php 
        _e('You can specify multiple terms to add by separating them with commas.  If you want the term(s) to be added to all posts, then don\'t specify any terms to match.', 'simpletags');
        ?>
</p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="taxo" value="<?php 
        echo esc_attr($this->taxonomy);
        ?>
" />
								<input type="hidden" name="cpt" value="<?php 
        echo esc_attr($this->post_type);
        ?>
" />
								
								<input type="hidden" name="term_action" value="addterm" />
								<input type="hidden" name="term_nonce" value="<?php 
        echo wp_create_nonce('simpletags_admin');
        ?>
" />
								
								<p>
									<label for="addterm_match"><?php 
        _e('Term(s) to match:', 'simpletags');
        ?>
</label>
									<br />
									<input type="text" class="autocomplete-input" id="addterm_match" name="addterm_match" value="" size="40" />
								</p>
								
								<p>
									<label for="addterm_new"><?php 
        _e('Term(s) to add:', 'simpletags');
        ?>
</label>
									<br />
									<input type="text" class="autocomplete-input" id="addterm_new" name="addterm_new" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="Add" value="<?php 
        _e('Add', 'simpletags');
        ?>
" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php 
        _e('Remove rarely used terms', 'simpletags');
        ?>
</strong></th>
					<td>
						<p><?php 
        _e('This feature allows you to remove rarely used terms.', 'simpletags');
        ?>
</p>
						<p><?php 
        _e('You can specify the number below which will be removed terms. If you put 5, all terms with a counter inferior to 5 will be deleted. The terms with a counter equal to 5 is keep.', 'simpletags');
        ?>
</p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="taxo" value="<?php 
        echo esc_attr($this->taxonomy);
        ?>
" />
								<input type="hidden" name="cpt" value="<?php 
        echo esc_attr($this->post_type);
        ?>
" />
								
								<input type="hidden" name="term_action" value="remove-rarelyterms" />
								<input type="hidden" name="term_nonce" value="<?php 
        echo wp_create_nonce('simpletags_admin');
        ?>
" />
								
								<p>
									<label for="number-delete"><?php 
        _e('Numbers minimum:', 'simpletags');
        ?>
</label>
									<br />
									<select name="number-rarely" id="number-delete">
									<?php 
        for ($i = 1; $i <= 100; $i++) {
            ?>
										<option value="<?php 
            echo $i;
            ?>
"><?php 
            echo $i;
            ?>
</option>
									<?php 
        }
        ?>
									</select>
								</p>
								
								<input class="button-primary" type="submit" name="Delete" value="<?php 
        _e('Delete rarely used', 'simpletags');
        ?>
" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<?php 
        /*
        <tr valign="top">
        	<th scope="row"><strong><?php _e('Edit Term Slug', 'simpletags'); ?></strong></th>
        	<td>
        		<p><?php _e('Enter the term name to edit and its new slug. <a href="http://codex.wordpress.org/Glossary#Slug">Slug definition</a>', 'simpletags'); ?></p>
        		<p><?php _e('You can specify multiple terms to rename by separating them with commas.', 'simpletags'); ?></p>
        		
        		<fieldset>
        			<form action="" method="post">
        				<input type="hidden" name="taxo" value="<?php echo esc_attr($this->taxonomy); ?>" />
        				<input type="hidden" name="cpt" value="<?php echo esc_attr($this->post_type); ?>" />
        				
        				<input type="hidden" name="term_action" value="editslug" />
        				<input type="hidden" name="term_nonce" value="<?php echo wp_create_nonce('simpletags_admin'); ?>" />
        				
        				<p>
        					<label for="tagname_match"><?php _e('Term(s) to match:', 'simpletags'); ?></label>
        					<br />
        					<input type="text" class="autocomplete-input" id="tagname_match" name="tagname_match" value="" size="40" />
        				</p>
        				
        				<p>
        					<label for="tagslug_new"><?php _e('Slug(s) to set:', 'simpletags'); ?></label>
        					<br />
        					<input type="text" class="autocomplete-input" id="tagslug_new" name="tagslug_new" value="" size="40" />
        				</p>
        				
        				<input class="button-primary" type="submit" name="edit" value="<?php _e('Edit', 'simpletags'); ?>" />
        			</form>
        		</fieldset>
        	</td>
        </tr>
        */
        ?>
				
				<tr>
					<th scope="row"><strong><?php 
        _e('Technical informations', 'simpletags');
        ?>
</strong></th>
					<td>
						<p><strong><?php 
        _e('Renaming', 'simpletags');
        ?>
</strong></p>
						<p><em><?php 
        _e('Simple Tags don\'t use the same method as WordPress for rename a term. For example, in WordPress you have 2 terms : "Blogging" and "Bloging". When you want edit the term "Bloging" for rename it on "Blogging", WordPress will keep the two terms with the same name but with a different slug. <br />With Simple Tags, when you edit "Bloging" for "Blogging", Simple Tags merge posts filled with "Bloging" to "Blogging" and it delete the term "Bloging". Another logic ;)', 'simpletags');
        ?>
<em></p>
					</td>
				</tr>
			</table>
			
			<div class="clear"></div>
			<?php 
        $this->printAdminFooter();
        ?>
		</div>
		<?php 
        do_action('simpletags-manage_terms', $this->taxonomy);
    }
Example #3
0
 /**
  * Method for theme render
  *
  * @param array $args
  * @param array $instance
  *
  * @return void
  * @author Amaury Balmer
  */
 public function widget($args, $instance)
 {
     extract($args);
     $current_taxonomy = self::_get_current_taxonomy($instance);
     // Build or not the name of the widget
     if (!empty($instance['title'])) {
         $title = $instance['title'];
     } else {
         if ('post_tag' == $current_taxonomy) {
             $title = __('Tags', 'simpletags');
         } else {
             $tax = get_taxonomy($current_taxonomy);
             if (isset($tax->labels)) {
                 $title = $tax->labels->name;
             } else {
                 $title = $tax->name;
             }
         }
     }
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     // Set values and clean it
     foreach ((array) self::get_fields() as $field => $field_value) {
         ${$field} = trim($instance[$field]);
     }
     $param = '';
     // Selection
     $param .= !empty($selectionby) ? '&selectionby=' . $selectionby : '&selectionby=count';
     $param .= !empty($selection) ? '&selection=' . $selection : '&selection=desc';
     // Order
     $param .= !empty($orderby) ? '&orderby=' . $orderby : '&orderby=random';
     $param .= !empty($order) ? '&order=' . $order : '&order=asc';
     // Max tags
     if ((int) $max != 0) {
         $param .= '&number=' . $max;
     }
     // Size Mini
     if ((int) $smini != 0) {
         $param .= '&smallest=' . $smini;
     }
     // Size Maxi
     if ((int) $smax != 0) {
         $param .= '&largest=' . $smax;
     }
     // Unit
     if (!empty($unit)) {
         $param .= '&unit=' . $unit;
     }
     // Format
     if (!empty($format)) {
         $param .= '&format=' . $format;
     }
     // Use color ?
     if ((int) $color == 0) {
         $param .= '&color=false';
     }
     // Color mini
     if (!empty($cmini)) {
         $param .= '&mincolor=' . $cmini;
     }
     // Color Max
     if (!empty($cmax)) {
         $param .= '&maxcolor=' . $cmax;
     }
     // Xformat
     if (!empty($xformat)) {
         $param .= '&xformat=' . $xformat;
     }
     // Advanced usage
     if (!empty($adv_usage)) {
         if (substr($adv_usage, 0, 1) != '&') {
             $param .= '&';
         }
         $param .= $adv_usage;
     }
     // Taxonomy
     $param .= '&taxonomy=' . $current_taxonomy;
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     st_tag_cloud(apply_filters('simple-tags-widget', 'title=' . $param, $instance));
     // Use Widgets title and no ST title !!
     echo $after_widget;
 }
	function widget_st_tag_cloud( $widget_args, $number = 1 ) {
		extract($widget_args);
		$options = get_option('widget_stags_cloud');

		// Use Widgets title and no ST title !!
		$args = 'title=';

		// Selection
		$selection = trim(strtolower($options[$number]['selection']));
		if ( !empty($selection) ) {
			$args .= '&cloud_selection='.$selection;
		} else {
			$args .= '&cloud_selection=count-desc';
		}

		// Order
		$order = trim(strtolower($options[$number]['order']));
		if ( !empty($order) ) {
			$args .= '&cloud_sort='.$order;
		} else {
			$args .= '&cloud_sort=random';
		}

		// Max tags
		$max = (int) $options[$number]['max'];
		if ( $max != 0 ) {
			$args .= '&number='.$max;
		}

		// Size Mini
		$smini = (int) $options[$number]['smini'];
		if ( $smini != 0 ) {
			$args .= '&smallest='.$smini;
		}

		// Size Maxi
		$smax = (int) $options[$number]['smax'];
		if ( $smax != 0 ) {
			$args .= '&largest='.$smax;
		}

		// Unit
		$unity = trim($options[$number]['unit']);
		if ( !empty($unity) ) {
			$args .= '&unit='.$unity;
		}

		// Format
		$format = trim($options[$number]['format']);
		if ( !empty($format) ) {
			$args .= '&format='.$format;
		}

		// Use color ?
		$color = (int) $options[$number]['color'];
		if ( $color == 0 ) {
			$args .= '&color=false';
		}

		// Color mini
		$cmini = trim($options[$number]['cmini']);
		if ( !empty($cmini) ) {
			$args .= '&mincolor='.$cmini;
		}

		// Color Max
		$cmax = trim($options[$number]['cmax']);
		if ( !empty($cmax) ) {
			$args .= '&maxcolor='.$cmax;
		}

		// Xformat
		$xformat = trim($options[$number]['xformat']);
		if ( !empty($xformat) ) {
			$args .= '&xformat='.$xformat;
		}

		// Use custom title with Widgets Title
		$title = trim($options[$number]['title']);
		
		echo $before_widget;
		echo $before_title . $title . $after_title;
		st_tag_cloud($args);
		echo $after_widget;
	}
	function widget_st_tag_cloud( $widget_args, $number = 1 ) {
		extract($widget_args);
		$options = get_option('widget_stags_cloud');
			
		$fields = array('title','max','selection','order','smini','smax','unit','format','color','cmini','cmax','xformat');
		foreach ( (array) $fields as $field ) {
			${$field} = trim(strtolower($options[$number][$field]));
		}

		// Use Widgets title and no ST title !!
		$args = 'title=';

		// Selection
		if ( !empty($selection) ) {
			$args .= '&cloud_selection='.$selection;
		} else {
			$args .= '&cloud_selection=count-desc';
		}

		// Order
		if ( !empty($order) ) {
			$args .= '&cloud_sort='.$order;
		} else {
			$args .= '&cloud_sort=random';
		}

		// Max tags
		if ( $max != 0 ) {
			$args .= '&number='.$max;
		}

		// Size Mini
		if ( $smini != 0 ) {
			$args .= '&smallest='.$smini;
		}

		// Size Maxi
		if ( $smax != 0 ) {
			$args .= '&largest='.$smax;
		}

		// Unit
		if ( !empty($unit) ) {
			$args .= '&unit='.$unit;
		}

		// Format
		if ( !empty($format) ) {
			$args .= '&format='.$format;
		}

		// Use color ?
		if ( $color == 0 ) {
			$args .= '&color=false';
		}

		// Color mini
		if ( !empty($cmini) ) {
			$args .= '&mincolor='.$cmini;
		}

		// Color Max
		if ( !empty($cmax) ) {
			$args .= '&maxcolor='.$cmax;
		}

		// Xformat
		if ( !empty($xformat) ) {
			$args .= '&xformat='.$xformat;
		}

		// Use custom title with Widgets Title 
		// Keep this, else title is also lower...
		$title = trim($options[$number]['title']);
		
		echo $before_widget;
		echo $before_title . $title . $after_title;
			st_tag_cloud($args);
		echo $after_widget;
	}
Example #6
0
	/**
	 * WP Page - Manage tags
	 *
	 */
	function pageManageTags() {
		// Control Post data
		if ( isset($_POST['tag_action']) ) {
			// Origination and intention
			if ( !wp_verify_nonce($_POST['tag_nonce'], 'simpletags_admin') ) {
				$this->message = __('Security problem. Try again. If this problem persist, contact <a href="mailto:amaury@wordpress-fr.net">plugin author</a>.', 'simpletags');
				$this->status = 'error';
			}
			elseif ( $_POST['tag_action'] == 'renametag' ) {
				$oldtag = (isset($_POST['renametag_old'])) ? $_POST['renametag_old'] : '';
				$newtag = (isset($_POST['renametag_new'])) ? $_POST['renametag_new'] : '';
				$this->renameTags( $oldtag, $newtag );
			}
			elseif ( $_POST['tag_action'] == 'deletetag' ) {
				$todelete = (isset($_POST['deletetag_name'])) ? $_POST['deletetag_name'] : '';
				$this->deleteTagsByTagList( $todelete );
			}
			elseif ( $_POST['tag_action'] == 'addtag'  ) {
				$matchtag = (isset($_POST['addtag_match'])) ? $_POST['addtag_match'] : '';
				$newtag   = (isset($_POST['addtag_new'])) ? $_POST['addtag_new'] : '';
				$this->addMatchTags( $matchtag, $newtag );
			}
			elseif ( $_POST['tag_action'] == 'editslug'  ) {
				$matchtag = (isset($_POST['tagname_match'])) ? $_POST['tagname_match'] : '';
				$newslug  = (isset($_POST['tagslug_new'])) ? $_POST['tagslug_new'] : '';
				$this->editTagSlug( $matchtag, $newslug );
			} elseif ( $_POST['tag_action'] == 'cleandb'  ) {
				$this->cleanDatabase();
			}
		}
		
		// Default order 
		if ( !isset($_GET['order']) ) {
			$_GET['order'] = 'name-asc';
		}
		
		$this->displayMessage();
		?>
		<script type="text/javascript">
			<!--
			initAutoComplete( '.autocomplete-input', '<?php echo admin_url('admin.php') .'?st_ajax_action=helper_js_collection&taxonomy='.$this->taxonomy; ?>', 300 );
			-->
		</script>
		
		<div class="wrap st_wrap">
			<h2><?php _e('Simple Tags: Manage Terms', 'simpletags'); ?></h2>
			<p><?php _e('Visit the <a href="http://redmine.beapi.fr/wiki/simple-tags/Theme_integration">plugin\'s homepage</a> for further details. If you find a bug, or have a fantastic idea for this plugin, <a href="mailto:amaury@wordpress-fr.net">ask me</a> !', 'simpletags'); ?></p>
			
			<div class="clear"></div>
			<div id="term-list">
				<h3><?php _e('Click terms list:', 'simpletags'); ?></h3>
				<form action="" method="get">
					<div>
						<input type="hidden" name="page" value="st_manage" />
						<select name="order">
							<option <?php if($_GET['order']=='count-asc') echo'selected="selected"'; ?> value="count-asc"><?php _e('Least used', 'simpletags'); ?></option>
							<option <?php if($_GET['order']=='count-desc') echo'selected="selected"'; ?> value="count-desc"><?php _e('Most popular', 'simpletags'); ?></option>
							<option <?php if($_GET['order']=='name-asc') echo'selected="selected"'; ?> value="name-asc"><?php _e('Alphabetical (default)', 'simpletags'); ?></option>
							<option <?php if($_GET['order']=='name-desc') echo'selected="selected"'; ?> value="name-desc"><?php _e('Inverse Alphabetical', 'simpletags'); ?></option>
							<option <?php if($_GET['order']=='random') echo'selected="selected"'; ?> value="random"><?php _e('Random', 'simpletags'); ?></option>
						</select>
						<input class="button" type="submit" value="<?php _e('Sort', 'simpletags'); ?>" />
					</div>
				</form>
				
				<div id="term-list-inner">
					<?php 
					if ( isset($_GET['order']) ) {
						$order = explode('-', stripslashes($_GET['order']));
						$order = '&selectionby='.$order[0].'&selection='.$order[1].'&orderby='.$order[0].'&order='.$order[1];
					} else {
						$order = '&selectionby=name&selection=asc&orderby=name&order=asc';
					}
					st_tag_cloud('hide_empty=false&number=&color=false&get=all&title='.$order);
					?>
				</div>
			</div>
			
			<table id="manage-table-tags" class="form-table">
				<tr valign="top">
					<th scope="row"><strong><?php _e('Rename/Merge Terms', 'simpletags'); ?></strong></th>
					<td>
						<p><?php _e('Enter the term to rename and its new value. You can use this feature to merge terms too. Click "Rename" and all posts which use this term will be updated.', 'simpletags'); ?></p>
						<p><?php _e('You can specify multiple terms to rename by separating them with commas.', 'simpletags'); ?></p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="tag_action" value="renametag" />
								<input type="hidden" name="tag_nonce" value="<?php echo wp_create_nonce('simpletags_admin'); ?>" />
								
								<p>
									<label for="renametag_old"><?php _e('Term(s) to rename:', 'simpletags'); ?></label>
									<br />
									<input type="text" class="autocomplete-input" id="renametag_old" name="renametag_old" value="" size="40" />
								</p>
								
								<p>
									<label for="renametag_new"><?php _e('New term name(s):', 'simpletags'); ?>
									<br />
									<input type="text" class="autocomplete-input" id="renametag_new" name="renametag_new" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="rename" value="<?php _e('Rename', 'simpletags'); ?>" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php _e('Delete Terms', 'simpletags'); ?></strong></th>
					<td>
						<p><?php _e('Enter the name of terms to delete. Terms will be removed from all posts.', 'simpletags'); ?></p>
						<p><?php _e('You can specify multiple terms to delete by separating them with commas', 'simpletags'); ?>.</p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="tag_action" value="deletetag" />
								<input type="hidden" name="tag_nonce" value="<?php echo wp_create_nonce('simpletags_admin'); ?>" />
								
								<p>
									<label for="deletetag_name"><?php _e('Term(s) to delete:', 'simpletags'); ?></label>
									<br />
									<input type="text" class="autocomplete-input" id="deletetag_name" name="deletetag_name" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="delete" value="<?php _e('Delete', 'simpletags'); ?>" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php _e('Add Terms', 'simpletags'); ?></strong></th>
					<td>
						<p><?php _e('This feature lets you add one or more new terms to all posts which match any of the terms given.', 'simpletags'); ?></p>
						<p><?php _e('You can specify multiple terms to add by separating them with commas.  If you want the term(s) to be added to all posts, then don\'t specify any terms to match.', 'simpletags'); ?></p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="tag_action" value="addtag" />
								<input type="hidden" name="tag_nonce" value="<?php echo wp_create_nonce('simpletags_admin'); ?>" />
								
								<p>
									<label for="addtag_match"><?php _e('Term(s) to match:', 'simpletags'); ?></label>
									<br />
									<input type="text" class="autocomplete-input" id="addtag_match" name="addtag_match" value="" size="40" />
								</p>
								
								<p>
									<label for="addtag_new"><?php _e('Term(s) to add:', 'simpletags'); ?></label>
									<br />
									<input type="text" class="autocomplete-input" id="addtag_new" name="addtag_new" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="Add" value="<?php _e('Add', 'simpletags'); ?>" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php _e('Edit Term Slug', 'simpletags'); ?></strong></th>
					<td>
						<p><?php _e('Enter the term name to edit and its new slug. <a href="http://codex.wordpress.org/Glossary#Slug">Slug definition</a>', 'simpletags'); ?></p>
						<p><?php _e('You can specify multiple terms to rename by separating them with commas.', 'simpletags'); ?></p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="tag_action" value="editslug" />
								<input type="hidden" name="tag_nonce" value="<?php echo wp_create_nonce('simpletags_admin'); ?>" />
								
								<p>
									<label for="tagname_match"><?php _e('Term(s) to match:', 'simpletags'); ?></label>
									<br />
									<input type="text" class="autocomplete-input" id="tagname_match" name="tagname_match" value="" size="40" />
								</p>
								
								<p>
									<label for="tagslug_new"><?php _e('Slug(s) to set:', 'simpletags'); ?></label>
									<br />
									<input type="text" class="autocomplete-input" id="tagslug_new" name="tagslug_new" value="" size="40" />
								</p>
								
								<input class="button-primary" type="submit" name="edit" value="<?php _e('Edit', 'simpletags'); ?>" />
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr valign="top">
					<th scope="row"><strong><?php _e('Remove empty terms', 'simpletags'); ?></strong></th>
					<td>
						<p><?php _e('Old WordPress versions have a small bug and allow to create empty terms. Remove it !', 'simpletags'); ?></p>
						
						<fieldset>
							<form action="" method="post">
								<input type="hidden" name="tag_action" value="cleandb" />
								<input type="hidden" name="tag_nonce" value="<?php echo wp_create_nonce('simpletags_admin'); ?>" />
								
								<p>
									<input class="button-primary" type="submit" name="clean" value="<?php _e('Clean !', 'simpletags'); ?>" />
								</p>
							</form>
						</fieldset>
					</td>
				</tr>
				
				<tr>
					<th scope="row"><strong><?php _e('Technical informations', 'simpletags'); ?></strong></th>
					<td>
						<p><strong><?php _e('Renaming', 'simpletags'); ?></strong></p>
						<p><em><?php _e('Simple Tags don\'t use the same method as WordPress for rename a term. For example, in WordPress you have 2 tags : "Blogging" and "Bloging". When you want edit the tag "Bloging" for rename it on "Blogging", WordPress will keep the two terms with the same name but with a different slug. <br />With Simple Tags, when you edit "Bloging" for "Blogging", Simple Tags merge posts tagged with "Bloging" to "Blogging" and it delete the term "Bloging". Another logic ;)', 'simpletags'); ?><em></p>
					</td>
				</tr>
			</table>
			
			<div class="clear"></div>
			<?php $this->printAdminFooter(); ?>
		</div>
		<?php
	}