PluginProbe
MaxGalleria / 2.5
MaxGalleria v2.5
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 / image-edit.php

image-edit.php in MaxGalleria 2.5, at meta/image-edit.php

132 lines 4.0 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 $common = $maxgalleria->common;
6 $image_gallery = $maxgalleria->image_gallery;
7
8 $image = get_post($_GET['image_id']);
9 $updated = false;
10
11 if ($_POST && check_admin_referer($image_gallery->nonce_image_edit['action'], $image_gallery->nonce_image_edit['name'])) {
12 if (isset($image)) {
13 // First update the post itself
14 $temp = array();
15 $temp['ID'] = $image->ID;
16 $temp['post_title'] = stripslashes($_POST['image-edit-title']);
17 $temp['post_excerpt'] = stripslashes($_POST['image-edit-caption']);
18 wp_update_post($temp);
19
20 // Determine if we need to prepend http:// to the link
21 $link = $_POST['image-edit-link'];
22 if ($link != '' && !$common->string_starts_with($link, 'http://')) {
23 $link = 'http://' . $link;
24 }
25
26 // Now update the meta
27 update_post_meta($image->ID, '_wp_attachment_image_alt', stripslashes($_POST['image-edit-alt']));
28 update_post_meta($image->ID, 'maxgallery_attachment_image_link', stripslashes($link));
29
30 $updated = true;
31 }
32 }
33 ?>
34
35 <!DOCTYPE html>
36
37 <html xmlns="http://www.w3.org/1999/xhtml">
38
39 <head>
40 <title><?php _e('Edit Image', 'maxgalleria') ?></title>
41 <link rel="stylesheet" type="text/css" media="screen" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" />
42 <link rel="stylesheet" type="text/css" media="screen" href="<?php echo MAXGALLERIA_PLUGIN_URL ?>/maxgalleria.css" />
43 <?php $maxgalleria->thickbox_l10n_fix() ?>
44 <script type="text/javascript" src="<?php echo admin_url() ?>load-scripts.php?load=jquery-core,thickbox,wp-ajax-response,imgareaselect,image-edit"></script>
45 <script type="text/javascript">
46 <?php if ($updated) { ?>
47 parent.eval("reloadPage()");
48 <?php } ?>
49
50 jQuery(document).ready(function() {
51 jQuery("#save-button").click(function () {
52 jQuery("#image-edit-form").submit();
53 return false;
54 });
55
56 jQuery("#cancel-button").click(function () {
57 parent.eval("reloadPage()");
58 });
59 });
60 </script>
61 </head>
62
63 <body>
64
65 <div class="maxgalleria-meta image-edit">
66 <form id="image-edit-form" method="post">
67 <table cellpadding="0" cellspacing="0">
68 <tr>
69 <td>
70 <div class="fields">
71 <div class="field">
72 <div class="field-label">
73 <?php _e('Title', 'maxgalleria') ?>
74 </div>
75 <div class="field-value">
76 <input type="text" name="image-edit-title" value="<?php echo $image->post_title ?>" />
77 </div>
78 </div>
79
80 <div class="field">
81 <div class="field-label">
82 <?php _e('Alternate Text', 'maxgalleria') ?>
83 </div>
84 <div class="field-value">
85 <input type="text" name="image-edit-alt" value="<?php echo get_post_meta($image->ID, '_wp_attachment_image_alt', true) ?>" />
86 </div>
87 </div>
88
89 <div class="field">
90 <div class="field-label">
91 <?php _e('Caption', 'maxgalleria') ?>
92 </div>
93 <div class="field-value">
94 <textarea name="image-edit-caption"><?php echo $image->post_excerpt ?></textarea>
95 </div>
96 </div>
97
98 <div class="field">
99 <div class="field-label">
100 <?php _e('Link', 'maxgalleria') ?>
101 </div>
102 <div class="field-value">
103 <input type="text" name="image-edit-link" value="<?php echo get_post_meta($image->ID, 'maxgallery_attachment_image_link', true) ?>" />
104 </div>
105 </div>
106 </div>
107 </td>
108 <td>
109 <div class="thumb">
110 <?php echo wp_get_attachment_image($image->ID, MAXGALLERIA_META_IMAGE_THUMB_LARGE) ?>
111 </div>
112 </td>
113 </tr>
114 </table>
115
116 <div class="actions">
117 <div class="save">
118 <input type="button" class="btn btn-primary" id="save-button" value="<?php _e('Save Changes', 'maxgalleria') ?>" />
119 </div>
120 <div class="cancel">
121 <input type="button" class="btn" id="cancel-button" value="<?php _e('Cancel', 'maxgalleria') ?>" />
122 </div>
123 </div>
124
125 <?php wp_nonce_field($image_gallery->nonce_image_edit['action'], $image_gallery->nonce_image_edit['name']) ?>
126 </form>
127 </div>
128
129 </body>
130
131 </html>
132