WP_Super_Cache_Rest_Get_Settings::callback() public WPSCache 1.0
Get the settings.
{} Это метод класса: WP_Super_Cache_Rest_Get_Settings{}
Хуков нет.
Возвращает
WP_Error/WP_REST_Response.
Использование
$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) (обязательный)
- Full data about the request.
Код WP_Super_Cache_Rest_Get_Settings::callback() WP Super Cache Rest Get Settings::callback WPSCache 1.7.1
public function callback( $request ) {
$settings = array();
global $wp_cache_config_file;
if ( defined( 'WPLOCKDOWN' ) ) {
$config_file = file_get_contents( $wp_cache_config_file );
if ( false === strpos( $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 );
}