媒体上传库表单(阵列 $个错误 )

输出媒体库的旧媒体上传表单。

参数

$个错误阵列必修的

来源

函数media_upload_library_form($errors){全局$wpdb、$wp_query、$wplocale、$type、$tab、$post_time_types;media_upload_header();$post_id=问题集($_REQUEST[“post_id”])?(int)$_REQUEST['post_id']:0;$form_action_url=admin_url(“media-upload.php?type=$type&tab=library&post_id=$post_id”);/**此筛选器记录在wp-admin/includs/media.php中*/$form_action_url=应用过滤器('media_upload_form_url',$form_ation_url,$type);$form_class='媒体上传表单验证';if(get_user_setting('上传程序')){$form_class.='html-uploader’;}$q=$_GET;$q['posts_per_page']=10;$q['page']=isset($q['页面'])?(int)$q[“页面”]:0;如果($q[“分页”]<1){$q[“页面”]=1;}$q['offset']=($q['页面']-1)*10;如果($q[‘偏移’]<1){$q['offset']=0;}列表($post_ime_types,$avail_post_ime_teypes)=wp_edit_attachments_query($q);?><form id=“filter”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_ime_type'])?esc_attr($_GET['post_ime_ttype']):'';?>”/><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('搜索媒体:');?></label><input type=“search”id=“media-search-input”name=“s”value=“<?php the_search_query();?>”/><?php submit_button(__('搜索媒体'),'','',false);?></p><ul class=“subsubub”><?php(电话)$type_links=数组();$_num_posts=(数组)wp_count_attachments();$matches=wp_match_mime_types(数组键($post_time_types),数组键($_ num_posts));foreach($匹配为$_type=>$reals){foreach($reals作为$real){if(isset($num_post[$_type])){$num_posts[$_type]+=$_num_posts[$real];}其他{$num_posts[$_type]=$_num_posts[$real];}}}//如果单击的媒体按钮指定了可用类型,请按该类型进行筛选。if(空($_GET['post_mime_type'])&&!空($num_post[$type]){$_GET['post_mime_type']=$type;list($post_mime_types,$aval_post_mime_types)=wp_edit_attachments_query();}if(空($_GET['post_mime_type'])||'全部'==$_GET['post-ime_type']]){$class='class=“current”';}其他{$class='';}$type_links[]='<li><a href=“'.esc_url(添加查询参数(阵列(“post_time_type”=>“all”,“paged”=>错误,'m'=>假,))) . '“'.$class.'>'.__('所有类型').'</a>';foreach($post_time_types作为$mime_type=>$label){$class='';if(!wp_match_mime_types($mime_type,$avail_post_time_types)){继续;}if(isset($_GET['post_ime_type'])和&wp_match_mime_types($mime_type,$_GET['post-ime_type'])){$class='class=“current”';}$type_links[]='<li><a href=“'.esc_url(添加查询参数(阵列(“post_ime_type”=>$mime_type,“paged”=>错误,))) . '“'.$class.'>'.sprintf(translate_nooped_plural($label[2],$num_posts[$mime_type]),'<span id=“'$mime_type。'-计数器“>'.number_format_i18n($num_post[$mime_type]).').'(</span>').'</a>';}/***过滤媒体上传mime类型列表项。**返回的值应以`<li>`标记开头。**@自3.1.0起**@param string[]$type_links包含mime类型链接HTML的列表项数组。*/echo内爆('</li>',apply_filters('media_upload_time_type_links',$type_links))。'</li>';unset($type_links);?></ul><div class=“tablenav”><?php(电话)$page_links=分页链接(阵列('base'=>add_query_arg('paged','%#%'),'格式'=>'','前文本'=>__('&laquo;'),'next_text'=>__('&raquo;'),“total”=>(int)ceil($wp_query->found_posts/10),“当前”=>$q[“定价”],));if($page_links){echo“<div class='tablenav-pages'>$page_links</div>”;}?><div class=“alignleft actions”><?php(电话)$arc_query=“从$wpdb->posts WHERE post_type='attachment'按post_date DESC选择DISTINCT YEAR(posd_date)AS yyear,MONTH(post_date)AS MONTH”;$arc_result=$wpdb->get_results($arc_cquery);$month_count=计数($arc_result);$selected_month=设置($_GET[m'])$_获取[m']:0;if($month_count&&!(1==$month-count&&0==$arc_result[0]->mmonth){?><选择名称=m'><选项<?已选择php($selected_month,0);?>值=“0”><?php_e('所有日期');?></选项><?php(电话)foreach($arc_result作为$arc_row){如果(0==$arc_row->yyear){继续;}$arc_row->mmonth=归零($arc_ row->mmonth,2);if($arc_row->yyear.$arc_row->mmonth==$selected_month){$default='selected=“selected”';}其他{$default=“”;}echo“<option$default value='”。esc_attr($arc_row->yyear.$arc_now->mmonth)。"'>";echo eschtml($wp_locale->get_month($arc_row->mmonth)。“$arc_row->yyear”);echo“</option>\n”;}?></选择><?php}?><?php submit_button(__('过滤器&#187;'),'','查询后提交',false);?></div><br class=“clear”/></div></form><form enctype=“multipart/form-data”method=“post”action=“<php echo esc_url($form_action_url);?>”class=“<php-echo$form_class;?>“id=”library-form“><?php wp_nonce_field(“媒体形式”);?><script type=“text/javascript”>jQuery(函数($){var preloaded=$(“.media item.proaded”);if(预加载长度>0){preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g,“”)},“”);});updateMediaForm();}});</script><div id=“media-items”><?php add_filter('attachment_fields_to_edit','media_post_single_attachment_fields_to_edit',10,2);?><?php echo get_media_items(空,$errors);?></div><p class=“ml-submit”><?php submit_button(__('保存所有更改'),'保存按钮','保存',false);?><input type=“hidden”name=“post_id”id=“post_id”value=“<?php echo(int)$post_id;?>”/></p></form><?php(电话)}

挂钩

应用筛选器('media_upload_form_url',一串 $form_action_url,一串 $类型 )

过滤媒体上传表单操作URL。

应用筛选器('媒体上传时间类型链接',字符串[] $类型链接 )

过滤媒体上传mime类型列表项。

变更日志

版本描述
2.5.0介绍。

用户贡献的笔记

你必须登录在能够发表注释或反馈之前。