show_message

Definition:
function show_message($message) {}

Parameters

  • unknown_type $message

Source code

function show_message($message) {

	if ( is_wp_error($message) ){

		if ( $message->get_error_data() )

			$message = $message->get_error_message() . ': ' . $message->get_error_data();

		else

			$message = $message->get_error_message();

	}

	echo "<p>$message</p>\n";

	wp_ob_end_flush_all();

	flush();

}

2869

shortcode_unautop

Definition:
function shortcode_unautop( $pee ) {}

Don’t auto-p wrap shortcodes that stand alone
Ensures that shortcodes are not wrapped in <p>…</p>.

Parameters

  • string $pee: The content.

Return values

returns:The filtered content.

Source code

function shortcode_unautop( $pee ) {

	global $shortcode_tags;



	if ( empty( $shortcode_tags ) || !is_array( $shortcode_tags ) ) {

		return $pee;

	}



	$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );



	$pattern =

		  '/'

		. '<p>'                              // Opening paragraph

		. '\\s*+'                            // Optional leading whitespace

		. '('                                // 1: The shortcode

		.     '\\['                          // Opening bracket

		.     "($tagregexp)"                 // 2: Shortcode name

		.     '\\b'                          // Word boundary

		                                     // Unroll the loop: Inside the opening shortcode tag

		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash

		.     '(?:'

		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket

		.         '[^\\]\\/]*'               // Not a closing bracket or forward slash

		.     ')*?'

		.     '(?:'

		.         '\\/\\]'                   // Self closing tag and closing bracket

		.     '|'

		.         '\\]'                      // Closing bracket

		.         '(?:'                      // Unroll the loop: Optionally, anything between the opening and closing shortcode tags

		.             '[^\\[]*+'             // Not an opening bracket

		.             '(?:'

		.                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag

		.                 '[^\\[]*+'         // Not an opening bracket

		.             ')*+'

		.             '\\[\\/\\2\\]'         // Closing shortcode tag

		.         ')?'

		.     ')'

		. ')'

		. '\\s*+'                            // optional trailing whitespace

		. '<\\/p>'                           // closing paragraph

		. '/s';



	return preg_replace( $pattern, '$1', $pee );

}

2865

shortcode_parse_atts

Definition:
function shortcode_parse_atts($text) {}

Retrieve all attributes from the shortcodes tag.
The attributes list has the attribute name as the key and the value of the attribute as the value in the key/value pair. This allows for easier retrieval of the attributes, since all attributes have to be known.

Parameters

  • string $text

Return values

returns:List of attributes and their value.

Source code

function shortcode_parse_atts($text) {

	$atts = array();

	$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';

	$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);

	if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {

		foreach ($match as $m) {

			if (!empty($m[1]))

				$atts[strtolower($m[1])] = stripcslashes($m[2]);

			elseif (!empty($m[3]))

				$atts[strtolower($m[3])] = stripcslashes($m[4]);

			elseif (!empty($m[5]))

				$atts[strtolower($m[5])] = stripcslashes($m[6]);

			elseif (isset($m[7]) and strlen($m[7]))

				$atts[] = stripcslashes($m[7]);

			elseif (isset($m[8]))

				$atts[] = stripcslashes($m[8]);

		}

	} else {

		$atts = ltrim($text);

	}

	return $atts;

}

2863

shortcode_atts

Definition:
function shortcode_atts($pairs, $atts) {}

Combine user attributes with known attributes and fill in defaults when needed.
The pairs should be considered to be all of the attributes which are supported by the caller and given as a list. The returned attributes will only contain the attributes in the $pairs list.

Parameters

  • array $pairs: Entire list of supported attributes and their defaults.
  • array $atts: User defined attributes in shortcode tag.

Return values

returns:Combined and filtered attribute list.

Source code

function shortcode_atts($pairs, $atts) {

	$atts = (array)$atts;

	$out = array();

	foreach($pairs as $name => $default) {

		if ( array_key_exists($name, $atts) )

			$out[$name] = $atts[$name];

		else

			$out[$name] = $default;

	}

	return $out;

}

2861