← All changes
|
json-endpoints/jetpack/class.jetpack-json-api-plugins-endpoint.php
+8
-4
13.3.3
→
16.3-a.5
View file →
| @@ -3,8 +3,12 @@ | ||
| 3 | 3 | use Automattic\Jetpack\Constants; |
| 4 | 4 | use Automattic\Jetpack\Current_Plan; |
| 5 | 5 | use Automattic\Jetpack\Sync\Functions; |
| 6 | 6 | |
| 7 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 8 | + exit( 0 ); | |
| 9 | +} | |
| 10 | + | |
| 7 | 11 | /** |
| 8 | 12 | * Base class for working with plugins. |
| 9 | 13 | */ |
| 10 | 14 | abstract class Jetpack_JSON_API_Plugins_Endpoint extends Jetpack_JSON_API_Endpoint { |
| @@ -168,9 +172,9 @@ | ||
| 168 | 172 | return new WP_Error( 'missing_plugins', __( 'No plugins found.', 'jetpack' ) ); |
| 169 | 173 | } |
| 170 | 174 | foreach ( $this->plugins as $index => $plugin ) { |
| 171 | 175 | if ( ! preg_match( '/\.php$/', $plugin ) ) { |
| 172 | - $plugin = $plugin . '.php'; | |
| 176 | + $plugin .= '.php'; | |
| 173 | 177 | $this->plugins[ $index ] = $plugin; |
| 174 | 178 | } |
| 175 | 179 | $valid = $this->validate_plugin( urldecode( $plugin ) ); |
| 176 | 180 | if ( is_wp_error( $valid ) ) { |
| @@ -288,9 +292,9 @@ | ||
| 288 | 292 | * |
| 289 | 293 | * @return bool |
| 290 | 294 | */ |
| 291 | 295 | protected function plugin_has_translations_autoupdates_enabled( $plugin_file ) { |
| 292 | - return (bool) in_array( $plugin_file, Jetpack_Options::get_option( 'autoupdate_plugins_translations', array() ), true ); | |
| 296 | + return in_array( $plugin_file, Jetpack_Options::get_option( 'autoupdate_plugins_translations', array() ), true ); | |
| 293 | 297 | } |
| 294 | 298 | |
| 295 | 299 | /** |
| 296 | 300 | * Get file mod capabilities. |
| @@ -325,10 +329,10 @@ | ||
| 325 | 329 | } |
| 326 | 330 | } |
| 327 | 331 | |
| 328 | 332 | $file_mod_capabilities = array( |
| 329 | - 'modify_files' => (bool) empty( $reasons_can_not_modify_files ), // install, remove, update | |
| 330 | - 'autoupdate_files' => (bool) empty( $reasons_can_not_modify_files ) && empty( $reasons_can_not_autoupdate ), // enable autoupdates | |
| 333 | + 'modify_files' => empty( $reasons_can_not_modify_files ), // install, remove, update | |
| 334 | + 'autoupdate_files' => empty( $reasons_can_not_modify_files ) && empty( $reasons_can_not_autoupdate ), // enable autoupdates | |
| 331 | 335 | ); |
| 332 | 336 | |
| 333 | 337 | if ( ! empty( $reasons_can_not_modify_files ) ) { |
| 334 | 338 | $file_mod_capabilities['reasons_modify_files_unavailable'] = $reasons_can_not_modify_files; |