PluginProbe
MaxGalleria / 2.6
MaxGalleria v2.6
6.5.3 trunk 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.2.2 2.3 2.4 2.5 2.6 2.6.1 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 All 135 releases
maxgalleria / meta / video-edit-bulk.php

video-edit-bulk.php in MaxGalleria 2.6, at meta/video-edit-bulk.php

178 lines 6.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require('../../../../wp-load.php');
3
4 global $maxgalleria;
5 $video_gallery = $maxgalleria->video_gallery;
6
7 $video_ids = $_GET['video_ids'];
8 $updated = false;
9
10 if ($_POST && check_admin_referer($video_gallery->nonce_video_edit_bulk['action'], $video_gallery->nonce_video_edit_bulk['name'])) {
11 $i = 0;
12 foreach ($_POST['video-edit-id'] as $video_edit_id) {
13 // First update the post itself
14 $temp = array();
15 $temp['ID'] = $video_edit_id;
16 $temp['post_title'] = stripslashes($_POST['video-edit-title'][$i]);
17 $temp['post_excerpt'] = stripslashes($_POST['video-edit-caption'][$i]);
18 wp_update_post($temp);
19
20 // Now update the image alt in the meta
21 update_post_meta($video_edit_id, '_wp_attachment_image_alt', stripslashes($_POST['video-edit-alt'][$i]));
22
23 // Then the related videos flag in the meta
24 if (isset($_POST['video-edit-related-videos-' . $video_edit_id])) {
25 update_post_meta($video_edit_id, 'maxgallery_attachment_video_enable_related_videos', 1);
26 }
27 else {
28 update_post_meta($video_edit_id, 'maxgallery_attachment_video_enable_related_videos', 0);
29 }
30
31 // And finally the HD playback flag in the meta
32 if (isset($_POST['video-edit-hd-playback-' . $video_edit_id])) {
33 update_post_meta($video_edit_id, 'maxgallery_attachment_video_enable_hd_playback', 1);
34 }
35 else {
36 update_post_meta($video_edit_id, 'maxgallery_attachment_video_enable_hd_playback', 0);
37 }
38
39 // Increment the counter
40 $i++;
41 }
42
43 $updated = true;
44 }
45 ?>
46
47 <!DOCTYPE html>
48
49 <html xmlns="http://www.w3.org/1999/xhtml">
50
51 <head>
52 <title><?php _e('Edit Bulk Videos', 'maxgalleria') ?></title>
53 <link rel="stylesheet" type="text/css" media="screen" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" />
54 <link rel="stylesheet" type="text/css" media="screen" href="<?php echo MAXGALLERIA_PLUGIN_URL ?>/maxgalleria.css" />
55 <?php $maxgalleria->thickbox_l10n_fix() ?>
56 <script type="text/javascript" src="<?php echo admin_url() ?>load-scripts.php?load=jquery-core,thickbox,wp-ajax-response"></script>
57 <script type="text/javascript">
58 <?php if ($updated) { ?>
59 parent.eval("reloadPage()");
60 <?php } ?>
61
62 jQuery(document).ready(function() {
63 jQuery("#save-button").click(function () {
64 jQuery("#video-bulk-edit-form").submit();
65 return false;
66 });
67
68 jQuery("#cancel-button").click(function () {
69 parent.eval("reloadPage()");
70 });
71 });
72 </script>
73 </head>
74
75 <body>
76
77 <div class="maxgalleria-meta video-edit-bulk">
78 <form id="video-bulk-edit-form" method="post">
79 <?php if (isset($video_ids)) { ?>
80 <?php $video_ids_array = explode(',', $video_ids) ?>
81
82 <table cellpadding="0" cellspacing="0">
83 <?php foreach ($video_ids_array as $video_id) { ?>
84 <?php if (isset($video_id)) { ?>
85 <?php $video = get_post($video_id) ?>
86 <?php if (isset($video)) { ?>
87 <tr>
88 <td class="thumb">
89 <?php echo wp_get_attachment_image($video->ID, MAXGALLERIA_META_VIDEO_THUMB_SMALL) ?>
90 <input type="hidden" name="video-edit-id[]" value="<?php echo $video->ID ?>" />
91 </td>
92 <td>
93 <div class="fields">
94 <div class="field">
95 <div class="field-label">
96 <?php _e('Title', 'maxgalleria') ?>
97 </div>
98 <div class="field-value">
99 <input type="text" name="video-edit-title[]" value="<?php echo $video->post_title ?>" />
100 </div>
101 </div>
102 <div class="clear"></div>
103
104 <div class="field">
105 <div class="field-label">
106 <?php _e('Alt Text', 'maxgalleria') ?>
107 </div>
108 <div class="field-value">
109 <input type="text" name="video-edit-alt[]" value="<?php echo get_post_meta($video->ID, '_wp_attachment_image_alt', true) ?>" />
110 </div>
111 </div>
112 <div class="clear"></div>
113
114 <div class="field">
115 <div class="field-label">
116 <?php _e('Caption', 'maxgalleria') ?>
117 </div>
118 <div class="field-value">
119 <input type="text" name="video-edit-caption[]" value="<?php echo $video->post_excerpt ?>" />
120 </div>
121 </div>
122 <div class="clear"></div>
123
124 <div class="field">
125 <div class="field-value">
126 <?php
127 $enable_related_videos = get_post_meta($video->ID, 'maxgallery_attachment_video_enable_related_videos', true);
128 if (!isset($enable_related_videos) || $enable_related_videos == '') {
129 // Default to true for backwards compatibility
130 $enable_related_videos = 1;
131 }
132 ?>
133 <input type="checkbox" name="video-edit-related-videos-<?php echo $video->ID ?>" id="video-edit-related-videos-<?php echo $video->ID ?>" <?php echo ($enable_related_videos == 1) ? 'checked="checked"' : '' ?>>
134 <label for="video-edit-related-videos-<?php echo $video->ID ?>"><strong><?php _e('Enable Related Videos', 'maxgalleria') ?></strong></label>
135 </div>
136 </div>
137 <div class="clear"></div>
138
139 <div class="field">
140 <div class="field-value last">
141 <?php
142 $enable_hd_playback = get_post_meta($video->ID, 'maxgallery_attachment_video_enable_hd_playback', true);
143 if (!isset($enable_hd_playback) || $enable_hd_playback == '') {
144 // Default to false for backwards compatibility
145 $enable_hd_playback = 0;
146 }
147 ?>
148 <input type="checkbox" name="video-edit-hd-playback-<?php echo $video->ID ?>" id="video-edit-hd-playback-<?php echo $video->ID ?>" <?php echo ($enable_hd_playback == 1) ? 'checked="checked"' : '' ?>>
149 <label for="video-edit-hd-playback-<?php echo $video->ID ?>"><strong><?php _e('Enable HD Playback', 'maxgalleria') ?></strong></label>
150 </div>
151 </div>
152 <div class="clear"></div>
153 </div>
154 </td>
155 </tr>
156 <?php } ?>
157 <?php } ?>
158 <?php } ?>
159 </table>
160 <?php } ?>
161
162 <div class="actions">
163 <div class="save">
164 <input type="button" class="btn btn-primary" id="save-button" value="<?php _e('Save Changes', 'maxgalleria') ?>" />
165 </div>
166 <div class="cancel">
167 <input type="button" class="btn" id="cancel-button" value="<?php _e('Cancel', 'maxgalleria') ?>" />
168 </div>
169 </div>
170
171 <?php wp_nonce_field($video_gallery->nonce_video_edit_bulk['action'], $video_gallery->nonce_video_edit_bulk['name']) ?>
172 </form>
173 </div>
174
175 </body>
176
177 </html>
178