本文整理汇总了PHP中XenForo_Helper_DevelopmentXml::scanFile方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Helper_DevelopmentXml::scanFile方法的具体用法?PHP XenForo_Helper_DevelopmentXml::scanFile怎么用?PHP XenForo_Helper_DevelopmentXml::scanFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Helper_DevelopmentXml
的用法示例。
在下文中一共展示了XenForo_Helper_DevelopmentXml::scanFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
}
示例4: 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);
}
示例5: importOptionsDevelopmentXml
/**
* Imports the options development XML data.
*
* @param string $fileName File to read the XML from
*/
public function importOptionsDevelopmentXml($fileName)
{
$document = XenForo_Helper_DevelopmentXml::scanFile($fileName);
$this->importOptionsAddOnXml($document, 'XenForo');
}
示例6: 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');
}
示例7: 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);
}
示例8: importAdminNavigationDevelopmentXml
/**
* Imports the development admin navigation XML data.
*
* @param string $fileName File to read the XML from
*/
public function importAdminNavigationDevelopmentXml($fileName)
{
$document = XenForo_Helper_DevelopmentXml::scanFile($fileName);
$this->importAdminNavigationAddOnXml($document, 'XenForo');
}
示例9: readMetaDataFile
/**
* Reads all of the meta-data out of the specified file.
*
* @param string $metaDataFile Path to meta data file
*
* @return array Format: [title] => meta-data
*/
public static function readMetaDataFile($metaDataFile)
{
if (file_exists($metaDataFile)) {
$metaData = array();
$xml = XenForo_Helper_DevelopmentXml::scanFile($metaDataFile);
foreach ($xml->item as $tag) {
$title = (string) $tag['title'];
if (isset($metaData[$title])) {
continue;
// give precedence to earlier entries as they are more up to date
}
$attributes = array();
foreach ($tag->attributes() as $key => $value) {
$attributes[(string) $key] = (string) $value;
}
$metaData[$title] = $attributes;
}
} else {
$metaData = array();
}
return $metaData;
}