/** * Retrieves contents of a change log section of a readme file. * @since 3.5.0 * @return void */ private function _getChangeLog($sSection) { $_aReplacements = array('%PLUGIN_DIR_URL%' => AdminPageFrameworkLoader_Registry::getPluginURL(), '%WP_ADMIN_URL%' => admin_url()); $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser(AdminPageFrameworkLoader_Registry::$sDirPath . '/readme.txt', $_aReplacements); $_sChangeLog = $_oWPReadmeParser->getSection($sSection); $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser(AdminPageFrameworkLoader_Registry::$sDirPath . '/changelog.md', $_aReplacements); $_sChangeLog .= $_oWPReadmeParser->getSection($sSection); return $_sChangeLog ? $_sChangeLog : '<p>' . __('No valid changlog was found.', 'admin-page-framework-loader') . '</p>'; }
/** * Sets up pages. * * @callback action set_up_{instantiated class name} */ public function replyToSetUpPages($oFactory) { // ( required ) Add sub-menu items (pages or links) $oFactory->addSubMenuItems(array('title' => __('Sample Page', 'admin-page-framework-loader'), 'page_slug' => 'apf_sample_page', 'screen_icon' => AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/image/wp_logo_bw_32x32.png'), array('title' => __('Hidden Page', 'admin-page-framework-loader'), 'page_slug' => 'apf_hidden_page', 'screen_icon' => version_compare($GLOBALS['wp_version'], '3.8', '<') ? AdminPageFrameworkLoader_Registry::getPluginURL('asset/image/wp_logo_bw_32x32.png', AdminPageFrameworkLoader_Registry::$sFilePath) : null, 'show_in_menu' => false)); add_action("load_" . "apf_sample_page", array($this, 'replyToLoadPage')); add_action("load_" . "apf_hidden_page", array($this, 'replyToLoadPage')); add_action("do_" . "apf_sample_page", array($this, 'replyToModifySamplePage')); add_action("do_" . "apf_hidden_page", array($this, 'replyToModifyHiddenPage')); }
/** * * @since 3.5.3 */ protected function _getReadmeContents($sFilePath, $sTOCTitle, $asSections = array()) { $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser($sFilePath, array('%PLUGIN_DIR_URL%' => AdminPageFrameworkLoader_Registry::getPluginURL(), '%WP_ADMIN_URL%' => admin_url()), array('content_before_parsing' => array($this, '_replyToProcessShortcodes'))); $_sContent = ''; foreach ((array) $asSections as $_sSection) { $_sContent .= $_oWPReadmeParser->getSection($_sSection); } if ($sTOCTitle) { $_oTOC = new AdminPageFramework_TableOfContents($_sContent, 4, $sTOCTitle); return $_oTOC->get(); } return '' . $_sContent; }
/** * * @return array The demo content. */ private function _getDemo() { $_oOption = AdminPageFrameworkLoader_Option::getInstance(AdminPageFrameworkLoader_Registry::$aOptionKeys['main']); $_bEnabled = $_oOption->get('enable_demo'); $_sTitle = __('Demo', 'admin=page-framework-loader'); return array($_sTitle => array('title' => $_sTitle, 'description' => '<div style="text-align: center;" class="aligncenter"><img class="aligncenter" src="' . AdminPageFrameworkLoader_Registry::getPluginURL('/asset/image/icon-128x128.png') . '" alt="' . esc_attr($_sTitle) . '"/></div>' . '<p>' . __('Showcases the features of Admin Page Framework.', 'admin-page-framework-loader') . '</p>', 'link' => add_query_arg(array('enable_apfl_demo_pages' => $_bEnabled ? 0 : 1) + $_GET, admin_url($GLOBALS['pagenow'])), 'label' => $_bEnabled ? __('Deactivate', 'admin-page-framework-loader') : __('Activate', 'admin-page-framework-loader'))); }
private function getFAQContents() { $_aReplacements = array('%PLUGIN_DIR_URL%' => AdminPageFrameworkLoader_Registry::getPluginURL(), '%WP_ADMIN_URL%' => admin_url()); $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser(AdminPageFrameworkLoader_Registry::$sDirPath . '/readme.txt', $_aReplacements); return $_oWPReadmeParser->getRawSection('Frequently asked questions'); }
/** * Do page specific settings. * * @callback action load_{page slug} */ public function load_apf_second_page() { $this->enqueueStyle(AdminPageFrameworkLoader_Registry::getPluginURL('asset/css/code.css', AdminPageFrameworkLoader_Registry::$sFilePath), 'apf_second_page'); }
/** * Sets up static properties. * @return void */ public static function setUp($sPluginFilePath = null) { self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; self::$sDirPath = dirname(self::$sFilePath); }
/** * Returns the URL with the given relative path to the plugin path. * * <h3>Example</h3> * <code> * AdminPageFrameworkLoader_Registry::getPluginURL( 'asset/css/meta_box.css' ); * </code> * @since 3.5.0 * @return string */ public static function getPluginURL($sRelativePath = '') { if (isset(self::$_sPluginURLCache)) { return self::$_sPluginURLCache . $sRelativePath; } self::$_sPluginURLCache = trailingslashit(plugins_url('', self::$sFilePath)); return self::$_sPluginURLCache . $sRelativePath; }
/** * The content filter callback method. * * Alternatively use the `content_{instantiated class name}` method instead. */ public function content($sContent) { $_aReplacements = array('%PLUGIN_DIR_URL%' => AdminPageFrameworkLoader_Registry::getPluginURL(), '%WP_ADMIN_URL%' => admin_url()); $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser(AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/about.txt', $_aReplacements); return '' . "<h4>" . "<span class='header-icon dashicons dashicons-book'></span>" . __('Documentation', 'admin-page-framework-loader') . "</h4>" . "<a href='http://admin-page-framework.michaeluno.jp/en/v3/package-AdminPageFramework.html' target='_blank'>" . __('Manual', 'admin-page-framework-loader') . "</a>" . "<h4>" . "<span class='header-icon dashicons dashicons-book'></span>" . __('Tutorials', 'admin-page-framework-loader') . "</h4>" . $_oWPReadmeParser->getSection('Tutorials') . $sContent; }
/** * Filters the top part of the page content. * * @callback filter content_top_{page slug} * @return string */ public function replyToFilterContentTop($sContent) { $_sVersion = '- ' . AdminPageFrameworkLoader_Registry::VERSION; $_sPluginName = AdminPageFrameworkLoader_Registry::SHORTNAME . ' ' . $_sVersion; $_sBadgeURL = esc_url(AdminPageFrameworkLoader_Registry::getPluginURL('asset/image/icon-128x128.png')); $_aOutput = array(); $_aOutput[] = "<h1>" . sprintf(__('Welcome to %1$s', 'admin-page-framework-loader'), $_sPluginName) . "</h1>"; $_aOutput[] = "<div class='about-text'>" . sprintf(__('Thank you for updating to the latest version! %1$s is ready to make your plugin or theme development faster, more organized and better!', 'admin-page-framework-loader'), $_sPluginName) . "</div>"; $_aOutput[] = '' . "<div class='apf-badge'>" . "<div class='apf-badge-image m-flip'>" . "<img src='{$_sBadgeURL}' />" . "</div>" . "<span class='label'>" . sprintf(__('Version %1$s', 'admin-page-framework-loader'), $_sVersion) . "</span>" . "</div>"; return implode(PHP_EOL, $_aOutput) . $sContent; }
/** * Modifies the inline CSS rules of the page. * * @remark A callback method of the "style_{page slug}" filter hook. */ public function replyToAddInlineCSS($sCSSRules) { $_sBadgeURL = esc_url(AdminPageFrameworkLoader_Registry::getPluginURL('asset/image/icon-128x128.png')); $_sWP38OrBelow = version_compare($GLOBALS['wp_version'], '3.8', '<') ? ".about-wrap .introduction h2 {\r\n padding: 1em;\r\n }" : ""; return $sCSSRules . ".apf-badge {\r\n background: url('{$_sBadgeURL}') no-repeat;\r\n } \r\n " . $_sWP38OrBelow; }
/** * Output custom page contents. */ public function replyToDoAfterPage() { $_aReplacements = array('%PLUGIN_DIR_URL%' => AdminPageFrameworkLoader_Registry::getPluginURL(), '%WP_ADMIN_URL%' => admin_url()); $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser(AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/about.txt', $_aReplacements); echo "<h3>" . __('Tutorials', 'admin-page-framework-loader') . "</h3>" . $_oWPReadmeParser->getSection('Tutorials'); }