WordPress.org

Plugin Directory

Changeset 1602211


Ignore:
Timestamp:
02/23/17 15:40:32 (5 months ago)
Author:
petersplugins
Message:

v 2.4 DEV - current dev state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 404page/trunk/404page.php

    r1577075 r1602211  
    55Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme. 
    66Version: 2.4 DEV 
    7 Author: Peter's Plugins, smartware.cc 
     7Author: Peter's Plugins (formerly smartware.cc) 
    88Author URI: http://petersplugins.com 
    99Text Domain: 404page 
     
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.txt 
    1212*/ 
    13  
    1413 
    1514if ( ! defined( 'WPINC' ) ) { 
     
    3332        $this->plugin_name = '404page'; 
    3433    $this->plugin_slug = '404page'; 
    35         $this->version = '2.3'; 
     34        $this->version = '2.4 DEV'; 
    3635    $this->get_settings(); 
    37     $this->init(); 
     36    $this->load(); 
    3837    }  
    3938   
     
    4746    $this->settings['404page_native'] = false; 
    4847  } 
     48   
     49  // load 
     50  // this function was introduced in v 2.4 and runs the init() function on firing of init action to ensure everything is loaded properly 
     51  private function load() {  
     52     
     53    add_action( 'init', array( $this, 'init' ) ); 
     54     
     55  } 
    4956  
    50   // do plugin init 
    51   private function init() { 
     57  // do plugin init  
     58  // as of v 2.4 this runs after init action has fired to ensure everything is loaded properly 
     59  function init() { 
    5260     
    5361    // as of v 2.2 always call set_mode 
    54     add_action( 'init', array( $this, 'set_mode' ) ); 
     62    // as of v 2.4 we do not need to add an init action hook 
     63    $this->set_mode(); 
    5564     
    5665    if ( !is_admin() ) { 
     
    92101           
    93102        // Compatibility Mode 
    94         add_filter( 'posts_results', array( $this, 'show404_compatiblity_mode' ), 999 ); 
     103        // As of v 2.4 we use the the_posts filter instead of posts_results, because the posts array is internally processed after posts_results fires 
     104        add_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999 ); 
    95105           
    96106      } else { 
     
    133143     
    134144    // remove the filter so we handle only the first query - no custom queries 
    135     remove_filter( 'posts_results', array( $this, 'show404_compatiblity_mode' ), 999 );  
     145    remove_filter( 'the_posts', array( $this, 'show404_compatiblity_mode' ), 999 );  
    136146     
    137147    $pageid = $this->get_page_id(); 
Note: See TracChangeset for help on using the changeset viewer.