Inheritance: extends AdminPageFramework_Registry_Base
 /**
  * Triggered when the tab is loaded.
  */
 public function replyToLoadTab($oAdminPage)
 {
     new GitHubCustomFieldType('admin_page_framework');
     $oAdminPage->addSettingSections($this->sPageSlug, array('section_id' => $this->sSectionID, 'tab_slug' => $this->sTabSlug));
     $oAdminPage->addSettingFields($this->sSectionID, array('field_id' => 'github_star', 'type' => 'github', 'user_name' => 'michaeluno', 'button_type' => 'star', 'count' => false, 'repository' => 'admin-page-framework', 'size' => 'mega', 'attributes' => array('data-text' => ' ' . AdminPageFramework_Registry::NAME . ' ' . AdminPageFramework_Registry::getVersion() . ' '), 'description' => __('Star the repository and get Involved!', 'admin-page-framework-demo'), 'show_title_column' => false));
     add_action('do_form_' . $this->sPageSlug . '_' . $this->sTabSlug, array($this, 'replyToDoTabBeforeForm'));
 }
 public function replyToLoadTab($oFactory)
 {
     add_action("style_{$this->sPageSlug}_{$this->sTabSlug}", array($this, 'replyToAddInlineCSS'));
     $oFactory->addSettingSections($this->sPageSlug, array('tab_slug' => $this->sTabSlug, 'section_id' => $this->sTabSlug, 'section_tab_slug' => 'welcome', 'title' => __("What's New", 'admin-page-framework-loader'), 'content' => $this->_getReadmeContents(AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/about.txt', '', array('New Features'))), array('tab_slug' => $this->sTabSlug, 'section_tab_slug' => $this->sTabSlug, 'section_id' => 'getting_started', 'title' => __("Getting Started", 'admin-page-framework-loader'), 'content' => $this->_getReadmeContents(AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/about.txt', "<h3>" . __('Contents', 'admin-page-framework-loader') . "</h3>", array('Getting Started', 'Tutorials'))), array('tab_slug' => $this->sTabSlug, 'section_tab_slug' => $this->sTabSlug, 'section_id' => 'change_log', 'title' => __("Change Log", 'admin-page-framework-loader'), 'content' => $this->_getChangeLog()));
     new GitHubCustomFieldType('admin_page_framework');
     $oFactory->addSettingSections($this->sPageSlug, array('section_id' => 'credit', 'tab_slug' => $this->sTabSlug, 'section_tab_slug' => $this->sTabSlug, 'title' => __('Credit', 'admin-page-framework-loader')));
     $oFactory->addSettingFields('credit', array('field_id' => '_message', 'type' => '_message', 'show_title_column' => false, 'content' => "<p class='about-description'>" . __('Admin Page Framework is created by the following contributors.', 'admin-page-framework-loader') . "</p>"), array('field_id' => '_contributors', 'type' => '_contributors', 'show_title_column' => false, 'content' => $this->_getContributors()), array('field_id' => 'github_star', 'type' => 'github', 'user_name' => 'michaeluno', 'button_type' => 'star', 'count' => false, 'repository' => 'admin-page-framework', 'size' => 'mega', 'attributes' => array('data-text' => ' ' . AdminPageFramework_Registry::NAME . ' ' . AdminPageFramework_Registry::getVersion() . ' '), 'description' => __('Star the repository and get Involved!', 'admin-page-framework-loader'), 'show_title_column' => false));
 }
 public function get()
 {
     if (!$this->isDebugModeEnabled()) {
         return '';
     }
     if (!in_array($this->sStructureType, array('widget', 'post_meta_box', 'page_meta_box', 'user_meta'))) {
         return '';
     }
     return "<div class='admin-page-framework-info'>" . $this->oMsg->get('debug_info') . ': ' . AdminPageFramework_Registry::NAME . ' ' . AdminPageFramework_Registry::getVersion() . "</div>";
 }
コード例 #4
0
 public function __construct($sLibraryPath)
 {
     if (!$this->_isLoadable()) {
         return;
     }
     AdminPageFramework_Registry::setUp($sLibraryPath);
     if (AdminPageFramework_Registry::$bIsMinifiedVersion) {
         return;
     }
     $this->_include();
 }
