芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitioglobal.co/wp-includes/widgets/class-wp-widget-text.php
'widget_text', 'description' => __( 'Arbitrary text.' ), 'customize_selective_refresh' => true, 'show_instance_in_rest' => true, ); $control_ops = array( 'width' => 400, 'height' => 350, ); parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops ); } /** * Adds hooks for enqueueing assets when registering all widget instances of this widget class. * * @param int $number Optional. The unique order number of this widget instance * compared to other instances of the same class. Default -1. */ public function _register_one( $number = -1 ) { parent::_register_one( $number ); if ( $this->registered ) { return; } $this->registered = true; if ( $this->is_preview() ) { add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) ); } /* * Note that the widgets component in the customizer will also do * the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts(). */ add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) ); /* * Note that the widgets component in the customizer will also do * the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts(). */ add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Text', 'render_control_template_scripts' ) ); } /** * Determines whether a given instance is legacy and should bypass using TinyMCE. * * @since 4.8.1 * * @param array $instance { * Instance data. * * @type string $text Content. * @type bool|string $filter Whether autop or content filters should apply. * @type bool $legacy Whether widget is in legacy mode. * } * @return bool Whether Text widget instance contains legacy data. */ public function is_legacy_instance( $instance ) { // Legacy mode when not in visual mode. if ( isset( $instance['visual'] ) ) { return ! $instance['visual']; } // Or, the widget has been added/updated in 4.8.0 then filter prop is 'content' and it is no longer legacy. if ( isset( $instance['filter'] ) && 'content' === $instance['filter'] ) { return false; } // If the text is empty, then nothing is preventing migration to TinyMCE. if ( empty( $instance['text'] ) ) { return false; } $wpautop = ! empty( $instance['filter'] ); $has_line_breaks = ( str_contains( trim( $instance['text'] ), "\n" ) ); // If auto-paragraphs are not enabled and there are line breaks, then ensure legacy mode. if ( ! $wpautop && $has_line_breaks ) { return true; } // If an HTML comment is present, assume legacy mode. if ( str_contains( $instance['text'], '