本文整理汇总了PHP中SimpleXmlElement::saveXML方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleXmlElement::saveXML方法的具体用法?PHP SimpleXmlElement::saveXML怎么用?PHP SimpleXmlElement::saveXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXmlElement
的用法示例。
在下文中一共展示了SimpleXmlElement::saveXML方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Save
public function Save()
{
//if installed goto dashboard
if ($this->getSystemSetting(OpenSms::INSTALLATION_STATUS)) {
OpenSms::redirectToAction('index', 'dashboard');
}
//var_dump($_POST);die();
// CREATE
$config = new SimpleXmlElement('<settings/>');
$config->{OpenSms::VERSION} = $this->getSystemSetting(OpenSms::VERSION);
$config->{OpenSms::SITE_NAME} = $this->getFormData(OpenSms::SITE_NAME);
$config->{OpenSms::SITE_URL} = $this->getFormData(OpenSms::SITE_URL);
$config->{OpenSms::DB_TYPE} = 'mysql';
$config->{OpenSms::DB_HOST} = $this->getFormData(OpenSms::DB_HOST);
$config->{OpenSms::DB_NAME} = $this->getFormData(OpenSms::DB_NAME);
$config->{OpenSms::DB_TABLE_PREFIX} = $this->getFormData(OpenSms::DB_TABLE_PREFIX);
$config->{OpenSms::DB_USERNAME} = $this->getFormData(OpenSms::DB_USERNAME);
$config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
$config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
$config->{OpenSms::CURRENT_THEME_KEY} = $this->getFormData(OpenSms::CURRENT_THEME_KEY);
$config->{OpenSms::OPEN_PRICE_PER_UNIT} = $this->getFormData(OpenSms::OPEN_PRICE_PER_UNIT);
$config->{OpenSms::OPEN_UNITS_PER_SMS} = $this->getFormData(OpenSms::OPEN_UNITS_PER_SMS);
$config->{OpenSms::INSTALLATION_STATUS} = false;
//unlink(OpenSms::SETTINGS_FILE_PATH);
$config->saveXML(OpenSms::SETTINGS_FILE_PATH);
$this->setNotification('Settings saved', 'settings_save');
OpenSms::redirectToAction('index');
}
示例2: _asXml
/**
* Output as XML
*
* @param array $shellList The shell list.
* @return void
*/
protected function _asXml($shellList)
{
$shells = new SimpleXmlElement('<shells></shells>');
foreach ($shellList as $command) {
$callable = $command;
$shell = $shells->addChild('shell');
$shell->addAttribute('name', $command);
$shell->addAttribute('call_as', $callable);
$shell->addAttribute('help', $callable . ' -h');
}
$this->out($shells->saveXML());
}
示例3: save
public function save()
{
if (!isset($_POST[OpenSms::DB_HOST])) {
OpenSms::redirectToAction('index');
}
//if installed goto dashboard
if ($this->getSystemSetting(OpenSms::INSTALLATION_STATUS)) {
OpenSms::redirectToAction('index', 'dashboard');
}
//var_dump($_POST);die();
// CREATE
$config = new SimpleXmlElement('<settings/>');
$config->{OpenSms::VERSION} = $this->getSystemSetting(OpenSms::VERSION);
$config->{OpenSms::SITE_NAME} = $this->getFormData(OpenSms::SITE_NAME);
$config->{OpenSms::SITE_URL} = $this->getFormData(OpenSms::SITE_URL);
$config->{OpenSms::DB_TYPE} = 'mysql';
$config->{OpenSms::DB_HOST} = $this->getFormData(OpenSms::DB_HOST);
$config->{OpenSms::DB_NAME} = $this->getFormData(OpenSms::DB_NAME);
$config->{OpenSms::DB_TABLE_PREFIX} = $this->getFormData(OpenSms::DB_TABLE_PREFIX);
$config->{OpenSms::DB_USERNAME} = $this->getFormData(OpenSms::DB_USERNAME);
$config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
$config->{OpenSms::DB_PASSWORD} = $this->getFormData(OpenSms::DB_PASSWORD);
$config->{OpenSms::CURRENT_THEME_KEY} = 'default';
$config->{OpenSms::OPEN_PRICE_PER_UNIT} = $this->getFormData(OpenSms::OPEN_PRICE_PER_UNIT);
$config->{OpenSms::OPEN_UNITS_PER_SMS} = $this->getFormData(OpenSms::OPEN_UNITS_PER_SMS);
$config->{OpenSms::INSTALLATION_STATUS} = 'installed';
//unlink(OpenSms::SETTINGS_FILE_PATH);
$config->saveXML(OpenSms::SETTINGS_FILE_PATH);
$this->loadSystemSettings();
//create tables
OpenSms_Helper_Db::executeNonQuery($this->getDbScript());
//create admin account
$user = $this->loadModel('OpenSms_Model_User');
$user->LoginId = $this->getFormData('admin_username');
$user->Password = $this->getFormData('admin_password');
$user->Role = OpenSms_Model_User::ADMIN;
$saved = $user->save();
OpenSms::redirectToAction('complete', 'install', 'admin', [0 => $saved == true ? 1 : 0]);
}
示例4: parseTextElement
/**
* Simply get text out of an element
*
* @param SimpleXmlElement $xmlElement
*
* @return string
*/
protected function parseTextElement($xmlElement)
{
$text = "";
$italic = strpos($xmlElement->saveXML(), "<w:i/>") !== false;
$bold = strpos($xmlElement->saveXML(), "<w:b/>") !== false;
$underline = strpos($xmlElement->saveXML(), "<w:u/>") !== false;
foreach ($xmlElement->xpath('w:t') as $textElement) {
$text .= strip_tags($textElement->saveXML());
}
// exclude if needed
if (in_array($text, $this->exclude)) {
return "";
}
// apply styles
$text = $this->normalize($text);
$text = $italic ? "<i " . $this->getAttributes('i') . ">" . $text . "</i>" : $text;
$text = $bold ? "<b " . $this->getAttributes('b') . ">" . $text . "</b>" : $text;
$text = $underline ? "<u " . $this->getAttributes('u') . ">" . $text . "</u>" : $text;
return $text;
}
示例5: getInnerXml
function getInnerXml(SimpleXmlElement $xml, $rootNodeToRemove)
{
return str_replace(array('<' . $rootNodeToRemove . '>', '</' . $rootNodeToRemove . '>'), '', $xml->saveXML());
}