wp_admin_css_color

Definition:
function wp_admin_css_color($key, $name, $url, $colors = array() {}

Registers an admin colour scheme css file.
Allows a plugin to register a new admin colour scheme. For example:

Parameters

  • string $key: The unique key for this theme.
  • string $name: The name of the theme.
  • string $url: The url of the css file containing the colour scheme.
  • array $colors: Optional An array of CSS color definitions which are used to give the user a feel for the theme.

Source code

function wp_admin_css_color($key, $name, $url, $colors = array()) {

	global $_wp_admin_css_colors;



	if ( !isset($_wp_admin_css_colors) )

		$_wp_admin_css_colors = array();



	$_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);

}

3419

wp_admin_css

Definition:
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {}

Enqueues or directly prints a stylesheet link to the specified CSS file.
"Intelligently" decides to enqueue or to print the CSS file. If the ‘wp_print_styles’ action has *not* yet been called, the CSS file will be enqueued. If the wp_print_styles action *has* been called, the CSS link will be printed. Printing may be forced by passing TRUE as the $force_echo (second) parameter.

Parameters

  • string $file: Optional. Style handle name or file name (without “.css” extension) relative to wp-admin/. Defaults to ‘wp-admin’.
  • bool $force_echo: Optional. Force the stylesheet link to be printed rather than enqueued.

Defined filters

  • wp_admin_css
    apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file )
  • wp_admin_css
    apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" )

Source code

function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {

	global $wp_styles;

	if ( !is_a($wp_styles, 'WP_Styles') )

		$wp_styles = new WP_Styles();



	// For backward compatibility

	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;



	if ( $wp_styles->query( $handle ) ) {

		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue.  Print this one immediately

			wp_print_styles( $handle );

		else // Add to style queue

			wp_enqueue_style( $handle );

		return;

	}



	echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );

	if ( is_rtl() )

		echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );

}

3417

wp_add_dashboard_widget

Definition:
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {}

Parameters

  • $widget_id
  • $widget_name
  • $callback
  • $control_callback

Source code

function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {

	$screen = get_current_screen();

	global $wp_dashboard_control_callbacks;



	if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {

		$wp_dashboard_control_callbacks[$widget_id] = $control_callback;

		if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {

			list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );

			$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';

			$callback = '_wp_dashboard_control_callback';

		} else {

			list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );

			$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';

		}

	}



	if ( is_blog_admin () )

		$side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');

	else if (is_network_admin() )

		$side_widgets = array('dashboard_primary', 'dashboard_secondary');

	else

		$side_widgets = array();



	$location = 'normal';

	if ( in_array($widget_id, $side_widgets) )

		$location = 'side';



	$priority = 'core';

	if ( 'dashboard_browser_nag' === $widget_id )

		$priority = 'high';



	add_meta_box( $widget_id, $widget_name, $callback, $screen->id, $location, $priority );

}

3413

wptexturize

Definition:
function wptexturize($text) {}

Replaces common plain text characters into formatted entities
As an example,

Parameters

  • string $text: The text to be formatted

Return values

returns:The string replaced with html entities

Defined filters

  • no_texturize_tags
    apply_filters('no_texturize_tags', $default_no_texturize_tags)
  • no_texturize_shortcodes
    apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes)

Source code

function wptexturize($text) {

	global $wp_cockneyreplace;

	static $opening_quote, $closing_quote, $en_dash, $em_dash, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements;



	// No need to set up these static variables more than once

	if ( empty( $opening_quote ) ) {

		/* translators: opening curly quote */

		$opening_quote = _x('“', 'opening curly quote');

		/* translators: closing curly quote */

		$closing_quote = _x('”', 'closing curly quote');

		/* translators: en dash */

		$en_dash = _x('–', 'en dash');

		/* translators: em dash */

		$em_dash = _x('—', 'em dash');



		$default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt');

		$default_no_texturize_shortcodes = array('code');



		// if a plugin has provided an autocorrect array, use it

		if ( isset($wp_cockneyreplace) ) {

			$cockney = array_keys($wp_cockneyreplace);

			$cockneyreplace = array_values($wp_cockneyreplace);

		} else {

			$cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause");

			$cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");

		}



		$static_characters = array_merge( array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney );

		$static_replacements = array_merge( array($em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace );



		$dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');

		$dynamic_replacements = array('’$1','’$1', '$1‘', '$1″', '$1′', '$1’$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '’$1', '$1×$2');

	}



	// Transform into regexp sub-expression used in _wptexturize_pushpop_element

	// Must do this everytime in case plugins use these filters in a context sensitive manner

	$no_texturize_tags = '(' . implode('|', apply_filters('no_texturize_tags', $default_no_texturize_tags) ) . ')';

	$no_texturize_shortcodes = '(' . implode('|', apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')';



	$no_texturize_tags_stack = array();

	$no_texturize_shortcodes_stack = array();



	$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);



	foreach ( $textarr as &$curl ) {

		if ( empty( $curl ) )

			continue;



		// Only call _wptexturize_pushpop_element if first char is correct tag opening

		$first = $curl[0];

		if ( '<' === $first ) {

			_wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>');

		} elseif ( '[' === $first ) {

			_wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']');

		} elseif ( empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack) ) {

			// This is not a tag, nor is the texturization disabled static strings

			$curl = str_replace($static_characters, $static_replacements, $curl);

			// regular expressions

			$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

		}

		$curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&$1', $curl);

	}

	return implode( '', $textarr );

}

3411