| 1 |
<?php |
| 2 |
global $maxgalleria; |
| 3 |
$settings = $maxgalleria->settings; |
| 4 |
|
| 5 |
$addons = $maxgalleria->get_all_addons(); |
| 6 |
$templates = $maxgalleria->get_template_addons(); |
| 7 |
$media_sources = $maxgalleria->get_media_source_addons(); |
| 8 |
|
| 9 |
// Filter for image templates |
| 10 |
$image_templates = array('Image Tiles' => 'image-tiles'); |
| 11 |
foreach ($templates as $template) { |
| 12 |
if ($template['subtype'] == 'image') { |
| 13 |
$image_templates = array_merge($image_templates, array($template['name'] => $template['key'])); |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
// Filter for video templates |
| 18 |
$video_templates = array('Video Tiles' => 'video-tiles'); |
| 19 |
foreach ($templates as $template) { |
| 20 |
if ($template['subtype'] == 'video') { |
| 21 |
$video_templates = array_merge($video_templates, array($template['name'] => $template['key'])); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
// Sort arrays |
| 26 |
asort($templates); |
| 27 |
asort($image_templates); |
| 28 |
asort($video_templates); |
| 29 |
asort($media_sources); |
| 30 |
|
| 31 |
$addon = isset($_GET['addon']) ? $_GET['addon'] : ''; |
| 32 |
?> |
| 33 |
|
| 34 |
<script type="text/javascript"> |
| 35 |
jQuery(document).ready(function() { |
| 36 |
jQuery("#save-general-settings").click(function() { |
| 37 |
jQuery("#save-general-settings-success").hide(); |
| 38 |
|
| 39 |
var form_data = jQuery("#form-general-settings").serialize(); |
| 40 |
form_data += "&action=save_general_settings"; |
| 41 |
|
| 42 |
jQuery.ajax({ |
| 43 |
type: "POST", |
| 44 |
url: "<?php echo admin_url('admin-ajax.php') ?>", |
| 45 |
data: form_data, |
| 46 |
success: function(message) { |
| 47 |
if (message == "success") { |
| 48 |
jQuery("#save-general-settings-success").show(); |
| 49 |
} |
| 50 |
} |
| 51 |
}); |
| 52 |
|
| 53 |
return false; |
| 54 |
}); |
| 55 |
}); |
| 56 |
</script> |
| 57 |
|
| 58 |
<div id="maxgalleria-admin"> |
| 59 |
<div class="wrap"> |
| 60 |
<div class="icon32"> |
| 61 |
<a href="http://maxgalleria.com" target="_blank"><img src="<?php echo MAXGALLERIA_PLUGIN_URL ?>/images/maxgalleria-icon-32.png" alt="MaxGalleria" /></a> |
| 62 |
</div> |
| 63 |
|
| 64 |
<h2 class="title"><?php _e('MaxGalleria: Settings', 'maxgalleria') ?></h2> |
| 65 |
|
| 66 |
<div class="clear"></div> |
| 67 |
|
| 68 |
<div class="settings"> |
| 69 |
<div class="main"> |
| 70 |
<div class="inside"> |
| 71 |
<div class="settings-menu"> |
| 72 |
<ul> |
| 73 |
<li><!-- Spacer --></li> |
| 74 |
|
| 75 |
<?php if ($addon == '') { ?> |
| 76 |
<li class="selected"><a href="<?php echo MAXGALLERIA_SETTINGS ?>"><?php _e('General', 'maxgalleria') ?></a></li> |
| 77 |
<?php } else { ?> |
| 78 |
<li><a href="<?php echo MAXGALLERIA_SETTINGS ?>"><?php _e('General', 'maxgalleria') ?></a></li> |
| 79 |
<?php } ?> |
| 80 |
|
| 81 |
<?php if (class_exists('MaxGalleriaAlbums')) { ?> |
| 82 |
<?php if ($addon == 'albums') { ?> |
| 83 |
<li class="selected"><a href="<?php echo MAXGALLERIA_SETTINGS . '&addon=albums' ?>"><?php _e('Albums', 'maxgalleria') ?></a></li> |
| 84 |
<?php } else { ?> |
| 85 |
<li><a href="<?php echo MAXGALLERIA_SETTINGS . '&addon=albums' ?>"><?php _e('Albums', 'maxgalleria') ?></a></li> |
| 86 |
<?php } ?> |
| 87 |
<?php } ?> |
| 88 |
|
| 89 |
<li><!-- Spacer --></li> |
| 90 |
<li><strong><?php _e('Templates', 'maxgalleria') ?></strong></li> |
| 91 |
|
| 92 |
<?php foreach ($templates as $template) { ?> |
| 93 |
<li class="<?php echo $template['key'] == $addon ? 'selected' : '' ?>"> |
| 94 |
<a href="<?php echo MAXGALLERIA_SETTINGS . '&addon=' . $template['key'] ?>"><?php echo $template['name'] ?></a> |
| 95 |
</li> |
| 96 |
<?php } ?> |
| 97 |
|
| 98 |
<li><!-- Spacer --></li> |
| 99 |
<li><strong><?php _e('Media Sources', 'maxgalleria') ?></strong></li> |
| 100 |
|
| 101 |
<?php foreach ($media_sources as $media_source) { ?> |
| 102 |
<li class="<?php echo $media_source['key'] == $addon ? 'selected' : '' ?>"> |
| 103 |
<a href="<?php echo MAXGALLERIA_SETTINGS . '&addon=' . $media_source['key'] ?>"><?php echo $media_source['name'] ?></a> |
| 104 |
</li> |
| 105 |
<?php } ?> |
| 106 |
|
| 107 |
<li><!-- Spacer --></li> |
| 108 |
</ul> |
| 109 |
</div> |
| 110 |
|
| 111 |
<div class="settings-content"> |
| 112 |
<?php if ($addon == '') { ?> |
| 113 |
<div id="save-general-settings-success" class="alert alert-success" style="display: none;"> |
| 114 |
<?php printf(__('Settings saved. %sRe-save your permalinks%s to avoid "page not found" errors.', 'maxgalleria'), '<a href="' . admin_url() . 'options-permalink.php">', '</a>') ?> |
| 115 |
</div> |
| 116 |
|
| 117 |
<form id="form-general-settings"> |
| 118 |
<div class="settings-title"> |
| 119 |
<?php _e('Gallery Rewrite Slug', 'maxgalleria') ?> |
| 120 |
</div> |
| 121 |
<div class="settings-options"> |
| 122 |
<p class="note"><?php _e('The rewrite slug is how WordPress knows to display your galleries.', 'maxgalleria') ?></p> |
| 123 |
<p><?php echo home_url() ?>/<input type="text" id="<?php echo MAXGALLERIA_SETTING_REWRITE_SLUG ?>" name="<?php echo MAXGALLERIA_SETTING_REWRITE_SLUG ?>" value="<?php echo $maxgalleria->settings->get_rewrite_slug() ?>" style="font-size: 13px; width: 80px;" />/<?php _e('gallery-name', 'maxgalleria') ?></p> |
| 124 |
</div> |
| 125 |
|
| 126 |
<div class="settings-title"> |
| 127 |
<?php _e('Searchable Galleries', 'maxgalleria') ?> |
| 128 |
</div> |
| 129 |
<div class="settings-options"> |
| 130 |
<p class="note"><?php _e('By default all galleries will appear in your search results; you can disable this using the option below. This setting affects all galleries.', 'maxgalleria') ?></p> |
| 131 |
<p> |
| 132 |
<label for="<?php echo MAXGALLERIA_SETTING_EXCLUDE_GALLERIES_FROM_SEARCH ?>"><?php _e('Exclude from Search:', 'maxgalleria') ?></label> |
| 133 |
<input type="checkbox" style="margin-left: 10px;" id="<?php echo MAXGALLERIA_SETTING_EXCLUDE_GALLERIES_FROM_SEARCH ?>" name="<?php echo MAXGALLERIA_SETTING_EXCLUDE_GALLERIES_FROM_SEARCH ?>" <?php echo (($maxgalleria->settings->get_exclude_galleries_from_search() == 'on') ? 'checked' : '') ?> /> |
| 134 |
</p> |
| 135 |
</div> |
| 136 |
|
| 137 |
<div class="settings-title"> |
| 138 |
<?php _e('Default Templates', 'maxgalleria') ?> |
| 139 |
</div> |
| 140 |
<div class="settings-options"> |
| 141 |
<p class="note"><?php _e('Select the default template for image and video galleries. These can be changed per gallery.', 'maxgalleria') ?></p> |
| 142 |
<table> |
| 143 |
<tr> |
| 144 |
<td><?php _e('Image Galleries:', 'maxgalleria') ?></td> |
| 145 |
<td> |
| 146 |
<select id="<?php echo MAXGALLERIA_SETTING_DEFAULT_IMAGE_GALLERY_TEMPLATE ?>" name="<?php echo MAXGALLERIA_SETTING_DEFAULT_IMAGE_GALLERY_TEMPLATE ?>"> |
| 147 |
<?php foreach ($image_templates as $name => $key) { ?> |
| 148 |
<?php $selected = ($maxgalleria->settings->get_default_image_gallery_template() == $key) ? 'selected="selected"' : ''; ?> |
| 149 |
<option value="<?php echo $key ?>" <?php echo $selected ?>><?php echo $name ?></option> |
| 150 |
<?php } ?> |
| 151 |
</select> |
| 152 |
</td> |
| 153 |
</tr> |
| 154 |
<tr> |
| 155 |
<td><?php _e('Video Galleries:', 'maxgalleria') ?></td> |
| 156 |
<td> |
| 157 |
<select id="<?php echo MAXGALLERIA_SETTING_DEFAULT_VIDEO_GALLERY_TEMPLATE ?>" name="<?php echo MAXGALLERIA_SETTING_DEFAULT_VIDEO_GALLERY_TEMPLATE ?>"> |
| 158 |
<?php foreach ($video_templates as $name => $key) { ?> |
| 159 |
<?php $selected = ($maxgalleria->settings->get_default_video_gallery_template() == $key) ? 'selected="selected"' : ''; ?> |
| 160 |
<option value="<?php echo $key ?>" <?php echo $selected ?>><?php echo $name ?></option> |
| 161 |
<?php } ?> |
| 162 |
</select> |
| 163 |
</td> |
| 164 |
</tr> |
| 165 |
</table> |
| 166 |
</div> |
| 167 |
|
| 168 |
<?php wp_nonce_field($settings->nonce_save_general_settings['action'], $settings->nonce_save_general_settings['name']) ?> |
| 169 |
</form> |
| 170 |
|
| 171 |
<a id="save-general-settings" href="#" class="button button-primary"><?php _e('Save Settings', 'maxgalleria') ?></a> |
| 172 |
<?php } else { ?> |
| 173 |
<?php if (class_exists('MaxGalleriaAlbums') && $addon == 'albums') { ?> |
| 174 |
<?php global $maxgalleria_albums ?> |
| 175 |
<?php include_once($maxgalleria_albums->settings) ?> |
| 176 |
<?php } ?> |
| 177 |
|
| 178 |
<?php foreach ($addons as $a) { ?> |
| 179 |
<?php if ($a['key'] == $addon) { ?> |
| 180 |
<?php include_once($a['settings']) ?> |
| 181 |
<?php } ?> |
| 182 |
<?php } ?> |
| 183 |
<?php } ?> |
| 184 |
</div> |
| 185 |
|
| 186 |
<div class="clear"></div> |
| 187 |
</div> |
| 188 |
</div> |
| 189 |
</div> |
| 190 |
</div> |
| 191 |
</div> |
| 192 |
|