public function cbAppendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('SMTP Email Library')));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Host'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][host]', Symphony::Configuration()->get('host', 'smtp_email_library')));
     $div->appendChild($label);
     $label = Widget::Label(__('Port'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][port]', Symphony::Configuration()->get('port', 'smtp_email_library')));
     $div->appendChild($label);
     $group->appendChild($div);
     $label = Widget::Label();
     $input = Widget::Input('settings[smtp_email_library][auth]', '1', 'checkbox');
     if (Symphony::Configuration()->get('auth', 'smtp_email_library') == '1') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Requires authentication');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Some SMTP connections require authentication. If that is the case, enter the username/password combination below.', array('class' => 'help')));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Username'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][username]', Symphony::Configuration()->get('username', 'smtp_email_library')));
     $div->appendChild($label);
     $label = Widget::Label(__('Password'));
     $label->appendChild(Widget::Input('settings[smtp_email_library][password]', Symphony::Configuration()->get('password', 'smtp_email_library')));
     $div->appendChild($label);
     $group->appendChild($div);
     $context['wrapper']->appendChild($group);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $this->_driver->addPublishHeaders($this->_engine->Page);
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $container = new XMLElement('div', $this->get('label'));
     $container->setAttribute('class', 'label');
     $container->appendChild(new XMLElement('i', __('Optional')));
     $group = new XMLElement('div');
     // From:
     $label = Widget::Label(__('Date'));
     $from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[from]", General::sanitize($data['from_value']));
     $label->appendChild($from);
     $group->appendChild($label);
     // To:
     $label = Widget::Label(__('Until Date'));
     $from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[to]", General::sanitize($data['to_value']));
     $label->appendChild($from);
     $group->appendChild($label);
     // Mode:
     $options = array(array('entire-day', false, 'Entire Day'), array('entire-week', false, 'Entire Week'), array('entire-month', false, 'Entire Month'), array('entire-year', false, 'Entire Year'), array('until-date', false, 'Until Date'));
     foreach ($options as &$option) {
         if ($option[0] != $data['mode']) {
             continue;
         }
         $option[1] = true;
         break;
     }
     $label = Widget::Label(__('Mode'));
     $from = Widget::Select("fields{$prefix}[{$element_name}]{$postfix}[mode]", $options);
     $label->appendChild($from);
     $group->appendChild($label);
     $container->appendChild($group);
     $wrapper->appendChild($container);
 }
 public function view()
 {
     $emergency = false;
     if (isset($this->_context[0]) && in_array(strlen($this->_context[0]), array(6, 8))) {
         if (!$this->__loginFromToken($this->_context[0])) {
             if (Administration::instance()->isLoggedIn()) {
                 redirect(SYMPHONY_URL);
             }
         }
     }
     $this->Form = Widget::Form(SYMPHONY_URL . '/login/', 'post');
     $this->Form->setAttribute('class', 'frame');
     $this->Form->appendChild(new XMLElement('h1', __('Symphony')));
     $fieldset = new XMLElement('fieldset');
     if ($this->_context[0] == 'retrieve-password') {
         $this->Form->setAttribute('action', SYMPHONY_URL . '/login/retrieve-password/');
         if (isset($this->_email_sent) && $this->_email_sent) {
             $fieldset->appendChild(new XMLElement('p', __('An email containing a customised login link has been sent. It will expire in 2 hours.')));
             $this->Form->appendChild($fieldset);
         } else {
             $fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote login link with further instructions for logging in.')));
             $label = Widget::Label(__('Email Address'));
             $label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus' => 'autofocus')));
             if (isset($this->_email_sent) && !$this->_email_sent) {
                 $label = Widget::Error($label, __('There was a problem locating your account. Please check that you are using the correct email address.'));
             }
             $fieldset->appendChild($label);
             $this->Form->appendChild($fieldset);
             $div = new XMLElement('div', NULL, array('class' => 'actions'));
             $div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[reset]', 'type' => 'submit')));
             $this->Form->appendChild($div);
         }
     } else {
         $fieldset->appendChild(new XMLElement('legend', __('Login')));
         $label = Widget::Label(__('Username'));
         $username = Widget::Input('username', $_POST['username']);
         if (!$this->_invalidPassword) {
             $username->setAttribute('autofocus', 'autofocus');
         }
         $label->appendChild($username);
         if (isset($_POST['action'], $_POST['action']['login']) && empty($_POST['username'])) {
             $username->setAttribute('autofocus', 'autofocus');
             $label = Widget::Error($label, __('No username was entered.'));
         }
         $fieldset->appendChild($label);
         $label = Widget::Label(__('Password'));
         $password = Widget::Input('password', NULL, 'password');
         $label->appendChild($password);
         if ($this->_invalidPassword) {
             $password->setAttribute('autofocus', 'autofocus');
             $label = Widget::Error($label, __('The supplied password was rejected.') . ' <br /><a href="' . SYMPHONY_URL . '/login/retrieve-password/">' . __('Retrieve password?') . '</a>');
         }
         $fieldset->appendChild($label);
         $this->Form->appendChild($fieldset);
         $div = new XMLElement('div', NULL, array('class' => 'actions'));
         $div->appendChild(new XMLElement('button', __('Login'), array('name' => 'action[login]', 'type' => 'submit', 'accesskey' => 's')));
         $this->Form->appendChild($div);
     }
     $this->Body->appendChild($this->Form);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $label = Widget::Label($this->get('label'));
     $text = new XMLElement('div', $data['value']);
     $wrapper->appendChild($label);
     $wrapper->appendChild($text);
 }
 public static function buildEditor(XMLElement $wrapper, array &$errors = array(), array $settings = null, $handle = null)
 {
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/section_schemas/assets/section_schemas.datasource.js', 100);
     if (is_null($settings[self::getClass()]['fields'])) {
         $settings[self::getClass()]['fields'] = array();
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings contextual ' . __CLASS__);
     $fieldset->setAttribute('data-context', General::createHandle(self::getName()));
     $fieldset->appendChild(new XMLElement('legend', self::getName()));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'two columns');
     $options = array();
     $sections = SectionManager::fetch();
     foreach ($sections as $section) {
         $options[] = array($section->get('handle'), $settings[self::getClass()]['section'] == $section->get('handle'), $section->get('name'));
     }
     $label = Widget::Label(__('Section'));
     $label->setAttribute('class', 'column');
     $label->appendChild(Widget::Select('fields[' . self::getClass() . '][section]', $options));
     $group->appendChild($label);
     foreach ($sections as $section) {
         $fields = $section->fetchFields();
         $options = array();
         foreach ($fields as $field) {
             $options[] = array($field->get('element_name'), in_array($field->get('element_name'), $settings[self::getClass()]['fields']), $field->get('label') . ' (' . $field->get('type') . ')');
         }
         $label = Widget::Label(__('Fields'));
         $label->setAttribute('class', 'column fields fields-for-' . $section->get('handle'));
         $label->appendChild(Widget::Select('fields[' . self::getClass() . '][fields][]', $options, array('multiple' => 'multiple')));
         $group->appendChild($label);
     }
     $fieldset->appendChild($group);
     $wrapper->appendChild($fieldset);
 }
 /**
  * Append maintenance mode preferences
  *
  * @param array $context
  *  delegate context
  */
 public function appendPreferences($context)
 {
     // Create preference group
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Maintenance Mode')));
     // Append settings
     $label = Widget::Label();
     $input = Widget::Input('settings[maintenance_mode][enabled]', 'yes', 'checkbox');
     if (Symphony::Configuration()->get('enabled', 'maintenance_mode') === 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' ' . __('Enable maintenance mode'));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of <code>maintenance</code>'), array('class' => 'help')));
     // IP White list
     $label = Widget::Label(__('IP Whitelist'));
     $label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode')));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help')));
     // Append new preference group
     $context['wrapper']->appendChild($group);
 }
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = General::sanitize($data['video_id']);
     $label = Widget::Label($this->get('label'));
     $video_id = new XMLElement('input');
     $video_id->setAttribute('type', 'text');
     $video_id->setAttribute('name', 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix);
     $video_id->setAttribute('value', $value);
     if ($this->get('required') != 'yes') {
         $label->appendChild(new XMLElement('i', __('Optional')));
     }
     if (strlen($value) == 11 && is_null($flagWithError)) {
         $video_id->setAttribute('class', 'hidden');
         $video_container = new XMLElement('span');
         $video_container->appendChild(self::createPlayer($value));
         $description = new XMLElement('div');
         $description->setAttribute('class', 'description');
         $description->setValue($data['title'] . ' by <a href="' . $data['user_url'] . '" target="blank">' . $data['user_name'] . '</a> (' . $data['views'] . ' views)');
         $change = new XMLElement('a', 'Remove Video');
         $change->setAttribute('class', 'change');
         $description->appendChild($change);
         $video_container->appendChild($description);
         $label->appendChild($video_container);
     }
     $label->appendChild($video_id);
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
Exemple #8
0
 /**
  * Add site preferences
  */
 public function __addPreferences($context)
 {
     // Get selected languages
     $selection = Symphony::Configuration()->get('datetime');
     if (empty($selection)) {
         $selection = array();
     }
     // Build default options
     $options = array();
     foreach ($this->languages as $name => $codes) {
         $options[$name] = array($name . '::' . $codes, array_key_exists($name, $selection) ? true : false, __(ucfirst($name)));
     }
     // Add custom options
     foreach (array_diff_key($selection, $this->languages) as $name => $codes) {
         $options[$name] = array($name . '::' . $codes, true, __(ucfirst($name)));
     }
     // Sort options
     ksort($options);
     // Add fieldset
     $group = new XMLElement('fieldset', '<legend>' . __('Date and Time') . '</legend>', array('class' => 'settings'));
     $select = Widget::Select('settings[datetime][]', $options, array('multiple' => 'multiple'));
     $label = Widget::Label('Languages included in the Date and Time Data Source', $select);
     $group->appendChild($label);
     $help = new XMLElement('p', __('You can add more languages in you configuration file.'), array('class' => 'help'));
     $group->appendChild($help);
     $context['wrapper']->appendChild($group);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null, $entry_id = null)
 {
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $classes = array();
     $label = Widget::Label($this->get('label'));
     $message = new XMLElement('span');
     switch ($data['handle']) {
         case 'none':
         case 'completed':
             return;
             break;
         case 'failed':
             $value = __('Video failed to upload.');
             break;
         case 'queued':
             $value = __('Video is waiting in queue.');
             break;
         case 'encoding':
             $value = __('Video is being encoded.');
             break;
         case 'uploading':
             $value = __('Video is being uploaded.');
             break;
     }
     if (isset($value)) {
         $message->setValue($value);
         $label->appendChild($message);
         $wrapper->appendChild($label);
     }
 }
 public function addGuideBelowTextArea($context)
 {
     //only show guide when using markdown
     $formatter = $context['field']->get('formatter');
     $pattern = '/^markdown/';
     if (!preg_match($pattern, $formatter)) {
         return;
     }
     //append the textarea here so the guide will show after the textarea in the form
     $context['label']->appendChild($context['textarea']);
     //nullify the textarea to prevent another one being appended in field.textarea.php
     $context['textarea'] = Widget::Label('');
     //retrieve the guide and append it
     switch ($formatter) {
         case 'markdown':
             $file = EXTENSIONS . '/markdown_guide/assets/markdown.php';
             break;
         case 'markdown_extra':
             $file = EXTENSIONS . '/markdown_guide/assets/markdown_extra.php';
             break;
         case 'markdown_extra_with_smartypants':
             $file = EXTENSIONS . '/markdown_guide/assets/markdown_extra_with_smartypants.php';
             break;
         case 'markdown_with_purifier':
             $file = EXTENSIONS . '/markdown_guide/assets/markdown_with_purifier.php';
             break;
     }
     include $file;
     foreach ($description as $line) {
         $contents .= "<strong>{$line[0]}:</strong> {$line[1]}<br />";
     }
     $guide = Widget::Label($contents, null, 'markdown_guide');
     $context['label']->appendChild($guide);
 }
