예제 #1
0
 /**
  * Registers necessary callbacks ans sets up internal components including properties.
  * 
  * <h4>Example</h4>
  * <code>if ( is_admin() ) {
  *     new MyAdminPageClass( 'my_custom_option_key', __FILE__ );
  * }</code>
  * 
  * @access      public
  * @since       2.0.0
  * @see         http://codex.wordpress.org/Roles_and_Capabilities
  * @see         http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains
  * @param       string      $sOptionKey         (optional) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used.
  * @param       string      $sCallerPath        (optional) used to retrieve the plugin/theme details to auto-insert the information into the page footer.
  * @param       string      $sCapability        (optional) sets the overall access level to the admin pages created by the framework. The used capabilities are listed <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. The capability can be set per page, tab, setting section, setting field. Default: `manage_options`
  * @param       string      $sTextDomain        (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: admin-page-framework.
  * @return      void        returns nothing.
  */
 public function __construct($sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework')
 {
     if (!$this->_isInstantiatable()) {
         return;
     }
     parent::__construct($sOptionKey, $sCallerPath ? trim($sCallerPath) : ($sCallerPath = is_admin() && (isset($GLOBALS['pagenow']) && in_array($GLOBALS['pagenow'], array('plugins.php')) || isset($_GET['page'])) ? AdminPageFramework_Utility::getCallerScriptPath(__FILE__) : null), $sCapability, $sTextDomain);
     $this->oUtil->addAndDoAction($this, 'start_' . $this->oProp->sClassName, $this);
 }
 public function __construct($sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_network', $sTextDomain = 'admin-page-framework')
 {
     if (!$this->_isInstantiatable()) {
         return;
     }
     $sCallerPath = $sCallerPath ? $sCallerPath : AdminPageFramework_Utility::getCallerScriptPath(__FILE__);
     parent::__construct($sOptionKey, $sCallerPath, $sCapability, $sTextDomain);
     new AdminPageFramework_Model_Menu__RegisterMenu($this, 'network_admin_menu');
 }
 public function __construct($sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_network', $sTextDomain = 'admin-page-framework')
 {
     if (!$this->_isInstantiatable()) {
         return;
     }
     add_action('network_admin_menu', array($this, '_replyToBuildMenu'), 98);
     $sCallerPath = $sCallerPath ? $sCallerPath : AdminPageFramework_Utility::getCallerScriptPath(__FILE__);
     $this->oProp = new AdminPageFramework_Property_NetworkAdmin($this, $sCallerPath, get_class($this), $sOptionKey, $sCapability, $sTextDomain);
     parent::__construct($sOptionKey, $sCallerPath, $sCapability, $sTextDomain);
 }
 public function __construct($sPostType, $aArgs = array(), $sCallerPath = null, $sTextDomain = 'admin-page-framework')
 {
     if (empty($sPostType)) {
         return;
     }
     $this->oProp = new AdminPageFramework_Property_PostType($this, $sCallerPath ? trim($sCallerPath) : (is_admin() && isset($GLOBALS['pagenow']) && in_array($GLOBALS['pagenow'], array('edit.php', 'post.php', 'post-new.php', 'plugins.php', 'tags.php', 'edit-tags.php')) ? AdminPageFramework_Utility::getCallerScriptPath(__FILE__) : null), get_class($this), 'publish_posts', $sTextDomain, 'post_type');
     $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug($sPostType);
     $this->oProp->aPostTypeArgs = $aArgs;
     parent::__construct($this->oProp);
     $this->oUtil->addAndDoAction($this, "start_{$this->oProp->sClassName}", $this);
 }
 /**
  * Registers necessary callbacks ans sets up internal components including properties.
  * 
  * <h4>Example</h4>
  * <code>if ( is_admin() )
  *     new MyAdminPageClass( 'my_custom_option_key', __FILE__ );</code>
  * 
  * @access      public
  * @since       3.1.0
  * @see         http://codex.wordpress.org/Roles_and_Capabilities
  * @see         http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains
  * @param       string      $sOptionKey         (optional) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used.
  * @param       string      $sCallerPath        (optional) used to retrieve the plugin/theme details to auto-insert the information into the page footer.
  * @param       string      $sCapability        (optional) sets the overall access level to the admin pages created by the framework. The used capabilities are listed <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. The capability can be set per page, tab, setting section, setting field. Default: `manage_options.`
  * @param       string      $sTextDomain        (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: `admin-page-framework`.
  * @return      void        returns nothing.
  */
 public function __construct($sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_network', $sTextDomain = 'admin-page-framework')
 {
     if (!$this->_isInstantiatable()) {
         return;
     }
     add_action('network_admin_menu', array($this, '_replyToBuildMenu'), 98);
     $sCallerPath = $sCallerPath ? $sCallerPath : AdminPageFramework_Utility::getCallerScriptPath(__FILE__);
     // this is important to attempt to find the caller script path here when separating the library into multiple files.
     $this->oProp = new AdminPageFramework_Property_NetworkAdmin($this, $sCallerPath, get_class($this), $sOptionKey, $sCapability, $sTextDomain);
     parent::__construct($sOptionKey, $sCallerPath, $sCapability, $sTextDomain);
 }
 public function __get($sName)
 {
     if ('aScriptInfo' === $sName) {
         $this->sCallerPath = $this->sCallerPath ? $this->sCallerPath : AdminPageFramework_Utility::getCallerScriptPath(__FILE__);
         $this->aScriptInfo = $this->getCallerInfo($this->sCallerPath);
         return $this->aScriptInfo;
     }
     if ('aOptions' === $sName) {
         $this->aOptions = $this->_getOptions();
         return $this->aOptions;
     }
     if ('aLastInput' === $sName) {
         $this->aLastInput = $this->_getLastInput();
         return $this->aLastInput;
     }
 }
 private function _getCallerPath($sCallerPath)
 {
     if ($sCallerPath) {
         return trim($sCallerPath);
     }
     if (!is_admin()) {
         return null;
     }
     if (!isset($GLOBALS['pagenow'])) {
         return null;
     }
     $_sCalllerPath = in_array($GLOBALS['pagenow'], array('plugins.php')) || isset($_GET['page']) ? AdminPageFramework_Utility::getCallerScriptPath(__FILE__) : null;
     return $_sCalllerPath;
 }
 private function _getCallerScriptPath($sCallerPath)
 {
     $sCallerPath = trim($sCallerPath);
     if ($sCallerPath) {
         return $sCallerPath;
     }
     if (!is_admin()) {
         return null;
     }
     $_sPageNow = AdminPageFramework_Utility::getElement($GLOBALS, 'pagenow');
     if (in_array($_sPageNow, array('edit.php', 'post.php', 'post-new.php', 'plugins.php', 'tags.php', 'edit-tags.php', 'term.php'))) {
         return AdminPageFramework_Utility::getCallerScriptPath(__FILE__);
     }
     return null;
 }
 /**
  * 
  * @since 3.1.3
  */
 public function __get($sName)
 {
     if ('aScriptInfo' === $sName) {
         $this->sCallerPath = $this->sCallerPath ? $this->sCallerPath : AdminPageFramework_Utility::getCallerScriptPath(__FILE__);
         $this->aScriptInfo = $this->getCallerInfo($this->sCallerPath);
         return $this->aScriptInfo;
     }
     // 3.4.1+ Moved from `AdminPageFramework_Property_Page` as meta box classes also access it.
     // If $this->aOptions is called for the first time, retrieve the option data from the database and assign them to the property.
     // Once this is done, calling $this->aOptions will not trigger the __get() magic method any more.
     if ('aOptions' === $sName) {
         $this->aOptions = $this->_getOptions();
         return $this->aOptions;
     }
     // 3.3.0+   Sets and returns the last user form input data as an array.
     // 3.4.1+   Moved from `AdminPageFramework_Property_Page` as meta box classes also access it.
     if ('aLastInput' === $sName) {
         $this->aLastInput = $this->_getLastInput();
         return $this->aLastInput;
     }
     // For regular undefined items,
     // return 'undefined';
 }