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


PHP AEPlatform::get_stock_directories方法代码示例

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


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

示例1: _run

	protected function _run()
	{
		// Run in a loop until we run out of time, or breakflag is set
		$registry =& AEFactory::getConfiguration();
		$timer =& AEFactory::getTimer();

		while( ($timer->getTimeLeft() > 0) && (!$registry->get('volatile.breakflag', false)) )
		{
			if ($this->getState() == 'postrun') {
				AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__." :: Already finished");
				$this->setStep("-");
				$this->setSubstep("");
				break;
			}
			else
			{
				if($this->done_scanning)
				{
					$this->pack_files();
					if($this->getError()) return false;
				}
				else
				{
					$result = $this->scan_directory();
					if($this->getError()) return false;
					if(!$result)
					{
						// We have finished with our directory list. Hmm... Do we have extra directories?
						if(count($this->root_definitions) > 0)
						{
							AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "More off-site directories detected");
							$registry =& AEFactory::getConfiguration();
							$dir_definition = array_shift($this->root_definitions);

							$this->remove_path_prefix = $dir_definition[0]; // Remove absolute path to directory when storing the file
							if(is_null($dir_definition[1]))
							{
								$this->path_prefix = ''; // No added path for main site
							}
							else
							{
								$this->path_prefix = $registry->get('akeeba.advanced.virtual_folder').'/'.$dir_definition[1];
							}

							$this->done_scanning = false; // Make sure we process this file list!
							$this->root = $dir_definition[0];

							// Translate the root into an absolute path
							$stock_dirs = AEPlatform::get_stock_directories();
							$absolute_dir = substr($this->root,0);
							if(!empty($stock_dirs))
							{
								foreach($stock_dirs as $key => $replacement)
								{
									$absolute_dir = str_replace($key, $replacement, $absolute_dir);
								}
							}
							$this->directory_list[] = $absolute_dir;
							$this->remove_path_prefix = $absolute_dir;

							$registry->set('volatile.filesystem.current_root', $absolute_dir);
							
							$this->total_files = 0;
							$this->done_files = 0;
							$this->total_folders = 0;
							$this->done_folders = 0;
							
							AEUtilLogger::WriteLog(_AE_LOG_INFO, "Including new off-site directory to ".$dir_definition[1]);
						}
						else
						// Nope, we are completely done!
						$this->setState('postrun');
					} // if not result
				} // if not doneScanning
			} // if not postrun
		} // while
		return true;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:78,代码来源:pack.php

