get_index_rel_link

Definition:
function get_index_rel_link() {}

Get site index relational link.

Defined filters

  • index_rel_link
    apply_filters( "index_rel_link", $link )

Source code

function get_index_rel_link() {

	$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";

	return apply_filters( "index_rel_link", $link );

}

1430

get_importers

Definition:
function get_importers() {}

Retrieve list of importers.

Source code

function get_importers() {

	global $wp_importers;

	if ( is_array($wp_importers) )

		uasort($wp_importers, create_function('$a, $b', 'return strcmp($a[0], $b[0]);'));

	return $wp_importers;

}

1428

get_image_tag

Definition:
function get_image_tag($id, $alt, $title, $align, $size='medium') {}

An <img src /> tag for an image attachment, scaling it down if requested.
The filter ‘get_image_tag_class’ allows for changing the class name for the image without having to use regular expressions on the HTML content. The parameters are: what WordPress will use for the class, the Attachment ID, image align value, and the size the image should be.

Parameters

  • int $id: Attachment ID.
  • string $alt: Image Description for the alt attribute.
  • string $title: Image Description for the title attribute.
  • string $align: Part of the class name for aligning the image.
  • string $size: Optional. Default is ‘medium’.

Return values

returns:HTML IMG element for given image attachment

Defined filters

  • get_image_tag_class
    apply_filters('get_image_tag_class', $class, $id, $align, $size)
  • get_image_tag
    apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size )

Source code

function get_image_tag($id, $alt, $title, $align, $size='medium') {



	list( $img_src, $width, $height ) = image_downsize($id, $size);

	$hwstring = image_hwstring($width, $height);



	$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;

	$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);



	$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.'class="'.$class.'" />';



	$html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );



	return $html;

}

1426

get_image_send_to_editor

Definition:
function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {}

Parameters

  • unknown_type $id
  • unknown_type $alt
  • unknown_type $title
  • unknown_type $align
  • unknown_type $url
  • unknown_type $rel
  • unknown_type $size
  • $caption

Defined filters

  • image_send_to_editor
    apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt )

Source code

function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {



	$html = get_image_tag($id, $alt, $title, $align, $size);



	$rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';



	if ( $url )

		$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";



	$html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );



	return $html;

}

1424

get_images_from_uri

Definition:
function get_images_from_uri($uri) {}

Retrieve all image URLs from given URI.

Parameters

  • string $uri

Source code

		function get_images_from_uri($uri) {

			$uri = preg_replace('/\/#.+?$/','', $uri);

			if ( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )

				return "'" . esc_attr( html_entity_decode($uri) ) . "'";

			$content = wp_remote_fopen($uri);

			if ( false === $content )

				return '';

			$host = parse_url($uri);

			$pattern = '/<img ([^>]*)src=(\"|\')([^<>\'\"]+)(\2)([^>]*)\/*>/i';

			$content = str_replace(array("\n","\t","\r"), '', $content);

			preg_match_all($pattern, $content, $matches);

			if ( empty($matches[0]) )

				return '';

			$sources = array();

			foreach ($matches[3] as $src) {

				// if no http in url

				if (strpos($src, 'http') === false)

					// if it doesn't have a relative uri

					if ( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0)

						$src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);

					else

						$src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);

				$sources[] = esc_url($src);

			}

			return "'" . implode("','", $sources) . "'";

		}

1422