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.php

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

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