name. Generated from the Reedach rules by build.mjs. * * @return array */ function reedach_categories() { static $categories = null; if ( null === $categories ) { $categories = require __DIR__ . '/includes/categories.php'; } return $categories; } /** * Categories switched off on the settings page. * * @return string[] */ function reedach_disabled() { $value = get_option( 'reedach_disabled', array() ); return is_array( $value ) ? array_values( array_intersect( $value, array_keys( reedach_categories() ) ) ) : array(); } add_action( 'enqueue_block_editor_assets', function () { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! $screen || 'post' !== $screen->base || ! current_user_can( 'edit_posts' ) ) { return; } $url = plugin_dir_url( __FILE__ ); wp_enqueue_script( 'reedach-editor', $url . 'build/editor.js', array( 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-plugins', 'wp-preferences', 'wp-rich-text' ), REEDACH_VERSION . '.' . filemtime( __DIR__ . '/build/editor.js' ), true ); $settings = array( 'disabled' => reedach_disabled(), 'yo' => (bool) get_option( 'reedach_yo', false ), 'strings' => array( /* translators: %d: number of suggestions. */ 'count' => __( 'Suggestions: %d', 'reedach' ), 'none' => __( 'No suggestions.', 'reedach' ), 'highlight' => __( 'Highlight in the text', 'reedach' ), /* translators: %s: the suggested word. */ 'replace' => __( 'Replace with %s', 'reedach' ), 'remove' => __( 'Remove', 'reedach' ), /* translators: %s: the text to remove. */ 'removeLabel' => __( 'Remove %s', 'reedach' ), /* translators: %s: the text that goes in. */ 'apply' => __( 'Accept “%s”', 'reedach' ), /* translators: 1: the text in the post, 2: the text that replaces it. */ 'applyLabel' => __( 'Replace %1$s with %2$s', 'reedach' ), 'nbsp' => __( 'Non-breaking space', 'reedach' ), /* translators: %s: the text that gets a non-breaking space. */ 'nbspLabel' => __( 'Put a non-breaking space in %s', 'reedach' ), 'skip' => __( 'Skip', 'reedach' ), /* translators: %s: the text of the suggestion. */ 'skipLabel' => __( 'Skip the suggestion %s', 'reedach' ), /* translators: %s: the text of the skipped suggestion. */ 'skipped' => __( 'Skipped “%s”.', 'reedach' ), 'restore' => __( 'Bring back', 'reedach' ), /* translators: %d: number of skipped suggestions. */ 'hidden' => __( 'Skipped suggestions: %d.', 'reedach' ), 'showHidden' => __( 'Show again', 'reedach' ), 'credit' => __( 'Hints are a guide, not a rule: the choice is yours. The list updates as you type. Click a hint to find it in the text, or a suggested word to put it in.', 'reedach' ), ), ); wp_add_inline_script( 'reedach-editor', 'window.reedachSettings = ' . wp_json_encode( $settings ) . ';', 'before' ); wp_enqueue_style( 'reedach-editor', $url . 'assets/editor.css', array(), REEDACH_VERSION . '.' . filemtime( __DIR__ . '/assets/editor.css' ) ); } ); add_action( 'admin_init', function () { register_setting( 'reedach', 'reedach_disabled', array( 'type' => 'array', 'default' => array(), 'sanitize_callback' => 'reedach_sanitize_disabled', ) ); register_setting( 'reedach', 'reedach_yo', array( 'type' => 'boolean', 'default' => false, 'sanitize_callback' => 'rest_sanitize_boolean', ) ); } ); /** * The form sends key => '1' for checked categories and key => '0' for the rest; the option keeps the keys switched off. * * @param mixed $value Form value or an already clean list. * @return string[] */ function reedach_sanitize_disabled( $value ) { if ( ! is_array( $value ) ) { return array(); } $known = array_keys( reedach_categories() ); if ( array_values( $value ) === $value ) { return array_values( array_intersect( array_map( 'strval', $value ), $known ) ); } $off = array(); foreach ( $known as $key ) { if ( isset( $value[ $key ] ) && '1' !== $value[ $key ] ) { $off[] = $key; } } return $off; } add_action( 'admin_menu', function () { add_options_page( 'Reedach', 'Reedach', 'manage_options', 'reedach', 'reedach_settings_page' ); } ); add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), function ( $links ) { array_unshift( $links, '' . esc_html__( 'Settings', 'reedach' ) . '' ); return $links; } ); /** * Settings → Reedach: which kinds of hints authors see. */ function reedach_settings_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $off = reedach_disabled(); ?>

Reedach

$name ) : ?>

dimafaller.ru/reedach' ); ?>