Issues (311)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

lib/timber-theme.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * 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::get_context()` in which case you can access it your theme like so:
5
 * @example
6
 * ```php
7
 * <?php
8
 * $context = Timber::get_context();
9
 * Timber::render('index.twig', $context);
10
 * ?>
11
 * ```
12
 * ```twig
13
 * <script src="{{theme.link}}/static/js/all.js"></script>
14
 * ```
15
 * ```html
16
 * <script src="http://example.org/wp-content/themes/my-theme/static/js/all.js"></script>
17
 * ```
18
 * @package Timber
19
 */
20
class TimberTheme extends TimberCore {
21
22
	/**
23
	 * @api
24
	 * @var string the human-friendly name of the theme (ex: `My Timber Starter Theme`)
25
	 */
26
	public $name;
27
28
	/**
29
	 * @api
30
	 * @var TimberTheme|bool the TimberTheme object for the parent theme (if it exists), false otherwise
31
	 */
32
	public $parent = false;
33
34
	/**
35
	 * @api
36
	 * @var string the slug of the parent theme (ex: `_s`)
37
	 */
38
	public $parent_slug;
39
40
	/**
41
	 * @api
42
	 * @var string the slug of the theme (ex: `my-super-theme`)
43
	 */
44
	public $slug;
45
	public $uri;
46
47
	/**
48
	 * Constructs a new TimberTheme object. NOTE the TimberTheme object of the current theme comes in the default `Timber::get_context()` call. You can access this in your twig template via `{{site.theme}}.
49
	 * @param string $slug
0 ignored issues
show
Should the type for parameter $slug not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
50
	 * @example
51
	 * ```php
52
	 * <?php
53
	 *     $theme = new TimberTheme("my-theme");
54
	 *     $context['theme_stuff'] = $theme;
55
	 *     Timber::render('single.')
56
	 * ?>
57
	 * ```
58
	 * ```twig
59
	 * We are currently using the {{ theme_stuff.name }} theme.
60
	 * ```
61
	 * ```html
62
	 * We are currently using the My Theme theme.
63
	 * ```
64
	 */
65
	function __construct($slug = null) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
66
		$this->init($slug);
67
	}
68
69
	/**
70
	 * @internal
71
	 * @param string $slug
0 ignored issues
show
Should the type for parameter $slug not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
72
	 */
73
	protected function init($slug = null) {
74
		$data = wp_get_theme($slug);
75
		$this->name = $data->get('Name');
76
		$ss = $data->get_stylesheet();
77
		$this->slug = $ss;
78
79
		if ( ! function_exists( 'get_home_path' ) ) {
80
			require_once(ABSPATH . 'wp-admin/includes/file.php');
81
		}
82
83
		$this->uri = get_stylesheet_directory_uri();
84
		$this->parent_slug = $data->get('Template');
85
		if ( !$this->parent_slug ) {
86
			$this->uri = get_template_directory_uri();
87
		}
88
		if ( $this->parent_slug && $this->parent_slug != $this->slug ) {
89
			$this->parent = new TimberTheme($this->parent_slug);
90
		}
91
	}
92
93
	/**
94
	 * @api
95
	 * @return string the absolute path to the theme (ex: `http://example.org/wp-content/themes/my-timber-theme`)
96
	 */
97
	public function link() {
98
		return $this->uri;
99
	}
100
101
	/**
102
	 * @api
103
	 * @return  string the relative path to the theme (ex: `/wp-content/themes/my-timber-theme`)
104
	 */
105
	public function path() {
106
		return TimberURLHelper::get_rel_url( $this->link() );
107
	}
108
109
	/**
110
	 * @param string $name
111
	 * @param bool $default
112
	 * @return string
113
	 */
114
	public function theme_mod($name, $default = false) {
115
		return get_theme_mod($name, $default);
116
	}
117
118
	/**
119
	 * @return array
120
	 */
121
	public function theme_mods() {
122
		return get_theme_mods();
123
	}
124
125
}
126