Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

  • AdminPageFramework
    • FieldType
    • MetaBox
    • NetworkAdmin
      • Page
    • Page
    • PageMetaBox
    • PostType
    • TaxonomyField
  • None

Classes

  • AdminPageFramework_MetaBox_Page
  • AdminPageFramework_MetaBox_Page_Controller
  • AdminPageFramework_MetaBox_Page_Model
  • AdminPageFramework_MetaBox_Page_Router
  • AdminPageFramework_MetaBox_Page_View
 1 <?php
 2 /**
 3  * Admin Page Framework
 4  * 
 5  * http://en.michaeluno.jp/admin-page-framework/
 6  * Copyright (c) 2013-2014 Michael Uno; Licensed MIT
 7  * 
 8  */
 9 if ( ! class_exists( 'AdminPageFramework_MetaBox_Page_Router' ) ) :
10 /**
11  * Provides routing methods for creating meta boxes in pages added by the framework.
12  * 
13  * @abstract
14  * @since 3.0.4
15  * @package AdminPageFramework
16  * @subpackage PageMetaBox
17  */
18 abstract class AdminPageFramework_MetaBox_Page_Router extends AdminPageFramework_MetaBox_Base {
19     
20     /**
21      * Triggers the start_{...} action hook.
22      *
23      * @since 3.0.4
24      */
25     function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) {     
26                         
27         parent::__construct( $sMetaBoxID, $sTitle, $asPageSlugs, $sContext, $sPriority, $sCapability, $sTextDomain );
28                 
29         $this->oUtil->addAndDoAction( $this, "start_{$this->oProp->sClassName}", $this );
30     
31     }
32             
33     /**
34      * Determines whether the meta box class components should be loaded in the currently loading page.
35      * @since 3.1.3    
36      */
37     protected  function _isInstantiatable() {
38         
39         // Disable in admin-ajax.php
40         if ( isset( $GLOBALS['pagenow'] ) && 'admin-ajax.php' === $GLOBALS['pagenow'] ) {
41             return false;
42         }
43         return true;
44         
45     }
46     
47     /**
48      * Determines whether the meta box belongs to the loading page.
49      * 
50      * @since 3.0.3
51      * @internal
52      */
53     protected function _isInThePage() {
54         
55         if ( ! $this->oProp->bIsAdmin ) {
56             return false;     
57         }
58                     
59         if ( ! isset( $_GET['page'] ) ) {
60             return false;
61         }
62             
63         return in_array( $_GET['page'], $this->oProp->aPageSlugs );
64         
65     }     
66 }
67 endif;
Admin Page Framework Documentation API documentation generated by ApiGen 2.8.0