public function response()
 {
     $result = new XMLElement($this->_event_name);
     $post_values = new XMLElement('post-values');
     $fields = $_POST['fields'];
     if (!empty($fields)) {
         General::array_to_xml($post_values, $fields, true);
     }
     if (!empty($this->_error_array)) {
         $result->appendChild($post_values);
         $result->setAttribute('result', 'error');
         $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.')));
         foreach ($this->_error_array as $field => $message) {
             $type = $fields[$field] == '' ? 'missing' : 'invalid';
             $field = new XMLElement($field);
             $field->setAttribute('type', $type);
             $field->setAttribute('message', $message);
             $result->appendChild($field);
         }
     } else {
         $result->setAttribute('result', 'success');
         $result->appendChild(new XMLElement('message', __('Entry created successfully.')));
     }
     return $result;
 }
    public static function documentation()
    {
        // Fetch all the Email Templates available and add to the end of the documentation
        $templates = extension_Members::fetchEmailTemplates();
        $div = new XMLElement('div');
        if (!empty($templates)) {
            $label = new XMLElement('label', __('Regenerate Activation Code Email Template'));
            $regenerate_activation_code_templates = extension_Members::setActiveTemplate($templates, 'regenerate-activation-code-template');
            $label->appendChild(Widget::Select('members[regenerate-activation-code-template][]', $regenerate_activation_code_templates, array('multiple' => 'multiple')));
            $div->appendChild($label);
            $div->appendChild(Widget::Input('members[event]', 'reset-password', 'hidden'));
            $div->appendChild(Widget::Input(null, __('Save Changes'), 'submit', array('accesskey' => 's')));
        }
        return '
				<p>This event will regenerate an activation code for a user and is useful if their current
				activation code has expired. The activation code can be sent to a Member\'s email after
				this event has executed.</p>
				<h3>Example Front-end Form Markup</h3>
				<p>This is an example of the form markup you can use on your front end. An input field
				accepts either the member\'s email address or username.</p>
				<pre class="XML"><code>
				&lt;form method="post"&gt;
					&lt;label&gt;Username: &lt;input name="fields[username]" type="text" value="{$username}"/&gt;&lt;/label&gt;
					or
					&lt;label&gt;Email: &lt;input name="fields[email]" type="text" value="{$email}"/&gt;&lt;/label&gt;
					&lt;input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Regenerate Activation Code"/&gt;
					&lt;input type="hidden" name="redirect" value="{$root}/"/&gt;
				&lt;/form&gt;
				</code></pre>
				<h3>More Information</h3>
				<p>For further information about this event, including response and error XML, please refer to the
				<a href="https://github.com/symphonycms/members/wiki/Members%3A-Regenerate-Activation-Code">wiki</a>.</p>
				' . $div->generate() . '
			';
    }
 public function execute(&$param_pool)
 {
     $result = new XMLElement($this->dsParamROOTELEMENT);
     $type_sql = $parent_sql = null;
     if (trim($this->dsParamFILTERS['type']) != '') {
         $type_sql = $this->__processNavigationTypeFilter($this->dsParamFILTERS['type'], $this->__determineFilterType($this->dsParamFILTERS['type']));
     }
     if (trim($this->dsParamFILTERS['parent']) != '') {
         $parent_sql = $this->__processNavigationParentFilter($this->dsParamFILTERS['parent']);
     }
     // Build the Query appending the Parent and/or Type WHERE clauses
     $pages = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\tSELECT DISTINCT p.id, p.title, p.handle, (SELECT COUNT(id) FROM `tbl_pages` WHERE parent = p.id) AS children\n\t\t\t\t\tFROM `tbl_pages` AS p\n\t\t\t\t\tLEFT JOIN `tbl_pages_types` AS pt ON (p.id = pt.page_id)\n\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t%s\n\t\t\t\t\t%s\n\t\t\t\t\tORDER BY p.`sortorder` ASC\n\t\t\t\t", !is_null($parent_sql) ? $parent_sql : " AND p.parent IS NULL ", !is_null($type_sql) ? $type_sql : ""));
     if (!is_array($pages) || empty($pages)) {
         if ($this->dsParamREDIRECTONEMPTY == 'yes') {
             throw new FrontendPageNotFoundException();
         }
         $result->appendChild($this->__noRecordsFound());
     } else {
         // Build an array of all the types so that the page's don't have to do
         // individual lookups.
         $page_types = PageManager::fetchAllPagesPageTypes();
         foreach ($pages as $page) {
             $result->appendChild($this->__buildPageXML($page, $page_types));
         }
     }
     return $result;
 }
 public function appendPreferences($context)
 {
     $context['parent']->Page->addScriptToHead(URL . '/extensions/db_sync/assets/ui-logic.js', 666);
     if (isset($_POST['action']['db_sync_flush'])) {
         $this->__flushLog($context);
     }
     if (isset($_POST['action']['db_sync_download'])) {
         $this->__downloadSQL();
     }
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     // Sync flush
     $group->appendChild(new XMLElement('legend', 'DB Sync'));
     $div = new XMLElement('div', NULL, array('id' => 'file-actions', 'class' => 'label'));
     $span = new XMLElement('span');
     if (!extension_loaded('zlib')) {
         $span->appendChild(new XMLElement('p', '<strong>Warning: It appears you do not have the zlib extension available.'));
     } else {
         $span->appendChild(new XMLElement('button', 'Download SQL', array('name' => 'action[db_sync_download]', 'type' => 'submit')));
         $span->appendChild(new XMLElement('button', 'Flush Log', array('name' => 'action[db_sync_flush]', 'type' => 'submit')));
     }
     $div->appendChild($span);
     $div->appendChild(new XMLElement('p', 'Deletes current queries in the db sync log.', array('class' => 'help')));
     $group->appendChild($div);
     $context['wrapper']->appendChild($group);
 }
 public function appendPreferences($context)
 {
     if (isset($_POST['action']['download-zip'])) {
         if (class_exists('ZipArchive')) {
             $this->__downloadZip();
         } else {
             Administration::instance()->Page->pageAlert(__('Export Ensemble is not able to download ZIP archives, since the "<a href="http://php.net/manual/en/book.zip.php">ZipArchive</a>" class is not available. To enable ZIP downloads, compile PHP with the <code>--enable-zip</code> flag. Try saving your install files instead and follow the README instructions.'), Alert::ERROR);
         }
     }
     if (isset($_POST['action']['save-install-files'])) {
         $this->__saveInstallFiles();
     }
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Export Ensemble')));
     $div = new XMLElement('div', NULL, array('id' => 'file-actions', 'class' => 'label'));
     $span = new XMLElement('span', NULL, array('class' => 'frame'));
     $span->appendChild(new XMLElement('button', __('Save Install Files'), array('name' => 'action[save-install-files]', 'type' => 'submit')));
     if (!class_exists('ZipArchive')) {
         $no_zip_warning = ' <strong>' . __('Warning: It appears you do not have the "ZipArchive" class available. To enable ZIP download, ensure that PHP is compiled with <code>--enable-zip</code>') . '</strong>';
     } else {
         $span->appendChild(new XMLElement('button', __('Download ZIP'), array('name' => 'action[download-zip]', 'type' => 'submit')));
     }
     $div->appendChild($span);
     $div->appendChild(new XMLElement('p', __('Save (overwrite) install files or package entire site as a <code>.zip</code> archive for download.' . $no_zip_warning), array('class' => 'help')));
     $group->appendChild($div);
     $context['wrapper']->appendChild($group);
 }
 protected function decode(XMLElement &$result, array $json)
 {
     $result = new XMLElement($this->dsParamROOTELEMENT);
     $result->appendChild(new XMLElement('name', $json['name']));
     $result->appendChild(new XMLElement('version', $json['version']));
     return $result;
 }
