wp_network_dashboard_right_now

Definition:
function wp_network_dashboard_right_now() {}

Defined actions

  • wpmuadminresult
    do_action( 'wpmuadminresult', '' );
  • mu_rightnow_end
    do_action( 'mu_rightnow_end' );
  • mu_activity_box_end
    do_action( 'mu_activity_box_end' );

Source code

function wp_network_dashboard_right_now() {

	$actions = array();

	if ( current_user_can('create_sites') )

		$actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';

	if ( current_user_can('create_users') )

		$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';



	$c_users = get_user_count();

	$c_blogs = get_blog_count();



	$user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );

	$blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );



	$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );



	if ( $actions ) {

		echo '<ul class="subsubsub">';

		foreach ( $actions as $class => $action ) {

			 $actions[ $class ] = "\t<li class='$class'>$action";

		}

		echo implode( " |</li>\n", $actions ) . "</li>\n";

		echo '</ul>';

	}

?>

	<br class="clear" />



	<p class="youhave"><?php echo $sentence; ?></p>

	<?php do_action( 'wpmuadminresult', '' ); ?>



	<form name="searchform" action="<?php echo network_admin_url('users.php'); ?>" method="get">

		<p>

			<input type="text" name="s" value="" size="17" />

			<?php submit_button( __( 'Search Users' ), 'button', 'submit', false, array( 'id' => 'submit_users' ) ); ?>

		</p>

	</form>



	<form name="searchform" action="<?php echo network_admin_url('sites.php'); ?>" method="get">

		<p>

			<input type="text" name="s" value="" size="17" />

			<?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?>

		</p>

	</form>

<?php

	do_action( 'mu_rightnow_end' );

	do_action( 'mu_activity_box_end' );

}

10884

wp_list_pluck

Definition:
function wp_list_pluck( $list, $field ) {}

Pluck a certain field out of each object in a list.

Parameters

  • array $list: A list of objects or arrays
  • int|string $field: A field from the object to place instead of the entire object

Source code

function wp_list_pluck( $list, $field ) {

	foreach ( $list as $key => $value ) {

		if ( is_object( $value ) )

			$list[ $key ] = $value->$field;

		else

			$list[ $key ] = $value[ $field ];

	}



	return $list;

}

10847

wp_list_filter

Definition:
function wp_list_filter( $list, $args = array() {}

Filters a list of objects, based on a set of key => value arguments.

Parameters

  • array $list: An array of objects to filter
  • array $args: An array of key => value arguments to match against each object
  • string $operator: The logical operation to perform: ‘AND’ means all elements from the array must match; ‘OR’ means only one element needs to match; ‘NOT’ means no elements may match. The default is ‘AND’.

Source code

function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {

	if ( ! is_array( $list ) )

		return array();



	if ( empty( $args ) )

		return $list;



	$operator = strtoupper( $operator );

	$count = count( $args );

	$filtered = array();



	foreach ( $list as $key => $obj ) {

		$to_match = (array) $obj;



		$matched = 0;

		foreach ( $args as $m_key => $m_value ) {

			if ( $m_value == $to_match[ $m_key ] )

				$matched++;

		}



		if ( ( 'AND' == $operator && $matched == $count )

		  || ( 'OR' == $operator && $matched > 0 )

		  || ( 'NOT' == $operator && 0 == $matched ) ) {

			$filtered[$key] = $obj;

		}

	}



	return $filtered;

}

10844

wp_link_query

Definition:
function wp_link_query( $args = array() {}

Performs post queries for internal linking.

Parameters

  • array $args: Optional. Accepts ‘pagenum’ and ‘s’ (search) arguments.

Return values

returns:Results.

Source code

function wp_link_query( $args = array() ) {

	$pts = get_post_types( array( 'public' => true ), 'objects' );

	$pt_names = array_keys( $pts );



	$query = array(

		'post_type' => $pt_names,

		'suppress_filters' => true,

		'update_post_term_cache' => false,

		'update_post_meta_cache' => false,

		'post_status' => 'publish',

		'order' => 'DESC',

		'orderby' => 'post_date',

		'posts_per_page' => 20,

	);



	$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;



	if ( isset( $args['s'] ) )

		$query['s'] = $args['s'];



	$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;



	// Do main query.

	$get_posts = new WP_Query;

	$posts = $get_posts->query( $query );

	// Check if any posts were found.

	if ( ! $get_posts->post_count )

		return false;



	// Build results.

	$results = array();

	foreach ( $posts as $post ) {

		if ( 'post' == $post->post_type )

			$info = mysql2date( __( 'Y/m/d' ), $post->post_date );

		else

			$info = $pts[ $post->post_type ]->labels->singular_name;



		$results[] = array(

			'ID' => $post->ID,

			'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),

			'permalink' => get_permalink( $post->ID ),

			'info' => $info,

		);

	}



	return $results;

}

10837

wp_link_dialog

Definition:
function wp_link_dialog() {}

Dialog for internal linking.

Source code

function wp_link_dialog() {

?>

<form id="wp-link" tabindex="-1">

<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>

<div id="link-selector">

	<div id="link-options">

		<p class="howto"><?php _e( 'Enter the destination URL' ); ?></p>

		<div>

			<label><span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" tabindex="10" name="href" /></label>

		</div>

		<div>

			<label><span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" tabindex="20" name="linktitle" /></label>

		</div>

		<div class="link-target">

			<label><input type="checkbox" id="link-target-checkbox" tabindex="30" /> <?php _e( 'Open link in a new window/tab' ); ?></label>

		</div>

	</div>

	<?php $show_internal = '1' == get_user_setting( 'wplink', '0' ); ?>

	<p class="howto toggle-arrow <?php if ( $show_internal ) echo 'toggle-arrow-active'; ?>" id="internal-toggle"><?php _e( 'Or link to existing content' ); ?></p>

	<div id="search-panel"<?php if ( ! $show_internal ) echo ' style="display:none"'; ?>>

		<div class="link-search-wrapper">

			<label>

				<span><?php _e( 'Search' ); ?></span>

				<input type="text" id="search-field" class="link-search-field" tabindex="60" autocomplete="off" />

				<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />

			</label>

		</div>

		<div id="search-results" class="query-results">

			<ul></ul>

			<div class="river-waiting">

				<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />

			</div>

		</div>

		<div id="most-recent-results" class="query-results">

			<div class="query-notice"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></div>

			<ul></ul>

			<div class="river-waiting">

				<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />

			</div>

		</div>

	</div>

</div>

<div class="submitbox">

	<div id="wp-link-cancel">

		<a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a>

	</div>

	<div id="wp-link-update">

		<?php submit_button( __('Update'), 'primary', 'wp-link-submit', false, array('tabindex' => 100)); ?>

	</div>

</div>

</form>

<?php

}

10835