Exemple #11
0
 /**
  * Append maintenance mode preferences
  *
  * @param array $context
  *  delegate context
  */
 public function appendPreferences($context)
 {
     // Create preference group
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Maintenance Mode')));
     // Append settings
     $label = Widget::Label();
     $input = Widget::Input('settings[maintenance_mode][enabled]', 'yes', 'checkbox');
     if (Symphony::Configuration()->get('enabled', 'maintenance_mode') === 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' ' . __('Enable maintenance mode'));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of <code>maintenance</code>'), array('class' => 'help')));
     // IP White list
     $label = Widget::Label(__('IP Whitelist'));
     $label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode')));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help')));
     // Useragent White list
     $label = Widget::Label(__('Useragent Whitelist'));
     $whitelist = json_decode(Symphony::Configuration()->get('useragent_whitelist', 'maintenance_mode'));
     if (is_array($whitelist) && !empty($whitelist)) {
         $useragent = implode("\r\n", $whitelist);
     }
     $label->appendChild(Widget::Textarea('settings[maintenance_mode][useragent_whitelist]', 5, 50, $useragent));
     $group->appendChild($label);
     // Append help
     $group->appendChild(new XMLElement('p', __('Any useragent that listed above will be granted access. This eliminates the need to allow a user backend access, useful when third party services need to access your site prior to launch. Insert in json array format eg ["useragent1","useragent2"].'), array('class' => 'help')));
     // Append new preference group
     $context['wrapper']->appendChild($group);
 }
 public function dashboardPanelOptions($context)
 {
     if ($context['type'] != 'piwik') {
         return;
     }
     $config = $context['existing_config'];
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Piwik')));
     $label = Widget::Label(__('Module'));
     $select = Widget::Select('config[module]', $this->getModuleOptions(isset($config['module']) ? $config['module'] : null));
     $label->appendChild($select);
     $fieldset->appendChild($label);
     $input = Widget::Input('config[columns]', isset($config['columns']) ? $config['columns'] : null);
     $input->setAttribute('type', 'number');
     $input->setAttribute('size', '3');
     $label = Widget::Label(__('Show the first %s columns in table.', array($input->generate())));
     $fieldset->appendChild($label);
     $input = Widget::Input('config[entries]', isset($config['entries']) ? $config['entries'] : null);
     $input->setAttribute('type', 'number');
     $input->setAttribute('size', '3');
     $label = Widget::Label(__('Show the first %s entries in table.', array($input->generate())));
     $fieldset->appendChild($label);
     $context['form'] = $fieldset;
 }
 public function __viewIndex()
 {
     $this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Section Schema data sources');
     $this->appendSubheading('Section Schema data sources');
     $container = new XMLElement('fieldset');
     $container->setAttribute('class', 'settings');
     $container->appendChild(new XMLElement('legend', 'Sections'));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'group');
     $sm = new SectionManager($this->_Parent);
     $sections = $sm->fetch();
     $options = array();
     $dsm = new DatasourceManager($this->_Parent);
     $datasources = $dsm->listAll();
     foreach ($sections as $section) {
         $selected = in_array('section_schema_' . str_replace('-', '_', $section->_data['handle']), array_keys($datasources));
         $options[] = array($section->_data['handle'], $selected, $section->_data['name']);
     }
     $section = Widget::Label('Create data sources for these sections:');
     $section->appendChild(Widget::Select('sections[]', $options, array('multiple' => 'multiple')));
     $group->appendChild($section);
     $container->appendChild($group);
     $this->Form->appendChild($container);
     //---------------------------------------------------------------------
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
     $this->Form->appendChild($div);
 }
 private function __buildFormContent()
 {
     $fieldset = new XMLElement('fieldset');
     // email was not send
     // or first time here (email_sent == NULL)
     if ($this->_email_sent !== true) {
         $fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote unban link with further instructions.')));
         $label = Widget::Label(__('Email Address'));
         $label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus', 'autofocus')));
     }
     if (isset($this->_email_sent)) {
         if ($this->_email_sent) {
             $div = new XMLElement('div', __('Email sent. Follow the instruction in it.'));
             $fieldset->appendChild($div);
         } else {
             $div = new XMLElement('div', NULL, array('class' => 'invalid'));
             $div->appendChild($label);
             $div->appendChild(new XMLElement('p', __('There was a problem locating your account. Please check that you are using the correct email address.')));
             $fieldset->appendChild($div);
         }
     } else {
         $fieldset->appendChild($label);
     }
     $this->Form->appendChild($fieldset);
     if ($this->_email_sent !== true) {
         $div = new XMLElement('div', NULL, array('class' => 'actions'));
         $div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[send-email]', 'type' => 'submit')));
         $this->Form->appendChild($div);
     }
 }
