本文整理汇总了PHP中Akeeba\Engine\Factory::getAkeebaRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getAkeebaRoot方法的具体用法?PHP Factory::getAkeebaRoot怎么用?PHP Factory::getAkeebaRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akeeba\Engine\Factory
的用法示例。
在下文中一共展示了Factory::getAkeebaRoot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Public constructor, loads filter data and filter classes
*/
public function __construct()
{
// Load filter data from platform's database
Factory::getLog()->log(LogLevel::DEBUG, 'Fetching filter data from database');
$this->filter_registry = Platform::getInstance()->load_filters();
// Load platform, plugin and core filters
$this->filters = array();
$locations = array(Factory::getAkeebaRoot() . '/Filter');
$platform_paths = Platform::getInstance()->getPlatformDirectories();
foreach ($platform_paths as $p) {
$locations[] = $p . '/Filter';
}
Factory::getLog()->log(LogLevel::DEBUG, 'Loading filters');
foreach ($locations as $folder) {
if (!@is_dir($folder)) {
continue;
}
if (!@is_readable($folder)) {
continue;
}
$di = new \DirectoryIterator($folder);
foreach ($di as $file) {
if (!$file->isFile()) {
continue;
}
// PHP 5.3.5 and earlier do not support getExtension
//if ($file->getExtension() != 'php')
if (substr($file->getBasename(), -4) != '.php') {
continue;
}
$filename = $file->getFilename();
// Skip filter files starting with dot or dash
if (in_array(substr($filename, 0, 1), array('.', '_'))) {
continue;
}
// Some hosts copy .ini and .php files, renaming them (ie foobar.1.php)
// We need to exclude them, otherwise we'll get a fatal error for declaring the same class twice
$bare_name = $file->getBasename('.php');
if (preg_match('/[^a-zA-Z0-9]/', $bare_name)) {
continue;
}
// Extract filter base name
$filter_name = ucfirst($bare_name);
// This is an abstract class; do not try to create instance
if ($filter_name == 'Base') {
continue;
}
// Skip already loaded filters
if (array_key_exists($filter_name, $this->filters)) {
continue;
}
Factory::getLog()->log(LogLevel::DEBUG, '-- Loading filter ' . $filter_name);
// Add the filter
$this->filters[$filter_name] = Factory::getFilterObject($filter_name);
}
}
// Load platform, plugin and core stacked filters
$locations = array(Factory::getAkeebaRoot() . '/Filter/Stack');
$platform_paths = Platform::getInstance()->getPlatformDirectories();
$platform_stack_paths = array();
foreach ($platform_paths as $p) {
$locations[] = $p . '/Filter';
$locations[] = $p . '/Filter/Stack';
$platform_stack_paths[] = $p . '/Filter/Stack';
}
$config = Factory::getConfiguration();
Factory::getLog()->log(LogLevel::DEBUG, 'Loading optional filters');
foreach ($locations as $folder) {
if (!@is_dir($folder)) {
continue;
}
if (!@is_readable($folder)) {
continue;
}
$di = new \DirectoryIterator($folder);
/** @var \DirectoryIterator $file */
foreach ($di as $file) {
if (!$file->isFile()) {
continue;
}
// PHP 5.3.5 and earlier do not support getExtension
// if ($file->getExtension() != 'php')
if (substr($file->getBasename(), -4) != '.php') {
continue;
}
// Some hosts copy .ini and .php files, renaming them (ie foobar.1.php)
// We need to exclude them, otherwise we'll get a fatal error for declaring the same class twice
$bare_name = strtolower($file->getBasename('.php'));
if (preg_match('/[^A-Za-z0-9]/', $bare_name)) {
continue;
}
// Extract filter base name
if (substr($bare_name, 0, 5) == 'stack') {
$bare_name = substr($bare_name, 5);
}
$filter_name = 'Stack\\Stack' . ucfirst($bare_name);
// Skip already loaded filters
//.........这里部分代码省略.........
示例2: getEnginePartPaths
/**
* Get the paths for a specific section
*
* @param string $section The section to get the path list for (engine, installer, gui, filter)
*
* @return array
*/
public function getEnginePartPaths($section = 'gui')
{
// Create the key if it's not already present
if (!array_key_exists($section, $this->enginePartPaths)) {
$this->enginePartPaths[$section] = array();
}
// Add the defaults if the list is empty
if (empty($this->enginePartPaths[$section])) {
switch ($section) {
case 'engine':
$this->enginePartPaths[$section] = array(Factory::getFilesystemTools()->TranslateWinPath(Factory::getAkeebaRoot()));
break;
case 'installer':
$this->enginePartPaths[$section] = array(Factory::getFilesystemTools()->TranslateWinPath(Platform::getInstance()->get_installer_images_path()));
break;
case 'gui':
// Add core GUI definitions
$this->enginePartPaths[$section] = array(Factory::getFilesystemTools()->TranslateWinPath(Factory::getAkeebaRoot() . '/Core'));
// Add platform GUI definition files
$platform_paths = Platform::getInstance()->getPlatformDirectories();
foreach ($platform_paths as $p) {
$this->enginePartPaths[$section][] = Factory::getFilesystemTools()->TranslateWinPath($p . '/Config');
if (defined('AKEEBA_PRO') && AKEEBA_PRO) {
$this->enginePartPaths[$section][] = Factory::getFilesystemTools()->TranslateWinPath($p . '/Config/Pro');
}
}
break;
case 'filter':
$this->enginePartPaths[$section] = array(Factory::getFilesystemTools()->TranslateWinPath(Factory::getAkeebaRoot() . '/Platform/Filter/Stack'), Factory::getFilesystemTools()->TranslateWinPath(Factory::getAkeebaRoot() . '/Filter/Stack'));
$platform_paths = Platform::getInstance()->getPlatformDirectories();
foreach ($platform_paths as $p) {
$this->enginePartPaths[$section][] = Factory::getFilesystemTools()->TranslateWinPath($p . '/Filter/Stack');
}
break;
}
}
return $this->enginePartPaths[$section];
}