本文整理汇总了PHP中get_media_items函数的典型用法代码示例。如果您正苦于以下问题:PHP get_media_items函数的具体用法?PHP get_media_items怎么用?PHP get_media_items使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_media_items函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: media_upload_crystal_form
function media_upload_crystal_form()
{
global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types, $redir_tab;
$redir_tab = 'crystal';
media_upload_header();
$post_id = intval($_REQUEST['post_id']);
$form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=crystal&post_id={$post_id}");
?>
<script type="text/javascript">
<!--
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
-->
</script>
<form enctype="multipart/form-data" method="post" action="<?php
echo attribute_escape($form_action_url);
?>
" class="media-upload-form validate" id="gallery-form">
<div id="media-items">
<?php
echo get_media_items($post_id, $errors);
?>
</div>
<input type="submit" class="button" name="save" value="<?php
echo attribute_escape(__('Save all changes'));
?>
" />
<input type="submit" class="button" name="insert-gallery" value="<?php
echo attribute_escape(__('Insert Crystal gallery!'));
?>
" />
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<input type="hidden" name="type" value="<?php
echo attribute_escape($GLOBALS['type']);
?>
" />
<input type="hidden" name="tab" value="<?php
echo attribute_escape($GLOBALS['tab']);
?>
" />
</p>
</form>
<?php
}
示例2: get_media_items
function get_media_items($post_id, $errors)
{
global $blog_id;
$output = get_media_items($post_id, $errors);
// remove edit button pre WP3.5
$output = preg_replace("%<p><input type='button' id='imgedit-open-btn.+?class='imgedit-wait-spin'[^>]+></p>%s", '', $output);
// remove edit button WP3.5+
$output = preg_replace("%<p><input type='button' id='imgedit-open-btn.+?<span class='spinner'></span></p>%s", '', $output);
// remove delete link
$output = preg_replace("%<a href='#' class='del-link' onclick=.+?</a>%s", '', $output);
$output = preg_replace("%<div id='del_attachment_.+?</div>%s", '', $output);
return $output;
}
示例3: media_upload_library_form
//.........这里部分代码省略.........
<div class="tablenav">
<?php
$page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($wp_query->found_posts / 10), 'current' => $q['paged']));
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
<div class="alignleft actions">
<?php
$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";
$arc_result = $wpdb->get_results($arc_query);
$month_count = count($arc_result);
$selected_month = isset($_GET['m']) ? $_GET['m'] : 0;
if ($month_count && !(1 == $month_count && 0 == $arc_result[0]->mmonth)) {
?>
<select name='m'>
<option<?php
selected($selected_month, 0);
?>
value='0'><?php
_e('All dates');
?>
</option>
<?php
foreach ($arc_result as $arc_row) {
if ($arc_row->yyear == 0) {
continue;
}
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
if ($arc_row->yyear . $arc_row->mmonth == $selected_month) {
$default = ' selected="selected"';
} else {
$default = '';
}
echo "<option{$default} value='" . esc_attr($arc_row->yyear . $arc_row->mmonth) . "'>";
echo esc_html($wp_locale->get_month($arc_row->mmonth) . " {$arc_row->yyear}");
echo "</option>\n";
}
?>
</select>
<?php
}
?>
<?php
submit_button(__('Filter »'), 'button', 'post-query-submit', 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('media-form');
//media_upload_form( $errors );
?>
<script type="text/javascript">
<!--
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 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);
echo get_media_items(null, $errors);
?>
</div>
<p class="ml-submit">
<?php
submit_button(__('Save all changes'), 'button savebutton', 'save', false);
?>
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
</p>
</form>
<?php
}
示例4: media_upload_library_form
//.........这里部分代码省略.........
?>
</ul>
<div class="tablenav">
<?php
$page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($wp_query->found_posts / 10), 'current' => $_GET['paged']));
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
<div class="alignleft actions">
<?php
$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";
$arc_result = $wpdb->get_results($arc_query);
$month_count = count($arc_result);
if ($month_count && !(1 == $month_count && 0 == $arc_result[0]->mmonth)) {
?>
<select name='m'>
<option<?php
selected(@$_GET['m'], 0);
?>
value='0'><?php
_e('Show all dates');
?>
</option>
<?php
foreach ($arc_result as $arc_row) {
if ($arc_row->yyear == 0) {
continue;
}
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
if ($arc_row->yyear . $arc_row->mmonth == $_GET['m']) {
$default = ' selected="selected"';
} else {
$default = '';
}
echo "<option{$default} value='" . esc_attr($arc_row->yyear . $arc_row->mmonth) . "'>";
echo esc_html($wp_locale->get_month($arc_row->mmonth) . " {$arc_row->yyear}");
echo "</option>\n";
}
?>
</select>
<?php
}
?>
<input type="submit" id="post-query-submit" value="<?php
echo esc_attr(__('Filter »'));
?>
" class="button-secondary" />
</div>
<br class="clear" />
</div>
</form>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="media-upload-form validate" id="library-form">
<?php
wp_nonce_field('media-form');
//media_upload_form( $errors );
?>
<script type="text/javascript">
<!--
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 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);
echo get_media_items(null, $errors);
?>
</div>
<p class="ml-submit">
<input type="submit" class="button savebutton" name="save" value="<?php
esc_attr_e('Save all changes');
?>
" />
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
</p>
</form>
<?php
}
示例5: media_jwplayer_url_insert_form
//.........这里部分代码省略.........
$attachment["post_content"] = "";
$attachment["post_title"] = "";
}
}
$id = wp_insert_attachment($attachment, $url, $post_id);
if ($youtube_api) {
update_post_meta($id, LONGTAIL_KEY . "thumbnail_url", $youtube_api["thumbnail_url"]);
update_post_meta($id, LONGTAIL_KEY . "creator", $youtube_api["author"]);
} else {
if (strstr($url, "rtmp://")) {
update_post_meta($id, LONGTAIL_KEY . "streamer", str_replace(basename($url), "", $url));
update_post_meta($id, LONGTAIL_KEY . "file", basename($url));
update_post_meta($id, LONGTAIL_KEY . "rtmp", true);
}
}
update_post_meta($id, LONGTAIL_KEY . "external", true);
wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $url));
}
?>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="media-upload-form type-form validate" id="<?php
echo $type;
?>
-form">
<input type="submit" class="hidden" name="save" value="" />
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<?php
wp_nonce_field('media-form');
?>
<h3 class="media-title"><?php
_e('Add media file from URL', 'jw-player-plugin-for-wordpress');
?>
</h3>
<div id="url-upload-ui">
<table class="describe">
<tbody>
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="insertonly[href]"><?php
_e('URL', 'jw-player-plugin-for-wordpress');
?>
</label></span>
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
</th>
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" class="button" name="insertonlybutton" value="<?php
echo esc_attr__('Add Media', 'jw-player-plugin-for-wordpress');
?>
" />
</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
//]]>
</script>
<div id="media-items">
<?php
if (isset($id)) {
if (!is_wp_error($id)) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items($id, $errors);
} else {
echo '<div id="media-upload-error">' . esc_html($id->get_error_message()) . '</div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit">
<input type="submit" class="button" name="save" value="<?php
esc_attr_e('Save all changes', 'jw-player-plugin-for-wordpress');
?>
" />
</p>
</form>
<?php
}
示例6: media_upload_external_videos_form
//.........这里部分代码省略.........
?>
" class="button" />
</p>
<div class="tablenav">
<?php
$page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($wp_query->found_posts / 10), 'current' => $_GET['paged']));
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
<div class="alignleft actions">
<?php
$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM {$wpdb->posts} WHERE post_type = 'external-videos' ORDER BY post_date DESC";
$arc_result = $wpdb->get_results($arc_query);
$month_count = count($arc_result);
if ($month_count && !(1 == $month_count && 0 == $arc_result[0]->mmonth)) {
?>
<select name='m'>
<option<?php
selected(@$_GET['m'], 0);
?>
value='0'><?php
_e('Show all dates');
?>
</option>
<?php
foreach ($arc_result as $arc_row) {
if ($arc_row->yyear == 0) {
continue;
}
$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
if (isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == $_GET['m']) {
$default = ' selected="selected"';
} else {
$default = '';
}
echo "<option{$default} value='" . esc_attr($arc_row->yyear . $arc_row->mmonth) . "'>";
echo esc_html($wp_locale->get_month($arc_row->mmonth) . " {$arc_row->yyear}");
echo "</option>\n";
}
?>
</select>
<?php
}
?>
<input type="submit" id="post-query-submit" value="<?php
echo esc_attr(__('Filter »'));
?>
" class="button-secondary" />
</div>
<br class="clear" />
</div>
</form>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="media-upload-form validate" id="library-form">
<?php
wp_nonce_field('media-form');
//media_upload_form( $errors );
?>
<script type="text/javascript">
<!--
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 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);
echo get_media_items(null, $errors);
?>
</div>
<p class="ml-submit">
<input type="submit" class="button savebutton" name="save" value="<?php
esc_attr_e('Save all changes');
?>
" />
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
</p>
</form>
<?php
}
示例7: _media_upload_type_form
protected function _media_upload_type_form($type = 'file', $errors = null, $id = null)
{
// media_upload_header();
$post_id = $this->postId;
$form_action_url = admin_url("media-upload.php?type={$type}&tab=type&post_id={$post_id}");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
$form_class = 'media-upload-form type-form validate';
if (get_user_setting('uploader')) {
$form_class .= ' html-uploader';
}
?>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_url($form_action_url);
?>
" class="<?php
echo $form_class;
?>
" id="<?php
echo $type;
?>
-form">
<?php
submit_button('', 'hidden', 'save', false);
?>
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<?php
wp_nonce_field('media-form');
?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
//]]>
</script>
<div id="media-items"><?php
if ($id) {
if (!is_wp_error($id)) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
add_filter('attachment_fields_to_edit', array($this, 'attachment_fields_to_edit'), 10, 2);
echo get_media_items($id, $errors);
} else {
echo '<div id="media-upload-error">' . esc_html($id->get_error_message()) . '</div></div>';
exit;
}
}
?>
</div>
</form>
<?php
}
示例8: jwp6_media_external_tab
//.........这里部分代码省略.........
wp_nonce_field('media-form');
?>
<?php
if (!MEDIA_MANAGER_35) {
?>
<h3 class="media-title">Add external media</h3>
<?php
}
?>
<?php
if (!$_POST) {
?>
<p> Add external media to your library to embed it with the JW Player</p>
<div id="url-upload-ui">
<table>
<tbody>
<tr>
<th scope="row" class="label">
<span class="alignleft"><label for="insertonly[href]">Media URL</label></span>
</th>
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"
style="width: 95%;" placeholder="Add the URL to your media here."></td>
</tr>
<tr>
<th></th>
<td class="description">
<p>The following types of external media are supported:</p>
<ol>
<li>
MP4/FLV video (http://example.com/video.mp4)
</li>
<li>
MP3/AAC Audio (http://example.com/audio.mp3)
</li>
<li>
YouTube video (http://youtu.be/dQw4w9WgXcQ)
</li>
<li>
MP4/FLV video (rtmp://example/com/vode/mp4:video.mp4)
</li>
</ol>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" class="button button-primary" name="insertonlybutton" value="Add to library" />
</td>
</tr>
</tbody>
</table>
</div>
<?php
}
?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
$('tr.url button, p.help').remove();
<?php
if (MEDIA_MANAGER_35) {
?>
jQuery('ul#sidemenu').css('display', 'none');
jQuery('a.describe-toggle-off').css('display', 'none');
<?php
}
?>
});
//]]>
</script>
<div id="media-items">
<?php
if (isset($id)) {
if (!is_wp_error($id)) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items($id, $errors);
} else {
echo '<div id="media-upload-error">' . esc_html($id->get_error_message()) . '</div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit">
<input type="submit" class="button" name="save" value="<?php
esc_attr_e('Save all changes', 'jw-player-plugin-for-wordpress');
?>
" />
</p>
</form>
<?php
}
示例9: dt_obo_slider_media_form
function dt_obo_slider_media_form($errors)
{
global $redir_tab, $type;
$redir_tab = 'dt_obo_slider_media';
media_upload_header();
$post_id = intval($_REQUEST['post_id']);
$form_action_url = admin_url("media-upload.php?type={$type}&tab=dt_obo_slider_media&post_id={$post_id}");
$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';
}
?>
<script type="text/javascript">
<!--
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
updateMediaForm();
}
});
-->
</script>
<div id="sort-buttons" class="hide-if-no-js">
<span>
<?php
_ex('All Tabs:', 'backend oboslider', LANGUAGE_ZONE);
?>
<a href="#" id="showall"><?php
_ex('Show', 'backend oboslider', LANGUAGE_ZONE);
?>
</a>
<a href="#" id="hideall" style="display:none;"><?php
_ex('Hide', 'backend oboslider', LANGUAGE_ZONE);
?>
</a>
</span>
<?php
_ex('Sort Order:', 'backend oboslider', LANGUAGE_ZONE);
?>
<a href="#" id="asc"><?php
_ex('Ascending', 'backend oboslider', LANGUAGE_ZONE);
?>
</a> |
<a href="#" id="desc"><?php
_ex('Descending', 'backend oboslider', LANGUAGE_ZONE);
?>
</a> |
<a href="#" id="clear"><?php
_ex('Clear', 'backend oboslider', LANGUAGE_ZONE);
?>
</a>
</div>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="<?php
echo $form_class;
?>
" id="gallery-form">
<?php
wp_nonce_field('media-form');
?>
<?php
//media_upload_form( $errors );
?>
<table class="widefat" cellspacing="0">
<thead><tr>
<th><?php
_ex('Media', 'backend oboslider', LANGUAGE_ZONE);
?>
</th>
<th class="order-head"><?php
_ex('Order', 'backend oboslider', LANGUAGE_ZONE);
?>
</th>
<th class="actions-head"><?php
_ex('Actions', 'backend oboslider', LANGUAGE_ZONE);
?>
</th>
</tr></thead>
</table>
<div id="media-items">
<?php
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
// remove insert into post button
add_filter('get_media_item_args', 'dt_core_media_item_remove_insert_button');
$_REQUEST['tab'] = 'gallery';
echo get_media_items($post_id, $errors);
$_REQUEST['tab'] = 'dt_obo_slider_media';
remove_filter('get_media_item_args', 'dt_core_media_item_remove_insert_button');
?>
</div>
<p class="ml-submit">
<?php
submit_button(_x('Save all changes', 'backend oboslider', LANGUAGE_ZONE), 'button savebutton', 'save', false, array('id' => 'save-all', 'style' => 'display: none;'));
?>
//.........这里部分代码省略.........
示例10: media_upload_type_form
function media_upload_type_form($type = 'file', $errors = null, $id = null)
{
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$form_action_url = admin_url("media-upload.php?type={$type}&tab=type&post_id={$post_id}");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
?>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="media-upload-form type-form validate" id="<?php
echo $type;
?>
-form">
<input type="submit" class="hidden" name="save" value="" />
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<?php
wp_nonce_field('media-form');
?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
//]]>
</script>
<div id="media-items">
<?php
if ($id) {
if (!is_wp_error($id)) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items($id, $errors);
} else {
echo '<div id="media-upload-error">' . esc_html($id->get_error_message()) . '</div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit">
<input type="submit" class="button" name="save" value="<?php
esc_attr_e('Save all changes');
?>
" />
</p>
</form>
<?php
}
示例11: media_upload_type_form_upyun
public static function media_upload_type_form_upyun($type = 'file', $errors = null, $id = null)
{
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
if (!self::connect_remote_server()) {
return self::raise_connection_error();
}
media_upload_header();
$upyun_form_action_url = 'http://' . self::$fs->get_api_domain() . '/' . self::$fs->get_bucketname() . '/';
if (isset($_GET['code']) && isset($_GET['message']) && isset($_GET['url']) && isset($_GET['time']) && isset($_GET['sign'])) {
$form_action_url = plugins_url('upload.php?post_id=' . $post_id . '&TB_iframe=1&width=640&height=451', HACKLOG_RA_UPYUN_LOADER);
} else {
$form_action_url = $upyun_form_action_url;
}
$form_class = 'media-upload-form type-form validate';
//if ( get_user_setting('uploader') )
$form_class .= ' html-uploader';
?>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="<?php
echo $form_class;
?>
" id="<?php
echo $type;
?>
-form">
<?php
submit_button('', 'hidden', 'save', false);
?>
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<?php
wp_nonce_field('media-form');
?>
<input type="hidden" id="policy" name="policy" value="">
<input type="hidden" id="signature" name="signature" value="">
<h3 class="media-title"><?php
_e('Add media files from your computer');
?>
</h3>
<p style="border:3px dotted #ccc;padding:5px;">
<?php
_e('I advise you to upload images via click WordPress original add media button.', self::textdomain);
?>
<br />
<?php
_e('This page was designed for uploading big files to UpYun Server.', self::textdomain);
?>
</p>
<?php
hacklogra_upyun_media_upload_form($errors);
?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
//]]>
</script>
<div id="media-items">
<?php
if ($id) {
if (!is_wp_error($id)) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items($id, $errors);
} else {
echo '<div id="media-upload-error">' . esc_html($id->get_error_message()) . '</div></div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit">
<?php
submit_button(__('Save all changes'), 'button', 'save', false);
?>
</p>
</form>
<script type="text/javascript">
jQuery(function($){
$('#html-upload').attr('disabled',true);
var set_upyun_form_api_action_url = function()
{
$('#file-form').attr('action','<?php
echo $upyun_form_action_url;
?>
');
};
//.........这里部分代码省略.........
示例12: formTemplate
public function formTemplate($type = 'file', $errors = null, $id = null)
{
wp_register_style('js_composer', $this->assetURL('js_composer.css'), false, WPB_VC_VERSION, false);
wp_enqueue_style('js_composer');
//wp_register_style( 'bootstrap', $this->assetURL( 'bootstrap/css/bootstrap.css' ), false, WPB_VC_VERSION, false );
//wp_enqueue_style('bootstrap');
wp_register_style('ui-custom-theme', $this->assetURL('ui-custom-theme/jquery-ui-1.8.18.custom.css'), false, WPB_VC_VERSION, false);
wp_enqueue_style('ui-custom-theme');
wp_register_script('wpb_js_composer_js', $this->assetURL('js_composer.js'), array('jquery'), WPB_VC_VERSION, true);
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-droppable');
wp_enqueue_script('jquery-ui-draggable');
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script('jquery-ui-sortable');
//wp_enqueue_script('bootstrap-js');
global $is_iphone;
global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
if ($is_iphone) {
return;
}
$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
$form_action_url = admin_url("media-upload.php?type={$this->type}&tab=type&post_id={$post_id}");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $this->type);
$form_class = 'media-upload-form type-form validate';
if (get_user_setting('uploader')) {
$form_class .= ' html-uploader';
}
?>
<div class="log"></div>
<div class="wpb_media_tab row-fluid">
<div class="<?php
echo (int) $this->get('single_image') == 0 ? 'span6' : 'span12';
?>
">
<h2 class="media-title"><?php
_e('Click image from media library or drag it to the "Selected images" area', 'js_composer');
?>
</h2>
<div id="wpb_composer_media_list">
<?php
echo $this->getContentList();
?>
</div>
<script type="text/javascript">
post_id = <?php
echo $post_id;
?>
;
</script>
<form enctype="multipart/form-data" method="post" action="<?php
echo esc_attr($form_action_url);
?>
" class="<?php
echo $form_class;
?>
" id="<?php
echo $this->type;
?>
-form">
<?php
submit_button('', 'hidden', 'save', false);
?>
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<?php
wp_nonce_field('media-form');
?>
<h2 class="media-title"><?php
_e('or add images from your computer.', 'js_composer');
?>
</h2>
<?php
media_upload_form($this->errors);
?>
<div id="media-items"><?php
if ($this->id) {
if (!is_wp_error($this->id)) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items($this->id, $this->errors);
} else {
echo '<div id="media-upload-error">' . esc_html($this->id->get_error_message()) . '</div></div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit" style="display:none;">
<!-- <?php
submit_button(__('Save all changes'), 'button', 'save', false);
?>
-->
</p>
</form>
</div>
//.........这里部分代码省略.........
示例13: _e
?>
</th>
<th class="order-head"><?php
_e('Order');
?>
</th>
<th class="actions-head"><?php
_e('Actions');
?>
</th>
</tr></thead>
</table>
<div id="media-items">
<?php
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items($post_id, $errors);
?>
</div>
<p class="ml-submit">
<?php
submit_button(__('Save all changes'), 'button savebutton', 'save', false, array('id' => 'save-all', 'style' => 'display: none;'));
?>
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
<input type="hidden" name="type" value="<?php
echo esc_attr($GLOBALS['type']);
?>
" />
示例14: render_output
function render_output($id)
{
$time = time();
get_media_items($id, null);
$post = get_post($id);
if ($thumb_url = wp_get_attachment_image_src($id, 'thumbnail', true)) {
$pinkynail = '<img class="pinkynail" src="' . esc_url($thumb_url[0]) . '" alt="" />';
}
$edit_link = '<a class="edit-attachment" href="' . esc_url(get_edit_post_link($id)) . '" target="_blank">' . _x('Edit', 'media item') . '</a>';
// Title shouldn't ever be empty, but use filename just in case.
$file = get_attached_file($post->ID);
$title = $post->post_title ? $post->post_title : wp_basename($file);
$file_name_new = '<div class="filename new"><span class="title">' . esc_html(wp_html_excerpt($title, 60, '…')) . '</span></div>';
$pinkynail = isset($pinkynail) ? $pinkynail : '';
?>
<script id="<?php
echo $time;
?>
">
var parent;
setTimeout(function(){
console.log("<?php
echo $time;
?>
");
parent = document.getElementById("<?php
echo $time;
?>
").parentNode;
var progress = parent.getElementsByClassName("progress");
var filename = parent.getElementsByClassName("filename original");
console.log(parent);
console.log(progress);
console.log(filename);
parent.innerHTML = "";
aaa();
}, 1000);
var aaa = function(){
console.log(parent);
var pinkynail = '<?php
echo $pinkynail;
?>
';
var edit_link = '<?php
echo $edit_link;
?>
';
var file_name_new = '<?php
echo $file_name_new;
?>
';
parent.innerHTML = pinkynail+edit_link+file_name_new;
console.log(pinkynail+edit_link+file_name_new);
}
</script>
<?php
}
示例15: jQuery
<script type="text/javascript">
<!--
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 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(null, $errors);
?>
</div>
<p>
<?php
submit_button(__('Save all changes'), 'button savebutton', 'save', false);
?>
<input type="hidden" name="post_id" id="post_id" value="<?php
echo (int) $post_id;
?>
" />
</p>
</form>