コード例 #5
0
 private static function _getLogHeadingLine($fCurrentTimeStamp, $nElapsed, $sCallerClass, $sCallerFunction)
 {
     static $_iPageLoadID;
     static $_nGMTOffset;
     $_nGMTOffset = isset($_nGMTOffset) ? $_nGMTOffset : get_option('gmt_offset');
     $_iPageLoadID = $_iPageLoadID ? $_iPageLoadID : uniqid();
     $_nNow = $fCurrentTimeStamp + $_nGMTOffset * 60 * 60;
     $_nMicroseconds = str_pad(round(($_nNow - floor($_nNow)) * 10000), 4, '0');
     $_aOutput = array(date("Y/m/d H:i:s", $_nNow) . '.' . $_nMicroseconds, self::_getFormattedElapsedTime($nElapsed), $_iPageLoadID, AdminPageFramework_Registry::getVersion(), $sCallerClass . '::' . $sCallerFunction, current_filter(), self::getCurrentURL());
     return implode(' ', $_aOutput);
 }
コード例 #6
0
 public function __construct($sLibraryPath = __FILE__)
 {
     if (!$this->_isLoadable()) {
         return;
     }
     AdminPageFramework_Registry::setUp($sLibraryPath);
     if (AdminPageFramework_Registry::$bIsMinifiedVersion) {
         return;
     }
     include AdminPageFramework_Registry::$sAutoLoaderPath;
     new AdminPageFramework_RegisterClasses(empty(AdminPageFramework_Registry::$aClassFiles) ? AdminPageFramework_Registry::$sDirPath : '', array('exclude_class_names' => array('AdminPageFramework_MinifiedVersionHeader', 'AdminPageFramework_BeautifiedVersionHeader')), AdminPageFramework_Registry::$aClassFiles);
     AdminPageFramework_Registry::$bIsDevelopmentVersion = class_exists('AdminPageFramework_InclusionClassFilesHeader');
 }
 private function _getFormattedSystemInformation($asCustomData)
 {
     $_aData = $this->getAsArray($asCustomData);
     $_aData = $_aData + array('Admin Page Framework' => isset($_aData['Admin Page Framework']) ? null : AdminPageFramework_Registry::getInfo(), 'WordPress' => $this->_getSiteInfoWithCache(!isset($_aData['WordPress'])), 'PHP' => $this->_getPHPInfo(!isset($_aData['PHP'])), 'PHP Error Log' => $this->_getErrorLogByType('php', !isset($_aData['PHP Error Log'])), 'MySQL' => isset($_aData['MySQL']) ? null : $this->getMySQLInfo(), 'MySQL Error Log' => $this->_getErrorLogByType('mysql', !isset($_aData['MySQL Error Log'])), 'Server' => $this->_getWebServerInfo(!isset($_aData['Server'])), 'Browser' => $this->_getClientInfo(!isset($_aData['Browser'])));
     return array_filter($_aData);
 }
 public static function _setLibraryData()
 {
     self::$_aLibraryData = array('sName' => AdminPageFramework_Registry::NAME, 'sURI' => AdminPageFramework_Registry::URI, 'sScriptName' => AdminPageFramework_Registry::NAME, 'sLibraryName' => AdminPageFramework_Registry::NAME, 'sLibraryURI' => AdminPageFramework_Registry::URI, 'sPluginName' => '', 'sPluginURI' => '', 'sThemeName' => '', 'sThemeURI' => '', 'sVersion' => AdminPageFramework_Registry::getVersion(), 'sDescription' => AdminPageFramework_Registry::DESCRIPTION, 'sAuthor' => AdminPageFramework_Registry::AUTHOR, 'sAuthorURI' => AdminPageFramework_Registry::AUTHOR_URI, 'sTextDomain' => AdminPageFramework_Registry::TEXT_DOMAIN, 'sDomainPath' => AdminPageFramework_Registry::TEXT_DOMAIN_PATH, 'sNetwork' => '', '_sitewide' => '');
     return self::$_aLibraryData;
 }
