Changeset 372730
- Timestamp:
- 04/14/2011 12:01:01 AM (15 years ago)
- Location:
- docs-auto-tags/trunk
- Files:
-
- 2 edited
-
docs-auto-tags.php (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
docs-auto-tags/trunk/docs-auto-tags.php
r372721 r372730 56 56 if ( intval($post->ID) > 0 ) { 57 57 $options = get_option( 'docs_autotags' ); 58 foreach ( $options as $pattern => $tags ) { 59 if ( strpos($post->post_content, $pattern) ) 60 wp_set_post_tags( $post->ID, $tags, TRUE ); // TRUE means append 58 if ( count($options) > 0 ) { 59 foreach ( $options as $pattern => $tags ) { 60 if ( strpos($post->post_content, $pattern) ) 61 wp_set_post_tags( $post->ID, $tags, TRUE ); // TRUE means append 62 } 61 63 } 62 64 } … … 66 68 // add options page 67 69 function jpl_docs_autotags_options_page() { 68 if ( !current_user_can( 'manage_options') ) {70 if ( !current_user_can('manage_options') ) { 69 71 // Doc might include profanity, but he can manage his own language file 70 72 wp_die( __('You do not have sufficient permissions to access this page.') ); … … 73 75 74 76 <div class="wrap"> 75 <h2><?php _e("Doc's Auto tags") ?></h2>77 <h2><?php _e("Doc's Auto-Tags") ?></h2> 76 78 <p><?php _e('Posts that include the (case-sensitive) string patterns defined below will be assigned the specified tag(s) when saved.') ?></p> 77 79 <form method="post" action=""> … … 82 84 if ( isset($_POST['pattern']) ) { 83 85 $i = 0; 84 while ( $i <= count( $_POST['pattern']) ) {85 if ( strlen( trim($_POST['pattern'][$i])) > 0 && strlen(trim($_POST['tags'][$i])) > 0 )86 while ( $i <= count( $_POST['pattern'] ) ) { 87 if ( strlen( trim($_POST['pattern'][$i]) ) > 0 && strlen( trim($_POST['tags'][$i]) ) > 0 ) 86 88 $options[$_POST['pattern'][$i]] = $_POST['tags'][$i]; 87 89 $i++; … … 94 96 95 97 <?php $i=0; ?> 96 <?php foreach ( $options as $pattern => $tags ) :?> 98 <?php if ( count($options) > 0 ): ?> 99 <?php foreach ( $options as $pattern => $tags ) : ?> 97 100 <div id="rule-<?php echo $i ?>"> 98 101 <p> … … 104 107 <?php $i++; ?> 105 108 <?php endforeach; ?> 109 <?php endif; ?> 106 110 107 111 <div id="rule-new"> -
docs-auto-tags/trunk/readme.txt
r372726 r372730 15 15 == Installation == 16 16 17 1. Install from the Plugins page within the dashboard. For those with too much free time, download from the [plugin page](http://wordpress.org/extend/plugins/docs-auto-tags/) or [subversion repository](http://plugins.svn.wordpress.org/docs-auto-tags/). Upload `docs-auto-tags` to your plugins directory (usually `/wp-content/plugins/` unless you've defined custom value for WP_PLUGINS_DIR).17 1. Install from the Plugins page within the Dashboard. For those with too much free time, download from the [plugin page](http://wordpress.org/extend/plugins/docs-auto-tags/) or [subversion repository](http://plugins.svn.wordpress.org/docs-auto-tags/) and upload `docs-auto-tags` to your plugins directory (usually `/wp-content/plugins/` unless you've defined custom value for WP_PLUGINS_DIR). 18 18 1. Activate the plugin through the 'Plugins' menu in WordPress 19 19 1. Configure your settings within the 'Tools' area in the Dashboard
Note: See TracChangeset
for help on using the changeset viewer.