本文整理汇总了PHP中XMLElement::appendChild方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLElement::appendChild方法的具体用法?PHP XMLElement::appendChild怎么用?PHP XMLElement::appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLElement
的用法示例。
在下文中一共展示了XMLElement::appendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response
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;
}
示例2: documentation
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>
<form method="post">
<label>Username: <input name="fields[username]" type="text" value="{$username}"/></label>
or
<label>Email: <input name="fields[email]" type="text" value="{$email}"/></label>
<input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Regenerate Activation Code"/>
<input type="hidden" name="redirect" value="{$root}/"/>
</form>
</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() . '
';
}
示例3: execute
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;
}
示例4: appendPreferences
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);
}
示例5: appendPreferences
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);
}
示例6: decode
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;
}
示例7: __addPreferences
/**
* 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);
}
示例8: execute
public function execute(array &$param_pool = null)
{
$result = new XMLElement('se-permissions');
$result->appendChild($this->buildActions());
$result->appendChild($this->buildLevels());
return $result;
}
示例9: notify
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);
}
示例10: view
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);
}
示例11: 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);
}
示例12: grab
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;
}
示例13: __trigger
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;
}
示例14: 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);
}
示例15: grab
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;
}