示例2: q203

	/**
	 * Q203 - MED  - Default output directory in use
	 *
	 * @return bool
	 */
	private static function q203()
	{
		$stock_dirs = AEPlatform::get_stock_directories();

		$registry =& AEFactory::getConfiguration();
		$outdir = $registry->get('akeeba.basic.output_directory');
		foreach( $stock_dirs as $macro => $replacement )
		{
			$outdir = str_replace($macro, $replacement, $outdir);
		}

		$default = $stock_dirs['[DEFAULT_OUTPUT]'];

		$outdir = AEUtilFilesystem::TranslateWinPath($outdir);
		$default = AEUtilFilesystem::TranslateWinPath($default);

		return $outdir == $default;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:23,代码来源:quirks.php

示例3: substr

	/**
	 * Returns a listing of contained directories and files, as well as their
	 * exclusion status
	 * @param string $root The root directory
	 * @param string $node The subdirectory to scan
	 * @return array
	 */
	private function &get_listing($root, $node)
	{
		// Initialize the absolute directory root
		$directory = substr($root,0);
		// Replace stock directory tags, like [SITEROOT]
		$stock_dirs = AEPlatform::get_stock_directories();
		if(!empty($stock_dirs))
		{
			foreach($stock_dirs as $key => $replacement)
			{
				$directory = str_replace($key, $replacement, $directory);
			}
		}
		$directory = AEUtilFilesystem::TranslateWinPath($directory);
		// Clean and add the node
		$node = AEUtilFilesystem::TranslateWinPath($node);
		if( ($node == '/') ) $node = ''; // Just a dir. sep. is treated as no dir at all
		// Trim leading and trailing slashes
		$node = trim($node, '/');
		// Add node to directory
		if( !empty($node) )	$directory .= '/'.$node;

		// Add any required trailing slash to the node to be used below
		if(!empty($node)) $node .= '/';

		// Get a filters instance
		$filters = AEFactory::getFilters();

		// Detect PHP 5.2.5or earlier, with broken json_decode implementation
		$phpversion = PHP_VERSION;
		$vparts = explode('.',$phpversion);
		if(
			(($vparts[0] == 5) && ($vparts[1] == 2) && ($vparts[2] <= 5)) ||
			(($vparts[0] == 5) && ($vparts[1] == 1) )
		)
		{
			define('AKEEBA_SAFE_JSON',false);
			require_once JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'jsonlib.php';
		}
		else
		{
			$test = '-test-';
			$tj = json_encode($test);
			$test = json_decode($test);
			if($test == '-test-') {
				define('AKEEBA_SAFE_JSON',true);
			} else {
				define('AKEEBA_SAFE_JSON',false);
				require_once JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers'.DS.'jsonlib.php';
			}
		}

		// Get a listing of folders and process it
		$folders =& AEUtilScanner::getFolders($directory);
		asort($folders);
		$folders_out = array();
		if(!empty($folders))
		{
			foreach($folders as $folder)
			{
				$folder = AEUtilFilesystem::TranslateWinPath($folder);
				// Filter out files whose names result to an empty JSON representation
				if(AKEEBA_SAFE_JSON)
				{
					$json_folder = json_encode($folder);
					$folder = json_decode($json_folder);
				}
				else
				{
					$jsonobj = new Akeeba_Services_JSON(0);
					$json_folder = $jsonobj->encode($folder);
					$folder = $jsonobj->decode($json_folder);
				}
				if(empty($folder)) continue;

				$test = $node.$folder;
				$status = array();

				// Check dir/all filter (exclude)
				$result = $filters->isFilteredExtended($test, $root, 'dir', 'all', $byFilter);
				$status['directories'] = (!$result) ? 0 : (( $byFilter == 'directories' ) ? 1 : 2 );

				// Check dir/content filter (skip_files)
				$result = $filters->isFilteredExtended($test, $root, 'dir', 'content', $byFilter);
				$status['skipfiles'] = (!$result) ? 0 : (( $byFilter == 'skipfiles' ) ? 1 : 2 );

				// Check dir/children filter (skip_dirs)
				$result = $filters->isFilteredExtended($test, $root, 'dir', 'children', $byFilter);
				$status['skipdirs'] = (!$result) ? 0 : (( $byFilter == 'skipdirs' ) ? 1 : 2 );

				// Add to output array
				$folders_out[$folder] = $status;
			}
//.........这里部分代码省略.........
开发者ID:rkern21,项目名称:videoeditor,代码行数:101,代码来源:fsfilter.php

示例4: translateStockDirs

	static function translateStockDirs( $folder, $translate_win_dirs = false, $trim_trailing_slash = false )
	{
		static $stock_dirs;
		if(empty($stock_dirs))
		{
			$stock_dirs = AEPlatform::get_stock_directories();
		}

		$temp = $folder;
		foreach($stock_dirs as $find => $replace)
		{
			$temp = str_replace($find, $replace, $temp);
		}
		if($translate_win_dirs)
		{
			$temp = self::TranslateWinPath( $temp );
		}
		if( $trim_trailing_slash )
		{
			$temp = self::TrimTrailingSlash( $temp );
		}
		return $temp;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:23,代码来源:filesystem.php

示例5: display

	function display()
	{
		jimport('joomla.filesystem.folder');
		jimport('joomla.filesystem.path');

		// Get the folder to browse
		$folder = JRequest::getString('folder', '');
		$processfolder = JRequest::getInt('processfolder', 0);

		if(empty($folder))
		{
			$folder = '';
			$folder_raw = '';
			$isFolderThere = false;
			$isInRoot = false;
			$isOpenbasedirRestricted = false;
		}
		else
		{
			$stock_dirs = AEPlatform::get_stock_directories();
			arsort($stock_dirs);

			if($processfolder == 1)
			{
				foreach($stock_dirs as $find => $replace)
				{
					$folder = str_replace($find, $replace, $folder);
				}
			}

			// Normalise name, but only if realpath() really, REALLY works...
			$old_folder = $folder;
			$folder = @realpath($folder);
			if($folder === false) $folder = $old_folder;

			if(AEUtilFilesystem::folderExists($folder))
			{
				$isFolderThere = true;
			}
			else
			{
				$isFolderThere = false;
			}
			JRequest::setVar('folder', $folder);

			// Check if it's a subdirectory of the site's root
			$isInRoot = (strpos($folder, JPATH_SITE) === 0);

			// Check open_basedir restrictions
			$isOpenbasedirRestricted = AEUtilQuirks::checkOpenBasedirs($folder);

			// -- Get the meta form of the directory name, if applicable
			$folder_raw = $folder;
			foreach($stock_dirs as $replace => $find)
			{
				$folder_raw = str_replace($find, $replace, $folder_raw);
			}

		}

		// Writable check and contents listing if it's in site root and not restricted
		if($isFolderThere && !$isOpenbasedirRestricted)
		{
			// Get writability status
			$isWritable = is_writable($folder);

			// Get contained folders
			$subfolders = JFolder::folders($folder);
		}
		else
		{
			if($isFolderThere && !$isOpenbasedirRestricted)
			{
				$isWritable = is_writable($folder);
			}
			else
			{
				$isWritable = false;
			}

			$subfolders = array();
		}

		// Get parent directory
		$pathparts = explode(DS, $folder);
		if(is_array($pathparts))
		{
			$path = '';
			foreach($pathparts as $part)
			{
				$path .= empty($path) ? $part : DS.$part;
				if(empty($part)) {
					if( DS != '\\' ) $path = DS;
					$part = DS;
				}
				$crumb['label'] = $part;
				$crumb['folder'] = $path;
				$breadcrumbs[]=$crumb;
			}

//.........这里部分代码省略.........
开发者ID:rkern21,项目名称:videoeditor,代码行数:101,代码来源:view.html.php

示例6: set

	/**
	 * Set a registry value
	 * @param	string	$regpath 	Registry Path (e.g. global.directory.temporary)
	 * @param 	mixed	$value		Value of entry
	 * @param	bool	$process_special_vars Optional. If true (default), it processes special variables, e.g. [SITEROOT] in folder names
	 * @return 	mixed	Value of old value or boolean false if operation failed
	 */
	public function set($regpath, $value, $process_special_vars = true)
	{
		// Cache the platform-specific stock directories
		static $stock_directories = array();
		if(empty($stock_directories))
		{
			$stock_directories = AEPlatform::get_stock_directories();
		}

		// Explode the registry path into an array
		$nodes = explode('.', $regpath);

		// Get the namespace
		$count = count($nodes);

		if ($count < 2) {
			$namespace = $this->defaultNameSpace;
		} else {
			$namespace = array_shift($nodes);
			$count--;
		}

		if (!isset($this->registry[$namespace])) {
			$this->makeNameSpace($namespace);
		}

		$ns = $this->registry[$namespace]['data'];

		$pathNodes = $count - 1;

		if ($pathNodes < 0) {
			$pathNodes = 0;
		}

		for ($i = 0; $i < $pathNodes; $i ++)
		{
			// If any node along the registry path does not exist, create it
			if (!isset($ns->$nodes[$i])) {
				$ns->$nodes[$i] = new stdClass();
			}
			$ns = $ns->$nodes[$i];
		}

		// Set the new values
		if(is_string($value))
		{
			if(substr($value,0,10) == '###json###')
			{
				$value = json_decode(substr($value,10));
			}
		}

		// Post-process certain directory-containing variables
		if( $process_special_vars && in_array($regpath, $this->directory_containing_keys) )
		{
			if(!empty($stock_directories))
			{
				$data = $value;
				foreach($stock_directories as $tag => $content)
				{
					$data = str_replace($tag, $content, $data);
				}
				$ns->$nodes[$i] = $data;
				return $ns->$nodes[$i];
			}
		}

		// This is executed if any of the previous two if's is false

		$ns->$nodes[$i] = $value;
		return $ns->$nodes[$i];
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:79,代码来源:configuration.php


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