WP_Super_Cache_Rest_Get_Settings::callback()
Get the settings.
Method of the class: WP_Super_Cache_Rest_Get_Settings{}
No Hooks.
Return
WP_Error|WP_REST_Response
.
Usage
$WP_Super_Cache_Rest_Get_Settings = new WP_Super_Cache_Rest_Get_Settings(); $WP_Super_Cache_Rest_Get_Settings->callback( $request );
- $request(WP_REST_Request) (required)
- Full data about the request.
WP_Super_Cache_Rest_Get_Settings::callback() WP Super Cache Rest Get Settings::callback code WPSCache 1.12.4
public function callback( $request ) { $settings = array(); global $wp_cache_config_file; if ( defined( 'WPLOCKDOWN' ) ) { $config_file = file_get_contents( $wp_cache_config_file ); if ( ! str_contains( $config_file, "defined( 'WPLOCKDOWN' )" ) ) { wp_cache_replace_line( '^.*WPLOCKDOWN', "if ( ! defined( 'WPLOCKDOWN' ) ) define( 'WPLOCKDOWN', " . $this->get_is_lock_down_enabled() . " );", $wp_cache_config_file ); } } if ( function_exists( "opcache_invalidate" ) ) { @opcache_invalidate( $wp_cache_config_file ); } include( $wp_cache_config_file ); foreach ( WP_Super_Cache_Settings_Map::$map as $name => $map ) { if ( isset ( $map['get'] ) ) { $get_method = $map['get']; if ( method_exists( $this, $get_method ) ) { $settings[ $name ] = $this->$get_method(); } elseif ( function_exists( $get_method ) ) { $settings[ $name ] = $get_method(); } } else if ( isset ( $map['option'] ) ) { $settings[ $name ] = get_option( $map['option'] ); } elseif ( isset( $map['global'] ) ) { if ( false == isset( $GLOBALS[ $map[ 'global' ] ] ) ) { $settings[ $name ] = false; } else { $settings[ $name ] = $GLOBALS[ $map[ 'global' ] ]; } } } return $this->prepare_item_for_response( $settings, $request ); }