Exemple #7
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 execute(array &$param_pool = null)
 {
     $result = new XMLElement('se-permissions');
     $result->appendChild($this->buildActions());
     $result->appendChild($this->buildLevels());
     return $result;
 }
 function notify($context)
 {
     var_dump($context);
     include_once TOOLKIT . '/class.gateway.php';
     $ch = new Gateway();
     $ch->init();
     $ch->setopt('URL', 'http://rpc.pingomatic.com/');
     $ch->setopt('POST', 1);
     $ch->setopt('CONTENTTYPE', 'text/xml');
     $ch->setopt('HTTPVERSION', '1.0');
     ##Create the XML request
     $xml = new XMLElement('methodCall');
     $xml->appendChild(new XMLElement('methodName', 'weblogUpdates.ping'));
     $params = new XMLElement('params');
     $param = new XMLElement('param');
     $param->appendChild(new XMLElement('value', $this->_Parent->Configuration->get('sitename', 'general')));
     $params->appendChild($param);
     $param = new XMLElement('param');
     $param->appendChild(new XMLElement('value', URL));
     $params->appendChild($param);
     $xml->appendChild($params);
     ####
     $ch->setopt('POSTFIELDS', $xml->generate(true, 0));
     //Attempt the ping
     $ch->exec(GATEWAY_FORCE_SOCKET);
 }
 public function view()
 {
     $this->setPageType('table');
     $this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create a new hub'), 'create button'));
     $aTableHead = array(array(__('Title'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col'));
     $aTableBody = array();
     $formatters = $this->_driver->listAll();
     if (!is_array($formatters) || empty($formatters)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $tfm = new TextformatterManager($this->_Parent);
         foreach ($formatters as $id => $data) {
             $formatter = $tfm->create($id);
             $about = $formatter->about();
             $td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name']));
             $td2 = Widget::TableData($about['templatedtextformatters-type']);
             $td3 = Widget::TableData($about['description']);
             $td1->appendChild(Widget::Input('items[' . $id . ']', NULL, 'checkbox'));
             // Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
 /**
  * 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 grab(&$param_pool)
 {
     $result = new XMLElement($this->dsParamROOTELEMENT);
     foreach ($this->_env as $key => $value) {
         switch ($key) {
             case 'param':
                 //$group = new XMLElement('params');
                 foreach ($this->_env[$key] as $key => $value) {
                     $param = new XMLElement($key, General::sanitize($value));
                     $result->appendChild($param);
                 }
                 //$result->appendChild($group);
                 break;
             case 'env':
                 //$group = new XMLElement('pool');
                 foreach ($this->_env[$key]['pool'] as $key => $value) {
                     $param = new XMLElement($key);
                     if (is_array($value)) {
                         $param->setAttribute('count', count($value));
                         foreach ($value as $key => $value) {
                             $item = new XMLElement('item', General::sanitize($value));
                             $item->setAttribute('handle', Lang::createHandle($value));
                             $param->appendChild($item);
                         }
                     } else {
                         $param->setValue(General::sanitize($value));
                     }
                     $result->appendChild($param);
                 }
                 //$result->appendChild($group);
                 break;
         }
     }
     return $result;
 }
 protected function __trigger()
 {
     $result = null;
     $actionName = $this->getActionName();
     $requestMethod = $this->getRequestMethod();
     $requestArray = $this->getRequestArray();
     if ($_SERVER['REQUEST_METHOD'] == $requestMethod && isset($requestArray[$actionName])) {
         $result = new XMLElement($actionName);
         $r = new XMLElement('result');
         $id = intval($_POST['id']);
         try {
             $this->validate();
             $entry = $this->createEntryFromPost($id);
             $this->visitEntry($entry);
             $r->setAttribute('success', 'yes');
             $r->setAttribute('id', $entry->get('id'));
         } catch (Exception $ex) {
             $xmlEx = new XMLElement('error');
             $showMsg = $ex instanceof InsertSectionException || Symphony::Engine()->isLoggedIn();
             $errorMessage = $showMsg ? $ex->getMessage() : __('A Fatal error occured');
             $xmlEx->setValue($errorMessage);
             $result->appendChild($xmlEx);
             $r->setAttribute('success', 'no');
             Symphony::Log()->pushExceptionToLog($ex, true);
         }
         $result->appendChild($r);
     } else {
         throw new FrontendPageNotFoundException();
     }
     return $result;
 }
 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);
 }
 function grab()
 {
     include_once EXTENSIONS . '/nested_cats/extension.driver.php';
     $driver = $this->_Parent->ExtensionManager->create('nested_cats');
     $xml = new XMLElement('nested-cats');
     $data = $driver->getTree('lft', 0);
     $right = array($data[0]['rgt']);
     array_shift($data);
     if (!$data) {
         $error = new XMLElement('error', 'No data received.');
         $xml->appendChild($error);
         return $xml;
     }
     foreach ($data as $d) {
         if (count($right) > 0) {
             while ($right[count($right) - 1] < $d['rgt']) {
                 array_pop($right);
             }
         }
         $item = new XMLElement('item', $d['title']);
         $item->setAttribute('id', $d['id']);
         $item->setAttribute('parent-id', $d['parent']);
         $item->setAttribute('level', count($right));
         $item->setAttribute('handle', $d['handle']);
         $xml->appendChild($item);
         $right[] = $d['rgt'];
     }
     return $xml;
 }
    public function __viewPCRE()
    {
        $this->setPageType('form');
        $this->setTitle("Symphony &ndash; SEO Manager &ndash; Help &ndash; Perl Compatible Regular Expressions");
        $this->appendSubheading("Perl Compatible Regular Expressions");
        // Documentation ------------------------------------------------------
        $fieldset = new XMLElement('fieldset');
        $fieldset->setAttribute('class', 'settings');
        $fieldset->appendChild(new XMLElement('legend', 'Documentation'));
        $fieldset->appendChild(new XMLElement('p', '
				Perl Compatible Regular Expressions, commonly known as PCRE,
				are a means for identifying strings of text of interest.
			'));
        $fieldset->appendChild(new XMLElement('h3', 'Resources'));
        $list = new XMLElement('ul');
        $list->appendChild(new XMLElement('li', '
				<a href="http://www.regular-expressions.info/tutorial.html">Learn How to Use Regular Expressions</a>
			'));
        $list->appendChild(new XMLElement('li', '
				<a href="http://en.wikipedia.org/wiki/Pcre">PCRE on Wikipedia</a>
			'));
        $list->appendChild(new XMLElement('li', '
				<a href="http://au.php.net/manual/en/reference.pcre.pattern.syntax.php">A technical description of PCRE</a>
			'));
        $fieldset->appendChild($list);
        $this->Form->appendChild($fieldset);
    }
 public function buildContent($wrapper)
 {
     $this->addStylesheetToHead(URL . '/extensions/profiledevkit/assets/devkit.css', 'screen', 9126343);
     $table = new XMLElement('table');
     $table->setAttribute('id', $this->_view);
     if ($this->_view == 'render-statistics') {
         $xml_generation = $this->_profiler->retrieveByMessage('XML Generation');
         $xsl_transformation = $this->_profiler->retrieveByMessage('XSLT Transformation');
         $event_total = 0;
         foreach ($this->_records['events'] as $data) {
             $event_total += $data[1];
         }
         $ds_total = 0;
         foreach ($this->_records['data-sources'] as $data) {
             $ds_total += $data[1];
         }
         $this->_records = array(array(__('Total Database Queries'), $this->_dbstats['queries'], NULL, NULL, false), array(__('Slow Queries (> 0.09s)'), count($this->_dbstats['slow-queries']), NULL, NULL, false), array(__('Total Time Spent on Queries'), $this->_dbstats['total-query-time']), array(__('Time Triggering All Events'), $event_total), array(__('Time Running All Data Sources'), $ds_total), array(__('XML Generation Function'), $xml_generation[1]), array(__('XSLT Generation'), $xsl_transformation[1]), array(__('Output Creation Time'), $this->_profiler->retrieveTotalRunningTime()), array(__('Total Memory Usage'), General::formatFilesize($this->_profiler->retrieveTotalMemoryUsage()), NULL, NULL, false));
         foreach ($this->_records as $data) {
             $row = new XMLElement('tr');
             $row->appendChild(new XMLElement('th', $data[0]));
             $row->appendChild(new XMLElement('td', $data[1] . (isset($data[4]) && $data[4] == false ? '' : ' s')));
             $table->appendChild($row);
         }
     } elseif ($this->_view == 'memory-usage') {
         $items = $this->_profiler->retrieve();
         $base = $items[0][5];
         $total = 0;
         $last = 0;
         foreach ($items as $index => $item) {
             $row = new XMLElement('tr');
             $row->appendChild(new XMLElement('th', $item[0]));
             $row->appendChild(new XMLElement('td', General::formatFilesize(max(0, $item[5] - $base - $last))));
             $table->appendChild($row);
             $last = $item[5] - $base;
         }
     } else {
         if ($this->_records = $this->_records[$this->_view]) {
             $ds_total = 0;
             foreach ($this->_records as $data) {
                 $row = new XMLElement('tr');
                 $row->appendChild(new XMLElement('th', $data[0]));
                 if ($this->_view == 'general') {
                     $row->appendChild(new XMLElement('td', $data[1] . ' s'));
                 } else {
                     if ($this->_view == 'slow-queries') {
                         $row->appendChild(new XMLElement('td', $data[1] . (isset($data[4]) && $data[4] == false ? '' : ' s')));
                     } else {
                         $row->appendChild(new XMLElement('td', $data[1] . ' s from ' . $data[4] . ' ' . ($data[4] == 1 ? 'query' : 'queries')));
                     }
                 }
                 $ds_total += $data[1];
                 $table->appendChild($row);
             }
         }
     }
     $wrapper->appendChild($table);
 }
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     Field::displaySettingsPanel($wrapper, $errors);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label('Options');
     $sectionManager = new SectionManager($this->_engine);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'name');
     $field_groups = array();
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $section) {
             $field_groups[$section->get('id')] = array('fields' => $section->fetchFields(), 'section' => $section);
         }
     }
     $options = array();
     foreach ($field_groups as $group) {
         if (!is_array($group['fields'])) {
             continue;
         }
         $fields = array();
         foreach ($group['fields'] as $f) {
             if ($f->get('id') != $this->get('id') && $f->canPrePopulate() && !is_null($this->get('related_field_id'))) {
                 $fields[] = array($f->get('id'), in_array($f->get('id'), $this->get('related_field_id')), $f->get('label'));
             }
         }
         if (is_array($fields) && !empty($fields)) {
             $options[] = array('label' => $group['section']->get('name'), 'options' => $fields);
         }
     }
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_field_id][]', $options, array('multiple' => 'multiple')));
     $div->appendChild($label);
     // set field type
     $label = Widget::Label('Field Type');
     $type_options = array(array('select', $this->get('field_type') == 'select', 'Select Box'), array('autocomplete', $this->get('field_type') == 'autocomplete', 'Autocomplete Input'));
     $label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][field_type]', $type_options));
     $div->appendChild($label);
     // Allow selection of multiple items
     $label = Widget::Label();
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][allow_multiple_selection]', 'yes', 'checkbox');
     if ($this->get('allow_multiple_selection') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Allow selection of multiple options');
     $div->appendChild($label);
     if (isset($errors['related_field_id'])) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($div, $errors['related_field_id']));
     } else {
         $wrapper->appendChild($div);
     }
     ## Maximum entries
     $label = Widget::Label();
     $input = Widget::Input('fields[' . $this->get('sortorder') . '][limit]', $this->get('limit'));
     $input->setAttribute('size', '3');
     $label->setValue('Limit to the ' . $input->generate() . ' most recent entries');
     $wrapper->appendChild($label);
     $this->appendShowColumnCheckbox($wrapper);
     $this->appendRequiredCheckbox($wrapper);
 }
 public function view()
 {
     //Page options
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Campaign Monitor Subscribers'))));
     $this->appendSubheading(__('Campaign Monitor Subscribers'));
     //Form action
     $this->Form->setAttribute('action', $this->_Parent->getCurrentPageURL());
     //Get Campaign Monitor preferences
     $api_key = $this->_Parent->Configuration->get('api_key', 'campaign_monitor');
     $list_id = $this->_Parent->Configuration->get('list_id', 'campaign_monitor');
     //New Campaign Monitor instance
     $cm = new CampaignMonitor($api_key);
     //Get subscriber list
     $result = $cm->subscribersGetActive(0, $list_id);
     $subscribers = $result['anyType']['Subscriber'];
     //Subscriber table headers
     $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Date Subscribed'), 'col'), array(__('Status'), 'col'));
     $aTableBody = array();
     if (!is_array($subscribers) || empty($subscribers)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('You currently have no subscribers.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         if (is_array($subscribers[0])) {
             //Check if the subscriber list is longer than one, in which case it's an array of arrays
             foreach ($subscribers as $subscriber) {
                 $td1 = Widget::TableData($subscriber["Name"]);
                 $td2 = Widget::TableData($subscriber["EmailAddress"]);
                 $td2->appendChild(Widget::Input('items[' . $subscriber["EmailAddress"] . ']', 'on', 'checkbox'));
                 $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscriber["Date"])));
                 $td4 = Widget::TableData($subscriber["State"]);
                 //Add table data to row and body
                 $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
             }
         } else {
             //Single subscriber
             $td1 = Widget::TableData($subscribers["Name"]);
             $td2 = Widget::TableData($subscribers["EmailAddress"]);
             $td2->appendChild(Widget::Input('items[' . $subscribers["EmailAddress"] . ']', 'on', 'checkbox'));
             $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscribers["Date"])));
             $td4 = Widget::TableData($subscribers["State"]);
             //Add table data to row and body
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable');
     //Append the subscriber table to the page
     $this->Form->appendChild($table);
     //Actions for this page
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('unsubscribe', false, __('Unsubscribe')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     //Append actions to the page
     $this->Form->appendChild($tableActions);
 }
Exemple #20
0
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Version'));
     $useragent = $this->_Parent->Configuration->get('useragent', 'general');
     $label = new XMLElement('label', $useragent);
     $group->appendChild($label);
     $context['wrapper']->appendChild($group);
 }
 public function displaySettingsPanel(&$wrapper, $errors = NULL)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $order = $this->get('sortorder');
     # Panel
     $label = new XMLElement("label", "Note");
     $label->appendChild(new XMLElement("i", "The raw output will be shown on the 'Publish' screen", array("class" => "help")));
     $label->appendChild(Widget::Textarea("fields[{$order}][note]", 5, 40, $this->get('note')));
     $wrapper->appendChild($label);
 }
 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);
 }
Exemple #23
0
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Site Name')));
     $sitename = Symphony::Configuration()->get('sitename', 'general');
     $label = new XMLElement('label', __('Website Name'));
     $label->appendChild(Widget::Input('settings[general][sitename]', htmlspecialchars($sitename), 'text'));
     $group->appendChild($label);
     $context['wrapper']->appendChild($group);
 }
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Akismet Spam Filtering'));
     $label = Widget::Label('Wordpress API Key');
     $label->appendChild(Widget::Input('settings[akismet][api-key]', General::Sanitize($this->getWordpressApiKey())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Get a Wordpress API key from the <a href="http://wordpress.com/api-keys/">Wordpress site</a>.', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Map Location Field'));
     $label = Widget::Label('Google Maps API Key');
     $label->appendChild(Widget::Input('settings[map-location-field][google-api-key]', General::Sanitize($context['parent']->Configuration->get('google-api-key', 'map-location-field'))));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Get a Google Maps API key from the <a href="http://code.google.com/apis/maps/index.html">Google Maps site</a>.', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Site Name'));
     $sitename = $this->_Parent->Configuration->get('sitename', 'general');
     $label = new XMLElement('label', 'Website Name');
     $label->appendChild(Widget::Input('settings[general][sitename]', $sitename, 'text'));
     $group->appendChild($label);
     $context['wrapper']->appendChild($group);
 }
 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 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);
 }
 public function appendPreferences($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Language Redirect')));
     $label = Widget::Label(__('Language codes'));
     $label->appendChild(Widget::Input('settings[language_redirect][language_codes]', General::Sanitize(Symphony::Configuration()->get('language_codes', 'language_redirect'))));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', __('Comma separated list of supported language codes. First language ist the default language. Leave empty to disable <code>.htaccess</code>-rules.'), array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
 /**
  * Set options on Preferences page.
  *
  * @param array $context
  */
 public function dAddCustomPreferenceFieldsets($context)
 {
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Multilingual Upload Field')));
     $label = Widget::Label(__('Consolidate entry data'));
     $label->appendChild(Widget::Input('settings[multilingual_upload][consolidate]', 'yes', 'checkbox', array('checked' => 'checked')));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', __('Check this field if you want to consolidate database by <b>keeping</b> entry values of removed/old Language Driver language codes. Entry values of current language codes will not be affected.'), array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }