/** * Load the form */ private function loadForm() { $this->frm = new BackendForm('settingsSeo'); $this->frm->addCheckbox('seo_noodp', $this->get('fork.settings')->get('Core', 'seo_noodp', false)); $this->frm->addCheckbox('seo_noydir', $this->get('fork.settings')->get('Core', 'seo_noydir', false)); $this->frm->addCheckbox('seo_nofollow_in_comments', $this->get('fork.settings')->get('Core', 'seo_nofollow_in_comments', false)); }
/** * Add all element into the form */ protected function loadForm() { // is the form submitted? if ($this->frm->isSubmitted()) { /** * If the fields are disabled we don't have any values in the post. * When an error occurs in the other fields of the form the meta-fields would be cleared * therefore we alter the POST so it contains the initial values. */ if (!isset($_POST['page_title'])) { $_POST['page_title'] = isset($this->data['title']) ? $this->data['title'] : null; } if (!isset($_POST['meta_description'])) { $_POST['meta_description'] = isset($this->data['description']) ? $this->data['description'] : null; } if (!isset($_POST['meta_keywords'])) { $_POST['meta_keywords'] = isset($this->data['keywords']) ? $this->data['keywords'] : null; } if (!isset($_POST['url'])) { $_POST['url'] = isset($this->data['url']) ? $this->data['url'] : null; } if ($this->custom && !isset($_POST['meta_custom'])) { $_POST['meta_custom'] = isset($this->data['custom']) ? $this->data['custom'] : null; } if (!isset($_POST['seo_index'])) { $_POST['seo_index'] = isset($this->data['data']['seo_index']) ? $this->data['data']['seo_index'] : 'none'; } if (!isset($_POST['seo_follow'])) { $_POST['seo_follow'] = isset($this->data['data']['seo_follow']) ? $this->data['data']['seo_follow'] : 'none'; } } // add page title elements into the form $this->frm->addCheckbox('page_title_overwrite', isset($this->data['title_overwrite']) && $this->data['title_overwrite'] == 'Y'); $this->frm->addText('page_title', isset($this->data['title']) ? $this->data['title'] : null); // add meta description elements into the form $this->frm->addCheckbox('meta_description_overwrite', isset($this->data['description_overwrite']) && $this->data['description_overwrite'] == 'Y'); $this->frm->addText('meta_description', isset($this->data['description']) ? $this->data['description'] : null); // add meta keywords elements into the form $this->frm->addCheckbox('meta_keywords_overwrite', isset($this->data['keywords_overwrite']) && $this->data['keywords_overwrite'] == 'Y'); $this->frm->addText('meta_keywords', isset($this->data['keywords']) ? $this->data['keywords'] : null); // add URL elements into the form $this->frm->addCheckbox('url_overwrite', isset($this->data['url_overwrite']) && $this->data['url_overwrite'] == 'Y'); $this->frm->addText('url', isset($this->data['url']) ? urldecode($this->data['url']) : null); // advanced SEO $indexValues = array(array('value' => 'none', 'label' => BackendLanguage::getLabel('None')), array('value' => 'index', 'label' => 'index'), array('value' => 'noindex', 'label' => 'noindex')); $this->frm->addRadiobutton('seo_index', $indexValues, isset($this->data['data']['seo_index']) ? $this->data['data']['seo_index'] : 'none'); $followValues = array(array('value' => 'none', 'label' => BackendLanguage::getLabel('None')), array('value' => 'follow', 'label' => 'follow'), array('value' => 'nofollow', 'label' => 'nofollow')); $this->frm->addRadiobutton('seo_follow', $followValues, isset($this->data['data']['seo_follow']) ? $this->data['data']['seo_follow'] : 'none'); // should we add the meta-custom field if ($this->custom) { // add meta custom element into the form $this->frm->addTextarea('meta_custom', isset($this->data['custom']) ? $this->data['custom'] : null); } $this->frm->addHidden('meta_id', $this->id); $this->frm->addHidden('base_field_name', $this->baseFieldName); $this->frm->addHidden('custom', $this->custom); $this->frm->addHidden('class_name', $this->callback['class']); $this->frm->addHidden('method_name', $this->callback['method']); $this->frm->addHidden('parameters', \SpoonFilter::htmlspecialchars(serialize($this->callback['parameters']))); }
/** * Load the settings form */ protected function loadSettingsForm() { $mapTypes = array('ROADMAP' => BL::lbl('Roadmap', $this->getModule()), 'SATELLITE' => BL::lbl('Satellite', $this->getModule()), 'HYBRID' => BL::lbl('Hybrid', $this->getModule()), 'TERRAIN' => BL::lbl('Terrain', $this->getModule())); $zoomLevels = array_combine(array_merge(array('auto'), range(3, 18)), array_merge(array(BL::lbl('Auto', $this->getModule())), range(3, 18))); $this->settingsForm = new BackendForm('settings'); // add map info (overview map) $this->settingsForm->addHidden('map_id', $this->id); $this->settingsForm->addDropdown('zoom_level', $zoomLevels, $this->settings['zoom_level']); $this->settingsForm->addText('width', $this->settings['width']); $this->settingsForm->addText('height', $this->settings['height']); $this->settingsForm->addDropdown('map_type', $mapTypes, $this->settings['map_type']); $this->settingsForm->addCheckbox('full_url', $this->settings['full_url']); $this->settingsForm->addCheckbox('directions', $this->settings['directions']); $this->settingsForm->addCheckbox('marker_overview', $this->record['show_overview'] == 'Y'); }
/** * Load the settings form */ protected function loadSettingsForm() { $mapTypes = array('ROADMAP' => BL::lbl('Roadmap', $this->getModule()), 'SATELLITE' => BL::lbl('Satellite', $this->getModule()), 'HYBRID' => BL::lbl('Hybrid', $this->getModule()), 'TERRAIN' => BL::lbl('Terrain', $this->getModule()), 'STREET_VIEW' => BL::lbl('StreetView', $this->getModule())); $mapStyles = array('standard' => BL::lbl('Default', $this->getModule()), 'custom' => BL::lbl('Custom', $this->getModule()), 'gray' => BL::lbl('Gray', $this->getModule()), 'blue' => BL::lbl('Blue', $this->getModule())); $zoomLevels = array_combine(array_merge(array('auto'), range(1, 18)), array_merge(array(BL::lbl('Auto', $this->getModule())), range(1, 18))); $this->settingsForm = new BackendForm('settings'); // add map info (overview map) $this->settingsForm->addHidden('map_id', $this->id); $this->settingsForm->addDropdown('zoom_level', $zoomLevels, $this->settings['zoom_level']); $this->settingsForm->addText('width', $this->settings['width']); $this->settingsForm->addText('height', $this->settings['height']); $this->settingsForm->addDropdown('map_type', $mapTypes, $this->settings['map_type']); $this->settingsForm->addDropdown('map_style', $mapStyles, isset($this->settings['map_style']) ? $this->settings['map_style'] : null); $this->settingsForm->addCheckbox('full_url', $this->settings['full_url']); $this->settingsForm->addCheckbox('directions', $this->settings['directions']); $this->settingsForm->addCheckbox('marker_overview', $this->record['show_overview'] == 'Y'); }
/** * Load the form */ private function loadForm() { // list of default domains $defaultDomains = array(str_replace(array('http://', 'www.', 'https://'), '', SITE_URL)); // create form $this->frm = new BackendForm('settingsIndex'); // general settings $this->frm->addText('site_title', $this->get('fork.settings')->get('Core', 'site_title_' . BL::getWorkingLanguage(), SITE_DEFAULT_TITLE)); $this->frm->addTextarea('site_html_header', $this->get('fork.settings')->get('Core', 'site_html_header', null), 'textarea code', 'textareaError code', true); $this->frm->addTextarea('site_start_of_body_scripts', $this->get('fork.settings')->get('Core', 'site_start_of_body_scripts', null), 'textarea code', 'textareaError code', true); $this->frm->addTextarea('site_html_footer', $this->get('fork.settings')->get('Core', 'site_html_footer', null), 'textarea code', 'textareaError code', true); $this->frm->addTextarea('site_domains', implode("\n", (array) $this->get('fork.settings')->get('Core', 'site_domains', $defaultDomains)), 'textarea code', 'textareaError code'); // facebook settings $this->frm->addText('facebook_admin_ids', $this->get('fork.settings')->get('Core', 'facebook_admin_ids', null)); $this->frm->addText('facebook_application_id', $this->get('fork.settings')->get('Core', 'facebook_app_id', null)); $this->frm->addText('facebook_application_secret', $this->get('fork.settings')->get('Core', 'facebook_app_secret', null)); // twitter settings $this->frm->addText('twitter_site_name', ltrim($this->get('fork.settings')->get('Core', 'twitter_site_name', null), '@')); // ckfinder $this->frm->addText('ckfinder_license_name', $this->get('fork.settings')->get('Core', 'ckfinder_license_name', null)); $this->frm->addText('ckfinder_license_key', $this->get('fork.settings')->get('Core', 'ckfinder_license_key', null)); $this->frm->addText('ckfinder_image_max_width', $this->get('fork.settings')->get('Core', 'ckfinder_image_max_width', 1600)); $this->frm->addText('ckfinder_image_max_height', $this->get('fork.settings')->get('Core', 'ckfinder_image_max_height', 1200)); // api keys $this->frm->addText('fork_api_public_key', $this->get('fork.settings')->get('Core', 'fork_api_public_key', null)); $this->frm->addText('fork_api_private_key', $this->get('fork.settings')->get('Core', 'fork_api_private_key', null)); // date & time formats $this->frm->addDropdown('time_format', BackendModel::getTimeFormats(), $this->get('fork.settings')->get('Core', 'time_format')); $this->frm->addDropdown('date_format_short', BackendModel::getDateFormatsShort(), $this->get('fork.settings')->get('Core', 'date_format_short')); $this->frm->addDropdown('date_format_long', BackendModel::getDateFormatsLong(), $this->get('fork.settings')->get('Core', 'date_format_long')); // number formats $this->frm->addDropdown('number_format', BackendModel::getNumberFormats(), $this->get('fork.settings')->get('Core', 'number_format')); // create a list of the languages foreach ($this->get('fork.settings')->get('Core', 'languages', array('en')) as $abbreviation) { // is this the default language $defaultLanguage = $abbreviation == SITE_DEFAULT_LANGUAGE ? true : false; // attributes $activeAttributes = array(); $activeAttributes['id'] = 'active_language_' . $abbreviation; $redirectAttributes = array(); $redirectAttributes['id'] = 'redirect_language_' . $abbreviation; // fetch label $label = BL::lbl(mb_strtoupper($abbreviation), 'Core'); // default may not be unselected if ($defaultLanguage) { // add to attributes $activeAttributes['disabled'] = 'disabled'; $redirectAttributes['disabled'] = 'disabled'; // overrule in $_POST if (!isset($_POST['active_languages']) || !is_array($_POST['active_languages'])) { $_POST['active_languages'] = array(SITE_DEFAULT_LANGUAGE); } elseif (!in_array($abbreviation, $_POST['active_languages'])) { $_POST['active_languages'][] = $abbreviation; } if (!isset($_POST['redirect_languages']) || !is_array($_POST['redirect_languages'])) { $_POST['redirect_languages'] = array(SITE_DEFAULT_LANGUAGE); } elseif (!in_array($abbreviation, $_POST['redirect_languages'])) { $_POST['redirect_languages'][] = $abbreviation; } } // add to the list $activeLanguages[] = array('label' => $label, 'value' => $abbreviation, 'attributes' => $activeAttributes, 'variables' => array('default' => $defaultLanguage)); $redirectLanguages[] = array('label' => $label, 'value' => $abbreviation, 'attributes' => $redirectAttributes, 'variables' => array('default' => $defaultLanguage)); } $hasMultipleLanguages = BackendModel::getContainer()->getParameter('site.multilanguage'); // create multilanguage checkbox $this->frm->addMultiCheckbox('active_languages', $activeLanguages, $this->get('fork.settings')->get('Core', 'active_languages', array($hasMultipleLanguages))); $this->frm->addMultiCheckbox('redirect_languages', $redirectLanguages, $this->get('fork.settings')->get('Core', 'redirect_languages', array($hasMultipleLanguages))); // api keys are not required for every module if ($this->needsAkismet) { $this->frm->addText('akismet_key', $this->get('fork.settings')->get('Core', 'akismet_key', null)); } if ($this->needsGoogleMaps) { $this->frm->addText('google_maps_key', $this->get('fork.settings')->get('Core', 'google_maps_key', null)); } // cookies $this->frm->addCheckbox('show_cookie_bar', $this->get('fork.settings')->get('Core', 'show_cookie_bar', false)); }