Linux premium155.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
LiteSpeed
: 162.0.235.200 | : 18.224.59.107
Cant Read [ /etc/named.conf ]
7.4.33
varifktc
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
varifktc /
public_html /
wp-includes /
[ HOME SHELL ]
Name
Size
Permission
Action
ID3
[ DIR ]
drwxr-xr-x
IXR
[ DIR ]
drwxr-xr-x
PHPMailer
[ DIR ]
drwxr-xr-x
Requests
[ DIR ]
drwxr-xr-x
SimplePie
[ DIR ]
drwxr-xr-x
Text
[ DIR ]
drwxr-xr-x
assets
[ DIR ]
drwxr-xr-x
block-bindings
[ DIR ]
drwxr-xr-x
block-patterns
[ DIR ]
drwxr-xr-x
block-supports
[ DIR ]
drwxr-xr-x
blocks
[ DIR ]
drwxr-xr-x
certificates
[ DIR ]
drwxr-xr-x
css
[ DIR ]
drwxr-xr-x
customize
[ DIR ]
drwxr-xr-x
fonts
[ DIR ]
drwxr-xr-x
html-api
[ DIR ]
drwxr-xr-x
images
[ DIR ]
drwxr-xr-x
interactivity-api
[ DIR ]
drwxr-xr-x
js
[ DIR ]
drwxr-xr-x
l10n
[ DIR ]
drwxr-xr-x
php-compat
[ DIR ]
drwxr-xr-x
pomo
[ DIR ]
drwxr-xr-x
rest-api
[ DIR ]
drwxr-xr-x
sitemaps
[ DIR ]
drwxr-xr-x
sodium_compat
[ DIR ]
drwxr-xr-x
style-engine
[ DIR ]
drwxr-xr-x
theme-compat
[ DIR ]
drwxr-xr-x
widgets
[ DIR ]
drwxr-xr-x
admin-bar.php
36.23
KB
-rw-r--r--
atomlib.php
11.79
KB
-rw-r--r--
author-template.php
18.51
KB
-rw-r--r--
block-bindings.php
5.46
KB
-rw-r--r--
block-editor.php
27.68
KB
-rw-r--r--
block-i18n.json
316
B
-rw-r--r--
block-patterns.php
12.81
KB
-rw-r--r--
block-template-utils.php
58.74
KB
-rw-r--r--
block-template.php
13.81
KB
-rw-r--r--
blocks.php
102.36
KB
-rw-r--r--
bookmark-template.php
12.64
KB
-rw-r--r--
bookmark.php
15.07
KB
-rw-r--r--
cache-compat.php
5.83
KB
-rw-r--r--
cache.php
13.16
KB
-rw-r--r--
canonical.php
33.71
KB
-rw-r--r--
capabilities.php
41.72
KB
-rw-r--r--
category-template.php
55.67
KB
-rw-r--r--
category.php
12.41
KB
-rw-r--r--
class-IXR.php
2.48
KB
-rw-r--r--
class-avif-info.php
28.92
KB
-rw-r--r--
class-feed.php
539
B
-rw-r--r--
class-http.php
367
B
-rw-r--r--
class-json.php
42.66
KB
-rw-r--r--
class-oembed.php
401
B
-rw-r--r--
class-phpass.php
6.61
KB
-rw-r--r--
class-phpmailer.php
664
B
-rw-r--r--
class-pop3.php
20.68
KB
-rw-r--r--
class-requests.php
2.18
KB
-rw-r--r--
class-simplepie.php
453
B
-rw-r--r--
class-smtp.php
457
B
-rw-r--r--
class-snoopy.php
36.83
KB
-rw-r--r--
class-walker-category-dropdown...
2.41
KB
-rw-r--r--
class-walker-category.php
8.28
KB
-rw-r--r--
class-walker-comment.php
13.89
KB
-rw-r--r--
class-walker-nav-menu.php
11.51
KB
-rw-r--r--
class-walker-page-dropdown.php
2.65
KB
-rw-r--r--
class-walker-page.php
7.43
KB
-rw-r--r--
class-wp-admin-bar.php
17.46
KB
-rw-r--r--
class-wp-ajax-response.php
5.14
KB
-rw-r--r--
class-wp-application-passwords...
15.25
KB
-rw-r--r--
class-wp-block-bindings-regist...
8.26
KB
-rw-r--r--
class-wp-block-bindings-source...
2.92
KB
-rw-r--r--
class-wp-block-editor-context....
1.32
KB
-rw-r--r--
class-wp-block-list.php
4.65
KB
-rw-r--r--
class-wp-block-metadata-regist...
8.16
KB
-rw-r--r--
class-wp-block-parser-block.ph...
2.5
KB
-rw-r--r--
class-wp-block-parser-frame.ph...
1.97
KB
-rw-r--r--
class-wp-block-parser.php
11.26
KB
-rw-r--r--
class-wp-block-pattern-categor...
5.25
KB
-rw-r--r--
class-wp-block-patterns-regist...
10.53
KB
-rw-r--r--
class-wp-block-styles-registry...
6.12
KB
-rw-r--r--
class-wp-block-supports.php
5.48
KB
-rw-r--r--
class-wp-block-template.php
1.99
KB
-rw-r--r--
class-wp-block-templates-regis...
7.06
KB
-rw-r--r--
class-wp-block-type-registry.p...
4.9
KB
-rw-r--r--
class-wp-block-type.php
16.86
KB
-rw-r--r--
class-wp-block.php
19.96
KB
-rw-r--r--
class-wp-classic-to-block-menu...
3.99
KB
-rw-r--r--
class-wp-comment-query.php
47.26
KB
-rw-r--r--
class-wp-comment.php
9.15
KB
-rw-r--r--
class-wp-customize-control.php
25.13
KB
-rw-r--r--
class-wp-customize-manager.php
197.79
KB
-rw-r--r--
class-wp-customize-nav-menus.p...
55.84
KB
-rw-r--r--
class-wp-customize-panel.php
10.39
KB
-rw-r--r--
class-wp-customize-section.php
10.95
KB
-rw-r--r--
class-wp-customize-setting.php
29.19
KB
-rw-r--r--
class-wp-customize-widgets.php
70.47
KB
-rw-r--r--
class-wp-date-query.php
34.89
KB
-rw-r--r--
class-wp-dependencies.php
14.78
KB
-rw-r--r--
class-wp-dependency.php
2.57
KB
-rw-r--r--
class-wp-duotone.php
39.83
KB
-rw-r--r--
class-wp-editor.php
70.64
KB
-rw-r--r--
class-wp-embed.php
15.62
KB
-rw-r--r--
class-wp-error.php
7.33
KB
-rw-r--r--
class-wp-exception.php
253
B
-rw-r--r--
class-wp-fatal-error-handler.p...
7.96
KB
-rw-r--r--
class-wp-feed-cache-transient....
3.1
KB
-rw-r--r--
class-wp-feed-cache.php
969
B
-rw-r--r--
class-wp-hook.php
15.63
KB
-rw-r--r--
class-wp-http-cookie.php
7.22
KB
-rw-r--r--
class-wp-http-curl.php
12.25
KB
-rw-r--r--
class-wp-http-encoding.php
6.53
KB
-rw-r--r--
class-wp-http-ixr-client.php
3.42
KB
-rw-r--r--
class-wp-http-proxy.php
5.84
KB
-rw-r--r--
class-wp-http-requests-hooks.p...
1.97
KB
-rw-r--r--
class-wp-http-requests-respons...
4.3
KB
-rw-r--r--
class-wp-http-response.php
2.91
KB
-rw-r--r--
class-wp-http-streams.php
16.46
KB
-rw-r--r--
class-wp-http.php
40.53
KB
-rw-r--r--
class-wp-image-editor-gd.php
19.42
KB
-rw-r--r--
class-wp-image-editor-imagick....
31.9
KB
-rw-r--r--
class-wp-image-editor.php
16.54
KB
-rw-r--r--
class-wp-list-util.php
7.27
KB
-rw-r--r--
class-wp-locale-switcher.php
6.47
KB
-rw-r--r--
class-wp-locale.php
15.73
KB
-rw-r--r--
class-wp-matchesmapregex.php
1.79
KB
-rw-r--r--
class-wp-meta-query.php
29.82
KB
-rw-r--r--
class-wp-metadata-lazyloader.p...
6.67
KB
-rw-r--r--
class-wp-navigation-fallback.p...
9
KB
-rw-r--r--
class-wp-network-query.php
19.39
KB
-rw-r--r--
class-wp-network.php
12.01
KB
-rw-r--r--
class-wp-object-cache.php
17.11
KB
-rw-r--r--
class-wp-oembed-controller.php
6.74
KB
-rw-r--r--
class-wp-oembed.php
30.74
KB
-rw-r--r--
class-wp-paused-extensions-sto...
4.99
KB
-rw-r--r--
class-wp-plugin-dependencies.p...
24.73
KB
-rw-r--r--
class-wp-post-type.php
29.63
KB
-rw-r--r--
class-wp-post.php
6.33
KB
-rw-r--r--
class-wp-query.php
150.47
KB
-rw-r--r--
class-wp-recovery-mode-cookie-...
6.72
KB
-rw-r--r--
class-wp-recovery-mode-email-s...
10.92
KB
-rw-r--r--
class-wp-recovery-mode-key-ser...
4.5
KB
-rw-r--r--
class-wp-recovery-mode-link-se...
3.38
KB
-rw-r--r--
class-wp-recovery-mode.php
11.17
KB
-rw-r--r--
class-wp-rewrite.php
62.2
KB
-rw-r--r--
class-wp-role.php
2.46
KB
-rw-r--r--
class-wp-roles.php
8.38
KB
-rw-r--r--
class-wp-script-modules.php
18.91
KB
-rw-r--r--
class-wp-scripts.php
27.68
KB
-rw-r--r--
class-wp-session-tokens.php
7.28
KB
-rw-r--r--
class-wp-simplepie-file.php
3.33
KB
-rw-r--r--
class-wp-simplepie-sanitize-ks...
1.79
KB
-rw-r--r--
class-wp-site-query.php
30.88
KB
-rw-r--r--
class-wp-site.php
7.28
KB
-rw-r--r--
class-wp-styles.php
10.75
KB
-rw-r--r--
class-wp-tax-query.php
19.1
KB
-rw-r--r--
class-wp-taxonomy.php
18.13
KB
-rw-r--r--
class-wp-term-query.php
39.91
KB
-rw-r--r--
class-wp-term.php
5.17
KB
-rw-r--r--
class-wp-text-diff-renderer-in...
979
B
-rw-r--r--
class-wp-text-diff-renderer-ta...
18.37
KB
-rw-r--r--
class-wp-textdomain-registry.p...
10.24
KB
-rw-r--r--
class-wp-theme-json-data.php
1.77
KB
-rw-r--r--
class-wp-theme-json-resolver.p...
34.97
KB
-rw-r--r--
class-wp-theme-json-schema.php
7.19
KB
-rw-r--r--
class-wp-theme-json.php
157.01
KB
-rw-r--r--
class-wp-theme.php
63.88
KB
-rw-r--r--
class-wp-token-map.php
27.95
KB
-rw-r--r--
class-wp-user-meta-session-tok...
2.92
KB
-rw-r--r--
class-wp-user-query.php
42.63
KB
-rw-r--r--
class-wp-user-request.php
2.17
KB
-rw-r--r--
class-wp-user.php
22.29
KB
-rw-r--r--
class-wp-walker.php
13.01
KB
-rw-r--r--
class-wp-widget-factory.php
3.27
KB
-rw-r--r--
class-wp-widget.php
17.99
KB
-rw-r--r--
class-wp-xmlrpc-server.php
209.91
KB
-rw-r--r--
class-wp.php
25.51
KB
-rw-r--r--
class-wpdb.php
115.61
KB
-rw-r--r--
class.wp-dependencies.php
373
B
-rw-r--r--
class.wp-scripts.php
343
B
-rw-r--r--
class.wp-styles.php
338
B
-rw-r--r--
comment-template.php
100.36
KB
-rw-r--r--
comment.php
127.22
KB
-rw-r--r--
compat.php
16.58
KB
-rw-r--r--
cron.php
40.62
KB
-rw-r--r--
date.php
400
B
-rw-r--r--
default-constants.php
11.1
KB
-rw-r--r--
default-filters.php
34.85
KB
-rw-r--r--
default-widgets.php
2.17
KB
-rw-r--r--
deprecated.php
185.67
KB
-rw-r--r--
embed-template.php
338
B
-rw-r--r--
embed.php
37.02
KB
-rw-r--r--
error-protection.php
4.02
KB
-rw-r--r--
error_log
977.58
KB
-rw-r--r--
feed-atom-comments.php
5.38
KB
-rw-r--r--
feed-atom.php
2.98
KB
-rw-r--r--
feed-rdf.php
2.61
KB
-rw-r--r--
feed-rss.php
1.16
KB
-rw-r--r--
feed-rss2-comments.php
4.04
KB
-rw-r--r--
feed-rss2.php
3.71
KB
-rw-r--r--
feed.php
22.86
KB
-rw-r--r--
fonts.php
9.52
KB
-rw-r--r--
formatting.php
327.37
KB
-rw-r--r--
functions.php
276.53
KB
-rw-r--r--
functions.wp-scripts.php
14.22
KB
-rw-r--r--
functions.wp-styles.php
8.38
KB
-rw-r--r--
general-template.php
165.52
KB
-rw-r--r--
global-styles-and-settings.php
20.71
KB
-rw-r--r--
http.php
24.72
KB
-rw-r--r--
https-detection.php
5.53
KB
-rw-r--r--
https-migration.php
4.63
KB
-rw-r--r--
kses.php
72.66
KB
-rw-r--r--
l10n.php
66.81
KB
-rw-r--r--
link-template.php
154.01
KB
-rw-r--r--
load.php
54.35
KB
-rw-r--r--
locale.php
162
B
-rw-r--r--
media-template.php
61.57
KB
-rw-r--r--
media.php
213.3
KB
-rw-r--r--
meta.php
62.9
KB
-rw-r--r--
ms-blogs.php
25.17
KB
-rw-r--r--
ms-default-constants.php
4.81
KB
-rw-r--r--
ms-default-filters.php
6.48
KB
-rw-r--r--
ms-deprecated.php
21.25
KB
-rw-r--r--
ms-files.php
2.65
KB
-rw-r--r--
ms-functions.php
89.11
KB
-rw-r--r--
ms-load.php
19.42
KB
-rw-r--r--
ms-network.php
3.69
KB
-rw-r--r--
ms-settings.php
4.03
KB
-rw-r--r--
ms-site.php
39.54
KB
-rw-r--r--
nav-menu-template.php
25.31
KB
-rw-r--r--
nav-menu.php
43.33
KB
-rw-r--r--
option.php
99.37
KB
-rw-r--r--
pluggable-deprecated.php
6.12
KB
-rw-r--r--
pluggable.php
113.25
KB
-rw-r--r--
plugin.php
34.63
KB
-rw-r--r--
post-formats.php
6.94
KB
-rw-r--r--
post-template.php
65.31
KB
-rw-r--r--
post-thumbnail-template.php
10.57
KB
-rw-r--r--
post.php
283.1
KB
-rw-r--r--
query.php
36.17
KB
-rw-r--r--
registration-functions.php
200
B
-rw-r--r--
registration.php
200
B
-rw-r--r--
rest-api.php
97.26
KB
-rw-r--r--
revision.php
30.17
KB
-rw-r--r--
rewrite.php
19.08
KB
-rw-r--r--
robots-template.php
5.06
KB
-rw-r--r--
rss-functions.php
255
B
-rw-r--r--
rss.php
22.57
KB
-rw-r--r--
script-loader.php
127.52
KB
-rw-r--r--
script-modules.php
7.53
KB
-rw-r--r--
session.php
258
B
-rw-r--r--
shortcodes.php
23.49
KB
-rw-r--r--
sitemaps.php
3.16
KB
-rw-r--r--
spl-autoload-compat.php
441
B
-rw-r--r--
style-engine.php
7.39
KB
-rw-r--r--
taxonomy.php
171.33
KB
-rw-r--r--
template-canvas.php
544
B
-rw-r--r--
template-loader.php
2.94
KB
-rw-r--r--
template.php
23.59
KB
-rw-r--r--
theme-i18n.json
1.26
KB
-rw-r--r--
theme-previews.php
2.77
KB
-rw-r--r--
theme-templates.php
6.08
KB
-rw-r--r--
theme.json
8.5
KB
-rw-r--r--
theme.php
130.84
KB
-rw-r--r--
update.php
35.93
KB
-rw-r--r--
user.php
170.32
KB
-rw-r--r--
vars.php
6.34
KB
-rw-r--r--
version.php
931
B
-rw-r--r--
widgets.php
69.03
KB
-rw-r--r--
wp-db.php
445
B
-rw-r--r--
wp-diff.php
726
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : class-wp-plugin-dependencies.php
<?php /** * WordPress Plugin Administration API: WP_Plugin_Dependencies class * * @package WordPress * @subpackage Administration * @since 6.5.0 */ /** * Core class for installing plugin dependencies. * * It is designed to add plugin dependencies as designated in the * `Requires Plugins` header to a new view in the plugins install page. */ class WP_Plugin_Dependencies { /** * Holds 'get_plugins()'. * * @since 6.5.0 * * @var array */ protected static $plugins; /** * Holds plugin directory names to compare with cache. * * @since 6.5.0 * * @var array */ protected static $plugin_dirnames; /** * Holds sanitized plugin dependency slugs. * * Keyed on the dependent plugin's filepath, * relative to the plugins directory. * * @since 6.5.0 * * @var array */ protected static $dependencies; /** * Holds an array of sanitized plugin dependency slugs. * * @since 6.5.0 * * @var array */ protected static $dependency_slugs; /** * Holds an array of dependent plugin slugs. * * Keyed on the dependent plugin's filepath, * relative to the plugins directory. * * @since 6.5.0 * * @var array */ protected static $dependent_slugs; /** * Holds 'plugins_api()' data for plugin dependencies. * * @since 6.5.0 * * @var array */ protected static $dependency_api_data; /** * Holds plugin dependency filepaths, relative to the plugins directory. * * Keyed on the dependency's slug. * * @since 6.5.0 * * @var string[] */ protected static $dependency_filepaths; /** * An array of circular dependency pairings. * * @since 6.5.0 * * @var array[] */ protected static $circular_dependencies_pairs; /** * An array of circular dependency slugs. * * @since 6.5.0 * * @var string[] */ protected static $circular_dependencies_slugs; /** * Whether Plugin Dependencies have been initialized. * * @since 6.5.0 * * @var bool */ protected static $initialized = false; /** * Initializes by fetching plugin header and plugin API data. * * @since 6.5.0 */ public static function initialize() { if ( false === self::$initialized ) { self::read_dependencies_from_plugin_headers(); self::get_dependency_api_data(); self::$initialized = true; } } /** * Determines whether the plugin has plugins that depend on it. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return bool Whether the plugin has plugins that depend on it. */ public static function has_dependents( $plugin_file ) { return in_array( self::convert_to_slug( $plugin_file ), (array) self::$dependency_slugs, true ); } /** * Determines whether the plugin has plugin dependencies. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return bool Whether a plugin has plugin dependencies. */ public static function has_dependencies( $plugin_file ) { return isset( self::$dependencies[ $plugin_file ] ); } /** * Determines whether the plugin has active dependents. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return bool Whether the plugin has active dependents. */ public static function has_active_dependents( $plugin_file ) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; $dependents = self::get_dependents( self::convert_to_slug( $plugin_file ) ); foreach ( $dependents as $dependent ) { if ( is_plugin_active( $dependent ) ) { return true; } } return false; } /** * Gets filepaths of plugins that require the dependency. * * @since 6.5.0 * * @param string $slug The dependency's slug. * @return array An array of dependent plugin filepaths, relative to the plugins directory. */ public static function get_dependents( $slug ) { $dependents = array(); foreach ( (array) self::$dependencies as $dependent => $dependencies ) { if ( in_array( $slug, $dependencies, true ) ) { $dependents[] = $dependent; } } return $dependents; } /** * Gets the slugs of plugins that the dependent requires. * * @since 6.5.0 * * @param string $plugin_file The dependent plugin's filepath, relative to the plugins directory. * @return array An array of dependency plugin slugs. */ public static function get_dependencies( $plugin_file ) { if ( isset( self::$dependencies[ $plugin_file ] ) ) { return self::$dependencies[ $plugin_file ]; } return array(); } /** * Gets a dependent plugin's filepath. * * @since 6.5.0 * * @param string $slug The dependent plugin's slug. * @return string|false The dependent plugin's filepath, relative to the plugins directory, * or false if the plugin has no dependencies. */ public static function get_dependent_filepath( $slug ) { $filepath = array_search( $slug, self::$dependent_slugs, true ); return $filepath ? $filepath : false; } /** * Determines whether the plugin has unmet dependencies. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return bool Whether the plugin has unmet dependencies. */ public static function has_unmet_dependencies( $plugin_file ) { if ( ! isset( self::$dependencies[ $plugin_file ] ) ) { return false; } require_once ABSPATH . '/wp-admin/includes/plugin.php'; foreach ( self::$dependencies[ $plugin_file ] as $dependency ) { $dependency_filepath = self::get_dependency_filepath( $dependency ); if ( false === $dependency_filepath || is_plugin_inactive( $dependency_filepath ) ) { return true; } } return false; } /** * Determines whether the plugin has a circular dependency. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return bool Whether the plugin has a circular dependency. */ public static function has_circular_dependency( $plugin_file ) { if ( ! is_array( self::$circular_dependencies_slugs ) ) { self::get_circular_dependencies(); } if ( ! empty( self::$circular_dependencies_slugs ) ) { $slug = self::convert_to_slug( $plugin_file ); if ( in_array( $slug, self::$circular_dependencies_slugs, true ) ) { return true; } } return false; } /** * Gets the names of plugins that require the plugin. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return array An array of dependent names. */ public static function get_dependent_names( $plugin_file ) { $dependent_names = array(); $plugins = self::get_plugins(); $slug = self::convert_to_slug( $plugin_file ); foreach ( self::get_dependents( $slug ) as $dependent ) { $dependent_names[ $dependent ] = $plugins[ $dependent ]['Name']; } sort( $dependent_names ); return $dependent_names; } /** * Gets the names of plugins required by the plugin. * * @since 6.5.0 * * @param string $plugin_file The dependent plugin's filepath, relative to the plugins directory. * @return array An array of dependency names. */ public static function get_dependency_names( $plugin_file ) { $dependency_api_data = self::get_dependency_api_data(); $dependencies = self::get_dependencies( $plugin_file ); $plugins = self::get_plugins(); $dependency_names = array(); foreach ( $dependencies as $dependency ) { // Use the name if it's available, otherwise fall back to the slug. if ( isset( $dependency_api_data[ $dependency ]['name'] ) ) { $name = $dependency_api_data[ $dependency ]['name']; } else { $dependency_filepath = self::get_dependency_filepath( $dependency ); if ( false !== $dependency_filepath ) { $name = $plugins[ $dependency_filepath ]['Name']; } else { $name = $dependency; } } $dependency_names[ $dependency ] = $name; } return $dependency_names; } /** * Gets the filepath for a dependency, relative to the plugin's directory. * * @since 6.5.0 * * @param string $slug The dependency's slug. * @return string|false If installed, the dependency's filepath relative to the plugins directory, otherwise false. */ public static function get_dependency_filepath( $slug ) { $dependency_filepaths = self::get_dependency_filepaths(); if ( ! isset( $dependency_filepaths[ $slug ] ) ) { return false; } return $dependency_filepaths[ $slug ]; } /** * Returns API data for the dependency. * * @since 6.5.0 * * @param string $slug The dependency's slug. * @return array|false The dependency's API data on success, otherwise false. */ public static function get_dependency_data( $slug ) { $dependency_api_data = self::get_dependency_api_data(); if ( isset( $dependency_api_data[ $slug ] ) ) { return $dependency_api_data[ $slug ]; } return false; } /** * Displays an admin notice if dependencies are not installed. * * @since 6.5.0 */ public static function display_admin_notice_for_unmet_dependencies() { if ( in_array( false, self::get_dependency_filepaths(), true ) ) { $error_message = __( 'Some required plugins are missing or inactive.' ); if ( is_multisite() ) { if ( current_user_can( 'manage_network_plugins' ) ) { $error_message .= ' ' . sprintf( /* translators: %s: Link to the network plugins page. */ __( '<a href="%s">Manage plugins</a>.' ), esc_url( network_admin_url( 'plugins.php' ) ) ); } else { $error_message .= ' ' . __( 'Please contact your network administrator.' ); } } elseif ( 'plugins' !== get_current_screen()->base ) { $error_message .= ' ' . sprintf( /* translators: %s: Link to the plugins page. */ __( '<a href="%s">Manage plugins</a>.' ), esc_url( admin_url( 'plugins.php' ) ) ); } wp_admin_notice( $error_message, array( 'type' => 'warning', ) ); } } /** * Displays an admin notice if circular dependencies are installed. * * @since 6.5.0 */ public static function display_admin_notice_for_circular_dependencies() { $circular_dependencies = self::get_circular_dependencies(); if ( ! empty( $circular_dependencies ) && count( $circular_dependencies ) > 1 ) { $circular_dependencies = array_unique( $circular_dependencies, SORT_REGULAR ); $plugins = self::get_plugins(); $plugin_dirnames = self::get_plugin_dirnames(); // Build output lines. $circular_dependency_lines = ''; foreach ( $circular_dependencies as $circular_dependency ) { $first_filepath = $plugin_dirnames[ $circular_dependency[0] ]; $second_filepath = $plugin_dirnames[ $circular_dependency[1] ]; $circular_dependency_lines .= sprintf( /* translators: 1: First plugin name, 2: Second plugin name. */ '<li>' . _x( '%1$s requires %2$s', 'The first plugin requires the second plugin.' ) . '</li>', '<strong>' . esc_html( $plugins[ $first_filepath ]['Name'] ) . '</strong>', '<strong>' . esc_html( $plugins[ $second_filepath ]['Name'] ) . '</strong>' ); } wp_admin_notice( sprintf( '<p>%1$s</p><ul>%2$s</ul><p>%3$s</p>', __( 'These plugins cannot be activated because their requirements are invalid.' ), $circular_dependency_lines, __( 'Please contact the plugin authors for more information.' ) ), array( 'type' => 'warning', 'paragraph_wrap' => false, ) ); } } /** * Checks plugin dependencies after a plugin is installed via AJAX. * * @since 6.5.0 */ public static function check_plugin_dependencies_during_ajax() { check_ajax_referer( 'updates' ); if ( empty( $_POST['slug'] ) ) { wp_send_json_error( array( 'slug' => '', 'pluginName' => '', 'errorCode' => 'no_plugin_specified', 'errorMessage' => __( 'No plugin specified.' ), ) ); } $slug = sanitize_key( wp_unslash( $_POST['slug'] ) ); $status = array( 'slug' => $slug ); self::get_plugins(); self::get_plugin_dirnames(); if ( ! isset( self::$plugin_dirnames[ $slug ] ) ) { $status['errorCode'] = 'plugin_not_installed'; $status['errorMessage'] = __( 'The plugin is not installed.' ); wp_send_json_error( $status ); } $plugin_file = self::$plugin_dirnames[ $slug ]; $status['pluginName'] = self::$plugins[ $plugin_file ]['Name']; $status['plugin'] = $plugin_file; if ( current_user_can( 'activate_plugin', $plugin_file ) && is_plugin_inactive( $plugin_file ) ) { $status['activateUrl'] = add_query_arg( array( '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_file ), 'action' => 'activate', 'plugin' => $plugin_file, ), is_multisite() ? network_admin_url( 'plugins.php' ) : admin_url( 'plugins.php' ) ); } if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { $status['activateUrl'] = add_query_arg( array( 'networkwide' => 1 ), $status['activateUrl'] ); } self::initialize(); $dependencies = self::get_dependencies( $plugin_file ); if ( empty( $dependencies ) ) { $status['message'] = __( 'The plugin has no required plugins.' ); wp_send_json_success( $status ); } require_once ABSPATH . '/wp-admin/includes/plugin.php'; $inactive_dependencies = array(); foreach ( $dependencies as $dependency ) { if ( false === self::$plugin_dirnames[ $dependency ] || is_plugin_inactive( self::$plugin_dirnames[ $dependency ] ) ) { $inactive_dependencies[] = $dependency; } } if ( ! empty( $inactive_dependencies ) ) { $inactive_dependency_names = array_map( function ( $dependency ) { if ( isset( self::$dependency_api_data[ $dependency ]['Name'] ) ) { $inactive_dependency_name = self::$dependency_api_data[ $dependency ]['Name']; } else { $inactive_dependency_name = $dependency; } return $inactive_dependency_name; }, $inactive_dependencies ); $status['errorCode'] = 'inactive_dependencies'; $status['errorMessage'] = sprintf( /* translators: %s: A list of inactive dependency plugin names. */ __( 'The following plugins must be activated first: %s.' ), implode( ', ', $inactive_dependency_names ) ); $status['errorData'] = array_combine( $inactive_dependencies, $inactive_dependency_names ); wp_send_json_error( $status ); } $status['message'] = __( 'All required plugins are installed and activated.' ); wp_send_json_success( $status ); } /** * Gets data for installed plugins. * * @since 6.5.0 * * @return array An array of plugin data. */ protected static function get_plugins() { if ( is_array( self::$plugins ) ) { return self::$plugins; } require_once ABSPATH . '/wp-admin/includes/plugin.php'; self::$plugins = get_plugins(); return self::$plugins; } /** * Reads and stores dependency slugs from a plugin's 'Requires Plugins' header. * * @since 6.5.0 */ protected static function read_dependencies_from_plugin_headers() { self::$dependencies = array(); self::$dependency_slugs = array(); self::$dependent_slugs = array(); $plugins = self::get_plugins(); foreach ( $plugins as $plugin => $header ) { if ( '' === $header['RequiresPlugins'] ) { continue; } $dependency_slugs = self::sanitize_dependency_slugs( $header['RequiresPlugins'] ); self::$dependencies[ $plugin ] = $dependency_slugs; self::$dependency_slugs = array_merge( self::$dependency_slugs, $dependency_slugs ); $dependent_slug = self::convert_to_slug( $plugin ); self::$dependent_slugs[ $plugin ] = $dependent_slug; } self::$dependency_slugs = array_unique( self::$dependency_slugs ); } /** * Sanitizes slugs. * * @since 6.5.0 * * @param string $slugs A comma-separated string of plugin dependency slugs. * @return array An array of sanitized plugin dependency slugs. */ protected static function sanitize_dependency_slugs( $slugs ) { $sanitized_slugs = array(); $slugs = explode( ',', $slugs ); foreach ( $slugs as $slug ) { $slug = trim( $slug ); /** * Filters a plugin dependency's slug before matching to * the WordPress.org slug format. * * Can be used to switch between free and premium plugin slugs, for example. * * @since 6.5.0 * * @param string $slug The slug. */ $slug = apply_filters( 'wp_plugin_dependencies_slug', $slug ); // Match to WordPress.org slug format. if ( preg_match( '/^[a-z0-9]+(-[a-z0-9]+)*$/mu', $slug ) ) { $sanitized_slugs[] = $slug; } } $sanitized_slugs = array_unique( $sanitized_slugs ); sort( $sanitized_slugs ); return $sanitized_slugs; } /** * Gets the filepath of installed dependencies. * If a dependency is not installed, the filepath defaults to false. * * @since 6.5.0 * * @return array An array of install dependencies filepaths, relative to the plugins directory. */ protected static function get_dependency_filepaths() { if ( is_array( self::$dependency_filepaths ) ) { return self::$dependency_filepaths; } if ( null === self::$dependency_slugs ) { return array(); } self::$dependency_filepaths = array(); $plugin_dirnames = self::get_plugin_dirnames(); foreach ( self::$dependency_slugs as $slug ) { if ( isset( $plugin_dirnames[ $slug ] ) ) { self::$dependency_filepaths[ $slug ] = $plugin_dirnames[ $slug ]; continue; } self::$dependency_filepaths[ $slug ] = false; } return self::$dependency_filepaths; } /** * Retrieves and stores dependency plugin data from the WordPress.org Plugin API. * * @since 6.5.0 * * @global string $pagenow The filename of the current screen. * * @return array|void An array of dependency API data, or void on early exit. */ protected static function get_dependency_api_data() { global $pagenow; if ( ! is_admin() || ( 'plugins.php' !== $pagenow && 'plugin-install.php' !== $pagenow ) ) { return; } if ( is_array( self::$dependency_api_data ) ) { return self::$dependency_api_data; } $plugins = self::get_plugins(); self::$dependency_api_data = (array) get_site_transient( 'wp_plugin_dependencies_plugin_data' ); foreach ( self::$dependency_slugs as $slug ) { // Set transient for individual data, remove from self::$dependency_api_data if transient expired. if ( ! get_site_transient( "wp_plugin_dependencies_plugin_timeout_{$slug}" ) ) { unset( self::$dependency_api_data[ $slug ] ); set_site_transient( "wp_plugin_dependencies_plugin_timeout_{$slug}", true, 12 * HOUR_IN_SECONDS ); } if ( isset( self::$dependency_api_data[ $slug ] ) ) { if ( false === self::$dependency_api_data[ $slug ] ) { $dependency_file = self::get_dependency_filepath( $slug ); if ( false === $dependency_file ) { self::$dependency_api_data[ $slug ] = array( 'Name' => $slug ); } else { self::$dependency_api_data[ $slug ] = array( 'Name' => $plugins[ $dependency_file ]['Name'] ); } continue; } // Don't hit the Plugin API if data exists. if ( ! empty( self::$dependency_api_data[ $slug ]['last_updated'] ) ) { continue; } } if ( ! function_exists( 'plugins_api' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; } $information = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'short_description' => true, 'icons' => true, ), ) ); if ( is_wp_error( $information ) ) { continue; } self::$dependency_api_data[ $slug ] = (array) $information; // plugins_api() returns 'name' not 'Name'. self::$dependency_api_data[ $slug ]['Name'] = self::$dependency_api_data[ $slug ]['name']; set_site_transient( 'wp_plugin_dependencies_plugin_data', self::$dependency_api_data, 0 ); } // Remove from self::$dependency_api_data if slug no longer a dependency. $differences = array_diff( array_keys( self::$dependency_api_data ), self::$dependency_slugs ); foreach ( $differences as $difference ) { unset( self::$dependency_api_data[ $difference ] ); } ksort( self::$dependency_api_data ); // Remove empty elements. self::$dependency_api_data = array_filter( self::$dependency_api_data ); set_site_transient( 'wp_plugin_dependencies_plugin_data', self::$dependency_api_data, 0 ); return self::$dependency_api_data; } /** * Gets plugin directory names. * * @since 6.5.0 * * @return array An array of plugin directory names. */ protected static function get_plugin_dirnames() { if ( is_array( self::$plugin_dirnames ) ) { return self::$plugin_dirnames; } self::$plugin_dirnames = array(); $plugin_files = array_keys( self::get_plugins() ); foreach ( $plugin_files as $plugin_file ) { $slug = self::convert_to_slug( $plugin_file ); self::$plugin_dirnames[ $slug ] = $plugin_file; } return self::$plugin_dirnames; } /** * Gets circular dependency data. * * @since 6.5.0 * * @return array[] An array of circular dependency pairings. */ protected static function get_circular_dependencies() { if ( is_array( self::$circular_dependencies_pairs ) ) { return self::$circular_dependencies_pairs; } if ( null === self::$dependencies ) { return array(); } self::$circular_dependencies_slugs = array(); self::$circular_dependencies_pairs = array(); foreach ( self::$dependencies as $dependent => $dependencies ) { /* * $dependent is in 'a/a.php' format. Dependencies are stored as slugs, i.e. 'a'. * * Convert $dependent to slug format for checking. */ $dependent_slug = self::convert_to_slug( $dependent ); self::$circular_dependencies_pairs = array_merge( self::$circular_dependencies_pairs, self::check_for_circular_dependencies( array( $dependent_slug ), $dependencies ) ); } return self::$circular_dependencies_pairs; } /** * Checks for circular dependencies. * * @since 6.5.0 * * @param array $dependents Array of dependent plugins. * @param array $dependencies Array of plugins dependencies. * @return array A circular dependency pairing, or an empty array if none exists. */ protected static function check_for_circular_dependencies( $dependents, $dependencies ) { $circular_dependencies_pairs = array(); // Check for a self-dependency. $dependents_location_in_its_own_dependencies = array_intersect( $dependents, $dependencies ); if ( ! empty( $dependents_location_in_its_own_dependencies ) ) { foreach ( $dependents_location_in_its_own_dependencies as $self_dependency ) { self::$circular_dependencies_slugs[] = $self_dependency; $circular_dependencies_pairs[] = array( $self_dependency, $self_dependency ); // No need to check for itself again. unset( $dependencies[ array_search( $self_dependency, $dependencies, true ) ] ); } } /* * Check each dependency to see: * 1. If it has dependencies. * 2. If its list of dependencies includes one of its own dependents. */ foreach ( $dependencies as $dependency ) { // Check if the dependency is also a dependent. $dependency_location_in_dependents = array_search( $dependency, self::$dependent_slugs, true ); if ( false !== $dependency_location_in_dependents ) { $dependencies_of_the_dependency = self::$dependencies[ $dependency_location_in_dependents ]; foreach ( $dependents as $dependent ) { // Check if its dependencies includes one of its own dependents. $dependent_location_in_dependency_dependencies = array_search( $dependent, $dependencies_of_the_dependency, true ); if ( false !== $dependent_location_in_dependency_dependencies ) { self::$circular_dependencies_slugs[] = $dependent; self::$circular_dependencies_slugs[] = $dependency; $circular_dependencies_pairs[] = array( $dependent, $dependency ); // Remove the dependent from its dependency's dependencies. unset( $dependencies_of_the_dependency[ $dependent_location_in_dependency_dependencies ] ); } } $dependents[] = $dependency; /* * Now check the dependencies of the dependency's dependencies for the dependent. * * Yes, that does make sense. */ $circular_dependencies_pairs = array_merge( $circular_dependencies_pairs, self::check_for_circular_dependencies( $dependents, array_unique( $dependencies_of_the_dependency ) ) ); } } return $circular_dependencies_pairs; } /** * Converts a plugin filepath to a slug. * * @since 6.5.0 * * @param string $plugin_file The plugin's filepath, relative to the plugins directory. * @return string The plugin's slug. */ protected static function convert_to_slug( $plugin_file ) { if ( 'hello.php' === $plugin_file ) { return 'hello-dolly'; } return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file ); } }
Close