Exemple #15
0
 function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     $note = isset($data['value']) ? $data['value'] : $this->get('note');
     $editable = $this->get('editable');
     # Add <div>
     $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
     $wrapper->appendChild($div);
     # Editable
     if (isset($editable) && $editable) {
         $wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
         $edit = new XMLElement("a", __("Edit note"), array("class" => "publishnotes-edit", "href" => "#edit"));
         $wrapper->appendChild($edit);
         # Add <textarea>
         $label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
         $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, 50, strlen($note) != 0 ? General::sanitize($note) : NULL);
         $label->appendChild($textarea);
         $control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
         $label->appendChild($control);
         if ($flagWithError != NULL) {
             $wrapper->appendChild(Widget::Error($label, $flagWithError));
         } else {
             $wrapper->appendChild($label);
         }
     }
 }
 function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $label = Widget::Label(__('URL Expression'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][url_expression]', $this->get('url_expression')));
     $wrapper->appendChild($label);
 }
 public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     // Check 'mode' exists; otherwise set manually from 'editable'
     $mode = $this->get('mode');
     if (!$mode) {
         if ($this->get('editable') == 'yes') {
             $mode = 'normal';
         } else {
             $mode = 'hidden';
         }
     }
     // Render the field only if it's not hidden
     if ($mode != 'hidden') {
         $name = $this->get('element_name');
         $edited_local = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $data['local']);
         $current_local = DateTimeObj::get(__SYM_DATETIME_FORMAT__, null);
         $label = Widget::Label($this->get('label'));
         if ($mode == 'disabled') {
             $input = Widget::Input("{$name}-display", $edited_local);
             $input->setAttribute('disabled', 'disabled');
         } else {
             $note = new XMLElement('i', __('Previous value: %s', array($edited_local)));
             $label->appendChild($note);
             $input = Widget::Input("fields{$fieldnamePrefix}[{$name}]", $current_local);
         }
         $label->appendChild($input);
         $label->setAttribute('class', 'date');
         if (!is_null($flagWithError)) {
             $label = Widget::Error($label, $error);
         }
         $wrapper->appendChild($label);
     }
 }
 public function ttf_form(&$form, &$page)
 {
     $p = new XMLElement('p', __('Wrap patterns with slashes, e.g., "/pattern_here/". You can use backreferences in replacement. Syntax for pattern and replacement is exactly the same as in <a href="http://www.php.net/manual/en/function.preg-replace.php" target="_blank">preg_replace()</a> PHP function.'));
     $p->setAttribute('class', 'help');
     $form->appendChild($p);
     $subsection = new XMLElement('div');
     $subsection->setAttribute('class', 'frame templatedtextformatter-duplicator');
     $ol = new XMLElement('ol');
     $ol->setAttribute('data-add', __('Add regex'));
     $ol->setAttribute('data-remove', __('Remove regex'));
     $temp = $this->_patterns;
     $temp[''] = '';
     foreach ($temp as $pattern => $replacement) {
         $li = new XMLElement('li');
         $li->setAttribute('class', $pattern ? 'field-regex' : 'template field-regex');
         $li->setAttribute('data-type', 'regex');
         $header = new XMLElement('header');
         $header->appendChild(new XMLElement('h4', '<strong>' . __('Replace') . '</strong> <span class="type">' . __('regex') . '</span>'));
         $li->appendChild($header);
         $div = new XMLElement('div');
         $div->setAttribute('class', 'two columns');
         $label = Widget::Label(__('Find with pattern'));
         $label->setAttribute('class', 'column');
         $label->appendChild(Widget::Input('fields[patterns][]', htmlentities($pattern, ENT_QUOTES, 'UTF-8')));
         $div->appendChild($label);
         $label = Widget::Label(__('Replace with'));
         $label->setAttribute('class', 'column');
         $label->appendChild(Widget::Input('fields[replacements][]', htmlentities($replacement, ENT_QUOTES, 'UTF-8')));
         $div->appendChild($label);
         $li->appendChild($div);
         $ol->appendChild($li);
     }
     $subsection->appendChild($ol);
     $form->appendChild($subsection);
 }
 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'PayPal Payments'));
     # Add Merchant Email field
     $label = Widget::Label('Merchant Email/Account ID');
     $label->appendChild(Widget::Input('settings[paypal-payments][business]', General::Sanitize($this->_get_paypal_business())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'The merchant email address or account ID of the payment recipient.', array('class' => 'help')));
     # Country <select>
     $countries = array('Australia', 'United Kingdom', 'United States');
     $selected_country = $this->_get_country();
     foreach ($countries as $country) {
         $selected = $country == $selected_country ? TRUE : FALSE;
         $options[] = array($country, $selected);
     }
     $label = Widget::Label();
     $select = Widget::Select('settings[paypal-payments][country]', $options);
     $label->setValue('PayPal Country' . $select->generate());
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Country you want to target.', array('class' => 'help')));
     # Sandbox
     $label = Widget::Label();
     $input = Widget::Input('settings[paypal-payments][sandbox]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('sandbox', 'paypal-payments') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Enable testing mode');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Directs payments to PayPal’s Sandbox: <code>http://www.sandbox.paypal.com/</code>', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     $wrapper->appendChild(new XMLElement('h4', ucwords($this->name())));
     $wrapper->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][type]', $this->handle(), 'hidden'));
     if ($this->get('id')) {
         $wrapper->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][id]', $this->get('id'), 'hidden'));
     }
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Label (fixed)'));
     $label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][label]', 'Entry Versions', null, array('readonly' => 'readonly')));
     if (isset($errors['label'])) {
         $div->appendChild(Widget::wrapFormElementWithError($label, $errors['label']));
     } else {
         $div->appendChild($label);
     }
     $div->appendChild($this->buildLocationSelect($this->get('location'), 'fields[' . $this->get('sortorder') . '][location]'));
     $wrapper->appendChild($div);
     $order = $this->get('sortorder');
     $label = Widget::Label();
     $input = Widget::Input("fields[{$order}][hide_in_publish]", 'yes', 'checkbox');
     if ($this->get('show_in_publish') == 'no') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Hide version history list on publish page');
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
 }
 public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
 {
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $right = $layout->createColumn(Layout::LARGE);
     //	Essentials --------------------------------------------------------
     $fieldset = Widget::Fieldset(__('Essentials'));
     // Name:
     $label = Widget::Label(__('Name'));
     $input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
     $label->appendChild($input);
     if (isset($errors->{'about::name'})) {
         $label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
     }
     $fieldset->appendChild($label);
     $left->appendChild($fieldset);
     $fieldset = Widget::Fieldset(__('Content'));
     $label = Widget::Label(__('Source XML'));
     $input = Widget::Textarea('fields[xml]', $this->parameters()->{'xml'}, array('rows' => '24', 'cols' => '50', 'class' => 'code'));
     $label->appendChild($input);
     if (isset($errors->{'xml'})) {
         $label = Widget::wrapFormElementWithError($label, $errors->{'xml'});
     }
     $fieldset->appendChild($label);
     $right->appendChild($fieldset);
     $layout->appendTo($wrapper);
 }
 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'CacheLite'));
     # Add Site Reference field
     $label = Widget::Label('Cache Period');
     $label->appendChild(Widget::Input('settings[cachelite][lifetime]', General::Sanitize($this->_get_lifetime())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Length of cache period in seconds.', array('class' => 'help')));
     $label = Widget::Label('Excluded URLs');
     $label->appendChild(Widget::Textarea('cachelite[excluded-pages]', 10, 50, $this->_get_excluded_pages()));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Add a line for each URL you want to be excluded from the cache. Add a <code>*</code> to the end of the URL for wildcard matches.', array('class' => 'help')));
     $label = Widget::Label();
     $input = Widget::Input('settings[cachelite][show-comments]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('show-comments', 'cachelite') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Show comments in page source?');
     $group->appendChild($label);
     $label = Widget::Label();
     $input = Widget::Input('settings[cachelite][backend-delegates]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('backend-delegates', 'cachelite') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Expire cache when entries are created/updated through the backend?');
     $group->appendChild($label);
     $context['wrapper']->appendChild($group);
 }
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $sectionManager = new SectionManager($this->_engine);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $options = array();
     // iterate over sections to build list of fields
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $section) {
             $section_fields = $section->fetchFields();
             if (!is_array($section_fields)) {
                 continue;
             }
             $fields = array();
             foreach ($section_fields as $f) {
                 // only show select box link fields
                 if ($f->get('type') == 'selectbox_link') {
                     $fields[] = array($f->get('id'), $this->get('related_sbl_id') == $f->get('id'), $f->get('label'));
                 }
             }
             if (!empty($fields)) {
                 $options[] = array('label' => $section->get('name'), 'options' => $fields);
             }
         }
     }
     $group = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label(__('Child Select Box Link'));
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_sbl_id]', $options));
     if (isset($errors['related_sbl_id'])) {
         $group->appendChild(Widget::wrapFormElementWithError($label, $errors['related_sbl_id']));
     } else {
         $group->appendChild($label);
     }
     $wrapper->appendChild($group);
 }
 public function displayDatasourceFilterPanel(&$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $wrapper->appendChild(new XMLElement('h4', $this->get('label') . ' <i>' . $this->Name() . '</i>'));
     $label = Widget::Label('Value');
     $label->appendChild(Widget::Input('fields[filter]' . ($fieldnamePrefix ? '[' . $fieldnamePrefix . ']' : '') . '[' . $this->get('id') . ']' . ($fieldnamePostfix ? '[' . $fieldnamePostfix . ']' : ''), $data ? General::sanitize($data) : NULL));
     $wrapper->appendChild($label);
     $wrapper->appendChild(new XMLElement('p', 'To filter by ranges, add <code>mysql:</code> to the beginning of the filter input. Use <code>value</code> for field name. E.G. <code>mysql: value &gt;= 1.01 AND value &lt;= {$price}</code>', array('class' => 'help')));
 }
