当前位置: 首页>>代码示例>>PHP>>正文


PHP get_available_post_mime_types函数代码示例

本文整理汇总了PHP中get_available_post_mime_types函数的典型用法代码示例。如果您正苦于以下问题:PHP get_available_post_mime_types函数的具体用法?PHP get_available_post_mime_types怎么用?PHP get_available_post_mime_types使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_available_post_mime_types函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_edit_attachments_query

/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument
 *
 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $post_type = get_post_type_object('attachment');
    $states = 'inherit';
    if (current_user_can($post_type->cap->read_private_posts)) {
        $states .= ',private';
    }
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : $states;
    $media_per_page = (int) get_user_option('upload_per_page');
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    if (isset($q['detached'])) {
        add_filter('posts_where', '_edit_attachments_query_helper');
    }
    wp($q);
    if (isset($q['detached'])) {
        remove_filter('posts_where', '_edit_attachments_query_helper');
    }
    return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:openify,项目名称:wordpress-composer,代码行数:43,代码来源:post.php

示例2: wp_edit_attachments_query

/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|false $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    wp(wp_edit_attachments_query_vars($q));
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:nicholasgriffintn,项目名称:WordPress,代码行数:16,代码来源:post.php

示例3: wp_edit_attachments_query

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : 'inherit';
    $media_per_page = (int) get_user_option('upload_per_page', 0, false);
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:gigikiri,项目名称:bcnAutoWallpaperSite,代码行数:30,代码来源:post.php

示例4: wp_edit_attachments_query

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $q
 * @return unknown
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $q['post_status'] = 'any';
    $q['posts_per_page'] = 15;
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')), 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')), 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:schr,项目名称:wordpress,代码行数:27,代码来源:post.php

示例5: ceil

    $_GET['paged'] = 1;
}
if (isset($_GET['detached'])) {
    if (!empty($lost)) {
        $start = ($_GET['paged'] - 1) * 50;
        $page_links_total = ceil(count($lost) / 50);
        $lost = implode(',', $lost);
        $orphans = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type = 'attachment' AND ID IN ({$lost}) LIMIT {$start}, 50");
    } else {
        $start = ($_GET['paged'] - 1) * 25;
        $orphans = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_parent < 1 LIMIT {$start}, 25");
        $page_links_total = ceil($wpdb->get_var("SELECT FOUND_ROWS()") / 25);
    }
    $post_mime_types = array('image' => array(__('Images'), __('Manage Images'), _n_noop('Image (%s)', 'Images (%s)')), 'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio (%s)', 'Audio (%s)')), 'video' => array(__('Video'), __('Manage Video'), _n_noop('Video (%s)', 'Video (%s)')));
    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($_GET['post_mime_type']) && !array_intersect((array) $_GET['post_mime_type'], array_keys($post_mime_types))) {
        unset($_GET['post_mime_type']);
    }
} else {
    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
}
wp_enqueue_script('media');
require_once 'admin-header.php';
?>

<?php 
if (isset($_GET['posted']) && (int) $_GET['posted']) {
    $_GET['message'] = '1';
    $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
}
开发者ID:papayalabs,项目名称:htdocs,代码行数:31,代码来源:upload.php

示例6: wp_edit_attachments_query

/**
 * Executes a query for attachments. An array of WP_Query arguments
 * can be passed in, which will override the arguments set by this function.
 *
 * @since 2.5.0
 *
 * @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
 * @return array
 */
