/** * 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' ) ); } } s user-facing strings and returns a new * config instance with those translations applied. * * @param string ...$fields Optionally, limit to translating only the given fields. * * @return $this */ public function translate( string ...$fields ): self { $fields = $fields ?: self::T_ALL; if ( ! $this->translated ) { $this->translated = clone $this; } foreach ( $fields as $field ) { if ( in_array( $field, $this->translated->translated_fields, true ) ) { continue; } if ( 'about' === $field ) { $this->translated->config['title'] = static::translate_value( $this->get_title() ); $this->translated->config['description'] = static::translate_value( $this->get_description() ); $this->translated->config['help'] = static::translate_value( $this->get_help() ); $this->translated->config['keywords'] = array_map( static function ( $value ) { return static::translate_value( $value ); }, $this->get_keywords() ); } elseif ( isset( $this->translated->config[ $field ] ) ) { self::apply_translate( $this->translated->config[ $field ] ); } $this->translated->translated_fields[] = $field; } return $this->translated; } /** * Extends the module config with a provided module config. * * @param Module_Config $with * * @return $this A new merged module config is returned. */ public function extend( Module_Config $with ): self { $new = clone $this; if ( $with->get_keywords() ) { $new->config['keywords'] = array_merge( $new->get_keywords(), $with->get_keywords() ); } if ( $with->get_tools() ) { $new->config['tools'] = array_merge( $new->get_tools(), $with->get_tools() ); } if ( $with->get_user_groups() ) { $new->config['user-groups'] = array_merge( $new->get_user_groups(), $with->get_user_groups() ); } if ( $with->get_password_requirements() ) { $new->config['password-requirements'] = array_merge( $new->get_password_requirements(), $with->get_password_requirements() ); } if ( $with->get_settings() ) { if ( ! $new->get_settings() ) { $new->config['settings'] = $with->get_settings(); } else { $new->config['settings'] = \ITSEC_Lib::array_merge_recursive_distinct( $new->config['settings'], $with->get_settings() ); } } if ( $with->get_conditional_settings() ) { $new->config['conditional-settings'] = array_merge( $new->get_conditional_settings(), $with->get_conditional_settings() ); } if ( $with->get_removed_settings() ) { $new->config['removed-settings'] = array_merge( $new->get_removed_settings(), $with->get_removed_settings() ); } if ( $with->get_removed_settings() ) { $new->config['removed-settings'] = array_merge( $new->get_removed_settings(), $with->get_removed_settings() ); } if ( $with->get_deprecated_settings() ) { $new->config['deprecated-settings'] = array_merge( $new->get_deprecated_settings(), $with->get_deprecated_settings() ); } if ( $with->get_onboard_settings() ) { $new->config['onboard-settings'] = array_merge( $new->get_onboard_settings(), $with->get_onboard_settings() ); } if ( $with->get_telemetry_settings() ) { $new->config['telemetry-settings'] = array_merge( $new->get_telemetry_settings(), $with->get_telemetry_settings() ); } if ( $with->get_scheduling() ) { $new->config['scheduling'] = array_merge( $new->get_scheduling(), $with->get_scheduling() ); } return $new; } /** * Extracts the list of strings that can be translated. * * @return array */ public function extract_translatable_strings(): array { $config = $this->config; $strings = array_intersect_key( $config, array_flip( [ 'title', 'description', 'help', ] ) ); if ( isset( $config['keywords'] ) ) { $strings = array_merge( $strings, $config['keywords'] ); } $extract = static function ( &$value ) use ( &$strings, &$extract ) { if ( ! is_array( $value ) ) { return; } foreach ( self::TRANSLATE as $field ) { if ( isset( $value[ $field ] ) ) { $strings = array_merge( $strings, (array) $value[ $field ] ); } } array_walk( $value, $extract ); }; foreach ( self::T_ALL as $field ) { if ( self::T_ABOUT === $field ) { continue; } if ( isset( $config[ $field ] ) ) { $extract( $config[ $field ] ); } } return array_filter( array_values( $strings ), function ( $string ) { return is_string( $string ) && trim( $string, " \t\n\r\0\x0B​" ) !== ''; } ); } /** * Transforms a module's config definition. * * @param array $config The module config. * * @return array */ private static function transform_module_config( array $config ): array { $transformed = \ITSEC_Lib::resolve_schema_refs( $config ); if ( isset( $transformed['user-groups'] ) ) { $item = [ 'oneOf' => [ [ 'type' => 'string', 'format' => 'uuid', ], [ 'type' => 'string', 'enum' => [ 'everybody-else' ], ] ] ]; foreach ( $transformed['user-groups'] as $slug => $group ) { if ( isset( $transformed['settings']['properties'][ $slug ] ) ) { continue; } if ( $group['type'] === 'multiple' ) { $transformed['settings']['properties'][ $slug ] = [ 'type' => 'array', 'items' => $item, 'default' => [], 'readonly' => true, ]; } else { $transformed['settings']['properties'][ $slug ] = [ 'oneOf' => $item['oneOf'], 'default' => '', 'readonly' => true, ]; } } } if ( isset( $transformed['settings'] ) ) { if ( ! isset( $transformed['settings']['$schema'] ) ) { $transformed['settings']['$schema'] = 'http://json-schema.org/draft-04/schema#'; } if ( ! isset( $transformed['settings']['id'] ) ) { $transformed['settings']['id'] = 'itsec-module-' . $config['id']; } } /** * Filters the config definition for a module. * * @param array $transformed The transformed config. * @param array $config The original config. */ return apply_filters( "itsec_{$config['id']}_module_config", $transformed, $config ); } /** * Resolves $ref entries at any point in the config. * * Currently, only a simplified form of JSON Pointers are supported where `/` is the only * allowed control character. * * Additionally, the `$ref` keyword must start with `#/definitions`. * * @param mixed $value The incoming value. * @param string $key The array key. * @param array $definitions The shared definitions. */ private static function resolve_ref( &$value, $key, $definitions ) { if ( ! is_array( $value ) ) { return; } if ( isset( $value['$ref'] ) ) { $ref = str_replace( '#/definitions/', '', $value['$ref'] ); $value = \ITSEC_Lib::array_get( $definitions, $ref, null, '/' ); return; } array_walk( $value, [ static::class, 'resolve_ref' ], $definitions ); } /** * Applies translations to the given value. * * @param mixed $value */ private static function apply_translate( &$value ) { if ( ! is_array( $value ) ) { return; } foreach ( self::TRANSLATE as $field ) { if ( isset( $value[ $field ] ) ) { if ( is_string( $value[ $field ] ) ) { $value[ $field ] = static::translate_value( $value[ $field ] ); } elseif ( wp_is_numeric_array( $value[ $field ] ) ) { $value[ $field ] = array_map( [ static::class, 'translate_value' ], $value[ $field ] ); } } } array_walk( $value, [ static::class, 'apply_translate' ] ); } private static function translate_value( string $value ): string { $translated = translate( $value, 'better-wp-security' ); if ( strpos( $value, '[' ) !== false ) { $translated = preg_replace_callback( '/\[([^\]]+)\]\(([^\)]+)\)/', function ( $matches ) { if ( 0 === strpos( $matches[2], 'itsec://' ) ) { $path = substr( $matches[2], strlen( 'itsec://' ) ); return \ITSEC_Core::get_link_for_settings_route( '/' . $path ) . $matches[1] . ''; } return sprintf( '%s', esc_url( $matches[2] ), $matches[1] ); }, $translated ); } return $translated; } }
Fatal error: Uncaught Error: Class "iThemesSecurity\Module_Config" not found in /htdocs/2.africbio.com/wp-content/plugins/better-wp-security/core/modules.php:123 Stack trace: #0 /htdocs/2.africbio.com/wp-content/plugins/better-wp-security/core/core.php(495): ITSEC_Modules::register_module('feature-flags', '/htdocs/2.afric...') #1 /htdocs/2.africbio.com/wp-includes/class-wp-hook.php(324): ITSEC_Core->register_modules('') #2 /htdocs/2.africbio.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #3 /htdocs/2.africbio.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /htdocs/2.africbio.com/wp-content/plugins/better-wp-security/core/modules.php(829): do_action('itsec-register-...') #5 /htdocs/2.africbio.com/wp-content/plugins/better-wp-security/core/core.php(138): ITSEC_Modules::init_modules() #6 /htdocs/2.africbio.com/wp-content/plugins/better-wp-security/better-wp-security.php(54): ITSEC_Core->init('/htdocs/2.afric...', 'Solid Security ...') #7 /htdocs/2.africbio.com/wp-settings.php(526): include_once('/htdocs/2.afric...') #8 /htdocs/2.africbio.com/wp-config.php(101): require_once('/htdocs/2.afric...') #9 /htdocs/2.africbio.com/wp-load.php(50): require_once('/htdocs/2.afric...') #10 /htdocs/2.africbio.com/wp-blog-header.php(13): require_once('/htdocs/2.afric...') #11 /htdocs/2.africbio.com/index.php(17): require('/htdocs/2.afric...') #12 {main} thrown in /htdocs/2.africbio.com/wp-content/plugins/better-wp-security/core/modules.php on line 123