本文整理汇总了PHP中XenForo_Helper_DevelopmentXml::createDomElements方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Helper_DevelopmentXml::createDomElements方法的具体用法?PHP XenForo_Helper_DevelopmentXml::createDomElements怎么用?PHP XenForo_Helper_DevelopmentXml::createDomElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Helper_DevelopmentXml
的用法示例。
在下文中一共展示了XenForo_Helper_DevelopmentXml::createDomElements方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderRedirect
/**
* Simple handler for XML redirects - do not redirect, just send status:ok and redirect:$redirectTarget
*
* @param integer Type of redirect. See {@link XenForo_ControllerResponse_Redirect}
* @param string Target to redirect to
* @param mixed Redirect message
*
* @return string XML response (response tag)
*/
public function renderRedirect($redirectType, $redirectTarget, $redirectMessage = null, array $redirectParams = array())
{
$document = new DOMDocument('1.0', 'utf-8');
$document->formatOutput = true;
$rootNode = $document->createElement('response');
XenForo_Helper_DevelopmentXml::createDomElements($rootNode, array('_redirectStatus' => 'ok', '_redirectTarget' => $redirectTarget, '_redirectMessage' => is_null($redirectMessage) ? new XenForo_Phrase('redirect_changes_saved_successfully') : $redirectMessage, 'jsonParams' => XenForo_ViewRenderer_Json::jsonEncodeForOutput($redirectParams)));
$document->appendChild($rootNode);
return $document->saveXML();
}
示例2: renderXml
public function renderXml()
{
$document = new DOMDocument('1.0', 'utf-8');
$document->formatOutput = true;
$rootNode = $document->createElement('user');
$document->appendChild($rootNode);
XenForo_Helper_DevelopmentXml::createDomElements($rootNode, $this->_params['user']);
return $document->saveXML();
}
示例3: appendOptionsAddOnXml
/**
* Appends the add-on options XML to a given DOM element.
*
* @param DOMElement $rootNode Node to append all navigation elements to
* @param string $addOnId Add-on ID to be exported
*/
public function appendOptionsAddOnXml(DOMElement $rootNode, $addOnId)
{
$groups = $this->getOptionGroupsByAddOn($addOnId);
$options = $this->getOptionsByAddOn($addOnId);
$relations = $this->getOptionRelationsGroupedByOption(array_keys($options));
$document = $rootNode->ownerDocument;
foreach ($groups as $group) {
$groupNode = $document->createElement('group');
$groupNode->setAttribute('group_id', $group['group_id']);
$groupNode->setAttribute('display_order', $group['display_order']);
$groupNode->setAttribute('debug_only', $group['debug_only']);
$rootNode->appendChild($groupNode);
}
foreach ($options as $option) {
$optionNode = $document->createElement('option');
$optionNode->setAttribute('option_id', $option['option_id']);
$optionNode->setAttribute('edit_format', $option['edit_format']);
$optionNode->setAttribute('data_type', $option['data_type']);
$optionNode->setAttribute('can_backup', $option['can_backup']);
if ($option['validation_class']) {
$optionNode->setAttribute('validation_class', $option['validation_class']);
$optionNode->setAttribute('validation_method', $option['validation_method']);
}
XenForo_Helper_DevelopmentXml::createDomElements($optionNode, array('default_value' => str_replace("\r\n", "\n", $option['default_value']), 'edit_format_params' => str_replace("\r\n", "\n", $option['edit_format_params']), 'sub_options' => str_replace("\r\n", "\n", $option['sub_options'])));
if (isset($relations[$option['option_id']])) {
foreach ($relations[$option['option_id']] as $relation) {
$relationNode = $document->createElement('relation');
$relationNode->setAttribute('group_id', $relation['group_id']);
$relationNode->setAttribute('display_order', $relation['display_order']);
$optionNode->appendChild($relationNode);
}
}
$rootNode->appendChild($optionNode);
}
return $document;
}
示例4: appendStylePropertyXml
/**
* Appends the style property list to an XML document.
*
* @param DOMElement $rootNode Node to append to
* @param integer $styleId Style to read values/definitions from
* @param string|null $addOnId If not null, limits to values/definitions in the specified add-on
* @param boolean $independent If true, exports all customized properties to the root
*/
public function appendStylePropertyXml(DOMElement $rootNode, $styleId, $addOnId = null, $independent = false)
{
$document = $rootNode->ownerDocument;
if (!$styleId) {
$independent = false;
}
if ($independent) {
$properties = $this->getEffectiveStylePropertiesInStyle($styleId);
} else {
$properties = $this->getStylePropertiesInStyles(array($styleId));
}
ksort($properties);
foreach ($properties as $property) {
if ($addOnId !== null && $property['addon_id'] !== $addOnId) {
continue;
}
if ($independent && $property['definition_style_id'] == 0 && $property['effectiveState'] == 'default') {
continue;
}
$node = $document->createElement('property');
$node->setAttribute('property_name', $property['property_name']);
$node->setAttribute('property_type', $property['property_type']);
if ($independent && $property['definition_style_id'] || $property['definition_style_id'] == $styleId) {
$node->setAttribute('definition', 1);
$node->setAttribute('group_name', $property['group_name']);
$node->setAttribute('title', isset($property['masterTitle']) ? $property['masterTitle'] : strval($property['title']));
$node->setAttribute('description', isset($property['masterDescription']) ? $property['masterDescription'] : strval($property['description']));
$components = unserialize($property['css_components']);
$node->setAttribute('css_components', implode(',', array_keys($components)));
$node->setAttribute('scalar_type', $property['scalar_type']);
$node->setAttribute('scalar_parameters', $property['scalar_parameters']);
$node->setAttribute('display_order', $property['display_order']);
$node->setAttribute('sub_group', $property['sub_group']);
}
if ($property['property_type'] == 'scalar') {
$node->appendChild($document->createCDATASection($property['property_value']));
} else {
$node->appendChild($document->createCDATASection(json_encode(unserialize($property['property_value']))));
}
$rootNode->appendChild($node);
}
if ($independent) {
$groups = $this->getEffectiveStylePropertyGroupsInStyle($styleId);
} else {
$groups = $this->getStylePropertyGroupsInStyles(array($styleId));
}
ksort($groups);
foreach ($groups as $group) {
if ($addOnId !== null && $group['addon_id'] !== $addOnId) {
continue;
}
if ($independent && $group['group_style_id'] == 0) {
continue;
}
$node = $document->createElement('group');
$rootNode->appendChild($node);
$node->setAttribute('group_name', $group['group_name']);
$node->setAttribute('display_order', $group['display_order']);
XenForo_Helper_DevelopmentXml::createDomElements($node, array('title' => $group['title'], 'description' => $group['description']));
}
}
示例5: appendOptionsXml
public function appendOptionsXml(DOMElement $rootNode, $blockId)
{
$document = $rootNode->ownerDocument;
$options = $this->getOptionsByBlock($blockId);
foreach ($options as $option) {
$optionNode = $document->createElement('option');
$optionNode->setAttribute('option_id', $option['option_id']);
$optionNode->setAttribute('edit_format', $option['edit_format']);
$optionNode->setAttribute('data_type', $option['data_type']);
$optionNode->setAttribute('display_order', $option['display_order']);
if ($option['validation_class']) {
$optionNode->setAttribute('validation_class', $option['validation_class']);
$optionNode->setAttribute('validation_method', $option['validation_method']);
}
XenForo_Helper_DevelopmentXml::createDomElements($optionNode, array('option_value' => str_replace("\r\n", "\n", $option['option_value']), 'edit_format_params' => str_replace("\r\n", "\n", $option['edit_format_params']), 'sub_options' => str_replace("\r\n", "\n", $option['sub_options']), 'title' => str_replace("\r\n", "\n", $option['title'])));
$explainNode = $optionNode->appendChild($document->createElement('explain'));
$explainNode->appendChild($document->createCDATASection($option['explain']));
$rootNode->appendChild($optionNode);
}
}
示例6: writeGroupDevelopmentFile
public function writeGroupDevelopmentFile(array $group)
{
$fileName = $this->getGroupDevelopmentFileName($group['group_name'], $group['group_style_id']);
$document = new DOMDocument('1.0', 'utf-8');
$document->formatOutput = true;
$node = $document->createElement('group');
$document->appendChild($node);
$node->setAttribute('display_order', $group['display_order']);
XenForo_Helper_DevelopmentXml::createDomElements($node, array('title' => $group['title'], 'description' => $group['description']));
$document->save($fileName);
}