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


PHP JInstaller::isManifest方法代码示例

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


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

示例1: onInstallerViewAfterLastTab

	public function onInstallerViewAfterLastTab()
	{
		if ($this->params->get('tab_position', 0)) {
			$this->getChanges();
		}
		$ishathor = $this->isHathor() ? 1 : 0;
		$installfrom = $this->getInstallFrom();
		$installfromon = $installfrom ? 1 : 0;

		$document = JFactory::getDocument();
		$ver = new JVersion;
		$min = JFactory::getConfig()->get('debug') ? '' : '.min';

		$installer = new JInstaller();
		$manifest = $installer->isManifest(JPATH_PLUGINS . DIRECTORY_SEPARATOR . 'installer' . DIRECTORY_SEPARATOR . 'webinstaller' . DIRECTORY_SEPARATOR . 'webinstaller.xml');

		$apps_base_url = addslashes($this->appsBaseUrl);
		$apps_installat_url = base64_encode(JURI::current(true) . '?option=com_installer&view=install');
		$apps_installfrom_url = addslashes($installfrom);
		$apps_product = base64_encode($ver->PRODUCT);
		$apps_release = base64_encode($ver->RELEASE);
		$apps_dev_level = base64_encode($ver->DEV_LEVEL);
		$btntxt = JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL', true);
		$pv = base64_encode($manifest->version);
		$updatestr1 = JText::_('COM_INSTALLER_WEBINSTALLER_INSTALL_UPDATE_AVAILABLE', true);
		$obsoletestr = JText::_('COM_INSTALLER_WEBINSTALLER_INSTALL_OBSOLETE', true);
		$updatestr2 = JText::_('JLIB_INSTALLER_UPDATE', true);

		$javascript = <<<END
apps_base_url = '$apps_base_url';
apps_installat_url = '$apps_installat_url';
apps_installfrom_url = '$apps_installfrom_url';
apps_product = '$apps_product';
apps_release = '$apps_release';
apps_dev_level = '$apps_dev_level';
apps_is_hathor = $ishathor;
apps_installfromon = $installfromon;
apps_btntxt = '$btntxt';
apps_pv = '$pv';
apps_updateavail1 = '$updatestr1';
apps_updateavail2 = '$updatestr2';
apps_obsolete = '$obsoletestr';

jQuery(document).ready(function() {
	if (apps_installfromon)
	{
		jQuery('#myTabTabs a[href="#web"]').click();
	}
	var link = jQuery('#myTabTabs a[href="#web"]').get(0);
	var eventpoint = jQuery(link).closest('li');
	if (apps_is_hathor)
	{
		jQuery('#mywebinstaller').show();
		link = jQuery('#mywebinstaller a');
		eventpoint = link;
	}

	jQuery(eventpoint).click(function (event){
		if (!Joomla.apps.loaded) {
			Joomla.apps.initialize();
		}
	});
	
	if (apps_installfrom_url != '') {
		var tag = 'li';
		if (apps_is_hathor)
		{
			tag = 'a';
		}
		jQuery(link).closest(tag).click();
	}

	if (!apps_is_hathor)
	{
		if(typeof jQuery('#myTabTabs a[href="'+localStorage.getItem('tab-href')+'"]').prop('tagName') == 'undefined' ||
			localStorage.getItem('tab-href') == null ||
			localStorage.getItem('tab-href') == 'undefined' ||
			!localStorage.getItem('tab-href')) {
			window.localStorage.setItem('tab-href', jQuery('#myTabTabs a').get(0).href.replace(/^.+?#/, '#'));
		}
	
		if (apps_installfrom_url == '' && localStorage.getItem('tab-href') == '#web')
		{
			jQuery('#myTabTabs li').each(function(index, value){
				value.removeClass('active');
			});
			jQuery(eventpoint).addClass('active');
			window.localStorage.setItem('tab-href', jQuery(eventpoint).children('a').attr('href'));
			if (jQuery(eventpoint).children('a').attr('href') == '#web')
			{
				jQuery(eventpoint).click();
			}
		}
	}
});

		
END;

		$document->addScriptDeclaration($javascript);
//.........这里部分代码省略.........
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:101,代码来源:webinstaller.php

示例2: rebuild

 /**
  * Rebuild update sites tables.
  *
  * @return  void
  *
  * @since   3.6
  *
  * @throws  Exception on ACL error
  */
 public function rebuild()
 {
     if (!JFactory::getUser()->authorise('core.admin', 'com_installer')) {
         throw new Exception(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_NOT_PERMITTED'), 403);
     }
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     // Check if Joomla Extension plugin is enabled.
     if (!JPluginHelper::isEnabled('extension', 'joomla')) {
         $query = $db->getQuery(true)->select($db->quoteName('extension_id'))->from($db->quoteName('#__extensions'))->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))->where($db->quoteName('element') . ' = ' . $db->quote('joomla'))->where($db->quoteName('folder') . ' = ' . $db->quote('extension'));
         $db->setQuery($query);
         $pluginId = (int) $db->loadResult();
         $link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $pluginId);
         $app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_REBUILD_EXTENSION_PLUGIN_NOT_ENABLED', $link), 'error');
         return;
     }
     $clients = array(JPATH_SITE, JPATH_ADMINISTRATOR);
     $extensionGroupFolders = array('components', 'modules', 'plugins', 'templates', 'language', 'manifests');
     $pathsToSearch = array();
     // Identifies which folders to search for manifest files.
     foreach ($clients as $clientPath) {
         foreach ($extensionGroupFolders as $extensionGroupFolderName) {
             // Components, modules, plugins, templates, languages and manifest (files, libraries, etc)
             if ($extensionGroupFolderName != 'plugins') {
                 foreach (glob($clientPath . '/' . $extensionGroupFolderName . '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $extensionFolderPath) {
                     array_push($pathsToSearch, $extensionFolderPath);
                 }
             } else {
                 foreach (glob($clientPath . '/' . $extensionGroupFolderName . '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $pluginGroupFolderPath) {
                     foreach (glob($pluginGroupFolderPath . '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $extensionFolderPath) {
                         array_push($pathsToSearch, $extensionFolderPath);
                     }
                 }
             }
         }
     }
     // Gets Joomla core update sites Ids.
     $joomlaUpdateSitesIds = implode(', ', $this->getJoomlaUpdateSitesIds(0));
     // Delete from all tables (except joomla core update sites).
     $query = $db->getQuery(true)->delete($db->quoteName('#__update_sites'))->where($db->quoteName('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')');
     $db->setQuery($query);
     $db->execute();
     $query = $db->getQuery(true)->delete($db->quoteName('#__update_sites_extensions'))->where($db->quoteName('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')');
     $db->setQuery($query);
     $db->execute();
     $query = $db->getQuery(true)->delete($db->quoteName('#__updates'))->where($db->quoteName('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')');
     $db->setQuery($query);
     $db->execute();
     $count = 0;
     // Gets Joomla core extension Ids.
     $joomlaCoreExtensionIds = implode(', ', $this->getJoomlaUpdateSitesIds(1));
     // Search for updateservers in manifest files inside the folders to search.
     foreach ($pathsToSearch as $extensionFolderPath) {
         $tmpInstaller = new JInstaller();
         $tmpInstaller->setPath('source', $extensionFolderPath);
         // Main folder manifests (higher priority)
         $parentXmlfiles = JFolder::files($tmpInstaller->getPath('source'), '.xml$', false, true);
         // Search for children manifests (lower priority)
         $allXmlFiles = JFolder::files($tmpInstaller->getPath('source'), '.xml$', 1, true);
         // Create an unique array of files ordered by priority
         $xmlfiles = array_unique(array_merge($parentXmlfiles, $allXmlFiles));
         if (!empty($xmlfiles)) {
             foreach ($xmlfiles as $file) {
                 // Is it a valid Joomla installation manifest file?
                 $manifest = $tmpInstaller->isManifest($file);
                 if (!is_null($manifest)) {
                     // Search if the extension exists in the extensions table. Excluding joomla core extensions (id < 10000) and discovered extensions.
                     $query = $db->getQuery(true)->select($db->quoteName('extension_id'))->from($db->quoteName('#__extensions'))->where($db->quoteName('name') . ' = ' . $db->quote($manifest->name))->where($db->quoteName('type') . ' = ' . $db->quote($manifest['type']))->where($db->quoteName('extension_id') . ' NOT IN (' . $joomlaCoreExtensionIds . ')')->where($db->quoteName('state') . ' != -1');
                     $db->setQuery($query);
                     $eid = (int) $db->loadResult();
                     if ($eid && $manifest->updateservers) {
                         // Set the manifest object and path
                         $tmpInstaller->manifest = $manifest;
                         $tmpInstaller->setPath('manifest', $file);
                         // Load the extension plugin (if not loaded yet).
                         JPluginHelper::importPlugin('extension', 'joomla');
                         // Fire the onExtensionAfterUpdate
                         JFactory::getApplication()->triggerEvent('onExtensionAfterUpdate', array('installer' => $tmpInstaller, 'eid' => $eid));
                         $count++;
                     }
                 }
             }
         }
     }
     if ($count > 0) {
         $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_SUCCESS'), 'message');
     } else {
         $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_MESSAGE'), 'message');
     }
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:99,代码来源:updatesites.php

示例3: getComponentManifestFile

 function getComponentManifestFile($com)
 {
     $short_element = str_replace('com_', '', $com);
     $manifestPath = JPATH_ADMINISTRATOR . '/components/' . $com . '/' . 'manifest.xml';
     $shortElementManifestPath = JPATH_ADMINISTRATOR . '/components/' . $com . '/' . $short_element . '.xml';
     if (JFile::exists($manifestPath)) {
         $file = $manifestPath;
     }
     if (JFile::exists($shortElementManifestPath)) {
         $file = $shortElementManifestPath;
     }
     if (empty($file)) {
         return false;
     }
     $installer = new JInstaller();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6+ code here
         $manifest = $installer->isManifest($file);
     } else {
         // Joomla! 1.5 code here
         $manifest = $installer->_isManifest($file);
     }
     return $manifest;
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:24,代码来源:installer.php

示例4: testIsManifest

 /**
  * Tests the isManifest method
  *
  * @since   3.1
  *
  * @return  void
  */
 public function testIsManifest()
 {
     $this->assertThat($this->object->isManifest(__DIR__ . '/data/pkg_joomla.xml'), $this->isInstanceOf('SimpleXmlElement'), 'Ensure JInstaller::isManifest properly tests a valid manifest file');
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:11,代码来源:JInstallerTest.php

示例5: install

 function install()
 {
     $extDir = JPATH_ROOT . '/components/com_sef/sef_ext';
     $db = $this->parent->getDBO();
     $this->manifest =& $this->parent->getManifest();
     $xml = $this->manifest;
     $name = (string) $xml->name;
     $name = JFilterInput::getInstance()->clean($name, 'string');
     $this->set('name', $name);
     $description = (string) $xml->description;
     if (is_a($description, 'JSimpleXMLElement')) {
         $this->parent->set('message', JText::_($description));
     } else {
         $this->parent->set('message', '');
     }
     if (count($xml->files->children())) {
         foreach ($xml->files->children() as $file) {
             if ((string) $file->attributes()->sef_ext) {
                 $element = (string) $file->attributes()->sef_ext;
                 if (substr($element, 0, 13) != 'ext_joomsef4_') {
                     $element = 'ext_joomsef4_' . $element;
                 }
                 $this->set('element', $element);
                 break;
             }
         }
     }
     if (!empty($element)) {
         $this->parent->setPath('extension_root', $extDir);
     } else {
         $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEFEXT_INSTALL_NO_FILE', JText::_('JLIB_INSTALLER_' . $this->route)));
         return false;
     }
     $this->route = 'install';
     $query = "SELECT extension_id, state, params \n";
     $query .= "FROM #__extensions \n";
     $query .= "WHERE type=" . $db->quote('sef_ext') . " \n";
     $query .= "AND element=" . $db->quote($element);
     $db->setQuery($query);
     $ext_o = $db->loadObject();
     if (!is_null($ext_o)) {
         $id = $ext_o->extension_id;
     } else {
         $id = null;
     }
     if (file_exists($this->parent->getPath('extension_root')) && (!$this->parent->isOverwrite() || $this->parent->isUpgrade())) {
         if ($this->parent->isUpgrade() || ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'update') || is_a($xml->update, 'SimpleXMLElement'))) {
             $this->parent->setOverwrite(true);
             $this->parent->setUpgrade(true);
             if ($id && $ext_o->state != -2) {
                 $this->route = 'update';
             }
         } else {
             if (!$this->parent->isOverwrite()) {
                 $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEFEXT_INSTALL_DIRECTORY', JText::_('JLIB_INSTALLER_' . $this->route), $this->parent->getPath('extension_root')));
             }
         }
     }
     if ((string) $xml->scriptfile) {
         $script = (string) $xml->scriptfile;
         $script_file = $this->parent->getPath('source') . '/' . $script;
         if (is_file($script_file)) {
             include_once $script_file;
             $class = $element . 'InstallerScript';
             if (class_exists($class)) {
                 $this->parent->manifestClass = new $class($this);
                 $this->set('manifest_script', $script);
             }
         }
     }
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) {
         if ($this->parent->manifestClass->preflight($this->route, $this) === false) {
             $this->parent->abort(JText::_('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_CUSTOM_INSTALL_FAILURE'));
             return false;
         }
     }
     $msg = ob_get_contents();
     ob_end_clean();
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (JFolder::create($this->parent->getPath('extension_root'))) {
             $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_CREATE_DIRECTORY', $this->parent->getPath('extension_root')));
             return false;
         }
     }
     $this->old_files = null;
     if ($this->route == 'update') {
         $old = null;
         $tmp = new JInstaller();
         $option = str_replace('ext_joomsef4_', 'com_', $this->get('element'));
         $tmp_manifest = $tmp->isManifest($this->parent->getPath('extension_root') . '/' . $option . '.xml');
         if ($tmp_manifest) {
             $this->old_files = $tmp_manifest->files;
         }
     }
     if (!$this->parent->parseFiles($xml->files, -1, $this->old_files)) {
         $this->parent->abort();
         return false;
     }
//.........这里部分代码省略.........
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:101,代码来源:sef_ext.php


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