do_activate_header

Definition:
function do_activate_header() {}

Defined actions

  • activate_wp_head
    do_action( 'activate_wp_head' );

Source code

function do_activate_header() {

	do_action( 'activate_wp_head' );

}

946

do_action_ref_array

Definition:
function do_action_ref_array($tag, $args) {}

Execute functions hooked on a specific action hook, specifying arguments in an array.

Parameters

  • string $tag: The name of the action to be executed.
  • array $args: The arguments supplied to the functions hooked to <tt>$tag</tt>

Return values

returns:Will return null if $tag does not exist in $wp_filter array

Source code

function do_action_ref_array($tag, $args) {

	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;



	if ( ! isset($wp_actions) )

		$wp_actions = array();



	if ( ! isset($wp_actions[$tag]) )

		$wp_actions[$tag] = 1;

	else

		++$wp_actions[$tag];



	// Do 'all' actions first

	if ( isset($wp_filter['all']) ) {

		$wp_current_filter[] = $tag;

		$all_args = func_get_args();

		_wp_call_all_hook($all_args);

	}



	if ( !isset($wp_filter[$tag]) ) {

		if ( isset($wp_filter['all']) )

			array_pop($wp_current_filter);

		return;

	}



	if ( !isset($wp_filter['all']) )

		$wp_current_filter[] = $tag;



	// Sort

	if ( !isset( $merged_filters[ $tag ] ) ) {

		ksort($wp_filter[$tag]);

		$merged_filters[ $tag ] = true;

	}



	reset( $wp_filter[ $tag ] );



	do {

		foreach( (array) current($wp_filter[$tag]) as $the_ )

			if ( !is_null($the_['function']) )

				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));



	} while ( next($wp_filter[$tag]) !== false );



	array_pop($wp_current_filter);

}

944

do_action

Definition:
function do_action($tag, $arg = '') {}

Execute functions hooked on a specific action hook.
This function invokes all functions attached to action hook $tag. It is possible to create new action hooks by simply calling this function, specifying the name of the new hook using the <tt>$tag</tt> parameter.

Parameters

  • string $tag: The name of the action to be executed.
  • mixed $arg,…: Optional additional arguments which are passed on to the functions hooked to the action.
  • $arg

Return values

returns:Will return null if $tag does not exist in $wp_filter array

Source code

function do_action($tag, $arg = '') {

	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;



	if ( ! isset($wp_actions) )

		$wp_actions = array();



	if ( ! isset($wp_actions[$tag]) )

		$wp_actions[$tag] = 1;

	else

		++$wp_actions[$tag];



	// Do 'all' actions first

	if ( isset($wp_filter['all']) ) {

		$wp_current_filter[] = $tag;

		$all_args = func_get_args();

		_wp_call_all_hook($all_args);

	}



	if ( !isset($wp_filter[$tag]) ) {

		if ( isset($wp_filter['all']) )

			array_pop($wp_current_filter);

		return;

	}



	if ( !isset($wp_filter['all']) )

		$wp_current_filter[] = $tag;



	$args = array();

	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)

		$args[] =& $arg[0];

	else

		$args[] = $arg;

	for ( $a = 2; $a < func_num_args(); $a++ )

		$args[] = func_get_arg($a);



	// Sort

	if ( !isset( $merged_filters[ $tag ] ) ) {

		ksort($wp_filter[$tag]);

		$merged_filters[ $tag ] = true;

	}



	reset( $wp_filter[ $tag ] );



	do {

		foreach ( (array) current($wp_filter[$tag]) as $the_ )

			if ( !is_null($the_['function']) )

				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));



	} while ( next($wp_filter[$tag]) !== false );



	array_pop($wp_current_filter);

}

942

download_url

Definition:
function download_url( $url, $timeout = 300 ) {}

Downloads a url to a local temporary file using the WordPress HTTP Class.
Please note, That the calling function must unlink() the file.

Parameters

  • string $url: the URL of the file to download
  • int $timeout: The timeout for the request to download the file default 300 seconds

Return values

returns:WP_Error on failure, string Filename on success.

Source code

function download_url( $url, $timeout = 300 ) {

	//WARNING: The file is not automatically deleted, The script must unlink() the file.

	if ( ! $url )

		return new WP_Error('http_no_url', __('Invalid URL Provided.'));



	$tmpfname = wp_tempnam($url);

	if ( ! $tmpfname )

		return new WP_Error('http_no_file', __('Could not create Temporary file.'));



	$response = wp_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname ) );



	if ( is_wp_error( $response ) ) {

		unlink( $tmpfname );

		return $response;

	}



	if ( 200 != wp_remote_retrieve_response_code( $response ) ){

		unlink( $tmpfname );

		return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );

	}



	return $tmpfname;

}

940

domain_exists

Definition:
function domain_exists($domain, $path, $site_id = 1) {}

Check whether a blogname is already taken.
Used during the new site registration process to ensure that each blogname is unique.

Parameters

  • string $domain: The domain to be checked.
  • string $path: The path to be checked.
  • int $site_id: Optional. Relevant only on multi-network installs.

Source code

function domain_exists($domain, $path, $site_id = 1) {

	global $wpdb;

	return $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );

}

938