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


PHP XMLParser::destroy方法代码示例

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


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

示例1: installSettings

 /**
  * Install conference settings from an XML file.
  * @param $id int ID of scheduled conference/conference for settings to apply to
  * @param $filename string Name of XML file to parse and install
  * @param $paramArray array Optional parameters for variable replacement in settings
  */
 function installSettings($id, $filename, $paramArray = array())
 {
     $xmlParser = new XMLParser();
     $tree = $xmlParser->parse($filename);
     if (!$tree) {
         $xmlParser->destroy();
         return false;
     }
     foreach ($tree->getChildren() as $setting) {
         $nameNode =& $setting->getChildByName('name');
         $valueNode =& $setting->getChildByName('value');
         if (isset($nameNode) && isset($valueNode)) {
             $type = $setting->getAttribute('type');
             $isLocaleField = $setting->getAttribute('locale');
             $name =& $nameNode->getValue();
             if ($type == 'date') {
                 $value = strtotime($valueNode->getValue());
             } elseif ($type == 'object') {
                 $arrayNode =& $valueNode->getChildByName('array');
                 $value = $this->_buildObject($arrayNode, $paramArray);
             } else {
                 $value = $this->_performReplacement($valueNode->getValue(), $paramArray);
             }
             // Replace translate calls with translated content
             $this->updateSetting($id, $name, $isLocaleField ? array(Locale::getLocale() => $value) : $value, $type, $isLocaleField);
         }
     }
     $xmlParser->destroy();
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:35,代码来源:SettingsDAO.inc.php

示例2: array

 /**
  * Parse an XML file and return data in an array.
  * @see xml.XMLParser::parseStruct()
  */
 function &parseStruct($file, $tagsToMatch = array())
 {
     $parser = new XMLParser();
     $data =& $parser->parseStruct($file, $tagsToMatch);
     $parser->destroy();
     return $data;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:11,代码来源:XMLDAO.inc.php

示例3: parseEmails

 /**
  * Parse into structures the XML contents of an email data file.
  * @param $contents string
  * @return array
  */
 function parseEmails($contents)
 {
     $parser = new XMLParser();
     $result = $parser->parseTextStruct($contents, array('email_text', 'subject', 'body'));
     $parser->destroy();
     return $result;
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:12,代码来源:genEmailUpdates.php

示例4: XMLParser

 /**
  * Parse a record's contents into an object
  * @param $contents string
  * @return object
  */
 function &parseContents(&$contents)
 {
     $xmlParser = new XMLParser();
     $result =& $xmlParser->parseText($contents);
     $returner = array();
     $returner =& $this->handleRootNode($result);
     $result->destroy();
     $xmlParser->destroy();
     return $returner;
 }
开发者ID:Rygbee,项目名称:harvester,代码行数:15,代码来源:ModsPlugin.inc.php

示例5: XMLParser

 /**
  * Parse an RT version XML file.
  * @param $file string path to the XML file
  * @return RTVersion
  */
 function &parse($file)
 {
     $parser = new XMLParser();
     $tree = $parser->parse($file);
     $parser->destroy();
     $version = false;
     if ($tree !== false) {
         $version =& $this->parseVersion($tree);
     }
     $tree->destroy();
     return $version;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:17,代码来源:RTXMLParser.inc.php

示例6: parseTasks

 /**
  * Parse and execute the scheduled tasks in the specified file.
  * @param $file string
  */
 function parseTasks($file)
 {
     $xmlParser = new XMLParser();
     $tree = $xmlParser->parse($file);
     if (!$tree) {
         $xmlParser->destroy();
         printf("Unable to parse file \"%s\"!\n", $file);
         exit(1);
     }
     foreach ($tree->getChildren() as $task) {
         $className = $task->getAttribute('class');
         $frequency = $task->getChildByName('frequency');
         if (isset($frequency)) {
             $canExecute = ScheduledTaskHelper::checkFrequency($className, $frequency);
         } else {
             // Always execute if no frequency is specified
             $canExecute = true;
         }
         if ($canExecute) {
             $this->executeTask($className, ScheduledTaskHelper::getTaskArgs($task));
         }
     }
     $xmlParser->destroy();
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:28,代码来源:ScheduledTaskTool.inc.php

示例7: XMLParser

 /**
  * Parse a record's contents into an object
  * @param $contents string
  * @return object
  */
 function &parseContents(&$contents)
 {
     $xmlParser = new XMLParser();
     $result =& $xmlParser->parseText($contents);
     $returner = array();
     $modsNode =& $result->getChildByName(array('oai_mods:mods', 'mods:mods', 'mods'));
     if (!isset($modsNode)) {
         $returner = null;
         return $returner;
     }
     $returner =& $this->handleRootNode($modsNode);
     $result->destroy();
     $xmlParser->destroy();
     return $returner;
 }
开发者ID:jalperin,项目名称:harvester,代码行数:20,代码来源:ModsPlugin.inc.php

示例8: parseInstaller

 /**
  * Parse the installation descriptor XML file.
  * @return boolean
  */
 function parseInstaller()
 {
     // Read installation descriptor file
     $this->log(sprintf('load: %s', $this->descriptor));
     $xmlParser = new XMLParser();
     $installPath = $this->isPlugin ? $this->descriptor : INSTALLER_DATA_DIR . DIRECTORY_SEPARATOR . $this->descriptor;
     $installTree = $xmlParser->parse($installPath);
     if (!$installTree) {
         // Error reading installation file
         $xmlParser->destroy();
         $this->setError(INSTALLER_ERROR_GENERAL, 'installer.installFileError');
         return false;
     }
     $versionString = $installTree->getAttribute('version');
     if (isset($versionString)) {
         $this->newVersion =& Version::fromString($versionString);
     } else {
         $this->newVersion = $this->currentVersion;
     }
     // Parse descriptor
     $this->parseInstallNodes($installTree);
     $xmlParser->destroy();
     $result = $this->getErrorType() == 0;
     HookRegistry::call('Installer::parseInstaller', array(&$this, &$result));
     return $result;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:30,代码来源:Installer.inc.php

示例9: installFilterConfig

 /**
  * Install the given filter configuration file.
  * @param $filterConfigFile string
  * @return boolean true when successful, otherwise false
  */
 function installFilterConfig($filterConfigFile)
 {
     static $filterHelper = false;
     // Parse the filter configuration.
     $xmlParser = new XMLParser();
     $tree =& $xmlParser->parse($filterConfigFile);
     // Validate the filter configuration.
     if (!$tree) {
         $xmlParser->destroy();
         return false;
     }
     // Get the filter helper.
     if ($filterHelper === false) {
         import('lib.pkp.classes.filter.FilterHelper');
         $filterHelper = new FilterHelper();
     }
     // Are there any filter groups to be installed?
     $filterGroupsNode =& $tree->getChildByName('filterGroups');
     if (is_a($filterGroupsNode, 'XMLNode')) {
         $filterHelper->installFilterGroups($filterGroupsNode);
     }
     // Are there any filters to be installed?
     $filtersNode =& $tree->getChildByName('filters');
     if (is_a($filtersNode, 'XMLNode')) {
         foreach ($filtersNode->getChildren() as $filterNode) {
             /* @var $filterNode XMLNode */
             $filterHelper->configureFilter($filterNode);
         }
     }
     // Get rid of the parser.
     $xmlParser->destroy();
     unset($xmlParser);
     return true;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:39,代码来源:Installer.inc.php

示例10: XMLParser

 /**
  * Parse all scheduled tasks files and
  * save the result object in database.
  */
 function _parseCrontab()
 {
     $xmlParser = new XMLParser();
     $taskFilesPath = array();
     // Load all plugins so any plugin can register a crontab.
     PluginRegistry::loadAllPlugins();
     // Let plugins register their scheduled tasks too.
     HookRegistry::call('AcronPlugin::parseCronTab', array(&$taskFilesPath));
     // Reference needed.
     // Add the default tasks file.
     $taskFilesPath[] = 'registry/scheduledTasks.xml';
     // TODO: make this a plugin setting, rather than assuming.
     $tasks = array();
     foreach ($taskFilesPath as $filePath) {
         $tree = $xmlParser->parse($filePath);
         if (!$tree) {
             $xmlParser->destroy();
             // TODO: graceful error handling
             fatalError('Error parsing scheduled tasks XML file: ' . $filePath);
         }
         foreach ($tree->getChildren() as $task) {
             $frequency = $task->getChildByName('frequency');
             $args = ScheduledTaskHelper::getTaskArgs($task);
             // Tasks without a frequency defined, or defined to zero, will run on every request.
             // To avoid that happening (may cause performance problems) we
             // setup a default period of time.
             $setDefaultFrequency = true;
             $minHoursRunPeriod = 24;
             if ($frequency) {
                 $frequencyAttributes = $frequency->getAttributes();
                 if (is_array($frequencyAttributes)) {
                     foreach ($frequencyAttributes as $key => $value) {
                         if ($value != 0) {
                             $setDefaultFrequency = false;
                             break;
                         }
                     }
                 }
             }
             $tasks[] = array('className' => $task->getAttribute('class'), 'frequency' => $setDefaultFrequency ? array('hour' => $minHoursRunPeriod) : $frequencyAttributes, 'args' => $args);
         }
         $xmlParser->destroy();
     }
     // Store the object.
     $this->updateSetting(0, 'crontab', $tasks, 'object');
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:50,代码来源:PKPAcronPlugin.inc.php

示例11: installSettings

 /**
  * Install plugin settings from an XML file.
  * @param $conferenceId int ID of conference, if applicable
  * @param $schedConfId int ID of scheduled conference, if applicable
  * @param $pluginName name of plugin for settings to apply to
  * @param $filename string Name of XML file to parse and install
  * @param $paramArray array Optional parameters for variable replacement in settings
  */
 function installSettings($conferenceId, $schedConfId, $pluginName, $filename, $paramArray = array())
 {
     $xmlParser = new XMLParser();
     $tree = $xmlParser->parse($filename);
     if (!$tree) {
         $xmlParser->destroy();
         return false;
     }
     foreach ($tree->getChildren() as $setting) {
         $nameNode =& $setting->getChildByName('name');
         $valueNode =& $setting->getChildByName('value');
         if (isset($nameNode) && isset($valueNode)) {
             $type = $setting->getAttribute('type');
             $name =& $nameNode->getValue();
             if ($type == 'object') {
                 $arrayNode =& $valueNode->getChildByName('array');
                 $value = $this->_buildObject($arrayNode, $paramArray);
             } else {
                 $value = $this->_performReplacement($valueNode->getValue(), $paramArray);
             }
             // Replace translate calls with translated content
             $this->updateSetting($conferenceId, $schedConfId, $pluginName, $name, $value, $type);
         }
     }
     $xmlParser->destroy();
 }
开发者ID:sedici,项目名称:ocs,代码行数:34,代码来源:PluginSettingsDAO.inc.php

示例12: XMLParser

 /**
  * Parse a record's contents into an object
  * @param $contents string
  * @return object
  */
 function &parseContents(&$contents)
 {
     $xmlParser = new XMLParser();
     $result =& $xmlParser->parseText($contents);
     $returner = array();
     foreach ($result->getChildren() as $child) {
         $name = $child->getName();
         $value = $child->getValue();
         if (String::substr($name, 0, 6) == 'etdms:') {
             $name = String::substr($name, 3);
         }
         $returner[$name][] = $value;
     }
     $result->destroy();
     $xmlParser->destroy();
     unset($result, $xmlParser);
     return $returner;
 }
开发者ID:ramonsodoma,项目名称:harvester,代码行数:23,代码来源:EtdmsPlugin.inc.php

示例13: parseCrontab

 function parseCrontab()
 {
     $xmlParser = new XMLParser();
     // TODO: make this a plugin setting, rather than assuming.
     $tree = $xmlParser->parse(Config::getVar('general', 'registry_dir') . '/scheduledTasks.xml');
     if (!$tree) {
         $xmlParser->destroy();
         // TODO: graceful error handling
         fatalError('Error parsing scheduled tasks XML.');
     }
     $tasks = array();
     foreach ($tree->getChildren() as $task) {
         $frequency = $task->getChildByName('frequency');
         $args = array();
         $index = 0;
         while (($arg = $task->getChildByName('arg', $index)) != null) {
             array_push($args, $arg->getValue());
             $index++;
         }
         $tasks[] = array('className' => $task->getAttribute('class'), 'frequency' => $frequency ? $frequency->getAttributes() : null, 'args' => $args);
     }
     $xmlParser->destroy();
     // Store the object.
     $this->updateSetting(0, 0, 'crontab', $tasks, 'object');
 }
开发者ID:sedici,项目名称:ocs,代码行数:25,代码来源:AcronPlugin.inc.php

示例14: installSettings

 /**
  * Install plugin settings from an XML file.
  * @param $pluginName name of plugin for settings to apply to
  * @param $filename string Name of XML file to parse and install
  * @param $paramArray array Optional parameters for variable replacement in settings
  */
 function installSettings($contextId, $pluginName, $filename, $paramArray = array())
 {
     $xmlParser = new XMLParser();
     $tree = $xmlParser->parse($filename);
     if (!$tree) {
         $xmlParser->destroy();
         return false;
     }
     // Check for existing settings and leave them if they are already in place.
     $currentSettings = $this->getPluginSettings($contextId, $pluginName);
     foreach ($tree->getChildren() as $setting) {
         $nameNode = $setting->getChildByName('name');
         $valueNode = $setting->getChildByName('value');
         if (isset($nameNode) && isset($valueNode)) {
             $type = $setting->getAttribute('type');
             $name = $nameNode->getValue();
             // If the setting already exists, respect it.
             if (isset($currentSettings[$name])) {
                 continue;
             }
             if ($type == 'object') {
                 $arrayNode = $valueNode->getChildByName('array');
                 $value = $this->_buildObject($arrayNode, $paramArray);
             } else {
                 $value = $this->_performReplacement($valueNode->getValue(), $paramArray);
             }
             // Replace translate calls with translated content
             $this->updateSetting($contextId, $pluginName, $name, $value, $type);
         }
     }
     $xmlParser->destroy();
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:38,代码来源:PluginSettingsDAO.inc.php

示例15: reloadLocalizedDefaultSettings

 /**
  * Install locale field Only journal settings from an XML file.
  * @param $journalId int ID of journal for settings to apply to
  * @param $filename string Name of XML file to parse and install
  * @param $paramArray array Optional parameters for variable replacement in settings
  * @param $locale string locale id for which settings will be loaded
  */
 function reloadLocalizedDefaultSettings($journalId, $filename, $paramArray, $locale)
 {
     $xmlParser = new XMLParser();
     $tree = $xmlParser->parse($filename);
     if (!$tree) {
         $xmlParser->destroy();
         return false;
     }
     foreach ($tree->getChildren() as $setting) {
         $nameNode =& $setting->getChildByName('name');
         $valueNode =& $setting->getChildByName('value');
         if (isset($nameNode) && isset($valueNode)) {
             $type = $setting->getAttribute('type');
             $isLocaleField = $setting->getAttribute('locale');
             $name =& $nameNode->getValue();
             //skip all settings that are not locale fields
             if (!$isLocaleField) {
                 continue;
             }
             if ($type == 'object') {
                 $arrayNode =& $valueNode->getChildByName('array');
                 $value = $this->_buildLocalizedObject($arrayNode, $paramArray, $locale);
             } else {
                 $value = $this->_performLocalizedReplacement($valueNode->getValue(), $paramArray, $locale);
             }
             // Replace translate calls with translated content
             $this->updateSetting($journalId, $name, array($locale => $value), $type, true);
         }
     }
     $xmlParser->destroy();
 }
开发者ID:philschatz,项目名称:ojs,代码行数:38,代码来源:JournalSettingsDAO.inc.php


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