wppaste
WordPress

WP_Widget_Custom_HTML::render_control_template_scripts()

Since
4.9.0
Source
wp-includes/widgets/class-wp-widget-custom-html.php:262
Render form template scripts.

Uses · 4

  • esc_html_e()Displays translated text that has been escaped for safe use in HTML output.
  • current_user_can()Returns whether the current user has the specified capability.
  • wp_kses_allowed_html()Returns an array of allowed HTML tags and attributes for a given context.
  • _e()Displays translated text.

Source

	public static function render_control_template_scripts() {		?>		<script type="text/html" id="tmpl-widget-custom-html-control-fields">			<# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #>			<p>				<label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label>				<input id="{{ elementIdPrefix }}title" type="text" class="widefat title">			</p> 			<p>				<label for="{{ elementIdPrefix }}content" id="{{ elementIdPrefix }}content-label"><?php esc_html_e( 'Content:' ); ?></label>				<textarea id="{{ elementIdPrefix }}content" class="widefat code content" rows="16" cols="20"></textarea>			</p> 			<?php if ( ! current_user_can( 'unfiltered_html' ) ) : ?>				<?php				$probably_unsafe_html = array( 'script', 'iframe', 'form', 'input', 'style' );				$allowed_html         = wp_kses_allowed_html( 'post' );				$disallowed_html      = array_diff( $probably_unsafe_html, array_keys( $allowed_html ) );				?>				<?php if ( ! empty( $disallowed_html ) ) : ?>					<# if ( data.codeEditorDisabled ) { #>						<p>							<?php _e( 'Some HTML tags are not permitted, including:' ); ?>							<code><?php echo implode( '</code>, <code>', $disallowed_html ); ?></code>						</p>					<# } #>				<?php endif; ?>			<?php endif; ?> 			<div class="code-editor-error-container"></div>		</script>		<?php	}

History

Introduced in 4.9.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/widgets/class-wp-widget-custom-html.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.