Changeset 175100
- Timestamp:
- 11/18/2009 09:21:05 PM (16 years ago)
- Location:
- page-tagger/trunk
- Files:
-
- 1 added
- 1 deleted
- 2 edited
-
README.txt (modified) (2 diffs)
-
page-tagger.js (added)
-
page-tagger.php (modified) (5 diffs)
-
page-tags.js (deleted)
Legend:
- Unmodified
- Added
- Removed
-
page-tagger/trunk/README.txt
r155159 r175100 5 5 Tags: tags, tagging, posts, pages 6 6 Requires at least: 2.8.4 7 Tested up to: 2.8. 48 Stable tag: 0.3. 17 Tested up to: 2.8.6 8 Stable tag: 0.3.2 9 9 10 10 Page Tagger is a Wordpress plugin which lets you tag your pages just like you do with your posts. It adds a tagging widget in the page-editing view in the admin interface. … … 23 23 24 24 == Changelog == 25 26 = 0.3.2 = 27 * Fixed plugin conflict issue which was sometimes causing the tag editing interface to stop working. 25 28 26 29 = 0.3.1 = -
page-tagger/trunk/page-tagger.php
r160178 r175100 22 22 Plugin URI: http://www.hiddentao.com/code/wordpress-page-tagger-plugin/ 23 23 Description: Enables tagging for pages. 24 Version: 0.3. 124 Version: 0.3.2 25 25 Author: Ramesh Nair 26 26 Author URI: http://www.hiddentao.com/ … … 37 37 class PageTagger 38 38 { 39 function __construct() 39 static $instance = NULL; 40 41 static function init() 42 { 43 if (NULL == self::$instance) 44 self::$instance = new PageTagger(); 45 } 46 47 function PageTagger() 40 48 { 41 49 // if we're editing or adding a page 42 50 global $pagenow; 43 if ( i n_array( $pagenow, array('page.php', 'page-new.php') ) )51 if ( isset($pagenow) && in_array( $pagenow, array('page.php', 'page-new.php') ) ) 44 52 { 45 53 add_action('admin_head',array(&$this, 'admin_head_hook') ); 46 add_action('wp_default_scripts', array(&$this, 'setup_scripts'), 100 );47 54 } 55 48 56 add_action('pre_get_posts', array(&$this, 'setup_query_vars_for_posts'), 100); 49 57 add_action('init',array(&$this,'setup_tag_post_count_callback'),100); 50 58 } 59 60 61 62 63 /** 64 * Stuff to do for the 'admin_head' hook. 65 */ 66 function admin_head_hook() 67 { 68 wp_register_script('page-tagger', WP_PLUGIN_URL.'/'.PAGE_TAGS_PARENT_DIR.'/page-tagger.js', array('jquery','suggest'), false); 69 wp_localize_script('page-tagger','pageTaggerL10n', 70 array( 71 'tagsUsed' => __('Tags used on this page:'), 72 'addTag' => esc_attr(__('Add new tag')), 73 ) 74 ); 75 wp_print_scripts('page-tagger'); 76 77 78 // all tag-style post taxonomies 79 foreach ( get_object_taxonomies('post') as $tax_name ) 80 { 81 if ( !is_taxonomy_hierarchical($tax_name) ) 82 { 83 $taxonomy = get_taxonomy($tax_name); 84 $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name; 85 86 add_meta_box('tagsdiv-'.$tax_name, $label, array(&$this, 'add_tags_meta_box'), 'page', 'side', 'default'); 87 } 88 } 89 } 90 51 91 52 92 … … 82 122 } 83 123 } 84 85 86 87 88 /** 89 * Set the Javascript files that need to be included for this to work. 90 */ 91 function setup_scripts(&$scripts) 92 { 93 // remove the default 'page' script definitions 94 if ( $scripts->query('page') ) 95 $scripts->remove('page'); 124 96 125 97 //98 // Redo it, essentially copying what we have for 'post' handle99 // (Taken from wp-includes/script-loader.php)100 //101 $scripts->add( 'page', WP_PLUGIN_URL.'/'.PAGE_TAGS_PARENT_DIR.'/page-tags.js', array('suggest', 'jquery', 'slug', 'wp-lists', 'postbox'), '20081210' );102 $scripts->localize( 'page', 'postL10n', array(103 'tagsUsed' => __('Tags used on this page:'),104 'add' => attribute_escape(__('Add')),105 'addTag' => attribute_escape(__('Add new tag')),106 'separate' => __('Separate tags with commas'),107 'cancel' => __('Cancel'),108 'edit' => __('Edit'),109 'publishOn' => __('Publish on:'),110 'publishOnFuture' => __('Schedule for:'),111 'publishOnPast' => __('Published on:'),112 'showcomm' => __('Show more comments'),113 'endcomm' => __('No more comments found.'),114 'publish' => __('Publish'),115 'schedule' => __('Schedule'),116 'update' => __('Update Page'),117 'savePending' => __('Save as Pending'),118 'saveDraft' => __('Save Draft'),119 'private' => __('Private'),120 'public' => __('Public'),121 'password' => __('Password Protected'),122 'privatelyPublished' => __('Privately Published'),123 'published' => __('Published'),124 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'125 ) );126 }127 128 126 129 127 … … 159 157 } 160 158 161 162 /** 163 * Stuff to do for the 'admin_head' hook. 164 */ 165 function admin_head_hook() 166 { 167 // all tag-style post taxonomies 168 foreach ( get_object_taxonomies('post') as $tax_name ) { 169 if ( !is_taxonomy_hierarchical($tax_name) ) { 170 $taxonomy = get_taxonomy($tax_name); 171 $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name; 172 173 add_meta_box('tagsdiv-'.$tax_name, $label, array(&$this, 'add_tags_meta_box'), 'page', 'side', 'default'); 174 } 175 } 176 } 159 177 160 178 161 … … 201 184 * Initialise PageTags object. 202 185 */ 203 function init_page_tagger() 204 { 205 global $pageTagger; 206 $pageTagger = new PageTagger(); 207 } 186 add_action('plugins_loaded','PageTagger::init'); 208 187 209 210 add_action('plugins_loaded','init_page_tagger');211 212 213 ?>
Note: See TracChangeset
for help on using the changeset viewer.