/** * generate box to save it * @return \wtb_seo_box */ public function generateBox() { $box = new wtb_seo_box(); for ($int = 1; $int <= 3; $int++) { $section = new wtb_seo_box_section($int); // keyword $section->keyword = ''; $inputName = $section->getInfoKey('keyword'); if (!empty($_POST[$inputName])) { $section->keyword = trim($_POST[$inputName]); $section->density = $this->getFromPostRequest($section->getInfoKey('density')); $section->score = $this->getFromPostRequest($section->getInfoKey('score')); $section->wdf = $this->getFromPostRequest($section->getInfoKey('wdf')); $section->idf = $this->getFromPostRequest($section->getInfoKey('idf')); // parameters $section->parameters = array(); $paramsInputName = $section->getInfoKey('checkboxes'); if (!empty($_POST[$paramsInputName]) and is_array($_POST[$paramsInputName])) { $section->parameters = $_POST[$paramsInputName]; } } $box->addSection($section); } return $box; }
/** * generate box to show in box on post edit page * @return \wtb_seo_box */ public function generateBox() { $box = new wtb_seo_box(); if ($this->isNewPage()) { $box->showErrorOnEmptyTitle = $this->isNewPage(); $box->showErrorOnEmptyContent = $this->isNewPage(); } else { for ($int = 1; $int <= 3; $int++) { $section = $this->getSection($int); // ohne title gehen wir nicht weiter if ($section) { $box->addSection($section); } } } return $box; }