PluginProbe ʕ •ᴥ•ʔ
Download Manager / trunk
Download Manager vtrunk
3.3.62 3.3.61 3.3.60 3.3.59 3.3.58 3.3.57 3.3.56 trunk 2.1.3 2.3.0 2.5.96 2.5.97 2.6.2 2.6.96 2.8.3 2.9.99 3.0.4 3.1.05 3.1.07 3.1.08 3.1.11 3.1.12 3.1.14 3.1.17 3.1.18 3.1.22 3.1.23 3.1.24 3.1.25 3.1.26 3.1.27 3.1.28 3.2.04 3.2.13 3.2.14 3.2.16 3.2.18 3.2.19 3.2.21 3.2.22 3.2.23 3.2.24 3.2.25 3.2.27 3.2.28 3.2.29 3.2.30 3.2.31 3.2.32 3.2.33 3.2.34 3.2.35 3.2.37 3.2.38 3.2.39 3.2.40 3.2.41 3.2.42 3.2.43 3.2.44 3.2.45 3.2.46 3.2.47 3.2.48 3.2.49 3.2.50 3.2.51 3.2.52 3.2.53 3.2.54 3.2.55 3.2.56 3.2.57 3.2.58 3.2.59 3.2.60 3.2.61 3.2.63 3.2.64 3.2.65 3.2.66 3.2.67 3.2.68 3.2.69 3.2.70 3.2.71 3.2.72 3.2.73 3.2.74 3.2.75 3.2.76 3.2.77 3.2.78 3.2.79 3.2.80 3.2.81 3.2.82 3.2.83 3.2.84 3.2.85 3.2.86 3.2.87 3.2.88 3.2.89 3.2.90 3.2.91 3.2.92 3.2.93 3.2.94 3.2.95 3.2.96 3.2.97 3.2.98 3.2.99 3.3.00 3.3.01 3.3.02 3.3.03 3.3.04 3.3.05 3.3.06 3.3.07 3.3.08 3.3.09 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.15 3.3.16 3.3.17 3.3.18 3.3.19 3.3.20 3.3.21 3.3.22 3.3.23 3.3.24 3.3.25 3.3.26 3.3.27 3.3.28 3.3.29 3.3.30 3.3.31 3.3.32 3.3.33 3.3.34 3.3.35 3.3.36 3.3.37 3.3.38 3.3.39 3.3.40 3.3.41 3.3.42 3.3.43 3.3.44 3.3.45 3.3.46 3.3.47 3.3.48 3.3.49 3.3.50 3.3.51 3.3.52 3.3.53 3.3.54 3.3.55
download-manager / src / MediaLibrary / views / media-tab.php
download-manager / src / MediaLibrary / views Last commit date
media-download.php 5 months ago media-shortcode.php 5 years ago media-tab.php 3 years ago
media-tab.php
153 lines
1 <?php
2 global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
3
4 media_upload_header();
5
6 $post_id = intval($_REQUEST['post_id']);
7
8 $form_action_url = admin_url("media-upload.php?type=$type&tab=<pluginname>&post_id=$post_id");
9 $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
10 $form_class = 'media-upload-form validate';
11
12 if ( get_user_setting('uploader') )
13 $form_class .= ' html-uploader';
14 $paged = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
15 if ( $paged < 1 )
16 $paged = 1;
17 $start = ( $paged - 1 ) * 10;
18 if ( $start < 1 )
19 $start = 0;
20
21 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
22 ?>
23 <form id="filter" action="" method="get">
24 <input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" />
25 <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
26 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
27 <input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" />
28
29 <p id="media-search">
30 <label for="media-search-input"><?php _e('Search Media');?>:</label>
31 <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
32 <?php submit_button( __( 'Search Media' ), 'button', '', false ); ?>
33 </p>
34
35 <ul>
36 <?php
37 $type_links = array();
38 $_num_posts = (array) wp_count_attachments();
39 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
40 foreach ( $matches as $_type => $reals )
41 foreach ( $reals as $real )
42 if ( isset($num_posts[$_type]) )
43 $num_posts[$_type] += $_num_posts[$real];
44 else
45 $num_posts[$_type] = $_num_posts[$real];
46 // If available type specified by media button clicked, filter by that type
47 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
48 $_GET['post_mime_type'] = $type;
49 list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
50 }
51 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
52 $class = '';
53 else
54 $class = '';
55 $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
56 foreach ( $post_mime_types as $mime_type => $label ) {
57 $class = '';
58
59 if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
60 continue;
61
62 if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
63 $class = '';
64
65 $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>';
66 }
67 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
68 unset($type_links);
69 ?>
70 </ul>
71
72 <div>
73
74 <?php
75 $page_links = paginate_links( array(
76 'base' => add_query_arg( 'paged', '%#%' ),
77 'format' => '',
78 'prev_text' => __('&laquo;'),
79 'next_text' => __('&raquo;'),
80 'total' => ceil($wp_query->found_posts / 10),
81 'current' => $paged
82 ));
83
84 if ( $page_links )
85 echo "<div class='tablenav-pages'>$page_links</div>";
86 ?>
87
88 <div>
89 <?php
90
91 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
92
93 $arc_result = $wpdb->get_results( $arc_query );
94
95 $month_count = count($arc_result);
96
97 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
98 <select name='m'>
99 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
100 <?php
101 foreach ($arc_result as $arc_row) {
102 if ( $arc_row->yyear == 0 )
103 continue;
104 $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
105
106 if ( isset($_GET['m']) && ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) )
107 $default = ' selected="selected"';
108 else
109 $default = '';
110
111 echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
112 echo esc_html( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
113 echo "</option>\n";
114 }
115 ?>
116 </select>
117 <?php } ?>
118
119 <?php submit_button( __( 'Filter »' ), 'secondary', 'post-query-submit', false ); ?>
120
121 </div>
122
123 <br />
124 </div>
125 </form>
126
127 <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" id="<pluginname>-form">
128
129 <?php wp_nonce_field('media-form'); ?>
130 <?php //media_upload_form( $errors ); ?>
131
132 <script type="text/javascript">
133 <!--
134 jQuery(function($){
135 var preloaded = $(".media-item.preloaded");
136 if ( preloaded.length > 0 ) {
137 preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
138 updateMediaForm();
139 }
140 });
141 -->
142 </script>
143
144 <div id="media-items">
145 <?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?>
146 <?php echo get_media_items(null, $errors); ?>
147 </div>
148 <p>
149 <?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false ); ?>
150 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
151 </p>
152 </form>
153