当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLElement类代码示例

本文整理汇总了PHP中XMLElement的典型用法代码示例。如果您正苦于以下问题:PHP XMLElement类的具体用法?PHP XMLElement怎么用?PHP XMLElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XMLElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:26,代码来源:extension.driver.php

示例2: __viewIndex

 public function __viewIndex()
 {
     $this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
     $this->setPageType('form');
     $this->setTitle('Symphony – Section Schema data sources');
     $this->appendSubheading('Section Schema data sources');
     $container = new XMLElement('fieldset');
     $container->setAttribute('class', 'settings');
     $container->appendChild(new XMLElement('legend', 'Sections'));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'group');
     $sm = new SectionManager($this->_Parent);
     $sections = $sm->fetch();
     $options = array();
     $dsm = new DatasourceManager($this->_Parent);
     $datasources = $dsm->listAll();
     foreach ($sections as $section) {
         $selected = in_array('section_schema_' . str_replace('-', '_', $section->_data['handle']), array_keys($datasources));
         $options[] = array($section->_data['handle'], $selected, $section->_data['name']);
     }
     $section = Widget::Label('Create data sources for these sections:');
     $section->appendChild(Widget::Select('sections[]', $options, array('multiple' => 'multiple')));
     $group->appendChild($section);
     $container->appendChild($group);
     $this->Form->appendChild($container);
     //---------------------------------------------------------------------
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
     $this->Form->appendChild($div);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:32,代码来源:content.list.php

示例3: __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);
 }
开发者ID:brendo,项目名称:datetime,代码行数:30,代码来源:extension.driver.php

示例4: trigger

 function trigger()
 {
     $username = $_POST['username'];
     $password = md5($_POST['password']);
     if (isset($_COOKIE[__SYM_COOKIE__]) && !isset($_POST['action']['login'])) {
         $args = unserialize(base64_decode($_COOKIE[__SYM_COOKIE_SAFE__]));
         $username = $args['username'];
         $password = $args['password'];
     }
     $sql = "SELECT *\n\t\t\t\t\tFROM `tbl_authors`\n\t\t\t\t\tWHERE `username` = '" . addslashes($username) . "'\n\t\t\t\t\tAND `password` = '" . $password . "'";
     $row = $this->_db->fetchRow(0, $sql);
     if (!empty($row) && is_array($row)) {
         $sql = "UPDATE `tbl_authors` SET `lastvisit` = UNIX_TIMESTAMP() WHERE `id` = '" . $row['id'] . "'";
         $this->_db->query($sql);
         setcookie(__SYM_COOKIE__, serialize($row), time() + 31536000, $this->_parent->getCookieDomain());
         setcookie(__SYM_COOKIE_SAFE__, base64_encode(serialize($row)), time() + 31536000, $this->_parent->getCookieDomain());
         $status = 'Author';
         if ($row['owner'] == 1) {
             $status = 'Owner';
         } elseif ($row['superuser'] == 1) {
             $status = 'Administrator';
         }
         $result = new XMLElement("user");
         $result->setAttribute("logged-in", "true");
         $result->addChild(new XMLElement("username", $row['username']));
         $result->addChild(new XMLElement("first-name", $row['firstname']));
         $result->addChild(new XMLElement("last-name", $row['lastname']));
         $result->addChild(new XMLElement("email", $row['email']));
         $result->addChild(new XMLElement("account-type", $status));
     } else {
         $result = new XMLElement("user");
         $result->setAttribute("logged-in", "false");
     }
     return $result;
 }
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:35,代码来源:event.login.php

示例5: generate

 /**
  * The generate functions outputs the correct headers for
  * this `XMLPage`, adds `$this->getHttpStatusCode()` code to the root attribute
  * before calling the parent generate function and generating
  * the `$this->_Result` XMLElement
  *
  * @param null $page
  * @return string
  */
 public function generate($page = null)
 {
     // Set the actual status code in the xml response
     $this->_Result->setAttribute('status', $this->getHttpStatusCode());
     parent::generate($page);
     return $this->_Result->generate(true);
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:16,代码来源:class.xmlpage.php

示例6: __buildFormContent

 private function __buildFormContent()
 {
     $fieldset = new XMLElement('fieldset');
     // email was not send
     // or first time here (email_sent == NULL)
     if ($this->_email_sent !== true) {
         $fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote unban link with further instructions.')));
         $label = Widget::Label(__('Email Address'));
         $label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus', 'autofocus')));
     }
     if (isset($this->_email_sent)) {
         if ($this->_email_sent) {
             $div = new XMLElement('div', __('Email sent. Follow the instruction in it.'));
             $fieldset->appendChild($div);
         } else {
             $div = new XMLElement('div', NULL, array('class' => 'invalid'));
             $div->appendChild($label);
             $div->appendChild(new XMLElement('p', __('There was a problem locating your account. Please check that you are using the correct email address.')));
             $fieldset->appendChild($div);
         }
     } else {
         $fieldset->appendChild($label);
     }
     $this->Form->appendChild($fieldset);
     if ($this->_email_sent !== true) {
         $div = new XMLElement('div', NULL, array('class' => 'actions'));
         $div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[send-email]', 'type' => 'submit')));
         $this->Form->appendChild($div);
     }
 }
开发者ID:korelogic,项目名称:anti_brute_force,代码行数:30,代码来源:content.login.php

示例7: lookup

 public static function lookup($ip)
 {
     $ch = curl_init();
     // Notice: the request back to the service API includes your domain name
     // and the version of Symphony that you're using
     $version = Symphony::Configuration()->get('version', 'symphony');
     $domain = $_SERVER[SERVER_NAME];
     curl_setopt($ch, CURLOPT_URL, "http://api.josephdenne.com/_geoloc/array/?symphony=" . $version . "&domain=" . $domain . "&ip=" . $ip);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $geoinfo = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     if ($geoinfo === false || $info['http_code'] != 200) {
         return;
     } else {
         $geoinfo = explode(',', $geoinfo);
     }
     $result = new XMLElement("geolocation");
     $included = array('id', 'lookups', 'country', 'region', 'city', 'lat', 'lon', 'error');
     $i = 0;
     foreach ($included as $geoloc) {
         $result->appendChild(new XMLElement($geoloc, $geoinfo[$i]));
         $i++;
     }
     return $result;
 }
开发者ID:josephdenne,项目名称:geolocation_service,代码行数:27,代码来源:class.geolocation_service.php

示例8: 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);
     }
 }
