install_plugin_information

Definition:
function install_plugin_information() {}

Display plugin information in dialog box form.

Source code

function install_plugin_information() {

	global $tab;



	$api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) ));



	if ( is_wp_error($api) )

		wp_die($api);



	$plugins_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),

								'abbr' => array('title' => array()), 'acronym' => array('title' => array()),

								'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),

								'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),

								'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),

								'img' => array('src' => array(), 'class' => array(), 'alt' => array()));

	//Sanitize HTML

	foreach ( (array)$api->sections as $section_name => $content )

		$api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);

	foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )

		$api->$key = wp_kses($api->$key, $plugins_allowedtags);



	$section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.

	if ( empty($section) || ! isset($api->sections[ $section ]) )

		$section = array_shift( $section_titles = array_keys((array)$api->sections) );



	iframe_header( __('Plugin Install') );

	echo "<div id='$tab-header'>\n";

	echo "<ul id='sidemenu'>\n";

	foreach ( (array)$api->sections as $section_name => $content ) {



		$title = $section_name;

		$title = ucwords(str_replace('_', ' ', $title));



		$class = ( $section_name == $section ) ? ' class="current"' : '';

		$href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );

		$href = esc_url($href);

		$san_title = esc_attr(sanitize_title_with_dashes($title));

		echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n";

	}

	echo "</ul>\n";

	echo "</div>\n";

	?>

	<div class="alignright fyi">

		<?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?>

		<p class="action-button">

		<?php

		$status = install_plugin_install_status($api);

		switch ( $status['status'] ) {

			case 'install':

				if ( $status['url'] )

					echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';

				break;

			case 'update_available':

				if ( $status['url'] )

					echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';

				break;

			case 'newer_installed':

				echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';

				break;

			case 'latest_installed':

				echo '<a>' . __('Latest Version Installed') . '</a>';

				break;

		}

		?>

		</p>

		<?php endif; ?>

		<h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI') ?></h2>

		<ul>

<?php if ( ! empty($api->version) ) : ?>

			<li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>

<?php endif; if ( ! empty($api->author) ) : ?>

			<li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li>

<?php endif; if ( ! empty($api->last_updated) ) : ?>

			<li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php

							printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>

<?php endif; if ( ! empty($api->requires) ) : ?>

			<li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li>

<?php endif; if ( ! empty($api->tested) ) : ?>

			<li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>

<?php endif; if ( ! empty($api->downloaded) ) : ?>

			<li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>

<?php endif; if ( ! empty($api->slug) && empty($api->external) ) : ?>

			<li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page »') ?></a></li>

<?php endif; if ( ! empty($api->homepage) ) : ?>

			<li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage  »') ?></a></li>

<?php endif; ?>

		</ul>

		<?php if ( ! empty($api->rating) ) : ?>

		<h2><?php _e('Average Rating') ?></h2>

		<div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?>">

			<div class="star star-rating" style="width: <?php echo esc_attr($api->rating) ?>px"></div>

			<div class="star star5"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('5 stars') ?>" /></div>

			<div class="star star4"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('4 stars') ?>" /></div>

			<div class="star star3"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('3 stars') ?>" /></div>

			<div class="star star2"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('2 stars') ?>" /></div>

			<div class="star star1"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php _e('1 star') ?>" /></div>

		</div>

		<small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>

		<?php endif; ?>

	</div>

	<div id="section-holder" class="wrap">

	<?php

		if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )

			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';



		else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )

			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';



		foreach ( (array)$api->sections as $section_name => $content ) {

			$title = $section_name;

			$title[0] = strtoupper($title[0]);

			$title = str_replace('_', ' ', $title);



			$content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/');

			$content = links_add_target($content, '_blank');



			$san_title = esc_attr(sanitize_title_with_dashes($title));



			$display = ( $section_name == $section ) ? 'block' : 'none';



			echo "\t<div id='section-{$san_title}' class='section' style='display: {$display};'>\n";

2039

install_plugins_upload

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

Upload from zip

Parameters

  • string $page

Source code

function install_plugins_upload( $page = 1 ) {

?>

	<h4><?php _e('Install a plugin in .zip format') ?></h4>

	<p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.') ?></p>

	<form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-plugin') ?>">

		<?php wp_nonce_field( 'plugin-upload') ?>

		<label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>

		<input type="file" id="pluginzip" name="pluginzip" />

		<input type="submit" class="button" value="<?php esc_attr_e('Install Now') ?>" />

	</form>

<?php

}

2037

install_new

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

Display new plugins.

Parameters

  • string $page

Source code

function install_new($page = 1) {

	$args = array('browse' => 'new', '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']);

}

