links_popup_script

Definition:
function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {}

Show the link to the links popup and the number of links.

Parameters

  • string $text: the text of the link
  • int $width: the width of the popup window
  • int $height: the height of the popup window
  • string $file: the page to open in the popup window
  • bool $count: the number of links in the db

Source code

function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {

	_deprecated_function( __FUNCTION__, '2.1' );



	if ( $count )

		$counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");



	$javascript = "<a href=\"#\" onclick=\"javascript:window.open('$file?popup=1', '_blank', 'width=$width,height=$height,scrollbars=yes,status=no'); return false\">";

	$javascript .= $text;



	if ( $count )

		$javascript .= " ($counts)";



	$javascript .= "</a>\n\n";

		echo $javascript;

}

2249

links_add_target

Definition:
function links_add_target( $content, $target = '_blank', $tags = array('a') {}

Adds a Target attribute to all links in passed content.
This function by default only applies to <a> tags, however this can be modified by the 3rd param.

Parameters

  • string $content: String to search for links in.
  • string $target: The Target to add to the links.
  • array $tags: An array of tags to apply to.

Return values

returns:The processed content.

Source code

function links_add_target( $content, $target = '_blank', $tags = array('a') ) {

	global $_links_add_target;

	$_links_add_target = $target;

	$tags = implode('|', (array)$tags);

	return preg_replace_callback( "!<($tags)(.+?)>!i", '_links_add_target', $content );

}

2247

links_add_base_url

Definition:
function links_add_base_url( $content, $base, $attrs = array('src', 'href') {}

Add a Base url to relative links in passed content.
By default it supports the ‘src’ and ‘href’ attributes. However this can be changed via the 3rd param.

Parameters

  • string $content: String to search for links in.
  • string $base: The base URL to prefix to links.
  • array $attrs: The attributes which should be processed.

Return values

returns:The processed content.

Source code

function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {

	global $_links_add_base;

	$_links_add_base = $base;

	$attrs = implode('|', (array)$attrs);

	return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );

}

2245

like_escape

Definition:
function like_escape($text) {}

Escapes text for SQL LIKE special characters % and _.

Parameters

  • string $text: The text to be escaped.

Return values

returns:text, safe for inclusion in LIKE query.

Source code

function like_escape($text) {

	return str_replace(array("%", "_"), array("\\%", "\\_"), $text);

}

2243

language_attributes

Definition:
function language_attributes($doctype = 'html') {}

Display the language attributes for the html tag.
Builds up a set of html attributes containing the text direction and language information for the page.

Parameters

  • string $doctype: The type of html document (xhtml|html).

Defined filters

  • language_attributes
    apply_filters('language_attributes', $output)

Source code

function language_attributes($doctype = 'html') {

	$attributes = array();

	$output = '';



	if ( function_exists( 'is_rtl' ) )

		$attributes[] = 'dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"';



	if ( $lang = get_bloginfo('language') ) {

		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )

			$attributes[] = "lang=\"$lang\"";



		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )

			$attributes[] = "xml:lang=\"$lang\"";

	}



	$output = implode(' ', $attributes);

	$output = apply_filters('language_attributes', $output);

	echo $output;

}

2241