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


PHP VersionCheck::parseVersionXML方法代码示例

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


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

示例1:

 /**
  * Return the current code version.
  * @return Version
  */
 function &getCurrentCodeVersion()
 {
     $versionInfo = VersionCheck::parseVersionXML(VERSION_CODE_PATH);
     if ($versionInfo) {
         $version = $versionInfo['version'];
     } else {
         $version = false;
     }
     return $version;
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:14,代码来源:VersionCheck.inc.php

示例2: executePluginTest

 /**
  * Executes the plug-in test.
  * @param $pluginCategory string
  * @param $pluginDir string
  * @param $pluginName string
  * @param $filterGroups array
  */
 protected function executePluginTest($pluginCategory, $pluginDir, $pluginName, $filterGroups)
 {
     // Make sure that the xml configuration is valid.
     $filterConfigFile = 'plugins/' . $pluginCategory . '/' . $pluginDir . '/filter/' . PLUGIN_FILTER_DATAFILE;
     $this->validateXmlConfig(array('./' . $filterConfigFile, './lib/pkp/' . $filterConfigFile));
     // Make sure that data from earlier tests is being deleted first.
     $filterDao =& DAORegistry::getDAO('FilterDAO');
     /* @var $filterDao FilterDAO */
     foreach ($filterGroups as $filterGroupSymbolic) {
         foreach ($filterDao->getObjectsByGroup($filterGroupSymbolic) as $filter) {
             $filterDao->deleteObject($filter);
         }
         foreach ($filterDao->getObjectsByGroup($filterGroupSymbolic, 0, true) as $filter) {
             $filterDao->deleteObject($filter);
         }
     }
     $filterGroupDao =& DAORegistry::getDAO('FilterGroupDAO');
     /* @var $filterGroupDao FilterGroupDAO */
     foreach ($filterGroups as $filterGroupSymbolic) {
         $filterGroupDao->deleteObjectBySymbolic($filterGroupSymbolic);
     }
     // Mock request and router.
     import('lib.pkp.classes.core.PKPRouter');
     import('classes.core.Request');
     $mockRequest = $this->getMock('Request', array('getRouter', 'getUser'));
     $router = new PKPRouter();
     $mockRequest->expects($this->any())->method('getRouter')->will($this->returnValue($router));
     $mockRequest->expects($this->any())->method('getUser')->will($this->returnValue(null));
     Registry::set('request', $mockRequest);
     // Instantiate the installer.
     import('classes.install.Install');
     $installFile = './lib/pkp/tests/plugins/testPluginInstall.xml';
     $params = $this->getConnectionParams();
     $installer = new Install($params, $installFile, true);
     // Parse the plug-ins version.xml.
     import('lib.pkp.classes.site.VersionCheck');
     self::assertFileExists($versionFile = './plugins/' . $pluginCategory . '/' . $pluginDir . '/version.xml');
     self::assertArrayHasKey('version', $versionInfo =& VersionCheck::parseVersionXML($versionFile));
     self::assertType('Version', $pluginVersion =& $versionInfo['version']);
     $installer->setCurrentVersion($pluginVersion);
     // Install the plug-in.
     self::assertTrue($installer->execute());
     // Reset the hook registry.
     Registry::set('hooks', $nullVar = null);
     // Test whether the installation is idempotent.
     self::assertTrue($installer->execute());
     // Test whether the filter groups have been installed.
     foreach ($filterGroups as $filterGroupSymbolic) {
         // Check the group.
         self::assertType('FilterGroup', $filterGroupDao->getObjectBySymbolic($filterGroupSymbolic), $filterGroupSymbolic);
     }
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:59,代码来源:PluginTestCase.inc.php

示例3: addPluginVersions

 /**
  * Insert or update plugin data in versions
  * and plugin_settings tables.
  * @return boolean
  */
 function addPluginVersions()
 {
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     import('lib.pkp.classes.site.VersionCheck');
     $fileManager = new FileManager();
     $categories = PluginRegistry::getCategories();
     foreach ($categories as $category) {
         PluginRegistry::loadCategory($category);
         $plugins = PluginRegistry::getPlugins($category);
         if (is_array($plugins)) {
             foreach ($plugins as $plugin) {
                 $versionFile = $plugin->getPluginPath() . '/version.xml';
                 if ($fileManager->fileExists($versionFile)) {
                     $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                     $pluginVersion = $versionInfo['version'];
                 } else {
                     $pluginVersion = new Version(1, 0, 0, 0, Core::getCurrentDate(), 1, 'plugins.' . $category, basename($plugin->getPluginPath()), '', 0, $plugin->isSitePlugin());
                 }
                 $versionDao->insertVersion($pluginVersion, true);
             }
         }
     }
     return true;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:29,代码来源:Installer.inc.php

示例4: FileManager

 /**
  * Checks whether the given version file exists and whether it
  * contains valid data. Returns a Version object if everything
  * is ok, otherwise null. If $returnErroMsg is true, returns the
  * error message.
  *
  * @param $versionFile string
  * @param $returnErrorMesg boolean
  * @return Version or null/string if invalid or missing version file
  */
 function &getValidPluginVersionInfo($versionFile, $returnErrorMsg = false)
 {
     $nullVar = null;
     $errorMsg = null;
     $fileManager = new FileManager();
     if ($fileManager->fileExists($versionFile)) {
         $versionInfo =& VersionCheck::parseVersionXML($versionFile);
     } else {
         $errorMsg = 'manager.plugins.versionFileNotFound';
     }
     // Validate plugin name and type to avoid abuse
     if (is_null($errorMsg)) {
         $productType = explode(".", $versionInfo['type']);
         if (count($productType) != 2 || $productType[0] != 'plugins') {
             $errorMsg = 'manager.plugins.versionFileInvalid';
         }
     }
     if (is_null($errorMsg)) {
         $pluginVersion =& $versionInfo['version'];
         $namesToValidate = array($pluginVersion->getProduct(), $productType[1]);
         foreach ($namesToValidate as $nameToValidate) {
             if (!String::regexp_match('/[a-z][a-zA-Z0-9]+/', $nameToValidate)) {
                 $errorMsg = 'manager.plugins.versionFileInvalid';
                 break;
             }
         }
     }
     if ($errorMsg) {
         if ($returnErrorMsg) {
             return $errorMsg;
         } else {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('message', $errorMsg);
             return $nullVar;
         }
     } else {
         return $pluginVersion;
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:49,代码来源:VersionCheck.inc.php

示例5: createData

 /**
  * Create initial required data.
  * @return boolean
  */
 function createData()
 {
     if ($this->getParam('manualInstall')) {
         // Add insert statements for default data
         // FIXME use ADODB data dictionary?
         $this->executeSQL(sprintf('INSERT INTO site (primary_locale, installed_locales) VALUES (\'%s\', \'%s\')', $this->getParam('locale'), join(':', $this->installedLocales)));
         $this->executeSQL(sprintf('INSERT INTO site_settings (setting_name, setting_type, setting_value, locale) VALUES (\'%s\', \'%s\', \'%s\', \'%s\')', 'title', 'string', addslashes(Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), $this->getParam('locale')));
         $this->executeSQL(sprintf('INSERT INTO site_settings (setting_name, setting_type, setting_value, locale) VALUES (\'%s\', \'%s\', \'%s\', \'%s\')', 'contactName', 'string', addslashes(Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), $this->getParam('locale')));
         $this->executeSQL(sprintf('INSERT INTO site_settings (setting_name, setting_type, setting_value, locale) VALUES (\'%s\', \'%s\', \'%s\', \'%s\')', 'contactEmail', 'string', addslashes($this->getParam('adminEmail')), $this->getParam('locale')));
         $this->executeSQL(sprintf('INSERT INTO users (username, first_name, last_name, password, email, date_registered, date_last_login) VALUES (\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\')', $this->getParam('adminUsername'), $this->getParam('adminUsername'), $this->getParam('adminUsername'), Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')), $this->getParam('adminEmail'), Core::getCurrentDate(), Core::getCurrentDate()));
         $this->executeSQL(sprintf('INSERT INTO roles (conference_id, user_id, role_id) VALUES (%d, (SELECT user_id FROM users WHERE username = \'%s\'), %d)', 0, $this->getParam('adminUsername'), ROLE_ID_SITE_ADMIN));
         // Install email template list and data for each locale
         $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
         foreach ($emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename(), true) as $sql) {
             $this->executeSQL($sql);
         }
         foreach ($this->installedLocales as $locale) {
             foreach ($emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale), true) as $sql) {
                 $this->executeSQL($sql);
             }
         }
     } else {
         // Add initial site data
         $locale = $this->getParam('locale');
         $siteDao =& DAORegistry::getDAO('SiteDAO', $this->dbconn);
         $site = new Site();
         $site->setRedirect(0);
         $site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH);
         $site->setPrimaryLocale($locale);
         $site->setInstalledLocales($this->installedLocales);
         $site->setSupportedLocales($this->installedLocales);
         if (!$siteDao->insertSite($site)) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
         $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
         $siteSettingsDao->updateSetting('title', array($locale => Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
         $siteSettingsDao->updateSetting('contactName', array($locale => Locale::translate(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
         $siteSettingsDao->updateSetting('contactEmail', array($locale => $this->getParam('adminEmail')), null, true);
         // Add initial site administrator user
         $userDao =& DAORegistry::getDAO('UserDAO', $this->dbconn);
         $user = new User();
         $user->setUsername($this->getParam('adminUsername'));
         $user->setPassword(Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')));
         $user->setFirstName($user->getUsername());
         $user->setLastName('');
         $user->setEmail($this->getParam('adminEmail'));
         if (!$userDao->insertUser($user)) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
         $roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn);
         $role = new Role();
         $role->setConferenceId(0);
         $role->setUserId($user->getId());
         $role->setRoleId(ROLE_ID_SITE_ADMIN);
         if (!$roleDao->insertRole($role)) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
         // Install email template list and data for each locale
         $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
         $emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename());
         foreach ($this->installedLocales as $locale) {
             $emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale));
         }
         // Add initial plugin data to versions table
         $versionDao =& DAORegistry::getDAO('VersionDAO');
         import('site.VersionCheck');
         $categories = PluginRegistry::getCategories();
         foreach ($categories as $category) {
             PluginRegistry::loadCategory($category, true);
             $plugins = PluginRegistry::getPlugins($category);
             foreach ($plugins as $plugin) {
                 $versionFile = $plugin->getPluginPath() . '/version.xml';
                 if (FileManager::fileExists($versionFile)) {
                     $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                     $pluginVersion = $versionInfo['version'];
                     $pluginVersion->setCurrent(1);
                     $versionDao->insertVersion($pluginVersion);
                 } else {
                     $pluginVersion = new Version();
                     $pluginVersion->setMajor(1);
                     $pluginVersion->setMinor(0);
                     $pluginVersion->setRevision(0);
                     $pluginVersion->setBuild(0);
                     $pluginVersion->setDateInstalled(Core::getCurrentDate());
                     $pluginVersion->setCurrent(1);
                     $pluginVersion->setProductType('plugins.' . $category);
                     $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                     $versionDao->insertVersion($pluginVersion);
                 }
             }
         }
     }
     return true;
//.........这里部分代码省略.........
开发者ID:jalperin,项目名称:ocs,代码行数:101,代码来源:Install.inc.php

示例6: createData

 /**
  * Create initial required data.
  * @return boolean
  */
 function createData()
 {
     // Add initial site data
     $locale = $this->getParam('locale');
     $siteDao =& DAORegistry::getDAO('SiteDAO', $this->dbconn);
     $site = new Site();
     $site->setRedirect(0);
     $site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH);
     $site->setPrimaryLocale($locale);
     $site->setInstalledLocales($this->installedLocales);
     $site->setSupportedLocales($this->installedLocales);
     if (!$siteDao->insertSite($site)) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
     $siteSettingsDao->updateSetting('title', array($locale => __(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
     $siteSettingsDao->updateSetting('contactName', array($locale => __(INSTALLER_DEFAULT_SITE_TITLE)), null, true);
     $siteSettingsDao->updateSetting('contactEmail', array($locale => $this->getParam('adminEmail')), null, true);
     // Add initial site administrator user
     $userDao =& DAORegistry::getDAO('UserDAO', $this->dbconn);
     $user = new User();
     $user->setUsername($this->getParam('adminUsername'));
     $user->setPassword(Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption')));
     $user->setFirstName($user->getUsername());
     $user->setLastName('');
     $user->setEmail($this->getParam('adminEmail'));
     if (!$userDao->insertUser($user)) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     $roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn);
     $role = new Role();
     $role->setConferenceId(0);
     $role->setUserId($user->getId());
     $role->setRoleId(ROLE_ID_SITE_ADMIN);
     if (!$roleDao->insertRole($role)) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     // Install email template list and data for each locale
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename());
     foreach ($this->installedLocales as $locale) {
         $emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale));
     }
     // Add initial plugin data to versions table
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     import('site.VersionCheck');
     $categories = PluginRegistry::getCategories();
     foreach ($categories as $category) {
         PluginRegistry::loadCategory($category, true);
         $plugins = PluginRegistry::getPlugins($category);
         foreach ($plugins as $plugin) {
             $versionFile = $plugin->getPluginPath() . '/version.xml';
             if (FileManager::fileExists($versionFile)) {
                 $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                 $pluginVersion = $versionInfo['version'];
                 $pluginVersion->setCurrent(1);
                 $versionDao->insertVersion($pluginVersion);
             } else {
                 $pluginVersion = new Version();
                 $pluginVersion->setMajor(1);
                 $pluginVersion->setMinor(0);
                 $pluginVersion->setRevision(0);
                 $pluginVersion->setBuild(0);
                 $pluginVersion->setDateInstalled(Core::getCurrentDate());
                 $pluginVersion->setCurrent(1);
                 $pluginVersion->setProductType('plugins.' . $category);
                 $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                 $versionDao->insertVersion($pluginVersion);
             }
         }
     }
     return true;
 }
开发者ID:sedici,项目名称:ocs,代码行数:80,代码来源:Install.inc.php

示例7: addPluginVersions

 /**
  * For 2.3 upgrade:  Add initial plugin data to versions table
  * @return boolean
  */
 function addPluginVersions()
 {
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     import('site.VersionCheck');
     $categories = PluginRegistry::getCategories();
     foreach ($categories as $category) {
         PluginRegistry::loadCategory($category, true);
         $plugins = PluginRegistry::getPlugins($category);
         if (is_array($plugins)) {
             foreach ($plugins as $plugin) {
                 $versionFile = $plugin->getPluginPath() . '/version.xml';
                 if (FileManager::fileExists($versionFile)) {
                     $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                     $pluginVersion = $versionInfo['version'];
                     $pluginVersion->setCurrent(1);
                     $versionDao->insertVersion($pluginVersion);
                 } else {
                     $pluginVersion = new Version();
                     $pluginVersion->setMajor(1);
                     $pluginVersion->setMinor(0);
                     $pluginVersion->setRevision(0);
                     $pluginVersion->setBuild(0);
                     $pluginVersion->setDateInstalled(Core::getCurrentDate());
                     $pluginVersion->setCurrent(1);
                     $pluginVersion->setProductType('plugins.' . $category);
                     $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                     $versionDao->insertVersion($pluginVersion);
                 }
             }
         }
     }
     return true;
 }
开发者ID:philschatz,项目名称:ojs,代码行数:37,代码来源:Upgrade.inc.php

示例8: loadCategoryData

 /**
  * @copydoc CategoryGridHandler::loadCategoryData()
  */
 function loadCategoryData($request, $categoryDataElement, $filter)
 {
     $plugins =& PluginRegistry::loadCategory($categoryDataElement);
     $versionDao = DAORegistry::getDAO('VersionDAO');
     import('lib.pkp.classes.site.VersionCheck');
     $fileManager = new FileManager();
     $notHiddenPlugins = array();
     foreach ((array) $plugins as $plugin) {
         if (!$plugin->getHideManagement()) {
             $notHiddenPlugins[$plugin->getName()] = $plugin;
         }
         $version = $plugin->getCurrentVersion();
         if ($version == null) {
             // this plugin is on the file system, but not installed.
             $versionFile = $plugin->getPluginPath() . '/version.xml';
             if ($fileManager->fileExists($versionFile)) {
                 $versionInfo = VersionCheck::parseVersionXML($versionFile);
                 $pluginVersion = $versionInfo['version'];
             } else {
                 $pluginVersion = new Version(1, 0, 0, 0, Core::getCurrentDate(), 1, 'plugins.' . $plugin->getCategory(), basename($plugin->getPluginPath()), '', 0, $plugin->isSitePlugin());
             }
             $versionDao->insertVersion($pluginVersion, true);
         }
     }
     if (!is_null($filter) && isset($filter['pluginName']) && $filter['pluginName'] != "") {
         // Find all plugins that have the filter name string in their display names.
         $filteredPlugins = array();
         foreach ($notHiddenPlugins as $plugin) {
             /* @var $plugin Plugin */
             $pluginName = $plugin->getDisplayName();
             if (stristr($pluginName, $filter['pluginName']) !== false) {
                 $filteredPlugins[$plugin->getName()] = $plugin;
             }
         }
         return $filteredPlugins;
     }
     return $notHiddenPlugins;
 }
开发者ID:piero-tasso,项目名称:pkp-lib,代码行数:41,代码来源:PluginGridHandler.inc.php

示例9: upgradePlugin

 /**
  * Upgrade a plugin to a newer version from the user's filesystem
  * @param $path string path to plugin Directory
  * @param $templateMgr reference to template manager
  * @return boolean
  */
 function upgradePlugin($path, &$templateMgr)
 {
     $versionFile = $path . VERSION_FILE;
     $templateMgr->assign('error', true);
     $templateMgr->assign('path', 'upgrade');
     if (FileManager::fileExists($versionFile)) {
         $versionInfo =& VersionCheck::parseVersionXML($versionFile);
     } else {
         $templateMgr->assign('message', 'manager.plugins.versionFileNotFound');
         return false;
     }
     $pluginVersion = $versionInfo['version'];
     $pluginName = $versionInfo['application'];
     $category = explode(".", $pluginVersion->getProductType());
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($pluginName);
     if (!$installedPlugin) {
         $templateMgr->assign('message', 'manager.plugins.pleaseInstall');
         return false;
     }
     if (PluginManagementHandler::checkIfNewer($pluginName, $pluginVersion)) {
         $templateMgr->assign('message', 'manager.plugins.installedVersionNewer');
         return false;
     } else {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $pluginName;
         FileManager::rmtree($pluginDest);
         if (FileManager::fileExists($pluginDest, 'dir')) {
             $templateMgr->assign('message', 'manager.plugins.deleteError');
             return false;
         }
         if (!FileManager::copyDir($path, $pluginDest)) {
             $templateMgr->assign('message', 'manager.plugins.copyError');
             return false;
         }
         $upgradeFile = $pluginDest . DIRECTORY_SEPARATOR . UPGRADE_FILE;
         if (FileManager::fileExists($upgradeFile)) {
             $params = PluginManagementHandler::setConnectionParams();
             $installer = new Upgrade($params, $upgradeFile, true);
             if (!$installer->execute()) {
                 $templateMgr->assign('message', array('manager.plugins.upgradeFailed', $installer->getErrorString()));
                 return false;
             }
         }
         $installedPlugin->setCurrent(0);
         $pluginVersion->setCurrent(1);
         $versionDao->insertVersion($pluginVersion);
         $templateMgr->assign('message', array('manager.plugins.upgradeSuccessful', $pluginVersion->getVersionString()));
         $templateMgr->assign('uploaded', true);
         $templateMgr->assign('error', false);
         return true;
     }
 }
开发者ID:jalperin,项目名称:ocs,代码行数:58,代码来源:PluginManagementHandler.inc.php

示例10: explode

 /**
  * Checks whether the given version file exists and whether it
  * contains valid data. Returns a Version object if everything
  * is ok, otherwise null.
  *
  * @param $versionFile string
  * @param $templateMgr TemplateManager
  * @return Version or null if invalid or missing version file
  */
 function &getValidPluginVersionInfo($versionFile, &$templateMgr)
 {
     $nullVar = null;
     if (FileManager::fileExists($versionFile)) {
         $versionInfo =& VersionCheck::parseVersionXML($versionFile);
     } else {
         $templateMgr->assign('message', 'manager.plugins.versionFileNotFound');
         return $nullVar;
     }
     $pluginVersion =& $versionInfo['version'];
     // Validate plugin name and type to avoid abuse
     $productType = explode(".", $versionInfo['type']);
     if (count($productType) != 2 || $productType[0] != 'plugins') {
         return $nullVar;
         $templateMgr->assign('message', 'manager.plugins.versionFileInvalid');
     }
     $namesToValidate = array($pluginVersion->getProduct(), $productType[1]);
     foreach ($namesToValidate as $nameToValidate) {
         if (!String::regexp_match('/[a-z][a-zA-Z0-9]+/', $nameToValidate)) {
             return $nullVar;
             $templateMgr->assign('message', 'manager.plugins.versionFileInvalid');
         }
     }
     return $pluginVersion;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:34,代码来源:VersionCheck.inc.php


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