/** * What encoding types to accept and their priority values. * * @since 2.8.0 * * @param string $url * @param array $args * @return string Types of encoding to accept. */ public static function accept_encoding( $url, $args ) { $type = array(); $compression_enabled = self::is_available(); if ( ! $args['decompress'] ) { // Decompression specifically disabled. $compression_enabled = false; } elseif ( $args['stream'] ) { // Disable when streaming to file. $compression_enabled = false; } elseif ( isset( $args['limit_response_size'] ) ) { // If only partial content is being requested, we won't be able to decompress it. $compression_enabled = false; } if ( $compression_enabled ) { if ( function_exists( 'gzinflate' ) ) { $type[] = 'deflate;q=1.0'; } if ( function_exists( 'gzuncompress' ) ) { $type[] = 'compress;q=0.5'; } if ( function_exists( 'gzdecode' ) ) { $type[] = 'gzip;q=0.5'; } } /** * Filters the allowed encoding types. * * @since 3.6.0 * * @param string[] $type Array of what encoding types to accept and their priority values. * @param string $url URL of the HTTP request. * @param array $args HTTP request arguments. */ $type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args ); return implode( ', ', $type ); } /** * What encoding the content used when it was compressed to send in the headers. * * @since 2.8.0 * * @return string Content-Encoding string to send in the header. */ public static function content_encoding() { return 'deflate'; } /** * Whether the content be decoded based on the headers. * * @since 2.8.0 * * @param array|string $headers All of the available headers. * @return bool */ public static function should_decode( $headers ) { if ( is_array( $headers ) ) { if ( array_key_exists( 'content-encoding', $headers ) && ! empty( $headers['content-encoding'] ) ) { return true; } } elseif ( is_string( $headers ) ) { return ( stripos( $headers, 'content-encoding:' ) !== false ); } return false; } /** * Whether decompression and compression are supported by the PHP version. * * Each function is tested instead of checking for the zlib extension, to * ensure that the functions all exist in the PHP version and aren't * disabled. * * @since 2.8.0 * * @return bool */ public static function is_available() { return ( function_exists( 'gzuncompress' ) || function_exists( 'gzdeflate' ) || function_exists( 'gzinflate' ) ); } } this->get_amp_compatible_plugins_url(), 'AMP_COMPATIBLE_THEMES_URL' => $this->get_amp_compatible_themes_url(), 'APP_ROOT_ID' => self::APP_ROOT_ID, 'APP_ROOT_SIBLING_ID' => self::APP_ROOT_SIBLING_ID, 'OPTIONS_REST_PATH' => '/amp/v1/options', 'SETTINGS_LINK' => menu_page_url( AMP_Options_Manager::OPTION_NAME, false ), 'SCANNABLE_URLS_REST_PATH' => '/amp/v1/scannable-urls', 'VALIDATE_NONCE' => AMP_Validation_Manager::has_cap() ? AMP_Validation_Manager::get_amp_validate_nonce() : '', ]; wp_add_inline_script( self::ASSET_HANDLE, sprintf( 'var ampSiteScanNotice = %s;', wp_json_encode( $data ) ), 'before' ); $this->add_preload_rest_paths(); } /** * Get a URL to AMP compatible plugins directory. * * For users capable of installing plugins, the link should lead to the Plugin install page. * Other users will be directed to the plugins page on amp-wp.org. * * @return string URL to AMP compatible plugins directory. */ protected function get_amp_compatible_plugins_url() { if ( current_user_can( 'install_plugins' ) ) { return admin_url( '/plugin-install.php?tab=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/plugins/'; } /** * Get a URL to AMP compatible themes directory. * * For users capable of installing themes, the link should lead to the Theme install page. * Other users will be directed to the themes page on amp-wp.org. * * @return string URL to AMP compatible themes directory. */ protected function get_amp_compatible_themes_url() { if ( current_user_can( 'install_themes' ) ) { return admin_url( '/theme-install.php?browse=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/themes/'; } /** * Adds REST paths to preload. */ protected function add_preload_rest_paths() { $paths = [ '/amp/v1/options', add_query_arg( [ '_fields' => [ 'url', 'amp_url', 'type', 'label' ], ], '/amp/v1/scannable-urls' ), add_query_arg( '_fields', [ 'author', 'name', 'plugin', 'status', 'version' ], '/wp/v2/plugins' ), add_query_arg( '_fields', [ 'author', 'name', 'status', 'stylesheet', 'template', 'version' ], '/wp/v2/themes' ), '/wp/v2/users/me', ]; foreach ( $paths as $path ) { $this->rest_preloader->add_preloaded_path( $path ); } } } this->get_amp_compatible_plugins_url(), 'AMP_COMPATIBLE_THEMES_URL' => $this->get_amp_compatible_themes_url(), 'APP_ROOT_ID' => self::APP_ROOT_ID, 'APP_ROOT_SIBLING_ID' => self::APP_ROOT_SIBLING_ID, 'OPTIONS_REST_PATH' => '/amp/v1/options', 'SETTINGS_LINK' => menu_page_url( AMP_Options_Manager::OPTION_NAME, false ), 'SCANNABLE_URLS_REST_PATH' => '/amp/v1/scannable-urls', 'VALIDATE_NONCE' => AMP_Validation_Manager::has_cap() ? AMP_Validation_Manager::get_amp_validate_nonce() : '', ]; wp_add_inline_script( self::ASSET_HANDLE, sprintf( 'var ampSiteScanNotice = %s;', wp_json_encode( $data ) ), 'before' ); $this->add_preload_rest_paths(); } /** * Get a URL to AMP compatible plugins directory. * * For users capable of installing plugins, the link should lead to the Plugin install page. * Other users will be directed to the plugins page on amp-wp.org. * * @return string URL to AMP compatible plugins directory. */ protected function get_amp_compatible_plugins_url() { if ( current_user_can( 'install_plugins' ) ) { return admin_url( '/plugin-install.php?tab=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/plugins/'; } /** * Get a URL to AMP compatible themes directory. * * For users capable of installing themes, the link should lead to the Theme install page. * Other users will be directed to the themes page on amp-wp.org. * * @return string URL to AMP compatible themes directory. */ protected function get_amp_compatible_themes_url() { if ( current_user_can( 'install_themes' ) ) { return admin_url( '/theme-install.php?browse=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/themes/'; } /** * Adds REST paths to preload. */ protected function add_preload_rest_paths() { $paths = [ '/amp/v1/options', add_query_arg( [ '_fields' => [ 'url', 'amp_url', 'type', 'label' ], ], '/amp/v1/scannable-urls' ), add_query_arg( '_fields', [ 'author', 'name', 'plugin', 'status', 'version' ], '/wp/v2/plugins' ), add_query_arg( '_fields', [ 'author', 'name', 'status', 'stylesheet', 'template', 'version' ], '/wp/v2/themes' ), '/wp/v2/users/me', ]; foreach ( $paths as $path ) { $this->rest_preloader->add_preloaded_path( $path ); } } } this->get_amp_compatible_plugins_url(), 'AMP_COMPATIBLE_THEMES_URL' => $this->get_amp_compatible_themes_url(), 'APP_ROOT_ID' => self::APP_ROOT_ID, 'APP_ROOT_SIBLING_ID' => self::APP_ROOT_SIBLING_ID, 'OPTIONS_REST_PATH' => '/amp/v1/options', 'SETTINGS_LINK' => menu_page_url( AMP_Options_Manager::OPTION_NAME, false ), 'SCANNABLE_URLS_REST_PATH' => '/amp/v1/scannable-urls', 'VALIDATE_NONCE' => AMP_Validation_Manager::has_cap() ? AMP_Validation_Manager::get_amp_validate_nonce() : '', ]; wp_add_inline_script( self::ASSET_HANDLE, sprintf( 'var ampSiteScanNotice = %s;', wp_json_encode( $data ) ), 'before' ); $this->add_preload_rest_paths(); } /** * Get a URL to AMP compatible plugins directory. * * For users capable of installing plugins, the link should lead to the Plugin install page. * Other users will be directed to the plugins page on amp-wp.org. * * @return string URL to AMP compatible plugins directory. */ protected function get_amp_compatible_plugins_url() { if ( current_user_can( 'install_plugins' ) ) { return admin_url( '/plugin-install.php?tab=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/plugins/'; } /** * Get a URL to AMP compatible themes directory. * * For users capable of installing themes, the link should lead to the Theme install page. * Other users will be directed to the themes page on amp-wp.org. * * @return string URL to AMP compatible themes directory. */ protected function get_amp_compatible_themes_url() { if ( current_user_can( 'install_themes' ) ) { return admin_url( '/theme-install.php?browse=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/themes/'; } /** * Adds REST paths to preload. */ protected function add_preload_rest_paths() { $paths = [ '/amp/v1/options', add_query_arg( [ '_fields' => [ 'url', 'amp_url', 'type', 'label' ], ], '/amp/v1/scannable-urls' ), add_query_arg( '_fields', [ 'author', 'name', 'plugin', 'status', 'version' ], '/wp/v2/plugins' ), add_query_arg( '_fields', [ 'author', 'name', 'status', 'stylesheet', 'template', 'version' ], '/wp/v2/themes' ), '/wp/v2/users/me', ]; foreach ( $paths as $path ) { $this->rest_preloader->add_preloaded_path( $path ); } } } this->get_amp_compatible_plugins_url(), 'AMP_COMPATIBLE_THEMES_URL' => $this->get_amp_compatible_themes_url(), 'APP_ROOT_ID' => self::APP_ROOT_ID, 'APP_ROOT_SIBLING_ID' => self::APP_ROOT_SIBLING_ID, 'OPTIONS_REST_PATH' => '/amp/v1/options', 'SETTINGS_LINK' => menu_page_url( AMP_Options_Manager::OPTION_NAME, false ), 'SCANNABLE_URLS_REST_PATH' => '/amp/v1/scannable-urls', 'VALIDATE_NONCE' => AMP_Validation_Manager::has_cap() ? AMP_Validation_Manager::get_amp_validate_nonce() : '', ]; wp_add_inline_script( self::ASSET_HANDLE, sprintf( 'var ampSiteScanNotice = %s;', wp_json_encode( $data ) ), 'before' ); $this->add_preload_rest_paths(); } /** * Get a URL to AMP compatible plugins directory. * * For users capable of installing plugins, the link should lead to the Plugin install page. * Other users will be directed to the plugins page on amp-wp.org. * * @return string URL to AMP compatible plugins directory. */ protected function get_amp_compatible_plugins_url() { if ( current_user_can( 'install_plugins' ) ) { return admin_url( '/plugin-install.php?tab=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/plugins/'; } /** * Get a URL to AMP compatible themes directory. * * For users capable of installing themes, the link should lead to the Theme install page. * Other users will be directed to the themes page on amp-wp.org. * * @return string URL to AMP compatible themes directory. */ protected function get_amp_compatible_themes_url() { if ( current_user_can( 'install_themes' ) ) { return admin_url( '/theme-install.php?browse=amp-compatible' ); } return 'https://amp-wp.org/ecosystem/themes/'; } /** * Adds REST paths to preload. */ protected function add_preload_rest_paths() { $paths = [ '/amp/v1/options', add_query_arg( [ '_fields' => [ 'url', 'amp_url', 'type', 'label' ], ], '/amp/v1/scannable-urls' ), add_query_arg( '_fields', [ 'author', 'name', 'plugin', 'status', 'version' ], '/wp/v2/plugins' ), add_query_arg( '_fields', [ 'author', 'name', 'status', 'stylesheet', 'template', 'version' ], '/wp/v2/themes' ), '/wp/v2/users/me', ]; foreach ( $paths as $path ) { $this->rest_preloader->add_preloaded_path( $path ); } } } {"id":3493,"count":1,"description":"","link":"https:\/\/www.infosculturedufaso.net\/tag\/la-direction-generale-du-musee-nationale\/","name":"la direction g\u00e9n\u00e9rale du mus\u00e9e nationale","slug":"la-direction-generale-du-musee-nationale","taxonomy":"post_tag","meta":[],"_links":{"self":[{"href":"https:\/\/www.infosculturedufaso.net\/wp-json\/wp\/v2\/tags\/3493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infosculturedufaso.net\/wp-json\/wp\/v2\/tags"}],"about":[{"href":"https:\/\/www.infosculturedufaso.net\/wp-json\/wp\/v2\/taxonomies\/post_tag"}],"wp:post_type":[{"href":"https:\/\/www.infosculturedufaso.net\/wp-json\/wp\/v2\/posts?tags=3493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}