wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



links_add_base_url › WordPress Function

Da2.7.0
Deprecaton/a
links_add_base_url ( $content, $base, $attrs = array('src', 'href') )
Parametri: (3)
  • (string) $content String to search for links in.
    Richiesto:
  • (string) $base The base URL to prefix to links.
    Richiesto:
  • (array) $attrs The attributes which should be processed.
    Richiesto: No
    Default: array('src', 'href')
Ritorna:
  • (string) The processed content.
Definito a:
Codex:

Adds a base URL to relative links in passed content.

By default, this function supports the 'src' and 'href' attributes. However, this can be modified via the $attrs parameter.


Sorgenti

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 );
}