Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/modules/system-info/reporters/theme.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + namespace Elementor\Modules\System_Info\Reporters;
3 +
4 + if ( ! defined( 'ABSPATH' ) ) {
5 + exit; // Exit if accessed directly.
6 + }
7 +
8 + /**
9 + * Elementor theme report.
10 + *
11 + * Elementor system report handler class responsible for generating a report for
12 + * the theme.
13 + *
14 + * @since 1.0.0
15 + */
16 + class Theme extends Base {
17 +
18 + /**
19 + * Theme.
20 + *
21 + * Holds the sites theme object.
22 + *
23 + * @since 1.0.0
24 + * @access private
25 + *
26 + * @var \WP_Theme WordPress theme object.
27 + */
28 + private $theme = null;
29 +
30 + /**
31 + * Get theme reporter title.
32 + *
33 + * Retrieve theme reporter title.
34 + *
35 + * @since 1.0.0
36 + * @access public
37 + *
38 + * @return string Reporter title.
39 + */
40 + public function get_title() {
41 + return 'Theme';
42 + }
43 +
44 + /**
45 + * Get theme report fields.
46 + *
47 + * Retrieve the required fields for the theme report.
48 + *
49 + * @since 1.0.0
50 + * @access public
51 + *
52 + * @return array Required report fields with field ID and field label.
53 + */
54 + public function get_fields() {
55 + $fields = [
56 + 'name' => 'Name',
57 + 'version' => 'Version',
58 + 'author' => 'Author',
59 + 'is_child_theme' => 'Child Theme',
60 + ];
61 +
62 + if ( $this->get_parent_theme() ) {
63 + $parent_fields = [
64 + 'parent_name' => 'Parent Theme Name',
65 + 'parent_version' => 'Parent Theme Version',
66 + 'parent_author' => 'Parent Theme Author',
67 + ];
68 + $fields = array_merge( $fields, $parent_fields );
69 + }
70 +
71 + return $fields;
72 + }
73 +
74 + /**
75 + * Get theme.
76 + *
77 + * Retrieve the theme.
78 + *
79 + * @since 1.0.0
80 + * @deprecated 3.1.0 Use `get_theme()` method instead.
81 + * @access protected
82 + *
83 + * @return \WP_Theme WordPress theme object.
84 + */
85 + protected function _get_theme() {
86 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'get_theme()' );
87 +
88 + return $this->get_theme();
89 + }
90 +
91 + /**
92 + * Get theme.
93 + *
94 + * Retrieve the theme.
95 + *
96 + * @since 3.1.0
97 + * @access private
98 + *
99 + * @return \WP_Theme WordPress theme object.
100 + */
101 + private function get_theme() {
102 + if ( is_null( $this->theme ) ) {
103 + $this->theme = wp_get_theme();
104 + }
105 + return $this->theme;
106 + }
107 +
108 + /**
109 + * Get parent theme.
110 + *
111 + * Retrieve the parent theme.
112 + *
113 + * @since 1.0.0
114 + * @access protected
115 + *
116 + * @return \WP_Theme|false WordPress theme object, or false if the current theme is not a child theme.
117 + */
118 + protected function get_parent_theme() {
119 + return $this->get_theme()->parent();
120 + }
121 +
122 + /**
123 + * Get theme name.
124 + *
125 + * Retrieve the theme name.
126 + *
127 + * @since 1.0.0
128 + * @access public
129 + *
130 + * @return array {
131 + * Report data.
132 + *
133 + * @type string $value The theme name.
134 + * }
135 + */
136 + public function get_name() {
137 + return [
138 + 'value' => $this->get_theme()->get( 'Name' ),
139 + ];
140 + }
141 +
142 + /**
143 + * Get theme author.
144 + *
145 + * Retrieve the theme author.
146 + *
147 + * @since 1.0.0
148 + * @access public
149 + *
150 + * @return array {
151 + * Report data.
152 + *
153 + * @type string $value The theme author.
154 + * }
155 + */
156 + public function get_author() {
157 + return [
158 + 'value' => $this->get_theme()->get( 'Author' ),
159 + ];
160 + }
161 +
162 + /**
163 + * Get theme version.
164 + *
165 + * Retrieve the theme version.
166 + *
167 + * @since 1.0.0
168 + * @access public
169 + *
170 + * @return array {
171 + * Report data.
172 + *
173 + * @type string $value The theme version.
174 + * }
175 + */
176 + public function get_version() {
177 + return [
178 + 'value' => $this->get_theme()->get( 'Version' ),
179 + ];
180 + }
181 +
182 + /**
183 + * Is the theme is a child theme.
184 + *
185 + * Whether the theme is a child theme.
186 + *
187 + * @since 1.0.0
188 + * @access public
189 + *
190 + * @return array {
191 + * Report data.
192 + *
193 + * @type string $value Yes if the theme is a child theme, No otherwise.
194 + * @type string $recommendation Theme source code modification recommendation.
195 + * }
196 + */
197 + public function get_is_child_theme() {
198 + $is_child_theme = is_child_theme();
199 +
200 + $result = [
201 + 'value' => $is_child_theme ? 'Yes' : 'No',
202 + ];
203 +
204 + if ( ! $is_child_theme ) {
205 + $result['recommendation'] = sprintf(
206 + /* translators: %s: WordPress child themes documentation. */
207 + __( 'If you want to modify the source code of your theme, we recommend using a <a href="%s">child theme</a>.', 'elementor' ),
208 + 'https://go.elementor.com/wordpress-child-themes/'
209 + );
210 + }
211 +
212 + return $result;
213 + }
214 +
215 + /**
216 + * Get parent theme version.
217 + *
218 + * Retrieve the parent theme version.
219 + *
220 + * @since 1.0.0
221 + * @access public
222 + *
223 + * @return array {
224 + * Report data.
225 + *
226 + * @type string $value The parent theme version.
227 + * }
228 + */
229 + public function get_parent_version() {
230 + return [
231 + 'value' => $this->get_parent_theme()->get( 'Version' ),
232 + ];
233 + }
234 +
235 + /**
236 + * Get parent theme author.
237 + *
238 + * Retrieve the parent theme author.
239 + *
240 + * @since 1.0.0
241 + * @access public
242 + *
243 + * @return array {
244 + * Report data.
245 + *
246 + * @type string $value The parent theme author.
247 + * }
248 + */
249 + public function get_parent_author() {
250 + return [
251 + 'value' => $this->get_parent_theme()->get( 'Author' ),
252 + ];
253 + }
254 +
255 + /**
256 + * Get parent theme name.
257 + *
258 + * Retrieve the parent theme name.
259 + *
260 + * @since 1.0.0
261 + * @access public
262 + *
263 + * @return array {
264 + * Report data.
265 + *
266 + * @type string $value The parent theme name.
267 + * }
268 + */
269 + public function get_parent_name() {
270 + return [
271 + 'value' => $this->get_parent_theme()->get( 'Name' ),
272 + ];
273 + }
274 + }
275 +