__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2022 RocketTheme, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
* http://opensource.org/licenses/MIT
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Gantry Framework code that extends GPL code is considered GNU/GPLv2 and later
*/
namespace Gantry\Admin;
use Gantry\Component\Filesystem\Folder;
use Gantry\Component\Theme\ThemeDetails;
use Gantry\Framework\Gantry;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
/**
* Class ThemeList
* @package Gantry\Admin
*/
class ThemeList
{
protected static $items;
/**
* @return array
*/
public static function getThemes()
{
if (!is_array(static::$items)) {
static::loadThemes();
}
return static::$items;
}
/**
* @param string $name
* @return ThemeDetails|null
*/
public static function getTheme($name)
{
if (!is_array(static::$items)) {
static::loadThemes();
}
return isset(static::$items[$name]) ? static::$items[$name] : null;
}
protected static function loadThemes()
{
$gantry = Gantry::instance();
/** @var UniformResourceLocator $locator */
$locator = $gantry['locator'];
/** @var array|ThemeDetails[] $list */
$list = [];
$files = Folder::all('gantry-themes://', ['recursive' => false, 'files' => false]);
natsort($files);
foreach ($files as $theme) {
try {
if ($locator('gantry-themes://' . $theme . '/gantry/theme.yaml')) {
$details = new ThemeDetails($theme);
$details->addStreams();
$details['name'] = $theme;
$details['title'] = $details['details.name'];
$details['preview_url'] = $gantry['platform']->getThemePreviewUrl($theme);
$details['admin_url'] = $gantry['platform']->getThemeAdminUrl($theme);
$details['params'] = [];
$list[$details->name] = $details;
}
} catch (\Exception $e) {
// Do not add broken themes into the list.
continue;
}
}
// Add Thumbnails links after adding all the paths to the locator.
foreach ($list as $details) {
$details['thumbnail'] = $details->getUrl("details.images.thumbnail");
}
static::$items = $list;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Controller | Folder | 0775 |
|
|
| Events | Folder | 0775 |
|
|
| Content.php | File | 4.1 KB | 0775 |
|
| EventListener.php | File | 12.4 KB | 0775 |
|
| Page.php | File | 4.02 KB | 0775 |
|
| Particles.php | File | 5.46 KB | 0775 |
|
| Router.php | File | 4.1 KB | 0775 |
|
| Styles.php | File | 3.9 KB | 0775 |
|
| Theme.php | File | 4 KB | 0775 |
|
| ThemeList.php | File | 2.53 KB | 0775 |
|