开发者ID:psychoticmeowArchives,项目名称:brightcove,代码行数:31,代码来源:field.brightcove_status.php

示例9: view

 public function view()
 {
     $this->setTitle(__('Symphony &ndash; 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);
 }
开发者ID:brendo,项目名称:indecent,代码行数:25,代码来源:content.indecent.php

示例10: __trigger

 protected function __trigger()
 {
     $result = new XMLElement(self::ROOTELEMENT);
     $success = false;
     self::__init();
     $db = ASDCLoader::instance();
     $Members = $this->_Parent->ExtensionManager->create('members');
     $Members->initialiseCookie();
     if ($Members->isLoggedIn() !== true) {
         $result->appendChild(new XMLElement('error', 'Must be logged in.'));
         $result->setAttribute('status', 'error');
         return $result;
     }
     $Members->initialiseMemberObject();
     // Make sure we dont accidently use an expired code
     extension_Members::purgeCodes();
     $em = new EntryManager($this->_Parent);
     $entry = end($em->fetch((int) $Members->Member->get('id')));
     $email = $entry->getData(self::findFieldID('email-address', 'members'));
     $name = $entry->getData(self::findFieldID('name', 'members'));
     $success = $Members->emailNewMember(array('entry' => $entry, 'fields' => array('username-and-password' => $entry->getData(self::findFieldID('username-and-password', 'members')), 'name' => $name['value'], 'email-address' => $email['value'])));
     if ($success == true && isset($_REQUEST['redirect'])) {
         redirect($_REQUEST['redirect']);
     }
     $result->setAttribute('result', $success === true ? 'success' : 'error');
     return $result;
 }
开发者ID:bauhouse,项目名称:members,代码行数:27,代码来源:event.members_resend_activation_email.php

示例11: 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);
 }
开发者ID:ShinShinman,项目名称:MAWWW,代码行数:35,代码来源:formatter.ttf_wiszce_ziomy.php

示例12: execute

 public function execute(array &$param_pool = null)
 {
     $result = new XMLElement('se-permissions');
     $result->appendChild($this->buildActions());
     $result->appendChild($this->buildLevels());
     return $result;
 }
开发者ID:andrewminton,项目名称:sections_event,代码行数:7,代码来源:data.se_permissions.php

示例13: 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;
 }
开发者ID:BloodBrother,项目名称:symphony-2-template,代码行数:7,代码来源:data.package.php

示例14: fromXML

 /**
  * Instantiates Services_Gnip_Publisher with current class data values
  *
  * @access    public
  * @param     XMLElement               $xml      XML Publisher
  * @return    Services_Gnip_Publisher            Services_Gnip_Publisher object
  */
 function fromXML($xml)
 {
     if ($xml->getName() != "publisher") {
         throw new Exception("expected publisher");
     }
     return new Services_Gnip_Publisher($xml["name"]);
 }
开发者ID:nsimon,项目名称:gnip-php,代码行数:14,代码来源:Publisher.php

示例15: append_preferences

 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'PayPal Payments'));
     # Add Merchant Email field
     $label = Widget::Label('Merchant Email/Account ID');
     $label->appendChild(Widget::Input('settings[paypal-payments][business]', General::Sanitize($this->_get_paypal_business())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'The merchant email address or account ID of the payment recipient.', array('class' => 'help')));
     # Country <select>
     $countries = array('Australia', 'United Kingdom', 'United States');
     $selected_country = $this->_get_country();
     foreach ($countries as $country) {
         $selected = $country == $selected_country ? TRUE : FALSE;
         $options[] = array($country, $selected);
     }
     $label = Widget::Label();
     $select = Widget::Select('settings[paypal-payments][country]', $options);
     $label->setValue('PayPal Country' . $select->generate());
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Country you want to target.', array('class' => 'help')));
     # Sandbox
     $label = Widget::Label();
     $input = Widget::Input('settings[paypal-payments][sandbox]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('sandbox', 'paypal-payments') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Enable testing mode');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Directs payments to PayPal’s Sandbox: <code>http://www.sandbox.paypal.com/</code>', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:34,代码来源:extension.driver.php


注:本文中的XMLElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。