本文整理汇总了PHP中XMLElement::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLElement::setValue方法的具体用法?PHP XMLElement::setValue怎么用?PHP XMLElement::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLElement
的用法示例。
在下文中一共展示了XMLElement::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appendFormattedElement
public function appendFormattedElement(&$wrapper, $data, $encode = false, $mode = null)
{
$element = new XMLElement($this->get('element_name'));
$element->setAttribute('hash', @dechex($data['value']));
$element->setValue(@$data['value'] ? $data['value'] : '0');
$wrapper->appendChild($element);
}
示例2: generateShowCreated
/**
* Appends the show_created input.
*
* @param XMLElement $wrapper
*/
public function generateShowCreated(XMLElement &$wrapper)
{
$div = new XMLElement('span', null, array('class' => 'hide-others'));
$input = Widget::Input('show_created', null, 'checkbox');
$div->setValue(__('%s hide others', array($input->generate())));
$wrapper->appendChild($div);
}
示例3: grab
public function grab(&$param_pool)
{
self::__init();
$result = new XMLElement($this->dsParamROOTELEMENT);
$rows = Symphony::Database()->fetch("SELECT *\n\t\t\t\tFROM `tbl_sessions` \n\t\t\t\tWHERE `session_data` != 'sym-|a:0:{}sym-members|a:0:{}' \n\t\t\t\tAND `session_data` REGEXP 'sym-members'\n\t\t\t\tAND `session_expires` > (UNIX_TIMESTAMP() - " . self::AGE . ") \n\t\t\t\tORDER BY `session_expires` DESC");
$added = array();
if (count($rows) > 0) {
foreach ($rows as $r) {
$raw = $r['session_data'];
$data = self::session_real_decode($raw);
if (!isset($data['sym-members'])) {
continue;
}
$record = ASDCLoader::instance()->query(sprintf("SELECT\n\t\t\t\t\t\t\t\temail.value AS `email`,\n\t\t\t\t\t\t\t\tMD5(email.value) AS `hash`,\n\t\t\t\t\t\t\t\tcreated_by.username AS `username`\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tFROM `tbl_entries_data_%d` AS `created_by`\n\t\t\t\t\t\t\tLEFT JOIN `tbl_entries_data_%d` AS `email` ON created_by.member_id = email.entry_id\n\t\t\t\t\t\t\tWHERE `created_by`.username = '%s'\n\t\t\t\t\t\t\tLIMIT 1", self::findFieldID('created-by', 'comments'), self::findFieldID('email-address', 'members'), ASDCLoader::instance()->escape($data['sym-members']['username'])));
if ($record->length() == 0) {
continue;
}
$member = $record->current();
// This is so we dont end up with accidental duplicates. No way to select
// distinct via the SQL since we grab raw session data
if (in_array($member->username, $added)) {
continue;
}
$added[] = $member->username;
$result->appendChild(new XMLElement('member', General::sanitize($member->username), array('email-hash' => $member->hash)));
}
} else {
$result->setValue('No Records Found.');
//This should never happen!
}
return $result;
}
示例4: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null, $entry_id = null)
{
$sortorder = $this->get('sortorder');
$element_name = $this->get('element_name');
$classes = array();
$label = Widget::Label($this->get('label'));
$message = new XMLElement('span');
switch ($data['handle']) {
case 'none':
case 'completed':
return;
break;
case 'failed':
$value = __('Video failed to upload.');
break;
case 'queued':
$value = __('Video is waiting in queue.');
break;
case 'encoding':
$value = __('Video is being encoded.');
break;
case 'uploading':
$value = __('Video is being uploaded.');
break;
}
if (isset($value)) {
$message->setValue($value);
$label->appendChild($message);
$wrapper->appendChild($label);
}
}
示例5: 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;
}
示例6: __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;
}
示例7: AddElementToFooter
public function AddElementToFooter($context)
{
$ul =& $context['wrapper'];
$li = new XMLElement('li');
$li->setValue("<a href=\"http://symphony-cms.com/\">Symphony CMS Version <strong>" . Administration::instance()->Configuration->get('version', 'symphony') . "</strong></a>");
$ul->prependChild($li);
}
示例8: transform
public function transform($data)
{
$txtElement = new XMLElement('data');
$txtElement->setValue(General::wrapInCDATA($data));
$data = $txtElement->generate();
return $data;
}
示例9: prepareTableValue
public function prepareTableValue($data, XMLElement $link = NULL)
{
$value = $data['value'];
if ($link) {
$link->setValue($value);
return $link->generate();
} else {
return $value;
}
}
示例10: displayPublishPanel
function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
if ($this->get('show_in_publish') == 'no') {
return;
}
$callback = Administration::instance()->getPageCallback();
$entry_id = $callback['context']['entry_id'];
$viewing_version = $_GET['version'];
$container = new XMLElement('div', null, array('class' => 'container'));
if (!$entry_id) {
$container->appendChild(new XMLElement('p', 'Version 1 will be created when you save.'));
$wrapper->appendChild($container);
return;
}
$label = new XMLElement('label');
$minor_edit_attributes = array('checked' => 'checked');
if (isset($viewing_version)) {
$minor_edit_attributes = array('disabled' => 'disabled', 'checked' => 'checked');
}
$input = Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 'yes', 'checkbox', $minor_edit_attributes);
$label->setValue($input->generate(false) . ' Create new version (major edit)');
if (isset($viewing_version)) {
$label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 'yes', 'hidden'));
}
$revision_history = new XMLElement('ol');
$revision_history->setAttribute('class', 'revisions');
$i = 0;
$entries = EntryVersionsManager::entryHistory($entry_id);
foreach ($entries as $entry) {
$meta = $entry->documentElement;
$href = '/symphony' . $callback['pageroot'] . $callback['context']['page'] . '/' . $entry_id;
if ($i != 0) {
$href .= '/?version=' . $meta->getAttribute('version');
}
$dom_revision = new XMLElement('a', 'Version ' . $meta->getAttribute('version'), array('href' => $href));
$timestamp = strtotime($meta->getAttribute('created-date') . ' ' . $meta->getAttribute('created-time'));
$dom_created = new XMLElement('span', 'on ' . DateTimeObj::get(__SYM_DATE_FORMAT__, $timestamp) . ' ' . DateTimeObj::get(__SYM_TIME_FORMAT__, $timestamp), array('class' => 'date'));
$dom_author = new XMLElement('span', 'by ' . $meta->getAttribute('created-by'), array('class' => 'author'));
$dom_li = new XMLElement('li');
if (!isset($viewing_version) && $i == 0) {
$dom_li->setAttribute('class', 'viewing');
}
if (isset($viewing_version) && (int) $viewing_version == (int) $meta->getAttribute('version')) {
$dom_li->setAttribute('class', 'viewing');
}
$dom_li->appendChild($dom_revision);
$dom_li->appendChild($dom_author);
$dom_li->appendChild($dom_created);
$revision_history->appendChild($dom_li);
$i++;
}
$container->appendChild($label);
$container->appendChild($revision_history);
$wrapper->appendChild($container);
}
示例11: displaySettingsPanel
public function displaySettingsPanel(XMLElement &$wrapper, $errors = null)
{
parent::displaySettingsPanel($wrapper, $errors);
$label = new XMLElement('label');
$input = Widget::Input("fields[{$this->get('sortorder')}][override]", 'yes', 'checkbox');
if ($this->get('override') == 'yes') {
$input->setAttribute('checked', 'checked');
}
$label->setValue(__('%s Allow overriding of upload directory in entries', array($input->generate())));
$wrapper->appendChild($label);
}
示例12: grab
public function grab(&$param_pool)
{
$result = new XMLElement($this->dsParamROOTELEMENT);
$driver = Frontend::instance()->ExtensionManager->create('iplocation_lookup');
$location = extension_IPLocation_Lookup::lookup();
if (is_null($location)) {
$result->appendChild(new XMLElement('error', 'unknown location'));
} else {
$result->setValue($location);
}
return $result;
}
示例13: 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)) {
//Template
$label = new XMLElement('label', __('Reset Password Email Template'));
$reset_password_templates = extension_Members::setActiveTemplate($templates, 'reset-password-template');
$label->appendChild(Widget::Select('members[reset-password-template][]', $reset_password_templates, array('multiple' => 'multiple')));
$div->appendChild($label);
}
// Auto Login
$div->appendChild(Widget::Input("members[auto-login]", 'no', 'hidden'));
$label = new XMLElement('label');
$input = Widget::Input("members[auto-login]", 'yes', 'checkbox');
if (extension_Members::getSetting('reset-password-auto-login') == 'yes') {
$input->setAttribute('checked', 'checked');
}
$label->setValue(__('%s Automatically log the member in after changing their password', array($input->generate())));
$div->appendChild($label);
$div->appendChild(Widget::Input('members[event]', 'reset-password', 'hidden'));
$div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
return '
<p>This event requires the user to enter their recovery code and then their new password. Should the recovery code
be correct and the new password validate, the member\'s password will be changed to their new password.</p><p>
A recovery code is available by including the
Member: Password field in a data source on the same page as this event, or by using
the event\'s result.</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 the member\'s recovery code, either the member\'s email address or username and two password
fields (one for password, one to confirm) will allow the member to change their password.</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>
<label>Recovery Code: <input name="fields[password][recovery-code]" type="text" value="{$code}"/></label>
<label>Password: <input name="fields[password][password]" type="password" /></label>
<label>Confirm Password: <input name="fields[password][confirm]" type="password" /></label>
<input type="hidden" name="members-section-id" value="{$your-section-id}"/>
<input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Recover Account"/>
<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-Reset-Password">wiki</a>.</p>
' . $div->generate() . '
';
}
示例14: view
public function view()
{
// Determine which formatter to use
// The textarea keeps this info in its class attribute, but sometimes there might be additional classes.
// We'll grab one that matches the installed formatters.
$fM = new TextformatterManager($this);
$formatter_handle = array_pop(array_intersect(array_keys($fM->listAll()), explode(' ', $_POST['formatter'])));
// We pass the full formatter name back for use in the preview display
$format_name = new XMLElement('formatter');
$preview = new XMLElement('preview');
if (empty($formatter_handle)) {
$format_name->setValue('None');
$preview->setValue($_POST['formatText']);
} else {
$formatter = $fM->create($formatter_handle);
$formatter_about = $formatter->about();
$format_name->setValue($formatter_about['name']);
$preview->setValue($formatter->run($_POST['formatText']));
}
$this->_Result->appendChild($format_name);
$this->_Result->appendChild($preview);
}
示例15: grab
function grab(&$param_pool)
{
$xml = new XMLElement($this->dsParamROOTELEMENT);
$discussion_id = (int) $this->dsParamFILTERS['discussion-id'];
$comment_id = $this->_Parent->Database->fetchVar('entry_id', 0, "SELECT `entry_id` FROM `tbl_entries_data_18` WHERE `relation_id` = {$discussion_id} ORDER BY `entry_id` ASC LIMIT 1");
$xml->setAttribute('comment-id', $comment_id);
$xml->setAttribute('discussion-id', $discussion_id);
$body = $this->_Parent->Database->fetchVar('value', 0, "SELECT `value` FROM `tbl_entries_data_17` WHERE `entry_id` = {$comment_id} LIMIT 1");
if (is_null($body) || strlen(trim($body)) == 0) {
return $this->emptyXMLSet();
}
$xml->setValue(General::sanitize($body));
return $xml;
}