Plugin Directory

Changeset 175100


Ignore:
Timestamp:
11/18/2009 09:21:05 PM (16 years ago)
Author:
randomaniac
Message:

Submit v0.3.2 of Page Tagger plugin.

Location:
page-tagger/trunk
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • page-tagger/trunk/README.txt

    r155159 r175100  
    55Tags: tags, tagging, posts, pages
    66Requires at least: 2.8.4
    7 Tested up to: 2.8.4
    8 Stable tag: 0.3.1
     7Tested up to: 2.8.6
     8Stable tag: 0.3.2
    99
    1010Page 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.
     
    2323
    2424== Changelog ==
     25
     26= 0.3.2 =
     27* Fixed plugin conflict issue which was sometimes causing the tag editing interface to stop working.
    2528
    2629= 0.3.1 =
  • page-tagger/trunk/page-tagger.php

    r160178 r175100  
    2222Plugin URI: http://www.hiddentao.com/code/wordpress-page-tagger-plugin/
    2323Description: Enables tagging for pages.
    24 Version: 0.3.1
     24Version: 0.3.2
    2525Author: Ramesh Nair
    2626Author URI: http://www.hiddentao.com/
     
    3737class PageTagger
    3838{
    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()
    4048    {
    4149        // if we're editing or adding a page
    4250        global $pagenow;
    43         if ( in_array( $pagenow, array('page.php', 'page-new.php') ) )
     51        if ( isset($pagenow) && in_array( $pagenow, array('page.php', 'page-new.php') ) )
    4452        {
    4553            add_action('admin_head',array(&$this, 'admin_head_hook') );
    46             add_action('wp_default_scripts', array(&$this, 'setup_scripts'), 100 );
    4754        }   
     55       
    4856        add_action('pre_get_posts', array(&$this, 'setup_query_vars_for_posts'), 100);
    4957        add_action('init',array(&$this,'setup_tag_post_count_callback'),100);
    5058    }
     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
    5191   
    5292
     
    82122        }
    83123    }
    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       
    96125
    97         //
    98         // Redo it, essentially copying what we have for 'post' handle
    99         // (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    
    128126   
    129127   
     
    159157    }
    160158   
    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
    177160   
    178161   
     
    201184 * Initialise PageTags object.
    202185 */ 
    203 function init_page_tagger()
    204 {
    205     global $pageTagger;
    206     $pageTagger = new PageTagger();
    207 }
     186add_action('plugins_loaded','PageTagger::init');
    208187
    209 
    210 add_action('plugins_loaded','init_page_tagger');
    211 
    212 
    213 ?>
Note: See TracChangeset for help on using the changeset viewer.