1 | <?php |
||
7 | class Plugins_Handler { |
||
8 | |||
9 | /** |
||
10 | * Returns an array containing the directories of all active plugins and all known activating plugins. |
||
11 | * |
||
12 | * @return Array An array of plugin directories as strings or an empty array. |
||
13 | */ |
||
14 | public function get_all_active_plugins() { |
||
27 | |||
28 | /** |
||
29 | * Returns an array containing the names for the active sitewide plugins in a multisite environment. |
||
30 | * |
||
31 | * @return Array The names of the active sitewide plugins or an empty array. |
||
32 | */ |
||
33 | protected function get_multisite_plugins() { |
||
38 | |||
39 | /** |
||
40 | * Returns an array containing the names of the currently active plugins. |
||
41 | * |
||
42 | * @return Array The active plugins' names or an empty array. |
||
43 | */ |
||
44 | protected function get_active_plugins() { |
||
47 | |||
48 | /** |
||
49 | * Ensure the plugin has its own directory and not a single-file plugin. |
||
50 | * |
||
51 | * @param string $plugin Plugin name, may be prefixed with "/". |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function is_directory_plugin( $plugin ) { |
||
58 | |||
59 | /** |
||
60 | * Returns the plugin's directory. |
||
61 | * |
||
62 | * The input is a string with the format 'dir/file.php'. This method removes the 'file.php' part. The directory |
||
63 | * alone can be used to identify the plugin. |
||
64 | * |
||
65 | * @param string $plugin The plugin string with the format 'dir/file.php'. |
||
66 | * |
||
67 | * @return string The plugin's directory. |
||
68 | */ |
||
69 | private function remove_plugin_file_from_string( $plugin ) { |
||
72 | |||
73 | /** |
||
74 | * Converts an array of plugin strings with the format 'dir/file.php' to an array of directories. Also removes any |
||
75 | * single-file plugins since they cannot have packages. |
||
76 | * |
||
77 | * @param Array $plugins The array of plugin strings with the format 'dir/file.php'. |
||
78 | * |
||
79 | * @return Array An array of plugin directories. |
||
80 | */ |
||
81 | private function convert_plugins_to_dirs( $plugins ) { |
||
85 | |||
86 | /** |
||
87 | * Checks whether the autoloader should be reset. The autoloader should be reset |
||
88 | * when a plugin is activating via a method other than a request, for example |
||
89 | * using WP-CLI. When this occurs, the activating plugin was not known when |
||
90 | * the autoloader selected the package versions for the classmap and filemap |
||
91 | * globals, so the autoloader must reselect the versions. |
||
92 | * |
||
93 | * If the current plugin is not already known, this method will add it to the |
||
94 | * $jetpack_autoloader_activating_plugins global. |
||
95 | * |
||
96 | * @return Boolean True if the autoloder must be reset, else false. |
||
97 | */ |
||
98 | public function should_autoloader_reset() { |
||
112 | |||
113 | /** |
||
114 | * Returns an array containing the names of plugins that are activating via a request. |
||
115 | * |
||
116 | * @return Array An array of names of the activating plugins or an empty array. |
||
117 | */ |
||
118 | private function get_plugins_activating_via_request() { |
||
150 | |||
151 | /** |
||
152 | * Returns the directory of the current plugin. |
||
153 | * |
||
154 | * @return String The directory of the current plugin. |
||
155 | */ |
||
156 | public function get_current_plugin_dir() { |
||
159 | |||
160 | /** |
||
161 | * Resets the autoloader after a plugin update. |
||
162 | * |
||
163 | * @param bool $response Installation response. |
||
164 | * @param array $hook_extra Extra arguments passed to hooked filters. |
||
165 | * @param array $result Installation result data. |
||
166 | * |
||
167 | * @return bool The passed in $response param. |
||
168 | */ |
||
169 | public function reset_maps_after_update( $response, $hook_extra, $result ) { |
||
199 | } |
||
200 |