wp/wp-includes/widgets/class-wp-widget-custom-html.php
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    67 		if ( $this->registered ) {
    67 		if ( $this->registered ) {
    68 			return;
    68 			return;
    69 		}
    69 		}
    70 		$this->registered = true;
    70 		$this->registered = true;
    71 
    71 
    72 		wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );
    72 		/*
    73 
    73 		 * Note that the widgets component in the customizer will also do
    74 		// Note that the widgets component in the customizer will also do
    74 		 * the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
    75 		// the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
    75 		 */
    76 		add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
    76 		add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
    77 
    77 
    78 		// Note that the widgets component in the customizer will also do
    78 		/*
    79 		// the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
    79 		 * Note that the widgets component in the customizer will also do
       
    80 		 * the 'admin_footer-widgets.php' action in WP_Customize_Widgets::print_footer_scripts().
       
    81 		 */
    80 		add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Custom_HTML', 'render_control_template_scripts' ) );
    82 		add_action( 'admin_footer-widgets.php', array( 'WP_Widget_Custom_HTML', 'render_control_template_scripts' ) );
    81 
    83 
    82 		// Note this action is used to ensure the help text is added to the end.
    84 		// Note this action is used to ensure the help text is added to the end.
    83 		add_action( 'admin_head-widgets.php', array( 'WP_Widget_Custom_HTML', 'add_help_text' ) );
    85 		add_action( 'admin_head-widgets.php', array( 'WP_Widget_Custom_HTML', 'add_help_text' ) );
    84 	}
    86 	}
   214 				),
   216 				),
   215 			)
   217 			)
   216 		);
   218 		);
   217 
   219 
   218 		wp_enqueue_script( 'custom-html-widgets' );
   220 		wp_enqueue_script( 'custom-html-widgets' );
       
   221 		wp_add_inline_script( 'custom-html-widgets', sprintf( 'wp.customHtmlWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );
       
   222 
   219 		if ( empty( $settings ) ) {
   223 		if ( empty( $settings ) ) {
   220 			$settings = array(
   224 			$settings = array(
   221 				'disabled' => true,
   225 				'disabled' => true,
   222 			);
   226 			);
   223 		}
   227 		}
   312 				__( 'The edit field automatically highlights code syntax. You can disable this in your <a href="%1$s" %2$s>user profile%3$s</a> to work in plain text mode.' ),
   316 				__( 'The edit field automatically highlights code syntax. You can disable this in your <a href="%1$s" %2$s>user profile%3$s</a> to work in plain text mode.' ),
   313 				esc_url( get_edit_profile_url() ),
   317 				esc_url( get_edit_profile_url() ),
   314 				'class="external-link" target="_blank"',
   318 				'class="external-link" target="_blank"',
   315 				sprintf(
   319 				sprintf(
   316 					'<span class="screen-reader-text"> %s</span>',
   320 					'<span class="screen-reader-text"> %s</span>',
   317 					/* translators: Accessibility text. */
   321 					/* translators: Hidden accessibility text. */
   318 					__( '(opens in a new tab)' )
   322 					__( '(opens in a new tab)' )
   319 				)
   323 				)
   320 			);
   324 			);
   321 			$content .= '</p>';
   325 			$content .= '</p>';
   322 
   326