PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/class-central.php +12 -8 5.6.1 → 6.3.0 View file →
@@ -46,9 +46,9 @@
46 46 public function routing() {
47 47 // This is the intention, we will use it to find the data stored in DI.
48 48 $route = HTTP::get( 'route', false );
49 49 $nonce = HTTP::get( '_def_nonce', false );
50 - if ( empty( $route ) || empty( $nonce ) ) {
50 + if ( ! is_string( $route ) || '' === trim( $route ) || ! is_string( $nonce ) || '' === trim( $nonce ) ) {
51 51 exit;
52 52 }
53 53
54 54 $this->check_opcache();
@@ -85,9 +85,9 @@
85 85
86 86 try {
87 87 $package = wd_di()->get( $key );
88 88 [ $class, $method, $is_private ] = $package;
89 - if ( $is_private && ! $this->check_permission() ) {
89 + if ( true === $is_private && ! $this->check_permission() ) {
90 90 wp_send_json_error(
91 91 array(
92 92 'message' => esc_html__( 'You shall not pass.', 'defender-security' ),
93 93 'type_notice' => 'not_allowed',
@@ -93,9 +93,9 @@
93 93 'type_notice' => 'not_allowed',
94 94 )
95 95 );
96 96 }
97 - if ( $is_private ) {
97 + if ( true === $is_private ) {
98 98 if ( ! wp_next_scheduled( 'defender_hub_sync' ) ) {
99 99 // Sync with HUB on every request it made, but not on public call.
100 100 wp_schedule_single_event( time(), 'defender_hub_sync' );
101 101 }
@@ -122,9 +122,9 @@
122 122 // No use reflection method for performance, also this just a simple call.
123 123 // Manipulate the POST as raw data.
124 124 $_POST = $request->get_data();
125 125
126 - return $object->$method( $request );
126 + return call_user_func( array( $object, $method ), $request );
127 127 } else {
128 128 $this->log( sprintf( 'class not found when executing: %s %s', $class_name, $method ), self::INTERNAL_LOG );
129 129 }
130 130 }
@@ -162,9 +162,9 @@
162 162 * @param string $class_name The class name.
163 163 *
164 164 * @return mixed The route associated with the intention, or null if not found.
165 165 */
166 - public function get_route( $method, $class_name ) {
166 + public function get_route( $method, $class_name ): mixed {
167 167 $intention = $this->get_intention( $class_name, $method );
168 168
169 169 try {
170 170 return wd_di()->get( sprintf( 'route.%s', $intention ) );
@@ -170,8 +170,10 @@
170 170 return wd_di()->get( sprintf( 'route.%s', $intention ) );
171 171 } catch ( Exception $e ) {
172 172 $this->log( $e->getMessage(), self::INTERNAL_LOG );
173 173 }
174 +
175 + return null;
174 176 }
175 177
176 178 /**
177 179 * Retrieves the nonce for a given method and class name.
@@ -180,9 +182,9 @@
180 182 * @param string $class_name The class name.
181 183 *
182 184 * @return mixed The nonce associated with the intention, or null if not found.
183 185 */
184 - public function get_nonce( $method, $class_name ) {
186 + public function get_nonce( $method, $class_name ): mixed {
185 187 $intention = $this->get_intention( $class_name, $method );
186 188
187 189 try {
188 190 return wd_di()->get( sprintf( 'nonce.%s', $intention ) );
@@ -188,8 +190,10 @@
188 190 return wd_di()->get( sprintf( 'nonce.%s', $intention ) );
189 191 } catch ( Exception $e ) {
190 192 $this->log( $e->getMessage(), self::INTERNAL_LOG );
191 193 }
194 +
195 + return null;
192 196 }
193 197
194 198 /**
195 199 * Check OPcache is enabled or not.
@@ -259,9 +263,9 @@
259 263
260 264 try {
261 265 $package = wd_di()->get( $key );
262 266
263 - return isset( $package[2] ) && $package[2];
267 + return isset( $package[2] ) && true === (bool) $package[2];
264 268 } catch ( Exception $e ) {
265 269 $this->log( $e->getMessage(), self::INTERNAL_LOG );
266 270 }
267 271
@@ -300,9 +304,9 @@
300 304
301 305 try {
302 306 $package = wd_di()->get( $key );
303 307
304 - return isset( $package[3] ) && $package[3];
308 + return isset( $package[3] ) && true === (bool) $package[3];
305 309 } catch ( Exception $e ) {
306 310 $this->log( $e->getMessage(), self::INTERNAL_LOG );
307 311 }
308 312