wp_post_mime_type_where

Definition:
function wp_post_mime_type_where($post_mime_types, $table_alias = '') {}

Convert MIME types into SQL.

Parameters

  • string|array $post_mime_types: List of mime types or comma separated string of mime types.
  • string $table_alias: Optional. Specify a table alias, if needed.

Return values

returns:The SQL AND clause for mime searching.

Source code

function wp_post_mime_type_where($post_mime_types, $table_alias = '') {

	$where = '';

	$wildcards = array('', '%', '%/%');

	if ( is_string($post_mime_types) )

		$post_mime_types = array_map('trim', explode(',', $post_mime_types));

	foreach ( (array) $post_mime_types as $mime_type ) {

		$mime_type = preg_replace('/\s/', '', $mime_type);

		$slashpos = strpos($mime_type, '/');

		if ( false !== $slashpos ) {

			$mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos));

			$mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1));

			if ( empty($mime_subgroup) )

				$mime_subgroup = '*';

			else

				$mime_subgroup = str_replace('/', '', $mime_subgroup);

			$mime_pattern = "$mime_group/$mime_subgroup";

		} else {

			$mime_pattern = preg_replace('/[^-*.a-zA-Z0-9]/', '', $mime_type);

			if ( false === strpos($mime_pattern, '*') )

				$mime_pattern .= '/*';

		}



		$mime_pattern = preg_replace('/\*+/', '%', $mime_pattern);



		if ( in_array( $mime_type, $wildcards ) )

			return '';



		if ( false !== strpos($mime_pattern, '%') )

			$wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'";

		else

			$wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'";

	}

	if ( !empty($wheres) )

		$where = ' AND (' . join(' OR ', $wheres) . ') ';

	return $where;

}

3989

wp_popular_terms_checklist

Definition:
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {}

Parameters

  • unknown_type $taxonomy
  • unknown_type $default
  • unknown_type $number
  • unknown_type $echo

Defined filters

  • the_category
    apply_filters( 'the_category', $term->name )

Source code

function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {

	global $post_ID;



	if ( $post_ID )

		$checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids'));

	else

		$checked_terms = array();



	$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );



	$tax = get_taxonomy($taxonomy);

	if ( ! current_user_can($tax->cap->assign_terms) )

		$disabled = 'disabled="disabled"';

	else

		$disabled = '';



	$popular_ids = array();

	foreach ( (array) $terms as $term ) {

		$popular_ids[] = $term->term_id;

		if ( !$echo ) // hack for AJAX use

			continue;

		$id = "popular-$taxonomy-$term->term_id";

		$checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';

		?>



		<li id="<?php echo $id; ?>" class="popular-category">

			<label class="selectit">

			<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>

				<?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>

			</label>

		</li>



		<?php

	}

	return $popular_ids;

}

3987

wp_plugin_update_rows

Definition:
function wp_plugin_update_rows() {}

Source code

function wp_plugin_update_rows() {

	if ( !current_user_can('update_plugins' ) )

		return;



	$plugins = get_site_transient( 'update_plugins' );

	if ( isset($plugins->response) && is_array($plugins->response) ) {

		$plugins = array_keys( $plugins->response );

		foreach( $plugins as $plugin_file ) {

			add_action( "after_plugin_row_$plugin_file", 'wp_plugin_update_row', 10, 2 );

		}

	}

}

3985

wp_plugin_update_row

Definition:
function wp_plugin_update_row( $file, $plugin_data ) {}

Parameters

  • $file
  • $plugin_data

Defined actions

  • in_plugin_update_message-$file
    do_action( "in_plugin_update_message-$file", $plugin_data, $r );

Source code

function wp_plugin_update_row( $file, $plugin_data ) {

	$current = get_site_transient( 'update_plugins' );

	if ( !isset( $current->response[ $file ] ) )

		return false;



	$r = $current->response[ $file ];



	$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());

	$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );



	$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');



	$wp_list_table = _get_list_table('WP_Plugins_List_Table');



	if ( is_network_admin() || !is_multisite() ) {

		echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';



		if ( ! current_user_can('update_plugins') )

			printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );

		else if ( empty($r->package) )

			printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );

		else

			printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) );



		do_action( "in_plugin_update_message-$file", $plugin_data, $r );



		echo '</div></td></tr>';

	}

}

3983

wp_plugin_directory_constants

Definition:
function wp_plugin_directory_constants( ) {}

Defines plugin directory WordPress constants
Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in

Source code

function wp_plugin_directory_constants( ) {

	if ( !defined('WP_CONTENT_URL') )

		define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up



	/**

	 * Allows for the plugins directory to be moved from the default location.

	 *

	 * @since 2.6.0

	 */

	if ( !defined('WP_PLUGIN_DIR') )

		define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash



	/**

	 * Allows for the plugins directory to be moved from the default location.

	 *

	 * @since 2.6.0

	 */

	if ( !defined('WP_PLUGIN_URL') )

		define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash



	/**

	 * Allows for the plugins directory to be moved from the default location.

	 *

	 * @since 2.1.0

	 * @deprecated

	 */

	if ( !defined('PLUGINDIR') )

		define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.



	/**

	 * Allows for the mu-plugins directory to be moved from the default location.

	 *

	 * @since 2.8.0

	 */

	if ( !defined('WPMU_PLUGIN_DIR') )

		define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash



	/**

	 * Allows for the mu-plugins directory to be moved from the default location.

	 *

	 * @since 2.8.0

	 */

	if ( !defined('WPMU_PLUGIN_URL') )

		define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash



	/**

	 * Allows for the mu-plugins directory to be moved from the default location.

	 *

	 * @since 2.8.0

	 * @deprecated

	 */

	if ( !defined( 'MUPLUGINDIR' ) )

		define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.

}

3981