WordPress.org

Plugin Directory

Changeset 327905


Ignore:
Timestamp:
01/02/11 15:02:33 (3 years ago)
Author:
JohnPBloch
Message:

Passing the object by reference in the callbacks for add_action and add_filter. Also for adding settings sections/fields. Props Shuya.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • custom-post-permalinks/trunk/custom-post-permalinks.php

    r303156 r327905  
    106106     
    107107    function __construct(){ 
    108         add_action( 'wp_loaded', array( $this, 'option_set' ), 99 ); 
    109         add_action( 'wp_loaded', array( $this, 'init' ), 100 ); 
    110         add_action( 'admin_init', array( $this, 'admin_init' ) ); 
    111         add_action( 'template_redirect', array( $this, 'template_redirect' ) ); 
    112         add_action( 'parse_request', array( $this, 'request_filter' ), 10, 1 ); 
    113         add_action( 'permalink_structure_changed', array( $this, 'update' ), 10, 1 ); 
    114         add_filter( 'post_type_link', array( $this, 'extra_permalinks' ), 10, 4 ); 
    115         add_filter( 'rewrite_rules_array', array( $this, 'rise_to_the_top' ), 100 ); 
     108        add_action( 'wp_loaded', array( &$this, 'option_set' ), 99 ); 
     109        add_action( 'wp_loaded', array( &$this, 'init' ), 100 ); 
     110        add_action( 'admin_init', array( &$this, 'admin_init' ) ); 
     111        add_action( 'template_redirect', array( &$this, 'template_redirect' ) ); 
     112        add_action( 'parse_request', array( &$this, 'request_filter' ), 10, 1 ); 
     113        add_action( 'permalink_structure_changed', array( &$this, 'update' ), 10, 1 ); 
     114        add_filter( 'post_type_link', array( &$this, 'extra_permalinks' ), 10, 4 ); 
     115        add_filter( 'rewrite_rules_array', array( &$this, 'rise_to_the_top' ), 100 ); 
    116116        $this->options = get_option( $this->settings_name ); 
    117117    } 
     
    199199    function admin_init(){ 
    200200        if( !empty( $this->post_types ) ){ 
    201             add_settings_section( $this->slug . '_section', __('Extra Permalink Settings for Non-Hierarchical Custom Post Types',$this->slug), array( $this, 'permalinks_settings' ), 'permalink' ); 
     201            add_settings_section( $this->slug . '_section', __('Extra Permalink Settings for Non-Hierarchical Custom Post Types',$this->slug), array( &$this, 'permalinks_settings' ), 'permalink' ); 
    202202            foreach( $this->post_types as $n => $t ) 
    203                 add_settings_field( $this->slug . '_pt_' . $n, sprintf( __('Custom Permalink for %s',$this->slug), $t->labels->name ), array($this,'permalinks_fields'), 'permalink', $this->slug . '_section' ); 
     203                add_settings_field( $this->slug . '_pt_' . $n, sprintf( __('Custom Permalink for %s',$this->slug), $t->labels->name ), array( &$this, 'permalinks_fields' ), 'permalink', $this->slug . '_section' ); 
    204204        } 
    205205        if( isset( $_POST['permalink_structure'] ) ){ 
Note: See TracChangeset for help on using the changeset viewer.