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 / meta-template.php

meta-template.php in MaxGalleria 2.5, at meta/meta-template.php

78 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $post;
3 $options = new MaxGalleryOptions($post->ID);
4
5 // Get all templates
6 global $maxgalleria;
7 $all_templates = $maxgalleria->get_template_addons();
8
9 // Filter for image templates
10 $image_templates = array();
11 foreach ($all_templates as $template) {
12 if ($template['subtype'] == 'image') {
13 $arr = array($template['key'] => array('name' => $template['name'], 'image' => $template['image']));
14 $image_templates = array_merge($image_templates, $arr);
15 }
16 }
17
18 // Filter for video templates
19 $video_templates = array();
20 foreach ($all_templates as $template) {
21 if ($template['subtype'] == 'video') {
22 $arr = array($template['key'] => array('name' => $template['name'], 'image' => $template['image']));
23 $video_templates = array_merge($video_templates, $arr);
24 }
25 }
26
27 // Default to image templates
28 $templates = $image_templates;
29
30 // But check to see if it should use video templates
31 if ($options->is_video_gallery()) {
32 $templates = $video_templates;
33 }
34
35 asort($templates);
36 ?>
37
38 <script type="text/javascript">
39 jQuery(document).ready(function() {
40 jQuery(".meta-options .meta-template img").click(function() {
41 var images = jQuery(".meta-options .meta-template img");
42 jQuery.each(images, function() {
43 jQuery(this).removeClass("selected");
44 });
45
46 jQuery(this).addClass("selected");
47 jQuery(this).next().attr("checked", true);
48
49 jQuery("#post").submit();
50 return false;
51 });
52 });
53 </script>
54
55 <div class="meta-options">
56 <?php if (count($templates) > 0) { ?>
57 <?php foreach ($templates as $key => $template) { ?>
58 <div class="meta-template">
59 <img src="<?php echo $template['image'] ?>" alt="<?php echo $template['name'] ?>" title="<?php echo $template['name'] ?>" <?php echo ($options->get_template() == $key) ? 'class="selected"' : '' ?> />
60 <input type="radio" name="<?php echo $options->template_key ?>" id="<?php echo $options->template_key ?>_<?php echo $key ?>" value="<?php echo $key ?>" <?php echo ($options->get_template() == $key) ? 'checked="checked"' : '' ?> />
61 <br />
62 <?php echo $template['name'] ?>
63 </div>
64 <?php } ?>
65
66 <!-- Saves count is for internal use only -->
67 <input type="hidden" id="<?php echo $options->saves_count_key ?>" name="<?php echo $options->saves_count_key ?>" value="<?php echo $options->get_saves_count() ?>" />
68 <?php } else { ?>
69 <?php if ($options->is_image_gallery()) { ?>
70 <p class="no-templates"><?php _e('You do not have any image gallery templates installed.', 'maxgalleria')?></p>
71 <?php } ?>
72
73 <?php if ($options->is_video_gallery()) { ?>
74 <p class="no-templates"><?php _e('You do not have any video gallery templates installed.', 'maxgalleria')?></p>
75 <?php } ?>
76 <?php } ?>
77 </div>
78