Version Description
- New: Ability to create own categories
- New: Ability to assign few categories to one item
- New: Ability to assign categories to non images
- Added: New capability for managing categories
Download this release
Release Info
Developer | pasyuk |
Plugin | Gmedia Photo Gallery |
Version | 1.8.12 |
Comparing to | |
See all releases |
Code changes from version 1.8.10 to 1.8.12
- admin/admin.php +2 -2
- admin/ajax.php +184 -100
- admin/assets/js/gmedia.admin.js +61 -0
- admin/galleries.php +2 -3
- admin/pages/addmedia/tpl/assign-terms.php +15 -22
- admin/pages/library/functions.php +1 -1
- admin/pages/library/library.php +6 -0
- admin/pages/library/tpl/edit-item.php +23 -29
- admin/pages/library/tpl/grid-item.php +13 -15
- admin/pages/library/tpl/list-item.php +13 -15
- admin/pages/library/tpl/panel-heading.php +5 -2
- admin/pages/settings/tpl/common.php +2 -1
- admin/pages/settings/tpl/roles.php +6 -0
- admin/pages/taxonomy/{edit-album.php → edit-term.php} +1 -1
- admin/pages/taxonomy/functions.php +30 -26
- admin/pages/taxonomy/terms.php +0 -909
- admin/pages/taxonomy/tpl/category-create-item.php +55 -0
- admin/pages/taxonomy/tpl/category-edit-item.php +104 -0
- admin/pages/taxonomy/tpl/category-list-item.php +19 -8
- admin/pages/taxonomy/tpl/category-preview-gmedia.php +54 -0
- admin/pages/taxonomy/tpl/filter-edit-item.php +1 -2
- admin/pages/taxonomy/tpl/terms-panel-heading.php +19 -24
- admin/processor/class.processor.library.php +62 -48
- admin/processor/class.processor.settings.php +3 -1
- admin/processor/class.processor.terms.php +56 -0
- app/access.php +338 -230
- config/setup.php +1 -29
- config/update.php +43 -0
- grand-media.php +4 -4
- inc/core.php +28 -9
- inc/db.connect.php +3 -10
- inc/media-upload.php +97 -85
- inc/shortcodes.php +4 -5
- module/afflux/index.php +1 -1
- module/afflux/js/jquery.gmAfflux.js +2 -2
- module/minima/index.php +1 -1
- module/minima/js/jquery.gmMinima.js +2 -2
- module/minima/settings.php +1 -1
- readme.txt +6 -0
- template/functions.php +2 -8
admin/admin.php
CHANGED
@@ -214,8 +214,8 @@ class GmediaAdmin {
|
|
214 |
break;
|
215 |
case 'GrandMedia_Terms':
|
216 |
if(isset($_GET['edit_item'])) {
|
217 |
-
if('gmedia_album'
|
218 |
-
include_once(dirname(__FILE__) . '/pages/taxonomy/edit-
|
219 |
} elseif('gmedia_filter' == $gmProcessor->taxonomy) {
|
220 |
include_once(dirname(__FILE__) . '/pages/taxonomy/edit-filter.php');
|
221 |
}
|
214 |
break;
|
215 |
case 'GrandMedia_Terms':
|
216 |
if(isset($_GET['edit_item'])) {
|
217 |
+
if(in_array($gmProcessor->taxonomy, array('gmedia_album', 'gmedia_category'))){
|
218 |
+
include_once(dirname(__FILE__) . '/pages/taxonomy/edit-term.php');
|
219 |
} elseif('gmedia_filter' == $gmProcessor->taxonomy) {
|
220 |
include_once(dirname(__FILE__) . '/pages/taxonomy/edit-filter.php');
|
221 |
}
|
admin/ajax.php
CHANGED
@@ -515,6 +515,14 @@ function gmedia_get_modal() {
|
|
515 |
$modal_title = __('Assign Category for Selected Images', 'grand-media');
|
516 |
$modal_button = __('Assign Category', 'grand-media');
|
517 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
case 'exclude_albums':
|
519 |
case 'filter_albums':
|
520 |
$modal_title = __('Filter Albums', 'grand-media');
|
@@ -662,36 +670,6 @@ function gmedia_get_modal() {
|
|
662 |
</div>
|
663 |
<?php
|
664 |
break;
|
665 |
-
case 'exclude_categories':
|
666 |
-
case 'filter_categories':
|
667 |
-
$gm_terms = $gmDB->get_terms('gmedia_category');
|
668 |
-
?>
|
669 |
-
<div class="checkbox"><label><input type="checkbox" name="cat[]" value="0"> <?php _e('Uncategorized', 'grand-media'); ?></label></div>
|
670 |
-
<?php
|
671 |
-
if(count($gm_terms)) {
|
672 |
-
foreach($gm_terms as $term) {
|
673 |
-
if($term->count) {
|
674 |
-
?>
|
675 |
-
<div class="checkbox">
|
676 |
-
<label><input type="checkbox" name="cat[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
677 |
-
<span class="badge pull-right"><?php echo $term->count; ?></span>
|
678 |
-
</div>
|
679 |
-
<?php
|
680 |
-
}
|
681 |
-
}
|
682 |
-
}
|
683 |
-
break;
|
684 |
-
case 'assign_category':
|
685 |
-
$term_type = 'gmedia_category';
|
686 |
-
$gm_terms = $gmGallery->options['taxonomies'][$term_type];
|
687 |
-
?>
|
688 |
-
<div class="radio"><label><input type="radio" name="cat" value="0"> <?php _e('Uncategorized', 'grand-media'); ?></label></div>
|
689 |
-
<?php if(count($gm_terms)) {
|
690 |
-
foreach($gm_terms as $term_name => $term_title) {
|
691 |
-
echo '<div class="radio"><label><input type="radio" name="cat" value="' . $term_name . '"> ' . esc_html($term_title) . '</label></div>';
|
692 |
-
}
|
693 |
-
}
|
694 |
-
break;
|
695 |
case 'exclude_albums':
|
696 |
case 'filter_albums':
|
697 |
if($gmCore->caps['gmedia_show_others_media']) {
|
@@ -769,6 +747,7 @@ function gmedia_get_modal() {
|
|
769 |
<option value="0"><?php _e('No Album', 'grand-media'); ?></option>
|
770 |
<?php echo $terms_album; ?>
|
771 |
</select>
|
|
|
772 |
</div>
|
773 |
<div class="form-group">
|
774 |
<div class="checkbox">
|
@@ -819,6 +798,96 @@ function gmedia_get_modal() {
|
|
819 |
</script>
|
820 |
<?php
|
821 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
822 |
case 'exclude_tags':
|
823 |
case 'filter_tags':
|
824 |
$gm_terms = $gmDB->get_terms('gmedia_tag', array('fields' => 'names_count'));
|
@@ -859,7 +928,7 @@ function gmedia_get_modal() {
|
|
859 |
<?php
|
860 |
} else {
|
861 |
$modal_button = false; ?>
|
862 |
-
<p class="
|
863 |
<?php
|
864 |
}
|
865 |
break;
|
@@ -933,7 +1002,7 @@ function gmedia_get_modal() {
|
|
933 |
}
|
934 |
} else {
|
935 |
$modal_button = false; ?>
|
936 |
-
<p class="
|
937 |
<?php
|
938 |
}
|
939 |
break;
|
@@ -1296,14 +1365,12 @@ function gmedia_module_install() {
|
|
1296 |
|
1297 |
add_action('wp_ajax_gmedia_import_wpmedia_modal', 'gmedia_import_wpmedia_modal');
|
1298 |
function gmedia_import_wpmedia_modal() {
|
1299 |
-
global $user_ID, $gmDB, $gmCore
|
1300 |
|
1301 |
check_ajax_referer('GmediaGallery');
|
1302 |
if(!current_user_can('gmedia_import')) {
|
1303 |
die('-1');
|
1304 |
}
|
1305 |
-
|
1306 |
-
$gm_terms = array();
|
1307 |
?>
|
1308 |
<div class="modal-content">
|
1309 |
<div class="modal-header">
|
@@ -1320,27 +1387,6 @@ function gmedia_import_wpmedia_modal() {
|
|
1320 |
echo $_COOKIE[$ckey];
|
1321 |
} ?>"/>
|
1322 |
<?php if($gmCore->caps['gmedia_terms']) { ?>
|
1323 |
-
<div class="form-group">
|
1324 |
-
<?php
|
1325 |
-
$term_type = 'gmedia_category';
|
1326 |
-
$gm_terms = $gmGallery->options['taxonomies'][$term_type];
|
1327 |
-
|
1328 |
-
$terms_category = '';
|
1329 |
-
if(count($gm_terms)) {
|
1330 |
-
foreach($gm_terms as $term_name => $term_title) {
|
1331 |
-
$terms_category .= '<option value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
|
1332 |
-
}
|
1333 |
-
}
|
1334 |
-
?>
|
1335 |
-
<label><?php _e('Assign Category', 'grand-media'); ?>
|
1336 |
-
<small><?php _e('(for images only)') ?></small>
|
1337 |
-
</label>
|
1338 |
-
<select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
|
1339 |
-
<option value=""><?php _e('Uncategorized', 'grand-media'); ?></option>
|
1340 |
-
<?php echo $terms_category; ?>
|
1341 |
-
</select>
|
1342 |
-
</div>
|
1343 |
-
|
1344 |
<div class="form-group">
|
1345 |
<?php
|
1346 |
$term_type = 'gmedia_album';
|
@@ -1360,62 +1406,101 @@ function gmedia_import_wpmedia_modal() {
|
|
1360 |
</select>
|
1361 |
</div>
|
1362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1363 |
<div class="form-group">
|
1364 |
<?php
|
1365 |
$term_type = 'gmedia_tag';
|
1366 |
-
$
|
1367 |
?>
|
1368 |
<label><?php _e('Add Tags', 'grand-media'); ?> </label>
|
1369 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
1370 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1371 |
<?php } else { ?>
|
1372 |
<p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
|
1373 |
<?php } ?>
|
1374 |
<div class="checkbox">
|
1375 |
-
<label><input type="checkbox" name="skip_exists" value="skip"> <?php _e('Skip if file with the same name already exists in Gmedia Library', 'grand-media');
|
1376 |
-
|
1377 |
<script type="text/javascript">
|
1378 |
jQuery(function($) {
|
1379 |
-
<?php if($gmCore->caps['gmedia_terms']){ ?>
|
1380 |
-
//noinspection JSDuplicatedDeclaration
|
1381 |
-
$('#combobox_gmedia_album').selectize({
|
1382 |
-
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
1383 |
-
create: true,
|
1384 |
-
createOnBlur: true,
|
1385 |
-
<?php } else{ ?>
|
1386 |
-
create: false,
|
1387 |
-
<?php } ?>
|
1388 |
-
persist: false
|
1389 |
-
});
|
1390 |
-
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
1391 |
-
//noinspection JSUnusedAssignment
|
1392 |
-
var items = gm_terms.map(function(x) {
|
1393 |
-
return {item: x};
|
1394 |
-
});
|
1395 |
-
//noinspection JSDuplicatedDeclaration
|
1396 |
-
$('#combobox_gmedia_tag').selectize({
|
1397 |
-
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
1398 |
-
create: function(input) {
|
1399 |
-
return {
|
1400 |
-
item: input
|
1401 |
-
}
|
1402 |
-
},
|
1403 |
-
createOnBlur: true,
|
1404 |
-
<?php } else{ ?>
|
1405 |
-
create: false,
|
1406 |
-
<?php } ?>
|
1407 |
-
delimiter: ',',
|
1408 |
-
maxItems: null,
|
1409 |
-
openOnFocus: false,
|
1410 |
-
persist: false,
|
1411 |
-
options: items,
|
1412 |
-
labelField: 'item',
|
1413 |
-
valueField: 'item',
|
1414 |
-
searchField: ['item'],
|
1415 |
-
hideSelected: true
|
1416 |
-
});
|
1417 |
-
<?php } ?>
|
1418 |
-
|
1419 |
$('#import-done').one('click', function() {
|
1420 |
$('#import_form').submit();
|
1421 |
$(this).text($(this).data('loading-text')).prop('disabled', true);
|
@@ -1424,7 +1509,6 @@ function gmedia_import_wpmedia_modal() {
|
|
1424 |
$('#importModal').modal('hide');
|
1425 |
});
|
1426 |
});
|
1427 |
-
|
1428 |
});
|
1429 |
</script>
|
1430 |
</form>
|
515 |
$modal_title = __('Assign Category for Selected Images', 'grand-media');
|
516 |
$modal_button = __('Assign Category', 'grand-media');
|
517 |
break;
|
518 |
+
case 'unassign_category':
|
519 |
+
if(!current_user_can('gmedia_terms')) {
|
520 |
+
die('-1');
|
521 |
+
}
|
522 |
+
$button_class = 'btn-danger';
|
523 |
+
$modal_title = __('Unassign Categories from Selected Items', 'grand-media');
|
524 |
+
$modal_button = __('Unassign Categories', 'grand-media');
|
525 |
+
break;
|
526 |
case 'exclude_albums':
|
527 |
case 'filter_albums':
|
528 |
$modal_title = __('Filter Albums', 'grand-media');
|
670 |
</div>
|
671 |
<?php
|
672 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
673 |
case 'exclude_albums':
|
674 |
case 'filter_albums':
|
675 |
if($gmCore->caps['gmedia_show_others_media']) {
|
747 |
<option value="0"><?php _e('No Album', 'grand-media'); ?></option>
|
748 |
<?php echo $terms_album; ?>
|
749 |
</select>
|
750 |
+
<small class="help-block" style="margin-top:0;"><?php _e('Choose "No Album" to delete albums from selected items', 'grand-media'); ?></small>
|
751 |
</div>
|
752 |
<div class="form-group">
|
753 |
<div class="checkbox">
|
798 |
</script>
|
799 |
<?php
|
800 |
break;
|
801 |
+
case 'exclude_categories':
|
802 |
+
case 'filter_categories':
|
803 |
+
$gm_terms = $gmDB->get_terms('gmedia_category');
|
804 |
+
?>
|
805 |
+
<div class="checkbox"><label><input type="checkbox" name="cat[]" value="0"> <?php _e('Uncategorized', 'grand-media'); ?></label></div>
|
806 |
+
<?php
|
807 |
+
if(count($gm_terms)) {
|
808 |
+
foreach($gm_terms as $term) {
|
809 |
+
if($term->count) {
|
810 |
+
?>
|
811 |
+
<div class="checkbox">
|
812 |
+
<label><input type="checkbox" name="cat[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
813 |
+
<span class="badge pull-right"><?php echo $term->count; ?></span>
|
814 |
+
</div>
|
815 |
+
<?php
|
816 |
+
}
|
817 |
+
}
|
818 |
+
}
|
819 |
+
break;
|
820 |
+
case 'assign_category':
|
821 |
+
$gm_terms = $gmDB->get_terms('gmedia_category', array('fields' => 'names_count'));
|
822 |
+
$gm_terms = array_values($gm_terms);
|
823 |
+
?>
|
824 |
+
<div class="form-group">
|
825 |
+
<input id="combobox_gmedia_category" name="cat_names" class="form-control input-sm" value="" placeholder="<?php _e('Add to Categories...', 'grand-media'); ?>"/>
|
826 |
+
</div>
|
827 |
+
<script type="text/javascript">
|
828 |
+
jQuery(function($) {
|
829 |
+
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
830 |
+
//noinspection JSUnusedAssignment
|
831 |
+
var items = gm_terms.map(function(x) {
|
832 |
+
//noinspection JSUnresolvedVariable
|
833 |
+
return {id: x.term_id, name: x.name, count: x.count};
|
834 |
+
});
|
835 |
+
//noinspection JSDuplicatedDeclaration
|
836 |
+
$('#combobox_gmedia_category').selectize({
|
837 |
+
delimiter: ',',
|
838 |
+
maxItems: null,
|
839 |
+
openOnFocus: false,
|
840 |
+
labelField: 'name',
|
841 |
+
hideSelected: true,
|
842 |
+
options: items,
|
843 |
+
searchField: ['name'],
|
844 |
+
valueField: 'name',
|
845 |
+
persist: false,
|
846 |
+
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
847 |
+
createOnBlur: true,
|
848 |
+
create: function(input) {
|
849 |
+
return {
|
850 |
+
name: input
|
851 |
+
}
|
852 |
+
},
|
853 |
+
<?php } else{ ?>
|
854 |
+
create: false,
|
855 |
+
<?php } ?>
|
856 |
+
render: {
|
857 |
+
item: function(item, escape) {
|
858 |
+
return '<div>' + escape(item.name) + '</div>';
|
859 |
+
},
|
860 |
+
option: function(item, escape) {
|
861 |
+
return '<div>' + escape(item.name) + ' <span class="badge">' + escape(item.count) + '</span></div>';
|
862 |
+
}
|
863 |
+
}
|
864 |
+
});
|
865 |
+
});
|
866 |
+
</script>
|
867 |
+
<?php
|
868 |
+
break;
|
869 |
+
case 'unassign_category':
|
870 |
+
// get selected items in Gmedia Library
|
871 |
+
$ckey = "gmuser_{$user_ID}_library";
|
872 |
+
$selected_items = array_filter(explode(',', $_COOKIE[$ckey]), 'is_numeric');
|
873 |
+
if(!empty($selected_items)) {
|
874 |
+
$gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_category');
|
875 |
+
}
|
876 |
+
if(count($gm_terms)){
|
877 |
+
foreach($gm_terms as $term){
|
878 |
+
?>
|
879 |
+
<div class="checkbox">
|
880 |
+
<label><input type="checkbox" name="category_id[]" value="<?php echo $term->term_id; ?>"> <?php echo esc_html($term->name); ?></label>
|
881 |
+
<span class="badge pull-right"><?php echo $term->count; ?></span>
|
882 |
+
</div>
|
883 |
+
<?php
|
884 |
+
}
|
885 |
+
} else {
|
886 |
+
$modal_button = false; ?>
|
887 |
+
<p class="noterms"><?php _e('No categories', 'grand-media'); ?></p>
|
888 |
+
<?php
|
889 |
+
}
|
890 |
+
break;
|
891 |
case 'exclude_tags':
|
892 |
case 'filter_tags':
|
893 |
$gm_terms = $gmDB->get_terms('gmedia_tag', array('fields' => 'names_count'));
|
928 |
<?php
|
929 |
} else {
|
930 |
$modal_button = false; ?>
|
931 |
+
<p class="noterms"><?php _e('No tags', 'grand-media'); ?></p>
|
932 |
<?php
|
933 |
}
|
934 |
break;
|
1002 |
}
|
1003 |
} else {
|
1004 |
$modal_button = false; ?>
|
1005 |
+
<p class="noterms"><?php _e('No tags', 'grand-media'); ?></p>
|
1006 |
<?php
|
1007 |
}
|
1008 |
break;
|
1365 |
|
1366 |
add_action('wp_ajax_gmedia_import_wpmedia_modal', 'gmedia_import_wpmedia_modal');
|
1367 |
function gmedia_import_wpmedia_modal() {
|
1368 |
+
global $user_ID, $gmDB, $gmCore;
|
1369 |
|
1370 |
check_ajax_referer('GmediaGallery');
|
1371 |
if(!current_user_can('gmedia_import')) {
|
1372 |
die('-1');
|
1373 |
}
|
|
|
|
|
1374 |
?>
|
1375 |
<div class="modal-content">
|
1376 |
<div class="modal-header">
|
1387 |
echo $_COOKIE[$ckey];
|
1388 |
} ?>"/>
|
1389 |
<?php if($gmCore->caps['gmedia_terms']) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1390 |
<div class="form-group">
|
1391 |
<?php
|
1392 |
$term_type = 'gmedia_album';
|
1406 |
</select>
|
1407 |
</div>
|
1408 |
|
1409 |
+
<div class="form-group">
|
1410 |
+
<?php
|
1411 |
+
$term_type = 'gmedia_category';
|
1412 |
+
$gm_cat_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
|
1413 |
+
?>
|
1414 |
+
<label><?php _e('Assign Categories', 'grand-media'); ?></label>
|
1415 |
+
<input id="combobox_gmedia_category" name="terms[gmedia_category]" class="form-control input-sm" value="" placeholder="<?php _e('Uncategorized', 'grand-media'); ?>"/>
|
1416 |
+
</div>
|
1417 |
+
|
1418 |
<div class="form-group">
|
1419 |
<?php
|
1420 |
$term_type = 'gmedia_tag';
|
1421 |
+
$gm_tag_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
|
1422 |
?>
|
1423 |
<label><?php _e('Add Tags', 'grand-media'); ?> </label>
|
1424 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
1425 |
</div>
|
1426 |
+
<script type="text/javascript">
|
1427 |
+
jQuery(function($) {
|
1428 |
+
//noinspection JSDuplicatedDeclaration
|
1429 |
+
$('#combobox_gmedia_album').selectize({
|
1430 |
+
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
1431 |
+
create: true,
|
1432 |
+
createOnBlur: true,
|
1433 |
+
<?php } else{ ?>
|
1434 |
+
create: false,
|
1435 |
+
<?php } ?>
|
1436 |
+
persist: false
|
1437 |
+
});
|
1438 |
+
|
1439 |
+
var gm_cat_terms = <?php echo json_encode($gm_cat_terms); ?>;
|
1440 |
+
//noinspection JSUnusedAssignment
|
1441 |
+
var cat_items = gm_cat_terms.map(function(x) {
|
1442 |
+
return {item: x};
|
1443 |
+
});
|
1444 |
+
//noinspection JSDuplicatedDeclaration
|
1445 |
+
$('#combobox_gmedia_category').selectize({
|
1446 |
+
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
1447 |
+
create: function(input) {
|
1448 |
+
return {
|
1449 |
+
item: input
|
1450 |
+
}
|
1451 |
+
},
|
1452 |
+
createOnBlur: true,
|
1453 |
+
<?php } else{ ?>
|
1454 |
+
create: false,
|
1455 |
+
<?php } ?>
|
1456 |
+
delimiter: ',',
|
1457 |
+
maxItems: null,
|
1458 |
+
openOnFocus: false,
|
1459 |
+
persist: false,
|
1460 |
+
options: cat_items,
|
1461 |
+
labelField: 'item',
|
1462 |
+
valueField: 'item',
|
1463 |
+
searchField: ['item'],
|
1464 |
+
hideSelected: true
|
1465 |
+
});
|
1466 |
+
|
1467 |
+
var gm_tag_terms = <?php echo json_encode($gm_tag_terms); ?>;
|
1468 |
+
//noinspection JSUnusedAssignment
|
1469 |
+
var tag_items = gm_tag_terms.map(function(x) {
|
1470 |
+
return {item: x};
|
1471 |
+
});
|
1472 |
+
//noinspection JSDuplicatedDeclaration
|
1473 |
+
$('#combobox_gmedia_tag').selectize({
|
1474 |
+
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
1475 |
+
create: function(input) {
|
1476 |
+
return {
|
1477 |
+
item: input
|
1478 |
+
}
|
1479 |
+
},
|
1480 |
+
createOnBlur: true,
|
1481 |
+
<?php } else{ ?>
|
1482 |
+
create: false,
|
1483 |
+
<?php } ?>
|
1484 |
+
delimiter: ',',
|
1485 |
+
maxItems: null,
|
1486 |
+
openOnFocus: false,
|
1487 |
+
persist: false,
|
1488 |
+
options: tag_items,
|
1489 |
+
labelField: 'item',
|
1490 |
+
valueField: 'item',
|
1491 |
+
searchField: ['item'],
|
1492 |
+
hideSelected: true
|
1493 |
+
});
|
1494 |
+
});
|
1495 |
+
</script>
|
1496 |
<?php } else { ?>
|
1497 |
<p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
|
1498 |
<?php } ?>
|
1499 |
<div class="checkbox">
|
1500 |
+
<label><input type="checkbox" name="skip_exists" value="skip"> <?php _e('Skip if file with the same name already exists in Gmedia Library', 'grand-media'); ?></label>
|
1501 |
+
</div>
|
1502 |
<script type="text/javascript">
|
1503 |
jQuery(function($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1504 |
$('#import-done').one('click', function() {
|
1505 |
$('#import_form').submit();
|
1506 |
$(this).text($(this).data('loading-text')).prop('disabled', true);
|
1509 |
$('#importModal').modal('hide');
|
1510 |
});
|
1511 |
});
|
|
|
1512 |
});
|
1513 |
</script>
|
1514 |
</form>
|
admin/assets/js/gmedia.admin.js
CHANGED
@@ -30,6 +30,37 @@ var GmediaLibrary = {
|
|
30 |
persist: false
|
31 |
});
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
// Date/Time picker
|
34 |
var gmedia_date_temp;
|
35 |
jQuery('.input-group.gmedia_date').datetimepicker({useSeconds: true}).on('dp.show', function() {
|
@@ -147,6 +178,36 @@ var GmediaAddMedia = {
|
|
147 |
});
|
148 |
}
|
149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
|
152 |
},
|
30 |
persist: false
|
31 |
});
|
32 |
|
33 |
+
if(window.gmedia_categories) {
|
34 |
+
var categories = jQuery('.combobox_gmedia_category');
|
35 |
+
if(categories.length) {
|
36 |
+
var categories_data = window.gmedia_categories.map(function(x) {
|
37 |
+
return {item: x};
|
38 |
+
});
|
39 |
+
|
40 |
+
categories.selectize({
|
41 |
+
create: function(input) {
|
42 |
+
if(categories.data('create')) {
|
43 |
+
return {
|
44 |
+
item: input
|
45 |
+
}
|
46 |
+
} else {
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
},
|
50 |
+
createOnBlur: true,
|
51 |
+
delimiter: ',',
|
52 |
+
maxItems: null,
|
53 |
+
openOnFocus: false,
|
54 |
+
persist: false,
|
55 |
+
options: categories_data,
|
56 |
+
labelField: 'item',
|
57 |
+
valueField: 'item',
|
58 |
+
searchField: ['item'],
|
59 |
+
hideSelected: true
|
60 |
+
});
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
// Date/Time picker
|
65 |
var gmedia_date_temp;
|
66 |
jQuery('.input-group.gmedia_date').datetimepicker({useSeconds: true}).on('dp.show', function() {
|
178 |
});
|
179 |
}
|
180 |
}
|
181 |
+
if(window.gmedia_categories) {
|
182 |
+
var categories = jQuery('#combobox_gmedia_category');
|
183 |
+
if(categories.length) {
|
184 |
+
var categories_data = window.gmedia_categories.map(function(x) {
|
185 |
+
return {item: x};
|
186 |
+
});
|
187 |
+
|
188 |
+
categories.selectize({
|
189 |
+
create: function(input) {
|
190 |
+
if(categories.data('create')) {
|
191 |
+
return {
|
192 |
+
item: input
|
193 |
+
}
|
194 |
+
} else {
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
},
|
198 |
+
createOnBlur: true,
|
199 |
+
delimiter: ',',
|
200 |
+
maxItems: null,
|
201 |
+
openOnFocus: false,
|
202 |
+
persist: false,
|
203 |
+
options: categories_data,
|
204 |
+
labelField: 'item',
|
205 |
+
valueField: 'item',
|
206 |
+
searchField: ['item'],
|
207 |
+
hideSelected: true
|
208 |
+
});
|
209 |
+
}
|
210 |
+
}
|
211 |
|
212 |
|
213 |
},
|
admin/galleries.php
CHANGED
@@ -285,7 +285,7 @@ function gmediaGalleries()
|
|
285 |
if ('gmedia_category' == $tax_tabs) {
|
286 |
_e('Categories', 'grand-media');
|
287 |
foreach ($tabs as $t) {
|
288 |
-
$terms_source[] = sprintf('<a class="gm_gallery_source gm_category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($
|
289 |
}
|
290 |
} elseif ('gmedia_album' == $tax_tabs) {
|
291 |
_e('Albums', 'grand-media');
|
@@ -723,14 +723,13 @@ function gmediaGalleryEdit()
|
|
723 |
<div class="form-group" id="div_gmedia_category">
|
724 |
<?php
|
725 |
$term_type = 'gmedia_category';
|
726 |
-
$gm_terms_all = $gmGallery->options['taxonomies'][$term_type];
|
727 |
$gm_terms = $gmDB->get_terms($term_type, array('fields' => 'names_count'));
|
728 |
|
729 |
$terms_items = '';
|
730 |
if (count($gm_terms)) {
|
731 |
foreach ($gm_terms as $id => $term) {
|
732 |
$selected = (isset($gallery['_query'][$term_type]) && in_array($id, $gallery['_query'][$term_type])) ? ' selected="selected"' : '';
|
733 |
-
$terms_items .= '<option value="' . $id . '"' . $selected . '>' . esc_html($
|
734 |
}
|
735 |
}
|
736 |
$setvalue = isset($gallery['_query'][$term_type]) ? 'data-setvalue="' . implode(',', $gallery['_query'][$term_type]) . '"' : '';
|
285 |
if ('gmedia_category' == $tax_tabs) {
|
286 |
_e('Categories', 'grand-media');
|
287 |
foreach ($tabs as $t) {
|
288 |
+
$terms_source[] = sprintf('<a class="gm_gallery_source gm_category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($t->name));
|
289 |
}
|
290 |
} elseif ('gmedia_album' == $tax_tabs) {
|
291 |
_e('Albums', 'grand-media');
|
723 |
<div class="form-group" id="div_gmedia_category">
|
724 |
<?php
|
725 |
$term_type = 'gmedia_category';
|
|
|
726 |
$gm_terms = $gmDB->get_terms($term_type, array('fields' => 'names_count'));
|
727 |
|
728 |
$terms_items = '';
|
729 |
if (count($gm_terms)) {
|
730 |
foreach ($gm_terms as $id => $term) {
|
731 |
$selected = (isset($gallery['_query'][$term_type]) && in_array($id, $gallery['_query'][$term_type])) ? ' selected="selected"' : '';
|
732 |
+
$terms_items .= '<option value="' . $id . '"' . $selected . '>' . esc_html($term['name']) . ' (' . $term['count'] . ')</option>' . "\n";
|
733 |
}
|
734 |
}
|
735 |
$setvalue = isset($gallery['_query'][$term_type]) ? 'data-setvalue="' . implode(',', $gallery['_query'][$term_type]) . '"' : '';
|
admin/pages/addmedia/tpl/assign-terms.php
CHANGED
@@ -6,26 +6,6 @@
|
|
6 |
*/
|
7 |
|
8 |
if(gm_user_can('terms')) { ?>
|
9 |
-
<div class="form-group">
|
10 |
-
<?php
|
11 |
-
$term_type = 'gmedia_category';
|
12 |
-
$gm_terms = $gmGallery->options['taxonomies'][$term_type];
|
13 |
-
|
14 |
-
$terms_category = '';
|
15 |
-
if(count($gm_terms)) {
|
16 |
-
foreach($gm_terms as $term_name => $term_title) {
|
17 |
-
$terms_category .= '<option value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
|
18 |
-
}
|
19 |
-
}
|
20 |
-
?>
|
21 |
-
<label><?php _e('Assign Category', 'grand-media'); ?>
|
22 |
-
<small><?php _e('(for images only)', 'grand-media') ?></small>
|
23 |
-
</label>
|
24 |
-
<select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
|
25 |
-
<option value=""><?php _e('Uncategorized', 'grand-media'); ?></option>
|
26 |
-
<?php echo $terms_category; ?>
|
27 |
-
</select>
|
28 |
-
</div>
|
29 |
<div class="form-group">
|
30 |
<?php
|
31 |
$term_type = 'gmedia_album';
|
@@ -56,15 +36,28 @@ if(gm_user_can('terms')) { ?>
|
|
56 |
<?php echo $terms_album; ?>
|
57 |
</select>
|
58 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
<div class="form-group">
|
60 |
<?php
|
61 |
$term_type = 'gmedia_tag';
|
62 |
-
$
|
63 |
?>
|
64 |
<label><?php _e('Add Tags', 'grand-media'); ?> </label>
|
65 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" data-create="<?php echo gm_user_can('tag_manage')? 'true' : 'false'; ?>" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
66 |
</div>
|
67 |
-
<script type="text/javascript">
|
|
|
|
|
|
|
68 |
<?php } else { ?>
|
69 |
<p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
|
70 |
<?php } ?>
|
6 |
*/
|
7 |
|
8 |
if(gm_user_can('terms')) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<div class="form-group">
|
10 |
<?php
|
11 |
$term_type = 'gmedia_album';
|
36 |
<?php echo $terms_album; ?>
|
37 |
</select>
|
38 |
</div>
|
39 |
+
|
40 |
+
<div class="form-group">
|
41 |
+
<?php
|
42 |
+
$term_type = 'gmedia_category';
|
43 |
+
$gm_category_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
|
44 |
+
?>
|
45 |
+
<label><?php _e('Assign Categories', 'grand-media'); ?></label>
|
46 |
+
<input id="combobox_gmedia_category" name="terms[gmedia_category]" data-create="<?php echo gm_user_can('category_manage')? 'true' : 'false'; ?>" class="form-control input-sm" value="" placeholder="<?php _e('Uncategorized', 'grand-media'); ?>"/>
|
47 |
+
</div>
|
48 |
+
|
49 |
<div class="form-group">
|
50 |
<?php
|
51 |
$term_type = 'gmedia_tag';
|
52 |
+
$gm_tag_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
|
53 |
?>
|
54 |
<label><?php _e('Add Tags', 'grand-media'); ?> </label>
|
55 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" data-create="<?php echo gm_user_can('tag_manage')? 'true' : 'false'; ?>" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
56 |
</div>
|
57 |
+
<script type="text/javascript">
|
58 |
+
var gmedia_categories = <?php echo json_encode($gm_category_terms); ?>;
|
59 |
+
var gmedia_tags = <?php echo json_encode($gm_tag_terms); ?>;
|
60 |
+
</script>
|
61 |
<?php } else { ?>
|
62 |
<p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
|
63 |
<?php } ?>
|
admin/pages/library/functions.php
CHANGED
@@ -94,7 +94,7 @@ function gmedia_item_more_data(&$item) {
|
|
94 |
|
95 |
$item->tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
|
96 |
$item->album = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
|
97 |
-
$item->
|
98 |
|
99 |
$item = apply_filters('gmedia_item_more_data', $item);
|
100 |
}
|
94 |
|
95 |
$item->tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
|
96 |
$item->album = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
|
97 |
+
$item->categories = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category');
|
98 |
|
99 |
$item = apply_filters('gmedia_item_more_data', $item);
|
100 |
}
|
admin/pages/library/library.php
CHANGED
@@ -60,6 +60,12 @@ if($gmProcessor->user_options['grid_cell_fit_gmedia']) {
|
|
60 |
include(dirname(__FILE__) . '/tpl/' . $gmedia_user_options['display_mode_gmedia'] . '-item.php');
|
61 |
}
|
62 |
} elseif(gm_user_can('edit_media')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
foreach($gmedia_query as &$item) {
|
64 |
gmedia_item_more_data($item);
|
65 |
|
60 |
include(dirname(__FILE__) . '/tpl/' . $gmedia_user_options['display_mode_gmedia'] . '-item.php');
|
61 |
}
|
62 |
} elseif(gm_user_can('edit_media')) {
|
63 |
+
$gm_category_terms = $gmDB->get_terms('gmedia_category', array('fields' => 'names'));
|
64 |
+
?>
|
65 |
+
<script type="text/javascript">
|
66 |
+
var gmedia_categories = <?php echo json_encode($gm_category_terms); ?>;
|
67 |
+
</script>
|
68 |
+
<?php
|
69 |
foreach($gmedia_query as &$item) {
|
70 |
gmedia_item_more_data($item);
|
71 |
|
admin/pages/library/tpl/edit-item.php
CHANGED
@@ -52,36 +52,7 @@
|
|
52 |
} ?>
|
53 |
</div>
|
54 |
<div class="col-lg-6">
|
55 |
-
<?php if(('image' != $item->type)) { ?>
|
56 |
-
<div class="form-group">
|
57 |
-
<label><?php _e('Custom Cover', 'grand-media'); echo ' <small>('.__('media image ID', 'grand-media').')</small>'; ?></label>
|
58 |
-
<input name="meta[_cover]" type="text" class="form-control input-sm gmedia-cover" value="<?php echo isset($item->meta['_cover'][0])? $item->meta['_cover'][0] : ''; ?>" placeholder="<?php _e('Gmedia ID or Image URL', 'grand-media'); ?>"/>
|
59 |
-
</div>
|
60 |
-
<?php } ?>
|
61 |
<?php if(gm_user_can('terms')) { ?>
|
62 |
-
<?php if($item->editor) { ?>
|
63 |
-
<?php
|
64 |
-
$cat_name = empty($item->category)? 0 : reset($item->category)->name;
|
65 |
-
$term_type = 'gmedia_category';
|
66 |
-
$gm_terms = $gmGallery->options['taxonomies'][$term_type];
|
67 |
-
|
68 |
-
$terms_category = '';
|
69 |
-
if(count($gm_terms)) {
|
70 |
-
foreach($gm_terms as $term_name => $term_title) {
|
71 |
-
$selected_option = ($cat_name === $term_name)? ' selected="selected"' : '';
|
72 |
-
$terms_category .= '<option' . $selected_option . ' value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
|
73 |
-
}
|
74 |
-
}
|
75 |
-
?>
|
76 |
-
<div class="form-group">
|
77 |
-
<label><?php _e('Category', 'grand-media'); ?> </label>
|
78 |
-
<select name="terms[gmedia_category]" class="gmedia_category form-control input-sm">
|
79 |
-
<option<?php echo $cat_name? '' : ' selected="selected"'; ?> value=""><?php _e('Uncategorized', 'grand-media'); ?></option>
|
80 |
-
<?php echo $terms_category; ?>
|
81 |
-
</select>
|
82 |
-
</div>
|
83 |
-
<?php } ?>
|
84 |
-
|
85 |
<?php
|
86 |
$alb_id = empty($item->album)? 0 : reset($item->album)->term_id;
|
87 |
$term_type = 'gmedia_album';
|
@@ -123,6 +94,23 @@
|
|
123 |
<?php echo $terms_album; ?>
|
124 |
</select>
|
125 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
<?php
|
127 |
if(!empty($item->tags)) {
|
128 |
$terms_tag = array();
|
@@ -200,6 +188,12 @@
|
|
200 |
}
|
201 |
?>
|
202 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
<?php if(('image' == $item->type) || ('video' == $item->type)) { ?>
|
204 |
<div class="form-group">
|
205 |
<label><?php _e('GPS Location', 'grand-media'); ?></label>
|
52 |
} ?>
|
53 |
</div>
|
54 |
<div class="col-lg-6">
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<?php if(gm_user_can('terms')) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
<?php
|
57 |
$alb_id = empty($item->album)? 0 : reset($item->album)->term_id;
|
58 |
$term_type = 'gmedia_album';
|
94 |
<?php echo $terms_album; ?>
|
95 |
</select>
|
96 |
</div>
|
97 |
+
|
98 |
+
<?php
|
99 |
+
if(!empty($item->categories)) {
|
100 |
+
$terms_category = array();
|
101 |
+
foreach($item->categories as $c) {
|
102 |
+
$terms_category[] = esc_html($c->name);
|
103 |
+
}
|
104 |
+
$terms_category = join(', ', $terms_category);
|
105 |
+
} else {
|
106 |
+
$terms_category = '';
|
107 |
+
}
|
108 |
+
?>
|
109 |
+
<div class="form-group">
|
110 |
+
<label><?php _e('Categories', 'grand-media'); ?></label>
|
111 |
+
<input name="terms[gmedia_category]" data-create="<?php echo gm_user_can('category_manage')? 'true' : 'false'; ?>" class="combobox_gmedia_category form-control input-sm" value="<?php echo $terms_category; ?>" placeholder="<?php _e('Uncategorized', 'grand-media'); ?>"/>
|
112 |
+
</div>
|
113 |
+
|
114 |
<?php
|
115 |
if(!empty($item->tags)) {
|
116 |
$terms_tag = array();
|
188 |
}
|
189 |
?>
|
190 |
</div>
|
191 |
+
<?php if(('image' != $item->type)) { ?>
|
192 |
+
<div class="form-group">
|
193 |
+
<label><?php _e('Custom Cover', 'grand-media'); echo ' <small>('.__('media image ID', 'grand-media').')</small>'; ?></label>
|
194 |
+
<input name="meta[_cover]" type="text" class="form-control input-sm gmedia-cover" value="<?php echo isset($item->meta['_cover'][0])? $item->meta['_cover'][0] : ''; ?>" placeholder="<?php _e('Gmedia ID or Image URL', 'grand-media'); ?>"/>
|
195 |
+
</div>
|
196 |
+
<?php } ?>
|
197 |
<?php if(('image' == $item->type) || ('video' == $item->type)) { ?>
|
198 |
<div class="form-group">
|
199 |
<label><?php _e('GPS Location', 'grand-media'); ?></label>
|
admin/pages/library/tpl/grid-item.php
CHANGED
@@ -34,22 +34,20 @@
|
|
34 |
$terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $gmedia_url)), '—');
|
35 |
}
|
36 |
echo $terms_album;
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$terms_category = array();
|
44 |
-
foreach($item->category as $c) {
|
45 |
-
$terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $gmedia_url)), esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
|
46 |
-
}
|
47 |
-
$terms_category = join(', ', $terms_category);
|
48 |
-
} else {
|
49 |
-
$terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
|
50 |
}
|
51 |
-
|
52 |
-
}
|
|
|
|
|
|
|
|
|
53 |
<br/><span class="label label-default"><?php _e('Tags', 'grand-media'); ?>:</span>
|
54 |
<?php
|
55 |
if($item->tags) {
|
34 |
$terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $gmedia_url)), '—');
|
35 |
}
|
36 |
echo $terms_album;
|
37 |
+
?>
|
38 |
+
<br/><span class="label label-default"><?php _e('Category', 'grand-media'); ?>:</span>
|
39 |
+
<?php
|
40 |
+
if($item->categories) {
|
41 |
+
$terms_category = array();
|
42 |
+
foreach($item->categories as $c) {
|
43 |
+
$terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $gmedia_url)), esc_html($c->name));
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
+
$terms_category = join(', ', $terms_category);
|
46 |
+
} else {
|
47 |
+
$terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
|
48 |
+
}
|
49 |
+
echo $terms_category;
|
50 |
+
?>
|
51 |
<br/><span class="label label-default"><?php _e('Tags', 'grand-media'); ?>:</span>
|
52 |
<?php
|
53 |
if($item->tags) {
|
admin/pages/library/tpl/list-item.php
CHANGED
@@ -40,22 +40,20 @@
|
|
40 |
$terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $gmedia_url)), '—');
|
41 |
}
|
42 |
echo $terms_album;
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$terms_category = array();
|
50 |
-
foreach($item->category as $c) {
|
51 |
-
$terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $gmedia_url)), esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
|
52 |
-
}
|
53 |
-
$terms_category = join(', ', $terms_category);
|
54 |
-
} else {
|
55 |
-
$terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
|
56 |
}
|
57 |
-
|
58 |
-
}
|
|
|
|
|
|
|
|
|
59 |
<br/><span class="label label-default"><?php _e('Tags', 'grand-media'); ?>:</span>
|
60 |
<?php
|
61 |
if($item->tags) {
|
40 |
$terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $gmedia_url)), '—');
|
41 |
}
|
42 |
echo $terms_album;
|
43 |
+
?>
|
44 |
+
<br/><span class="label label-default"><?php _e('Category', 'grand-media'); ?>:</span>
|
45 |
+
<?php
|
46 |
+
if($item->categories) {
|
47 |
+
$terms_category = array();
|
48 |
+
foreach($item->categories as $c) {
|
49 |
+
$terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $gmedia_url)), esc_html($c->name));
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
+
$terms_category = join(', ', $terms_category);
|
52 |
+
} else {
|
53 |
+
$terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
|
54 |
+
}
|
55 |
+
echo $terms_category;
|
56 |
+
?>
|
57 |
<br/><span class="label label-default"><?php _e('Tags', 'grand-media'); ?>:</span>
|
58 |
<?php
|
59 |
if($item->tags) {
|
admin/pages/library/tpl/panel-heading.php
CHANGED
@@ -131,10 +131,13 @@
|
|
131 |
|
132 |
<li class="divider"></li>
|
133 |
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
134 |
-
<a href="#libModal" data-modal="
|
135 |
</li>
|
136 |
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
137 |
-
<a href="#libModal" data-modal="
|
|
|
|
|
|
|
138 |
</li>
|
139 |
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
140 |
<a href="#libModal" data-modal="add_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Add Tags...', 'grand-media'); ?></a></li>
|
131 |
|
132 |
<li class="divider"></li>
|
133 |
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
134 |
+
<a href="#libModal" data-modal="assign_album" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Move to Album...', 'grand-media'); ?></a>
|
135 |
</li>
|
136 |
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
137 |
+
<a href="#libModal" data-modal="assign_category" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Assign Categories...', 'grand-media'); ?></a>
|
138 |
+
</li>
|
139 |
+
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
140 |
+
<a href="#libModal" data-modal="unassign_category" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Unassign Categories...', 'grand-media'); ?></a>
|
141 |
</li>
|
142 |
<li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
|
143 |
<a href="#libModal" data-modal="add_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Add Tags...', 'grand-media'); ?></a></li>
|
admin/pages/settings/tpl/common.php
CHANGED
@@ -36,7 +36,7 @@
|
|
36 |
</div>
|
37 |
<div class="form-group row">
|
38 |
<div class="col-xs-6">
|
39 |
-
<label><?php _e('In Category order gmedia', 'grand-media'); ?></label>
|
40 |
<select name="set[in_category_orderby]" class="form-control input-sm">
|
41 |
<option value="ID" <?php selected($gmGallery->options['in_category_orderby'], 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
|
42 |
<option value="title" <?php selected($gmGallery->options['in_category_orderby'], 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
|
@@ -53,6 +53,7 @@
|
|
53 |
<option value="ASC" <?php selected($gmGallery->options['in_category_order'], 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
|
54 |
</select>
|
55 |
</div>
|
|
|
56 |
</div>
|
57 |
<div class="form-group">
|
58 |
<label><?php _e('Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'grand-media') ?>:</label>
|
36 |
</div>
|
37 |
<div class="form-group row">
|
38 |
<div class="col-xs-6">
|
39 |
+
<label><?php _e('In Category order gmedia (set default order)', 'grand-media'); ?></label>
|
40 |
<select name="set[in_category_orderby]" class="form-control input-sm">
|
41 |
<option value="ID" <?php selected($gmGallery->options['in_category_orderby'], 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
|
42 |
<option value="title" <?php selected($gmGallery->options['in_category_orderby'], 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
|
53 |
<option value="ASC" <?php selected($gmGallery->options['in_category_order'], 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
|
54 |
</select>
|
55 |
</div>
|
56 |
+
<p class="help-block"><?php _e('This option could be rewritten by individual category settings.', 'grand-media'); ?></p>
|
57 |
</div>
|
58 |
<div class="form-group">
|
59 |
<label><?php _e('Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'grand-media') ?>:</label>
|
admin/pages/settings/tpl/roles.php
CHANGED
@@ -85,6 +85,12 @@
|
|
85 |
|
86 |
<p class="help-block"><?php _e('Who can create and edit own custom filters. It is required "Edit Others Media" capability to edit filters you do not own', 'grand-media'); ?></p>
|
87 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
<div class="form-group">
|
89 |
<label><?php _e('Manage Tags', 'grand-media') ?>:</label>
|
90 |
<select name="capability[gmedia_tag_manage]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_tag_manage')); ?></select>
|
85 |
|
86 |
<p class="help-block"><?php _e('Who can create and edit own custom filters. It is required "Edit Others Media" capability to edit filters you do not own', 'grand-media'); ?></p>
|
87 |
</div>
|
88 |
+
<div class="form-group">
|
89 |
+
<label><?php _e('Manage Categories', 'grand-media') ?>:</label>
|
90 |
+
<select name="capability[gmedia_category_manage]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_category_manage')); ?></select>
|
91 |
+
|
92 |
+
<p class="help-block"><?php _e('Who can create new categories. It is required "Edit Others Media" capability to edit categories', 'grand-media'); ?></p>
|
93 |
+
</div>
|
94 |
<div class="form-group">
|
95 |
<label><?php _e('Manage Tags', 'grand-media') ?>:</label>
|
96 |
<select name="capability[gmedia_tag_manage]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_tag_manage')); ?></select>
|
admin/pages/taxonomy/{edit-album.php → edit-term.php}
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Gmedia Term (Album) Edit
|
4 |
*/
|
5 |
|
6 |
// don't load directly
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Gmedia Term (Album, Category) Edit
|
4 |
*/
|
5 |
|
6 |
// don't load directly
|
admin/pages/taxonomy/functions.php
CHANGED
@@ -77,33 +77,31 @@ function gmedia_term_item_actions($item) {
|
|
77 |
$actions['share'] = "<span class='action-inactive'>$share_icon</span>";
|
78 |
}
|
79 |
|
80 |
-
if('
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
$actions['edit'] = '<a title="' . __('Edit', 'grand-media') . '" href="' . add_query_arg(array("edit_item" => $item->term_id), $gmProcessor->url) . '">' . $edit_icon . '</a>';
|
85 |
-
} else {
|
86 |
-
$actions['edit'] = "<span class='action-inactive'>$edit_icon</span>";
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
$trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
|
91 |
-
if($item->allow_delete) {
|
92 |
-
$actions['delete'] = '<a class="trash-icon" title="' . __('Delete', 'grand-media') . '" href="' . wp_nonce_url(add_query_arg(array('delete' => $item->term_id), $gmProcessor->url), 'gmedia_delete') . '" data-confirm="' . __("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media") . '">' . $trash_icon . '</a>';
|
93 |
} else {
|
94 |
-
$actions['
|
95 |
}
|
|
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
104 |
}
|
105 |
-
}
|
106 |
-
}
|
107 |
|
108 |
|
109 |
return apply_filters('gmedia_term_item_actions', $actions);
|
@@ -111,7 +109,7 @@ function gmedia_term_item_actions($item) {
|
|
111 |
|
112 |
|
113 |
function gmedia_term_item_more_data(&$item) {
|
114 |
-
global $gmDB
|
115 |
|
116 |
$meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
|
117 |
$item->meta = $meta;
|
@@ -134,9 +132,6 @@ function gmedia_term_item_more_data(&$item) {
|
|
134 |
$item->comment_status = $post_item->comment_status;
|
135 |
}
|
136 |
}
|
137 |
-
} elseif('gmedia_category' == $item->taxonomy) {
|
138 |
-
$item->slug = $item->name;
|
139 |
-
$item->name = $gmGallery->options['taxonomies']['gmedia_category'][$item->slug];
|
140 |
}
|
141 |
|
142 |
|
@@ -147,6 +142,10 @@ function gmedia_terms_create_album_tpl() {
|
|
147 |
include(dirname(__FILE__) . '/tpl/album-create-item.php');
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
150 |
function gmedia_terms_create_tag_tpl() {
|
151 |
include(dirname(__FILE__) . '/tpl/tag-create-item.php');
|
152 |
}
|
@@ -188,6 +187,11 @@ function gmedia_term_album_after_panel($term){
|
|
188 |
include(dirname(__FILE__) . '/tpl/album-sort-gmedia.php');
|
189 |
}
|
190 |
|
|
|
|
|
|
|
|
|
|
|
191 |
add_action('gmedia_term_filter_after_panel', 'gmedia_term_filter_after_panel');
|
192 |
function gmedia_term_filter_after_panel($term){
|
193 |
include(dirname(__FILE__) . '/tpl/filter-preview-query.php');
|
77 |
$actions['share'] = "<span class='action-inactive'>$share_icon</span>";
|
78 |
}
|
79 |
|
80 |
+
if('gmedia_tag' != $item->taxonomy) {
|
81 |
+
$edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
|
82 |
+
if($item->allow_edit) {
|
83 |
+
$actions['edit'] = '<a title="' . __('Edit', 'grand-media') . '" href="' . add_query_arg(array("edit_item" => $item->term_id), $gmProcessor->url) . '">' . $edit_icon . '</a>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
} else {
|
85 |
+
$actions['edit'] = "<span class='action-inactive'>$edit_icon</span>";
|
86 |
}
|
87 |
+
}
|
88 |
|
89 |
+
$trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
|
90 |
+
if($item->allow_delete) {
|
91 |
+
$actions['delete'] = '<a class="trash-icon" title="' . __('Delete', 'grand-media') . '" href="' . wp_nonce_url(add_query_arg(array('delete' => $item->term_id), $gmProcessor->url), 'gmedia_delete') . '" data-confirm="' . __("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media") . '">' . $trash_icon . '</a>';
|
92 |
+
} else {
|
93 |
+
$actions['delete'] = "<span class='action-inactive'>$trash_icon</span>";
|
94 |
+
}
|
95 |
|
96 |
+
/*if(gm_user_can("{$item->taxonomy}_manage")) {
|
97 |
+
if((int)$item->global === get_current_user_id() || gm_user_can('edit_others_media')) {
|
98 |
+
$action['edit'] = '<a title="' . __('Edit', 'grand-media') . '" href="' . add_query_arg(array("edit_item" => $item->term_id), $gmProcessor->url) . '">' . $edit_icon . '</a>';
|
99 |
+
|
100 |
+
if(gm_user_can('terms_delete')) {
|
101 |
+
$action['delete'] = '<a class="trash-icon" title="' . __('Delete', 'grand-media') . '" href="' . wp_nonce_url(add_query_arg(array('delete' => $item->term_id), $gmProcessor->url), 'gmedia_delete') . '" data-confirm="' . __("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media") . '">' . $trash_icon . '</a>';
|
102 |
}
|
103 |
+
}
|
104 |
+
}*/
|
105 |
|
106 |
|
107 |
return apply_filters('gmedia_term_item_actions', $actions);
|
109 |
|
110 |
|
111 |
function gmedia_term_item_more_data(&$item) {
|
112 |
+
global $gmDB;
|
113 |
|
114 |
$meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
|
115 |
$item->meta = $meta;
|
132 |
$item->comment_status = $post_item->comment_status;
|
133 |
}
|
134 |
}
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
|
142 |
include(dirname(__FILE__) . '/tpl/album-create-item.php');
|
143 |
}
|
144 |
|
145 |
+
function gmedia_terms_create_category_tpl() {
|
146 |
+
include(dirname(__FILE__) . '/tpl/category-create-item.php');
|
147 |
+
}
|
148 |
+
|
149 |
function gmedia_terms_create_tag_tpl() {
|
150 |
include(dirname(__FILE__) . '/tpl/tag-create-item.php');
|
151 |
}
|
187 |
include(dirname(__FILE__) . '/tpl/album-sort-gmedia.php');
|
188 |
}
|
189 |
|
190 |
+
add_action('gmedia_term_category_after_panel', 'gmedia_term_category_after_panel');
|
191 |
+
function gmedia_term_category_after_panel($term){
|
192 |
+
include(dirname(__FILE__) . '/tpl/category-preview-gmedia.php');
|
193 |
+
}
|
194 |
+
|
195 |
add_action('gmedia_term_filter_after_panel', 'gmedia_term_filter_after_panel');
|
196 |
function gmedia_term_filter_after_panel($term){
|
197 |
include(dirname(__FILE__) . '/tpl/filter-preview-query.php');
|
admin/pages/taxonomy/terms.php
CHANGED
@@ -80,912 +80,3 @@ $gmedia_terms_pager = $gmDB->query_pager();
|
|
80 |
<?php
|
81 |
|
82 |
include(GMEDIA_ABSPATH . 'admin/tpl/modal-share.php');
|
83 |
-
|
84 |
-
|
85 |
-
/**
|
86 |
-
* gmediaAlbumEdit()
|
87 |
-
*
|
88 |
-
* @return mixed content
|
89 |
-
*/
|
90 |
-
function gmediaAlbumEdit() {
|
91 |
-
global $gmDB, $gmCore, $gmProcessor, $gmGallery, $user_ID;
|
92 |
-
|
93 |
-
if(!$gmCore->caps['gmedia_album_manage']) {
|
94 |
-
die('-1');
|
95 |
-
}
|
96 |
-
|
97 |
-
$gmedia_url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
|
98 |
-
|
99 |
-
$gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
|
100 |
-
if(!is_array($gm_screen_options)) {
|
101 |
-
$gm_screen_options = array();
|
102 |
-
}
|
103 |
-
$gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
|
104 |
-
|
105 |
-
$taxonomy = $gmProcessor->taxonomy;
|
106 |
-
$term_id = $gmCore->_get('edit_item');
|
107 |
-
|
108 |
-
$term = $gmDB->get_term($term_id, $taxonomy);
|
109 |
-
|
110 |
-
if(!empty($term) && !is_wp_error($term)) {
|
111 |
-
|
112 |
-
$term_meta = $gmDB->get_metadata('gmedia_term', $term->term_id);
|
113 |
-
$term_meta = array_map('reset', $term_meta);
|
114 |
-
$term_meta = array_merge(array('_cover' => '', '_orderby' => 'ID', '_order' => 'DESC'), $term_meta);
|
115 |
-
$per_page = !empty($gm_screen_options['per_page_sort_gmedia'])? $gm_screen_options['per_page_sort_gmedia'] : 60;
|
116 |
-
$cur_page = $gmCore->_get('pager', 1);
|
117 |
-
$pager_html = '';
|
118 |
-
|
119 |
-
$termItems = array();
|
120 |
-
if($term->count) {
|
121 |
-
$args = array(
|
122 |
-
'album__in' => $term->term_id,
|
123 |
-
'orderby' => $term_meta['_orderby'],
|
124 |
-
'order' => $term_meta['_order'],
|
125 |
-
'per_page' => $per_page,
|
126 |
-
'page' => $cur_page
|
127 |
-
);
|
128 |
-
$termItems = $gmDB->get_gmedias($args);
|
129 |
-
|
130 |
-
$pager_html = $gmDB->query_pager();
|
131 |
-
}
|
132 |
-
|
133 |
-
?>
|
134 |
-
<div class="panel panel-default">
|
135 |
-
|
136 |
-
HEADER
|
137 |
-
|
138 |
-
EDIT FORM HERE
|
139 |
-
|
140 |
-
</div>
|
141 |
-
<div class="panel panel-default">
|
142 |
-
<div class="panel-heading clearfix">
|
143 |
-
<h4 style="margin:7px 0;" class="pull-left"><?php _e('Sort Album'); ?></h4>
|
144 |
-
|
145 |
-
<?php echo $pager_html; ?>
|
146 |
-
|
147 |
-
</div>
|
148 |
-
<form method="post" id="gmedia-sort-term" name="gmSortTerm" class="panel-body">
|
149 |
-
<div class="order-form" style="border-bottom:1px solid #ddd; margin-bottom:15px;">
|
150 |
-
<div class="row">
|
151 |
-
<div class="col-xs-3">
|
152 |
-
<div class="form-group">
|
153 |
-
<label><?php _e('Order gmedia', 'grand-media'); ?></label>
|
154 |
-
<select name="term[meta][_orderby]" id="gmedia_term_orderby" class="form-control input-sm">
|
155 |
-
<option value="custom"<?php selected($term_meta['_orderby'], 'custom'); ?>><?php _e('Custom Order', 'grand-media'); ?></option>
|
156 |
-
<option value="ID"<?php selected($term_meta['_orderby'], 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
|
157 |
-
<option value="title"<?php selected($term_meta['_orderby'], 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
|
158 |
-
<option value="gmuid"<?php selected($term_meta['_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
|
159 |
-
<option value="date"<?php selected($term_meta['_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
|
160 |
-
<option value="modified"<?php selected($term_meta['_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
|
161 |
-
<option value="rand"<?php selected($term_meta['_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
|
162 |
-
</select>
|
163 |
-
</div>
|
164 |
-
</div>
|
165 |
-
<div class="col-xs-3">
|
166 |
-
<div class="form-group">
|
167 |
-
<label><?php _e('Sort order', 'grand-media'); ?></label>
|
168 |
-
<select id="gmedia_term_order" name="term[meta][_order]" class="form-control input-sm">
|
169 |
-
<option value="DESC"<?php selected($term_meta['_order'], 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
|
170 |
-
<option value="ASC"<?php selected($term_meta['_order'], 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
|
171 |
-
</select>
|
172 |
-
</div>
|
173 |
-
</div>
|
174 |
-
<div class="col-xs-6">
|
175 |
-
<div class="form-group pull-left" style="margin-right:30px;">
|
176 |
-
<label style="visibility:hidden;">-</label>
|
177 |
-
|
178 |
-
<div class="checkbox"><label><input id="reset_order_option" type="checkbox" name="term[reset_custom_order]" value="1"> <?php _e('Reset custom order', 'grand-media'); ?> </label></div>
|
179 |
-
</div>
|
180 |
-
<div class="form-group pull-left">
|
181 |
-
<label style="visibility:hidden;">-</label>
|
182 |
-
<button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_term_sort_save"><?php _e('Update', 'grand-media'); ?></button>
|
183 |
-
</div>
|
184 |
-
<?php wp_nonce_field('GmediaTerms', 'term_save_wpnonce'); ?>
|
185 |
-
<input type="hidden" name="term[term_id]" value="<?php echo $term->term_id; ?>"/>
|
186 |
-
<input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
|
187 |
-
</div>
|
188 |
-
</div>
|
189 |
-
<p><?php _e('Use your mouse (drag&drop) for custom sorting of images or manually enter index number in top right field of each image.') ?></p>
|
190 |
-
</div>
|
191 |
-
<div class="termItems clearfix" id="termItems">
|
192 |
-
<?php if(!empty($termItems)) {
|
193 |
-
foreach($termItems as $item) {
|
194 |
-
?>
|
195 |
-
<div class="gm-img-thumbnail" data-gmid="<?php echo $item->ID; ?>"><?php
|
196 |
-
?><img src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt="<?php echo $item->ID; ?>" title="<?php echo esc_attr($item->title); ?>"/><?php
|
197 |
-
?><input type="text" name="term[gmedia_ids][<?php echo $item->ID; ?>]" value="<?php echo isset($item->gmedia_order)? $item->gmedia_order : '0'; ?>"/><?php
|
198 |
-
?><span class="label label-default">ID: <?php echo $item->ID; ?></span><?php
|
199 |
-
?>
|
200 |
-
<div class="gm-img-thumb-title"><?php echo esc_html($item->title); ?></div>
|
201 |
-
</div>
|
202 |
-
<?php
|
203 |
-
}
|
204 |
-
} ?>
|
205 |
-
|
206 |
-
</div>
|
207 |
-
</form>
|
208 |
-
<div class="panel-footer clearfix" style="margin-top:20px;"><?php echo $pager_html; ?>
|
209 |
-
<div class="well well-sm pull-left" style="margin:0;"><?php printf(__('Total items: %d'), $term->count); ?></div>
|
210 |
-
</div>
|
211 |
-
|
212 |
-
<script type="text/javascript">
|
213 |
-
jQuery(function($) {
|
214 |
-
var sortdiv = $('#termItems');
|
215 |
-
var items = $('.gm-img-thumbnail', sortdiv);
|
216 |
-
|
217 |
-
sortdiv.sortable({
|
218 |
-
items: '.gm-img-thumbnail',
|
219 |
-
handle: 'img',
|
220 |
-
placeholder: 'gm-img-thumbnail ui-highlight-placeholder',
|
221 |
-
forcePlaceholderSize: true,
|
222 |
-
//revert: true,
|
223 |
-
stop: function(event, ui) {
|
224 |
-
$('#gmedia_term_orderby').val('custom');
|
225 |
-
var cur_order, prev_order, next_order;
|
226 |
-
var self = ui.item,
|
227 |
-
prev_item = self.prev(),
|
228 |
-
next_item = self.next();
|
229 |
-
prev_order = prev_item.length? parseInt($('input', prev_item).val()) : 0;
|
230 |
-
var img_order_asc = ('ASC' == $('#gmedia_term_order').val());
|
231 |
-
if(img_order_asc) {
|
232 |
-
cur_order = prev_order + 1;
|
233 |
-
$('input', self).val(cur_order);
|
234 |
-
while(next_item.length) {
|
235 |
-
next_order = parseInt(next_item.find('input').val());
|
236 |
-
if(cur_order < next_order) {
|
237 |
-
break;
|
238 |
-
}
|
239 |
-
cur_order += 1;
|
240 |
-
next_item.find('input').val(cur_order);
|
241 |
-
next_item = next_item.next();
|
242 |
-
}
|
243 |
-
|
244 |
-
} else {
|
245 |
-
next_order = next_item.length? parseInt($('input', next_item).val()) : (prev_order? (prev_order - 1) : 0);
|
246 |
-
cur_order = next_order + 1;
|
247 |
-
$('input', self).val(cur_order);
|
248 |
-
while(prev_item.length) {
|
249 |
-
prev_order = parseInt(prev_item.find('input').val());
|
250 |
-
if(cur_order < prev_order) {
|
251 |
-
break;
|
252 |
-
}
|
253 |
-
cur_order += 1;
|
254 |
-
prev_item.find('input').val(cur_order);
|
255 |
-
prev_item = prev_item.prev();
|
256 |
-
}
|
257 |
-
}
|
258 |
-
}
|
259 |
-
});
|
260 |
-
|
261 |
-
$('input', items).on('change', function() {
|
262 |
-
$('#gmedia_term_orderby').val('custom');
|
263 |
-
sortdiv.css({height: sortdiv.height()});
|
264 |
-
var items = $('.gm-img-thumbnail', sortdiv);
|
265 |
-
|
266 |
-
var new_order = $.isNumeric($(this).val())? parseInt($(this).val()) : -1;
|
267 |
-
$(this).val(new_order).closest('.gm-img-thumbnail').css({zIndex: 1000});
|
268 |
-
|
269 |
-
var ipos = [];
|
270 |
-
items.each(function(i, el) {
|
271 |
-
var pos = $(el).position();
|
272 |
-
$.data(el, 'pos', pos);
|
273 |
-
ipos[i] = pos;
|
274 |
-
});
|
275 |
-
|
276 |
-
var img_order_asc = ('ASC' == $('#gmedia_term_order').val());
|
277 |
-
var order = img_order_asc? 'asc' : 'desc';
|
278 |
-
items.tsort('input', {
|
279 |
-
useVal: true,
|
280 |
-
order: order
|
281 |
-
}, 'span.label', {order: order}).each(function(i, el) {
|
282 |
-
var from = $.data(el, 'pos');
|
283 |
-
var to = ipos[i];
|
284 |
-
$(el).css({position: 'absolute', top: from.top, left: from.left}).animate({
|
285 |
-
top: to.top,
|
286 |
-
left: to.left
|
287 |
-
}, 500);
|
288 |
-
}).promise().done(function() {
|
289 |
-
items.removeAttr('style');
|
290 |
-
sortdiv.removeAttr('style');
|
291 |
-
});
|
292 |
-
|
293 |
-
$(this).val(((0 > new_order)? 0 : new_order));
|
294 |
-
});
|
295 |
-
});
|
296 |
-
</script>
|
297 |
-
|
298 |
-
</div>
|
299 |
-
|
300 |
-
|
301 |
-
<div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
|
302 |
-
<div class="modal-dialog">
|
303 |
-
<div class="modal-content">
|
304 |
-
<div class="modal-header">
|
305 |
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
306 |
-
<h4 class="modal-title"><?php _e('Add New Custom Field'); ?></h4>
|
307 |
-
</div>
|
308 |
-
<form class="modal-body" method="post" id="newCustomFieldForm">
|
309 |
-
<?php
|
310 |
-
echo $gmCore->meta_form($meta_type = 'gmedia_term');
|
311 |
-
wp_nonce_field('gmedia_custom_field', '_customfield_nonce');
|
312 |
-
?>
|
313 |
-
<input type="hidden" name="action" value="gmedia_term_add_custom_field"/>
|
314 |
-
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
315 |
-
</form>
|
316 |
-
<div class="modal-footer">
|
317 |
-
<button type="button" class="btn btn-primary customfieldsubmit"><?php _e('Add', 'grand-media'); ?></button>
|
318 |
-
<button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Close', 'grand-media'); ?></button>
|
319 |
-
</div>
|
320 |
-
</div>
|
321 |
-
</div>
|
322 |
-
</div>
|
323 |
-
<?php
|
324 |
-
} else {
|
325 |
-
|
326 |
-
}
|
327 |
-
}
|
328 |
-
|
329 |
-
/**
|
330 |
-
* gmediaFilterEdit()
|
331 |
-
*
|
332 |
-
* @return mixed content
|
333 |
-
*/
|
334 |
-
function gmediaFilterEdit() {
|
335 |
-
global $gmDB, $gmCore, $gmProcessor, $gmGallery, $user_ID;
|
336 |
-
|
337 |
-
if(!$gmCore->caps['gmedia_filter_manage']) {
|
338 |
-
die('-1');
|
339 |
-
}
|
340 |
-
|
341 |
-
$gmedia_url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
|
342 |
-
|
343 |
-
/*$gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
|
344 |
-
if(!is_array($gm_screen_options)){
|
345 |
-
$gm_screen_options = array();
|
346 |
-
}
|
347 |
-
$gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);*/
|
348 |
-
//$per_page = !empty($gm_screen_options['per_page_sort_gmedia'])? $gm_screen_options['per_page_sort_gmedia'] : 40;
|
349 |
-
$per_page = 40;
|
350 |
-
$cur_page = $gmCore->_get('pager', 1);
|
351 |
-
|
352 |
-
$taxonomy = $gmProcessor->taxonomy;
|
353 |
-
$term_id = (int)$gmCore->_get('edit_item');
|
354 |
-
|
355 |
-
$author_new = false;
|
356 |
-
if($gmCore->caps['gmedia_edit_others_media']) {
|
357 |
-
$author = (int)$gmCore->_get('author', $user_ID);
|
358 |
-
} else {
|
359 |
-
$author = $user_ID;
|
360 |
-
}
|
361 |
-
|
362 |
-
$pager_html = '';
|
363 |
-
$term = array(
|
364 |
-
'name' => '',
|
365 |
-
'description' => '',
|
366 |
-
'global' => $author
|
367 |
-
);
|
368 |
-
|
369 |
-
$filter_data = array(
|
370 |
-
'author__in' => array()
|
371 |
-
, 'author__not_in' => array()
|
372 |
-
, 'category__in' => array() // use category id. Same as 'cat', but does not accept negative values
|
373 |
-
, 'category__not_in' => array() // use category id. Exclude multiple categories
|
374 |
-
, 'album__in' => array() // use album id. Same as 'alb'
|
375 |
-
, 'album__not_in' => array() // use album id. Exclude multiple albums
|
376 |
-
, 'tag__and' => array() // use tag ids. Display posts that are tagged with all listed tags in array
|
377 |
-
, 'tag__in' => array() // use tag ids. To display posts from either tags listed in array. Same as 'tag'
|
378 |
-
, 'tag__not_in' => array() // use tag ids. Display posts that do not have any of the listed tag ids
|
379 |
-
, 'terms_relation' => '' // allows you to describe the boolean relationship between the taxonomy queries. Possible values are 'OR', 'AND'. Default 'AND'
|
380 |
-
, 'gmedia__in' => array() // use gmedia ids. Specify posts to retrieve
|
381 |
-
, 'gmedia__not_in' => array() // use gmedia ids. Specify post NOT to retrieve
|
382 |
-
, 'mime_type' => array() // mime types
|
383 |
-
|
384 |
-
, 'limit' => '' // (int) - set limit
|
385 |
-
, 'per_page' => '' // (int) - set limit
|
386 |
-
, 'order' => '' // Designates the ascending or descending order of the 'orderby' parameter. Defaults to 'DESC'
|
387 |
-
, 'orderby' => '' // Sort retrieved posts by parameter. Defaults to 'ID'
|
388 |
-
, 'year' => '' // (int) - 4 digit year
|
389 |
-
, 'monthnum' => '' // (int) - Month number (from 1 to 12)
|
390 |
-
, 'day' => '' // (int) - Day of the month (from 1 to 31)
|
391 |
-
|
392 |
-
, 'meta_query' => array(
|
393 |
-
array(
|
394 |
-
'key' => '',
|
395 |
-
'value' => '',
|
396 |
-
'compare' => '',
|
397 |
-
'type' => ''
|
398 |
-
)
|
399 |
-
)
|
400 |
-
, 's' => '' // (string) - search string or terms separated by comma
|
401 |
-
, 'exact' => false // Search exactly string if 'exact' parameter set to true
|
402 |
-
|
403 |
-
);
|
404 |
-
|
405 |
-
$filter_variable_data = $term_query = array(
|
406 |
-
'cache_results' => false,
|
407 |
-
'page' => $cur_page, // number of page. Show the posts that would normally show up just on page X.
|
408 |
-
'per_page' => $per_page // number of post to displace or pass over. Note: Setting offset parameter will ignore the 'page' parameter.
|
409 |
-
);
|
410 |
-
|
411 |
-
$filter_form_custom_data = array(
|
412 |
-
'gmedia_album' => array(),
|
413 |
-
'gmedia_category' => array(),
|
414 |
-
'gmedia_tag' => array(),
|
415 |
-
'gmedia_id' => array(),
|
416 |
-
'author_id' => array(),
|
417 |
-
'album__condition' => 'album__in',
|
418 |
-
'category__condition' => 'category__in',
|
419 |
-
'tag__condition' => 'tag__in',
|
420 |
-
'gmedia_id__condition' => 'gmedia__in',
|
421 |
-
'author_id__condition' => 'author__in'
|
422 |
-
);
|
423 |
-
/**
|
424 |
-
* @var $gmedia_album
|
425 |
-
* @var $gmedia_category
|
426 |
-
* @var $gmedia_tag
|
427 |
-
* @var $gmedia_id
|
428 |
-
* @var $author_id
|
429 |
-
* @var $album__condition
|
430 |
-
* @var $category__condition
|
431 |
-
* @var $tag__condition
|
432 |
-
* @var $gmedia_id__condition
|
433 |
-
* @var $author_id__condition
|
434 |
-
*/
|
435 |
-
extract($filter_form_custom_data);
|
436 |
-
|
437 |
-
$totalResult = 0;
|
438 |
-
$trueTotalResult = 0;
|
439 |
-
if($term_id) {
|
440 |
-
$term = $gmDB->get_term($term_id, $taxonomy, ARRAY_A);
|
441 |
-
if(!empty($term) && !is_wp_error($term)) {
|
442 |
-
|
443 |
-
$term_query = $gmDB->get_metadata('gmedia_term', $term['term_id'], '_query', true);
|
444 |
-
$filter_data = array_merge($filter_data, $term_query);
|
445 |
-
|
446 |
-
$term_query = array_merge($filter_variable_data, $term_query);
|
447 |
-
|
448 |
-
if(isset($_GET['author']) && ($term['global'] != $author)) {
|
449 |
-
$filter_data['_query']['gmedia_album'] = array();
|
450 |
-
$term['global'] = $author;
|
451 |
-
$author_new = true;
|
452 |
-
}
|
453 |
-
|
454 |
-
if(!empty($filter_data['album__not_in'])) {
|
455 |
-
$album__condition = 'album__not_in';
|
456 |
-
}
|
457 |
-
$gmedia_album = $filter_data[$album__condition];
|
458 |
-
|
459 |
-
if(!empty($filter_data['category__not_in'])) {
|
460 |
-
$category__condition = 'category__not_in';
|
461 |
-
}
|
462 |
-
$gmedia_category = $filter_data[$category__condition];
|
463 |
-
|
464 |
-
if(!empty($filter_data['tag__not_in'])) {
|
465 |
-
$tag__condition = 'tag__not_in';
|
466 |
-
} elseif(!empty($filter_data['tag__and'])) {
|
467 |
-
$tag__condition = 'tag__and';
|
468 |
-
}
|
469 |
-
$gmedia_tag = $filter_data[$tag__condition];
|
470 |
-
|
471 |
-
if(!empty($filter_data['gmedia__not_in'])) {
|
472 |
-
$gmedia_id__condition = 'gmedia__not_in';
|
473 |
-
}
|
474 |
-
$gmedia_id = $filter_data[$gmedia_id__condition];
|
475 |
-
|
476 |
-
if(!empty($filter_data['author__not_in'])) {
|
477 |
-
$author_id__condition = 'author__not_in';
|
478 |
-
}
|
479 |
-
$author_id = $filter_data[$author_id__condition];
|
480 |
-
|
481 |
-
$termItems = $gmDB->get_gmedias($term_query);
|
482 |
-
$totalResult = (int)$gmDB->totalResult;
|
483 |
-
if(!$totalResult && !empty($termItems)) {
|
484 |
-
$totalResult = count($termItems);
|
485 |
-
}
|
486 |
-
if(!empty($gmDB->trueTotalResult)) {
|
487 |
-
$trueTotalResult = $gmDB->trueTotalResult;
|
488 |
-
}
|
489 |
-
|
490 |
-
if(!empty($termItems)) {
|
491 |
-
$pager_html = $gmDB->query_pager();
|
492 |
-
}
|
493 |
-
} else {
|
494 |
-
$term_id = 0;
|
495 |
-
}
|
496 |
-
}
|
497 |
-
|
498 |
-
?>
|
499 |
-
<div class="panel panel-default">
|
500 |
-
<div class="panel-heading clearfix">
|
501 |
-
<div class="btn-toolbar pull-left">
|
502 |
-
<div class="btn-group" style="margin-right:20px;">
|
503 |
-
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
504 |
-
<?php _e('Return to') ?> <span class="caret"></span>
|
505 |
-
</button>
|
506 |
-
<ul class="dropdown-menu" role="menu">
|
507 |
-
<li><a href="<?php echo add_query_arg(array('taxonomy' => 'gmedia_album'), $gmedia_url); ?>"><?php _e('Albums', 'grand-media'); ?></a></li>
|
508 |
-
<li><a href="<?php echo add_query_arg(array('taxonomy' => 'gmedia_tag'), $gmedia_url); ?>"><?php _e('Tags', 'grand-media'); ?></a></li>
|
509 |
-
<li><a href="<?php echo add_query_arg(array('taxonomy' => 'gmedia_category'), $gmedia_url); ?>"><?php _e('Categories', 'grand-media'); ?></a></li>
|
510 |
-
<li class="divider"></li>
|
511 |
-
<li class="active"><a href="<?php echo add_query_arg(array('taxonomy' => 'gmedia_filter'), $gmedia_url); ?>"><?php _e('Custom Filters', 'grand-media'); ?></a></li>
|
512 |
-
</ul>
|
513 |
-
</div>
|
514 |
-
|
515 |
-
<?php if($term_id) { ?>
|
516 |
-
<div class="btn-group">
|
517 |
-
<a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
|
518 |
-
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
519 |
-
<span class="caret"></span>
|
520 |
-
<span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
|
521 |
-
</button>
|
522 |
-
<ul class="dropdown-menu" role="menu">
|
523 |
-
<li><a href="<?php echo add_query_arg(array(
|
524 |
-
'page' => 'GrandMedia',
|
525 |
-
'custom_filter' => $term['term_id']
|
526 |
-
), admin_url('admin.php')); ?>"><?php _e('Show Filter in Gmedia Library', 'grand-media'); ?></a>
|
527 |
-
</li>
|
528 |
-
</ul>
|
529 |
-
</div>
|
530 |
-
<?php } ?>
|
531 |
-
</div>
|
532 |
-
|
533 |
-
</div>
|
534 |
-
|
535 |
-
<form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body">
|
536 |
-
<h4 style="margin-top:0;">
|
537 |
-
<?php if($term_id) { ?>
|
538 |
-
<span class="pull-right"><?php echo __('ID', 'grand-media') . ": {$term['term_id']}"; ?></span>
|
539 |
-
<?php _e('Edit Filter'); ?>: <em><?php echo esc_html($term['name']); ?></em>
|
540 |
-
<?php } else {
|
541 |
-
_e('Create Filter');
|
542 |
-
} ?>
|
543 |
-
</h4>
|
544 |
-
|
545 |
-
<div class="row">
|
546 |
-
<div class="col-xs-6">
|
547 |
-
<div class="form-group">
|
548 |
-
<label><?php _e('Filter Name', 'grand-media'); ?></label>
|
549 |
-
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr($term['name']); ?>" placeholder="<?php _e('Filter Name', 'grand-media'); ?>" required/>
|
550 |
-
</div>
|
551 |
-
<div class="form-group pull-right">
|
552 |
-
<?php
|
553 |
-
wp_nonce_field('GmediaGallery');
|
554 |
-
wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
|
555 |
-
?>
|
556 |
-
<input type="hidden" name="term[taxonomy]" value="gmedia_filter"/>
|
557 |
-
<input type="hidden" name="term[term_id]" value="<?php echo $term_id; ?>"/>
|
558 |
-
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_filter_save"><?php _e('Save', 'grand-media'); ?></button>
|
559 |
-
</div>
|
560 |
-
<p><b><?php _e('Filter Author:', 'grand-media'); ?></b>
|
561 |
-
<?php if($gmCore->caps['gmedia_delete_others_media']) { ?>
|
562 |
-
<a href="#gallModal" data-modal="select_author" data-action="gmedia_get_modal" class="gmedia-modal" title="<?php _e('Click to choose author for gallery', 'grand-media'); ?>"><?php echo $term['global']? get_the_author_meta('display_name', $term['global']) : __('(no author / shared albums)'); ?></a>
|
563 |
-
<?php if($author_new) {
|
564 |
-
echo '<br /><span class="text-danger">' . __('Note: Author changed but not saved yet. You can see Albums list only of chosen author') . '</span>';
|
565 |
-
} ?>
|
566 |
-
<?php } else {
|
567 |
-
echo $term['global']? get_the_author_meta('display_name', $term['global']) : '—';
|
568 |
-
} ?>
|
569 |
-
<input type="hidden" name="term[global]" value="<?php echo $term['global']; ?>"/></p>
|
570 |
-
|
571 |
-
</div>
|
572 |
-
<div class="col-xs-6">
|
573 |
-
<div class="form-group">
|
574 |
-
<label><?php _e('Description', 'grand-media'); ?></label>
|
575 |
-
<textarea class="form-control input-sm" style="height:77px;" rows="2" name="term[description]"><?php echo $term['description']; ?></textarea>
|
576 |
-
</div>
|
577 |
-
</div>
|
578 |
-
</div>
|
579 |
-
<hr/>
|
580 |
-
<h4 style="margin-top:0;"><?php _e('Query Parameters'); ?></h4>
|
581 |
-
|
582 |
-
<?php if($gmCore->caps['gmedia_terms']) { ?>
|
583 |
-
<div class="form-group">
|
584 |
-
<?php
|
585 |
-
$term_type = 'gmedia_album';
|
586 |
-
$args = array();
|
587 |
-
if($term['global']) {
|
588 |
-
if(user_can($term['global'], 'gmedia_edit_others_media')) {
|
589 |
-
$args['global'] = '';
|
590 |
-
} else {
|
591 |
-
$args['global'] = array(0, $term['global']);
|
592 |
-
}
|
593 |
-
} else {
|
594 |
-
$args['global'] = 0;
|
595 |
-
}
|
596 |
-
$gm_terms = $gmDB->get_terms($term_type, $args);
|
597 |
-
|
598 |
-
$terms_items = '';
|
599 |
-
if(count($gm_terms)) {
|
600 |
-
foreach($gm_terms as $_term) {
|
601 |
-
$selected = (in_array($_term->term_id, $gmedia_album))? ' selected="selected"' : '';
|
602 |
-
$terms_items .= '<option value="' . $_term->term_id . '"' . $selected . '>' . esc_html($_term->name) . ('publish' == $_term->status? '' : " [{$_term->status}]") . ' (' . $_term->count . ')</option>' . "\n";
|
603 |
-
}
|
604 |
-
}
|
605 |
-
$setvalue = !empty($gmedia_album)? 'data-setvalue="' . implode(',', $gmedia_album) . '"' : '';
|
606 |
-
?>
|
607 |
-
<label><?php _e('Choose Albums', 'grand-media'); ?> </label>
|
608 |
-
|
609 |
-
<div class="row">
|
610 |
-
<div class="col-xs-8">
|
611 |
-
<select <?php echo $setvalue; ?> id="gmedia_album" name="filter_data[gmedia_album][]" class="gmedia-combobox form-control input-sm" multiple="multiple" placeholder="<?php echo esc_attr(__('Any Album...', 'grand-media')); ?>">
|
612 |
-
<option value=""<?php if(empty($gmedia_album)) {
|
613 |
-
echo ' selected="selected"';
|
614 |
-
} ?>><?php _e('Any Album...', 'grand-media'); ?></option>
|
615 |
-
<?php echo $terms_items; ?>
|
616 |
-
</select>
|
617 |
-
</div>
|
618 |
-
<div class="col-xs-4">
|
619 |
-
<select name="filter_data[album__condition]" class="form-control input-sm">
|
620 |
-
<option <?php selected($album__condition, 'album__in'); ?> value="album__in"><?php _e('get albums', 'grand-media'); ?></option>
|
621 |
-
<option <?php selected($album__condition, 'album__not_in'); ?> value="album__not_in"><?php _e('exclude albums', 'grand-media'); ?></option>
|
622 |
-
</select>
|
623 |
-
</div>
|
624 |
-
</div>
|
625 |
-
<p class="help-block"><?php _e('You can choose Albums from the same author as Gallery author or Albums without author', 'grand-media'); ?></p>
|
626 |
-
</div>
|
627 |
-
|
628 |
-
<div class="form-group">
|
629 |
-
<?php
|
630 |
-
$term_type = 'gmedia_category';
|
631 |
-
$gm_terms_all = $gmGallery->options['taxonomies'][$term_type];
|
632 |
-
$gm_terms = $gmDB->get_terms($term_type, array('fields' => 'names_count'));
|
633 |
-
|
634 |
-
$terms_items = '';
|
635 |
-
if(count($gm_terms)) {
|
636 |
-
foreach($gm_terms as $id => $_term) {
|
637 |
-
$selected = (in_array($id, $gmedia_category))? ' selected="selected"' : '';
|
638 |
-
$terms_items .= '<option value="' . $id . '"' . $selected . '>' . esc_html($gm_terms_all[$_term['name']]) . ' (' . $_term['count'] . ')</option>' . "\n";
|
639 |
-
}
|
640 |
-
}
|
641 |
-
$setvalue = !empty($gmedia_category)? 'data-setvalue="' . implode(',', $gmedia_category) . '"' : '';
|
642 |
-
?>
|
643 |
-
<label><?php _e('Choose Categories', 'grand-media'); ?></label>
|
644 |
-
|
645 |
-
<div class="row">
|
646 |
-
<div class="col-xs-8">
|
647 |
-
<select <?php echo $setvalue; ?> id="gmedia_category" name="filter_data[gmedia_category][]" class="gmedia-combobox form-control input-sm" multiple="multiple" placeholder="<?php echo esc_attr(__('Any Category...', 'grand-media')); ?>">
|
648 |
-
<option value=""<?php echo empty($gmedia_category)? ' selected="selected"' : ''; ?>><?php _e('Any Category...', 'grand-media'); ?></option>
|
649 |
-
<?php echo $terms_items; ?>
|
650 |
-
</select>
|
651 |
-
</div>
|
652 |
-
<div class="col-xs-4">
|
653 |
-
<select name="filter_data[category__condition]" class="form-control input-sm">
|
654 |
-
<option <?php selected($category__condition, 'category__in'); ?> value="category__in"><?php _e('get categories', 'grand-media'); ?></option>
|
655 |
-
<option <?php selected($category__condition, 'category__not_in'); ?> value="category__not_in"><?php _e('exclude categories', 'grand-media'); ?></option>
|
656 |
-
</select>
|
657 |
-
</div>
|
658 |
-
</div>
|
659 |
-
</div>
|
660 |
-
|
661 |
-
<div class="form-group">
|
662 |
-
<?php
|
663 |
-
$term_type = 'gmedia_tag';
|
664 |
-
$gm_terms = $gmDB->get_terms($term_type, array('fields' => 'names_count'));
|
665 |
-
|
666 |
-
$terms_items = '';
|
667 |
-
if(count($gm_terms)) {
|
668 |
-
foreach($gm_terms as $id => $_term) {
|
669 |
-
$selected = (in_array($id, $gmedia_tag))? ' selected="selected"' : '';
|
670 |
-
$terms_items .= '<option value="' . $id . '"' . $selected . '>' . esc_html($_term['name']) . ' (' . $_term['count'] . ')</option>' . "\n";
|
671 |
-
}
|
672 |
-
}
|
673 |
-
$setvalue = !empty($gmedia_tag)? 'data-setvalue="' . implode(',', $gmedia_tag) . '"' : '';
|
674 |
-
?>
|
675 |
-
<label><?php _e('Choose Tags', 'grand-media'); ?> </label>
|
676 |
-
|
677 |
-
<div class="row">
|
678 |
-
<div class="col-xs-8">
|
679 |
-
<select <?php echo $setvalue; ?> id="gmedia_tag" name="filter_data[gmedia_tag][]" class="gmedia-combobox form-control input-sm" multiple="multiple" placeholder="<?php echo esc_attr(__('Any Tag...', 'grand-media')); ?>">
|
680 |
-
<option value=""<?php echo empty($gmedia_tag)? ' selected="selected"' : ''; ?>><?php _e('Any Tag...', 'grand-media'); ?></option>
|
681 |
-
<?php echo $terms_items; ?>
|
682 |
-
</select>
|
683 |
-
</div>
|
684 |
-
<div class="col-xs-4">
|
685 |
-
<select name="filter_data[tag__condition]" class="form-control input-sm">
|
686 |
-
<option <?php selected($tag__condition, 'tag__in'); ?> value="tag__in"><?php _e('get items with either tags', 'grand-media'); ?></option>
|
687 |
-
<option <?php selected($tag__condition, 'tag__and'); ?> value="tag__and"><?php _e('get items that have all listed tags', 'grand-media'); ?></option>
|
688 |
-
<option <?php selected($tag__condition, 'tag__not_in'); ?> value="tag__not_in"><?php _e('exclude items that have any of the listed tags', 'grand-media'); ?></option>
|
689 |
-
</select>
|
690 |
-
</div>
|
691 |
-
</div>
|
692 |
-
</div>
|
693 |
-
|
694 |
-
<?php } ?>
|
695 |
-
<div class="form-group">
|
696 |
-
<label><?php _e('Terms Relation', 'grand-media'); ?> </label>
|
697 |
-
|
698 |
-
<div class="row">
|
699 |
-
<div class="col-xs-4">
|
700 |
-
<select name="gmedia_filter[terms_relation]" class="form-control input-sm">
|
701 |
-
<option <?php selected($filter_data['terms_relation'], ''); ?> value=""><?php _e('AND'); ?></option>
|
702 |
-
<option <?php selected($filter_data['terms_relation'], 'OR'); ?> value="OR"><?php _e('OR'); ?></option>
|
703 |
-
</select>
|
704 |
-
</div>
|
705 |
-
<div class="col-xs-8">
|
706 |
-
<p class="help-block"><?php _e('allows you to describe the relationship between the taxonomy queries', 'grand-media'); ?></p>
|
707 |
-
</div>
|
708 |
-
</div>
|
709 |
-
</div>
|
710 |
-
<div class="form-group">
|
711 |
-
<label><?php _e('Search', 'grand-media'); ?></label>
|
712 |
-
|
713 |
-
<div class="row">
|
714 |
-
<div class="col-xs-8">
|
715 |
-
<input type="text" class="form-control input-sm" placeholder="<?php _e('Search string or terms separated by comma', 'grand-media'); ?>" value="<?php echo $filter_data['s']; ?>" name="gmedia_filter[s]">
|
716 |
-
</div>
|
717 |
-
<div class="col-xs-4">
|
718 |
-
<div class="checkbox"><label><input type="checkbox" name="gmedia_filter[exact]" value="yes"<?php echo $filter_data['exact']? ' checked="checked"' : ''; ?> /> <?php _e('Search exactly string', 'grand-media'); ?></label></div>
|
719 |
-
</div>
|
720 |
-
</div>
|
721 |
-
</div>
|
722 |
-
<div class="form-group">
|
723 |
-
<div class="row">
|
724 |
-
<div class="col-xs-8">
|
725 |
-
<div class="pull-right"><a id="use_lib_selected" class="label label-primary" href="#libselected"><?php _e('Use selected in Library', 'grand-media'); ?></a></div>
|
726 |
-
<label><?php _e('Gmedia IDs <small class="text-muted">separated by comma</small>', 'grand-media'); ?> </label>
|
727 |
-
<?php $value = !empty($gmedia_id)? implode(',', wp_parse_id_list($gmedia_id)) : ''; ?>
|
728 |
-
<textarea id="gmedia__ids" name="filter_data[gmedia_id]" rows="1" class="form-control input-sm" style="resize:vertical;" placeholder="<?php echo esc_attr(__('Gmedia IDs...', 'grand-media')); ?>"><?php echo $value; ?></textarea>
|
729 |
-
</div>
|
730 |
-
<div class="col-xs-4">
|
731 |
-
<label> </label>
|
732 |
-
<select name="filter_data[gmedia_id__condition]" class="form-control input-sm">
|
733 |
-
<option <?php selected($gmedia_id__condition, 'gmedia__in'); ?> value="gmedia__in"><?php _e('get gmedia IDs', 'grand-media'); ?></option>
|
734 |
-
<option <?php selected($gmedia_id__condition, 'gmedia__not_in'); ?> value="gmedia__not_in"><?php _e('exclude gmedia IDs', 'grand-media'); ?></option>
|
735 |
-
</select>
|
736 |
-
</div>
|
737 |
-
</div>
|
738 |
-
<p class="help-block"><?php _e('You can select items you want to add here right in Gmedia Library and then return here and click button "Use selected in Library"', 'grand-media'); ?></p>
|
739 |
-
</div>
|
740 |
-
<div class="form-group">
|
741 |
-
<div class="row">
|
742 |
-
<div class="col-xs-4">
|
743 |
-
<label><?php _e('Mime Type', 'grand-media'); ?> </label>
|
744 |
-
<select name="gmedia_filter[mime_type][]" class="gmedia-combobox form-control input-sm" multiple="multiple" placeholder="<?php echo esc_attr(__('All types...', 'grand-media')); ?>">
|
745 |
-
<option value=""><?php _e('All types...', 'grand-media'); ?></option>
|
746 |
-
<option <?php echo in_array('image', $filter_data['mime_type'])? 'selected="selected"' : ''; ?> value="image"><?php _e('Image', 'grand-media'); ?></option>
|
747 |
-
<option <?php echo in_array('audio', $filter_data['mime_type'])? 'selected="selected"' : ''; ?> value="audio"><?php _e('Audio', 'grand-media'); ?></option>
|
748 |
-
<option <?php echo in_array('video', $filter_data['mime_type'])? 'selected="selected"' : ''; ?> value="video"><?php _e('Video', 'grand-media'); ?></option>
|
749 |
-
<option <?php echo in_array('text', $filter_data['mime_type'])? 'selected="selected"' : ''; ?> value="text"><?php _e('Text', 'grand-media'); ?></option>
|
750 |
-
<option <?php echo in_array('application', $filter_data['mime_type'])? 'selected="selected"' : ''; ?> value="application"><?php _e('Application', 'grand-media'); ?></option>
|
751 |
-
</select>
|
752 |
-
</div>
|
753 |
-
<div class="col-xs-4">
|
754 |
-
<label><?php _e('Authors', 'grand-media'); ?></label>
|
755 |
-
<?php if($gmCore->caps['gmedia_show_others_media']) {
|
756 |
-
$user_ids = $gmCore->get_editable_user_ids();
|
757 |
-
if(!in_array($user_ID, $user_ids)) {
|
758 |
-
array_push($user_ids, $user_ID);
|
759 |
-
}
|
760 |
-
$filter_users = get_users(array('include' => $user_ids));
|
761 |
-
$users = '';
|
762 |
-
if(count($filter_users)) {
|
763 |
-
foreach((array)$filter_users as $user) {
|
764 |
-
$user->ID = (int)$user->ID;
|
765 |
-
$_selected = in_array($user->ID, $author_id)? ' selected="selected"' : '';
|
766 |
-
$users .= "<option value='$user->ID'$_selected>" . esc_html($user->display_name) . "</option>";
|
767 |
-
}
|
768 |
-
}
|
769 |
-
$setvalue = !empty($author_id)? 'data-setvalue="' . implode(',', $author_id) . '"' : '';
|
770 |
-
?>
|
771 |
-
<select <?php echo $setvalue; ?> name="filter_data[author_id][]" class="gmedia-combobox form-control input-sm" multiple="multiple" placeholder="<?php echo esc_attr(__('All authors...', 'grand-media')); ?>">
|
772 |
-
<option value=""><?php _e('All authors...', 'grand-media'); ?></option>
|
773 |
-
<?php echo $users; ?>
|
774 |
-
</select>
|
775 |
-
<?php } else { ?>
|
776 |
-
<input type="text" readonly="readonly" name="filter_data[author_id][]" class="gmedia-combobox form-control input-sm" value="<?php the_author_meta('display_name', $user_ID); ?>"/>
|
777 |
-
<input type="hidden" name="filter_data[author_id__condition]" value="author__in"/>
|
778 |
-
<?php } ?>
|
779 |
-
</div>
|
780 |
-
<?php if($gmCore->caps['gmedia_show_others_media']) { ?>
|
781 |
-
<div class="col-xs-4">
|
782 |
-
<label> </label>
|
783 |
-
<select name="filter_data[author_id__condition]" class="form-control input-sm">
|
784 |
-
<option <?php selected($author_id__condition, 'author__in'); ?> value="author__in"><?php _e('get authors', 'grand-media'); ?></option>
|
785 |
-
<option <?php selected($author_id__condition, 'author__not_in'); ?> value="author__not_in"><?php _e('exclude authors', 'grand-media'); ?></option>
|
786 |
-
</select>
|
787 |
-
</div>
|
788 |
-
<?php } ?>
|
789 |
-
</div>
|
790 |
-
</div>
|
791 |
-
<div class="form-group">
|
792 |
-
<div class="row">
|
793 |
-
<div class="col-xs-4">
|
794 |
-
<label><?php _e('Year', 'grand-media'); ?></label>
|
795 |
-
<input type="text" class="form-control input-sm" placeholder="<?php _e('4 digit year e.g. 2011', 'grand-media'); ?>" value="<?php echo $filter_data['year']; ?>" name="gmedia_filter[year]">
|
796 |
-
</div>
|
797 |
-
<div class="col-xs-4">
|
798 |
-
<label><?php _e('Month', 'grand-media'); ?></label>
|
799 |
-
<input type="text" class="form-control input-sm" placeholder="<?php _e('from 1 to 12', 'grand-media'); ?>" value="<?php echo $filter_data['monthnum']; ?>" name="gmedia_filter[monthnum]">
|
800 |
-
</div>
|
801 |
-
<div class="col-xs-4">
|
802 |
-
<label><?php _e('Day', 'grand-media'); ?></label>
|
803 |
-
<input type="text" class="form-control input-sm" placeholder="<?php _e('from 1 to 31', 'grand-media'); ?>" value="<?php echo $filter_data['day']; ?>" name="gmedia_filter[day]">
|
804 |
-
</div>
|
805 |
-
</div>
|
806 |
-
</div>
|
807 |
-
<div class="form-group">
|
808 |
-
<?php foreach($filter_data['meta_query'] as $i => $q) {
|
809 |
-
if($i) {
|
810 |
-
continue;
|
811 |
-
}
|
812 |
-
?>
|
813 |
-
<div class="row">
|
814 |
-
<div class="col-xs-6 col-sm-3">
|
815 |
-
<label><?php _e('Custom Field Key', 'grand-media'); ?></label>
|
816 |
-
<input type="text" class="form-control input-sm" value="<?php echo $q['key']; ?>" name="gmedia_filter[meta_query][<?php echo $i; ?>][key]">
|
817 |
-
<span class="help-block"><?php _e('Display items with this field key', 'grand-media'); ?></span>
|
818 |
-
</div>
|
819 |
-
<div class="col-xs-6 col-sm-3">
|
820 |
-
<label><?php _e('Custom Field Value', 'grand-media'); ?></label>
|
821 |
-
<input type="text" class="form-control input-sm" value="<?php echo $q['value']; ?>" name="gmedia_filter[meta_query][<?php echo $i; ?>][value]">
|
822 |
-
<span class="help-block"><?php _e('Display items with this field value', 'grand-media'); ?></span>
|
823 |
-
</div>
|
824 |
-
<div class="col-xs-6 col-sm-3">
|
825 |
-
<label><?php _e('Compare Operator', 'grand-media'); ?></label>
|
826 |
-
<select class="form-control input-sm" name="gmedia_filter[meta_query][<?php echo $i; ?>][compare]">
|
827 |
-
<option value=""><?php _e('Choose..', 'grand-media'); ?></option>
|
828 |
-
<option <?php selected($q['compare'], '='); ?> value="=">= (<?php _e('Default', 'grand-media'); ?>)</option>
|
829 |
-
<option <?php selected($q['compare'], '!='); ?> value="!=">!=</option>
|
830 |
-
<option <?php selected($q['compare'], '>'); ?> value=">">></option>
|
831 |
-
<option <?php selected($q['compare'], '>='); ?> value=">=">>=</option>
|
832 |
-
<option <?php selected($q['compare'], '<'); ?> value="<"><</option>
|
833 |
-
<option <?php selected($q['compare'], '<='); ?> value="<="><=</option>
|
834 |
-
<option <?php selected($q['compare'], 'LIKE'); ?> value="LIKE">LIKE</option>
|
835 |
-
<option <?php selected($q['compare'], 'NOT LIKE'); ?> value="NOT LIKE">NOT LIKE</option>
|
836 |
-
<?php /* ?>
|
837 |
-
<option <?php selected($q['compare'], 'IN'); ?> value="IN">IN</option>
|
838 |
-
<option <?php selected($q['compare'], 'NOT IN'); ?> value="NOT IN">NOT IN</option>
|
839 |
-
<option <?php selected($q['compare'], 'BETWEEN'); ?> value="BETWEEN">BETWEEN</option>
|
840 |
-
<option <?php selected($q['compare'], 'NOT BETWEEN'); ?> value="NOT BETWEEN">NOT BETWEEN</option>
|
841 |
-
<?php */ ?>
|
842 |
-
<option <?php selected($q['compare'], 'EXISTS'); ?> value="EXISTS">EXISTS</option>
|
843 |
-
</select>
|
844 |
-
<span class="help-block"><?php _e('Operator to test the field value', 'grand-media'); ?></span>
|
845 |
-
</div>
|
846 |
-
<div class="col-xs-6 col-sm-3">
|
847 |
-
<label><?php _e('Meta Type', 'grand-media'); ?></label>
|
848 |
-
<select class="form-control input-sm" name="gmedia_filter[meta_query][<?php echo $i; ?>][type]">
|
849 |
-
<option value=""><?php _e('Choose..', 'grand-media'); ?></option>
|
850 |
-
<option <?php selected($q['type'], 'NUMERIC'); ?> value="NUMERIC">NUMERIC</option>
|
851 |
-
<option <?php selected($q['type'], 'BINARY'); ?> value="BINARY">BINARY</option>
|
852 |
-
<option <?php selected($q['type'], 'DATE'); ?> value="DATE">DATE</option>
|
853 |
-
<option <?php selected($q['type'], 'CHAR'); ?> value="CHAR">CHAR (<?php _e('Default', 'grand-media'); ?>)</option>
|
854 |
-
<option <?php selected($q['type'], 'DATETIME'); ?> value="DATETIME">DATETIME</option>
|
855 |
-
<option <?php selected($q['type'], 'DECIMAL'); ?> value="DECIMAL">DECIMAL</option>
|
856 |
-
<option <?php selected($q['type'], 'SIGNED'); ?> value="SIGNED">SIGNED</option>
|
857 |
-
<option <?php selected($q['type'], 'TIME'); ?> value="TIME">TIME</option>
|
858 |
-
<option <?php selected($q['type'], 'UNSIGNED'); ?> value="UNSIGNED">UNSIGNED</option>
|
859 |
-
</select>
|
860 |
-
<span class="help-block"><?php _e('Custom field type', 'grand-media'); ?></span>
|
861 |
-
</div>
|
862 |
-
</div>
|
863 |
-
<?php } ?>
|
864 |
-
</div>
|
865 |
-
<div class="form-group">
|
866 |
-
<div class="row">
|
867 |
-
<div class="col-xs-6 col-sm-3">
|
868 |
-
<label><?php _e('Order', 'grand-media'); ?></label>
|
869 |
-
<select class="form-control input-sm" name="gmedia_filter[order]">
|
870 |
-
<option value=""><?php _e('Choose..', 'grand-media'); ?></option>
|
871 |
-
<option <?php selected($filter_data['order'], 'ASC'); ?> value="ASC"><?php _e('ASC', 'grand-media'); ?></option>
|
872 |
-
<option <?php selected($filter_data['order'], 'DESC'); ?> value="DESC"><?php _e('DESC - Default', 'grand-media'); ?></option>
|
873 |
-
</select>
|
874 |
-
<span class="help-block"><?php _e('Ascending or Descending order', 'grand-media'); ?></span>
|
875 |
-
</div>
|
876 |
-
<div class="col-xs-6 col-sm-3">
|
877 |
-
<label><?php _e('Order by', 'grand-media'); ?></label>
|
878 |
-
<select class="form-control input-sm" name="gmedia_filter[orderby]">
|
879 |
-
<option value=""><?php _e('Choose..', 'grand-media'); ?></option>
|
880 |
-
<option <?php selected($filter_data['orderby'], 'none'); ?> value="none"><?php _e('None', 'grand-media'); ?></option>
|
881 |
-
<option <?php selected($filter_data['orderby'], 'rand'); ?> value="rand"><?php _e('Random', 'grand-media'); ?></option>
|
882 |
-
<option <?php selected($filter_data['orderby'], 'id'); ?> value="id"><?php _e('ID', 'grand-media'); ?></option>
|
883 |
-
<option <?php selected($filter_data['orderby'], 'title'); ?> value="title"><?php _e('Title', 'grand-media'); ?></option>
|
884 |
-
<option <?php selected($filter_data['orderby'], 'gmuid'); ?> value="gmuid"><?php _e('Filename', 'grand-media'); ?></option>
|
885 |
-
<option <?php selected($filter_data['orderby'], 'date'); ?> value="date"><?php _e('Date - Default', 'grand-media'); ?></option>
|
886 |
-
<option <?php selected($filter_data['orderby'], 'modified'); ?> value="modified"><?php _e('Modified Date', 'grand-media'); ?></option>
|
887 |
-
<option <?php selected($filter_data['orderby'], 'author'); ?> value="author"><?php _e('Author', 'grand-media'); ?></option>
|
888 |
-
<option <?php selected($filter_data['orderby'], 'gmedia__in'); ?> value="gmedia__in"><?php _e('Selected Order', 'grand-media'); ?></option>
|
889 |
-
<option <?php selected($filter_data['orderby'], 'meta_value'); ?> value="meta_value"><?php _e('Custom Field Value', 'grand-media'); ?></option>
|
890 |
-
<option <?php selected($filter_data['orderby'], 'meta_value_num'); ?> value="meta_value_num"><?php _e('Custom Field Value (Numeric)', 'grand-media'); ?></option>
|
891 |
-
</select>
|
892 |
-
<span class="help-block"><?php _e('Sort retrieved posts by', 'grand-media'); ?></span>
|
893 |
-
</div>
|
894 |
-
<div class="col-xs-6 col-sm-3">
|
895 |
-
<label><?php _e('Limit', 'grand-media'); ?></label>
|
896 |
-
<input type="text" class="form-control input-sm" value="<?php echo $filter_data['limit']; ?>" name="gmedia_filter[limit]" placeholder="<?php _e('leave empty for no limit', 'grand-media'); ?>">
|
897 |
-
<span class="help-block"><?php _e('Limit number of gmedia items', 'grand-media'); ?></span>
|
898 |
-
</div>
|
899 |
-
<div class="col-xs-6 col-sm-3 text-right">
|
900 |
-
<label style="display:block;"> </label>
|
901 |
-
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_filter_save"><?php _e('Save', 'grand-media'); ?></button>
|
902 |
-
</div>
|
903 |
-
</div>
|
904 |
-
</div>
|
905 |
-
</form>
|
906 |
-
<script type="text/javascript">
|
907 |
-
jQuery(function($) {
|
908 |
-
<?php if($gmCore->caps['gmedia_terms']){ ?>
|
909 |
-
$('.gmedia-combobox').each(function() {
|
910 |
-
var select = $(this).selectize({
|
911 |
-
create: false,
|
912 |
-
hideSelected: true,
|
913 |
-
allowEmptyOption: true
|
914 |
-
});
|
915 |
-
var val = $(this).data('setvalue');
|
916 |
-
if(val) {
|
917 |
-
val = val.toString().split(',');
|
918 |
-
select[0].selectize.setValue(val);
|
919 |
-
}
|
920 |
-
});
|
921 |
-
<?php } ?>
|
922 |
-
|
923 |
-
$('#use_lib_selected').on('click', function() {
|
924 |
-
var field = $('#gmedia__ids');
|
925 |
-
var valData = field.val().split(',');
|
926 |
-
var storedData = getStorage('gmuser_<?php echo $user_ID; ?>_');
|
927 |
-
storedData = storedData.get('library').split(',');
|
928 |
-
valData = $.grep(valData, function(e) {
|
929 |
-
return e;
|
930 |
-
});
|
931 |
-
$.each(storedData, function(i, id) {
|
932 |
-
if(!id) {
|
933 |
-
return true;
|
934 |
-
}
|
935 |
-
if($.inArray(id, valData) === -1) {
|
936 |
-
valData.push(id);
|
937 |
-
}
|
938 |
-
});
|
939 |
-
field.val(valData.join(', '));
|
940 |
-
});
|
941 |
-
});
|
942 |
-
|
943 |
-
</script>
|
944 |
-
</div>
|
945 |
-
|
946 |
-
<div class="panel panel-default" id="queryfilter">
|
947 |
-
<div class="panel-heading clearfix">
|
948 |
-
<h4 style="margin:7px 0;" class="pull-left"><?php _e('Query Filter'); ?></h4>
|
949 |
-
<?php echo $pager_html; ?>
|
950 |
-
</div>
|
951 |
-
<div class="panel-body">
|
952 |
-
<div class="termItems clearfix">
|
953 |
-
<?php if(!empty($termItems)) {
|
954 |
-
foreach($termItems as $item) {
|
955 |
-
$item_class = '';
|
956 |
-
?>
|
957 |
-
<div class="gm-img-thumbnail<?php echo $item_class; ?>" data-gmid="<?php echo $item->ID; ?>"><?php
|
958 |
-
?><img src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt="<?php echo $item->ID; ?>" title="<?php echo esc_attr($item->title); ?>"/><?php
|
959 |
-
?><span class="label label-default">ID: <?php echo $item->ID; ?></span><?php
|
960 |
-
?>
|
961 |
-
<div class="gm-img-thumb-title"><?php echo esc_html($item->title); ?></div>
|
962 |
-
</div>
|
963 |
-
<?php
|
964 |
-
}
|
965 |
-
} else {
|
966 |
-
if($term_id) { ?>
|
967 |
-
<p class="text-center"><?php _e('No items with selected parameters.') ?></p>
|
968 |
-
<?php } else { ?>
|
969 |
-
<p class="text-center"><?php _e('Set Filter parameters and click Save button to test query.') ?></p>
|
970 |
-
<?php }
|
971 |
-
} ?>
|
972 |
-
</div>
|
973 |
-
</div>
|
974 |
-
<div class="panel-footer clearfix" style="margin-top:20px;"><?php echo $pager_html; ?>
|
975 |
-
<?php if($trueTotalResult) { ?>
|
976 |
-
<div class="well well-sm pull-left" style="margin-right:10px;"><?php printf(__('Limited to: %d'), $totalResult); ?></div>
|
977 |
-
<div class="well well-sm pull-left" style="margin:0;"><?php printf(__('Total items: %d'), $trueTotalResult); ?></div>
|
978 |
-
<?php } else { ?>
|
979 |
-
<div class="well well-sm pull-left" style="margin:0;"><?php printf(__('Total items: %d'), $totalResult); ?></div>
|
980 |
-
<?php } ?>
|
981 |
-
</div>
|
982 |
-
</div>
|
983 |
-
|
984 |
-
<?php if($gmCore->caps['gmedia_edit_others_media']) { ?>
|
985 |
-
<div class="modal fade gmedia-modal" id="gallModal" tabindex="-1" role="dialog" aria-hidden="true">
|
986 |
-
<div class="modal-dialog"></div>
|
987 |
-
</div>
|
988 |
-
<?php } ?>
|
989 |
-
|
990 |
-
<?php
|
991 |
-
}
|
80 |
<?php
|
81 |
|
82 |
include(GMEDIA_ABSPATH . 'admin/tpl/modal-share.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/pages/taxonomy/tpl/category-create-item.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Add Album Form
|
4 |
+
*/
|
5 |
+
global $gmProcessor, $gmGallery;
|
6 |
+
$gmedia_url = $gmProcessor->url;
|
7 |
+
|
8 |
+
$_orderby = $gmGallery->options['in_category_orderby'];
|
9 |
+
$_order = $gmGallery->options['in_category_order'];
|
10 |
+
?>
|
11 |
+
<form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body" action="<?php echo $gmedia_url; ?>" style="padding-bottom:0; border-bottom:1px solid #ddd;">
|
12 |
+
<div class="row">
|
13 |
+
<div class="col-xs-6">
|
14 |
+
<div class="form-group">
|
15 |
+
<label><?php _e('Name', 'grand-media'); ?></label>
|
16 |
+
<input type="text" class="form-control input-sm" name="term[name]" placeholder="<?php _e('Category Name', 'grand-media'); ?>" required/>
|
17 |
+
</div>
|
18 |
+
<div class="form-group">
|
19 |
+
<label><?php _e('Description', 'grand-media'); ?></label>
|
20 |
+
<textarea class="form-control input-sm" style="height:49px;" rows="2" name="term[description]"></textarea>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
<div class="col-xs-6">
|
24 |
+
<div class="form-group row">
|
25 |
+
<div class="col-xs-6">
|
26 |
+
<label><?php _e('Order gmedia', 'grand-media'); ?></label>
|
27 |
+
<select name="term[meta][_orderby]" class="form-control input-sm">
|
28 |
+
<option value="ID"<?php selected($_orderby, 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
|
29 |
+
<option value="title"<?php selected($_orderby, 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
|
30 |
+
<option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
|
31 |
+
<option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
|
32 |
+
<option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
|
33 |
+
<option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
|
34 |
+
</select>
|
35 |
+
</div>
|
36 |
+
<div class="col-xs-6">
|
37 |
+
<label><?php _e('Sort order', 'grand-media'); ?></label>
|
38 |
+
<select name="term[meta][_order]" class="form-control input-sm">
|
39 |
+
<option value="DESC"<?php selected($_order, 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
|
40 |
+
<option value="ASC"<?php selected($_order, 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
|
41 |
+
</select>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
<div class="form-group">
|
45 |
+
<label> </label>
|
46 |
+
<?php
|
47 |
+
wp_original_referer_field(true, 'previous');
|
48 |
+
wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
|
49 |
+
?>
|
50 |
+
<input type="hidden" name="term[taxonomy]" value="gmedia_category"/>
|
51 |
+
<button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_category_save"><?php _e('Add New Category', 'grand-media'); ?></button>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
</form>
|
admin/pages/taxonomy/tpl/category-edit-item.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Edit Album Form
|
4 |
+
*/
|
5 |
+
|
6 |
+
$_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
|
7 |
+
$_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
|
8 |
+
?>
|
9 |
+
<form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body" data-id="<?php echo $term->term_id; ?>">
|
10 |
+
<h4 style="margin-top:0;">
|
11 |
+
<span class="pull-right"><?php echo __('ID', 'grand-media') . ": {$term->term_id}"; ?></span>
|
12 |
+
<?php _e('Edit Category'); ?>: <em><?php echo esc_html($term->name); ?></em>
|
13 |
+
</h4>
|
14 |
+
|
15 |
+
<div class="row">
|
16 |
+
<div class="col-xs-6">
|
17 |
+
<div class="form-group">
|
18 |
+
<label><?php _e('Name', 'grand-media'); ?></label>
|
19 |
+
<input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr($term->name); ?>" placeholder="<?php _e('Category Name', 'grand-media'); ?>" required/>
|
20 |
+
</div>
|
21 |
+
<div class="form-group">
|
22 |
+
<label><?php _e('Description', 'grand-media'); ?></label>
|
23 |
+
<textarea class="form-control input-sm" style="height:49px;" rows="2" name="term[description]"><?php echo $term->description; ?></textarea>
|
24 |
+
</div>
|
25 |
+
<div class="text-right">
|
26 |
+
<?php wp_nonce_field('GmediaTerms', 'term_save_wpnonce'); ?>
|
27 |
+
<input type="hidden" name="term[term_id]" value="<?php echo $term->term_id; ?>"/>
|
28 |
+
<input type="hidden" name="term[taxonomy]" value="<?php echo $term->taxonomy; ?>"/>
|
29 |
+
<button type="submit" class="btn btn-primary btn-sm" name="gmedia_category_save"><?php _e('Update', 'grand-media'); ?></button>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
<div class="col-xs-6">
|
33 |
+
<div class="row">
|
34 |
+
<div class="col-xs-6">
|
35 |
+
<div class="form-group">
|
36 |
+
<label><?php _e('Order gmedia', 'grand-media'); ?></label>
|
37 |
+
<select name="term[meta][_orderby]" class="form-control input-sm">
|
38 |
+
<option value="ID"<?php selected($_orderby, 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
|
39 |
+
<option value="title"<?php selected($_orderby, 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
|
40 |
+
<option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
|
41 |
+
<option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
|
42 |
+
<option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
|
43 |
+
<option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
|
44 |
+
</select>
|
45 |
+
</div>
|
46 |
+
<div class="form-group">
|
47 |
+
<label><?php _e('Sort order', 'grand-media'); ?></label>
|
48 |
+
<select name="term[meta][_order]" class="form-control input-sm">
|
49 |
+
<option value="DESC"<?php selected($_order, 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
|
50 |
+
<option value="ASC"<?php selected($_order, 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
|
51 |
+
</select>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
<div class="col-xs-6">
|
55 |
+
<?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
|
56 |
+
<div class="form-group">
|
57 |
+
<label><?php _e('Category Cover', 'grand-media'); ?></label>
|
58 |
+
<input type="text" class="form-control input-sm" name="term[meta][_cover]" value="<?php echo esc_attr($cover_id); ?>" placeholder="<?php _e('Gmedia Image ID', 'grand-media'); ?>"/>
|
59 |
+
</div>
|
60 |
+
<?php
|
61 |
+
if(($cover_id = intval($cover_id))) {
|
62 |
+
if(($cover = $gmDB->get_gmedia($cover_id))) { ?>
|
63 |
+
<div class="gm-img-thumbnail" data-gmid="<?php echo $cover->ID; ?>"><?php
|
64 |
+
?><img src="<?php echo $gmCore->gm_get_media_image($cover, 'thumb', true); ?>" alt="<?php echo $cover->ID; ?>" title="<?php echo esc_attr($cover->title); ?>"/><?php
|
65 |
+
?><span class="label label-default">ID: <?php echo $cover->ID; ?></span><?php
|
66 |
+
?></div>
|
67 |
+
<?php } else {
|
68 |
+
echo '<strong class="text-danger">' . __('No image with such ID', 'grand-media') . '</strong>';
|
69 |
+
}
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<hr/>
|
77 |
+
<?php
|
78 |
+
$gmCore->gmedia_custom_meta_box($term->term_id, $meta_type = 'gmedia_term');
|
79 |
+
do_action('gmedia_term_edit_form');
|
80 |
+
?>
|
81 |
+
</form>
|
82 |
+
|
83 |
+
<div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
|
84 |
+
<div class="modal-dialog">
|
85 |
+
<div class="modal-content">
|
86 |
+
<div class="modal-header">
|
87 |
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
88 |
+
<h4 class="modal-title"><?php _e('Add New Custom Field'); ?></h4>
|
89 |
+
</div>
|
90 |
+
<form class="modal-body" method="post" id="newCustomFieldForm">
|
91 |
+
<?php
|
92 |
+
echo $gmCore->meta_form($meta_type = 'gmedia_term');
|
93 |
+
wp_nonce_field('gmedia_custom_field', '_customfield_nonce');
|
94 |
+
?>
|
95 |
+
<input type="hidden" name="action" value="gmedia_term_add_custom_field"/>
|
96 |
+
<input type="hidden" class="newcustomfield-for-id" name="ID" value=""/>
|
97 |
+
</form>
|
98 |
+
<div class="modal-footer">
|
99 |
+
<button type="button" class="btn btn-primary customfieldsubmit"><?php _e('Add', 'grand-media'); ?></button>
|
100 |
+
<button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Close', 'grand-media'); ?></button>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
</div>
|
admin/pages/taxonomy/tpl/category-list-item.php
CHANGED
@@ -5,19 +5,30 @@
|
|
5 |
* @var $item
|
6 |
*/
|
7 |
?>
|
8 |
-
<div class="list-group-item term-list-item">
|
9 |
<div class="row cb_term-object">
|
10 |
<div class="term_id">#<?php echo $item->term_id; ?></div>
|
11 |
-
<div class="col-xs-6 term-label"
|
12 |
-
<
|
13 |
-
|
14 |
-
<?php
|
15 |
-
|
16 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
</div>
|
18 |
</div>
|
19 |
<div class="col-xs-6">
|
20 |
<?php gmedia_term_item_thumbnails($item); ?>
|
21 |
</div>
|
22 |
</div>
|
23 |
-
</div>
|
5 |
* @var $item
|
6 |
*/
|
7 |
?>
|
8 |
+
<div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
|
9 |
<div class="row cb_term-object">
|
10 |
<div class="term_id">#<?php echo $item->term_id; ?></div>
|
11 |
+
<div class="col-xs-6 term-label">
|
12 |
+
<div class="checkbox">
|
13 |
+
<input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
|
14 |
+
<?php if($item->allow_edit) { ?>
|
15 |
+
<a class="term_name" href="<?php echo add_query_arg(array('edit_item' => $item->term_id), $gmedia_url); ?>"><?php echo esc_html($item->name); ?></a>
|
16 |
+
<?php } else { ?>
|
17 |
+
<span class="term_name"><?php echo esc_html($item->name); ?></span>
|
18 |
+
<?php } ?>
|
19 |
+
|
20 |
+
<div class="object-actions">
|
21 |
+
<?php $action_links = gmedia_term_item_actions($item);
|
22 |
+
echo implode('', $action_links);
|
23 |
+
?>
|
24 |
+
</div>
|
25 |
+
<?php if(!empty($item->description)) { ?>
|
26 |
+
<div class="term-description"><?php echo esc_html(nl2br($item->description)); ?></div>
|
27 |
+
<?php } ?>
|
28 |
</div>
|
29 |
</div>
|
30 |
<div class="col-xs-6">
|
31 |
<?php gmedia_term_item_thumbnails($item); ?>
|
32 |
</div>
|
33 |
</div>
|
34 |
+
</div>
|
admin/pages/taxonomy/tpl/category-preview-gmedia.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Preview Gmedia in Category
|
4 |
+
*
|
5 |
+
* @var $term
|
6 |
+
*/
|
7 |
+
if(!$term->count) {
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
|
11 |
+
global $gmDB, $gmCore, $gmGallery;
|
12 |
+
|
13 |
+
$_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
|
14 |
+
$_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
|
15 |
+
$per_page = !empty($gmedia_user_options['per_page_sort_gmedia'])? $gmedia_user_options['per_page_sort_gmedia'] : 60;
|
16 |
+
$cur_page = $gmCore->_get('pager', 1);
|
17 |
+
|
18 |
+
$args = array(
|
19 |
+
'album__in' => $term->term_id,
|
20 |
+
'orderby' => $_orderby,
|
21 |
+
'order' => $_order,
|
22 |
+
'per_page' => $per_page,
|
23 |
+
'page' => $cur_page
|
24 |
+
);
|
25 |
+
|
26 |
+
$termItems = $gmDB->get_gmedias($args);
|
27 |
+
$pager_html = $gmDB->query_pager();
|
28 |
+
|
29 |
+
|
30 |
+
?>
|
31 |
+
<div class="panel panel-default">
|
32 |
+
<div class="panel-heading clearfix">
|
33 |
+
<h4 style="margin:7px 0;" class="pull-left"><?php _e('Category Preview'); ?></h4>
|
34 |
+
<?php echo $pager_html; ?></div>
|
35 |
+
<div class="panel-body">
|
36 |
+
<div class="termItems clearfix" id="termItems">
|
37 |
+
<?php if(!empty($termItems)) {
|
38 |
+
foreach($termItems as $item) {
|
39 |
+
?>
|
40 |
+
<div class="gm-img-thumbnail" data-gmid="<?php echo $item->ID; ?>"><?php
|
41 |
+
?><img src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt="<?php echo $item->ID; ?>" title="<?php echo esc_attr($item->title); ?>"/><?php
|
42 |
+
?><span class="label label-default">ID: <?php echo $item->ID; ?></span><?php
|
43 |
+
?>
|
44 |
+
<div class="gm-img-thumb-title"><?php echo esc_html($item->title); ?></div>
|
45 |
+
</div>
|
46 |
+
<?php
|
47 |
+
}
|
48 |
+
} ?>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
<div class="panel-footer clearfix" style="margin-top:20px;"><?php echo $pager_html; ?>
|
52 |
+
<div class="well well-sm pull-left" style="margin:0;"><?php printf(__('Total items: %d'), $term->count); ?></div>
|
53 |
+
</div>
|
54 |
+
</div>
|
admin/pages/taxonomy/tpl/filter-edit-item.php
CHANGED
@@ -99,14 +99,13 @@
|
|
99 |
<div class="form-group">
|
100 |
<?php
|
101 |
$term_type = 'gmedia_category';
|
102 |
-
$gm_terms_all = $gmGallery->options['taxonomies'][$term_type];
|
103 |
$gm_terms = $gmDB->get_terms($term_type, array('fields' => 'names_count'));
|
104 |
|
105 |
$terms_items = '';
|
106 |
if(count($gm_terms)) {
|
107 |
foreach($gm_terms as $id => $_term) {
|
108 |
$selected = (in_array($id, $gmedia_category))? ' selected="selected"' : '';
|
109 |
-
$terms_items .= '<option value="' . $id . '"' . $selected . '>' . esc_html($
|
110 |
}
|
111 |
}
|
112 |
$setvalue = !empty($gmedia_category)? 'data-setvalue="' . implode(',', $gmedia_category) . '"' : '';
|
99 |
<div class="form-group">
|
100 |
<?php
|
101 |
$term_type = 'gmedia_category';
|
|
|
102 |
$gm_terms = $gmDB->get_terms($term_type, array('fields' => 'names_count'));
|
103 |
|
104 |
$terms_items = '';
|
105 |
if(count($gm_terms)) {
|
106 |
foreach($gm_terms as $id => $_term) {
|
107 |
$selected = (in_array($id, $gmedia_category))? ' selected="selected"' : '';
|
108 |
+
$terms_items .= '<option value="' . $id . '"' . $selected . '>' . esc_html($_term['name']) . ' (' . $_term['count'] . ')</option>' . "\n";
|
109 |
}
|
110 |
}
|
111 |
$setvalue = !empty($gmedia_category)? 'data-setvalue="' . implode(',', $gmedia_category) . '"' : '';
|
admin/pages/taxonomy/tpl/terms-panel-heading.php
CHANGED
@@ -10,31 +10,26 @@
|
|
10 |
<div class="panel-heading-fake"></div>
|
11 |
<div class="panel-heading clearfix">
|
12 |
|
13 |
-
<?php
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
echo $gmedia_terms_pager;
|
18 |
-
|
19 |
-
} ?>
|
20 |
|
21 |
<div class="btn-toolbar pull-left">
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
<
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
<
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
</div>
|
37 |
-
<?php } ?>
|
38 |
|
39 |
<?php
|
40 |
switch($gmedia_term_taxonomy) {
|
@@ -70,7 +65,7 @@
|
|
70 |
<a class="btn btn-success pull-left" href="<?php echo add_query_arg(array('edit_item' => '0'), $gmedia_url); ?>"><?php _e('Create Filter', 'grand-media'); ?></a>
|
71 |
<?php } ?>
|
72 |
|
73 |
-
<?php if(
|
74 |
<div class="btn-group">
|
75 |
<a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
|
76 |
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
10 |
<div class="panel-heading-fake"></div>
|
11 |
<div class="panel-heading clearfix">
|
12 |
|
13 |
+
<?php
|
14 |
+
include(GMEDIA_ABSPATH . 'admin/tpl/search-form.php');
|
15 |
+
echo $gmedia_terms_pager;
|
16 |
+
?>
|
|
|
|
|
|
|
17 |
|
18 |
<div class="btn-toolbar pull-left">
|
19 |
+
<div class="btn-group gm-checkgroup" id="cb_global-btn">
|
20 |
+
<span class="btn btn-default active"><input class="doaction" id="cb_global"
|
21 |
+
data-group="cb_term-object" type="checkbox"/></span>
|
22 |
+
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
23 |
+
<span class="caret"></span>
|
24 |
+
<span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
|
25 |
+
</button>
|
26 |
+
<ul class="dropdown-menu" role="menu">
|
27 |
+
<li><a data-select="total" href="#"><?php _e('All', 'grand-media'); ?></a></li>
|
28 |
+
<li><a data-select="none" href="#"><?php _e('None', 'grand-media'); ?></a></li>
|
29 |
+
<li class="divider"></li>
|
30 |
+
<li><a data-select="reverse" href="#" title="<?php _e('Reverse only visible items', 'grand-media'); ?>"><?php _e('Reverse', 'grand-media'); ?></a></li>
|
31 |
+
</ul>
|
32 |
+
</div>
|
|
|
|
|
33 |
|
34 |
<?php
|
35 |
switch($gmedia_term_taxonomy) {
|
65 |
<a class="btn btn-success pull-left" href="<?php echo add_query_arg(array('edit_item' => '0'), $gmedia_url); ?>"><?php _e('Create Filter', 'grand-media'); ?></a>
|
66 |
<?php } ?>
|
67 |
|
68 |
+
<?php if(!empty($gmedia_terms)) { ?>
|
69 |
<div class="btn-group">
|
70 |
<a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
|
71 |
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
admin/processor/class.processor.library.php
CHANGED
@@ -141,9 +141,6 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
141 |
if(!empty($query_args['category__in'])) {
|
142 |
$category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__in']));
|
143 |
if(!empty($category_names)) {
|
144 |
-
foreach($category_names as $i => $name) {
|
145 |
-
$category_names[$i] = $gmGallery->options['taxonomies']['gmedia_category'][$name];
|
146 |
-
}
|
147 |
$this->filters['filter_categories'] = array(
|
148 |
'title' => __('Filter Category', 'grand-media'),
|
149 |
'filter' => $category_names
|
@@ -153,9 +150,6 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
153 |
if(!empty($query_args['category__not_in'])) {
|
154 |
$category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__not_in']));
|
155 |
if(!empty($category_names)) {
|
156 |
-
foreach($category_names as $i => $name) {
|
157 |
-
$category_names[$i] = $gmGallery->options['taxonomies']['gmedia_category'][$name];
|
158 |
-
}
|
159 |
$this->filters['exclude_categories'] = array(
|
160 |
'title' => __('Exclude Category', 'grand-media'),
|
161 |
'filter' => $category_names
|
@@ -301,48 +295,6 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
301 |
}
|
302 |
|
303 |
if(!empty($this->selected_items)) {
|
304 |
-
if(isset($_POST['assign_category'])) {
|
305 |
-
check_admin_referer('gmedia_modal');
|
306 |
-
if($gmCore->caps['gmedia_terms']) {
|
307 |
-
if(!$gmCore->caps['gmedia_edit_others_media']) {
|
308 |
-
$selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
|
309 |
-
if(count($selected_items) < count($this->selected_items)) {
|
310 |
-
$this->error[] = __('You are not allowed to edit others media', 'grand-media');
|
311 |
-
}
|
312 |
-
} else {
|
313 |
-
$selected_items = $this->selected_items;
|
314 |
-
}
|
315 |
-
$term = $gmCore->_post('cat');
|
316 |
-
if((false !== $term) && ($count = count($selected_items))) {
|
317 |
-
if('0' == $term) {
|
318 |
-
foreach($selected_items as $item) {
|
319 |
-
$gmDB->delete_gmedia_term_relationships($item, 'gmedia_category');
|
320 |
-
}
|
321 |
-
$this->msg[] = sprintf(__('%d item(s) was uncategorized', 'grand-media'), $count);
|
322 |
-
} else {
|
323 |
-
foreach($selected_items as $item) {
|
324 |
-
$result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = 0);
|
325 |
-
if(is_wp_error($result)) {
|
326 |
-
$this->error[] = $result;
|
327 |
-
$count--;
|
328 |
-
} elseif(!$result) {
|
329 |
-
$count--;
|
330 |
-
}
|
331 |
-
}
|
332 |
-
if(isset($gmGallery->options['taxonomies']['gmedia_category'][$term])) {
|
333 |
-
$cat_name = $gmGallery->options['taxonomies']['gmedia_category'][$term];
|
334 |
-
$this->msg[] = sprintf(__("Category `%s` assigned to %d image(s).", 'grand-media'), esc_html($cat_name), $count);
|
335 |
-
} else {
|
336 |
-
$this->error[] = sprintf(__("Category `%s` can't be assigned.", 'grand-media'), $term);
|
337 |
-
}
|
338 |
-
}
|
339 |
-
|
340 |
-
$this->selected_items = $this->clear_selected_items('library');
|
341 |
-
}
|
342 |
-
} else {
|
343 |
-
$this->error[] = __('You are not allowed to assign terms', 'grand-media');
|
344 |
-
}
|
345 |
-
}
|
346 |
if(isset($_POST['assign_album'])) {
|
347 |
check_admin_referer('gmedia_modal');
|
348 |
if($gmCore->caps['gmedia_terms']) {
|
@@ -401,6 +353,68 @@ class GmediaProcessor_Library extends GmediaProcessor {
|
|
401 |
$this->error[] = __('You are not allowed to assign terms', 'grand-media');
|
402 |
}
|
403 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
if(isset($_POST['add_tags'])) {
|
405 |
check_admin_referer('gmedia_modal');
|
406 |
if(!$gmCore->caps['gmedia_terms']) {
|
141 |
if(!empty($query_args['category__in'])) {
|
142 |
$category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__in']));
|
143 |
if(!empty($category_names)) {
|
|
|
|
|
|
|
144 |
$this->filters['filter_categories'] = array(
|
145 |
'title' => __('Filter Category', 'grand-media'),
|
146 |
'filter' => $category_names
|
150 |
if(!empty($query_args['category__not_in'])) {
|
151 |
$category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__not_in']));
|
152 |
if(!empty($category_names)) {
|
|
|
|
|
|
|
153 |
$this->filters['exclude_categories'] = array(
|
154 |
'title' => __('Exclude Category', 'grand-media'),
|
155 |
'filter' => $category_names
|
295 |
}
|
296 |
|
297 |
if(!empty($this->selected_items)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
if(isset($_POST['assign_album'])) {
|
299 |
check_admin_referer('gmedia_modal');
|
300 |
if($gmCore->caps['gmedia_terms']) {
|
353 |
$this->error[] = __('You are not allowed to assign terms', 'grand-media');
|
354 |
}
|
355 |
}
|
356 |
+
if(isset($_POST['assign_category'])) {
|
357 |
+
check_admin_referer('gmedia_modal');
|
358 |
+
if($gmCore->caps['gmedia_terms']) {
|
359 |
+
if(!$gmCore->caps['gmedia_edit_others_media']) {
|
360 |
+
$selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
|
361 |
+
if(count($selected_items) < count($this->selected_items)) {
|
362 |
+
$this->error[] = __('You are not allowed to edit others media', 'grand-media');
|
363 |
+
}
|
364 |
+
} else {
|
365 |
+
$selected_items = $this->selected_items;
|
366 |
+
}
|
367 |
+
$term = $gmCore->_post('cat_names');
|
368 |
+
$term = explode(',', $term);
|
369 |
+
if(!empty($term) && ($count = count($selected_items))) {
|
370 |
+
foreach($selected_items as $item) {
|
371 |
+
$result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = 1);
|
372 |
+
if(is_wp_error($result)) {
|
373 |
+
$this->error[] = $result;
|
374 |
+
$count--;
|
375 |
+
} elseif(!$result) {
|
376 |
+
$count--;
|
377 |
+
}
|
378 |
+
}
|
379 |
+
|
380 |
+
$this->msg[] = sprintf(__("Categories assigned to %d image(s).", 'grand-media'), $count);
|
381 |
+
|
382 |
+
$this->selected_items = $this->clear_selected_items('library');
|
383 |
+
}
|
384 |
+
} else {
|
385 |
+
$this->error[] = __('You are not allowed to assign terms', 'grand-media');
|
386 |
+
}
|
387 |
+
}
|
388 |
+
if(isset($_POST['unassign_category'])) {
|
389 |
+
check_admin_referer('gmedia_modal');
|
390 |
+
if(($term = $gmCore->_post('category_id')) && $gmCore->caps['gmedia_terms']) {
|
391 |
+
if(!$gmCore->caps['gmedia_edit_others_media']) {
|
392 |
+
$selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
|
393 |
+
if(count($selected_items) < count($this->selected_items)) {
|
394 |
+
$this->error[] = __('You are not allowed to edit others media', 'grand-media');
|
395 |
+
}
|
396 |
+
} else {
|
397 |
+
$selected_items = $this->selected_items;
|
398 |
+
}
|
399 |
+
$term = array_map('intval', $term);
|
400 |
+
if(($count = count($selected_items))) {
|
401 |
+
foreach($selected_items as $item) {
|
402 |
+
$result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = -1);
|
403 |
+
if(is_wp_error($result)) {
|
404 |
+
$this->error[] = $result;
|
405 |
+
$count--;
|
406 |
+
} elseif(!$result) {
|
407 |
+
$count--;
|
408 |
+
}
|
409 |
+
}
|
410 |
+
$this->msg[] = sprintf(__('%d category(ies) deleted from %d item(s)', 'grand-media'), count($term), $count);
|
411 |
+
|
412 |
+
$this->selected_items = $this->clear_selected_items('library');
|
413 |
+
}
|
414 |
+
} else {
|
415 |
+
$this->error[] = __('You are not allowed to assign terms', 'grand-media');
|
416 |
+
}
|
417 |
+
}
|
418 |
if(isset($_POST['add_tags'])) {
|
419 |
check_admin_referer('gmedia_modal');
|
420 |
if(!$gmCore->caps['gmedia_terms']) {
|
admin/processor/class.processor.settings.php
CHANGED
@@ -79,6 +79,9 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
79 |
if($roles[$capabilities['gmedia_terms']] < $roles[$capabilities['gmedia_album_manage']]) {
|
80 |
$capabilities['gmedia_album_manage'] = $capabilities['gmedia_terms'];
|
81 |
}
|
|
|
|
|
|
|
82 |
if($roles[$capabilities['gmedia_terms']] < $roles[$capabilities['gmedia_tag_manage']]) {
|
83 |
$capabilities['gmedia_tag_manage'] = $capabilities['gmedia_terms'];
|
84 |
}
|
@@ -163,7 +166,6 @@ class GmediaProcessor_Settings extends GmediaProcessor {
|
|
163 |
$gmGallery->options['license_key2'] = $_temp_options['license_key2'];
|
164 |
// don't reset mobile app
|
165 |
$gmGallery->options['site_email'] = $_temp_options['site_email'];
|
166 |
-
$gmGallery->options['site_category'] = $_temp_options['site_category'];
|
167 |
$gmGallery->options['site_ID'] = $_temp_options['site_ID'];
|
168 |
$gmGallery->options['mobile_app'] = $_temp_options['mobile_app'];
|
169 |
delete_metadata('user', 0, 'gm_screen_options', '', true);
|
79 |
if($roles[$capabilities['gmedia_terms']] < $roles[$capabilities['gmedia_album_manage']]) {
|
80 |
$capabilities['gmedia_album_manage'] = $capabilities['gmedia_terms'];
|
81 |
}
|
82 |
+
if($roles[$capabilities['gmedia_terms']] < $roles[$capabilities['gmedia_category_manage']]) {
|
83 |
+
$capabilities['gmedia_category_manage'] = $capabilities['gmedia_terms'];
|
84 |
+
}
|
85 |
if($roles[$capabilities['gmedia_terms']] < $roles[$capabilities['gmedia_tag_manage']]) {
|
86 |
$capabilities['gmedia_tag_manage'] = $capabilities['gmedia_terms'];
|
87 |
}
|
166 |
$gmGallery->options['license_key2'] = $_temp_options['license_key2'];
|
167 |
// don't reset mobile app
|
168 |
$gmGallery->options['site_email'] = $_temp_options['site_email'];
|
|
|
169 |
$gmGallery->options['site_ID'] = $_temp_options['site_ID'];
|
170 |
$gmGallery->options['mobile_app'] = $_temp_options['mobile_app'];
|
171 |
delete_metadata('user', 0, 'gm_screen_options', '', true);
|
admin/processor/class.processor.terms.php
CHANGED
@@ -90,6 +90,13 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
90 |
add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
|
91 |
}
|
92 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
case 'gmedia_tag':
|
94 |
if(gm_user_can('tag_manage')) {
|
95 |
add_action('gmedia_before_terms_list', 'gmedia_terms_create_tag_tpl');
|
@@ -329,6 +336,55 @@ class GmediaProcessor_Terms extends GmediaProcessor {
|
|
329 |
$this->msg[] = sprintf(__('Album `%s` successfuly saved', 'grand-media'), $_term->name);
|
330 |
}
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
} while(0);
|
333 |
} elseif(isset($_POST['gmedia_tag_add'])) {
|
334 |
if($gmCore->caps['gmedia_tag_manage']) {
|
90 |
add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
|
91 |
}
|
92 |
break;
|
93 |
+
case 'gmedia_category':
|
94 |
+
if(gm_user_can('category_manage')) {
|
95 |
+
add_action('gmedia_before_terms_list', 'gmedia_terms_create_category_tpl');
|
96 |
+
} else {
|
97 |
+
add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
|
98 |
+
}
|
99 |
+
break;
|
100 |
case 'gmedia_tag':
|
101 |
if(gm_user_can('tag_manage')) {
|
102 |
add_action('gmedia_before_terms_list', 'gmedia_terms_create_tag_tpl');
|
336 |
$this->msg[] = sprintf(__('Album `%s` successfuly saved', 'grand-media'), $_term->name);
|
337 |
}
|
338 |
|
339 |
+
} while(0);
|
340 |
+
} elseif(isset($_POST['gmedia_category_save'])) {
|
341 |
+
check_admin_referer('GmediaTerms', 'term_save_wpnonce');
|
342 |
+
$edit_term = (int)$gmCore->_get('edit_item');
|
343 |
+
do {
|
344 |
+
if(!$gmCore->caps['gmedia_category_manage']) {
|
345 |
+
$this->error[] = __('You are not allowed to manage categories', 'grand-media');
|
346 |
+
break;
|
347 |
+
}
|
348 |
+
$term = $gmCore->_post('term');
|
349 |
+
if(($meta = $gmCore->_post('meta'))) {
|
350 |
+
$term = array_merge_recursive(array('meta' => $meta), $term);
|
351 |
+
}
|
352 |
+
$term['name'] = trim($term['name']);
|
353 |
+
if(empty($term['name'])) {
|
354 |
+
$this->error[] = __('Term Name is not specified', 'grand-media');
|
355 |
+
break;
|
356 |
+
}
|
357 |
+
if($gmCore->is_digit($term['name'])) {
|
358 |
+
$this->error[] = __("Term Name can't be only digits", 'grand-media');
|
359 |
+
break;
|
360 |
+
}
|
361 |
+
$taxonomy = 'gmedia_category';
|
362 |
+
if($edit_term && !$gmDB->term_exists($edit_term, $taxonomy)) {
|
363 |
+
$this->error[] = __('A term with the id provided do not exists', 'grand-media');
|
364 |
+
$edit_term = false;
|
365 |
+
}
|
366 |
+
if(($term_id = $gmDB->term_exists($term['name'], $taxonomy))) {
|
367 |
+
if($term_id != $edit_term) {
|
368 |
+
$this->error[] = __('A term with the name provided already exists', 'grand-media');
|
369 |
+
break;
|
370 |
+
}
|
371 |
+
}
|
372 |
+
if($edit_term) {
|
373 |
+
if(!current_user_can('gmedia_edit_others_media')) {
|
374 |
+
$this->error[] = __('You are not allowed to edit others media', 'grand-media');
|
375 |
+
break;
|
376 |
+
}
|
377 |
+
$term_id = $gmDB->update_term($edit_term, $term['taxonomy'], $term);
|
378 |
+
} else {
|
379 |
+
$term_id = $gmDB->insert_term($term['name'], $term['taxonomy'], $term);
|
380 |
+
}
|
381 |
+
if(is_wp_error($term_id)) {
|
382 |
+
$this->error[] = $term_id->get_error_message();
|
383 |
+
break;
|
384 |
+
}
|
385 |
+
|
386 |
+
$this->msg[] = sprintf(__('Category `%s` successfuly saved', 'grand-media'), $term['name']);
|
387 |
+
|
388 |
} while(0);
|
389 |
} elseif(isset($_POST['gmedia_tag_add'])) {
|
390 |
if($gmCore->caps['gmedia_tag_manage']) {
|
app/access.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Application access
|
4 |
*/
|
5 |
|
6 |
-
$time = -
|
7 |
|
8 |
// don't load directly
|
9 |
if(!defined('ABSPATH')) {
|
@@ -90,6 +90,7 @@ if($globaldata) {
|
|
90 |
'gmedia_upload',
|
91 |
'gmedia_terms',
|
92 |
'gmedia_album_manage',
|
|
|
93 |
'gmedia_tag_manage',
|
94 |
'gmedia_terms_delete'
|
95 |
);
|
@@ -195,9 +196,9 @@ function gmedia_ios_app_library_data(
|
|
195 |
|
196 |
$ep = $gmGallery->options['endpoint'];
|
197 |
if(get_option('permalink_structure')) {
|
198 |
-
$
|
199 |
} else {
|
200 |
-
$
|
201 |
}
|
202 |
|
203 |
if(in_array('site', $data)) {
|
@@ -236,13 +237,17 @@ function gmedia_ios_app_library_data(
|
|
236 |
$out['filter'] = array_map('intval', $out['filter']);
|
237 |
}
|
238 |
if(in_array('gmedia_category', $data)) {
|
239 |
-
/*
|
240 |
if($user_ID){
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
} else{
|
243 |
$cap = 0;
|
244 |
}
|
245 |
-
*/
|
246 |
$default_args = array('fields' => 'name=>all');
|
247 |
if(isset($args['per_page'])) {
|
248 |
$args['number'] = $args['per_page'];
|
@@ -256,77 +261,19 @@ function gmedia_ios_app_library_data(
|
|
256 |
'items_count' => $gmDB->resultPerPage,
|
257 |
'total_count' => $gmDB->totalResult
|
258 |
);
|
259 |
-
$terms =
|
260 |
-
$gmGallery->options['taxonomies']['gmedia_category']);
|
261 |
$out['categories'] = array(
|
262 |
'list' => $terms,
|
263 |
-
'cap' =>
|
|
|
264 |
'data' => array()
|
265 |
);
|
266 |
if(!empty($gmediaTerms)) {
|
267 |
foreach($gmediaTerms as $i => $term) {
|
268 |
-
|
269 |
-
$gmediaTerms[$i]
|
270 |
-
|
271 |
-
$term_meta = $gmDB->get_metadata('gmedia_term', $term->term_id);
|
272 |
-
$term_meta = array_map('reset', $term_meta);
|
273 |
-
$term_meta = array_merge(array('_orderby' => $gmGallery->options['in_category_orderby'], '_order' => $gmGallery->options['in_category_order']), $term_meta);
|
274 |
-
$term_meta['orderby'] = $term_meta['_orderby'];
|
275 |
-
$term_meta['order'] = $term_meta['_order'];
|
276 |
-
|
277 |
-
if(empty($term_meta['_cover'])) {
|
278 |
-
$term_meta['_cover'] = false;
|
279 |
-
} else {
|
280 |
-
$term_meta['_cover'] = intval($term_meta['_cover']);
|
281 |
-
}
|
282 |
-
if($term_meta['_cover']) {
|
283 |
-
$cover_id = (int)$term_meta['_cover'];
|
284 |
-
$cover = gmedia_ios_app_processor('library', array('gmedia__in' => array($cover_id)), false);
|
285 |
-
if(isset($cover['data'][0])) {
|
286 |
-
$term_meta['_cover'] = $cover['data'][0];
|
287 |
-
$gmediaTerms[$i]->thumbnail = $gmCore->gm_get_media_image($cover_id, 'thumb', false);
|
288 |
-
} else {
|
289 |
-
$term_meta['_cover'] = false;
|
290 |
-
}
|
291 |
-
}
|
292 |
-
if(!$term_meta['_cover'] && $term->count) {
|
293 |
-
$gmargs = array(
|
294 |
-
'no_found_rows' => true,
|
295 |
-
'mime_type' => 'image/*',
|
296 |
-
'per_page' => 1,
|
297 |
-
'album__in' => array($term->term_id),
|
298 |
-
'status' => 'publish'
|
299 |
-
);
|
300 |
-
if($user_ID) {
|
301 |
-
$gmargs['status'] = array('publish', 'private');
|
302 |
-
if(user_can($user_ID, 'gmedia_edit_others_media')) {
|
303 |
-
$gmargs['status'] = '';
|
304 |
-
}
|
305 |
-
} else {
|
306 |
-
$gmargs['status'] = 'publish';
|
307 |
-
}
|
308 |
-
|
309 |
-
$termItems = $gmDB->get_gmedias($gmargs);
|
310 |
-
if(!empty($termItems)) {
|
311 |
-
$cover = gmedia_ios_app_processor('library', array('gmedia__in' => array($termItems[0]->ID)),
|
312 |
-
false);
|
313 |
-
if(isset($cover['data'][0])) {
|
314 |
-
$term_meta['_cover'] = $cover['data'][0];
|
315 |
-
}
|
316 |
-
$gmediaTerms[$i]->thumbnail = $gmCore->gm_get_media_image($termItems[0], 'thumb', false);
|
317 |
-
}
|
318 |
-
}
|
319 |
-
|
320 |
-
$gmediaTerms[$i]->meta = $term_meta;
|
321 |
-
|
322 |
-
$gmedia_hashid = gmedia_hash_id_encode($gmediaTerms[$i]->term_id, 'category');
|
323 |
-
$gmediaTerms[$i]->sharelink = str_replace(array('$1', '$2'), array(urlencode($gmedia_hashid), 'k'),
|
324 |
-
$share_link);
|
325 |
-
|
326 |
-
$gmediaTerms[$i]->cap = 0;
|
327 |
}
|
328 |
|
329 |
-
$out['categories']['properties'] = $props;
|
330 |
$out['categories']['data'] = array_values($gmediaTerms);
|
331 |
}
|
332 |
}
|
@@ -338,9 +285,9 @@ function gmedia_ios_app_library_data(
|
|
338 |
}
|
339 |
|
340 |
if($user_ID) {
|
341 |
-
if(current_user_can('
|
342 |
$cap = 4;
|
343 |
-
} elseif(current_user_can('
|
344 |
$cap = 2;
|
345 |
} else {
|
346 |
$cap = 0;
|
@@ -367,96 +314,7 @@ function gmedia_ios_app_library_data(
|
|
367 |
'total_count' => $gmDB->totalResult
|
368 |
);
|
369 |
foreach($gmediaTerms as $i => $term) {
|
370 |
-
$
|
371 |
-
if($author_id) {
|
372 |
-
if(($author_id != $user_ID) && ('draft' == $term->status) && !current_user_can('gmedia_edit_others_media')) {
|
373 |
-
unset($gmediaTerms[$i]);
|
374 |
-
continue;
|
375 |
-
}
|
376 |
-
$authordata = get_userdata($author_id);
|
377 |
-
if($authordata) {
|
378 |
-
$display_name = $authordata->display_name;
|
379 |
-
$first_name = $authordata->first_name;
|
380 |
-
$last_name = $authordata->last_name;
|
381 |
-
} else {
|
382 |
-
$display_name = __('Deleted User', 'grand-media');
|
383 |
-
$first_name = '';
|
384 |
-
$last_name = '';
|
385 |
-
}
|
386 |
-
} else {
|
387 |
-
$display_name = __('Shared', 'grand-media');
|
388 |
-
$first_name = $last_name = '';
|
389 |
-
}
|
390 |
-
$gmediaTerms[$i]->user = array(
|
391 |
-
'id' => $author_id,
|
392 |
-
'displayname' => $display_name,
|
393 |
-
'firstname' => $first_name,
|
394 |
-
'lastname' => $last_name
|
395 |
-
);
|
396 |
-
|
397 |
-
$term_meta = $gmDB->get_metadata('gmedia_term', $term->term_id);
|
398 |
-
$term_meta = array_map('reset', $term_meta);
|
399 |
-
$term_meta = array_merge(array('_orderby' => 'ID', '_order' => 'DESC'), $term_meta);
|
400 |
-
$term_meta['orderby'] = $term_meta['_orderby'];
|
401 |
-
$term_meta['order'] = $term_meta['_order'];
|
402 |
-
|
403 |
-
if(empty($term_meta['_cover'])) {
|
404 |
-
$term_meta['_cover'] = false;
|
405 |
-
} else {
|
406 |
-
$term_meta['_cover'] = intval($term_meta['_cover']);
|
407 |
-
}
|
408 |
-
if($term_meta['_cover']) {
|
409 |
-
$cover_id = (int)$term_meta['_cover'];
|
410 |
-
$cover = gmedia_ios_app_processor('library', array('gmedia__in' => array($cover_id)), false);
|
411 |
-
if(isset($cover['data'][0])) {
|
412 |
-
$term_meta['_cover'] = $cover['data'][0];
|
413 |
-
$gmediaTerms[$i]->thumbnail = $gmCore->gm_get_media_image($cover_id, 'thumb', false);
|
414 |
-
} else {
|
415 |
-
$term_meta['_cover'] = false;
|
416 |
-
}
|
417 |
-
}
|
418 |
-
if(!$term_meta['_cover'] && $term->count) {
|
419 |
-
$gmargs = array(
|
420 |
-
'no_found_rows' => true,
|
421 |
-
'mime_type' => 'image/*',
|
422 |
-
'per_page' => 1,
|
423 |
-
'album__in' => array($term->term_id),
|
424 |
-
'status' => 'publish'
|
425 |
-
);
|
426 |
-
if($user_ID) {
|
427 |
-
$gmargs['status'] = array('publish', 'private');
|
428 |
-
if($author_id === $user_ID) {
|
429 |
-
$gmargs['status'] = '';
|
430 |
-
}
|
431 |
-
} else {
|
432 |
-
$gmargs['status'] = 'publish';
|
433 |
-
}
|
434 |
-
|
435 |
-
$termItems = $gmDB->get_gmedias($gmargs);
|
436 |
-
if(!empty($termItems)) {
|
437 |
-
$cover = gmedia_ios_app_processor('library', array('gmedia__in' => array($termItems[0]->ID)),
|
438 |
-
false);
|
439 |
-
if(isset($cover['data'][0])) {
|
440 |
-
$term_meta['_cover'] = $cover['data'][0];
|
441 |
-
}
|
442 |
-
$gmediaTerms[$i]->thumbnail = $gmCore->gm_get_media_image($termItems[0], 'thumb', false);
|
443 |
-
}
|
444 |
-
}
|
445 |
-
|
446 |
-
$gmediaTerms[$i]->meta = $term_meta;
|
447 |
-
|
448 |
-
$gmedia_hashid = gmedia_hash_id_encode($term->term_id, 'album');
|
449 |
-
$gmediaTerms[$i]->sharelink = str_replace(array('$1', '$2'), array(urlencode($gmedia_hashid), 'a'),
|
450 |
-
$share_link);
|
451 |
-
|
452 |
-
$gmediaTerms[$i]->cap = (4 == $cap)? 4 : 0;
|
453 |
-
|
454 |
-
if(1 === $logic) {
|
455 |
-
if('publish' == $gmediaTerms[$i]->status) {
|
456 |
-
$gmediaTerms[$i]->status = 'public';
|
457 |
-
}
|
458 |
-
}
|
459 |
-
|
460 |
}
|
461 |
$out['albums'] = array(
|
462 |
'cap' => $cap,
|
@@ -467,8 +325,13 @@ function gmedia_ios_app_library_data(
|
|
467 |
if(in_array('gmedia_tag', $data)) {
|
468 |
$default_args = array();
|
469 |
if($user_ID) {
|
470 |
-
|
471 |
-
|
|
|
|
|
|
|
|
|
|
|
472 |
} else {
|
473 |
$cap = 0;
|
474 |
}
|
@@ -485,15 +348,7 @@ function gmedia_ios_app_library_data(
|
|
485 |
'total_count' => $gmDB->totalResult
|
486 |
);
|
487 |
foreach($gmediaTerms as $i => $term) {
|
488 |
-
|
489 |
-
|
490 |
-
$gmediaTerms[$i]->meta = array('_orderby' => $gmGallery->options['in_tag_orderby'], '_order' => $gmGallery->options['in_tag_order']);
|
491 |
-
|
492 |
-
$gmedia_hashid = gmedia_hash_id_encode($term->term_id, 'tag');
|
493 |
-
$gmediaTerms[$i]->sharelink = str_replace(array('$1', '$2'), array(urlencode($gmedia_hashid), 't'),
|
494 |
-
$share_link);
|
495 |
-
|
496 |
-
$gmediaTerms[$i]->cap = (4 == $cap)? 4 : 0;
|
497 |
}
|
498 |
$out['tags'] = array(
|
499 |
'cap' => $cap,
|
@@ -505,6 +360,136 @@ function gmedia_ios_app_library_data(
|
|
505 |
return $out;
|
506 |
}
|
507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
/**
|
509 |
* @param $action
|
510 |
* @param $data
|
@@ -565,16 +550,21 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
565 |
if(!current_user_can('gmedia_terms')) {
|
566 |
unset($gmedia['categories'], $gmedia['albums'], $gmedia['tags']);
|
567 |
} else {
|
568 |
-
if(!empty($gmedia['categories'])) {
|
569 |
-
$cat = $gmedia['categories'][0]->name;
|
570 |
-
$gmedia['terms']['gmedia_category'] = $cat;
|
571 |
-
}
|
572 |
if(empty($gmedia['albums'])) {
|
573 |
$gmedia['terms']['gmedia_album'] = '';
|
574 |
} else {
|
575 |
$alb = isset($gmedia['albums'][0]->term_id)? $gmedia['albums'][0]->term_id : $gmedia['albums'][0]->name;
|
576 |
$gmedia['terms']['gmedia_album'] = $alb;
|
577 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
if(empty($gmedia['tags'])) {
|
579 |
$gmedia['terms']['gmedia_tag'] = '';
|
580 |
} else {
|
@@ -616,10 +606,6 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
616 |
if(!current_user_can('gmedia_terms')) {
|
617 |
unset($gmedia['categories'], $gmedia['albums'], $gmedia['tags']);
|
618 |
} else {
|
619 |
-
if(!empty($gmedia['categories'])) {
|
620 |
-
$cat = $gmedia['categories'][0]->name;
|
621 |
-
$gmedia['terms']['gmedia_category'] = $cat;
|
622 |
-
}
|
623 |
if(empty($gmedia['albums'])) {
|
624 |
$gmedia['terms']['gmedia_album'] = '';
|
625 |
} else {
|
@@ -629,6 +615,19 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
629 |
$gmedia['terms']['gmedia_album'] = $gmedia['albums'][0]->name;
|
630 |
}
|
631 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
if(empty($gmedia['tags'])) {
|
633 |
$gmedia['terms']['gmedia_tag'] = '';
|
634 |
} else {
|
@@ -669,24 +668,20 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
669 |
}
|
670 |
break;
|
671 |
|
672 |
-
case '
|
673 |
if(!current_user_can('gmedia_terms')) {
|
674 |
-
$error[] = __('You are not allowed to manage
|
675 |
-
break;
|
676 |
-
}
|
677 |
-
$term = $data['assign_category'][0];
|
678 |
-
if(false === $term) {
|
679 |
-
break;
|
680 |
}
|
|
|
681 |
$count = count($data['selected']);
|
682 |
if('0' == $term) {
|
683 |
foreach($data['selected'] as $item) {
|
684 |
-
$gmDB->delete_gmedia_term_relationships($item, '
|
685 |
}
|
686 |
-
$alert[] = sprintf(__('%d
|
687 |
} else {
|
688 |
foreach($data['selected'] as $item) {
|
689 |
-
$result = $gmDB->set_gmedia_terms($item, $term, '
|
690 |
if(is_wp_error($result)) {
|
691 |
$error[] = $result->get_error_message();
|
692 |
$count--;
|
@@ -694,30 +689,35 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
694 |
$count--;
|
695 |
}
|
696 |
}
|
697 |
-
if(
|
698 |
-
$
|
699 |
-
$alert[] = sprintf(__("Category `%s` assigned to %d images.", 'grand-media'),
|
700 |
-
esc_html($cat_name), $count);
|
701 |
} else {
|
702 |
-
$
|
703 |
}
|
|
|
|
|
704 |
}
|
705 |
break;
|
706 |
|
707 |
-
case '
|
708 |
if(!current_user_can('gmedia_terms')) {
|
709 |
-
$error[] = __('You are not allowed to manage
|
|
|
710 |
}
|
711 |
-
$
|
|
|
|
|
|
|
|
|
712 |
$count = count($data['selected']);
|
713 |
-
if('0' == $
|
714 |
foreach($data['selected'] as $item) {
|
715 |
-
$gmDB->delete_gmedia_term_relationships($item, '
|
716 |
}
|
717 |
-
$alert[] = sprintf(__('%d
|
718 |
} else {
|
719 |
foreach($data['selected'] as $item) {
|
720 |
-
$result = $gmDB->set_gmedia_terms($item, $
|
721 |
if(is_wp_error($result)) {
|
722 |
$error[] = $result->get_error_message();
|
723 |
$count--;
|
@@ -725,14 +725,31 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
725 |
$count--;
|
726 |
}
|
727 |
}
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
}
|
733 |
-
$alert[] = sprintf(__('Album `%s` assigned to %d items', 'grand-media'), esc_html($alb_name),
|
734 |
-
$count);
|
735 |
}
|
|
|
736 |
break;
|
737 |
|
738 |
case 'add_tags':
|
@@ -744,10 +761,10 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
744 |
$error[] = __('No tags provided', 'grand-media');
|
745 |
break;
|
746 |
}
|
747 |
-
$
|
748 |
$count = count($data['selected']);
|
749 |
foreach($data['selected'] as $item) {
|
750 |
-
$result = $gmDB->set_gmedia_terms($item, $
|
751 |
if(is_wp_error($result)) {
|
752 |
$error[] = $result->get_error_message();
|
753 |
$count--;
|
@@ -755,7 +772,7 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
755 |
$count--;
|
756 |
}
|
757 |
}
|
758 |
-
$alert[] = sprintf(__('%d
|
759 |
break;
|
760 |
|
761 |
case 'delete_tags':
|
@@ -767,10 +784,10 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
767 |
$error[] = __('No tags provided', 'grand-media');
|
768 |
break;
|
769 |
}
|
770 |
-
$
|
771 |
$count = count($data['selected']);
|
772 |
foreach($data['selected'] as $item) {
|
773 |
-
$result = $gmDB->set_gmedia_terms($item, $
|
774 |
if(is_wp_error($result)) {
|
775 |
$error[] = $result->get_error_message();
|
776 |
$count--;
|
@@ -778,7 +795,7 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
778 |
$count--;
|
779 |
}
|
780 |
}
|
781 |
-
$alert[] = sprintf(__('%d
|
782 |
break;
|
783 |
|
784 |
case 'delete':
|
@@ -812,9 +829,9 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
812 |
case 'library':
|
813 |
$ep = $gmGallery->options['endpoint'];
|
814 |
if(get_option('permalink_structure')) {
|
815 |
-
$
|
816 |
} else {
|
817 |
-
$
|
818 |
}
|
819 |
$filter = $filter? gmedia_ios_app_library_data(array('filter')) : array();
|
820 |
|
@@ -839,13 +856,46 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
839 |
'data' => array()
|
840 |
));
|
841 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
842 |
$is_admin = isset($data['admin'])? intval($data['admin']) : 0;
|
843 |
if(!is_user_logged_in()) {
|
844 |
-
$logged_in
|
845 |
$data['status'] = array('publish');
|
846 |
-
if(!empty($
|
847 |
-
$
|
848 |
-
|
|
|
|
|
|
|
|
|
|
|
849 |
$out = $false_out;
|
850 |
break;
|
851 |
}
|
@@ -861,12 +911,12 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
861 |
}
|
862 |
}
|
863 |
|
864 |
-
$_data
|
865 |
$_data['per_page'] = -1;
|
866 |
-
$_data['status']
|
867 |
-
$_data['fields']
|
868 |
-
$all_gmedias_ids
|
869 |
-
$gmedias
|
870 |
foreach($gmedias as $i => $item) {
|
871 |
|
872 |
//if((!$logged_in && 'publish' != $item->status) || (!$is_admin && ('draft' == $item->status) && ((int)$user_ID != (int)$item->author))) {
|
@@ -930,7 +980,7 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
930 |
if($terms) {
|
931 |
$terms = array_values((array)$terms);
|
932 |
foreach($terms as $term) {
|
933 |
-
$categories[] = array('term_id' => $term->term_id, 'name' => $term->name);
|
934 |
}
|
935 |
}
|
936 |
$gmedias[$i]->categories = $categories;
|
@@ -975,20 +1025,20 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
975 |
|
976 |
$item_name = $item->title? $item->title : pathinfo($item->gmuid, PATHINFO_FILENAME);
|
977 |
$gmedia_hashid = gmedia_hash_id_encode($item->ID, 'single');
|
978 |
-
$gmedias[$i]->sharelink = str_replace(array('$1', '$2'), array(urlencode($gmedia_hashid), 's'), $
|
979 |
if(1 === $logic && 'publish' == $item->status) {
|
980 |
$gmedias[$i]->status = 'public';
|
981 |
}
|
982 |
}
|
983 |
$out = array_merge($filter, array(
|
984 |
-
'properties' => array(
|
985 |
'request' => isset($data['request'])? $data['request'] : null,
|
986 |
'total_pages' => $gmDB->pages,
|
987 |
'current_page' => $gmDB->openPage,
|
988 |
'items_count' => $gmDB->resultPerPage,
|
989 |
'total_count' => $gmDB->totalResult,
|
990 |
-
'count'
|
991 |
-
),
|
992 |
'data' => array_values($gmedias)
|
993 |
));
|
994 |
break;
|
@@ -1104,6 +1154,64 @@ function gmedia_ios_app_processor($action, $data, $filter = true) {
|
|
1104 |
|
1105 |
} while(0);
|
1106 |
$out = gmedia_ios_app_library_data(array('filter', $taxonomy));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1107 |
} elseif('gmedia_tag' == $taxonomy) {
|
1108 |
if(!current_user_can('gmedia_tag_manage')) {
|
1109 |
$out['error'] = array(
|
3 |
* Application access
|
4 |
*/
|
5 |
|
6 |
+
$time = -microtime(true);
|
7 |
|
8 |
// don't load directly
|
9 |
if(!defined('ABSPATH')) {
|
90 |
'gmedia_upload',
|
91 |
'gmedia_terms',
|
92 |
'gmedia_album_manage',
|
93 |
+
'gmedia_category_manage',
|
94 |
'gmedia_tag_manage',
|
95 |
'gmedia_terms_delete'
|
96 |
);
|
196 |
|
197 |
$ep = $gmGallery->options['endpoint'];
|
198 |
if(get_option('permalink_structure')) {
|
199 |
+
$share_link_base = home_url(urlencode($ep) . '/$2/$1');
|
200 |
} else {
|
201 |
+
$share_link_base = add_query_arg(array("$ep" => '$1', 't' => '$2'), home_url('index.php'));
|
202 |
}
|
203 |
|
204 |
if(in_array('site', $data)) {
|
237 |
$out['filter'] = array_map('intval', $out['filter']);
|
238 |
}
|
239 |
if(in_array('gmedia_category', $data)) {
|
|
|
240 |
if($user_ID){
|
241 |
+
if(current_user_can('gmedia_terms_delete') && current_user_can('gmedia_delete_others_media')) {
|
242 |
+
$cap = 4;
|
243 |
+
} elseif(current_user_can('gmedia_category_manage')) {
|
244 |
+
$cap = 2;
|
245 |
+
} else {
|
246 |
+
$cap = 0;
|
247 |
+
}
|
248 |
} else{
|
249 |
$cap = 0;
|
250 |
}
|
|
|
251 |
$default_args = array('fields' => 'name=>all');
|
252 |
if(isset($args['per_page'])) {
|
253 |
$args['number'] = $args['per_page'];
|
261 |
'items_count' => $gmDB->resultPerPage,
|
262 |
'total_count' => $gmDB->totalResult
|
263 |
);
|
264 |
+
$terms = array('0' => __('Uncategorized', 'grand-media'));
|
|
|
265 |
$out['categories'] = array(
|
266 |
'list' => $terms,
|
267 |
+
'cap' => $cap,
|
268 |
+
'properties' => $props,
|
269 |
'data' => array()
|
270 |
);
|
271 |
if(!empty($gmediaTerms)) {
|
272 |
foreach($gmediaTerms as $i => $term) {
|
273 |
+
$out['categories']['list']["{$term->term_id}"] = $term->name;
|
274 |
+
gmedia_ios_app_term_data_extend($gmediaTerms[$i], $share_link_base, $logic, $cap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
}
|
276 |
|
|
|
277 |
$out['categories']['data'] = array_values($gmediaTerms);
|
278 |
}
|
279 |
}
|
285 |
}
|
286 |
|
287 |
if($user_ID) {
|
288 |
+
if(current_user_can('gmedia_terms_delete')) {
|
289 |
$cap = 4;
|
290 |
+
} elseif(current_user_can('gmedia_album_manage')) {
|
291 |
$cap = 2;
|
292 |
} else {
|
293 |
$cap = 0;
|
314 |
'total_count' => $gmDB->totalResult
|
315 |
);
|
316 |
foreach($gmediaTerms as $i => $term) {
|
317 |
+
gmedia_ios_app_term_data_extend($gmediaTerms[$i], $share_link_base, $logic, $cap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
}
|
319 |
$out['albums'] = array(
|
320 |
'cap' => $cap,
|
325 |
if(in_array('gmedia_tag', $data)) {
|
326 |
$default_args = array();
|
327 |
if($user_ID) {
|
328 |
+
if(current_user_can('gmedia_terms_delete') && current_user_can('gmedia_delete_others_media')) {
|
329 |
+
$cap = 4;
|
330 |
+
} elseif(current_user_can('gmedia_tag_manage')) {
|
331 |
+
$cap = 2;
|
332 |
+
} else {
|
333 |
+
$cap = 0;
|
334 |
+
}
|
335 |
} else {
|
336 |
$cap = 0;
|
337 |
}
|
348 |
'total_count' => $gmDB->totalResult
|
349 |
);
|
350 |
foreach($gmediaTerms as $i => $term) {
|
351 |
+
gmedia_ios_app_term_data_extend($gmediaTerms[$i], $share_link_base, $logic, $cap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
}
|
353 |
$out['tags'] = array(
|
354 |
'cap' => $cap,
|
360 |
return $out;
|
361 |
}
|
362 |
|
363 |
+
/**
|
364 |
+
* @param object $term
|
365 |
+
* @param string $share_link_base
|
366 |
+
*
|
367 |
+
* @param int $logic
|
368 |
+
* @param int $cap
|
369 |
+
*
|
370 |
+
* @return array
|
371 |
+
*/
|
372 |
+
function gmedia_ios_app_term_data_extend(&$term, $share_link_base, $logic = 0, $cap = 0) {
|
373 |
+
global $gmCore, $gmDB, $gmGallery, $user_ID;
|
374 |
+
|
375 |
+
$taxterm = str_replace('gmedia_', '', $term->taxonomy);
|
376 |
+
$default_meta = array();
|
377 |
+
|
378 |
+
if('gmedia_album' == $term->taxonomy) {
|
379 |
+
$author_id = (int)$term->global;
|
380 |
+
if($author_id) {
|
381 |
+
if(($author_id != $user_ID) && ('draft' == $term->status) && !current_user_can('gmedia_edit_others_media')) {
|
382 |
+
unset($term);
|
383 |
+
return;
|
384 |
+
}
|
385 |
+
$authordata = get_userdata($author_id);
|
386 |
+
if($authordata) {
|
387 |
+
$display_name = $authordata->display_name;
|
388 |
+
$first_name = $authordata->first_name;
|
389 |
+
$last_name = $authordata->last_name;
|
390 |
+
} else {
|
391 |
+
$display_name = __('Deleted User', 'grand-media');
|
392 |
+
$first_name = '';
|
393 |
+
$last_name = '';
|
394 |
+
}
|
395 |
+
} else {
|
396 |
+
$display_name = __('Shared', 'grand-media');
|
397 |
+
$first_name = $last_name = '';
|
398 |
+
}
|
399 |
+
$term->user = array(
|
400 |
+
'id' => $author_id,
|
401 |
+
'displayname' => $display_name,
|
402 |
+
'firstname' => $first_name,
|
403 |
+
'lastname' => $last_name
|
404 |
+
);
|
405 |
+
|
406 |
+
$default_meta = array('_orderby' => 'ID', '_order' => 'DESC');
|
407 |
+
|
408 |
+
if(1 === $logic) {
|
409 |
+
if('publish' == $term->status) {
|
410 |
+
$term->status = 'public';
|
411 |
+
}
|
412 |
+
}
|
413 |
+
}
|
414 |
+
if('gmedia_category' == $term->taxonomy) {
|
415 |
+
unset($term->global, $term->status);
|
416 |
+
$term->title = $term->name;
|
417 |
+
$default_meta = array('_orderby' => $gmGallery->options['in_category_orderby'], '_order' => $gmGallery->options['in_category_order']);
|
418 |
+
}
|
419 |
+
if('gmedia_tag' == $term->taxonomy) {
|
420 |
+
unset($term->description, $term->global, $term->status);
|
421 |
+
|
422 |
+
$default_meta = array('_orderby' => $gmGallery->options['in_tag_orderby'], '_order' => $gmGallery->options['in_tag_order']);
|
423 |
+
}
|
424 |
+
|
425 |
+
$term_meta = $gmDB->get_metadata('gmedia_term', $term->term_id);
|
426 |
+
foreach($term_meta as $key => $value) {
|
427 |
+
if(is_array($value) && 1 === count($value)) {
|
428 |
+
$term_meta[$key] = $value[0];
|
429 |
+
}
|
430 |
+
}
|
431 |
+
$term_meta = array_merge($default_meta, $term_meta);
|
432 |
+
$term_meta['orderby'] = $term_meta['_orderby'];
|
433 |
+
$term_meta['order'] = $term_meta['_order'];
|
434 |
+
|
435 |
+
if(in_array($term->taxonomy, array('gmedia_album', 'gmedia_category'))) {
|
436 |
+
if(empty($term_meta['_cover'])) {
|
437 |
+
$term_meta['_cover'] = false;
|
438 |
+
} else {
|
439 |
+
$term_meta['_cover'] = intval($term_meta['_cover']);
|
440 |
+
}
|
441 |
+
if($term_meta['_cover']) {
|
442 |
+
$cover_id = (int)$term_meta['_cover'];
|
443 |
+
$cover = gmedia_ios_app_processor('library', array('gmedia__in' => array($cover_id)), false);
|
444 |
+
if(isset($cover['data'][0])) {
|
445 |
+
$term_meta['_cover'] = $cover['data'][0];
|
446 |
+
$term->thumbnail = $gmCore->gm_get_media_image($cover_id, 'thumb', false);
|
447 |
+
} else {
|
448 |
+
$term_meta['_cover'] = false;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
if(!$term_meta['_cover'] && $term->count) {
|
452 |
+
$gmargs = array(
|
453 |
+
'no_found_rows' => true,
|
454 |
+
'mime_type' => 'image/*',
|
455 |
+
'per_page' => 1,
|
456 |
+
"{$taxterm}__in" => array($term->term_id),
|
457 |
+
'status' => 'publish'
|
458 |
+
);
|
459 |
+
if($user_ID) {
|
460 |
+
$gmargs['status'] = array('publish', 'private');
|
461 |
+
if(user_can($user_ID, 'gmedia_edit_others_media')) {
|
462 |
+
$gmargs['status'] = '';
|
463 |
+
}
|
464 |
+
} else {
|
465 |
+
$gmargs['status'] = 'publish';
|
466 |
+
}
|
467 |
+
|
468 |
+
$termItems = $gmDB->get_gmedias($gmargs);
|
469 |
+
if(!empty($termItems)) {
|
470 |
+
$cover = gmedia_ios_app_processor('library', array('gmedia__in' => array($termItems[0]->ID)),
|
471 |
+
false);
|
472 |
+
if(isset($cover['data'][0])) {
|
473 |
+
$term_meta['_cover'] = $cover['data'][0];
|
474 |
+
}
|
475 |
+
$term->thumbnail = $gmCore->gm_get_media_image($termItems[0], 'thumb', false);
|
476 |
+
}
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
$term->meta = $term_meta;
|
481 |
+
|
482 |
+
$t = array(
|
483 |
+
'album' => 'a',
|
484 |
+
'tag' => 't',
|
485 |
+
'category' => 'k'
|
486 |
+
);
|
487 |
+
$gmedia_hashid = gmedia_hash_id_encode($term->term_id, $taxterm);
|
488 |
+
$term->sharelink = str_replace(array('$1', '$2'), array(urlencode($gmedia_hashid), $t[$taxterm]), $share_link_base);
|
489 |
+
|
490 |
+
$term->cap = (4 == $cap)? 4 : 0;
|
491 |
+
}
|
492 |
+
|
493 |
/**
|
494 |
* @param $action
|
495 |
* @param $data
|
550 |
if(!current_user_can('gmedia_terms')) {
|
551 |
unset($gmedia['categories'], $gmedia['albums'], $gmedia['tags']);
|
552 |
} else {
|
|
|
|
|
|
|
|
|
553 |
if(empty($gmedia['albums'])) {
|
554 |
$gmedia['terms']['gmedia_album'] = '';
|
555 |
} else {
|
556 |
$alb = isset($gmedia['albums'][0]->term_id)? $gmedia['albums'][0]->term_id : $gmedia['albums'][0]->name;
|
557 |
$gmedia['terms']['gmedia_album'] = $alb;
|
558 |
}
|
559 |
+
if(empty($gmedia['categories'])) {
|
560 |
+
$gmedia['terms']['gmedia_category'] = '';
|
561 |
+
} else {
|
562 |
+
$categories = array();
|
563 |
+
foreach($gmedia['categories'] as $category) {
|
564 |
+
$categories[] = isset($category->term_id)? $category->term_id : $category->name;
|
565 |
+
}
|
566 |
+
$gmedia['terms']['gmedia_category'] = implode(',', $categories);
|
567 |
+
}
|
568 |
if(empty($gmedia['tags'])) {
|
569 |
$gmedia['terms']['gmedia_tag'] = '';
|
570 |
} else {
|
606 |
if(!current_user_can('gmedia_terms')) {
|
607 |
unset($gmedia['categories'], $gmedia['albums'], $gmedia['tags']);
|
608 |
} else {
|
|
|
|
|
|
|
|
|
609 |
if(empty($gmedia['albums'])) {
|
610 |
$gmedia['terms']['gmedia_album'] = '';
|
611 |
} else {
|
615 |
$gmedia['terms']['gmedia_album'] = $gmedia['albums'][0]->name;
|
616 |
}
|
617 |
}
|
618 |
+
if(empty($gmedia['categories'])) {
|
619 |
+
$gmedia['terms']['gmedia_category'] = '';
|
620 |
+
} else {
|
621 |
+
$categories = array();
|
622 |
+
foreach($gmedia['categories'] as $category) {
|
623 |
+
if(isset($category->term_id)) {
|
624 |
+
$categories[] = $category->term_id;
|
625 |
+
} elseif(current_user_can('gmedia_category_manage')) {
|
626 |
+
$categories[] = $category->name;
|
627 |
+
}
|
628 |
+
}
|
629 |
+
$gmedia['terms']['gmedia_category'] = implode(',', $categories);
|
630 |
+
}
|
631 |
if(empty($gmedia['tags'])) {
|
632 |
$gmedia['terms']['gmedia_tag'] = '';
|
633 |
} else {
|
668 |
}
|
669 |
break;
|
670 |
|
671 |
+
case 'assign_album':
|
672 |
if(!current_user_can('gmedia_terms')) {
|
673 |
+
$error[] = __('You are not allowed to manage albums', 'grand-media');
|
|
|
|
|
|
|
|
|
|
|
674 |
}
|
675 |
+
$term = $data['assign_album'][0];
|
676 |
$count = count($data['selected']);
|
677 |
if('0' == $term) {
|
678 |
foreach($data['selected'] as $item) {
|
679 |
+
$gmDB->delete_gmedia_term_relationships($item, 'gmedia_album');
|
680 |
}
|
681 |
+
$alert[] = sprintf(__('%d item(s) updated with "No Album"', 'grand-media'), $count);
|
682 |
} else {
|
683 |
foreach($data['selected'] as $item) {
|
684 |
+
$result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_album', $append = 0);
|
685 |
if(is_wp_error($result)) {
|
686 |
$error[] = $result->get_error_message();
|
687 |
$count--;
|
689 |
$count--;
|
690 |
}
|
691 |
}
|
692 |
+
if($gmCore->is_digit($term)) {
|
693 |
+
$alb_name = $gmDB->get_alb_name($term);
|
|
|
|
|
694 |
} else {
|
695 |
+
$alb_name = $term;
|
696 |
}
|
697 |
+
$alert[] = sprintf(__('Album `%s` assigned to %d item(s)', 'grand-media'), esc_html($alb_name),
|
698 |
+
$count);
|
699 |
}
|
700 |
break;
|
701 |
|
702 |
+
case 'assign_category':
|
703 |
if(!current_user_can('gmedia_terms')) {
|
704 |
+
$error[] = __('You are not allowed to manage categories', 'grand-media');
|
705 |
+
break;
|
706 |
}
|
707 |
+
if(empty($data['assign_category'])) {
|
708 |
+
$error[] = __('No categories provided', 'grand-media');
|
709 |
+
break;
|
710 |
+
}
|
711 |
+
$terms = $data['assign_category'];
|
712 |
$count = count($data['selected']);
|
713 |
+
if(1 === count($terms) && '0' == $terms[0]) {
|
714 |
foreach($data['selected'] as $item) {
|
715 |
+
$gmDB->delete_gmedia_term_relationships($item, 'gmedia_category');
|
716 |
}
|
717 |
+
$alert[] = sprintf(__('%d item(s) updated with "Uncategorized"', 'grand-media'), $count);
|
718 |
} else {
|
719 |
foreach($data['selected'] as $item) {
|
720 |
+
$result = $gmDB->set_gmedia_terms($item, $terms, 'gmedia_category', $append = 0);
|
721 |
if(is_wp_error($result)) {
|
722 |
$error[] = $result->get_error_message();
|
723 |
$count--;
|
725 |
$count--;
|
726 |
}
|
727 |
}
|
728 |
+
$alert[] = sprintf(__('%d category(ies) added to %d item(s)', 'grand-media'), count($terms), $count);
|
729 |
+
}
|
730 |
+
break;
|
731 |
+
|
732 |
+
case 'unassign_category':
|
733 |
+
if(!current_user_can('gmedia_delete_others_media')) {
|
734 |
+
$error[] = __('You are not allowed to delete others media', 'grand-media');
|
735 |
+
break;
|
736 |
+
}
|
737 |
+
if(empty($data['unassign_category'])) {
|
738 |
+
$error[] = __('No categories provided', 'grand-media');
|
739 |
+
break;
|
740 |
+
}
|
741 |
+
$terms = array_map('intval', $data['unassign_category']);
|
742 |
+
$count = count($data['selected']);
|
743 |
+
foreach($data['selected'] as $item) {
|
744 |
+
$result = $gmDB->set_gmedia_terms($item, $terms, 'gmedia_category', $append = -1);
|
745 |
+
if(is_wp_error($result)) {
|
746 |
+
$error[] = $result->get_error_message();
|
747 |
+
$count--;
|
748 |
+
} elseif(!$result) {
|
749 |
+
$count--;
|
750 |
}
|
|
|
|
|
751 |
}
|
752 |
+
$alert[] = sprintf(__('%d category(ies) deleted from %d item(s)', 'grand-media'), count($terms), $count);
|
753 |
break;
|
754 |
|
755 |
case 'add_tags':
|
761 |
$error[] = __('No tags provided', 'grand-media');
|
762 |
break;
|
763 |
}
|
764 |
+
$terms = $data['add_tags'];
|
765 |
$count = count($data['selected']);
|
766 |
foreach($data['selected'] as $item) {
|
767 |
+
$result = $gmDB->set_gmedia_terms($item, $terms, 'gmedia_tag', $append = 1);
|
768 |
if(is_wp_error($result)) {
|
769 |
$error[] = $result->get_error_message();
|
770 |
$count--;
|
772 |
$count--;
|
773 |
}
|
774 |
}
|
775 |
+
$alert[] = sprintf(__('%d tag(s) added to %d item(s)', 'grand-media'), count($terms), $count);
|
776 |
break;
|
777 |
|
778 |
case 'delete_tags':
|
784 |
$error[] = __('No tags provided', 'grand-media');
|
785 |
break;
|
786 |
}
|
787 |
+
$terms = array_map('intval', $data['delete_tags']);
|
788 |
$count = count($data['selected']);
|
789 |
foreach($data['selected'] as $item) {
|
790 |
+
$result = $gmDB->set_gmedia_terms($item, $terms, 'gmedia_tag', $append = -1);
|
791 |
if(is_wp_error($result)) {
|
792 |
$error[] = $result->get_error_message();
|
793 |
$count--;
|
795 |
$count--;
|
796 |
}
|
797 |
}
|
798 |
+
$alert[] = sprintf(__('%d tag(s) deleted from %d item(s)', 'grand-media'), count($terms), $count);
|
799 |
break;
|
800 |
|
801 |
case 'delete':
|
829 |
case 'library':
|
830 |
$ep = $gmGallery->options['endpoint'];
|
831 |
if(get_option('permalink_structure')) {
|
832 |
+
$share_link_base = home_url(urlencode($ep) . '/$2/$1');
|
833 |
} else {
|
834 |
+
$share_link_base = add_query_arg(array("$ep" => '$1', 't' => '$2'), home_url('index.php'));
|
835 |
}
|
836 |
$filter = $filter? gmedia_ios_app_library_data(array('filter')) : array();
|
837 |
|
856 |
'data' => array()
|
857 |
));
|
858 |
|
859 |
+
$terms_ids = array();
|
860 |
+
if(!empty($data['album__in'])) {
|
861 |
+
$terms_ids = array_merge($terms_ids, $data['album__in']);
|
862 |
+
}
|
863 |
+
if(!empty($data['category__in'])) {
|
864 |
+
$terms_ids = array_merge($terms_ids, $data['category__in']);
|
865 |
+
}
|
866 |
+
if(!empty($data['tag__in'])) {
|
867 |
+
$terms_ids = array_merge($terms_ids, $data['tag__in']);
|
868 |
+
}
|
869 |
+
if(!empty($terms_ids)){
|
870 |
+
$terms_ids = $gmDB->get_terms(array('gmedia_album', 'gmedia_category', 'gmedia_tag'), array('include' => $terms_ids));
|
871 |
+
if(!empty($terms_ids) && !is_wp_error($terms_ids)){
|
872 |
+
foreach($terms_ids as $i => $term){
|
873 |
+
gmedia_ios_app_term_data_extend($terms_ids[$i], $share_link_base);
|
874 |
+
}
|
875 |
+
} else {
|
876 |
+
$terms_ids = array();
|
877 |
+
}
|
878 |
+
}
|
879 |
+
$req_terms = array();
|
880 |
+
if(!empty($terms_ids)){
|
881 |
+
foreach($terms_ids as $term){
|
882 |
+
$taxterm = str_replace('gmedia_', '', $term->taxonomy);
|
883 |
+
$req_terms["{$taxterm}__in"]["{$term->term_id}"] = $term;
|
884 |
+
}
|
885 |
+
}
|
886 |
+
|
887 |
$is_admin = isset($data['admin'])? intval($data['admin']) : 0;
|
888 |
if(!is_user_logged_in()) {
|
889 |
+
$logged_in = false;
|
890 |
$data['status'] = array('publish');
|
891 |
+
if(!empty($req_terms['album__in'])) {
|
892 |
+
$break = false;
|
893 |
+
foreach($req_terms['album__in'] as $alb) {
|
894 |
+
if(!(isset($alb->status) && ('publish' == $alb->status))) {
|
895 |
+
$break = true;
|
896 |
+
}
|
897 |
+
}
|
898 |
+
if($break){
|
899 |
$out = $false_out;
|
900 |
break;
|
901 |
}
|
911 |
}
|
912 |
}
|
913 |
|
914 |
+
$_data = $data;
|
915 |
$_data['per_page'] = -1;
|
916 |
+
$_data['status'] = null;
|
917 |
+
$_data['fields'] = 'ids';
|
918 |
+
$all_gmedias_ids = $gmDB->get_gmedias($_data);
|
919 |
+
$gmedias = $gmDB->get_gmedias($data);
|
920 |
foreach($gmedias as $i => $item) {
|
921 |
|
922 |
//if((!$logged_in && 'publish' != $item->status) || (!$is_admin && ('draft' == $item->status) && ((int)$user_ID != (int)$item->author))) {
|
980 |
if($terms) {
|
981 |
$terms = array_values((array)$terms);
|
982 |
foreach($terms as $term) {
|
983 |
+
$categories[] = array('term_id' => $term->term_id, 'name' => $term->term_id, 'title' => $term->name);
|
984 |
}
|
985 |
}
|
986 |
$gmedias[$i]->categories = $categories;
|
1025 |
|
1026 |
$item_name = $item->title? $item->title : pathinfo($item->gmuid, PATHINFO_FILENAME);
|
1027 |
$gmedia_hashid = gmedia_hash_id_encode($item->ID, 'single');
|
1028 |
+
$gmedias[$i]->sharelink = str_replace(array('$1', '$2'), array(urlencode($gmedia_hashid), 's'), $share_link_base);
|
1029 |
if(1 === $logic && 'publish' == $item->status) {
|
1030 |
$gmedias[$i]->status = 'public';
|
1031 |
}
|
1032 |
}
|
1033 |
$out = array_merge($filter, array(
|
1034 |
+
'properties' => array_merge($req_terms, array(
|
1035 |
'request' => isset($data['request'])? $data['request'] : null,
|
1036 |
'total_pages' => $gmDB->pages,
|
1037 |
'current_page' => $gmDB->openPage,
|
1038 |
'items_count' => $gmDB->resultPerPage,
|
1039 |
'total_count' => $gmDB->totalResult,
|
1040 |
+
'count' => count($all_gmedias_ids)
|
1041 |
+
)),
|
1042 |
'data' => array_values($gmedias)
|
1043 |
));
|
1044 |
break;
|
1154 |
|
1155 |
} while(0);
|
1156 |
$out = gmedia_ios_app_library_data(array('filter', $taxonomy));
|
1157 |
+
} elseif('gmedia_category' == $taxonomy) {
|
1158 |
+
if(!current_user_can('gmedia_category_manage')) {
|
1159 |
+
$out['error'] = array(
|
1160 |
+
'code' => 'nocapability',
|
1161 |
+
'title' => __("You can't do this", 'grand-media'),
|
1162 |
+
'message' => __('You have no permission to do this operation', 'grand-media')
|
1163 |
+
);
|
1164 |
+
|
1165 |
+
return $out;
|
1166 |
+
}
|
1167 |
+
if($edit_term) {
|
1168 |
+
if(!current_user_can('gmedia_edit_others_media')) {
|
1169 |
+
$error[] = __('You are not allowed to edit others media', 'grand-media');
|
1170 |
+
break;
|
1171 |
+
}
|
1172 |
+
$term['name'] = trim($term['name']);
|
1173 |
+
$term['term_id'] = intval($term['term_id']);
|
1174 |
+
if($term['name'] && !$gmCore->is_digit($term['name'])) {
|
1175 |
+
if(($term_id = $gmDB->term_exists($term['term_id'], $taxonomy))) {
|
1176 |
+
if(!$gmDB->term_exists($term['name'], $taxonomy)) {
|
1177 |
+
$term_id = $gmDB->update_term($term['term_id'], $taxonomy, $term);
|
1178 |
+
if(is_wp_error($term_id)) {
|
1179 |
+
$error[] = $term_id->get_error_message();
|
1180 |
+
} else {
|
1181 |
+
$alert[] = sprintf(__("Category %d successfuly updated", 'grand-media'), $term_id);
|
1182 |
+
}
|
1183 |
+
} else {
|
1184 |
+
$error[] = __('A term with the name provided already exists', 'grand-media');
|
1185 |
+
}
|
1186 |
+
} else {
|
1187 |
+
$error[] = __("A term with the id provided do not exists", 'grand-media');
|
1188 |
+
}
|
1189 |
+
} else {
|
1190 |
+
$error[] = __("Term name can't be only digits or empty", 'grand-media');
|
1191 |
+
}
|
1192 |
+
} else {
|
1193 |
+
$terms = array_filter(array_map('trim', explode(',', $term['name'])));
|
1194 |
+
$terms_added = 0;
|
1195 |
+
$terms_qty = count($terms);
|
1196 |
+
foreach($terms as $term_name) {
|
1197 |
+
if($gmCore->is_digit($term_name)) {
|
1198 |
+
continue;
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
if(!$gmDB->term_exists($term_name, $taxonomy)) {
|
1202 |
+
$term_id = $gmDB->insert_term($term_name, $taxonomy);
|
1203 |
+
if(is_wp_error($term_id)) {
|
1204 |
+
$error[] = $term_id->get_error_message();
|
1205 |
+
} else {
|
1206 |
+
$alert['category_add'] = sprintf(__('%d of %d categories successfuly added', 'grand-media'),
|
1207 |
+
++$terms_added, $terms_qty);
|
1208 |
+
}
|
1209 |
+
} else {
|
1210 |
+
$alert['category_add'] = __('Some of provided categories are already exists', 'grand-media');
|
1211 |
+
}
|
1212 |
+
}
|
1213 |
+
}
|
1214 |
+
$out = gmedia_ios_app_library_data(array('filter', $taxonomy));
|
1215 |
} elseif('gmedia_tag' == $taxonomy) {
|
1216 |
if(!current_user_can('gmedia_tag_manage')) {
|
1217 |
$out['error'] = array(
|
config/setup.php
CHANGED
@@ -68,35 +68,7 @@ function gmedia_default_options() {
|
|
68 |
$gm['license_key'] = '';
|
69 |
$gm['license_key2'] = '';
|
70 |
|
71 |
-
$gm['taxonomies']['gmedia_category'] = array(
|
72 |
-
'abstract' => __('Abstract', 'grand-media'),
|
73 |
-
'animals' => __('Animals', 'grand-media'),
|
74 |
-
'black-and-white' => __('Black and White', 'grand-media'),
|
75 |
-
'celebrities' => __('Celebrities', 'grand-media'),
|
76 |
-
'city-and-architecture' => __('City & Architecture', 'grand-media'),
|
77 |
-
'commercial' => __('Commercial', 'grand-media'),
|
78 |
-
'concert' => __('Concert', 'grand-media'),
|
79 |
-
'family' => __('Family', 'grand-media'),
|
80 |
-
'fashion' => __('Fashion', 'grand-media'),
|
81 |
-
'film' => __('Film', 'grand-media'),
|
82 |
-
'fine-art' => __('Fine Art', 'grand-media'),
|
83 |
-
'food' => __('Food', 'grand-media'),
|
84 |
-
'journalism' => __('Journalism', 'grand-media'),
|
85 |
-
'landscapes' => __('Landscapes', 'grand-media'),
|
86 |
-
'macro' => __('Macro', 'grand-media'),
|
87 |
-
'nature' => __('Nature', 'grand-media'),
|
88 |
-
'nude' => __('Nude', 'grand-media'),
|
89 |
-
'people' => __('People', 'grand-media'),
|
90 |
-
'performing-arts' => __('Performing Arts', 'grand-media'),
|
91 |
-
'sport' => __('Sport', 'grand-media'),
|
92 |
-
'still-life' => __('Still Life', 'grand-media'),
|
93 |
-
'street' => __('Street', 'grand-media'),
|
94 |
-
'transportation' => __('Transportation', 'grand-media'),
|
95 |
-
'travel' => __('Travel', 'grand-media'),
|
96 |
-
'underwater' => __('Underwater', 'grand-media'),
|
97 |
-
'urban-exploration' => __('Urban Exploration', 'grand-media'),
|
98 |
-
'wedding' => __('Wedding', 'grand-media')
|
99 |
-
);
|
100 |
$gm['taxonomies']['gmedia_tag'] = array();
|
101 |
$gm['taxonomies']['gmedia_album'] = array();
|
102 |
|
68 |
$gm['license_key'] = '';
|
69 |
$gm['license_key2'] = '';
|
70 |
|
71 |
+
$gm['taxonomies']['gmedia_category'] = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$gm['taxonomies']['gmedia_tag'] = array();
|
73 |
$gm['taxonomies']['gmedia_album'] = array();
|
74 |
|
config/update.php
CHANGED
@@ -749,6 +749,49 @@ function gmedia_quite_update() {
|
|
749 |
@unlink($gmCore->upload['path'] . '/module/mosaic/js/mosaic.js');
|
750 |
}
|
751 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
|
753 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/afflux');
|
754 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/jq-mplayer');
|
749 |
@unlink($gmCore->upload['path'] . '/module/mosaic/js/mosaic.js');
|
750 |
}
|
751 |
}
|
752 |
+
if(version_compare($current_version, '1.8.12', '<')) {
|
753 |
+
$categories = $gmDB->get_terms('gmedia_category');
|
754 |
+
if(!empty($categories)) {
|
755 |
+
$cats = array(
|
756 |
+
'abstract' => __('Abstract', 'grand-media'),
|
757 |
+
'animals' => __('Animals', 'grand-media'),
|
758 |
+
'black-and-white' => __('Black and White', 'grand-media'),
|
759 |
+
'celebrities' => __('Celebrities', 'grand-media'),
|
760 |
+
'city-and-architecture' => __('City & Architecture', 'grand-media'),
|
761 |
+
'commercial' => __('Commercial', 'grand-media'),
|
762 |
+
'concert' => __('Concert', 'grand-media'),
|
763 |
+
'family' => __('Family', 'grand-media'),
|
764 |
+
'fashion' => __('Fashion', 'grand-media'),
|
765 |
+
'film' => __('Film', 'grand-media'),
|
766 |
+
'fine-art' => __('Fine Art', 'grand-media'),
|
767 |
+
'food' => __('Food', 'grand-media'),
|
768 |
+
'journalism' => __('Journalism', 'grand-media'),
|
769 |
+
'landscapes' => __('Landscapes', 'grand-media'),
|
770 |
+
'macro' => __('Macro', 'grand-media'),
|
771 |
+
'nature' => __('Nature', 'grand-media'),
|
772 |
+
'nude' => __('Nude', 'grand-media'),
|
773 |
+
'people' => __('People', 'grand-media'),
|
774 |
+
'performing-arts' => __('Performing Arts', 'grand-media'),
|
775 |
+
'sport' => __('Sport', 'grand-media'),
|
776 |
+
'still-life' => __('Still Life', 'grand-media'),
|
777 |
+
'street' => __('Street', 'grand-media'),
|
778 |
+
'transportation' => __('Transportation', 'grand-media'),
|
779 |
+
'travel' => __('Travel', 'grand-media'),
|
780 |
+
'underwater' => __('Underwater', 'grand-media'),
|
781 |
+
'urban-exploration' => __('Urban Exploration', 'grand-media'),
|
782 |
+
'wedding' => __('Wedding', 'grand-media')
|
783 |
+
);
|
784 |
+
foreach($categories as $c) {
|
785 |
+
if(isset($cats[$c->name])) {
|
786 |
+
$wpdb->update($wpdb->prefix . 'gmedia_term', array('name' => $cats[$c->name]), array('term_id' => $c->term_id));
|
787 |
+
$gmDB->clean_term_cache($c->term_id, 'gmedia_category');
|
788 |
+
}
|
789 |
+
}
|
790 |
+
}
|
791 |
+
|
792 |
+
$role = $gmDB->get_role('gmedia_tag_manage');
|
793 |
+
$gmDB->set_capability($role, 'gmedia_category_manage');
|
794 |
+
}
|
795 |
|
796 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/afflux');
|
797 |
$gmCore->delete_folder($gmCore->upload['path'] . '/module/jq-mplayer');
|
grand-media.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Gmedia Gallery
|
4 |
* Plugin URI: http://wordpress.org/extend/plugins/grand-media/
|
5 |
* Description: Gmedia Gallery - powerful media library plugin for creating beautiful galleries and managing files.
|
6 |
-
* Version: 1.8.
|
7 |
* Author: Rattus
|
8 |
* Author URI: http://codeasily.com/
|
9 |
* Requires at least: 3.6
|
@@ -42,7 +42,7 @@ if(!class_exists('Gmedia')) {
|
|
42 |
*/
|
43 |
class Gmedia {
|
44 |
|
45 |
-
var $version = '1.8.
|
46 |
var $dbversion = '1.8.0';
|
47 |
var $minium_WP = '3.6';
|
48 |
var $options = '';
|
@@ -328,8 +328,8 @@ if(!class_exists('Gmedia')) {
|
|
328 |
'plugin_dirurl' => $gmCore->gmedia_url
|
329 |
));
|
330 |
|
331 |
-
wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/assets/css/gmedia.admin.css', array(), '1.8.
|
332 |
-
wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/assets/js/gmedia.admin.js', array('jquery', 'gmedia-global-backend'), '1.8.
|
333 |
wp_localize_script('grand-media', 'grandMedia', array(
|
334 |
'error3' => __('Disable your Popup Blocker and try again.', 'grand-media'),
|
335 |
'download' => __('downloading...', 'grand-media'),
|
3 |
* Plugin Name: Gmedia Gallery
|
4 |
* Plugin URI: http://wordpress.org/extend/plugins/grand-media/
|
5 |
* Description: Gmedia Gallery - powerful media library plugin for creating beautiful galleries and managing files.
|
6 |
+
* Version: 1.8.12
|
7 |
* Author: Rattus
|
8 |
* Author URI: http://codeasily.com/
|
9 |
* Requires at least: 3.6
|
42 |
*/
|
43 |
class Gmedia {
|
44 |
|
45 |
+
var $version = '1.8.12';
|
46 |
var $dbversion = '1.8.0';
|
47 |
var $minium_WP = '3.6';
|
48 |
var $options = '';
|
328 |
'plugin_dirurl' => $gmCore->gmedia_url
|
329 |
));
|
330 |
|
331 |
+
wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/assets/css/gmedia.admin.css', array(), '1.8.12', 'all');
|
332 |
+
wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/assets/js/gmedia.admin.js', array('jquery', 'gmedia-global-backend'), '1.8.12');
|
333 |
wp_localize_script('grand-media', 'grandMedia', array(
|
334 |
'error3' => __('Disable your Popup Blocker and try again.', 'grand-media'),
|
335 |
'download' => __('downloading...', 'grand-media'),
|
inc/core.php
CHANGED
@@ -2036,12 +2036,19 @@ class GmediaCore {
|
|
2036 |
}
|
2037 |
|
2038 |
unset($post_data['gmuid'], $post_data['mime_type'], $post_data['set_title'], $post_data['set_status']);
|
2039 |
-
|
2040 |
-
|
|
|
|
|
|
|
|
|
|
|
2041 |
}
|
2042 |
|
2043 |
-
if(isset($post_data['terms']['gmedia_tag']) && !empty($post_data['terms']['gmedia_tag'])
|
2044 |
-
|
|
|
|
|
2045 |
} else {
|
2046 |
$post_data['terms']['gmedia_tag'] = array();
|
2047 |
}
|
@@ -2210,6 +2217,21 @@ class GmediaCore {
|
|
2210 |
$_status = 'publish';
|
2211 |
}
|
2212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2213 |
$c = count($files);
|
2214 |
$i = 0;
|
2215 |
foreach($files as $file) {
|
@@ -2487,10 +2509,6 @@ class GmediaCore {
|
|
2487 |
$title = $fileinfo['title'];
|
2488 |
}
|
2489 |
|
2490 |
-
if(!$is_webimage) {
|
2491 |
-
unset($terms['gmedia_category']);
|
2492 |
-
}
|
2493 |
-
|
2494 |
// Construct the media_data array
|
2495 |
$media_data = array(
|
2496 |
'mime_type' => $fileinfo['mime_type'],
|
@@ -2531,7 +2549,7 @@ class GmediaCore {
|
|
2531 |
|
2532 |
}
|
2533 |
|
2534 |
-
echo '<p><b>' . __('Category') . ':</b> ' . ((isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category']))? esc_html(
|
2535 |
echo '<br /><b>' . __('Album') . ':</b> ' . ((isset($_terms['gmedia_album']) && !empty($_terms['gmedia_album']))? (isset($album_name)? $album_name : esc_html($_terms['gmedia_album'])) : '-') . PHP_EOL;
|
2536 |
echo '<br /><b>' . __('Tags') . ':</b> ' . ((isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag']))? esc_html(str_replace(',', ', ', $_terms['gmedia_tag'])) : '-') . '</p>' . PHP_EOL;
|
2537 |
|
@@ -3176,6 +3194,7 @@ class GmediaCore {
|
|
3176 |
, 'gmedia_import'
|
3177 |
, 'gmedia_terms'
|
3178 |
, 'gmedia_album_manage'
|
|
|
3179 |
, 'gmedia_filter_manage'
|
3180 |
, 'gmedia_tag_manage'
|
3181 |
, 'gmedia_terms_delete'
|
2036 |
}
|
2037 |
|
2038 |
unset($post_data['gmuid'], $post_data['mime_type'], $post_data['set_title'], $post_data['set_status']);
|
2039 |
+
|
2040 |
+
if(isset($post_data['terms']['gmedia_category']) && !empty($post_data['terms']['gmedia_category'])) {
|
2041 |
+
if(!is_array($post_data['terms']['gmedia_category'])) {
|
2042 |
+
$post_data['terms']['gmedia_category'] = explode(',', $post_data['terms']['gmedia_category']);
|
2043 |
+
}
|
2044 |
+
} else {
|
2045 |
+
$post_data['terms']['gmedia_category'] = array();
|
2046 |
}
|
2047 |
|
2048 |
+
if(isset($post_data['terms']['gmedia_tag']) && !empty($post_data['terms']['gmedia_tag'])) {
|
2049 |
+
if(!is_array($post_data['terms']['gmedia_tag'])) {
|
2050 |
+
$post_data['terms']['gmedia_tag'] = explode(',', $post_data['terms']['gmedia_tag']);
|
2051 |
+
}
|
2052 |
} else {
|
2053 |
$post_data['terms']['gmedia_tag'] = array();
|
2054 |
}
|
2217 |
$_status = 'publish';
|
2218 |
}
|
2219 |
|
2220 |
+
if(isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category'])) {
|
2221 |
+
if(!is_array($_terms['gmedia_category'])) {
|
2222 |
+
$_terms['gmedia_category'] = explode(',', $_terms['gmedia_category']);
|
2223 |
+
}
|
2224 |
+
} else {
|
2225 |
+
$_terms['gmedia_category'] = array();
|
2226 |
+
}
|
2227 |
+
if(isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag'])) {
|
2228 |
+
if(!is_array($_terms['gmedia_tag'])) {
|
2229 |
+
$_terms['gmedia_tag'] = explode(',', $_terms['gmedia_tag']);
|
2230 |
+
}
|
2231 |
+
} else {
|
2232 |
+
$_terms['gmedia_tag'] = array();
|
2233 |
+
}
|
2234 |
+
|
2235 |
$c = count($files);
|
2236 |
$i = 0;
|
2237 |
foreach($files as $file) {
|
2509 |
$title = $fileinfo['title'];
|
2510 |
}
|
2511 |
|
|
|
|
|
|
|
|
|
2512 |
// Construct the media_data array
|
2513 |
$media_data = array(
|
2514 |
'mime_type' => $fileinfo['mime_type'],
|
2549 |
|
2550 |
}
|
2551 |
|
2552 |
+
echo '<p><b>' . __('Category') . ':</b> ' . ((isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category']))? esc_html(str_replace(',', ', ', $_terms['gmedia_category'])) : '-') . PHP_EOL;
|
2553 |
echo '<br /><b>' . __('Album') . ':</b> ' . ((isset($_terms['gmedia_album']) && !empty($_terms['gmedia_album']))? (isset($album_name)? $album_name : esc_html($_terms['gmedia_album'])) : '-') . PHP_EOL;
|
2554 |
echo '<br /><b>' . __('Tags') . ':</b> ' . ((isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag']))? esc_html(str_replace(',', ', ', $_terms['gmedia_tag'])) : '-') . '</p>' . PHP_EOL;
|
2555 |
|
3194 |
, 'gmedia_import'
|
3195 |
, 'gmedia_terms'
|
3196 |
, 'gmedia_album_manage'
|
3197 |
+
, 'gmedia_category_manage'
|
3198 |
, 'gmedia_filter_manage'
|
3199 |
, 'gmedia_tag_manage'
|
3200 |
, 'gmedia_terms_delete'
|
inc/db.connect.php
CHANGED
@@ -457,7 +457,7 @@ class GmediaDB {
|
|
457 |
if(isset($terms) && is_array($terms) && count($terms)) {
|
458 |
foreach($terms as $taxonomy => $_terms) {
|
459 |
$taxonomy = trim($taxonomy);
|
460 |
-
if(('gmedia_tag'
|
461 |
$_terms = explode(',', $_terms);
|
462 |
} else {
|
463 |
$_terms = (array)$_terms;
|
@@ -3444,13 +3444,6 @@ class GmediaDB {
|
|
3444 |
return new WP_Error('gm_invalid_taxonomy', __('Invalid Taxonomy'));
|
3445 |
}
|
3446 |
|
3447 |
-
if('gmedia_category' == $taxonomy) {
|
3448 |
-
$object = $this->get_gmedia($object_id);
|
3449 |
-
if(!in_array($object->mime_type, array('image/jpeg', 'image/png', 'image/gif'))) {
|
3450 |
-
return false;
|
3451 |
-
}
|
3452 |
-
}
|
3453 |
-
|
3454 |
if(!is_array($terms)) {
|
3455 |
$terms = array($terms);
|
3456 |
}
|
@@ -3481,7 +3474,7 @@ class GmediaDB {
|
|
3481 |
}
|
3482 |
if(!$term_id = $this->term_exists($term, $taxonomy, $global)) {
|
3483 |
// Skip if a non-existent term ID is passed or if taxonomy is category or if user is not allowed to add new terms.
|
3484 |
-
if($gmCore->is_digit($term) || ($append < 0) ||
|
3485 |
continue;
|
3486 |
}
|
3487 |
if($global) {
|
@@ -3494,7 +3487,7 @@ class GmediaDB {
|
|
3494 |
return $term_id;
|
3495 |
}
|
3496 |
} else {
|
3497 |
-
if(('gmedia_album'
|
3498 |
$alb = $this->get_term($term_id, 'gmedia_album');
|
3499 |
if($alb->global && ($alb->global != get_current_user_id())) {
|
3500 |
continue;
|
457 |
if(isset($terms) && is_array($terms) && count($terms)) {
|
458 |
foreach($terms as $taxonomy => $_terms) {
|
459 |
$taxonomy = trim($taxonomy);
|
460 |
+
if(in_array($taxonomy, array('gmedia_tag', 'gmedia_category')) && !is_array($_terms)) {
|
461 |
$_terms = explode(',', $_terms);
|
462 |
} else {
|
463 |
$_terms = (array)$_terms;
|
3444 |
return new WP_Error('gm_invalid_taxonomy', __('Invalid Taxonomy'));
|
3445 |
}
|
3446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3447 |
if(!is_array($terms)) {
|
3448 |
$terms = array($terms);
|
3449 |
}
|
3474 |
}
|
3475 |
if(!$term_id = $this->term_exists($term, $taxonomy, $global)) {
|
3476 |
// Skip if a non-existent term ID is passed or if taxonomy is category or if user is not allowed to add new terms.
|
3477 |
+
if($gmCore->is_digit($term) || ($append < 0) || !current_user_can($taxonomy . '_manage')) {
|
3478 |
continue;
|
3479 |
}
|
3480 |
if($global) {
|
3487 |
return $term_id;
|
3488 |
}
|
3489 |
} else {
|
3490 |
+
if(in_array($taxonomy, array('gmedia_album')) && !current_user_can('gmedia_edit_others_media')) {
|
3491 |
$alb = $this->get_term($term_id, 'gmedia_album');
|
3492 |
if($alb->global && ($alb->global != get_current_user_id())) {
|
3493 |
continue;
|
inc/media-upload.php
CHANGED
@@ -359,7 +359,7 @@ function gmedia_add_media_galleries()
|
|
359 |
if ('gmedia_category' == $tax_tabs) {
|
360 |
_e('Categories', 'grand-media');
|
361 |
foreach ($tabs as $t) {
|
362 |
-
$terms_source[] = sprintf('<a class="gm_category" target="_blank" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($
|
363 |
}
|
364 |
} elseif ('gmedia_album' == $tax_tabs) {
|
365 |
_e('Albums', 'grand-media');
|
@@ -500,14 +500,12 @@ function gmedia_add_media_terms()
|
|
500 |
}
|
501 |
}
|
502 |
break;
|
|
|
503 |
case 'gmedia_tag':
|
504 |
if ('global' == $args['orderby']) {
|
505 |
$args['orderby'] = 'id';
|
506 |
}
|
507 |
break;
|
508 |
-
case 'gmedia_category':
|
509 |
-
$args = array();
|
510 |
-
break;
|
511 |
case 'gmedia_filter':
|
512 |
$args['hide_empty'] = 0;
|
513 |
$args['global'] = $gmCore->_get('author', $gmCore->caps['gmedia_edit_others_media'] ? '' : array(0, $user_ID));
|
@@ -574,22 +572,20 @@ function gmedia_add_media_terms()
|
|
574 |
|
575 |
<div class="panel panel-default">
|
576 |
<div class="panel-heading clearfix">
|
577 |
-
|
578 |
-
<
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
<?php echo $gmDB->query_pager(); ?>
|
592 |
-
<?php } ?>
|
593 |
|
594 |
<div class="btn-group" style="margin-right:20px;">
|
595 |
<a class="btn btn<?php echo ('gmedia_album' == $taxonomy) ? "-primary active" : '-default'; ?>"
|
@@ -612,7 +608,6 @@ function gmedia_add_media_terms()
|
|
612 |
if (count($gmediaTerms)) {
|
613 |
$author = $gmCore->caps['gmedia_show_others_media'] ? 0 : $user_ID;
|
614 |
$allow_edit = $gmCore->caps['gmedia_edit_others_media'];
|
615 |
-
$gmediaCategories = $gmGallery->options['taxonomies']['gmedia_category'];
|
616 |
foreach ($gmediaTerms as $item) {
|
617 |
$author_name = $owner = '';
|
618 |
$list_row_class = $row_class = '';
|
@@ -673,9 +668,6 @@ function gmedia_add_media_terms()
|
|
673 |
$args = array('cache_results' => false, 'no_found_rows' => true, 'per_page' => $per_page);
|
674 |
$args = array_merge($args, $term_query);
|
675 |
$termItems = $gmDB->get_gmedias($args);
|
676 |
-
} elseif ('gmedia_category' == $taxonomy) {
|
677 |
-
$item_name = $gmediaCategories[$item_name];
|
678 |
-
$allow_edit = false;
|
679 |
}
|
680 |
|
681 |
if ($item->count) {
|
@@ -1111,7 +1103,7 @@ function gmedia_add_media_library()
|
|
1111 |
function gmedia_add_media_upload()
|
1112 |
{
|
1113 |
|
1114 |
-
global $gmCore, $gmDB, $gmProcessor, $
|
1115 |
|
1116 |
if (! current_user_can('gmedia_upload')) {
|
1117 |
_e('You do not have permissions to upload media', 'grand-media');
|
@@ -1124,7 +1116,6 @@ function gmedia_add_media_upload()
|
|
1124 |
$maxupsize_mb = floor($maxupsize / 1024 / 1024);
|
1125 |
|
1126 |
$gm_screen_options = $gmProcessor->user_options;
|
1127 |
-
$gm_terms = array();
|
1128 |
|
1129 |
?>
|
1130 |
<div class="panel panel-default">
|
@@ -1264,26 +1255,6 @@ function gmedia_add_media_upload()
|
|
1264 |
<hr/>
|
1265 |
|
1266 |
<?php if ($gmCore->caps['gmedia_terms']) { ?>
|
1267 |
-
<div class="form-group">
|
1268 |
-
<?php
|
1269 |
-
$term_type = 'gmedia_category';
|
1270 |
-
$gm_terms = $gmGallery->options['taxonomies'][$term_type];
|
1271 |
-
|
1272 |
-
$terms_category = '';
|
1273 |
-
if (count($gm_terms)) {
|
1274 |
-
foreach ($gm_terms as $term_name => $term_title) {
|
1275 |
-
$terms_category .= '<option value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
|
1276 |
-
}
|
1277 |
-
}
|
1278 |
-
?>
|
1279 |
-
<label><?php _e('Assign Category', 'grand-media'); ?>
|
1280 |
-
<small><?php _e('(for images only)') ?></small>
|
1281 |
-
</label>
|
1282 |
-
<select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
|
1283 |
-
<option value=""><?php _e('Uncategorized', 'grand-media'); ?></option>
|
1284 |
-
<?php echo $terms_category; ?>
|
1285 |
-
</select>
|
1286 |
-
</div>
|
1287 |
<div class="form-group">
|
1288 |
<?php
|
1289 |
$term_type = 'gmedia_album';
|
@@ -1302,59 +1273,100 @@ function gmedia_add_media_upload()
|
|
1302 |
<?php echo $terms_album; ?>
|
1303 |
</select>
|
1304 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1305 |
<div class="form-group">
|
1306 |
<?php
|
1307 |
$term_type = 'gmedia_tag';
|
1308 |
-
$
|
1309 |
?>
|
1310 |
<label><?php _e('Add Tags', 'grand-media'); ?> </label>
|
1311 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
1312 |
</div>
|
1313 |
<div class="addtags-gap"> </div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1314 |
<?php } else { ?>
|
1315 |
<p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
|
1316 |
<?php } ?>
|
1317 |
|
1318 |
-
<!--suppress JSDuplicatedDeclaration -->
|
1319 |
<script type="text/javascript">
|
1320 |
jQuery(function ($) {
|
1321 |
-
<?php if($gmCore->caps['gmedia_terms']){ ?>
|
1322 |
-
$('#combobox_gmedia_album').selectize({
|
1323 |
-
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
1324 |
-
create: true,
|
1325 |
-
createOnBlur: true,
|
1326 |
-
<?php } else{ ?>
|
1327 |
-
create: false,
|
1328 |
-
<?php } ?>
|
1329 |
-
persist: false
|
1330 |
-
});
|
1331 |
-
var gm_terms = <?php echo json_encode($gm_terms); ?>;
|
1332 |
-
//noinspection JSUnusedAssignment
|
1333 |
-
var items = gm_terms.map(function (x) {
|
1334 |
-
return {item: x};
|
1335 |
-
});
|
1336 |
-
$('#combobox_gmedia_tag').selectize({
|
1337 |
-
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
1338 |
-
create: function (input) {
|
1339 |
-
return {
|
1340 |
-
item: input
|
1341 |
-
}
|
1342 |
-
},
|
1343 |
-
createOnBlur: true,
|
1344 |
-
<?php } else{ ?>
|
1345 |
-
create: false,
|
1346 |
-
<?php } ?>
|
1347 |
-
delimiter: ',',
|
1348 |
-
maxItems: null,
|
1349 |
-
openOnFocus: false,
|
1350 |
-
persist: false,
|
1351 |
-
options: items,
|
1352 |
-
labelField: 'item',
|
1353 |
-
valueField: 'item',
|
1354 |
-
searchField: ['item'],
|
1355 |
-
hideSelected: true
|
1356 |
-
});
|
1357 |
-
<?php } ?>
|
1358 |
$('#uploader_runtime select').change(function () {
|
1359 |
if ('html4' == $(this).val()) {
|
1360 |
$('#uploader_chunking').addClass('hide');
|
359 |
if ('gmedia_category' == $tax_tabs) {
|
360 |
_e('Categories', 'grand-media');
|
361 |
foreach ($tabs as $t) {
|
362 |
+
$terms_source[] = sprintf('<a class="gm_category" target="_blank" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $t->term_id), $lib_url)), esc_html($t->name));
|
363 |
}
|
364 |
} elseif ('gmedia_album' == $tax_tabs) {
|
365 |
_e('Albums', 'grand-media');
|
500 |
}
|
501 |
}
|
502 |
break;
|
503 |
+
case 'gmedia_category':
|
504 |
case 'gmedia_tag':
|
505 |
if ('global' == $args['orderby']) {
|
506 |
$args['orderby'] = 'id';
|
507 |
}
|
508 |
break;
|
|
|
|
|
|
|
509 |
case 'gmedia_filter':
|
510 |
$args['hide_empty'] = 0;
|
511 |
$args['global'] = $gmCore->_get('author', $gmCore->caps['gmedia_edit_others_media'] ? '' : array(0, $user_ID));
|
572 |
|
573 |
<div class="panel panel-default">
|
574 |
<div class="panel-heading clearfix">
|
575 |
+
<form class="form-inline gmedia-search-form" role="search" method="get">
|
576 |
+
<div class="form-group">
|
577 |
+
<?php foreach ($_GET as $key => $value) {
|
578 |
+
if (in_array($key, array('chromeless', 'post_id', 'tab', 'orderby', 'order', 'number', 'global'))) {
|
579 |
+
?>
|
580 |
+
<input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
|
581 |
+
<?php
|
582 |
+
}
|
583 |
+
} ?>
|
584 |
+
<input id="gmedia-search" class="form-control input-sm" type="text" name="s" placeholder="<?php _e('Search...', 'grand-media'); ?>" value="<?php echo $gmCore->_get('s', ''); ?>"/>
|
585 |
+
</div>
|
586 |
+
<button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span></button>
|
587 |
+
</form>
|
588 |
+
<?php echo $gmDB->query_pager(); ?>
|
|
|
|
|
589 |
|
590 |
<div class="btn-group" style="margin-right:20px;">
|
591 |
<a class="btn btn<?php echo ('gmedia_album' == $taxonomy) ? "-primary active" : '-default'; ?>"
|
608 |
if (count($gmediaTerms)) {
|
609 |
$author = $gmCore->caps['gmedia_show_others_media'] ? 0 : $user_ID;
|
610 |
$allow_edit = $gmCore->caps['gmedia_edit_others_media'];
|
|
|
611 |
foreach ($gmediaTerms as $item) {
|
612 |
$author_name = $owner = '';
|
613 |
$list_row_class = $row_class = '';
|
668 |
$args = array('cache_results' => false, 'no_found_rows' => true, 'per_page' => $per_page);
|
669 |
$args = array_merge($args, $term_query);
|
670 |
$termItems = $gmDB->get_gmedias($args);
|
|
|
|
|
|
|
671 |
}
|
672 |
|
673 |
if ($item->count) {
|
1103 |
function gmedia_add_media_upload()
|
1104 |
{
|
1105 |
|
1106 |
+
global $gmCore, $gmDB, $gmProcessor, $user_ID;
|
1107 |
|
1108 |
if (! current_user_can('gmedia_upload')) {
|
1109 |
_e('You do not have permissions to upload media', 'grand-media');
|
1116 |
$maxupsize_mb = floor($maxupsize / 1024 / 1024);
|
1117 |
|
1118 |
$gm_screen_options = $gmProcessor->user_options;
|
|
|
1119 |
|
1120 |
?>
|
1121 |
<div class="panel panel-default">
|
1255 |
<hr/>
|
1256 |
|
1257 |
<?php if ($gmCore->caps['gmedia_terms']) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1258 |
<div class="form-group">
|
1259 |
<?php
|
1260 |
$term_type = 'gmedia_album';
|
1273 |
<?php echo $terms_album; ?>
|
1274 |
</select>
|
1275 |
</div>
|
1276 |
+
|
1277 |
+
<div class="form-group">
|
1278 |
+
<?php
|
1279 |
+
$term_type = 'gmedia_category';
|
1280 |
+
$gm_cat_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
|
1281 |
+
?>
|
1282 |
+
<label><?php _e('Assign Categories', 'grand-media'); ?></label>
|
1283 |
+
<input id="combobox_gmedia_category" name="terms[gmedia_category]" class="form-control input-sm" value="" placeholder="<?php _e('Uncategorized', 'grand-media'); ?>"/>
|
1284 |
+
</div>
|
1285 |
+
|
1286 |
<div class="form-group">
|
1287 |
<?php
|
1288 |
$term_type = 'gmedia_tag';
|
1289 |
+
$gm_tag_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
|
1290 |
?>
|
1291 |
<label><?php _e('Add Tags', 'grand-media'); ?> </label>
|
1292 |
<input id="combobox_gmedia_tag" name="terms[gmedia_tag]" class="form-control input-sm" value="" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
|
1293 |
</div>
|
1294 |
<div class="addtags-gap"> </div>
|
1295 |
+
|
1296 |
+
<script type="text/javascript">
|
1297 |
+
jQuery(function ($) {
|
1298 |
+
$('#combobox_gmedia_album').selectize({
|
1299 |
+
<?php if($gmCore->caps['gmedia_album_manage']){ ?>
|
1300 |
+
create: true,
|
1301 |
+
createOnBlur: true,
|
1302 |
+
<?php } else{ ?>
|
1303 |
+
create: false,
|
1304 |
+
<?php } ?>
|
1305 |
+
persist: false
|
1306 |
+
});
|
1307 |
+
|
1308 |
+
var gm_cat_terms = <?php echo json_encode($gm_cat_terms); ?>;
|
1309 |
+
//noinspection JSUnusedAssignment
|
1310 |
+
var cat_items = gm_cat_terms.map(function(x) {
|
1311 |
+
return {item: x};
|
1312 |
+
});
|
1313 |
+
//noinspection JSDuplicatedDeclaration
|
1314 |
+
$('#combobox_gmedia_category').selectize({
|
1315 |
+
<?php if($gmCore->caps['gmedia_category_manage']){ ?>
|
1316 |
+
create: function(input) {
|
1317 |
+
return {
|
1318 |
+
item: input
|
1319 |
+
}
|
1320 |
+
},
|
1321 |
+
createOnBlur: true,
|
1322 |
+
<?php } else{ ?>
|
1323 |
+
create: false,
|
1324 |
+
<?php } ?>
|
1325 |
+
delimiter: ',',
|
1326 |
+
maxItems: null,
|
1327 |
+
openOnFocus: false,
|
1328 |
+
persist: false,
|
1329 |
+
options: cat_items,
|
1330 |
+
labelField: 'item',
|
1331 |
+
valueField: 'item',
|
1332 |
+
searchField: ['item'],
|
1333 |
+
hideSelected: true
|
1334 |
+
});
|
1335 |
+
|
1336 |
+
var gm_tag_terms = <?php echo json_encode($gm_tag_terms); ?>;
|
1337 |
+
//noinspection JSUnusedAssignment
|
1338 |
+
var tag_items = gm_tag_terms.map(function (x) {
|
1339 |
+
return {item: x};
|
1340 |
+
});
|
1341 |
+
$('#combobox_gmedia_tag').selectize({
|
1342 |
+
<?php if($gmCore->caps['gmedia_tag_manage']){ ?>
|
1343 |
+
create: function (input) {
|
1344 |
+
return {
|
1345 |
+
item: input
|
1346 |
+
}
|
1347 |
+
},
|
1348 |
+
createOnBlur: true,
|
1349 |
+
<?php } else{ ?>
|
1350 |
+
create: false,
|
1351 |
+
<?php } ?>
|
1352 |
+
delimiter: ',',
|
1353 |
+
maxItems: null,
|
1354 |
+
openOnFocus: false,
|
1355 |
+
persist: false,
|
1356 |
+
options: tag_items,
|
1357 |
+
labelField: 'item',
|
1358 |
+
valueField: 'item',
|
1359 |
+
searchField: ['item'],
|
1360 |
+
hideSelected: true
|
1361 |
+
});
|
1362 |
+
});
|
1363 |
+
</script>
|
1364 |
<?php } else { ?>
|
1365 |
<p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
|
1366 |
<?php } ?>
|
1367 |
|
|
|
1368 |
<script type="text/javascript">
|
1369 |
jQuery(function ($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1370 |
$('#uploader_runtime select').change(function () {
|
1371 |
if ('html4' == $(this).val()) {
|
1372 |
$('#uploader_chunking').addClass('hide');
|
inc/shortcodes.php
CHANGED
@@ -211,11 +211,7 @@ function gmedia_shortcode($atts, $content = '')
|
|
211 |
$terms[$term_id] = $gmDB->get_term($term_id, $tax);
|
212 |
if (! empty($terms[$term_id]) && ! is_wp_error($terms[$term_id])) {
|
213 |
if ($terms[$term_id]->count) {
|
214 |
-
if ('
|
215 |
-
$terms[$term_id]->name = $gmGallery->options['taxonomies']['gmedia_category'][$terms[$term_id]->name];
|
216 |
-
$args = array('category__in' => $term_id, 'orderby' => $gmGallery->options['in_category_orderby'], 'order' => $gmGallery->options['in_category_order'], 'status' => $gmedia_status);
|
217 |
-
$gmedia[$term_id] = $gmDB->get_gmedias($args);
|
218 |
-
} elseif ('gmedia_album' == $tax) {
|
219 |
if (('draft' == $terms[$term_id]->status) || (('private' == $terms[$term_id]->status) && ! is_user_logged_in())) {
|
220 |
unset($terms[$term_id]);
|
221 |
continue;
|
@@ -225,6 +221,9 @@ function gmedia_shortcode($atts, $content = '')
|
|
225 |
$term_meta = array_merge(array('_orderby' => 'ID', '_order' => 'DESC'), $term_meta);
|
226 |
$args = array('album__in' => $term_id, 'orderby' => $term_meta['_orderby'], 'order' => $term_meta['_order'], 'status' => $gmedia_status);
|
227 |
$gmedia[$term_id] = $gmDB->get_gmedias($args);
|
|
|
|
|
|
|
228 |
} elseif ('gmedia_tag' == $tax) {
|
229 |
$args = array('tag__in' => $term_id, 'orderby' => $gmGallery->options['in_tag_orderby'], 'order' => $gmGallery->options['in_tag_order'], 'status' => $gmedia_status);
|
230 |
$gmedia[$term_id] = $gmDB->get_gmedias($args);
|
211 |
$terms[$term_id] = $gmDB->get_term($term_id, $tax);
|
212 |
if (! empty($terms[$term_id]) && ! is_wp_error($terms[$term_id])) {
|
213 |
if ($terms[$term_id]->count) {
|
214 |
+
if ('gmedia_album' == $tax) {
|
|
|
|
|
|
|
|
|
215 |
if (('draft' == $terms[$term_id]->status) || (('private' == $terms[$term_id]->status) && ! is_user_logged_in())) {
|
216 |
unset($terms[$term_id]);
|
217 |
continue;
|
221 |
$term_meta = array_merge(array('_orderby' => 'ID', '_order' => 'DESC'), $term_meta);
|
222 |
$args = array('album__in' => $term_id, 'orderby' => $term_meta['_orderby'], 'order' => $term_meta['_order'], 'status' => $gmedia_status);
|
223 |
$gmedia[$term_id] = $gmDB->get_gmedias($args);
|
224 |
+
} elseif ('gmedia_category' == $tax) {
|
225 |
+
$args = array('category__in' => $term_id, 'orderby' => $gmGallery->options['in_category_orderby'], 'order' => $gmGallery->options['in_category_order'], 'status' => $gmedia_status);
|
226 |
+
$gmedia[$term_id] = $gmDB->get_gmedias($args);
|
227 |
} elseif ('gmedia_tag' == $tax) {
|
228 |
$args = array('tag__in' => $term_id, 'orderby' => $gmGallery->options['in_tag_orderby'], 'order' => $gmGallery->options['in_tag_order'], 'status' => $gmedia_status);
|
229 |
$gmedia[$term_id] = $gmDB->get_gmedias($args);
|
module/afflux/index.php
CHANGED
@@ -3,7 +3,7 @@ $module_info = array(
|
|
3 |
'base' => 'afflux',
|
4 |
'name' => 'afflux',
|
5 |
'title' => 'Afflux',
|
6 |
-
'version' => '3.
|
7 |
'author' => 'CodEasily.com',
|
8 |
'description' => 'A Free Gallery Skin that supports thumbnails size change, color change, captions and autoplay. Responsive and mobile friendly gallery.',
|
9 |
'type' => 'gallery',
|
3 |
'base' => 'afflux',
|
4 |
'name' => 'afflux',
|
5 |
'title' => 'Afflux',
|
6 |
+
'version' => '3.9',
|
7 |
'author' => 'CodEasily.com',
|
8 |
'description' => 'A Free Gallery Skin that supports thumbnails size change, color change, captions and autoplay. Responsive and mobile friendly gallery.',
|
9 |
'type' => 'gallery',
|
module/afflux/js/jquery.gmAfflux.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*
|
2 |
* Title : Afflux Gallery Module
|
3 |
-
* Version : 3.
|
4 |
* Copyright : 2013-2015 CodEasily.com
|
5 |
* Website : http://www.codeasily.com
|
6 |
*/
|
@@ -39,7 +39,7 @@ if (typeof jQuery.fn.gmAfflux == 'undefined') {
|
|
39 |
'postID': 0
|
40 |
},
|
41 |
bool = {
|
42 |
-
'lockheight':
|
43 |
'autoSlideshow': true,
|
44 |
'descrVisOnMouseover': true,
|
45 |
'loveLink': false,
|
1 |
/*
|
2 |
* Title : Afflux Gallery Module
|
3 |
+
* Version : 3.9
|
4 |
* Copyright : 2013-2015 CodEasily.com
|
5 |
* Website : http://www.codeasily.com
|
6 |
*/
|
39 |
'postID': 0
|
40 |
},
|
41 |
bool = {
|
42 |
+
'lockheight': true,
|
43 |
'autoSlideshow': true,
|
44 |
'descrVisOnMouseover': true,
|
45 |
'loveLink': false,
|
module/minima/index.php
CHANGED
@@ -3,7 +3,7 @@ $module_info = array(
|
|
3 |
'base' => 'minima',
|
4 |
'name' => 'minima',
|
5 |
'title' => 'Minima',
|
6 |
-
'version' => '2.
|
7 |
'author' => 'CodEasily.com',
|
8 |
'description' => 'Multi-tab professional image gallery skin with slideshow feature. This is the free light version of <a target="_blank" href="http://codeasily.com/portfolio-item/gmedia-optima/">Optima Module</a>.',
|
9 |
'type' => 'gallery',
|
3 |
'base' => 'minima',
|
4 |
'name' => 'minima',
|
5 |
'title' => 'Minima',
|
6 |
+
'version' => '2.9',
|
7 |
'author' => 'CodEasily.com',
|
8 |
'description' => 'Multi-tab professional image gallery skin with slideshow feature. This is the free light version of <a target="_blank" href="http://codeasily.com/portfolio-item/gmedia-optima/">Optima Module</a>.',
|
9 |
'type' => 'gallery',
|
module/minima/js/jquery.gmMinima.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*
|
2 |
* Title : Minima Gallery Module
|
3 |
-
* Version : 2.
|
4 |
* Copyright : 2013-2015 CodEasily.com
|
5 |
* Website : http://www.codeasily.com
|
6 |
*/
|
@@ -40,7 +40,7 @@ if (typeof jQuery.fn.gmMinima == 'undefined') {
|
|
40 |
'postID': 0
|
41 |
},
|
42 |
bool = {
|
43 |
-
'lockheight':
|
44 |
'autoSlideshow': true, /* autoSlideshow */
|
45 |
'counterStatus': true, /* counterStatus */
|
46 |
'hitcounter': false,
|
1 |
/*
|
2 |
* Title : Minima Gallery Module
|
3 |
+
* Version : 2.9
|
4 |
* Copyright : 2013-2015 CodEasily.com
|
5 |
* Website : http://www.codeasily.com
|
6 |
*/
|
40 |
'postID': 0
|
41 |
},
|
42 |
bool = {
|
43 |
+
'lockheight': true,
|
44 |
'autoSlideshow': true, /* autoSlideshow */
|
45 |
'counterStatus': true, /* counterStatus */
|
46 |
'hitcounter': false,
|
module/minima/settings.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
$default_options = array(
|
3 |
'maxwidth' => '0',
|
4 |
-
'lockheight' => '
|
5 |
'height' => '500',
|
6 |
'maxheight' => '0',
|
7 |
'autoSlideshow' => '1',
|
1 |
<?php
|
2 |
$default_options = array(
|
3 |
'maxwidth' => '0',
|
4 |
+
'lockheight' => '1',
|
5 |
'height' => '500',
|
6 |
'maxheight' => '0',
|
7 |
'autoSlideshow' => '1',
|
readme.txt
CHANGED
@@ -135,6 +135,12 @@ Use [Gmedia Gallery support forum](http://codeasily.com/community/forum/gmedia-g
|
|
135 |
= Modules Updated =
|
136 |
* Go to Gmedia Modules page and update installed premium modules to latest versions
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 1.8.10 =
|
139 |
* Added: Stack for Gmedia Items
|
140 |
* New: Selected items now cleared automatically after Action
|
135 |
= Modules Updated =
|
136 |
* Go to Gmedia Modules page and update installed premium modules to latest versions
|
137 |
|
138 |
+
= 1.8.12 =
|
139 |
+
* New: Ability to create own categories
|
140 |
+
* New: Ability to assign few categories to one item
|
141 |
+
* New: Ability to assign categories to non images
|
142 |
+
* Added: New capability for managing categories
|
143 |
+
|
144 |
= 1.8.10 =
|
145 |
* Added: Stack for Gmedia Items
|
146 |
* New: Selected items now cleared automatically after Action
|
template/functions.php
CHANGED
@@ -116,11 +116,8 @@ function gmedia_title($sep = '|', $display = true)
|
|
116 |
|
117 |
$_title = __('GmediaGallery', 'grand-media');
|
118 |
if (is_object($gmedia) && ! is_wp_error($gmedia)) {
|
119 |
-
if (in_array($gmedia_type, array('gallery', 'album', 'tag', 'filter'))) {
|
120 |
$_title = $gmedia->name;
|
121 |
-
} elseif ('category' == $gmedia_type) {
|
122 |
-
$gm_terms_all = $gmGallery->options['taxonomies']['gmedia_category'];
|
123 |
-
$_title = $gm_terms_all[$gmedia->name];
|
124 |
} elseif ('single' == $gmedia_type) {
|
125 |
$_title = $gmedia->title;
|
126 |
}
|
@@ -161,11 +158,8 @@ function the_gmedia_title($return = false)
|
|
161 |
|
162 |
$title = __('GmediaGallery', 'grand-media');
|
163 |
if (is_object($gmedia) && ! is_wp_error($gmedia)) {
|
164 |
-
if (in_array($gmedia_type, array('gallery', 'album', 'tag', 'filter'))) {
|
165 |
$title = $gmedia->name;
|
166 |
-
} elseif ('category' == $gmedia_type) {
|
167 |
-
$gm_terms_all = $gmGallery->options['taxonomies']['gmedia_category'];
|
168 |
-
$title = $gm_terms_all[$gmedia->name];
|
169 |
} elseif ('single' == $gmedia_type) {
|
170 |
$title = $gmedia->title;
|
171 |
}
|
116 |
|
117 |
$_title = __('GmediaGallery', 'grand-media');
|
118 |
if (is_object($gmedia) && ! is_wp_error($gmedia)) {
|
119 |
+
if (in_array($gmedia_type, array('gallery', 'album', 'category', 'tag', 'filter'))) {
|
120 |
$_title = $gmedia->name;
|
|
|
|
|
|
|
121 |
} elseif ('single' == $gmedia_type) {
|
122 |
$_title = $gmedia->title;
|
123 |
}
|
158 |
|
159 |
$title = __('GmediaGallery', 'grand-media');
|
160 |
if (is_object($gmedia) && ! is_wp_error($gmedia)) {
|
161 |
+
if (in_array($gmedia_type, array('gallery', 'album', 'category', 'tag', 'filter'))) {
|
162 |
$title = $gmedia->name;
|
|
|
|
|
|
|
163 |
} elseif ('single' == $gmedia_type) {
|
164 |
$title = $gmedia->title;
|
165 |
}
|