WordPress.org

Plugin Directory

Changeset 268351 for edit-flow


Ignore:
Timestamp:
07/28/10 02:02:45 (7 years ago)
Author:
batmoo
Message:

2.9 compatibility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • edit-flow/trunk/php/custom_status.php

    r268346 r268351  
    1717        if( !ef_taxonomy_exists( $this->status_taxonomy ) ) register_taxonomy( $this->status_taxonomy, 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => false, 'query_var' => false, 'rewrite' => false, 'show_ui' => false) ); 
    1818         
    19         // Not needed as of 3.0 since it supports built in post statuses 
    20         // These actions should be called regardless of whether custom statuses are enabled or not 
    21         // Add actions and filters for the Edit/Manage Posts page 
    22         //add_action('load-edit.php', array(&$this, 'load_edit_hooks')); 
    23         // Add action and filter for the Edit/Manage Pages page 
    24         //add_action('load-edit-pages.php', array(&$this, 'load_edit_hooks')); 
    25          
     19         
     20        // Note: These hooks do not need to be called as of 3.0 since it supports built in post statuses 
     21        // Note: For pre-3.0, these actions should be called regardless of whether custom statuses are enabled or not 
     22        if( ! function_exists( 'register_post_status' ) ) { 
     23            // Add actions and filters for the Edit/Manage Posts page 
     24            add_action( 'load-edit.php', array( &$this, 'load_edit_hooks' ) ); 
     25            // Add action and filter for the Edit/Manage Pages page 
     26            add_action( 'load-edit-pages.php', array( &$this, 'load_edit_hooks' ) ); 
     27        } 
     28                 
    2629        if( $active ) { 
    2730             
     
    3639            add_filter('manage_pages_columns', array('custom_status', '_filter_manage_posts_columns')); 
    3740            add_action('manage_pages_custom_column', array('custom_status', '_filter_manage_posts_custom_column')); 
     41             
    3842        } 
    3943    } // END: __construct() 
     
    4852         
    4953        // @TODO: support for custom post types 
    50          
    51         // Users can delete draft and pending statuses if they want, so let's get rid of them 
    52         // They'll get re-added if the user hasn't "deleted" them 
    53         unset( $wp_post_statuses[ 'draft' ] ); 
    54         unset( $wp_post_statuses[ 'pending' ] ); 
    55          
    56         $custom_statuses = $this->get_custom_statuses(); 
    57          
    58         foreach( $custom_statuses as $status ) { 
    59             register_post_status( $status->slug, array( 
    60                 'label'       => $status->name 
    61                 , 'protected'   => true 
    62                 , '_builtin'    => false 
    63                 , 'label_count' => _n_noop( "{$status->name} <span class='count'>(%s)</span>", "{$status->name} <span class='count'>(%s)</span>" ) 
    64             ) ); 
     54        if( function_exists( 'register_post_status' ) ) { 
     55            // Users can delete draft and pending statuses if they want, so let's get rid of them 
     56            // They'll get re-added if the user hasn't "deleted" them 
     57            unset( $wp_post_statuses[ 'draft' ] ); 
     58            unset( $wp_post_statuses[ 'pending' ] ); 
     59             
     60            $custom_statuses = $this->get_custom_statuses(); 
     61             
     62            foreach( $custom_statuses as $status ) { 
     63                register_post_status( $status->slug, array( 
     64                    'label'       => $status->name 
     65                    , 'protected'   => true 
     66                    , '_builtin'    => false 
     67                    , 'label_count' => _n_noop( "{$status->name} <span class='count'>(%s)</span>", "{$status->name} <span class='count'>(%s)</span>" ) 
     68                ) ); 
     69            } 
    6570        } 
    6671    } 
     
    6873    /** 
    6974     * Hooks to make modifications to the Manage/Edit Posts 
     75     * Only used for pre-3.0 
    7076     */ 
    7177    function load_edit_hooks() { 
     
    7581        add_filter('posts_where', array(&$this, 'custom_status_where_filter')); 
    7682    } // END: load_edit_hooks() 
    77      
     83 
     84    /** 
     85     * Hooks to make modifications to the Manage/Edit Pages 
     86     * Only used for pre-3.0 
     87     */ 
    7888    function load_edit_pages_hooks() { 
    7989        global $edit_flow; 
Note: See TracChangeset for help on using the changeset viewer.