@@ 115-146 (lines=32) @@ | ||
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. |
@@ 90-125 (lines=36) @@ | ||
87 | * |
|
88 | * @return array An array of names of the activating plugins or an empty array. |
|
89 | */ |
|
90 | private function get_plugins_activating_via_request() { |
|
91 | ||
92 | // phpcs:disable WordPress.Security.NonceVerification.Recommended |
|
93 | // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
|
94 | // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
95 | ||
96 | $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false; |
|
97 | $plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false; |
|
98 | $nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false; |
|
99 | ||
100 | /** |
|
101 | * Note: we're not actually checking the nonce here becase it's too early |
|
102 | * in the execution. The pluggable functions are not yet loaded to give |
|
103 | * plugins a chance to plug their versions. Therefore we're doing the bare |
|
104 | * minimum: checking whether the nonce exists and it's in the right place. |
|
105 | * The request will fail later if the nonce doesn't pass the check. |
|
106 | */ |
|
107 | ||
108 | // In case of a single plugin activation there will be a plugin slug. |
|
109 | if ( 'activate' === $action && ! empty( $nonce ) ) { |
|
110 | return array( $this->create_plugin_path( wp_unslash( $plugin ) ) ); |
|
111 | } |
|
112 | ||
113 | $plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array(); |
|
114 | ||
115 | // In case of bulk activation there will be an array of plugins. |
|
116 | if ( 'activate-selected' === $action && ! empty( $nonce ) ) { |
|
117 | $plugin_slugs = array_map( 'wp_unslash', $plugins ); |
|
118 | return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs ); |
|
119 | } |
|
120 | ||
121 | // phpcs:enable WordPress.Security.NonceVerification.Recommended |
|
122 | // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
|
123 | // phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
124 | return array(); |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * Returns the path of the current plugin. |