本文整理汇总了PHP中Gantry\Component\Filesystem\Folder::shift方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::shift方法的具体用法?PHP Folder::shift怎么用?PHP Folder::shift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gantry\Component\Filesystem\Folder
的用法示例。
在下文中一共展示了Folder::shift方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
use Gantry\Component\Filesystem\Folder;
define('PRIME_ROOT', dirname($_SERVER['SCRIPT_FILENAME']));
define('PRIME_URI', dirname($_SERVER['SCRIPT_NAME']));
date_default_timezone_set('UTC');
// Bootstrap Gantry framework or fail gracefully (inside included file).
$gantry = (include_once PRIME_ROOT . '/includes/gantry.php');
// Get current theme and path.
$path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : Folder::getRelativePath($_SERVER['REQUEST_URI'], PRIME_URI);
$path = explode('?', $path, 2);
$path = reset($path);
$extension = strrchr(basename($path), '.');
if ($extension) {
$path = substr($path, 0, -strlen($extension));
}
$theme = strpos($path, 'admin') !== 0 ? Folder::shift($path) : null;
define('THEME', $theme);
define('PAGE_PATH', $path ?: ($theme ? 'home' : ''));
define('PAGE_EXTENSION', trim($extension, '.') ?: 'html');
// Bootstrap selected theme.
$include = PRIME_ROOT . "/themes/{$theme}/includes/gantry.php";
if (is_file($include)) {
include $include;
}
// Enter to administration if we are in /ROOT/theme/admin. Also display installed themes if no theme has been selected.
if (!isset($gantry['theme']) || strpos($path, 'admin') === 0) {
require_once PRIME_ROOT . '/admin/admin.php';
exit;
}
// Boot the service.
/** @var Gantry\Framework\Theme $theme */