/** * 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>"; }
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); }
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; }
/** * 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; }
/** * 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>"; }
public static function getFrameworkVersion($bTrimDevVer = false) { $_sVersion = AdminPageFramework_Registry::getVersion(); return $bTrimDevVer ? self::getSuffixRemoved($_sVersion, '.dev') : $_sVersion; }