function wp_edit_attachments_query($q = false)
{
    if (false === $q) {
        $q = $_GET;
    }
    $q['m'] = isset($q['m']) ? (int) $q['m'] : 0;
    $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
    $q['post_type'] = 'attachment';
    $post_type = get_post_type_object('attachment');
    $states = 'inherit';
    if (current_user_can($post_type->cap->read_private_posts)) {
        $states .= ',private';
    }
    $q['post_status'] = isset($q['status']) && 'trash' == $q['status'] ? 'trash' : $states;
    $q['post_status'] = isset($q['attachment-filter']) && 'trash' == $q['attachment-filter'] ? 'trash' : $states;
    $media_per_page = (int) get_user_option('upload_per_page');
    if (empty($media_per_page) || $media_per_page < 1) {
        $media_per_page = 20;
    }
    /**
     * Filter the number of items to list per page when listing media items.
     *
     * @since 2.9.0
     *
     * @param int $media_per_page Number of media to list. Default 20.
     */
    $q['posts_per_page'] = apply_filters('upload_per_page', $media_per_page);
    $post_mime_types = get_post_mime_types();
    $avail_post_mime_types = get_available_post_mime_types('attachment');
    if (isset($q['post_mime_type']) && !array_intersect((array) $q['post_mime_type'], array_keys($post_mime_types))) {
        unset($q['post_mime_type']);
    }
    foreach (array_keys($post_mime_types) as $type) {
        if (isset($q['attachment-filter']) && "post_mime_type:{$type}" == $q['attachment-filter']) {
            $q['post_mime_type'] = $type;
            break;
        }
    }
    if (isset($q['detached']) || isset($q['attachment-filter']) && 'detached' == $q['attachment-filter']) {
        $q['post_parent'] = 0;
    }
    wp($q);
    return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:53,代码来源:post.php

示例7: wp_edit_attachments_query

function wp_edit_attachments_query( $q = false ) {
	global $wpdb;
	if ( false === $q )
		$q = $_GET;
	$q['m']   = (int) $q['m'];
	$q['cat'] = (int) $q['cat'];
	$q['post_type'] = 'attachment';
	$q['post_status'] = 'any';
	$q['posts_per_page'] = 15;
	$post_mime_types = array(	//	array( adj, noun )
				'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
				'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
				'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
			);
	$post_mime_types = apply_filters('post_mime_types', $post_mime_types);

	$avail_post_mime_types = get_available_post_mime_types('attachment');

	if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
		unset($q['post_mime_type']);

	wp($q);

	return array($post_mime_types, $avail_post_mime_types);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:25,代码来源:post.php

示例8: form

    function form($instance)
    {
        /* Set up the defaults. */
        $defaults = array('title' => '', 'display' => 'ul', 'post_status' => array('publish'), 'post_type' => array('post'), 'post_mime_type' => array(''), 'order' => 'DESC', 'orderby' => 'date', 'caller_get_posts' => true, 'enable_pagination' => true, 'posts_per_page' => get_option('posts_per_page'), 'offset' => '0', 'author' => '', 'wp_reset_query' => true, 'meta_compare' => '', 'meta_key' => '', 'meta_value' => '', 'year' => '', 'monthnum' => '', 'w' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', 'post_parent' => '', 'entry_container' => 'div', 'show_entry_title' => true, 'entry_title' => 'h2', 'wp_link_pages' => true, 'error_message' => __('Apologies, but no results were found.', 'bizzthemes'), 'post_author' => false, 'post_date' => true, 'post_comments' => true, 'post_categories' => false, 'post_tags' => false, 'post_edit' => false, 'thumb_display' => false, 'thumb_selflink' => false, 'thumb_width' => 150, 'thumb_height' => 150, 'thumb_align' => 'alignright', 'thumb_cropp' => 'c', 'thumb_filter' => '', 'thumb_sharpen' => '', 'post_columns' => 1, 'remove_posts' => false, 'full_posts' => false, 'read_more' => true, 'read_more_text' => __('Continue reading', 'bizzthemes'));
        $instance = wp_parse_args((array) $instance, $defaults);
        $number_posts = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
        $thumb_align = array("alignleft" => "Left", "aligncenter" => "Center", "alignright" => "Right");
        $post_columns = array("1" => "One Column", "2" => "Two Columns", "3" => "Three Columns", "4" => "Four Columns");
        $thumb_cropp = array("c" => "Center", "t" => "Top", "tr" => "Top Right", "tl" => "Top Left", "b" => "Bottom", "bl" => "Bottom Left", "br" => "Bottom Right", "l" => "Left", "r" => "Right");
        ?>


		<div class="bizz-widget-controls" style="float:left;width:23%;"><?php 
        /* Widget title. */
        query_posts_input_text('Title:', $this->get_field_id('title'), $this->get_field_name('title'), $instance['title']);
        echo '<small class="section">Select Posts</small>';
        /* Post statuses. */
        $stati = get_post_stati('', 'objects');
        foreach ($stati as $status) {
            $statuses[$status->name] = $status->label;
        }
        $statuses['inherit'] = __('Inherit', 'bizzthemes');
        query_posts_select_multiple('Post status:', $this->get_field_id('post_status'), $this->get_field_name('post_status'), $instance['post_status'], $statuses, false);
        /* Post types. */
        $post_types = array('any' => __('Any', 'bizzthemes'));
        foreach (get_post_types(array('publicly_queryable' => true), 'objects') as $post_type) {
            $type_label = isset($post_type->singular_label) && $post_type->singular_label ? $post_type->singular_label : $post_type->label;
            $post_types[$post_type->name] = $type_label;
        }
        query_posts_select_multiple('Post type:', $this->get_field_id('post_type'), $this->get_field_name('post_type'), $instance['post_type'], $post_types, false);
        /* Post mime type. */
        $post_mime_types = get_available_post_mime_types();
        foreach ($post_mime_types as $post_mime_type) {
            $mime_types[$post_mime_type] = $post_mime_type;
        }
        $mime_types = isset($mime_types) ? $mime_types : '';
        query_posts_select_multiple('Post mime type:', $this->get_field_id('post_mime_type'), $this->get_field_name('post_mime_type'), $instance['post_mime_type'], $mime_types, false);
        /* Meta key. */
        foreach (get_meta_keys() as $meta) {
            $meta_keys[$meta] = $meta;
        }
        query_posts_select_single('Meta key:', $this->get_field_id('meta_key'), $this->get_field_name('meta_key'), $instance['meta_key'], $meta_keys, true);
        /* Meta value. */
        query_posts_input_text('Meta value:', $this->get_field_id('meta_value'), $this->get_field_name('meta_value'), $instance['meta_value']);
        /* Meta compare. */
        $operators = array('=' => '=', '!=' => '!=', '>' => '>', '>=' => '>=', '<' => '<', '<=' => '<=');
        query_posts_select_single('Meta compare:', $this->get_field_id('meta_compare'), $this->get_field_name('meta_compare'), $instance['meta_compare'], $operators, true);
        ?>
</div>

		<div class="bizz-widget-controls" style="float:left;width:23%;margin-left:2%;"><?php 
        /* Order. */
        query_posts_select_single('Order:', $this->get_field_id('order'), $this->get_field_name('order'), $instance['order'], array('ASC' => __('Ascending', 'bizzthemes'), 'DESC' => __('Descending', 'bizzthemes')), false);
        /* Order By. */
        $orderby_options = array('author' => __('Author', 'bizzthemes'), 'comment_count' => __('Comment Count', 'bizzthemes'), 'date' => __('Date', 'bizzthemes'), 'ID' => __('ID', 'bizzthemes'), 'menu_order' => __('Menu Order', 'bizzthemes'), 'meta_value' => __('Meta Value', 'bizzthemes'), 'modified' => __('Modified', 'bizzthemes'), 'none' => __('None', 'bizzthemes'), 'parent' => __('Parent', 'bizzthemes'), 'rand' => __('Random', 'bizzthemes'), 'title' => __('Title', 'bizzthemes'));
        query_posts_select_single('Order by:', $this->get_field_id('orderby'), $this->get_field_name('orderby'), $instance['orderby'], $orderby_options, false);
        echo '<small class="section">Pagination</small>';
        /* Enable pagination. */
        query_posts_input_checkbox(__('Enable pagination', 'bizzthemes'), $this->get_field_id('enable_pagination'), $this->get_field_name('enable_pagination'), checked($instance['enable_pagination'], true, false));
        /* Posts per page. */
        query_posts_input_text('Posts per page:', $this->get_field_id('posts_per_page'), $this->get_field_name('posts_per_page'), $instance['posts_per_page']);
        /* Offset. */
        query_posts_input_text('Offset:', $this->get_field_id('offset'), $this->get_field_name('offset'), $instance['offset']);
        echo '<small class="section">Date Filter</small>';
        /* Year. */
        query_posts_input_text_small('Years:', $this->get_field_id('year'), $this->get_field_name('year'), $instance['year']);
        /* Months. */
        query_posts_select_single('Month:', $this->get_field_id('monthnum'), $this->get_field_name('monthnum'), $instance['monthnum'], range(1, 12), true, 'smallfat', 'float:right;');
        /* Weeks. */
        query_posts_select_single('Week:', $this->get_field_id('w'), $this->get_field_name('w'), $instance['w'], range(1, 53), true, 'smallfat', 'float:right;');
        /* Days. */
        query_posts_select_single('Day:', $this->get_field_id('day'), $this->get_field_name('day'), $instance['day'], range(1, 31), true, 'smallfat', 'float:right;');
        /* Hours. */
        query_posts_select_single('Hour:', $this->get_field_id('hour'), $this->get_field_name('hour'), $instance['hour'], range(1, 23), true, 'smallfat', 'float:right;');
        /* Minutes. */
        query_posts_select_single('Minute;', $this->get_field_id('minute'), $this->get_field_name('minute'), $instance['minute'], range(1, 60), true, 'smallfat', 'float:right;');
        /* Seconds. */
        query_posts_select_single('Second:', $this->get_field_id('second'), $this->get_field_name('second'), $instance['second'], range(1, 60), true, 'smallfat', 'float:right;');
        ?>
</div>

		<div class="bizz-widget-controls" style="float:left;width:23%;margin-left:2%;"><?php 
        echo '<small class="section">Post Container</small>';
        /* Stickies. */
        query_posts_input_checkbox(__('Disable sticky posts', 'bizzthemes'), $this->get_field_id('caller_get_posts'), $this->get_field_name('caller_get_posts'), checked($instance['caller_get_posts'], true, false));
        /* Post container. */
        $containers = array('widget' => 'widget', 'div' => 'div', 'ul' => 'ul', 'ol' => 'ol');
        query_posts_select_single('Entry container', $this->get_field_id('entry_container'), $this->get_field_name('entry_container'), $instance['entry_container'], $containers, true);
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('post_columns');
        ?>
">Columns?</label> 
			<select class="widefat" id="<?php 
        echo $this->get_field_id('post_columns');
        ?>
" name="<?php 
        echo $this->get_field_name('post_columns');
//.........这里部分代码省略.........
开发者ID:loevendahl,项目名称:flexbil,代码行数:101,代码来源:widget-query-posts.php

示例9: on_edit_widget_filter_exceptions

    function on_edit_widget_filter_exceptions()
    {
        global $xtreme_widget_manager;
        if (!current_user_can('edit_theme_options') && !$xtreme_widget_manager->current_user_has_right()) {
            _e("You do not have the permission to change widget filter exceptions.", XF_TEXTDOMAIN);
            ?>
			<div class="widget-control-actions">
				<a id="x-portlet-editing-close" href="#"><span class="ui-icon ui-icon-close"></span><?php 
            _e('Close', XF_TEXTDOMAIN);
            ?>
</a>
			</div>
			<?php 
            exit;
        }
        $filter = $_POST["filter"];
        if (!isset($_POST['content']) || empty($_POST['content'])) {
            $_POST['content'] = "standard";
        }
        if (in_array($filter, $xtreme_widget_manager->filters_with_exceptions)) {
            $filtername = $xtreme_widget_manager->filters[$filter];
            ?>
			<div class="x-portlet-wrapper-label"><?php 
            _e('Edit Filter Exceptions for:', XF_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo esc_attr($filtername);
            ?>
</strong></div>
			<?php 
            if (is_rtl()) {
                ?>
				<image src="<?php 
                echo XF_ADMIN_URL;
                ?>
/images/filter-arrow-rtl.png" class="x-filter-arrow" />
			<?php 
            } else {
                ?>
				<image src="<?php 
                echo XF_ADMIN_URL;
                ?>
/images/filter-arrow.png" class="x-filter-arrow" />
			<?php 
            }
            ?>
			<div class="x-portlet-wrapper-label">
				<small><?php 
            _e('Sidebar:', XF_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo esc_attr($_POST['sidebar']);
            ?>
</strong>&nbsp;|&nbsp;
				<?php 
            _e('Widget:', XF_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo esc_attr($_POST['widget']);
            ?>
</strong></small>
			</div>
			<div class="x-portlet-wrapper">
			<?php 
            $this->setup_data();
            $this->navigation("top", __('Search', XF_TEXTDOMAIN), "xtreme-dialog");
            if ($filter == 'is_attachment') {
                echo '<div class="x-media-types"><b>' . __('Media Types', XF_TEXTDOMAIN) . ':</b>&nbsp;';
                $mt = get_available_post_mime_types('attachment');
                $ma = array('<a href="#" class="x-media-type' . ($_POST['s_media'] == 'all' ? ' x-media-type-active' : '') . '" rel="all">' . __('All', XF_TEXTDOMAIN) . '</a>');
                if (isset($_POST['callback_id']) && !empty($_POST['callback_id'])) {
                    $ma[] = '<a href="#" class="x-media-type' . ($_POST['s_media'] == 'image/' ? ' x-media-type-active' : '') . '" rel="image/">' . __('Images', XF_TEXTDOMAIN) . '</a>';
                }
                foreach ($mt as $m) {
                    $p = explode('/', $m);
                    if (isset($_POST['callback_id']) && !empty($_POST['callback_id']) && !preg_match('|^image/|', $m)) {
                        continue;
                    }
                    $ma[] = '<a href="#" class="x-media-type' . ($_POST['s_media'] == $m ? ' x-media-type-active' : '') . '" rel="' . $m . '">' . $p[1] . '</a>';
                }
                echo implode('', $ma);
                echo "</div>";
            }
            ?>
			<table cellspacing="0" class="widefat fixed">
			<thead>
				<tr>	
					<th class="column-cb check-column" scope="col"><input class="fex-maintoggle" type="checkbox"></th>
					<th class="column-title" scope="col"><?php 
            _e("Title", XF_TEXTDOMAIN);
            ?>
</th>
					<?php 
            if ($filter == 'is_attachment') {
                ?>
					<th class="column-icon" scope="col"><?php 
                _e("Media Link", XF_TEXTDOMAIN);
                ?>
</th>
					<?php 
//.........这里部分代码省略.........
开发者ID:katikos,项目名称:xtreme-one,代码行数:101,代码来源:xtreme-dialogs.php


注:本文中的get_available_post_mime_types函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。