コード例 #9
0
 /**
  * Sets the library information property array.
  * @internal
  * @since 3.0.0
  */
 public static function _setLibraryData()
 {
     self::$_aLibraryData = array('sName' => AdminPageFramework_Registry::Name, 'sURI' => AdminPageFramework_Registry::URI, 'sScriptName' => AdminPageFramework_Registry::Name, 'sLibraryName' => AdminPageFramework_Registry::Name, 'sLibraryURI' => AdminPageFramework_Registry::URI, 'sPluginName' => '', 'sPluginURI' => '', 'sThemeName' => '', 'sThemeURI' => '', 'sVersion' => AdminPageFramework_Registry::getVersion(), 'sDescription' => AdminPageFramework_Registry::Description, 'sAuthor' => AdminPageFramework_Registry::Author, 'sAuthorURI' => AdminPageFramework_Registry::AuthorURI, 'sTextDomain' => AdminPageFramework_Registry::TextDomain, 'sDomainPath' => AdminPageFramework_Registry::TextDomainPath, 'sNetwork' => '', '_sitewide' => '');
     return self::$_aLibraryData;
 }
コード例 #10
0
 /**
  * Returns a set of HTML table outputs consisting of form sections and fields.
  * 
  * Currently there are mainly two types of structures.
  * 1. Normal Sections - Vertically arranged sections. They can be repeatable.
  * <code>
  *  <div class="admin-page-framework-sectionset">
  *      <div class="admin-page-framework-sections">
  *          <div class="admin-page-framework-section">
  *              <table class="form-table">
  *                  <caption>       
  *                      <div class="admin-page-framework-section-title">...</div>
  *                      <div class="admin-page-framework-section-description">...</div>
  *                  </caption>
  *                  <tbody>
  *                      <tr>a field goes here.</tr>
  *                      <tr>a field goes here.</tr>
  *                      <tr>a field goes here.</tr>
  *                  </tbody>
  *              </table>
  *          </div>
  *          <div class="admin-page-framework-section">
  *              if repeatable sections, this container is repeated
  *          </div>
  *      </div>
  *  </div>
  * </code>
  * 2. Tabbed Sections - Horizontally arranged grouped sections. They can be repeatable.
  * <code>
  *  <div class="admin-page-framework-sectionset">
  *      <div class="admin-page-framework-sections">
  *          <ul class="admin-page-framework-section-tabs">
  *              <li> ... </li>
  *              <li> ... </li>
  *          </ul>
  *          <div class="admin-page-framework-section">
  *              <table class="form-table">
  *                  <caption>       
  *                      <div class="admin-page-framework-section-title">...</div>
  *                      <div class="admin-page-framework-section-description">...</div>
  *                  </caption>
  *                  <tbody>
  *                      <tr>a field goes here.</tr>
  *                      <tr>a field goes here.</tr>
  *                      <tr>a field goes here.</tr>
  *                  </tbody>
  *              </table>
  *          </div>
  *          <div class="admin-page-framework-section">
  *              if repeatable sections, this container is repeated
  *          </div>
  *      </div>
  *  </div>
  * </code>
  * @since 3.0.0
  */
 public function getFormTables($aSections, $aFieldsInSections, $hfSectionCallback, $hfFieldCallback)
 {
     $_aOutput = array();
     $_sFieldsType = $this->_getSectionsFieldsType($aSections);
     // must be done before the $aSections array gets updated below.
     // Update the array structure by tab slug (passed by reference).
     $this->_divideElementsBySectionTabs($aSections, $aFieldsInSections);
     foreach ($aSections as $_sSectionTabSlug => $_aSectionsBySectionTab) {
         if (!count($aFieldsInSections[$_sSectionTabSlug])) {
             continue;
         }
         $_sSectionSet = $this->_getSectionsTables($_aSectionsBySectionTab, $aFieldsInSections[$_sSectionTabSlug], $hfSectionCallback, $hfFieldCallback);
         if (!$_sSectionSet) {
             continue;
         }
         $_aOutput[] = "<div " . $this->generateAttributes(array('class' => 'admin-page-framework-sectionset', 'id' => "sectionset-{$_sSectionTabSlug}_" . md5(serialize($_aSectionsBySectionTab)))) . ">" . $_sSectionSet . "</div>";
     }
     return implode(PHP_EOL, $_aOutput) . $this->_getSectionTabsEnablerScript() . (defined('WP_DEBUG') && WP_DEBUG && in_array($_sFieldsType, array('widget', 'post_meta_box', 'page_meta_box')) ? "<div class='admin-page-framework-info'>" . 'Debug Info: ' . AdminPageFramework_Registry::Name . ' ' . AdminPageFramework_Registry::getVersion() . "</div>" : '');
 }
 protected function _getDebugInfo($sFieldsType)
 {
     if (!$this->isDebugModeEnabled()) {
         return '';
     }
     if (!in_array($sFieldsType, array('widget', 'post_meta_box', 'page_meta_box', 'user_meta'))) {
         return '';
     }
     return "<div class='admin-page-framework-info'>" . 'Debug Info: ' . AdminPageFramework_Registry::NAME . ' ' . AdminPageFramework_Registry::getVersion() . "</div>";
 }
コード例 #12
0
 function __construct($sLibraryPath)
 {
     // The minifier script will include this file ( but it does not include WordPress ) to use the reflection class to extract the docblock
     if (!defined('ABSPATH')) {
         return;
     }
     // If the autoloader class exists, it means the framework has been loaded somewhere else.
     // [3.4.6+] Deprecated as the minified version does not have if ( class_exists( )  checks any more so all the classes get loaded.
     // if ( class_exists( 'AdminPageFramework_RegisterClasses' ) ) {
     // return;
     // }
     // Sets up registry properties.
     AdminPageFramework_Registry::setUp($sLibraryPath);
     // Load the classes. For the minified version, the autoloader class should not be located in the utility folder.
     if (!AdminPageFramework_Registry::$bIsMinifiedVersion) {
         include AdminPageFramework_Registry::$sAutoLoaderPath;
         include AdminPageFramework_Registry::$sDirPath . '/admin-page-framework-include-class-list.php';
         new AdminPageFramework_RegisterClasses(isset($aClassFiles) ? '' : AdminPageFramework_Registry::$sDirPath, array(), isset($aClassFiles) ? $aClassFiles : array());
     }
 }
コード例 #13
0
 /**
  * Returns the system information value for a textarea tag.
  */
 private function _getSystemInfomation($asValue = null, $asCustomData = null, $iPrintType = 1)
 {
     global $wpdb;
     $_aData = $this->getAsArray($asCustomData);
     $_aData = $_aData + array('Admin Page Framework' => isset($_aData['Admin Page Framework']) ? null : AdminPageFramework_Registry::getInfo(), 'WordPress' => isset($_aData['WordPress']) ? null : $this->_getSiteInfo(), 'PHP' => isset($_aData['PHP']) ? null : $this->_getPHPInfo(), 'PHP Error Log' => isset($_aData['PHP Error Log']) ? null : $this->_getPHPErrorLog(), 'MySQL' => isset($_aData['MySQL']) ? null : $this->getMySQLInfo(), 'MySQL Error Log' => isset($_aData['MySQL Error Log']) ? null : $this->_getMySQLErrorLog(), 'Server' => isset($_aData['Server']) ? null : $this->_getWebServerInfo(), 'Browser' => isset($_aData['Browser']) ? null : $this->_getClientInfo());
     $_aOutput = array();
     foreach ($_aData as $_sSection => $_aInfo) {
         // Skipping an empty element allows the user to remove a section by setting an empty section.
         if (empty($_aInfo)) {
             continue;
         }
         switch ($iPrintType) {
             default:
             case 1:
                 // use the framework readable representation of arrays.
                 $_aOutput[] = $this->getReadableArrayContents($_sSection, $_aInfo, 32) . PHP_EOL;
                 break;
             case 2:
                 // use print_r()
                 $_aOutput[] = "[{$_sSection}]" . PHP_EOL . print_r($_aInfo, true) . PHP_EOL;
                 break;
         }
     }
     return implode(PHP_EOL, $_aOutput);
 }
 public static function getFrameworkVersion($bTrimDevVer = false)
 {
     $_sVersion = AdminPageFramework_Registry::getVersion();
     return $bTrimDevVer ? self::getSuffixRemoved($_sVersion, '.dev') : $_sVersion;
 }