本文整理汇总了PHP中Widget::Textarea方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Textarea方法的具体用法?PHP Widget::Textarea怎么用?PHP Widget::Textarea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::Textarea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
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);
}
示例2: view
public function view()
{
$this->setTitle(__('Symphony – Indecent Filter'));
$this->setPageType('form');
$this->Form->setAttribute('enctype', 'multipart/form-data');
$this->appendSubheading(__('Indecent Filter'));
$words = extension_indecent::processFilterList(true);
// Word List
$container = new XMLElement('fieldset');
$container->setAttribute('class', 'settings');
$container->appendChild(new XMLElement('legend', __('Word Blacklist')));
$p = new XMLElement('p', __('Enter each of the terms on a new line.'), array('class' => 'help'));
$container->appendChild($p);
// Add last saved timestamp
if (!empty($words)) {
$p->setValue($p->getValue() . '<br / >' . __('Last updated: %s', array(extension_indecent::lastUpdateFilterList())));
}
$container->appendChild(Widget::Textarea('fields[words]', 30, 30, $words));
$this->Form->appendChild($container);
// Actions
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', 'Save', 'submit', array('accesskey' => 's')));
$this->Form->appendChild($div);
}
示例3: appendPreferences
/**
* 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);
}
示例4: append_preferences
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);
}
示例5: displaySettingsPanel
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);
}
示例6: appendPreferences
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);
}
示例7: appendPreferences
/**
* Append preferences to the preferences page
*
* @param $context
* The context
*/
public function appendPreferences($context)
{
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', __('Force Download')));
$label = Widget::Label(__('Trusted Locations'));
$locations = implode("\n", $this->getLocations());
$label->appendChild(Widget::Textarea('force_download[trusted_locations]', 5, 50, $locations));
$group->appendChild($label);
$group->appendChild(new XMLElement('p', __('Relative from the root. Single path per line. Add * at end for wild card matching.'), array('class' => 'help')));
$context['wrapper']->appendChild($group);
}
示例8: displaySettingsPanel
public function displaySettingsPanel(XMLElement &$wrapper, $errors = null)
{
parent::displaySettingsPanel($wrapper, $errors);
$order = $this->get('sortorder');
# Value: Note
$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);
# Setting: Editable
$div = new XMLElement('div', NULL, array('class' => 'compact'));
$setting = new XMLElement('label', '<input name="fields[' . $order . '][editable]" value="1" type="checkbox"' . ($this->get('editable') == 0 ? '' : ' checked="checked"') . '/> ' . __('Allow note to be edited?'));
$div->appendChild($setting);
$wrapper->appendChild($div);
}
示例9: addCustomPreferenceFieldsets
public function addCustomPreferenceFieldsets($context)
{
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', 'New Visiter'));
$message = Widget::Label('Message');
$message->appendChild(Widget::Textarea('settings[newvisiter][message]', '5', '25', General::Sanitize($this->getMessage())));
$group->appendChild($message);
$thresholds = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$options = array();
foreach ($thresholds as $t) {
$options[] = array($t, $t == $this->_Parent->Configuration->get('threshold', 'newvisiter'), $t);
}
$threshold = Widget::Label('Threshold');
$threshold->appendChild(Widget::Select('settings[newvisiter][threshold]', $options));
$group->appendChild($threshold);
$context['wrapper']->appendChild($group);
}
示例10: displaySettingsPanel
public function displaySettingsPanel(XMLElement &$wrapper, $errors = NULL)
{
parent::displaySettingsPanel($wrapper, $errors);
// Disable/Enable publish filtering
$label = Widget::Label(__('Expression'));
$label->appendChild(new XMLElement('i', __('Optional')));
$input = Widget::Textarea('fields[' . $this->get('sortorder') . '][expression]', 6, 50, General::sanitize(stripslashes($this->get('expression'))), array('class' => 'code'));
$label->appendChild($input);
if (isset($errors['expression'])) {
$wrapper->appendChild(Widget::Error($label, $errors['expression']));
} else {
$wrapper->appendChild($label);
}
$wrapper->appendChild(new XMLElement('p', __('Default value of this field will be set to <code>yes</code>. If expression above will evaluate to <code>false</code>, value of this field will be set to <code>no</code>. Use <code>{XPath}</code> syntax to put values into expression before it will be evaluated, e.g., to make use of a value posted from HTML element called "<code>fields[published]</code>" enter "<code>{/data/post/published}</code>".'), array('class' => 'help')));
// Disable/Enable publish error when evaluated expression returns false
$label = Widget::Label();
$input = Widget::Input('fields[' . $this->get('sortorder') . '][show_errors]', 'yes', 'checkbox');
if ($this->get('show_errors') == 'yes') {
$input->setAttribute('checked', 'checked');
}
$label->setValue(__('%s Show error when expression entered above evaluates to <code>false</code>', array($input->generate())));
$wrapper->appendChild($label);
}
示例11: __viewEdit
public function __viewEdit()
{
$this->addStylesheetToHead(URL . '/extensions/search_index/assets/search_index.css', 'screen', 100);
// $this->addScriptToHead(URL . '/extensions/search_index/assets/search_index.js', 101);
$this->setPageType('form');
$this->setTitle(__('Symphony') . ' – ' . __('Search Indexes'));
$subheading = !empty($this->_synonym['word']) ? $this->_synonym['word'] : __('Untitled');
$this->appendSubheading($subheading);
$this->insertBreadcrumbs(array(Widget::Anchor(__('Synonyms'), $this->_uri . '/synonyms/')));
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Replacement word')));
$p = new XMLElement('p', __('Matching synonyms will be replaced with this word.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$label = Widget::Label(__('Word'));
$label->appendChild(Widget::Input('synonym[word]', $this->_synonym['word']));
$fieldset->appendChild($label);
$fieldset->appendChild(new XMLElement('p', __('e.g. United Kingdom'), array('class' => 'help')));
$this->Form->appendChild($fieldset);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Synonyms')));
$p = new XMLElement('p', __('These words will be replaced with the word above. Separate multiple words with commas.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$label = Widget::Label(__('Synonyms'));
$label->appendChild(Widget::Textarea('synonym[synonyms]', 5, 40, $this->_synonym['synonyms']));
$fieldset->appendChild($label);
$fieldset->appendChild(new XMLElement('p', __('e.g. UK, Great Britain, GB'), array('class' => 'help')));
$this->Form->appendChild(new XMLElement('input', NULL, array('type' => 'hidden', 'name' => 'synonym[hash]', 'value' => $this->_hash)));
$this->Form->appendChild($fieldset);
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
$this->Form->appendChild($div);
}
示例12: __form
//.........这里部分代码省略.........
$label = Widget::Label(__('Parent Page'));
$options = array(array('', false, '/'));
if (is_array($pages) and !empty($pages)) {
if (!function_exists('__compare_pages')) {
function __compare_pages($a, $b)
{
return strnatcasecmp($a[2], $b[2]);
}
}
foreach ($pages as $page) {
$options[] = array($page['id'], $fields['parent'] == $page['id'], '/' . $this->_Parent->resolvePagePath($page['id']));
}
usort($options, '__compare_pages');
}
$label->appendChild(Widget::Select('fields[parent]', $options));
$group->appendChild($label);
$label = Widget::Label(__('URL Handle'));
$label->appendChild(Widget::Input('fields[handle]', $fields['handle']));
$group->appendChild(isset($this->_errors['handle']) ? $this->wrapFormElementWithError($label, $this->_errors['handle']) : $label);
$label = Widget::Label(__('URL Parameters'));
$label->appendChild(Widget::Input('fields[params]', $fields['params']));
$group->appendChild($label);
$div->appendChild($group);
$div->appendChild(new XMLElement('h3', __('Page Metadata')));
$group = new XMLElement('div');
$group->setAttribute('class', 'triple group');
$label = Widget::Label(__('Events'));
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$options = array();
if (is_array($events) && !empty($events)) {
foreach ($events as $name => $about) {
$options[] = array($name, @in_array($name, $fields['events']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$label = Widget::Label(__('Data Sources'));
$DSManager = new DatasourceManager($this->_Parent);
$datasources = $DSManager->listAll();
$options = array();
if (is_array($datasources) && !empty($datasources)) {
foreach ($datasources as $name => $about) {
$options[] = array($name, @in_array($name, $fields['data_sources']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[data_sources][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$div3 = new XMLElement('div');
$label = Widget::Label(__('Page Type'));
$label->appendChild(Widget::Input('fields[type]', $fields['type']));
$div3->appendChild(isset($this->_errors['type']) ? $this->wrapFormElementWithError($label, $this->_errors['type']) : $label);
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
if ($types = $this->__fetchAvailablePageTypes()) {
foreach ($types as $type) {
$ul->appendChild(new XMLElement('li', $type));
}
}
$div3->appendChild($ul);
$group->appendChild($div3);
$div->appendChild($group);
$this->Form->appendChild($div);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'primary');
$label = Widget::Label(__('Title'));
$label->appendChild(Widget::Input('fields[title]', General::sanitize($fields['title'])));
$fieldset->appendChild(isset($this->_errors['title']) ? $this->wrapFormElementWithError($label, $this->_errors['title']) : $label);
$label = Widget::Label(__('Body'));
$label->appendChild(Widget::Textarea('fields[body]', '25', '50', General::sanitize($fields['body']), array('class' => 'code')));
$fieldset->appendChild(isset($this->_errors['body']) ? $this->wrapFormElementWithError($label, $this->_errors['body']) : $label);
$this->Form->appendChild($fieldset);
$utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
$utilities = $utilities['filelist'];
if (is_array($utilities) && !empty($utilities)) {
$div = new XMLElement('div');
$div->setAttribute('class', 'secondary');
$h3 = new XMLElement('h3', __('Utilities'));
$h3->setAttribute('class', 'label');
$div->appendChild($h3);
$ul = new XMLElement('ul');
$ul->setAttribute('id', 'utilities');
foreach ($utilities as $util) {
$li = new XMLElement('li');
$li->appendChild(Widget::Anchor($util, URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/', NULL));
$ul->appendChild($li);
}
$div->appendChild($ul);
$this->Form->appendChild($div);
}
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create Page'), 'submit', array('accesskey' => 's')));
if ($this->_context[0] == 'edit') {
$button = new XMLElement('button', __('Delete'));
$button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this page')));
$div->appendChild($button);
}
$this->Form->appendChild($div);
}
示例13: __form
//.........这里部分代码省略.........
$prefix = '$ds-' . (isset($this->_context[1]) ? Lang::createHandle($fields['name']) : __('untitled')) . '.';
$options = array(array('label' => __('Authors'), 'data-label' => 'authors', 'options' => array()));
foreach (array('id', 'username', 'name', 'email', 'user_type') as $p) {
$options[0]['options'][] = array($p, $fields['source'] == 'authors' && in_array($p, $fields['param']), $prefix . $p, null, null, array('data-handle' => $p));
}
foreach ($field_groups as $section_id => $section_data) {
$optgroup = array('label' => $section_data['section']->get('name'), 'data-label' => 'section-' . $section_data['section']->get('id'), 'options' => array());
foreach (array('id', 'creation-date', 'modification-date', 'author') as $p) {
$option = array('system:' . $p, $fields['source'] == $section_id && in_array('system:' . $p, $fields['param']), $prefix . 'system-' . $p, null, null, array('data-handle' => 'system-' . $p));
// Handle 'system:date' as an output paramater (backwards compatibility)
if ($p === 'creation-date') {
if ($fields['source'] == $section_id && in_array('system:date', $fields['param'])) {
$option[1] = true;
}
}
$optgroup['options'][] = $option;
}
if (is_array($section_data['fields']) && !empty($section_data['fields'])) {
foreach ($section_data['fields'] as $input) {
if (!$input->allowDatasourceParamOutput()) {
continue;
}
$optgroup['options'][] = array($input->get('element_name'), $fields['source'] == $section_id && in_array($input->get('element_name'), $fields['param']), $prefix . $input->get('element_name'), null, null, array('data-handle' => $input->get('element_name')));
}
}
$options[] = $optgroup;
}
$label->appendChild(Widget::Select('fields[param][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
$fieldset->appendChild($group);
// Associations
$label = Widget::Checkbox('fields[associated_entry_counts]', $fields['associated_entry_counts'], __('Include a count of entries in associated sections'));
$this->setContext($label, array('sections'));
$fieldset->appendChild($label);
// Encoding
$label = Widget::Checkbox('fields[html_encode]', $fields['html_encode'], __('HTML-encode text'));
$this->setContext($label, array('sections'));
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
// Static XML
if (!isset($fields['static_xml'])) {
$fields['static_xml'] = null;
}
$fieldset = new XMLElement('fieldset');
$this->setContext($fieldset, array('static-xml'));
$fieldset->appendChild(new XMLElement('legend', __('Static XML')));
$p = new XMLElement('p', __('Enter valid XML, exclude XML declaration'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$label = Widget::Label();
$label->appendChild(Widget::Textarea('fields[static_xml]', 12, 50, General::sanitize(stripslashes($fields['static_xml'])), array('class' => 'code', 'placeholder' => '<static>content</static>')));
if (isset($this->_errors['static_xml'])) {
$fieldset->appendChild(Widget::Error($label, $this->_errors['static_xml']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
// Connections
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Attach to Pages')));
$p = new XMLElement('p', __('The data will only be available on the selected pages.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$div = new XMLElement('div');
$label = Widget::Label(__('Pages'));
$pages = PageManager::fetch();
$ds_handle = str_replace('-', '_', Lang::createHandle($fields['name']));
$connections = ResourceManager::getAttachedPages(ResourceManager::RESOURCE_TYPE_DS, $ds_handle);
$selected = array();
foreach ($connections as $connection) {
$selected[] = $connection['id'];
}
$options = array();
foreach ($pages as $page) {
$options[] = array($page['id'], in_array($page['id'], $selected), PageManager::resolvePageTitle($page['id']));
}
$label->appendChild(Widget::Select('fields[connections][]', $options, array('multiple' => 'multiple')));
$div->appendChild($label);
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
// Call the provided datasources to let them inject their filters
// @todo Ideally when a new Datasource is chosen an AJAX request will fire
// to get the HTML from the extension. This is hardcoded for now into
// creating a 'big' page and then hiding the fields with JS
if (!empty($providers)) {
foreach ($providers as $providerClass => $provider) {
call_user_func_array(array($providerClass, 'buildEditor'), array($this->Form, &$this->_errors, $fields, $handle));
}
}
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Data Source'), 'submit', array('accesskey' => 's')));
if ($isEditing) {
$button = new XMLElement('button', __('Delete'));
$button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this data source'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this data source?')));
$div->appendChild($button);
}
$this->Form->appendChild($div);
}
示例14: getExampleFormMarkup
public function getExampleFormMarkup()
{
$label = Widget::Label($this->get('label'));
$label->appendChild(Widget::Textarea('fields[' . $this->get('element_name') . ']', $this->get('size'), 50));
return $label;
}
示例15: __form
//.........这里部分代码省略.........
$label->appendChild(Widget::Select('fields[xml_elements][]', $options, array('multiple' => 'multiple', 'class' => 'filtered')));
$li->appendChild($label);
$label = Widget::Label();
$label->setAttribute('class', 'contextual inverse ' . __('authors'));
$input = Widget::Input('fields[html_encode]', 'yes', 'checkbox', isset($fields['html_encode']) ? array('checked' => 'checked') : NULL);
$label->setValue(__('%s HTML-encode text', array($input->generate(false))));
$li->appendChild($label);
$ul->appendChild($li);
$fieldset->appendChild($ul);
$this->Form->appendChild($fieldset);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings contextual ' . __('dynamic_xml'));
$fieldset->appendChild(new XMLElement('legend', __('Dynamic XML')));
$label = Widget::Label(__('URL'));
$label->appendChild(Widget::Input('fields[dynamic_xml][url]', General::sanitize($fields['dynamic_xml']['url'])));
if (isset($this->_errors['dynamic_xml']['url'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['dynamic_xml']['url']));
} else {
$fieldset->appendChild($label);
}
$p = new XMLElement('p', __('Use <code>{$param}</code> syntax to specify dynamic portions of the URL.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$div = new XMLElement('div');
$div->setAttribute('class', 'subsection');
$div->appendChild(new XMLElement('h3', __('Namespace Declarations <i>Optional</i>')));
$ol = new XMLElement('ol');
if (is_array($fields['dynamic_xml']['namespace']['name'])) {
$namespaces = $fields['dynamic_xml']['namespace']['name'];
$uri = $fields['dynamic_xml']['namespace']['uri'];
for ($ii = 0; $ii < count($namespaces); $ii++) {
$li = new XMLElement('li');
$li->appendChild(new XMLElement('h4', 'Namespace'));
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[dynamic_xml][namespace][name][]', General::sanitize($namespaces[$ii])));
$group->appendChild($label);
$label = Widget::Label(__('URI'));
$label->appendChild(Widget::Input('fields[dynamic_xml][namespace][uri][]', General::sanitize($uri[$ii])));
$group->appendChild($label);
$li->appendChild($group);
$ol->appendChild($li);
}
}
$li = new XMLElement('li');
$li->setAttribute('class', 'template');
$li->appendChild(new XMLElement('h4', __('Namespace')));
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[dynamic_xml][namespace][name][]'));
$group->appendChild($label);
$label = Widget::Label(__('URI'));
$label->appendChild(Widget::Input('fields[dynamic_xml][namespace][uri][]'));
$group->appendChild($label);
$li->appendChild($group);
$ol->appendChild($li);
$div->appendChild($ol);
$fieldset->appendChild($div);
$label = Widget::Label(__('Included Elements'));
$label->appendChild(Widget::Input('fields[dynamic_xml][xpath]', General::sanitize($fields['dynamic_xml']['xpath'])));
if (isset($this->_errors['dynamic_xml']['xpath'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['dynamic_xml']['xpath']));
} else {
$fieldset->appendChild($label);
}
$p = new XMLElement('p', __('Use an XPath expression to select which elements from the source XML to include.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$label = Widget::Label();
$input = Widget::Input('fields[dynamic_xml][cache]', max(1, intval($fields['dynamic_xml']['cache'])), NULL, array('size' => '6'));
$label->setValue('Update cached result every ' . $input->generate(false) . ' minutes');
if (isset($this->_errors['dynamic_xml']['cache'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['dynamic_xml']['cache']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings contextual ' . __('static_xml'));
$fieldset->appendChild(new XMLElement('legend', __('Static XML')));
$label = Widget::Label(__('Body'));
$label->appendChild(Widget::Textarea('fields[static_xml]', 12, 50, General::sanitize($fields['static_xml']), array('class' => 'code')));
if (isset($this->_errors['static_xml'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['static_xml']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Input('action[save]', $isEditing ? __('Save Changes') : __('Create Data Source'), 'submit', array('accesskey' => 's')));
if ($isEditing) {
$button = new XMLElement('button', 'Delete');
$button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this data source')));
$div->appendChild($button);
}
$this->Form->appendChild($div);
}