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0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / vendor / class-plugins-handler.php
woocommerce / vendor Last commit date
automattic 5 years ago bin 5 years ago composer 5 years ago jetpack-autoloader 5 years ago league 5 years ago maxmind-db 5 years ago pelago 6 years ago psr 5 years ago symfony 6 years ago autoload.php 5 years ago autoload_packages.php 5 years ago class-autoloader-handler.php 5 years ago class-classes-handler.php 5 years ago class-files-handler.php 5 years ago class-plugins-handler.php 5 years ago class-version-selector.php 5 years ago
class-plugins-handler.php
159 lines
1 <?php
2 /**
3 * This file was automatically generated by automattic/jetpack-autoloader.
4 *
5 * @package automattic/jetpack-autoloader
6 */
7
8 namespace Automattic\Jetpack\Autoloader\jp24a6cd966207dd699bcb2c85b28af7f3;
9
10 // phpcs:ignore
11
12 /**
13 * This class provides information about the current plugin and the site's active plugins.
14 */
15 class Plugins_Handler {
16
17 /**
18 * Returns an array containing the paths of all active plugins and all known activating plugins.
19 *
20 * @return array An array of plugin paths as strings or an empty array.
21 */
22 public function get_all_active_plugins_paths() {
23 global $jetpack_autoloader_activating_plugins_paths;
24
25 $active_plugins_paths = $this->get_active_plugins_paths();
26 $multisite_plugins_paths = $this->get_multisite_plugins_paths();
27 $active_plugins_paths = array_merge( $multisite_plugins_paths, $active_plugins_paths );
28
29 $activating_plugins_paths = $this->get_plugins_activating_via_request();
30 $activating_plugins_paths = array_unique( array_merge( $activating_plugins_paths, $jetpack_autoloader_activating_plugins_paths ) );
31
32 $plugins_paths = array_unique( array_merge( $active_plugins_paths, $activating_plugins_paths ) );
33
34 return $plugins_paths;
35 }
36
37 /**
38 * Returns an array containing the paths of the active sitewide plugins in a multisite environment.
39 *
40 * @return array The paths of the active sitewide plugins or an empty array.
41 */
42 protected function get_multisite_plugins_paths() {
43 $plugin_slugs = is_multisite()
44 ? array_keys( get_site_option( 'active_sitewide_plugins', array() ) )
45 : array();
46
47 $plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
48 return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
49 }
50
51 /**
52 * Returns an array containing the paths of the currently active plugins.
53 *
54 * @return array The active plugins' paths or an empty array.
55 */
56 protected function get_active_plugins_paths() {
57 $plugin_slugs = (array) get_option( 'active_plugins', array() );
58 $plugin_slugs = array_filter( $plugin_slugs, array( $this, 'is_directory_plugin' ) );
59 return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
60 }
61
62 /**
63 * Adds the plugin directory from the WP_PLUGIN_DIR constant to the plugin slug.
64 *
65 * @param string $plugin_slug The plugin slug.
66 */
67 private function create_plugin_path( $plugin_slug ) {
68 $plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR );
69 return trailingslashit( $plugin_dir ) . substr( $plugin_slug, 0, strrpos( $plugin_slug, '/' ) );
70 }
71
72 /**
73 * Ensure the plugin has its own directory and not a single-file plugin.
74 *
75 * @param string $plugin Plugin name, may be prefixed with "/".
76 *
77 * @return bool
78 */
79 public function is_directory_plugin( $plugin ) {
80 return strlen( $plugin ) > 1 && false !== strpos( $plugin, '/', 1 );
81 }
82
83 /**
84 * Checks whether the autoloader should be reset. The autoloader should be reset
85 * when a plugin is activating via a method other than a request, for example
86 * using WP-CLI. When this occurs, the activating plugin was not known when
87 * the autoloader selected the package versions for the classmap and filemap
88 * globals, so the autoloader must reselect the versions.
89 *
90 * If the current plugin is not already known, this method will add it to the
91 * $jetpack_autoloader_activating_plugins_paths global.
92 *
93 * @return boolean True if the autoloder must be reset, else false.
94 */
95 public function should_autoloader_reset() {
96 global $jetpack_autoloader_activating_plugins_paths;
97
98 $plugins_paths = $this->get_all_active_plugins_paths();
99 $current_plugin_path = $this->get_current_plugin_path();
100 $plugin_unknown = ! in_array( $current_plugin_path, $plugins_paths, true );
101
102 if ( $plugin_unknown ) {
103 // If the current plugin isn't known, add it to the activating plugins list.
104 $jetpack_autoloader_activating_plugins_paths[] = $current_plugin_path;
105 }
106
107 return $plugin_unknown;
108 }
109
110 /**
111 * Returns an array containing the names of plugins that are activating via a request.
112 *
113 * @return array An array of names of the activating plugins or an empty array.
114 */
115 private function get_plugins_activating_via_request() {
116
117 // phpcs:disable WordPress.Security.NonceVerification.Recommended
118
119 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
120 $plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false;
121 $nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false;
122
123 /**
124 * Note: we're not actually checking the nonce here becase it's too early
125 * in the execution. The pluggable functions are not yet loaded to give
126 * plugins a chance to plug their versions. Therefore we're doing the bare
127 * minimum: checking whether the nonce exists and it's in the right place.
128 * The request will fail later if the nonce doesn't pass the check.
129 */
130
131 // In case of a single plugin activation there will be a plugin slug.
132 if ( 'activate' === $action && ! empty( $nonce ) ) {
133 return array( $this->create_plugin_path( wp_unslash( $plugin ) ) );
134 }
135
136 $plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
137
138 // In case of bulk activation there will be an array of plugins.
139 if ( 'activate-selected' === $action && ! empty( $nonce ) ) {
140 $plugin_slugs = array_map( 'wp_unslash', $plugins );
141 return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
142 }
143
144 // phpcs:enable WordPress.Security.NonceVerification.Recommended
145 return array();
146 }
147
148 /**
149 * Returns the path of the current plugin.
150 *
151 * @return string The path of the current plugin.
152 */
153 public function get_current_plugin_path() {
154 $vendor_path = str_replace( '\\', '/', dirname( __FILE__ ) );
155 // Path to the plugin's folder (the parent of the vendor folder).
156 return substr( $vendor_path, 0, strrpos( $vendor_path, '/' ) );
157 }
158 }
159