__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Timber;
use Timber\Core;
use Timber\Theme;
use Timber\URLHelper;
/**
* Need to display info about your theme? Well you've come to the right place. By default info on the current theme comes for free with what's fetched by `Timber::context()` in which case you can access it your theme like so:
* @example
* ```php
* <?php
* $context = Timber::context();
* Timber::render('index.twig', $context);
* ?>
* ```
* ```twig
* <script src="{{theme.link}}/static/js/all.js"></script>
* ```
* ```html
* <script src="http://example.org/wp-content/themes/my-theme/static/js/all.js"></script>
* ```
* @package Timber
*/
class Theme extends Core {
/**
* @api
* @var string the human-friendly name of the theme (ex: `My Timber Starter Theme`)
*/
public $name;
/**
* @api
* @var string the version of the theme (ex: `1.2.3`)
*/
public $version;
/**
* @api
* @var TimberTheme|bool the TimberTheme object for the parent theme (if it exists), false otherwise
*/
public $parent = false;
/**
* @api
* @var string the slug of the parent theme (ex: `_s`)
*/
public $parent_slug;
/**
* @api
* @var string the slug of the theme (ex: `my-super-theme`)
*/
public $slug;
public $uri;
/**
* @var WP_Theme the underlying WordPress native Theme object
*/
private $theme;
/**
* Constructs a new TimberTheme object. NOTE the TimberTheme object of the current theme comes in the default `Timber::context()` call. You can access this in your twig template via `{{site.theme}}.
* @param string $slug
* @example
* ```php
* <?php
* $theme = new TimberTheme("my-theme");
* $context['theme_stuff'] = $theme;
* Timber::render('single.twig', $context);
* ?>
* ```
* ```twig
* We are currently using the {{ theme_stuff.name }} theme.
* ```
* ```html
* We are currently using the My Theme theme.
* ```
*/
public function __construct( $slug = null ) {
$this->init($slug);
}
/**
* @internal
* @param string $slug
*/
protected function init( $slug = null ) {
$this->theme = wp_get_theme($slug);
$this->name = $this->theme->get('Name');
$this->version = $this->theme->get('Version');
$this->slug = $this->theme->get_stylesheet();
$this->uri = $this->theme->get_template_directory_uri();
if ( $this->theme->parent() ) {
$this->parent_slug = $this->theme->parent()->get_stylesheet();
$this->parent = new Theme($this->parent_slug);
}
}
/**
* @api
* @return string the absolute path to the theme (ex: `http://example.org/wp-content/themes/my-timber-theme`)
*/
public function link() {
return $this->theme->get_stylesheet_directory_uri();
}
/**
* @api
* @return string the relative path to the theme (ex: `/wp-content/themes/my-timber-theme`)
*/
public function path() {
// force = true to work with specifying the port
// @see https://github.com/timber/timber/issues/1739
return URLHelper::get_rel_url($this->link(), true);
}
/**
* @param string $name
* @param bool $default
* @return string
*/
public function theme_mod( $name, $default = false ) {
return get_theme_mod($name, $default);
}
/**
* @return array
*/
public function theme_mods() {
return get_theme_mods();
}
/**
* Gets a raw, unformatted theme header.
*
* @api
* @see \WP_Theme::get()
* @example
* ```twig
* {{ theme.get('Version') }}
* ```
*
* @param string $header Name of the theme header. Name, Description, Author, Version,
* ThemeURI, AuthorURI, Status, Tags.
*
* @return false|string String on success, false on failure.
*/
public function get( $header ) {
return $this->theme->get( $header );
}
/**
* Gets a theme header, formatted and translated for display.
*
* @api
* @see \WP_Theme::display()
* @example
* ```twig
* {{ theme.display('Description') }}
* ```
*
* @param string $header Name of the theme header. Name, Description, Author, Version,
* ThemeURI, AuthorURI, Status, Tags.
*
* @return false|string
*/
public function display( $header ) {
return $this->theme->display( $header );
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Cache | Folder | 0775 |
|
|
| Image | Folder | 0775 |
|
|
| Integrations | Folder | 0775 |
|
|
| Admin.php | File | 5.65 KB | 0775 |
|
| Archives.php | File | 10.65 KB | 0775 |
|
| Comment.php | File | 10.45 KB | 0775 |
|
| CommentThread.php | File | 3.58 KB | 0775 |
|
| Core.php | File | 2.69 KB | 0775 |
|
| CoreInterface.php | File | 231 B | 0775 |
|
| FunctionWrapper.php | File | 2.83 KB | 0775 |
|
| Helper.php | File | 14.42 KB | 0775 |
|
| Image.php | File | 15.64 KB | 0775 |
|
| ImageHelper.php | File | 22.06 KB | 0775 |
|
| Integrations.php | File | 717 B | 0775 |
|
| Loader.php | File | 10.02 KB | 0775 |
|
| LocationManager.php | File | 3.57 KB | 0775 |
|
| Menu.php | File | 8.52 KB | 0775 |
|
| MenuItem.php | File | 11.94 KB | 0775 |
|
| Pagination.php | File | 6.93 KB | 0775 |
|
| PathHelper.php | File | 1.76 KB | 0775 |
|
| Post.php | File | 52.58 KB | 0775 |
|
| PostCollection.php | File | 2.98 KB | 0775 |
|
| PostGetter.php | File | 6.51 KB | 0775 |
|
| PostPreview.php | File | 7.98 KB | 0775 |
|
| PostQuery.php | File | 1.81 KB | 0775 |
|
| PostType.php | File | 602 B | 0775 |
|
| PostsIterator.php | File | 247 B | 0775 |
|
| QueryIterator.php | File | 5.37 KB | 0775 |
|
| Request.php | File | 649 B | 0775 |
|
| Site.php | File | 6.23 KB | 0775 |
|
| Term.php | File | 12.26 KB | 0775 |
|
| TermGetter.php | File | 5.38 KB | 0775 |
|
| TextHelper.php | File | 4.72 KB | 0775 |
|
| Theme.php | File | 4.06 KB | 0775 |
|
| Timber.php | File | 15.84 KB | 0775 |
|
| Twig.php | File | 12.98 KB | 0775 |
|
| Twig_Filter.php | File | 650 B | 0775 |
|
| Twig_Function.php | File | 696 B | 0775 |
|
| URLHelper.php | File | 10.54 KB | 0775 |
|
| User.php | File | 7.94 KB | 0775 |
|