p_screen !== null && ! empty( $wp_screen->post_type ) ) { return $wp_screen->post_type; } return ''; } /** * Gets the type of the current page. * * @return string Returns 'post' if the current page is a post edit page. Taxonomy in other cases. */ public static function get_page_type() { global $pagenow; if ( WPSEO_Metabox::is_post_edit( $pagenow ) ) { return 'post'; } return 'taxonomy'; } /** * Getter for the Adminl10n array. Applies the wpseo_admin_l10n filter. * * @return array The Adminl10n array. */ public static function get_admin_l10n() { $post_type = self::get_post_type(); $page_type = self::get_page_type(); $label_object = false; $no_index = false; if ( $page_type === 'post' ) { $label_object = get_post_type_object( $post_type ); $no_index = WPSEO_Options::get( 'noindex-' . $post_type, false ); } else { $label_object = WPSEO_Taxonomy::get_labels(); $wp_screen = get_current_screen(); if ( $wp_screen !== null && ! empty( $wp_screen->taxonomy ) ) { $taxonomy_slug = $wp_screen->taxonomy; $no_index = WPSEO_Options::get( 'noindex-tax-' . $taxonomy_slug, false ); } } $wpseo_admin_l10n = [ 'displayAdvancedTab' => WPSEO_Capability_Utils::current_user_can( 'wpseo_edit_advanced_metadata' ) || ! WPSEO_Options::get( 'disableadvanced_meta' ), 'noIndex' => (bool) $no_index, 'isPostType' => (bool) get_post_type(), 'postType' => get_post_type(), 'postTypeNamePlural' => ( $page_type === 'post' ) ? $label_object->label : $label_object->name, 'postTypeNameSingular' => ( $page_type === 'post' ) ? $label_object->labels->singular_name : $label_object->singular_name, 'isBreadcrumbsDisabled' => WPSEO_Options::get( 'breadcrumbs-enable', false ) !== true && ! current_theme_supports( 'yoast-seo-breadcrumbs' ), // phpcs:ignore Generic.ControlStructures.DisallowYodaConditions -- Bug: squizlabs/PHP_CodeSniffer#2962. 'isPrivateBlog' => ( (string) get_option( 'blog_public' ) ) === '0', 'news_seo_is_active' => ( defined( 'WPSEO_NEWS_FILE' ) ), ]; $additional_entries = apply_filters( 'wpseo_admin_l10n', [] ); if ( is_array( $additional_entries ) ) { $wpseo_admin_l10n = array_merge( $wpseo_admin_l10n, $additional_entries ); } return $wpseo_admin_l10n; } /** * Retrieves the analysis worker log level. Defaults to errors only. * * Uses bool YOAST_SEO_DEBUG as flag to enable logging. Off equals ERROR. * Uses string YOAST_SEO_DEBUG_ANALYSIS_WORKER as log level for the Analysis * Worker. Defaults to INFO. * Can be: TRACE, DEBUG, INFO, WARN or ERROR. * * @return string The log level to use. */ public static function get_analysis_worker_log_level() { if ( defined( 'YOAST_SEO_DEBUG' ) && YOAST_SEO_DEBUG ) { return defined( 'YOAST_SEO_DEBUG_ANALYSIS_WORKER' ) ? YOAST_SEO_DEBUG_ANALYSIS_WORKER : 'INFO'; } return 'ERROR'; } /** * Returns the unfiltered home URL. * * In case WPML is installed, returns the original home_url and not the WPML version. * In case of a multisite setup we return the network_home_url. * * @codeCoverageIgnore * * @return string The home url. */ public static function get_home_url() { return YoastSEO()->helpers->url->network_safe_home_url(); } /** * Prepares data for outputting as JSON. * * @param array $data The data to format. * * @return false|string The prepared JSON string. */ public static function format_json_encode( $data ) { $flags = ( JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); if ( self::is_development_mode() ) { $flags = ( $flags | JSON_PRETTY_PRINT ); /** * Filter the Yoast SEO development mode. * * @param array $data Allows filtering of the JSON data for debug purposes. */ $data = apply_filters( 'wpseo_debug_json_data', $data ); } // phpcs:ignore Yoast.Yoast.JsonEncodeAlternative.FoundWithAdditionalParams -- This is the definition of format_json_encode. return wp_json_encode( $data, $flags ); } /** * Extends the allowed post tags with accessibility-related attributes. * * @codeCoverageIgnore * * @param array $allowed_post_tags The allowed post tags. * * @return array The allowed tags including post tags, input tags and select tags. */ public static function extend_kses_post_with_a11y( $allowed_post_tags ) { static $a11y_tags; if ( isset( $a11y_tags ) === false ) { $a11y_tags = [ 'button' => [ 'aria-expanded' => true, 'aria-controls' => true, ], 'div' => [ 'tabindex' => true, ], // Below are attributes that are needed for backwards compatibility (WP < 5.1). 'span' => [ 'aria-hidden' => true, ], 'input' => [ 'aria-describedby' => true, ], 'select' => [ 'aria-describedby' => true, ], 'textarea' => [ 'aria-describedby' => true, ], ]; // Add the global allowed attributes to each html element. $a11y_tags = array_map( '_wp_add_global_attributes', $a11y_tags ); } return array_merge_recursive( $allowed_post_tags, $a11y_tags ); } /** * Extends the allowed post tags with input, select and option tags. * * @codeCoverageIgnore * * @param array $allowed_post_tags The allowed post tags. * * @return array The allowed tags including post tags, input tags, select tags and option tags. */ public static function extend_kses_post_with_forms( $allowed_post_tags ) { static $input_tags; if ( isset( $input_tags ) === false ) { $input_tags = [ 'input' => [ 'accept' => true, 'accesskey' => true, 'align' => true, 'alt' => true, 'autocomplete' => true, 'autofocus' => true, 'checked' => true, 'contenteditable' => true, 'dirname' => true, 'disabled' => true, 'draggable' => true, 'dropzone' => true, 'form' => true, 'formaction' => true, 'formenctype' => true, 'formmethod' => true, 'formnovalidate' => true, 'formtarget' => true, 'height' => true, 'hidden' => true, 'lang' => true, 'list' => true, 'max' => true, 'maxlength' => true, 'min' => true, 'multiple' => true, 'name' => true, 'pattern' => true, 'placeholder' => true, 'readonly' => true, 'required' => true, 'size' => true, 'spellcheck' => true, 'src' => true, 'step' => true, 'tabindex' => true, 'translate' => true, 'type' => true, 'value' => true, 'width' => true, /* * Below are attributes that are needed for backwards compatibility (WP < 5.1). * They are used for the social media image in the metabox. * These can be removed once we move to the React versions of the social previews. */ 'data-target' => true, 'data-target-id' => true, ], 'select' => [ 'accesskey' => true, 'autofocus' => true, 'contenteditable' => true, 'disabled' => true, 'draggable' => true, 'dropzone' => true, 'form' => true, 'hidden' => true, 'lang' => true, 'multiple' => true, 'name' => true, 'onblur' => true, 'onchange' => true, 'oncontextmenu' => true, 'onfocus' => true, 'oninput' => true, 'oninvalid' => true, 'onreset' => true, 'onsearch' => true, 'onselect' => true, 'onsubmit' => true, 'required' => true, 'size' => true, 'spellcheck' => true, 'tabindex' => true, 'translate' => true, ], 'option' => [ 'class' => true, 'disabled' => true, 'id' => true, 'label' => true, 'selected' => true, 'value' => true, ], ]; // Add the global allowed attributes to each html element. $input_tags = array_map( '_wp_add_global_attributes', $input_tags ); } return array_merge_recursive( $allowed_post_tags, $input_tags ); } /** * Gets an array of enabled features. * * @return string[] The array of enabled features. */ public static function retrieve_enabled_features() { /** * The feature flag integration. * * @var Feature_Flag_Integration $feature_flag_integration; */ $feature_flag_integration = YoastSEO()->classes->get( Feature_Flag_Integration::class ); return $feature_flag_integration->get_enabled_features(); } } ووردبريس › خطأ

كان هناك خطأ فادح في هذا الموقع.

معرفة المزيد حول استكشاف الأخطاء في ووردبريس.