/** * Echoes the meta box contents. * * @since 2.0.0 * @remark A callback for the `add_meta_box()` method. * @param object $oPost The object of the post associated with the meta box. * @param array $vArgs The array of arguments. * @return void * @internal */ public function _replyToPrintMetaBoxContents($oPost, $vArgs) { // Use nonce for verification $_aOutput = array(); $_aOutput[] = wp_nonce_field($this->oProp->sMetaBoxID, $this->oProp->sMetaBoxID, true, false); // @deprecated 3.3.2+ Moved to _registerFormElements() method. // Condition the sections and fields definition arrays. // $this->oForm->applyConditions(); // will set $this->oForm->aConditionedFields internally // $this->oForm->applyFiltersToFields( $this, $this->oProp->sClassName ); // @deprecated 3.4.1 This procedure is done in the _registerFormElements() method. // Set the option array - the framework will refer to this data when displaying the fields. // if ( isset( $this->oProp->aOptions ) ) { // $this->_setOptionArray( // isset( $oPost->ID ) ? $oPost->ID : ( isset( $_GET['page'] ) ? $_GET['page'] : null ), // $this->oForm->aConditionedFields // ); // will set $this->oProp->aOptions // } // @deprecated 3.4.1 This procedure is done in the _registerFormElements() method. // Add the repeatable section elements to the fields definition array. // $this->oForm->setDynamicElements( $this->oProp->aOptions ); // will update $this->oForm->aConditionedFields // Get the fields output. $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->_getFieldErrors(), $this->oMsg); $_aOutput[] = $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); /* Do action */ $this->oUtil->addAndDoActions($this, 'do_' . $this->oProp->sClassName, $this); /* Render the filtered output */ echo $this->oUtil->addAndApplyFilters($this, "content_{$this->oProp->sClassName}", $this->content(implode(PHP_EOL, $_aOutput))); }
/** * Prints out the widget form. * * @since 3.2.0 * @internal */ public function _printWidgetForm() { // Get the fields output. $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->_getFieldErrors(), $this->oMsg); $_aOutput[] = $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); echo implode(PHP_EOL, $_aOutput); }
public function _replyToPrintMetaBoxContents($oPost, $vArgs) { $_aOutput = array(); $_aOutput[] = wp_nonce_field($this->oProp->sMetaBoxID, $this->oProp->sMetaBoxID, true, false); $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->_getFieldErrors(), $this->oMsg); $_aOutput[] = $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); $this->oUtil->addAndDoActions($this, 'do_' . $this->oProp->sClassName, $this); echo $this->oUtil->addAndApplyFilters($this, "content_{$this->oProp->sClassName}", $this->content(implode(PHP_EOL, $_aOutput))); }
private function _getFieldsOutput($iUserID) { $_aOutput = array(); $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->_getFieldErrors(), $this->oMsg); $_aOutput[] = $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); $_sOutput = $this->oUtil->addAndApplyFilters($this, 'content_' . $this->oProp->sClassName, $this->content(implode(PHP_EOL, $_aOutput))); $this->oUtil->addAndDoActions($this, 'do_' . $this->oProp->sClassName, $this); return $_sOutput; }
private function _getFieldsOutput($iTermID, $bRenderTableRow) { $_aOutput = array(); $_aOutput[] = wp_nonce_field($this->oProp->sClassHash, $this->oProp->sClassHash, true, false); $this->_setOptionArray($iTermID, $this->oProp->sOptionKey); $this->oForm->format(); $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->_getFieldErrors(), $this->oMsg); $_aOutput[] = $bRenderTableRow ? $_oFieldsTable->getFieldRows($this->oForm->aFields['_default'], array($this, '_replyToGetFieldOutput')) : $_oFieldsTable->getFields($this->oForm->aFields['_default'], array($this, '_replyToGetFieldOutput')); $_sOutput = $this->oUtil->addAndApplyFilters($this, 'content_' . $this->oProp->sClassName, implode(PHP_EOL, $_aOutput)); $this->oUtil->addAndDoActions($this, 'do_' . $this->oProp->sClassName, $this); return $_sOutput; }
private function _printMainContent($sPageSlug, $sTabSlug) { $_bIsSideMetaboxExist = isset($GLOBALS['wp_meta_boxes'][$GLOBALS['page_hook']]['side']) && count($GLOBALS['wp_meta_boxes'][$GLOBALS['page_hook']]['side']) > 0; echo "<!-- main admin page content -->"; echo "<div class='admin-page-framework-content'>"; if ($_bIsSideMetaboxExist) { echo "<div id='post-body-content'>"; } ob_start(); if ($this->oProp->bEnableForm && $this->oForm->isPageAdded($sPageSlug)) { $this->aFieldErrors = isset($this->aFieldErrors) ? $this->aFieldErrors : $this->_getFieldErrors($sPageSlug); $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->aFieldErrors, $this->oMsg); echo $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); } $_sContent = ob_get_contents(); ob_end_clean(); echo $this->oUtil->addAndApplyFilters($this, $this->oUtil->getFilterArrayByPrefix('content_', $this->oProp->sClassName, $sPageSlug, $sTabSlug, false), $_sContent); $this->oUtil->addAndDoActions($this, $this->oUtil->getFilterArrayByPrefix('do_', $this->oProp->sClassName, $sPageSlug, $sTabSlug, true), $this); if ($_bIsSideMetaboxExist) { echo "</div><!-- #post-body-content -->"; } echo "</div><!-- .admin-page-framework-content -->"; }
private function _getFormOutput($sPageSlug) { if (!$this->oProp->bEnableForm) { return ''; } if (!$this->oForm->isPageAdded($sPageSlug)) { return ''; } $this->aFieldErrors = isset($this->aFieldErrors) ? $this->aFieldErrors : $this->_getFieldErrors($sPageSlug); $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->aFieldErrors, $this->oMsg); return $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); }
/** * Renders the main content of the admin page. * * @since 3.0.0 * @since 3.3.1 Moved from `AdminPageFramework_Page`. */ private function _printMainContent($sPageSlug, $sTabSlug) { /* Check if a sidebar meta box is registered */ $_bIsSideMetaboxExist = isset($GLOBALS['wp_meta_boxes'][$GLOBALS['page_hook']]['side']) && count($GLOBALS['wp_meta_boxes'][$GLOBALS['page_hook']]['side']) > 0; echo "<!-- main admin page content -->"; echo "<div class='admin-page-framework-content'>"; if ($_bIsSideMetaboxExist) { echo "<div id='post-body-content'>"; } /* Capture the output buffer */ ob_start(); // start buffer // Render the form elements. if ($this->oProp->bEnableForm && $this->oForm->isPageAdded($sPageSlug)) { $this->aFieldErrors = isset($this->aFieldErrors) ? $this->aFieldErrors : $this->_getFieldErrors($sPageSlug); $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->aFieldErrors, $this->oMsg); // @deprecated 3.4.1 the followings are already done in _replyToRegisterSettings(). // $this->oForm->setCurrentPageSlug( $sPageSlug ); // $this->oForm->setCurrentTabSlug( $sTabSlug ); // $this->oForm->applyConditions(); // $this->oForm->applyFiltersToFields( $this, $this->oProp->sClassName ); // applies filters to the conditioned field definition arrays. // $this->oForm->setDynamicElements( $this->oProp->aOptions ); // will update $this->oForm->aConditionedFields echo $_oFieldsTable->getFormTables($this->oForm->aConditionedSections, $this->oForm->aConditionedFields, array($this, '_replyToGetSectionHeaderOutput'), array($this, '_replyToGetFieldOutput')); } $_sContent = ob_get_contents(); // assign the content buffer to a variable ob_end_clean(); // end buffer and remove the buffer // Apply the content filters. // @todo call the content() method. echo $this->oUtil->addAndApplyFilters($this, $this->oUtil->getFilterArrayByPrefix('content_', $this->oProp->sClassName, $sPageSlug, $sTabSlug, false), $_sContent); // Do the page actions. $this->oUtil->addAndDoActions($this, $this->oUtil->getFilterArrayByPrefix('do_', $this->oProp->sClassName, $sPageSlug, $sTabSlug, true), $this); if ($_bIsSideMetaboxExist) { echo "</div><!-- #post-body-content -->"; } echo "</div><!-- .admin-page-framework-content -->"; }
/** * Retrieves the fields output. * * @since 3.0.0 * @internal */ private function _getFieldsOutput($iTermID, $bRenderTableRow) { $_aOutput = array(); /* Set nonce. */ $_aOutput[] = wp_nonce_field($this->oProp->sClassHash, $this->oProp->sClassHash, true, false); /* Set the option property array */ $this->_setOptionArray($iTermID, $this->oProp->sOptionKey); /* Format the fields arrays - taxonomy fields do not support sections */ $this->oForm->format(); /* Get the field outputs */ $_oFieldsTable = new AdminPageFramework_FormTable($this->oProp->aFieldTypeDefinitions, $this->_getFieldErrors(), $this->oMsg); $_aOutput[] = $bRenderTableRow ? $_oFieldsTable->getFieldRows($this->oForm->aFields['_default'], array($this, '_replyToGetFieldOutput')) : $_oFieldsTable->getFields($this->oForm->aFields['_default'], array($this, '_replyToGetFieldOutput')); /* Filter the output */ // @todo call the content() method. $_sOutput = $this->oUtil->addAndApplyFilters($this, 'content_' . $this->oProp->sClassName, implode(PHP_EOL, $_aOutput)); /* Do action */ $this->oUtil->addAndDoActions($this, 'do_' . $this->oProp->sClassName, $this); return $_sOutput; }