Copyright (c) 2013-2017, Michael Uno; Licensed under MIT */ class AdminPageFramework_View__PageRenderer extends AdminPageFramework_FrameworkUtility { public $oFactory; public $sPageSlug; public $sTabSlug; public $aCSSRules = array(); public $aScripts = array(); public function __construct($oFactory, $sPageSlug, $sTabSlug) { $this->oFactory = $oFactory; $this->sPageSlug = $sPageSlug; $this->sTabSlug = $sTabSlug; } public function render() { $_sPageSlug = $this->sPageSlug; $_sTabSlug = $this->sTabSlug; $this->addAndDoActions($this->oFactory, $this->getFilterArrayByPrefix('do_before_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true), $this->oFactory); ?>
_getContentTop(); ?>
addAndDoActions($this->oFactory, $this->getFilterArrayByPrefix('do_form_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true), $this->oFactory); $this->_printFormOpeningTag($this->oFactory->oProp->bEnableForm); ?>
_printMainPageContent($_sPageSlug, $_sTabSlug); $this->_printPageMetaBoxes(); ?>
_printFormClosingTag($_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm); ?>
addAndApplyFilters($this->oFactory, $this->getFilterArrayByPrefix('content_bottom_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, false), ''); ?>
addAndDoActions($this->oFactory, $this->getFilterArrayByPrefix('do_after_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true), $this->oFactory); } private function _getNumberOfColumns() { if (!$this->doesMetaBoxExist('side')) { return 1; } $_iColumns = $this->getNumberOfScreenColumns(); return $_iColumns ? $_iColumns : 1; } private function _getContentTop() { $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon($this->oFactory, $this->sPageSlug, $this->sTabSlug); $_sContentTop = $_oScreenIcon->get(); $_oPageHeadingTabs = new AdminPageFramework_View__PageRenderer__PageHeadingTabs($this->oFactory, $this->sPageSlug); $_sContentTop.= $_oPageHeadingTabs->get(); $_oInPageTabs = new AdminPageFramework_View__PageRenderer__InPageTabs($this->oFactory, $this->sPageSlug); $_sContentTop.= $_oInPageTabs->get(); return $this->addAndApplyFilters($this->oFactory, $this->getFilterArrayByPrefix('content_top_', $this->oFactory->oProp->sClassName, $this->sPageSlug, $this->sTabSlug, false), $_sContentTop); } private function _printMainPageContent($sPageSlug, $sTabSlug) { $_bSideMetaboxExists = $this->doesMetaBoxExist('side'); echo ""; echo "
"; if ($_bSideMetaboxExists) { echo "
"; } echo $this->addAndApplyFilters($this->oFactory, $this->getFilterArrayByPrefix('content_', $this->oFactory->oProp->sClassName, $sPageSlug, $sTabSlug, false), $this->oFactory->content($this->_getFormOutput($sPageSlug))); $this->addAndDoActions($this->oFactory, $this->getFilterArrayByPrefix('do_', $this->oFactory->oProp->sClassName, $sPageSlug, $sTabSlug, true), $this->oFactory); if ($_bSideMetaboxExists) { echo "
"; } echo "
"; } private function _getFormOutput($sPageSlug) { if (!$this->oFactory->oProp->bEnableForm) { return ''; } return $this->oFactory->oForm->get(); } private function _printPageMetaBoxes() { $_oPageMetaBoxRenderer = new AdminPageFramework_View__PageMataBoxRenderer(); $_oPageMetaBoxRenderer->render('side'); $_oPageMetaBoxRenderer->render('normal'); $_oPageMetaBoxRenderer->render('advanced'); } private function _printFormOpeningTag($fEnableForm = true) { if (!$fEnableForm) { return; } echo "
getAttributes(array('method' => 'post', 'enctype' => $this->oFactory->oProp->sFormEncType, 'id' => 'admin-page-framework-form', 'action' => wp_unslash(remove_query_arg('settings-updated', $this->oFactory->oProp->sTargetFormPage)),)) . " >" . PHP_EOL; echo "" . PHP_EOL; settings_fields($this->oFactory->oProp->sOptionKey); } private function _printFormClosingTag($sPageSlug, $sTabSlug, $fEnableForm = true) { if (!$fEnableForm) { return; } $_sNonceTransientKey = 'form_' . md5($this->oFactory->oProp->sClassName . get_current_user_id()); $_sNonce = $this->getTransient($_sNonceTransientKey, '_admin_page_framework_form_nonce_' . uniqid()); $this->setTransient($_sNonceTransientKey, $_sNonce, 60 * 60); echo "" . PHP_EOL . "" . PHP_EOL . "" . PHP_EOL . "
" . PHP_EOL; } }