Exemple #25
0
 public function displayDatasourceFilterPanel(&$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $wrapper->appendChild(new XMLElement('h4', $this->get('label') . ' <i>' . $this->Name() . '</i>'));
     $label = Widget::Label('Value');
     $label->appendChild(Widget::Input('fields[filter]' . ($fieldnamePrefix ? '[' . $fieldnamePrefix . ']' : '') . '[' . $this->get('id') . ']' . ($fieldnamePostfix ? '[' . $fieldnamePostfix . ']' : ''), $data ? General::sanitize($data) : NULL));
     $wrapper->appendChild($label);
     $wrapper->appendChild(new XMLElement('p', 'Accepts either a 32 character hash, or plain text value. If plain text, it will be hashed before comparing.', array('class' => 'help')));
 }
 public function addCustomPreferenceFieldsets($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Can Of Spam Filter'));
     $uniqueID = Widget::Label('Unique ID');
     $uniqueID->appendChild(Widget::Input('settings[canofspam][uniqueid]', General::Sanitize($this->getUniqueID())));
     $group->appendChild($uniqueID);
     $context['wrapper']->appendChild($group);
 }
 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     $order = $this->get('sortorder');
     $label = Widget::Label(__('Point <code>@links</code> to'));
     $label->appendChild(Widget::Select("fields[{$order}][linked_field_id]", $this->findOptions()));
     if (isset($errors['linked_field_id'])) {
         $label = Widget::wrapFormElementWithError($label, $errors['linked_field_id']);
     }
     parent::displaySettingsPanel($wrapper, $errors, null, $label);
 }
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'JIT Image Manipulation'));
     $label = Widget::Label('Trusted Sites');
     $label->appendChild(Widget::Textarea('jit_image_manipulation[trusted_external_sites]', 10, 50, $this->trusted()));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Leave empty to disable external linking. Single rule per line. Add * at end for wild card matching.', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $label = Widget::Label($this->get('label'));
     $name = $this->get('element_name');
     $input = Widget::Input("fields{$prefix}[{$name}]{$postfix}", strlen($data['value']) != 0 ? General::sanitize($data['value']) : null);
     $label->appendChild($input);
     if ($error != null) {
         $label = Widget::wrapFormElementWithError($label, $error);
     }
     $wrapper->appendChild($label);
 }
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Admin Rainbow Headline'));
     $label = Widget::Label('Headline Background Color');
     $label->appendChild(Widget::Input('settings[admin_rainbow_headline][headline_color]', General::Sanitize(Administration::instance()->Configuration->get('headline_color', 'admin_rainbow_headline'))));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'This can be any RGB-Hexvalue, for example <code>#97712B</code>', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }