• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XenForo_Helper_DevelopmentXml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: renderXml

 public function renderXml()
 {
     $system =& $this->_params['system'];
     $widgets =& $this->_params['widgets'];
     $document = new DOMDocument('1.0', 'utf-8');
     $document->formatOutput = true;
     $rootNode = $document->createElement('widget_framework');
     $rootNode->setAttribute('version', $system['version_string']);
     $document->appendChild($rootNode);
     foreach ($widgets as $widget) {
         $widgetNode = $document->createElement('widget');
         $widgetNode->setAttribute('title', $widget['title']);
         $widgetNode->setAttribute('class', $widget['class']);
         $optionsNode = $document->createElement('options');
         $optionsString = $widget['options'];
         if (!is_string($optionsString)) {
             $optionsString = serialize($optionsString);
         }
         $optionsData = XenForo_Helper_DevelopmentXml::createDomCdataSection($document, $optionsString);
         $optionsNode->appendChild($optionsData);
         $widgetNode->appendChild($optionsNode);
         $widgetNode->setAttribute('position', $widget['position']);
         $widgetNode->setAttribute('display_order', $widget['display_order']);
         $widgetNode->setAttribute('active', $widget['active']);
         $rootNode->appendChild($widgetNode);
     }
     $this->setDownloadFileName('widget_framework-widgets-' . XenForo_Template_Helper_Core::date(XenForo_Application::$time, 'YmdHi') . '.xml');
     return $document->saveXml();
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:29,代码来源:Export.php


示例2: renderXml

 public function renderXml()
 {
     $document = new DOMDocument('1.0', 'utf-8');
     $document->formatOutput = true;
     $rootNode = $document->createElement('errors');
     $document->appendChild($rootNode);
     if (isset($this->_params['exception']) && $this->_params['exception'] instanceof Exception) {
         $e = $this->_params['exception'];
         $exceptionMessage = $e->getMessage();
         $rootNode->appendChild(XenForo_Helper_DevelopmentXml::createDomElement($document, 'error', $exceptionMessage));
         $traceNode = $document->createElement('trace');
         foreach ($e->getTrace() as $trace) {
             $function = (isset($trace['class']) ? $trace['class'] . $trace['type'] : '') . $trace['function'];
             if (!isset($trace['file'])) {
                 $trace['file'] = '';
             }
             if (!isset($trace['line'])) {
                 $trace['line'] = '';
             }
             $entryNode = $document->createElement('entry');
             $entryNode->setAttribute('function', $function);
             $entryNode->setAttribute('file', $trace['file']);
             $entryNode->setAttribute('line', $trace['line']);
             $traceNode->appendChild($entryNode);
         }
         $rootNode->appendChild($traceNode);
     } else {
         $rootNode->appendChild($document->createElement('error', 'Unknown error, trace unavailable'));
     }
     return $document->saveXML();
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:31,代码来源:ServerError.php


示例3: 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();
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:18,代码来源:Xml.php


示例4: 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();
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:9,代码来源:MiniStats.php


示例5: appendAdminTemplatesXml

 public function appendAdminTemplatesXml(DOMElement $rootNode, $blockId)
 {
     $document = $rootNode->ownerDocument;
     $adminTemplates = $this->getAdminTemplatesByBlock($blockId);
     foreach ($adminTemplates as $template) {
         $templateNode = $document->createElement('template');
         $templateNode->setAttribute('title', $template['title']);
         $templateNode->appendChild(XenForo_Helper_DevelopmentXml::createDomCdataSection($document, $template['template']));
         $rootNode->appendChild($templateNode);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:11,代码来源:Templates.php


示例6: scanXmlFile

 public static function scanXmlFile($xmlFile)
 {
     if (self::callbackChecker('XenForo_Helper_DevelopmentXml', 'scanFile')) {
         //Protected method
         $file = XenForo_Helper_DevelopmentXml::scanFile($xmlFile);
     } else {
         //Classic PHP method
         $file = new SimpleXMLElement($xmlFile, null, true);
     }
     return $file;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:11,代码来源:Bbm.php


示例7: execute

 public function execute(array $deferred, array $data, $targetRunTime, &$status)
 {
     $data = array_merge(array('file' => XenForo_Application::getInstance()->getRootDir() . '/install/data/email_templates.xml'), $data);
     /* @var $templateModel XenForo_Model_EmailTemplate */
     $templateModel = XenForo_Model::create('XenForo_Model_EmailTemplate');
     $document = XenForo_Helper_DevelopmentXml::scanFile($data['file']);
     $templateModel->importEmailTemplatesAddOnXml($document, 'XenForo', false);
     $actionPhrase = new XenForo_Phrase('importing');
     $typePhrase = new XenForo_Phrase('email_templates');
     $status = sprintf('%s... %s', $actionPhrase, $typePhrase);
     return false;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:12,代码来源:ImportEmailTemplate.php


示例8: importListenersXml

 public function importListenersXml(SimpleXMLElement $xml, $blockId)
 {
     $db = $this->_getDb();
     XenForo_Db::beginTransaction($db);
     $this->deleteListenersByBlock($blockId);
     $listeners = XenForo_Helper_DevelopmentXml::fixPhpBug50670($xml->listener);
     foreach ($listeners as $event) {
         $eventId = (string) $event['event_id'];
         $dw = XenForo_DataWriter::create('XenForo_DataWriter_CodeEventListener');
         $dw->setOption(XenForo_DataWriter_CodeEventListener::OPTION_REBUILD_CACHE, false);
         $dw->bulkSet(array('event_id' => (string) $event['event_id'], 'execute_order' => (string) $event['execute_order'], 'callback_class' => (string) $event['callback_class'], 'callback_method' => (string) $event['callback_method'], 'active' => (string) $event['active'], 'description' => (string) $event['description']));
         $dw->save();
     }
     $this->getModelFromCache('XenForo_Model_CodeEvent')->rebuildEventListenerCache();
     XenForo_Db::commit($db);
     return;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:17,代码来源:CodeEvents.php


示例9: importPhrasesXml

 public function importPhrasesXml(SimpleXMLElement $xml, $blockId)
 {
     $existingPhrases = $this->getPhrasesByBlock($blockId);
     $db = $this->_getDb();
     XenForo_Db::beginTransaction($db);
     $phrases = XenForo_Helper_DevelopmentXml::fixPhpBug50670($xml->phrase);
     foreach ($phrases as $phrase) {
         $phraseName = (string) $phrase['title'];
         $dw = XenForo_DataWriter::create('XenForo_DataWriter_Phrase');
         if (isset($existingPhrases[$phraseName])) {
             $dw->setExistingData($existingPhrases[$phraseName], true);
         }
         $dw->bulkSet(array('language_id' => '0', 'title' => $phraseName, 'phrase_text' => (string) $phrase));
         $dw->save();
     }
     XenForo_Db::commit($db);
     return;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:18,代码来源:Phrases.php


示例10: execute

 public function execute(array $deferred, array $data, $targetRunTime, &$status)
 {
     $data = array_merge(array('file' => XenForo_Application::getInstance()->getRootDir() . '/install/data/phrases.xml', 'offset' => 0, 'position' => 0), $data);
     /* @var $phraseModel XenForo_Model_Phrase */
     $phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
     $document = XenForo_Helper_DevelopmentXml::scanFile($data['file']);
     $result = $phraseModel->importPhrasesAddOnXml($document, 'XenForo', $targetRunTime, $data['offset']);
     if (is_int($result)) {
         $data['offset'] = $result;
         $data['position']++;
         $actionPhrase = new XenForo_Phrase('importing');
         $typePhrase = new XenForo_Phrase('phrases');
         $status = sprintf('%s... %s %s', $actionPhrase, $typePhrase, str_repeat(' . ', $data['position']));
         return $data;
         // continue again
     } else {
         return false;
     }
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:19,代码来源:ImportPhrase.php


示例11: importFromFile

 public function importFromFile($fileName, $deleteAll = false)
 {
     if (!file_exists($fileName) || !is_readable($fileName)) {
         throw new XenForo_Exception(new XenForo_Phrase('please_enter_valid_file_name_requested_file_not_read'), true);
     }
     try {
         $document = new SimpleXMLElement($fileName, 0, true);
     } catch (Exception $e) {
         throw new XenForo_Exception(new XenForo_Phrase('provided_file_was_not_valid_xml_file'), true);
     }
     if ($document->getName() != 'widget_framework') {
         throw new XenForo_Exception(new XenForo_Phrase('wf_provided_file_is_not_an_widgets_xml_file'), true);
     }
     $widgets = XenForo_Helper_DevelopmentXml::fixPhpBug50670($document->widget);
     XenForo_Db::beginTransaction();
     if ($deleteAll) {
         // get global widgets from database and delete them all!
         // NOTE: ignore widget page widgets
         $existingWidgets = $this->getGlobalWidgets(false, false);
         foreach ($existingWidgets as $existingWidget) {
             $dw = XenForo_DataWriter::create('WidgetFramework_DataWriter_Widget');
             $dw->setExtraData(WidgetFramework_DataWriter_Widget::EXTRA_DATA_SKIP_REBUILD, true);
             $dw->setExistingData($existingWidget);
             $dw->delete();
         }
     }
     foreach ($widgets as $widget) {
         $dw = XenForo_DataWriter::create('WidgetFramework_DataWriter_Widget');
         $dw->setExtraData(WidgetFramework_DataWriter_Widget::EXTRA_DATA_SKIP_REBUILD, true);
         $dw->set('title', $widget['title']);
         $dw->set('class', $widget['class']);
         $dw->set('position', $widget['position']);
         $dw->set('display_order', $widget['display_order']);
         $dw->set('active', intval($widget['active']));
         $dw->set('options', unserialize(XenForo_Helper_DevelopmentXml::processSimpleXmlCdata($widget->options)));
         $dw->save();
     }
     $this->buildCache();
     XenForo_Db::commit();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:40,代码来源:Widget.php


示例12: importAdminTemplatesFieldXml

 /**
  * Imports admin templates.
  * It does not check for conflicts.
  *
  * @param SimpleXMLElement $xml
  */
 public function importAdminTemplatesFieldXml(SimpleXMLElement $xml)
 {
     $db = $this->_getDb();
     if ($xml->template === null) {
         return;
     }
     XenForo_Db::beginTransaction($db);
     foreach ($xml->template as $template) {
         $templateName = (string) $template['title'];
         $dw = XenForo_DataWriter::create('XenForo_DataWriter_AdminTemplate');
         $existingTemplate = $this->_getAdminTemplateModel()->getAdminTemplateByTitle($templateName);
         if ($existingTemplate) {
             $dw->setExistingData($existingTemplate);
         }
         $dw->setOption(XenForo_DataWriter_AdminTemplate::OPTION_DEV_OUTPUT_DIR, '');
         $dw->setOption(XenForo_DataWriter_AdminTemplate::OPTION_FULL_COMPILE, false);
         $dw->setOption(XenForo_DataWriter_AdminTemplate::OPTION_TEST_COMPILE, false);
         $dw->bulkSet(array('title' => (string) $template['title'], 'template' => XenForo_Helper_DevelopmentXml::processSimpleXmlCdata($template), 'addon_id' => (string) $template['addon_id']));
         $dw->save();
     }
     XenForo_Db::commit($db);
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:28,代码来源:AdminTemplate.php


示例13: parseSVG

 public function parseSVG($filename)
 {
     $svgfile = null;
     try {
         if (method_exists('XenForo_Helper_DevelopmentXml', 'scanFile')) {
             $svgfile = XenForo_Helper_DevelopmentXml::scanFile($filename);
         } else {
             $svgfile = new SimpleXMLElement($filename, 0, true);
         }
     } catch (Exception $e) {
         XenForo_Error::logException($e, false);
         $svgfile = null;
     }
     if (empty($svgfile)) {
         return null;
     }
     // check for bad tags
     $options = XenForo_Application::getOptions();
     $badTags = array_fill_keys(explode(',', strtolower($options->SV_AttachImpro_badTags)), true);
     $badAttributes = array_fill_keys(explode(',', strtolower($options->SV_AttachmentImprovements_badAttributes)), true);
     return $this->_scanSVG($svgfile, $badTags, $badAttributes);
 }
开发者ID:Xon,项目名称:XenForo-AttachmentImprovements,代码行数:22,代码来源:Attachment.php


示例14: importSmiliesXml

 /**
  * Imports a smilie XML file.
  *
  * @param SimpleXMLElement $document
  * @param string $smilieGroupId
  * @param integer $overwriteSmilieId
  *
  * @return array List of cache rebuilders to run
  */
 public function importSmiliesXml(SimpleXMLElement $document, $overwrite = 0)
 {
     if ($document->getName() != 'smilies') {
         throw new XenForo_Exception(new XenForo_Phrase('waindigo_provided_file_is_not_valid_smilie_xml_smilieimporter'), true);
     }
     $smilies = XenForo_Helper_DevelopmentXml::fixPhpBug50670($document->smilie);
     $db = $this->_getDb();
     /* @var $smilie SimpleXMLElement */
     XenForo_Db::beginTransaction($db);
     foreach ($smilies as $smilie) {
         $smilieText = XenForo_Helper_DevelopmentXml::processSimpleXmlCdata($smilie->smilie_text);
         $existing = $this->getSmiliesByText($smilieText);
         $updateText = array();
         foreach ($existing as $text => $existingSmilie) {
             if ($overwrite) {
                 if (isset($updateText[$existingSmilie['smilie_id']])) {
                     $existingSmilie['smilie_text'] = $updateText[$existingSmilie['smilie_id']];
                 }
                 $existingSmilie['smilie_text'] = preg_split('/\\R/m', $existingSmilie['smilie_text']);
                 unset($existingSmilie['smilie_text'][array_search($text, $existingSmilie['smilie_text'])]);
                 if (!empty($existingSmilie['smilie_text'])) {
                     $updateText[$existingSmilie['smilie_id']] = implode(PHP_EOL, $existingSmilie['smilie_text']);
                 } else {
                     $dw = XenForo_DataWriter::create('XenForo_DataWriter_Smilie', XenForo_DataWriter::ERROR_SILENT);
                     $dw->setExistingData($existingSmilie['smilie_id']);
                     $dw->delete();
                 }
             } else {
                 $smilieText = preg_split('/\\R/m', $smilieText);
                 if (in_array($text, $smilieText)) {
                     unset($smilieText[array_search($text, $smilieText)]);
                 }
                 $smilieText = implode(PHP_EOL, $smilieText);
                 if (!trim($smilieText)) {
                     continue;
                 }
             }
         }
         foreach ($updateText as $smilieId => $updateTextItem) {
             $dw = XenForo_DataWriter::create('XenForo_DataWriter_Smilie', XenForo_DataWriter::ERROR_SILENT);
             $dw->setExistingData($smilieId);
             $dw->set('smilie_text', $updateTextItem);
             $dw->save();
         }
         if (!trim($smilieText)) {
             continue;
         }
         $dw = XenForo_DataWriter::create('XenForo_DataWriter_Smilie', XenForo_DataWriter::ERROR_SILENT);
         $spriteParams = array('h' => (string) $smilie['h'], 'w' => (string) $smilie['w'], 'x' => (string) $smilie['x'], 'y' => (string) $smilie['y']);
         $dw->bulkSet(array('title' => XenForo_Helper_DevelopmentXml::processSimpleXmlCdata($smilie->title), 'image_url' => XenForo_Helper_DevelopmentXml::processSimpleXmlCdata($smilie->image_url), 'smilie_text' => $smilieText, 'sprite_mode' => (string) $smilie['sprite_mode'], 'sprite_params' => $spriteParams));
         $dw->save();
     }
     XenForo_Db::commit($db);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:63,代码来源:Smilie.php


示例15: importStylePropertyDevelopmentXml

 /**
  * Imports the development admin navigation XML data.
  *
  * @param string $fileName File to read the XML from
  */
 public function importStylePropertyDevelopmentXml($fileName, $styleId)
 {
     $document = XenForo_Helper_DevelopmentXml::scanFile($fileName);
     $this->importStylePropertyXml($document, $styleId, 'XenForo');
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:10,代码来源:StyleProperty.php


示例16: 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);
     }
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:20,代码来源:Options.php


示例17: importPrefixesAddOnXml

 /**
  * Imports the add-on route prefixes XML.
  *
  * @param SimpleXMLElement $xml XML element pointing to the root of the prefix data
  * @param string $addOnId Add-on to import for
  */
 public function importPrefixesAddOnXml(SimpleXMLElement $xml, $addOnId)
 {
     $db = $this->_getDb();
     $currentPrefixes = $this->getAllPrefixesGroupedByRouteType();
     XenForo_Db::beginTransaction($db);
     $this->deletePrefixesForAddOn($addOnId);
     $routeTypes = XenForo_Helper_DevelopmentXml::fixPhpBug50670($xml->route_type);
     foreach ($routeTypes as $typeXml) {
         $type = (string) $typeXml['type'];
         if (!$type) {
             continue;
         }
         $conflictPrefixes = $this->getPrefixesByRouteType($type);
         $types = XenForo_Helper_DevelopmentXml::fixPhpBug50670($typeXml->prefix);
         foreach ($types as $prefix) {
             $originalPrefixValue = (string) $prefix['original_prefix'];
             $prefixInfo = array('route_type' => $type, 'route_class' => (string) $prefix['class'], 'original_prefix' => $originalPrefixValue, 'build_link' => (string) $prefix['build_link'], 'addon_id' => $addOnId);
             $dw = XenForo_DataWriter::create('XenForo_DataWriter_RoutePrefix');
             if (isset($conflictPrefixes[$originalPrefixValue])) {
                 $dw->setExistingData($conflictPrefixes[$originalPrefixValue], true);
             }
             $dw->setOption(XenForo_DataWriter_RoutePrefix::OPTION_REBUILD_CACHE, false);
             $dw->bulkSet($prefixInfo);
             $dw->save();
         }
     }
     $this->rebuildRoutePrefixCache();
     XenForo_Db::commit($db);
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:35,代码来源:RoutePrefix.php


示例18: installAddOnXmlFromFile

 /**
  * Installs (or upgrades) an add-on using XML from a file.
  *
  * If an upgrade add-on is given, the XML add-on ID will be checked against if.
  * If matching, an upgrade will be performed. Otherwise, installing existing add-ons will
  * be blocked.
  *
  * @param string $fileName Path to file
  * @param string|false $upgradeAddOnId ID of the add-on to upgrade, if there is one
  *
  * @return bool
  */
 public function installAddOnXmlFromFile($fileName, $upgradeAddOnId = false)
 {
     if (!file_exists($fileName) || !is_readable($fileName)) {
         throw new XenForo_Exception(new XenForo_Phrase('please_enter_valid_file_name_requested_file_not_read'), true);
     }
     try {
         $document = XenForo_Helper_DevelopmentXml::scanFile($fileName);
     } catch (Exception $e) {
         throw new XenForo_Exception(new XenForo_Phrase('provided_file_was_not_valid_xml_file'), true);
     }
     return $this->installAddOnXml($document, $upgradeAddOnId);
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:24,代码来源:AddOn.php


示例19: importTemplatesAddOnXml

 /**
  * Imports the add-on templates XML.
  *
  * @param SimpleXMLElement $xml XML element pointing to the root of the data
  * @param string $addOnId Add-on to import for
  * @param integer $maxExecution Maximum run time in seconds
  * @param integer $offset Number of elements to skip
  *
  * @return boolean|integer True on completion; false if the XML isn't correct; integer otherwise with new offset value
  */
 public function importTemplatesAddOnXml(SimpleXMLElement $xml, $addOnId, $maxExecution = 0, $offset = 0)
 {
     $db = $this->_getDb();
     XenForo_Db::beginTransaction($db);
     $startTime = microtime(true);
     if ($offset == 0) {
         $this->deleteTemplatesForAddOn($addOnId);
     }
     $templates = XenForo_Helper_DevelopmentXml::fixPhpBug50670($xml->template);
     $titles = array();
     $current = 0;
     foreach ($templates as $template) {
         $current++;
         if ($current <= $offset) {
             continue;
         }
         $titles[] = (string) $template['title'];
     }
     $existingTemplates = $this->getTemplatesInStyleByTitles($titles, 0);
     $current = 0;
     $restartOffset = false;
     foreach ($templates as $template) {
         $current++;
         if ($current <= $offset) {
             continue;
         }
         $templateName = (string) $template['title'];
         $dw = XenForo_DataWriter::create('XenForo_DataWriter_Template');
         if (isset($existingTemplates[$templateName])) {
             $dw->setExistingData($existingTemplates[$templateName], true);
         }
         $dw->setOption(XenForo_DataWriter_Template::OPTION_DEV_OUTPUT_DIR, '');
         $dw->setOption(XenForo_DataWriter_Template::OPTION_FULL_COMPILE, false);
         $dw->setOption(XenForo_DataWriter_Template::OPTION_TEST_COMPILE, false);
         $dw->setOption(XenForo_DataWriter_Template::OPTION_CHECK_DUPLICATE, false);
         $dw->setOption(XenForo_DataWriter_Template::OPTION_REBUILD_TEMPLATE_MAP, false);
         $dw->bulkSet(array('style_id' => 0, 'title' => $templateName, 'template' => (string) $template, 'addon_id' => $addOnId, 'version_id' => (int) $template['version_id'], 'version_string' => (string) $template['version_string']));
         $dw->save();
         if ($maxExecution && microtime(true) - $startTime > $maxExecution) {
             $restartOffset = $current;
             break;
         }
     }
     XenForo_Db::commit($db);
     return $restartOffset ? $restartOffset : true;
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:56,代码来源:Template.php


示例20: importAdminPermissionsAddOnXml

 /**
  * Imports the add-on admin permission XML.
  *
  * @param SimpleXMLElement $xml XML element pointing to the root of the  data
  * @param string $addOnId Add-on to import for
  */
 public function importAdminPermissionsAddOnXml(SimpleXMLElement $xml, $addOnId)
 {
     $db = $this->_getDb();
     XenForo_Db::beginTransaction($db);
     $this->deleteAdminPermissionsForAddOn($addOnId);
     $xmlPermissions = XenForo_Helper_DevelopmentXml::fixPhpBug50670($xml->admin_permission);
     $adminPermissionIds = array();
     foreach ($xmlPermissions as $adminPermission) {
         $adminPermissionIds[] = (string) $adminPermission['admin_permission_id'];
     }
     $existingPermissions = $this->getAdminPermissionsByIds($adminPermissionIds);
     foreach ($xmlPermissions as $adminPermission) {
         $adminPermissionId = (string) $adminPermission['admin_permission_id'];
         $dw = XenForo_DataWriter::create('XenForo_DataWriter_AdminPermission');
         if (isset($existingPermissions[$adminPermissionId])) {
             $dw->setExistingData($existingPermissions[$adminPermissionId], true);
         }
         $dw->bulkSet(array('admin_permission_id' => $adminPermissionId, 'display_order' => (string) $adminPermission['display_order'], 'addon_id' => $addOnId));
         $dw->save();
     }
     $this->rebuildUserAdminPermissionCache();
     XenForo_Db::commit($db);
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:29,代码来源:Admin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XenForo_Helper_File类代码示例发布时间:2022-05-23
下一篇:
PHP XenForo_Helper_Cookie类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap