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


PHP AEPlatform::get_installer_images_path方法代码示例

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


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

示例1: getInstallerList

	public static function getInstallerList()
	{
		// This is a static cache which persists between subsequent calls, but not
		// between successive page loads.
		static $installer_list = array();

		// Try to serve cached data first
		if(!empty($installer_list) && is_array($installer_list))
		{
			if(count($installer_list) > 0) return $installer_list;
		}

		// Find absolute path to normal and plugins directories
		$ds = DIRECTORY_SEPARATOR;
		$path_list = array(
			AEPlatform::get_installer_images_path()
		);

		// Initialize the array where we store our data
		$installer_list = array();

		// Loop for the paths where engines can be found
		foreach($path_list as $path)
		{
			if(is_dir($path))
			{
				if(is_readable($path))
				{
					if( $handle = @opendir($path) )
					{
						while(false !== $filename = @readdir($handle))
						{
							if( (strtolower(substr($filename, -4)) == '.ini') && @is_file($path.$ds.$filename) )
							{
								$data = AEUtilINI::parse_ini_file($path.$ds.$filename, true);
								foreach($data as $key => $values)
								{
									$installer_list[$key] = array();
									foreach($values as $key2 => $value)
									{
										$installer_list[$key][$key2]=$value;
									}
								}
							}
						} // while readdir
						@closedir($handle);
					} // if opendir
				} // if readable
			} // if is_dir
		}

		return $installer_list;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:53,代码来源:inihelper.php

示例2: transformJPA

	/**
	 * Transforms a JPA archive (containing an installer) to the native archive format
	 * of the class. It actually extracts the source JPA in memory and instructs the
	 * class to include each extracted file.
	 *
	 * @param int $offset The source JPA archive's offset to use
	 * @return boolean False if an error occured, true otherwise
	 */
	public final function transformJPA( $offset )
	{
		// Do we have to open the file?
		if(!$this->_xform_fp)
		{
			// Get the source path
			$registry =& AEFactory::getConfiguration();
			$embedded_installer = $registry->get('akeeba.advanced.embedded_installer');
			
			// Fetch the name of the installer image
			$installerDescriptors = AEUtilInihelper::getInstallerList();
			$xform_source = AEPlatform::get_installer_images_path().DIRECTORY_SEPARATOR.
					'foobar.jpa'; // We need this as a "safe fallback"
			if(array_key_exists($embedded_installer, $installerDescriptors)) {
				$package = $installerDescriptors[$embedded_installer]['package'];
				if(empty($package)) {
					// No installer package specified. Pretend we are done!
					$retArray = array(
						"filename"			=> '',		// File name extracted
						"data"				=> '',		// File data
						"offset"			=> 0,		// Offset in ZIP file
						"skip"              => false,   // Skip this?
						"done"				=> true,	// Are we done yet?
						"filesize"			=> 0
					);
					return $retArray;
				} else {
					// A package is specified, use it!
					$xform_source = AEPlatform::get_installer_images_path().DIRECTORY_SEPARATOR.
						$package;
				}
			}
			
			// 2.3: Try to use sane default if the indicated installer doesn't exist
			if( !file_exists($xform_source) && (basename($xform_source) != 'abi.jpa') )
			{
				$this->setWarning(__CLASS__ . ":: Selected embedded installer not found, using ABI instead");
				$xform_source = dirname($xform_source).DS.'abi.jpa';
			}

			// Try opening the file
			if( file_exists($xform_source) )
			{
				$this->_xform_fp = @fopen( $xform_source, 'r');
				if( $this->_xform_fp === false )
				{
					$this->setError(__CLASS__ . ":: Can't seed archive with installer package ".$xform_source);
					return false;
				}
			} else {
				$this->setError(__CLASS__ . ":: Installer package ".$xform_source." does not exist!");
				return false;
			}
		}

		if(!$offset)
		{
			// First run detected!
			AEUtilLogger::WriteLog(_AE_LOG_DEBUG, 'Initializing with JPA package ');

			$offset = 0;

			// Skip over the header and check no problem exists
			$offset = $this->_xformReadHeader();
			if($offset === false)
			{
				$this->setError('JPA package file was not read');
				return false; // Oops! The package file doesn't exist or is corrupt
			}
		}

		$ret =& $this->_xformExtract($offset);
		if(is_array($ret))
		{
			$offset = $ret['offset'];
			if(!$ret['skip'] && !$ret['done'])
			{
				AEUtilLogger::WriteLog(_AE_LOG_DEBUG, '  Adding '.$ret['filename'] . '; Next offset:'.$offset);
				$this->addVirtualFile($ret['filename'], '', $ret['data']);
				if($this->getError()) return false;
			}
			else
			{
				$reason = $ret['done'] ? 'Done' : '  Skipping '.$ret['filename'];
				AEUtilLogger::WriteLog(_AE_LOG_DEBUG, $reason);
			}
		}
		else
		{
			$this->setError('JPA extraction returned FALSE');
			return false;
		}
//.........这里部分代码省略.........
开发者ID:rkern21,项目名称:videoeditor,代码行数:101,代码来源:archiver.php


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