install_featured

Definition:
function install_featured($page = 1) {}

Display featured plugins.

Parameters

  • string $page

Source code

function install_featured($page = 1) {

	$args = array('browse' => 'featured', 'page' => $page);

	$api = plugins_api('query_plugins', $args);

	if ( is_wp_error($api) )

		wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');

	display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);

}

2029

install_dashboard

Definition:
function install_dashboard() {}

Source code

function install_dashboard() {

	?>

	<p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.') ?></p>



	<h4><?php _e('Search') ?></h4>

	<p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.') ?></p>

	<?php install_search_form(); ?>



	<h4><?php _e('Popular tags') ?></h4>

	<p class="install-help"><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>

	<?php



	$api_tags = install_popular_tags();



	echo '<p class="popular-tags">';

	if ( is_wp_error($api_tags) ) {

		echo $api_tags->get_error_message();

	} else {

		//Set up the tags in a way which can be interprated by wp_generate_tag_cloud()

		$tags = array();

		foreach ( (array)$api_tags as $tag )

			$tags[ $tag['name'] ] = (object) array(

									'link' => esc_url( self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),

									'name' => $tag['name'],

									'id' => sanitize_title_with_dashes($tag['name']),

									'count' => $tag['count'] );

		echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );

	}

	echo '</p><br class="clear" />';

}

2027

install_blog_defaults

Definition:
function install_blog_defaults($blog_id, $user_id) {}

Set blog defaults.
This function creates a row in the wp_blogs table.

Parameters

  • int $blog_id: Ignored in this function.
  • int $user_id

Source code

function install_blog_defaults($blog_id, $user_id) {

	global $wpdb;



	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );



	$wpdb->suppress_errors();



	wp_install_defaults($user_id);



	$wpdb->suppress_errors( false );

}

2025

install_blog

Definition:
function install_blog($blog_id, $blog_title = '') {}

Install an empty blog.
Creates the new blog tables and options. If calling this function directly, be sure to use switch_to_blog() first, so that $wpdb points to the new blog.

Parameters

  • int $blog_id: The value returned by insert_blog().
  • string $blog_title: The title of the new site.

Source code

function install_blog($blog_id, $blog_title = '') {

	global $wpdb, $table_prefix, $wp_roles;

	$wpdb->suppress_errors();



	// Cast for security

	$blog_id = (int) $blog_id;



	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );



	if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )

		die(__('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');



	$wpdb->suppress_errors(false);



	$url = get_blogaddress_by_id($blog_id);



	// Set everything up

	make_db_current_silent( 'blog' );

	populate_options();

	populate_roles();

	$wp_roles->_init();



	// fix url.

	update_option('siteurl', $url);

	update_option('home', $url);

	update_option('fileupload_url', $url . "files" );

	update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files");

	update_option('blogname', stripslashes( $blog_title ) );

	update_option('admin_email', '');

	$wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );



	// remove all perms

	$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'user_level') );

	$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'capabilities') );



	$wpdb->suppress_errors( false );

}

2023

insert_with_markers

Definition:
function insert_with_markers( $filename, $marker, $insertion ) {}

Inserts an array of strings into a file (.htaccess ), placing it between BEGIN and END markers. Replaces existing marked info. Retains surrounding data. Creates file if none exists.

Parameters

  • unknown_type $filename
  • unknown_type $marker
  • unknown_type $insertion

Return values

returns:True on write success, false on failure.

Source code

function insert_with_markers( $filename, $marker, $insertion ) {

	if (!file_exists( $filename ) || is_writeable( $filename ) ) {

		if (!file_exists( $filename ) ) {

			$markerdata = '';

		} else {

			$markerdata = explode( "\n", implode( '', file( $filename ) ) );

		}



		if ( !$f = @fopen( $filename, 'w' ) )

			return false;



		$foundit = false;

		if ( $markerdata ) {

			$state = true;

			foreach ( $markerdata as $n => $markerline ) {

				if (strpos($markerline, '# BEGIN ' . $marker) !== false)

					$state = false;

				if ( $state ) {

					if ( $n + 1 < count( $markerdata ) )

						fwrite( $f, "{$markerline}\n" );

					else

						fwrite( $f, "{$markerline}" );

				}

				if (strpos($markerline, '# END ' . $marker) !== false) {

					fwrite( $f, "# BEGIN {$marker}\n" );

					if ( is_array( $insertion ))

						foreach ( $insertion as $insertline )

							fwrite( $f, "{$insertline}\n" );

					fwrite( $f, "# END {$marker}\n" );

2021