2035

install_network

Definition:
function install_network() {}

Install Network.

Source code

function install_network() {

	global $wpdb, $charset_collate;

	$ms_queries = "

CREATE TABLE $wpdb->users (

  ID bigint(20) unsigned NOT NULL auto_increment,

  user_login varchar(60) NOT NULL default '',

  user_pass varchar(64) NOT NULL default '',

  user_nicename varchar(50) NOT NULL default '',

  user_email varchar(100) NOT NULL default '',

  user_url varchar(100) NOT NULL default '',

  user_registered datetime NOT NULL default '0000-00-00 00:00:00',

  user_activation_key varchar(60) NOT NULL default '',

  user_status int(11) NOT NULL default '0',

  display_name varchar(250) NOT NULL default '',

  spam tinyint(2) NOT NULL default '0',

  deleted tinyint(2) NOT NULL default '0',

  PRIMARY KEY  (ID),

  KEY user_login_key (user_login),

  KEY user_nicename (user_nicename)

) $charset_collate;

CREATE TABLE $wpdb->blogs (

  blog_id bigint(20) NOT NULL auto_increment,

  site_id bigint(20) NOT NULL default '0',

  domain varchar(200) NOT NULL default '',

  path varchar(100) NOT NULL default '',

  registered datetime NOT NULL default '0000-00-00 00:00:00',

  last_updated datetime NOT NULL default '0000-00-00 00:00:00',

  public tinyint(2) NOT NULL default '1',

  archived enum('0','1') NOT NULL default '0',

  mature tinyint(2) NOT NULL default '0',

  spam tinyint(2) NOT NULL default '0',

  deleted tinyint(2) NOT NULL default '0',

  lang_id int(11) NOT NULL default '0',

  PRIMARY KEY  (blog_id),

  KEY domain (domain(50),path(5)),

  KEY lang_id (lang_id)

) $charset_collate;

CREATE TABLE $wpdb->blog_versions (

  blog_id bigint(20) NOT NULL default '0',

  db_version varchar(20) NOT NULL default '',

  last_updated datetime NOT NULL default '0000-00-00 00:00:00',

  PRIMARY KEY  (blog_id),

  KEY db_version (db_version)

) $charset_collate;

CREATE TABLE $wpdb->registration_log (

  ID bigint(20) NOT NULL auto_increment,

  email varchar(255) NOT NULL default '',

  IP varchar(30) NOT NULL default '',

  blog_id bigint(20) NOT NULL default '0',

  date_registered datetime NOT NULL default '0000-00-00 00:00:00',

  PRIMARY KEY  (ID),

  KEY IP (IP)

) $charset_collate;

CREATE TABLE $wpdb->site (

  id bigint(20) NOT NULL auto_increment,

  domain varchar(200) NOT NULL default '',

  path varchar(100) NOT NULL default '',

  PRIMARY KEY  (id),

  KEY domain (domain,path)

) $charset_collate;

CREATE TABLE $wpdb->sitemeta (

  meta_id bigint(20) NOT NULL auto_increment,

  site_id bigint(20) NOT NULL default '0',

  meta_key varchar(255) default NULL,

  meta_value longtext,

  PRIMARY KEY  (meta_id),

  KEY meta_key (meta_key),

  KEY site_id (site_id)

) $charset_collate;

CREATE TABLE $wpdb->signups (

  domain varchar(200) NOT NULL default '',

  path varchar(100) NOT NULL default '',

  title longtext NOT NULL,

  user_login varchar(60) NOT NULL default '',

  user_email varchar(100) NOT NULL default '',

  registered datetime NOT NULL default '0000-00-00 00:00:00',

  activated datetime NOT NULL default '0000-00-00 00:00:00',

  active tinyint(1) NOT NULL default '0',

  activation_key varchar(50) NOT NULL default '',

  meta longtext,

  KEY activation_key (activation_key),

  KEY domain (domain)

) $charset_collate;

";

// now create tables

	dbDelta( $ms_queries );

}

2033

install_global_terms

Definition:
function install_global_terms() {}

Install global terms.

Source code

function install_global_terms() {

	global $wpdb, $charset_collate;

	$ms_queries = "

CREATE TABLE $wpdb->sitecategories (

  cat_ID bigint(20) NOT NULL auto_increment,

  cat_name varchar(55) NOT NULL default '',

  category_nicename varchar(200) NOT NULL default '',

  last_updated timestamp NOT NULL,

  PRIMARY KEY  (cat_ID),

  KEY category_nicename (category_nicename),

  KEY last_updated (last_updated)

) $charset_collate;

";

// now create tables

	dbDelta( $ms_queries );

}

2031