/** * @return array|string If sections exits, an array holding sections. If no, a string content of the item. */ private function _getFAQSubSections($asItems) { if (empty($asItems)) { return array(); } $aItems = $this->getContentsByHeader($asItems, 5); $_aNestedSections = array(); $_iLastIndex = count($aItems) - 1; foreach ($aItems as $_iIndex => $_aContent) { $_oParser = new AdminPageFramework_WPReadmeParser($_aContent[1]); // If no sections, return the contents of the first item. if (!$_aContent[0]) { return $_oParser->get(); } $_aNestedSections[] = array('section_id' => 'faq_item_' . $_iIndex, 'title' => $_aContent[0], 'collapsible' => array('toggle_all_button' => $_iLastIndex === $_iIndex ? array('bottom-right') : (0 === $_iIndex ? array('top-right') : false)), 'content' => $_oParser->get()); } return $_aNestedSections; }
/** * Triggered when the tab is loaded. */ public function replyToLoadTab($oAdminPage) { $_aItems = $this->getContentsByHeader($this->getReadmeContents(), 4); $_iLastIndex = count($_aItems) - 1; foreach ($_aItems as $_iIndex => $_aContent) { $_oParser = new AdminPageFramework_WPReadmeParser($_aContent[1]); $_sContent = $_oParser->get(); $oAdminPage->addSettingSections($this->sPageSlug, array('section_id' => 'tips_' . $_iIndex, 'title' => $_aContent[0], 'collapsible' => array('toggle_all_button' => $_iLastIndex === $_iIndex ? array('bottom-right') : (0 === $_iIndex ? array('top-right') : false)), 'content' => $_sContent)); } }
/** * Triggered when the tab is loaded. */ public function replyToLoadTab($oAdminPage) { $_aFAQs = array(); foreach ($this->getContentsByHeader($this->getFAQContents(), 4) as $_aContent) { $_aFAQs = array_merge($_aFAQs, $this->getContentsByHeader($_aContent[1], 5)); } $_iLastIndex = count($_aFAQs) - 1; foreach ($_aFAQs as $_iIndex => $_aContent) { $_oParser = new AdminPageFramework_WPReadmeParser(); $_oParser->setText($_aContent[1]); $_sContent = $_oParser->get(); $oAdminPage->addSettingSections($this->sPageSlug, array('section_id' => 'faq_items_' . $_iIndex, 'tab_slug' => $this->sTabSlug, 'title' => $_aContent[0], 'collapsible' => array('toggle_all_button' => $_iLastIndex === $_iIndex ? array('bottom-right') : (0 === $_iIndex ? array('top-right') : false)))); $oAdminPage->addSettingFields('faq_items_' . $_iIndex, array('field_id' => 'faq', 'type' => 'faq', 'show_title_column' => false, 'before_field' => $_sContent, 'attributes' => array('field' => array('style' => 'display:none;')))); } }