本文整理汇总了PHP中Widget::Input方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Input方法的具体用法?PHP Widget::Input怎么用?PHP Widget::Input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::Input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: displaySettingsPanel
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);
}
示例3: displaySettingsPanel
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'));
$label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][label]', $this->get('label'), null));
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 entry page'));
$wrapper->appendChild($label);
$this->appendShowColumnCheckbox($wrapper);
}
示例4: ttf_form
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);
}
示例5: 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')));
// Append new preference group
$context['wrapper']->appendChild($group);
}
示例6: displaySettingsPanel
function displaySettingsPanel(&$wrapper, $errors = NULL)
{
Field::displaySettingsPanel($wrapper, $errors);
$div = new XMLElement('div', NULL, array('class' => 'group'));
$ignore = array('/workspace/events', '/workspace/data-sources', '/workspace/text-formatters', '/workspace/pages', '/workspace/utilities');
$directories = General::listDirStructure(WORKSPACE, NULL, 'asc', DOCROOT, $ignore);
$label = Widget::Label(__('Destination Directory'));
$options = array();
$options[] = array('/workspace', false, '/workspace');
if (!empty($directories) && is_array($directories)) {
foreach ($directories as $d) {
$d = '/' . trim($d, '/');
if (!in_array($d, $ignore)) {
$options[] = array($d, $this->get('destination') == $d, $d);
}
}
}
$label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][destination]', $options));
if (isset($errors['destination'])) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $errors['destination']));
} else {
$wrapper->appendChild($label);
}
$this->appendRequiredCheckbox($wrapper);
$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(__('%s Allow selection of multiple options', array($input->generate())));
$wrapper->appendChild($label);
$this->appendShowColumnCheckbox($wrapper);
}
示例7: displayPublishPanel
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);
}
示例8: appendEventFilterDocumentation
public function appendEventFilterDocumentation(array $context)
{
if (in_array('validate-xsrf', $context['selected'])) {
$context['documentation'][] = new XMLElement('p', __('To validate a XSRF token, ensure it is passed in the form.'));
$context['documentation'][] = contentAjaxEventDocumentation::processDocumentationCode(Widget::Input('xsrf', '{$cookie-xsrf-token}', 'hidden'));
}
}
示例9: cbAppendPreferences
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);
}
示例10: view
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);
}
示例11: 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);
}
示例12: view
public function view()
{
$this->appendSubheading(__('Preferences'));
$bIsWritable = true;
$formHasErrors = is_array($this->_errors) && !empty($this->_errors);
if (!is_writable(CONFIG)) {
$this->pageAlert(__('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.'), Alert::ERROR);
$bIsWritable = false;
} else {
if ($formHasErrors) {
$this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR);
} else {
if (isset($this->_context[0]) && $this->_context[0] == 'success') {
$this->pageAlert(__('Preferences saved.'), Alert::SUCCESS);
}
}
}
###
# Delegate: AddCustomPreferenceFieldsets
# Description: Add Extension custom preferences. Use the $wrapper reference to append objects.
$this->_Parent->ExtensionManager->notifyMembers('AddCustomPreferenceFieldsets', '/system/preferences/', array('wrapper' => &$this->Form));
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$attr = array('accesskey' => 's');
if (!$bIsWritable) {
$attr['disabled'] = 'disabled';
}
$div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', $attr));
$this->Form->appendChild($div);
}
示例13: 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);
}
示例14: dashboardPanelOptions
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;
}
示例15: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle('Symphony – Importers');
$tableHead = array(array('Name', 'col'), array('Version', 'col'), array('Author', 'col'));
$tableBody = array();
if (!is_array($this->_importers) or empty($this->_importers)) {
$tableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', null, count($tableHead)))));
} else {
foreach ($this->_importers as $importer) {
$importer = (object) $importer;
$col_name = Widget::TableData(Widget::Anchor($this->_driver->truncateValue($importer->name), $this->_uri . "/importers/edit/{$importer->handle}/"));
$col_name->appendChild(Widget::Input("items[{$importer->id}]", null, 'checkbox'));
$col_version = Widget::TableData($this->_driver->truncateValue($importer->version));
$col_author = Widget::TableData($this->_driver->truncateValue($importer->version));
if (isset($importer->author['website']) and preg_match('/^[^\\s:\\/?#]+:(?:\\/{2,3})?[^\\s.\\/?#]+(?:\\.[^\\s.\\/?#]+)*(?:\\/[^\\s?#]*\\??[^\\s?#]*(#[^\\s#]*)?)?$/', $importer->author['website'])) {
$col_author = Widget::Anchor($importer->author['name'], General::validateURL($importer->author['website']));
} elseif (isset($importer->author['email']) and preg_match('/^\\w(?:\\.?[\\w%+-]+)*@\\w(?:[\\w-]*\\.)+?[a-z]{2,}$/i', $importer->author['email'])) {
$col_author = Widget::Anchor($importer->author['name'], 'mailto:' . $importer->author['email']);
} else {
$col_author = $importer->author['name'];
}
$col_author = Widget::TableData($col_author);
$tableBody[] = Widget::TableRow(array($col_name, $col_version, $col_author));
}
}
$table = Widget::Table(Widget::TableHead($tableHead), null, Widget::TableBody($tableBody));
$this->Form->appendChild($table);
}