Gmedia Photo Gallery - Version 1.8.94

Version Description

Download this release

Release Info

Developer pasyuk
Plugin Icon 128x128 Gmedia Photo Gallery
Version 1.8.94
Comparing to
See all releases

Code changes from version 1.8.80 to 1.8.94

Files changed (121) hide show
  1. admin/admin.php +63 -22
  2. admin/ajax.php +80 -33
  3. admin/app.php +82 -27
  4. admin/assets/css/gmedia.admin.css +148 -123
  5. admin/assets/img/application.png +0 -0
  6. admin/assets/img/archive.png +0 -0
  7. admin/assets/img/audio.png +0 -0
  8. admin/assets/img/clicked.png +0 -0
  9. admin/assets/img/code.png +0 -0
  10. admin/assets/img/default.png +0 -0
  11. admin/assets/img/document.png +0 -0
  12. admin/assets/img/gm-icon.png +0 -0
  13. admin/assets/img/grand_icon.png +0 -0
  14. admin/assets/img/icon-128x128.png +0 -0
  15. admin/assets/img/icon.png +0 -0
  16. admin/assets/img/icon_edit.png +0 -0
  17. admin/assets/img/interactive.png +0 -0
  18. admin/assets/img/metabox.png +0 -0
  19. admin/assets/img/pdf.png +0 -0
  20. admin/assets/img/refresh.png +0 -0
  21. admin/assets/img/reload.png +0 -0
  22. admin/assets/img/slide1.jpg +0 -0
  23. admin/assets/img/slide2.jpg +0 -0
  24. admin/assets/img/slide3.jpg +0 -0
  25. admin/assets/img/slide4.jpg +0 -0
  26. admin/assets/img/slide5.jpg +0 -0
  27. admin/assets/img/slide6.jpg +0 -0
  28. admin/assets/img/social-footer.png +0 -0
  29. admin/assets/img/spreadsheet.png +0 -0
  30. admin/assets/img/text.png +0 -0
  31. admin/assets/img/throbber.gif +0 -0
  32. admin/assets/img/video.png +0 -0
  33. admin/assets/js/gmedia.admin.js +253 -95
  34. admin/class.processor.php +80 -16
  35. admin/functions.php +0 -147
  36. admin/pages/addmedia/tpl/assign-terms.php +15 -8
  37. admin/pages/addmedia/tpl/panel-heading.php +3 -3
  38. admin/pages/galleries/edit-gallery.php +5 -4
  39. admin/pages/galleries/functions.php +3 -78
  40. admin/pages/galleries/galleries.php +1 -15
  41. admin/pages/galleries/tpl/choose-module.php +1 -1
  42. admin/pages/galleries/tpl/galleries-panel-heading.php +12 -9
  43. admin/pages/galleries/tpl/gallery-edit-item.php +22 -12
  44. admin/pages/galleries/tpl/gallery-list-item.php +3 -5
  45. admin/pages/galleries/tpl/gallery-panel-heading.php +24 -10
  46. admin/pages/galleries/tpl/modal-build-query.php +21 -13
  47. admin/pages/galleries/tpl/module-settings.php +2 -2
  48. admin/pages/library/functions.php +56 -97
  49. admin/pages/library/library.php +41 -8
  50. admin/pages/library/tpl/edit-item.php +84 -66
  51. admin/pages/library/tpl/grid-item.php +17 -11
  52. admin/pages/library/tpl/list-item.php +11 -11
  53. admin/pages/library/tpl/no-items.php +9 -3
  54. admin/pages/library/tpl/panel-heading.php +162 -137
  55. admin/pages/modules/edit-preset.php +1 -1
  56. admin/pages/modules/modules.php +43 -41
  57. admin/pages/modules/tpl/module-item.php +1 -1
  58. admin/pages/modules/tpl/module-preset-edit-item.php +2 -2
  59. admin/pages/settings/tpl/common.php +11 -0
  60. admin/pages/settings/tpl/permalinks.php +2 -2
  61. admin/pages/settings/tpl/roles.php +1 -1
  62. admin/pages/terms/edit-term.php +4 -4
  63. admin/pages/terms/functions.php +99 -107
  64. admin/pages/terms/terms.php +1 -15
  65. admin/pages/terms/tpl/album-create-item.php +45 -32
  66. admin/pages/terms/tpl/album-edit-item.php +82 -25
  67. admin/pages/terms/tpl/album-list-item.php +6 -8
  68. admin/pages/terms/tpl/album-sort-gmedia.php +0 -193
  69. admin/pages/terms/tpl/category-create-item.php +16 -1
  70. admin/pages/terms/tpl/category-edit-item.php +35 -14
  71. admin/pages/terms/tpl/category-list-item.php +5 -7
  72. admin/pages/terms/tpl/category-preview-gmedia.php +0 -59
  73. admin/pages/terms/tpl/tag-list-item.php +6 -5
  74. admin/pages/terms/tpl/term-panel-heading.php +52 -7
  75. admin/pages/terms/tpl/terms-panel-heading.php +13 -10
  76. admin/processor/class.processor.addmedia.php +10 -2
  77. admin/processor/class.processor.galleries.php +46 -17
  78. admin/processor/class.processor.library.php +524 -324
  79. admin/processor/class.processor.modules.php +15 -2
  80. admin/processor/class.processor.settings.php +10 -2
  81. admin/processor/class.processor.terms.php +138 -140
  82. admin/processor/class.processor.wpmedia.php +11 -3
  83. admin/tpl/comments.php +1 -1
  84. admin/tpl/modal-share.php +2 -2
  85. admin/tpl/search-form.php +11 -6
  86. admin/wpmedia.php +23 -22
  87. assets/fancybox/jquery.fancybox-1.3.4.pack.js +1 -46
  88. assets/jq-plugins/jquery.tinysort.js +0 -289
  89. assets/swiper/LICENSE +20 -0
  90. assets/swiper/swiper.jquery.min.js +18 -0
  91. assets/swiper/swiper.min.css +15 -0
  92. config/setup.php +13 -9
  93. config/update.php +8 -0
  94. grand-media.php +73 -23
  95. inc/core.php +91 -11
  96. inc/db.connect.php +199 -137
  97. inc/functions.php +388 -0
  98. inc/media-upload.php +57 -66
  99. inc/module.options.php +3 -3
  100. inc/permalinks.php +2 -2
  101. inc/post-metabox.php +1 -1
  102. inc/shortcodes.php +37 -15
  103. inc/sitemap.php +14 -12
  104. inc/widget.php +189 -0
  105. module/afflux/init.php +2 -2
  106. module/minima/init.php +2 -2
  107. module/phantom/css/style.css +362 -212
  108. module/phantom/index.php +16 -16
  109. module/phantom/init.php +330 -256
  110. module/phantom/js/jquery.gmPhantom.js +406 -464
  111. module/phantom/settings.php +368 -410
  112. module/photomania/css/styles.photomania.css +197 -190
  113. module/photomania/img/facebook@2x.png +0 -0
  114. module/photomania/img/google@2x.png +0 -0
  115. module/photomania/img/pinterest@2x.png +0 -0
  116. module/photomania/img/share@2x.png +0 -0
  117. module/photomania/img/stumbleupon@2x.png +0 -0
  118. module/photomania/img/twitter@2x.png +0 -0
  119. module/photomania/index.php +3 -2
  120. module/photomania/init.php +311 -158
  121. module/photomania/js/1-script.swiper.js +0 -16
admin/admin.php CHANGED
@@ -20,18 +20,20 @@ class GmediaAdmin{
20
 
21
  // Add the script and style files
22
  add_action('admin_enqueue_scripts', array(&$this, 'load_scripts'), 20);
 
23
 
24
  add_filter('screen_settings', array(&$this, 'screen_settings'), 10, 2);
25
  add_filter('set-screen-option', array(&$this, 'screen_settings_save'), 11, 3);
26
 
27
  if(isset($_GET['page']) && (false !== strpos($_GET['page'], 'GrandMedia'))){
 
28
 
29
  if(!isset($_GET['gmediablank']) || 'library' === $_GET['gmediablank']){
30
  $this->body_classes[] = $_GET['page'];
31
  if(!empty($_GET['mode'])){
32
  $this->body_classes[] = $_GET['page'] . '_' . $_GET['mode'];
33
  }
34
- if(isset($_GET['edit_item']) || isset($_GET['gallery_module']) || isset($_GET['preset'])){
35
  $this->body_classes[] = $_GET['page'] . '_edit';
36
  }
37
  }
@@ -124,9 +126,18 @@ class GmediaAdmin{
124
 
125
  // integrate the menu
126
  function add_menu(){
 
 
 
 
 
 
 
 
 
127
  $gmediaURL = plugins_url(GMEDIA_FOLDER);
128
  $this->pages = array();
129
- $this->pages[] = add_menu_page(__('Gmedia Library', 'grand-media'), 'Gmedia Gallery', 'gmedia_library', 'GrandMedia', array(&$this, 'shell'), $gmediaURL . '/admin/assets/img/gm-icon.png', 11);
130
  $this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Library', 'grand-media'), __('Gmedia Library', 'grand-media'), 'gmedia_library', 'GrandMedia', array(&$this, 'shell'));
131
  if(current_user_can('gmedia_library')){
132
  $this->pages[] = add_submenu_page('GrandMedia', __('Add Media Files', 'grand-media'), __('Add/Import Files', 'grand-media'), 'gmedia_upload', 'GrandMedia_AddMedia', array(&$this, 'shell'));
@@ -136,7 +147,7 @@ class GmediaAdmin{
136
  $this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Galleries', 'grand-media'), __('Galleries', 'grand-media'), 'gmedia_gallery_manage', 'GrandMedia_Galleries', array(&$this, 'shell'));
137
  $this->pages[] = add_submenu_page('GrandMedia', __('Modules', 'grand-media'), __('Modules', 'grand-media'), 'gmedia_gallery_manage', 'GrandMedia_Modules', array(&$this, 'shell'));
138
  $this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Settings', 'grand-media'), __('Settings', 'grand-media'), 'manage_options', 'GrandMedia_Settings', array(&$this, 'shell'));
139
- $this->pages[] = add_submenu_page('GrandMedia', __('Mobile Application', 'grand-media'), __('Mobile Application', 'grand-media'), 'gmedia_settings', 'GrandMedia_App', array(&$this, 'shell'));
140
  $this->pages[] = add_submenu_page('GrandMedia', __('Wordpress Media Library', 'grand-media'), __('WP Media Library', 'grand-media'), 'gmedia_import', 'GrandMedia_WordpressLibrary', array(&$this, 'shell'));
141
  }
142
 
@@ -237,14 +248,20 @@ class GmediaAdmin{
237
  $content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-premium" target="_blank" href="http://codeasily.com/product/one-site-license/">' . __('Get Gmedia Premium', 'grand-media') . '</a></li><li>';
238
  }
239
  foreach($submenu['GrandMedia'] as $menuKey => $menuItem){
240
- if($submenu['GrandMedia'][ $menuKey ][2] == $gmProcessor->page){
241
  $iscur = ' active';
242
- $content['grandTitle'] = $submenu['GrandMedia'][ $menuKey ][3];
243
  } else{
244
  $iscur = '';
245
  }
 
 
 
 
 
 
246
 
247
- $content['sideLinks'] .= "\n" . '<a class="list-group-item' . $iscur . '" href="' . admin_url('admin.php?page=' . $submenu['GrandMedia'][ $menuKey ][2]) . '">' . $submenu['GrandMedia'][ $menuKey ][0] . '</a>';
248
  }
249
  $content['sideLinks'] .= '
250
  </li></ul>
@@ -295,14 +312,14 @@ class GmediaAdmin{
295
  include_once(dirname(__FILE__) . '/pages/addmedia/addmedia.php');
296
  break;
297
  case 'GrandMedia_Albums':
298
- if(isset($_GET['edit_item'])){
299
  include_once(dirname(__FILE__) . '/pages/terms/edit-term.php');
300
  } else{
301
  include_once(dirname(__FILE__) . '/pages/terms/terms.php');
302
  }
303
  break;
304
  case 'GrandMedia_Categories':
305
- if(isset($_GET['edit_item'])){
306
  include_once(dirname(__FILE__) . '/pages/terms/edit-term.php');
307
  } else{
308
  include_once(dirname(__FILE__) . '/pages/terms/terms.php');
@@ -312,7 +329,7 @@ class GmediaAdmin{
312
  include_once(dirname(__FILE__) . '/pages/terms/terms.php');
313
  break;
314
  case 'GrandMedia_Galleries':
315
- if(isset($_GET['gallery_module']) || isset($_GET['edit_item'])){
316
  include_once(dirname(__FILE__) . '/pages/galleries/edit-gallery.php');
317
  } else{
318
  include_once(dirname(__FILE__) . '/pages/galleries/galleries.php');
@@ -352,7 +369,6 @@ class GmediaAdmin{
352
  */
353
  function load_scripts($hook){
354
  global $gmCore, $gmProcessor, $gmGallery;
355
-
356
  // no need to go on if it's not a plugin page
357
  if('admin.php' != $hook && strpos($gmCore->_get('page'), 'GrandMedia') === false){
358
  return;
@@ -420,11 +436,19 @@ class GmediaAdmin{
420
  }
421
  break;
422
  case "GrandMedia_Albums" :
423
- if(isset($_GET['edit_item']) && $gmCore->caps['gmedia_album_manage']){
424
- wp_enqueue_style('jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', array(), '1.10.2', 'screen');
425
- wp_enqueue_script('jquery-ui-full', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js', array(), '1.10.2');
426
-
427
- wp_enqueue_script('tinysort', $gmCore->gmedia_url . '/assets/jq-plugins/jquery.tinysort.js', array('jquery'), '1.5.6');
 
 
 
 
 
 
 
 
428
  }
429
  break;
430
  case "GrandMedia_AddMedia" :
@@ -453,7 +477,7 @@ class GmediaAdmin{
453
  // under construction
454
  break;
455
  case "GrandMedia_Galleries" :
456
- if($gmCore->caps['gmedia_gallery_manage'] && (isset($_GET['gallery_module']) || isset($_GET['edit_item']))){
457
 
458
  wp_enqueue_style('jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', array(), '1.10.2', 'screen');
459
  wp_enqueue_script('jquery-ui-resizable');
@@ -488,6 +512,10 @@ class GmediaAdmin{
488
 
489
  }
490
 
 
 
 
 
491
  function screen_help(){
492
  $screen = get_current_screen();
493
  $screen_id = explode('page_', $screen->id, 2);
@@ -562,10 +590,15 @@ class GmediaAdmin{
562
  <option' . selected($gm_screen_options['orderby_gmedia'], 'ID', false) . ' value="ID">' . __('ID', 'grand-media') . '</option>
563
  <option' . selected($gm_screen_options['orderby_gmedia'], 'title', false) . ' value="title">' . __('Title', 'grand-media') . '</option>
564
  <option' . selected($gm_screen_options['orderby_gmedia'], 'gmuid', false) . ' value="gmuid">' . __('Filename', 'grand-media') . '</option>
565
- <option' . selected($gm_screen_options['orderby_gmedia'], 'date', false) . ' value="date">' . __('Date', 'grand-media') . '</option>
566
- <option' . selected($gm_screen_options['orderby_gmedia'], 'modified', false) . ' value="modified">' . __('Last Modified', 'grand-media') . '</option>
567
  <option' . selected($gm_screen_options['orderby_gmedia'], 'mime_type', false) . ' value="mime_type">' . __('MIME Type', 'grand-media') . '</option>
568
  <option' . selected($gm_screen_options['orderby_gmedia'], 'author', false) . ' value="author">' . __('Author', 'grand-media') . '</option>
 
 
 
 
 
 
 
569
  </select> <span>' . __('order items', 'grand-media') . '</span>
570
  </div>
571
  <div class="form-group">
@@ -620,11 +653,11 @@ class GmediaAdmin{
620
  }
621
  break;
622
  case 'GrandMedia_Albums' :
623
- if(isset($_GET['edit_item'])){
624
  $settings = '
625
  <div class="form-inline pull-left">
626
  <div class="form-group">
627
- <input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_sort_gmedia]" class="form-control input-sm" style="width: 5em;" value="' . $gm_screen_options['per_page_sort_gmedia'] . '" /> <span>' . __('items per page', 'grand-media') . '</span>
628
  </div>
629
  </div>
630
  ';
@@ -653,7 +686,15 @@ class GmediaAdmin{
653
  }
654
  break;
655
  case 'GrandMedia_Categories' :
656
- if(!isset($_GET['edit_item'])){
 
 
 
 
 
 
 
 
657
  $settings = '
658
  <div class="form-inline pull-left">
659
  <div class="form-group">
@@ -699,7 +740,7 @@ class GmediaAdmin{
699
  ';
700
  break;
701
  case 'GrandMedia_Galleries' :
702
- if(!$gmCore->_get('edit_item') && !$gmCore->_get('gallery_module')){
703
  $settings = '
704
  <div class="form-inline pull-left">
705
  <div class="form-group">
20
 
21
  // Add the script and style files
22
  add_action('admin_enqueue_scripts', array(&$this, 'load_scripts'), 20);
23
+ add_action('admin_print_scripts-widgets.php', array(&$this, 'gmedia_widget_scripts'));
24
 
25
  add_filter('screen_settings', array(&$this, 'screen_settings'), 10, 2);
26
  add_filter('set-screen-option', array(&$this, 'screen_settings_save'), 11, 3);
27
 
28
  if(isset($_GET['page']) && (false !== strpos($_GET['page'], 'GrandMedia'))){
29
+ $this->body_classes[] = 'grand-media-admin-page';
30
 
31
  if(!isset($_GET['gmediablank']) || 'library' === $_GET['gmediablank']){
32
  $this->body_classes[] = $_GET['page'];
33
  if(!empty($_GET['mode'])){
34
  $this->body_classes[] = $_GET['page'] . '_' . $_GET['mode'];
35
  }
36
+ if(isset($_GET['edit_term']) || isset($_GET['gallery_module']) || isset($_GET['preset'])){
37
  $this->body_classes[] = $_GET['page'] . '_edit';
38
  }
39
  }
126
 
127
  // integrate the menu
128
  function add_menu(){
129
+
130
+ $count = '';
131
+ if(current_user_can('gmedia_module_manage')){
132
+ global $gmGallery;
133
+ if($gmGallery->options['modules_update']){
134
+ $count = " <span class='update-plugins count-{$gmGallery->options['modules_update']}'><span class='plugin-count gm-module-count'>" . $gmGallery->options['modules_update'] . "</span></span>";
135
+ }
136
+ }
137
+
138
  $gmediaURL = plugins_url(GMEDIA_FOLDER);
139
  $this->pages = array();
140
+ $this->pages[] = add_menu_page(__('Gmedia Library', 'grand-media'), "Gmedia{$count}", 'gmedia_library', 'GrandMedia', array(&$this, 'shell'), 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjAgMjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgeD0iMCIgeT0iMCIKICAgIHhsaW5rOmhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQlFBQUFBVUNBTUFBQUM2ViswL0FBQUFCR2RCVFVFQUFMR1BDL3hoQlFBQUFDQmpTRkpOCkFBQjZKZ0FBZ0lRQUFQb0FBQUNBNkFBQWRUQUFBT3BnQUFBNm1BQUFGM0NjdWxFOEFBQUJrbEJNVkVVeFpua3haM2d4WjNoQ2RJTnUKbEtBK2NZQnBrSjJRcmJhb3Y4YTV5OUdadEx5UnJyZG1qcHMzYTN4WmhKS0txYktPckxXcndjaW52c1dWc2JxM3l0Q1hzcnRWZ1k5UwpmNDZndWNGN25hZzdibjVFZFlWeGxxS01xclN3eGN1aHVzS2Z1TUMrejlSMm1xWTZibjZ1dzhyNy9QekYxTm0weU03dDh2UHo5dmVGCnBhL2Y1K3BiaHBSSWVJZCtvS3FOcTdTZHQ3OWhpcGN5YUhuSDF0clMzdUZIZDRiSzJOMzUrL3YzK2ZxOXp0UmFoWk5QZll5Qm9xeUMKbzYwOGIzOUdkb1poaTVoT2ZJdnE3L0dwdjhiLy8vLzIrUG45L2YzQjBkWkFjb0tZczd3emFIbSt6OVZxa1oxWGc1SFQzK0xZNHVaNgpuYWh3bGFGRGRJVFAzT0JLZVloTWU0bnc5UFhoNmV2eDlmYkwyZDFUZ0k1em1LTXphWHJUM3VLWXM3dlAyOS9WNE9PY3RyN2c2T3VVCnNMbE5mSXU0eTlEbzd2QkZkb1YzbTZibTdlODViWDNJMXR1RHBLN1EzT0JZaEpHUHJMWEMwdGVsdmNSSmVZamI1ZWpOMnQ1eWw2S1cKc3JyYjVPZUFvYXhqakpuZTUrbDJtcVhFMDlpSHByQnRrNTl5bDZOOG5xazRiSDNXNGVUVTMrUFIzZUdxd01jY1RNSnpBQUFBQW5SUwpUbE51MlhMaTRXRUFBQUFCWWt0SFJFVDV0SmpCQUFBQUNYQklXWE1BQUFzVEFBQUxFd0VBbXB3WUFBQUFCM1JKVFVVSDRBc0NDRGNJCmw0WXhCZ0FBQVIxSlJFRlVHTk5qWUdCa1FnT01ESmhpSUZFNGs1bUZGY2FFQzdLeGMzQnljZlB3SWd2eWNmRUxDQW9KYzRxSThvdEIKQmNVRkpDU2xtS1JsWklYbDVCVVVsVUNDeWlxcWF1b2FtbHJhT3N4TXVucjZCb1pBUVNOakUxTW1Kak56QzBzQkt5WW1hMTBiUHFDZwpyWWFkdllLRG81T3ppNnVidTRlOHA1QVhVTkJiMGNmWHo5OHVJRkNDS1VneE9NUk9DR2hScUdaWU9MTmRSR1JVZ0FFVGsxU0VYMVEwCkUwTk1ySGRjZklKVVlwSzdiRExRMHBUVXRIUW1ob3pNTEgzVGhPd2MzY3pjUExEelRMU1lHUElMbUR3S2k0cExtRXFUSWQ3Z0tHUmkKWUF1elk3SXJpeXV2cUlTSVNWVlZBeTJxQ2ErdERtU3BxMk1KckZkcXlNbjN5MjRFQ25weEp6UWxOUHZGeHBxMDVBWUh4N2Z5SW9VUwpNc0FleU5paUF3Q3FwalN3RnBqcGxnQUFBQ1YwUlZoMFpHRjBaVHBqY21WaGRHVUFNakF4TmkweE1TMHdNbFF3T0RvMU5Ub3dPQzB3Ck56b3dNSWl4dXBvQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNVFl0TVRFdE1ESlVNRGc2TlRVNk1EZ3RNRGM2TURENTdBSW0KQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==', 11);
141
  $this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Library', 'grand-media'), __('Gmedia Library', 'grand-media'), 'gmedia_library', 'GrandMedia', array(&$this, 'shell'));
142
  if(current_user_can('gmedia_library')){
143
  $this->pages[] = add_submenu_page('GrandMedia', __('Add Media Files', 'grand-media'), __('Add/Import Files', 'grand-media'), 'gmedia_upload', 'GrandMedia_AddMedia', array(&$this, 'shell'));
147
  $this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Galleries', 'grand-media'), __('Galleries', 'grand-media'), 'gmedia_gallery_manage', 'GrandMedia_Galleries', array(&$this, 'shell'));
148
  $this->pages[] = add_submenu_page('GrandMedia', __('Modules', 'grand-media'), __('Modules', 'grand-media'), 'gmedia_gallery_manage', 'GrandMedia_Modules', array(&$this, 'shell'));
149
  $this->pages[] = add_submenu_page('GrandMedia', __('Gmedia Settings', 'grand-media'), __('Settings', 'grand-media'), 'manage_options', 'GrandMedia_Settings', array(&$this, 'shell'));
150
+ $this->pages[] = add_submenu_page('GrandMedia', __('iOS Application', 'grand-media'), __('iOS Application', 'grand-media'), 'gmedia_settings', 'GrandMedia_App', array(&$this, 'shell'));
151
  $this->pages[] = add_submenu_page('GrandMedia', __('Wordpress Media Library', 'grand-media'), __('WP Media Library', 'grand-media'), 'gmedia_import', 'GrandMedia_WordpressLibrary', array(&$this, 'shell'));
152
  }
153
 
248
  $content['sideLinks'] .= "\n" . '<a class="list-group-item list-group-item-premium" target="_blank" href="http://codeasily.com/product/one-site-license/">' . __('Get Gmedia Premium', 'grand-media') . '</a></li><li>';
249
  }
250
  foreach($submenu['GrandMedia'] as $menuKey => $menuItem){
251
+ if($menuItem[2] == $gmProcessor->page){
252
  $iscur = ' active';
253
+ $content['grandTitle'] = $menuItem[3];
254
  } else{
255
  $iscur = '';
256
  }
257
+ $menuData = '';
258
+ if($menuItem[2] == 'GrandMedia_Modules' && gm_user_can('module_manage')){
259
+ if($gmGallery->options['modules_update']){
260
+ $menuData = '<span class="badge badge-error pull-right gm-module-count" title="' . __('Module Updates') . '">' . $gmGallery->options['modules_update'] . '</span>';
261
+ }
262
+ }
263
 
264
+ $content['sideLinks'] .= "\n" . '<a class="list-group-item' . $iscur . '" href="' . admin_url('admin.php?page=' . $menuItem[2]) . '">' . $menuItem[0] . $menuData . '</a>';
265
  }
266
  $content['sideLinks'] .= '
267
  </li></ul>
312
  include_once(dirname(__FILE__) . '/pages/addmedia/addmedia.php');
313
  break;
314
  case 'GrandMedia_Albums':
315
+ if(isset($_GET['edit_term'])){
316
  include_once(dirname(__FILE__) . '/pages/terms/edit-term.php');
317
  } else{
318
  include_once(dirname(__FILE__) . '/pages/terms/terms.php');
319
  }
320
  break;
321
  case 'GrandMedia_Categories':
322
+ if(isset($_GET['edit_term'])){
323
  include_once(dirname(__FILE__) . '/pages/terms/edit-term.php');
324
  } else{
325
  include_once(dirname(__FILE__) . '/pages/terms/terms.php');
329
  include_once(dirname(__FILE__) . '/pages/terms/terms.php');
330
  break;
331
  case 'GrandMedia_Galleries':
332
+ if(isset($_GET['gallery_module']) || isset($_GET['edit_term'])){
333
  include_once(dirname(__FILE__) . '/pages/galleries/edit-gallery.php');
334
  } else{
335
  include_once(dirname(__FILE__) . '/pages/galleries/galleries.php');
369
  */
370
  function load_scripts($hook){
371
  global $gmCore, $gmProcessor, $gmGallery;
 
372
  // no need to go on if it's not a plugin page
373
  if('admin.php' != $hook && strpos($gmCore->_get('page'), 'GrandMedia') === false){
374
  return;
436
  }
437
  break;
438
  case "GrandMedia_Albums" :
439
+ if(isset($_GET['edit_term'])){
440
+ if($gmCore->caps['gmedia_album_manage']){
441
+ wp_enqueue_style('jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', array(), '1.10.2', 'screen');
442
+ wp_enqueue_script('jquery-ui-full', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js', array(), '1.10.2');
443
+ }
444
+ wp_enqueue_style('selectize');
445
+ wp_enqueue_script('selectize');
446
+ }
447
+ break;
448
+ case "GrandMedia_Categories" :
449
+ if(isset($_GET['edit_term'])){
450
+ wp_enqueue_style('selectize');
451
+ wp_enqueue_script('selectize');
452
  }
453
  break;
454
  case "GrandMedia_AddMedia" :
477
  // under construction
478
  break;
479
  case "GrandMedia_Galleries" :
480
+ if($gmCore->caps['gmedia_gallery_manage'] && (isset($_GET['gallery_module']) || isset($_GET['edit_term']))){
481
 
482
  wp_enqueue_style('jquery-ui-smoothness', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css', array(), '1.10.2', 'screen');
483
  wp_enqueue_script('jquery-ui-resizable');
512
 
513
  }
514
 
515
+ function gmedia_widget_scripts(){
516
+
517
+ }
518
+
519
  function screen_help(){
520
  $screen = get_current_screen();
521
  $screen_id = explode('page_', $screen->id, 2);
590
  <option' . selected($gm_screen_options['orderby_gmedia'], 'ID', false) . ' value="ID">' . __('ID', 'grand-media') . '</option>
591
  <option' . selected($gm_screen_options['orderby_gmedia'], 'title', false) . ' value="title">' . __('Title', 'grand-media') . '</option>
592
  <option' . selected($gm_screen_options['orderby_gmedia'], 'gmuid', false) . ' value="gmuid">' . __('Filename', 'grand-media') . '</option>
 
 
593
  <option' . selected($gm_screen_options['orderby_gmedia'], 'mime_type', false) . ' value="mime_type">' . __('MIME Type', 'grand-media') . '</option>
594
  <option' . selected($gm_screen_options['orderby_gmedia'], 'author', false) . ' value="author">' . __('Author', 'grand-media') . '</option>
595
+ <option' . selected($gm_screen_options['orderby_gmedia'], 'date', false) . ' value="date">' . __('Date', 'grand-media') . '</option>
596
+ <option' . selected($gm_screen_options['orderby_gmedia'], 'modified', false) . ' value="modified">' . __('Last Modified', 'grand-media') . '</option>
597
+ <option' . selected($gm_screen_options['orderby_gmedia'], '_created_timestamp', false) . ' value="_created_timestamp">' . __('Created Timestamp', 'grand-media') . '</option>
598
+ <option' . selected($gm_screen_options['orderby_gmedia'], 'comment_count', false) . ' value="comment_count">' . __('Comment Count', 'grand-media') . '</option>
599
+ <option' . selected($gm_screen_options['orderby_gmedia'], 'views', false) . ' value="views">' . __('Views Count', 'grand-media') . '</option>
600
+ <option' . selected($gm_screen_options['orderby_gmedia'], 'likes', false) . ' value="likes">' . __('Likes Count', 'grand-media') . '</option>
601
+ <option' . selected($gm_screen_options['orderby_gmedia'], '_size', false) . ' value="_size">' . __('File Size', 'grand-media') . '</option>
602
  </select> <span>' . __('order items', 'grand-media') . '</span>
603
  </div>
604
  <div class="form-group">
653
  }
654
  break;
655
  case 'GrandMedia_Albums' :
656
+ if(isset($_GET['edit_term'])){
657
  $settings = '
658
  <div class="form-inline pull-left">
659
  <div class="form-group">
660
+ <input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_album_edit]" class="form-control input-sm" style="width: 5em;" value="' . $gm_screen_options['per_page_gmedia_album_edit'] . '" /> <span>' . __('items per page', 'grand-media') . '</span>
661
  </div>
662
  </div>
663
  ';
686
  }
687
  break;
688
  case 'GrandMedia_Categories' :
689
+ if(isset($_GET['edit_term'])){
690
+ $settings = '
691
+ <div class="form-inline pull-left">
692
+ <div class="form-group">
693
+ <input type="number" max="999" min="0" step="5" size="3" name="gm_screen_options[per_page_gmedia_category_edit]" class="form-control input-sm" style="width: 5em;" value="' . $gm_screen_options['per_page_gmedia_category_edit'] . '" /> <span>' . __('items per page', 'grand-media') . '</span>
694
+ </div>
695
+ </div>
696
+ ';
697
+ } else{
698
  $settings = '
699
  <div class="form-inline pull-left">
700
  <div class="form-group">
740
  ';
741
  break;
742
  case 'GrandMedia_Galleries' :
743
+ if(!$gmCore->_get('edit_term') && !$gmCore->_get('gallery_module')){
744
  $settings = '
745
  <div class="form-inline pull-left">
746
  <div class="form-group">
admin/ajax.php CHANGED
@@ -100,16 +100,25 @@ function gmedia_update_data(){
100
  } else{
101
  $result = $gmDB->get_gmedia($id);
102
  }
 
 
 
 
 
 
 
103
  if(current_user_can('gmedia_terms')){
104
- $tags = $gmDB->get_the_gmedia_terms($id, 'gmedia_tag');
105
- if($tags){
106
- $tags_list = array();
107
- foreach($tags as $tag){
108
- $tags_list[] = $tag->name;
109
- }
110
- $result->tags = implode(', ', $tags_list);
111
- }
112
  if(!empty($gmedia['terms']['gmedia_album'])){
 
 
 
 
 
 
 
 
 
 
113
  $alb_id = $gmedia['terms']['gmedia_album'];
114
  $alb = $gmDB->get_term($alb_id, 'gmedia_album');
115
  $result->album_status = $alb? $alb->status : 'none';
@@ -319,12 +328,13 @@ function gmedia_get_modal(){
319
  $button_class = 'btn-primary';
320
  $gm_terms = array();
321
  $modal = $gmCore->_post('modal');
 
322
  switch($modal){
323
  case 'quick_gallery':
324
  if(!current_user_can('gmedia_gallery_manage')){
325
  die('-1');
326
  }
327
- $ckey = "gmuser_{$user_ID}_library";
328
  $modal_title = __('Quick Gallery from selected items', 'grand-media');
329
  $modal_button = __('Create Quick Gallery', 'grand-media');
330
  break;
@@ -332,7 +342,7 @@ function gmedia_get_modal(){
332
  if(!current_user_can('gmedia_gallery_manage')){
333
  die('-1');
334
  }
335
- $ckey = "gmuser_{$user_ID}_library_stack";
336
  $modal_title = __('Quick Gallery from Stack', 'grand-media');
337
  $modal_button = __('Create Quick Gallery', 'grand-media');
338
  break;
@@ -434,7 +444,7 @@ function gmedia_get_modal(){
434
  case 'quick_gallery':
435
  case 'quick_gallery_stack':
436
  if(!empty($ckey)){
437
- $selected_in_library = isset($_COOKIE[ $ckey ])? $_COOKIE[ $ckey ] : '';
438
  }
439
  if(empty($selected_in_library)){
440
  _e('No selected Gmedia. Select at least one item in library.', 'grand-media');
@@ -444,7 +454,7 @@ function gmedia_get_modal(){
444
  ?>
445
  <div class="form-group">
446
  <label><?php _e('Gallery Name', 'grand-media'); ?></label>
447
- <input type="text" class="form-control input-sm" name="gallery[name]" placeholder="<?php echo esc_attr(__('Gallery Name', 'grand-media')); ?>" value="" required="required"/>
448
  </div>
449
  <div class="form-group">
450
  <label><?php _e('Modue', 'grand-media'); ?></label>
@@ -646,7 +656,7 @@ function gmedia_get_modal(){
646
  $('#combobox_gmedia_category').selectize({
647
  delimiter: ',',
648
  maxItems: null,
649
- openOnFocus: false,
650
  labelField: 'name',
651
  hideSelected: true,
652
  options: items,
@@ -678,8 +688,7 @@ function gmedia_get_modal(){
678
  break;
679
  case 'unassign_category':
680
  // get selected items in Gmedia Library
681
- $ckey = "gmuser_{$user_ID}_library";
682
- $selected_items = array_filter(explode(',', $_COOKIE[ $ckey ]), 'is_numeric');
683
  if(!empty($selected_items)){
684
  $gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_category');
685
  }
@@ -764,7 +773,7 @@ function gmedia_get_modal(){
764
  $('#combobox_gmedia_tag').selectize({
765
  delimiter: ',',
766
  maxItems: null,
767
- openOnFocus: false,
768
  labelField: 'name',
769
  hideSelected: true,
770
  options: items,
@@ -796,8 +805,7 @@ function gmedia_get_modal(){
796
  break;
797
  case 'delete_tags':
798
  // get selected items in Gmedia Library
799
- $ckey = "gmuser_{$user_ID}_library";
800
- $selected_items = array_filter(explode(',', $_COOKIE[ $ckey ]), 'is_numeric');
801
  if(!empty($selected_items)){
802
  $gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_tag');
803
  }
@@ -859,7 +867,7 @@ function gmedia_get_modal(){
859
  <div class="batch_set_custom" style="margin-top:5px;display:none;">
860
  <input class="form-control input-sm" name="batch_filename_custom" value="" placeholder="<?php echo 'newname_{id}'; ?>"/>
861
 
862
- <div><?php _e('Variables: <b>{filename}</b> - original file name; <b>{id}</b> - Gmedia #ID in database; <b>{index:1}</b> - index of selected file in order you select (set start number after colon).') ?></div>
863
  </div>
864
  </div>
865
  <div class="form-group">
@@ -958,10 +966,10 @@ function gmedia_get_modal(){
958
  <button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Cancel', 'grand-media'); ?></button>
959
  <?php if($modal_button){ ?>
960
  <input type="hidden" name="<?php echo $modal; ?>"/>
961
- <button type="button" onclick="jQuery('#ajax-modal-form').submit()" name="<?php echo $modal; ?>" class="btn <?php echo $button_class; ?>"><?php echo $modal_button; ?></button>
962
  <?php
963
  }
964
- wp_nonce_field('gmedia_modal');
965
  ?>
966
  </div>
967
  </form><!-- /.modal-content -->
@@ -1131,9 +1139,9 @@ function gmedia_import_wpmedia_modal(){
1131
  <?php wp_nonce_field('GmediaImport'); ?>
1132
  <input type="hidden" name="action" value="gmedia_import_handler"/>
1133
  <input type="hidden" id="import-action" name="import" value="import-wpmedia"/>
1134
- <input type="hidden" name="selected" value="<?php $ckey = "gmuser_{$user_ID}_wpmedia";
1135
  if(isset($_COOKIE[ $ckey ])){
1136
- echo $_COOKIE[ $ckey ];
1137
  } ?>"/>
1138
  <?php if($gmCore->caps['gmedia_terms']){ ?>
1139
  <div class="form-group">
@@ -1204,7 +1212,7 @@ function gmedia_import_wpmedia_modal(){
1204
  <?php } ?>
1205
  delimiter: ',',
1206
  maxItems: null,
1207
- openOnFocus: false,
1208
  persist: false,
1209
  options: cat_items,
1210
  labelField: 'item',
@@ -1232,7 +1240,7 @@ function gmedia_import_wpmedia_modal(){
1232
  <?php } ?>
1233
  delimiter: ',',
1234
  maxItems: null,
1235
- openOnFocus: false,
1236
  persist: false,
1237
  options: tag_items,
1238
  labelField: 'item',
@@ -1909,7 +1917,7 @@ function gmedia_add_custom_field(){
1909
  $pid = (int)$meta->{$column};
1910
  $meta = get_object_vars($meta);
1911
  $result = array('success' => array('meta_id' => $mid,
1912
- 'data' => $gmCore->_list_meta_item($meta)
1913
  ),
1914
  'id' => $pid
1915
  );
@@ -1998,7 +2006,7 @@ function gmedia_term_add_custom_field(){
1998
  $pid = (int)$meta->{$column};
1999
  $meta = get_object_vars($meta);
2000
  $result = array('success' => array('meta_id' => $mid,
2001
- 'data' => $gmCore->_list_meta_item($meta)
2002
  ),
2003
  'id' => $pid
2004
  );
@@ -2057,6 +2065,45 @@ function gmedia_term_delete_custom_field(){
2057
 
2058
  }
2059
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2060
  add_action('wp_ajax_gmedia_upgrade_process', 'gmedia_upgrade_process');
2061
  function gmedia_upgrade_process(){
2062
 
@@ -2139,20 +2186,20 @@ function gmedia_recreate_images(){
2139
 
2140
  check_ajax_referer('ajaxLongOperation');
2141
 
2142
- $gmid = 0;
2143
  $ajax_operations = get_option('gmedia_ajax_long_operations', array());
2144
  if(!empty($ajax_operations['gmedia_recreate_images'])){
2145
- $all_count = count($ajax_operations['gmedia_recreate_images']);
2146
  $recreate_ids = array_filter($ajax_operations['gmedia_recreate_images']);
2147
- $do_count = count($recreate_ids);
2148
 
2149
  if(!empty($recreate_ids)){
2150
  $gmid = reset($recreate_ids);
2151
  $gmCore->recreate_images_from_original($gmid);
2152
 
2153
- $ajax_operations['gmedia_recreate_images'][$gmid] = false;
2154
  update_option('gmedia_ajax_long_operations', $ajax_operations);
2155
- } else {
2156
  unset($ajax_operations['gmedia_recreate_images']);
2157
  }
2158
 
@@ -2160,7 +2207,7 @@ function gmedia_recreate_images(){
2160
  delete_option('gmedia_ajax_long_operations');
2161
 
2162
  wp_send_json_success(array('progress' => '100%', 'info' => __('Done:', 'grand-media'), 'done' => true, 'id' => $gmid));
2163
- } else {
2164
  $progress = round(($all_count - $do_count) * 100 / $all_count);
2165
 
2166
  wp_send_json_success(array('progress' => "{$progress}%", 'info' => __('Working:', 'grand-media'), 'id' => $gmid));
100
  } else{
101
  $result = $gmDB->get_gmedia($id);
102
  }
103
+
104
+ include_once(GMEDIA_ABSPATH . 'admin/pages/library/functions.php');
105
+ gmedia_item_more_data($result);
106
+ if('image' != $result->type){
107
+ $result->thumbnail = gmedia_item_thumbnail($result);
108
+ }
109
+
110
  if(current_user_can('gmedia_terms')){
 
 
 
 
 
 
 
 
111
  if(!empty($gmedia['terms']['gmedia_album'])){
112
+ if(isset($gmedia['gmedia_album_order'])){
113
+ $album = $gmDB->get_the_gmedia_terms($id, 'gmedia_album');
114
+ if($album){
115
+ $album = reset($album);
116
+ if((int)$gmedia['gmedia_album_order'] != (int)$album->gmedia_order){
117
+ $gmDB->update_term_sortorder($album->term_id, array($id => (int)$gmedia['gmedia_album_order']));
118
+ $result->gmedia_album_order = (int)$gmedia['gmedia_album_order'];
119
+ }
120
+ }
121
+ }
122
  $alb_id = $gmedia['terms']['gmedia_album'];
123
  $alb = $gmDB->get_term($alb_id, 'gmedia_album');
124
  $result->album_status = $alb? $alb->status : 'none';
328
  $button_class = 'btn-primary';
329
  $gm_terms = array();
330
  $modal = $gmCore->_post('modal');
331
+ $ckey = $gmCore->_post('ckey');
332
  switch($modal){
333
  case 'quick_gallery':
334
  if(!current_user_can('gmedia_gallery_manage')){
335
  die('-1');
336
  }
337
+ //$ckey = "gmedia_library";
338
  $modal_title = __('Quick Gallery from selected items', 'grand-media');
339
  $modal_button = __('Create Quick Gallery', 'grand-media');
340
  break;
342
  if(!current_user_can('gmedia_gallery_manage')){
343
  die('-1');
344
  }
345
+ //$ckey = "gmedia_{$user_ID}_libstack";
346
  $modal_title = __('Quick Gallery from Stack', 'grand-media');
347
  $modal_button = __('Create Quick Gallery', 'grand-media');
348
  break;
444
  case 'quick_gallery':
445
  case 'quick_gallery_stack':
446
  if(!empty($ckey)){
447
+ $selected_in_library = isset($_COOKIE[ $ckey ])? str_replace('.', ',', $_COOKIE[ $ckey ]) : '';
448
  }
449
  if(empty($selected_in_library)){
450
  _e('No selected Gmedia. Select at least one item in library.', 'grand-media');
454
  ?>
455
  <div class="form-group">
456
  <label><?php _e('Gallery Name', 'grand-media'); ?></label>
457
+ <input type="text" class="form-control input-sm" name="gallery[name]" placeholder="<?php esc_attr_e(__('Gallery Name', 'grand-media')); ?>" value="" required="required"/>
458
  </div>
459
  <div class="form-group">
460
  <label><?php _e('Modue', 'grand-media'); ?></label>
656
  $('#combobox_gmedia_category').selectize({
657
  delimiter: ',',
658
  maxItems: null,
659
+ openOnFocus: true,
660
  labelField: 'name',
661
  hideSelected: true,
662
  options: items,
688
  break;
689
  case 'unassign_category':
690
  // get selected items in Gmedia Library
691
+ $selected_items = !empty($ckey)? array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric') : false;
 
692
  if(!empty($selected_items)){
693
  $gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_category');
694
  }
773
  $('#combobox_gmedia_tag').selectize({
774
  delimiter: ',',
775
  maxItems: null,
776
+ openOnFocus: true,
777
  labelField: 'name',
778
  hideSelected: true,
779
  options: items,
805
  break;
806
  case 'delete_tags':
807
  // get selected items in Gmedia Library
808
+ $selected_items = !empty($ckey)? array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric') : false;
 
809
  if(!empty($selected_items)){
810
  $gm_terms = $gmDB->get_gmedia_terms($selected_items, 'gmedia_tag');
811
  }
867
  <div class="batch_set_custom" style="margin-top:5px;display:none;">
868
  <input class="form-control input-sm" name="batch_filename_custom" value="" placeholder="<?php echo 'newname_{id}'; ?>"/>
869
 
870
+ <div><?php _e('Variables: <b>{filename}</b> - original file name; <b>{id}</b> - Gmedia #ID in database; <b>{index:001}</b> - index of selected file in order you select (set start number after colon).') ?></div>
871
  </div>
872
  </div>
873
  <div class="form-group">
966
  <button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Cancel', 'grand-media'); ?></button>
967
  <?php if($modal_button){ ?>
968
  <input type="hidden" name="<?php echo $modal; ?>"/>
969
+ <button type="button" onclick="jQuery('#ajax-modal-form').submit()" class="btn <?php echo $button_class; ?>"><?php echo $modal_button; ?></button>
970
  <?php
971
  }
972
+ wp_nonce_field('gmedia_action');
973
  ?>
974
  </div>
975
  </form><!-- /.modal-content -->
1139
  <?php wp_nonce_field('GmediaImport'); ?>
1140
  <input type="hidden" name="action" value="gmedia_import_handler"/>
1141
  <input type="hidden" id="import-action" name="import" value="import-wpmedia"/>
1142
+ <input type="hidden" name="selected" value="<?php $ckey = "gmedia_library:wpmedia";
1143
  if(isset($_COOKIE[ $ckey ])){
1144
+ echo str_replace('.', ',', $_COOKIE[ $ckey ]);
1145
  } ?>"/>
1146
  <?php if($gmCore->caps['gmedia_terms']){ ?>
1147
  <div class="form-group">
1212
  <?php } ?>
1213
  delimiter: ',',
1214
  maxItems: null,
1215
+ openOnFocus: true,
1216
  persist: false,
1217
  options: cat_items,
1218
  labelField: 'item',
1240
  <?php } ?>
1241
  delimiter: ',',
1242
  maxItems: null,
1243
+ openOnFocus: true,
1244
  persist: false,
1245
  options: tag_items,
1246
  labelField: 'item',
1917
  $pid = (int)$meta->{$column};
1918
  $meta = get_object_vars($meta);
1919
  $result = array('success' => array('meta_id' => $mid,
1920
+ 'data' => $gmCore->_list_meta_item($meta, $meta_type)
1921
  ),
1922
  'id' => $pid
1923
  );
2006
  $pid = (int)$meta->{$column};
2007
  $meta = get_object_vars($meta);
2008
  $result = array('success' => array('meta_id' => $mid,
2009
+ 'data' => $gmCore->_list_meta_item($meta, $meta_type)
2010
  ),
2011
  'id' => $pid
2012
  );
2065
 
2066
  }
2067
 
2068
+ add_action('wp_ajax_gmedia_term_sortorder', 'gmedia_term_sortorder');
2069
+ function gmedia_term_sortorder(){
2070
+ global $gmDB, $user_ID, $gmCore;
2071
+ check_ajax_referer('GmediaTerms');
2072
+
2073
+ $term_id = $gmCore->_post('term_id');
2074
+ $idx0 = (int)$gmCore->_post('idx0');
2075
+ $ids = $gmCore->_post('ids');
2076
+
2077
+ if(!$idx0 || !is_array($ids)){
2078
+ die();
2079
+ }
2080
+
2081
+ if(!current_user_can('gmedia_album_manage')){
2082
+ wp_send_json(array('error' => array('code' => 100, 'message' => __('You are not allowed to manage this taxonomy', 'grand-media')), 'id' => $term_id));
2083
+ }
2084
+
2085
+ if(!$term_id || !($term_id = $gmDB->term_exists($term_id))){
2086
+ wp_send_json(array('error' => array('code' => 101, 'message' => __('A term with the id provided do not exists', 'grand-media')), 'id' => $term_id));
2087
+ }
2088
+ $term = $gmDB->get_term($term_id);
2089
+ if(((int)$term->global != (int)$user_ID) && !current_user_can('gmedia_edit_others_media')){
2090
+ wp_send_json(array('error' => array('code' => 102, 'message' => __('You are not allowed to edit others media', 'grand-media')), 'id' => $term_id));
2091
+ }
2092
+
2093
+ $gm_ids_order = array();
2094
+ foreach($ids as $id){
2095
+ $gm_ids_order[ $id ] = $idx0;
2096
+ $idx0 ++;
2097
+ }
2098
+
2099
+ $term_id = $gmDB->update_term_sortorder($term_id, $gm_ids_order);
2100
+ if(is_wp_error($term_id)){
2101
+ wp_send_json(array('error' => array('code' => 103, 'message' => $term_id->get_error_message()), 'id' => $term_id));
2102
+ }
2103
+
2104
+ wp_send_json_success($term_id);
2105
+ }
2106
+
2107
  add_action('wp_ajax_gmedia_upgrade_process', 'gmedia_upgrade_process');
2108
  function gmedia_upgrade_process(){
2109
 
2186
 
2187
  check_ajax_referer('ajaxLongOperation');
2188
 
2189
+ $gmid = 0;
2190
  $ajax_operations = get_option('gmedia_ajax_long_operations', array());
2191
  if(!empty($ajax_operations['gmedia_recreate_images'])){
2192
+ $all_count = count($ajax_operations['gmedia_recreate_images']);
2193
  $recreate_ids = array_filter($ajax_operations['gmedia_recreate_images']);
2194
+ $do_count = count($recreate_ids);
2195
 
2196
  if(!empty($recreate_ids)){
2197
  $gmid = reset($recreate_ids);
2198
  $gmCore->recreate_images_from_original($gmid);
2199
 
2200
+ $ajax_operations['gmedia_recreate_images'][ $gmid ] = false;
2201
  update_option('gmedia_ajax_long_operations', $ajax_operations);
2202
+ } else{
2203
  unset($ajax_operations['gmedia_recreate_images']);
2204
  }
2205
 
2207
  delete_option('gmedia_ajax_long_operations');
2208
 
2209
  wp_send_json_success(array('progress' => '100%', 'info' => __('Done:', 'grand-media'), 'done' => true, 'id' => $gmid));
2210
+ } else{
2211
  $progress = round(($all_count - $do_count) * 100 / $all_count);
2212
 
2213
  wp_send_json_success(array('progress' => "{$progress}%", 'info' => __('Working:', 'grand-media'), 'id' => $gmid));
admin/app.php CHANGED
@@ -1,24 +1,23 @@
1
  <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
3
  die('You are not allowed to call this page directly.');
4
  }
5
 
6
  /**
7
  * gmSettings()
8
- *
9
  * @return mixed content
10
  */
11
- function gmediaApp() {
12
  global $gmCore, $gmGallery;
13
 
14
- if(false !== ($force_app_status = $gmCore->_get('force_app_status'))) {
15
  $gm_options = get_option('gmediaOptions');
16
  $gm_options['mobile_app'] = (int)$force_app_status;
17
  update_option('gmediaOptions', $gm_options);
18
  }
19
  $alert = '';
20
  $btn_state = '';
21
- if('127.0.0.1' == $_SERVER['SERVER_ADDR']) {
22
  $alert = $gmCore->alert('danger', __('Your server is not accessable by iOS application', 'grand-media'));
23
  $btn_state = ' disabled';
24
  }
@@ -46,10 +45,10 @@ function gmediaApp() {
46
  </div>
47
  <div class="panel-body" id="gmedia-msg-panel"><?php echo $alert; ?></div>
48
  <div class="panel-body" id="gm_application_data">
49
- <?php if(current_user_can('manage_options')) { ?>
50
  <div class="container-fluid">
51
  <div class="row">
52
- <div class="col-xs-7">
53
  <?php /* ?>
54
  <div class="gm_service_actions">
55
  <p><button type="button" data-action="app_activate" class="btn btn-primary"><?php _e('Activate GmediaService', 'grand-media'); ?></button>
@@ -65,32 +64,88 @@ function gmediaApp() {
65
  <!--<p><?php echo 'Server address: ' . $_SERVER['SERVER_ADDR'];
66
  echo '<br>Remote address: ' . $_SERVER['REMOTE_ADDR'];
67
  ?></p>-->
68
- <p><?php _e('On the right side you can see information about your website that will be used by GmediaService and iOS application, so you\'ll be able to manage your Gmedia Library with your smartphone and other people can find and view your public collections.', 'grand-media'); ?></p>
 
 
 
 
69
 
70
- <p><?php _e('Download Gmedia iOS application from the App Store to manage your Gmedia Library from iPhone.', 'grand-media'); ?></p>
 
71
 
72
- <div class="text-center"><img style="max-width:100%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/mobile_app.png"/>
73
- <br/><a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="max-width:100%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/appstore_button.png"/></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  </div>
75
  </div>
76
- <div class="col-xs-5">
77
- <div class="form-group">
78
- <label><?php _e('Email', 'grand-media') ?>:</label>
79
- <input type="text" name="site_email" class="form-control input-sm" value="<?php esc_attr_e($site_email); ?>" placeholder="<?php esc_attr_e(get_option('admin_email')); ?>"/>
80
- </div>
81
- <div class="form-group">
82
- <label><?php _e('Site URL', 'grand-media') ?>:</label>
83
- <input type="text" readonly="readonly" name="site_url" class="form-control input-sm" value="<?php echo home_url(); ?>"/>
84
- </div>
85
- <div class="form-group">
86
- <label><?php _e('Site Title', 'grand-media') ?>:</label>
87
- <input type="text" name="site_title" class="form-control input-sm" value="<?php esc_attr_e($site_title); ?>" placeholder="<?php esc_attr_e(get_bloginfo('name')); ?>"/>
 
 
 
 
 
 
 
 
88
  </div>
89
- <div class="form-group">
90
- <label><?php _e('Site Description', 'grand-media') ?>:</label>
91
- <textarea rows="2" cols="10" name="site_description" class="form-control input-sm" placeholder="<?php esc_attr_e(get_bloginfo('description')); ?>"><?php esc_html_e($site_description); ?></textarea>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </div>
93
- <p><?php _e('Also the list of your Gmedia Tags will be shared with GmediaService.') ?></p>
94
  </div>
95
  </div>
96
  </div>
1
  <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
3
  die('You are not allowed to call this page directly.');
4
  }
5
 
6
  /**
7
  * gmSettings()
 
8
  * @return mixed content
9
  */
10
+ function gmediaApp(){
11
  global $gmCore, $gmGallery;
12
 
13
+ if(false !== ($force_app_status = $gmCore->_get('force_app_status'))){
14
  $gm_options = get_option('gmediaOptions');
15
  $gm_options['mobile_app'] = (int)$force_app_status;
16
  update_option('gmediaOptions', $gm_options);
17
  }
18
  $alert = '';
19
  $btn_state = '';
20
+ if('127.0.0.1' == $_SERVER['SERVER_ADDR']){
21
  $alert = $gmCore->alert('danger', __('Your server is not accessable by iOS application', 'grand-media'));
22
  $btn_state = ' disabled';
23
  }
45
  </div>
46
  <div class="panel-body" id="gmedia-msg-panel"><?php echo $alert; ?></div>
47
  <div class="panel-body" id="gm_application_data">
48
+ <?php if(current_user_can('manage_options')){ ?>
49
  <div class="container-fluid">
50
  <div class="row">
51
+ <div class="col-xs-6">
52
  <?php /* ?>
53
  <div class="gm_service_actions">
54
  <p><button type="button" data-action="app_activate" class="btn btn-primary"><?php _e('Activate GmediaService', 'grand-media'); ?></button>
64
  <!--<p><?php echo 'Server address: ' . $_SERVER['SERVER_ADDR'];
65
  echo '<br>Remote address: ' . $_SERVER['REMOTE_ADDR'];
66
  ?></p>-->
67
+ <div class="gmapp-description">
68
+ <div style="text-align:center; margin-bottom:30px;">
69
+ <a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:0 30px; max-height:88px;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/icon-128x128.png" alt=""/></a>
70
+ <a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:0 30px;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/appstore_button.png"/></a>
71
+ </div>
72
 
73
+ <p><?php _e('You are using one of the best plugins to create media library as well as your personal cloud storage on your WordPress website. You have chosen <strong><a href="https://wordpress.org/plugins/grand-media/" target="_blank">Gmedia Gallery Plugin</a></strong> and this choice gives you great opportunities to manage and organise your media library.', 'grand-media'); ?></p>
74
+ <p><?php _e('We are happy to offer you a simple way to access your photos and audios by means of your iOS devices: at a few taps and you will be able to create great photo gallery and share it with your friends, readers and subscribers.', 'grand-media'); ?></p>
75
 
76
+ <p class="text-center"><img style="max-width:90%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/slide1.jpg" alt=""/></p>
77
+
78
+ <div class="text-left" style="padding-top:40%;">
79
+ <div style="margin-right:20%">
80
+ <h3><?php _e('DISCOVER and SHARE', 'grand-media'); ?></h3>
81
+ <p><?php _e('Search, learn, open new horizons, share! It is just as easy as a piece of cake! Your photos will be seen by your friends, relatives and others.', 'grand-media'); ?></p>
82
+ </div>
83
+ <p><img style="max-width:90%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/slide3.jpg" alt=""/></p>
84
+ </div>
85
+ <div class="text-left" style="padding-top:40%;">
86
+ <div style="margin-right:20%">
87
+ <h3><?php _e('PRIVATE CONTENT', 'grand-media'); ?></h3>
88
+ <p><?php _e('If you are one of subscribers, contributors, authors, editors or administrators, use your login and password to get an access to the private content.', 'grand-media'); ?></p>
89
+ </div>
90
+ <p><img style="max-width:90%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/slide5.jpg" alt=""/></p>
91
+ </div>
92
+
93
+ <div class="well well-lg text-center" style="margin-top:40%; padding-top:50px;">
94
+ <p><?php _e('Download Gmedia iOS application from the App Store to manage your Gmedia&nbsp;Library from iPhone.', 'grand-media'); ?></p>
95
+ <div>
96
+ <a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:30px;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/appstore_button.png"/></a>
97
+ <a target="_blank" href="https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8"><img style="vertical-align:middle; max-width:100%; margin:30px; max-height:88px;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/icon-128x128.png" alt=""/></a>
98
+ </div>
99
+ </div>
100
  </div>
101
  </div>
102
+ <div class="col-xs-6">
103
+ <div class="well-lg well">
104
+ <p><?php _e('Below you can see information about your website that will be used by GmediaService and iOS application, so you\'ll be able to manage your Gmedia Library with your smartphone and other people can find and view your public collections.', 'grand-media'); ?></p>
105
+ <div class="form-group">
106
+ <label><?php _e('Email', 'grand-media') ?>:</label>
107
+ <input type="text" name="site_email" class="form-control input-sm" value="<?php esc_attr_e($site_email); ?>" placeholder="<?php esc_attr_e(get_option('admin_email')); ?>"/>
108
+ </div>
109
+ <div class="form-group">
110
+ <label><?php _e('Site URL', 'grand-media') ?>:</label>
111
+ <input type="text" readonly="readonly" name="site_url" class="form-control input-sm" value="<?php echo home_url(); ?>"/>
112
+ </div>
113
+ <div class="form-group">
114
+ <label><?php _e('Site Title', 'grand-media') ?>:</label>
115
+ <input type="text" name="site_title" class="form-control input-sm" value="<?php esc_attr_e($site_title); ?>" placeholder="<?php esc_attr_e(get_bloginfo('name')); ?>"/>
116
+ </div>
117
+ <div class="form-group">
118
+ <label><?php _e('Site Description', 'grand-media') ?>:</label>
119
+ <textarea rows="2" cols="10" name="site_description" class="form-control input-sm" placeholder="<?php esc_attr_e(get_bloginfo('description')); ?>"><?php esc_html_e($site_description); ?></textarea>
120
+ </div>
121
+ <p><?php _e('Also the list of your Gmedia Tags will be shared with GmediaService.') ?></p>
122
  </div>
123
+
124
+ <div class="gmapp-description">
125
+ <div class="text-right" style="padding-top:35%;">
126
+ <div style="margin-left:20%">
127
+ <h3><?php _e('FIND and ADD SITE it’s SIMPLY', 'grand-media'); ?></h3>
128
+ <p><?php _e('Just a few touches and our smart search bar will let you find and add your website, your friend’s website or a famous blogger’s site to your favourites list.', 'grand-media'); ?></p>
129
+ </div>
130
+ <p><img style="max-width:90%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/slide2.jpg" alt=""/></p>
131
+ </div>
132
+
133
+ <div class="text-right" style="padding-top:35%;">
134
+ <div style="margin-left:20%">
135
+ <h3><?php _e('MP3', 'grand-media'); ?></h3>
136
+ <p><?php _e('Take your favourite music track with you on a trip or create a playlist to travel with it! It is so simple with Gmedia. Share your energy and positive mood with your friends!', 'grand-media'); ?></p>
137
+ </div>
138
+ <p><img style="max-width:90%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/slide4.jpg" alt=""/></p>
139
+ </div>
140
+
141
+ <div class="text-right" style="padding-top:35%;">
142
+ <div style="margin-left:20%">
143
+ <h3><?php _e('GMEDIA LIBRARY', 'grand-media'); ?></h3>
144
+ <p><?php _e('If you are one of subscribers, contributors,authors, editors or administrators, use your login and password to get an access to private content. If your type of users has an access to Gmedia Library, you will be able to create photo collections and download pictures just from iPhone, using wide functional opportunities of our app and plugin.', 'grand-media'); ?></p>
145
+ </div>
146
+ <p><img style="max-width:90%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/assets/img/slide6.jpg" alt=""/></p>
147
+ </div>
148
  </div>
 
149
  </div>
150
  </div>
151
  </div>
admin/assets/css/gmedia.admin.css CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  #adminmenu #toplevel_page_GrandMedia ul.wp-submenu {
2
  display:none;
3
  }
@@ -42,6 +45,7 @@ body.gmedia-busy {
42
  iframe {
43
  background-color:#ffffff;
44
  }
 
45
  #gmedia-data-helper{
46
  background: #333;
47
  background: rgba(0,0,0,.8);
@@ -62,6 +66,10 @@ iframe {
62
  position: absolute;
63
  z-index: 99;
64
  }
 
 
 
 
65
  body.gmedia-blank {
66
  height:auto;
67
  min-height:100%;
@@ -92,7 +100,12 @@ div#gmedia-container {
92
  min-width:560px;
93
  -webkit-backface-visibility: hidden;
94
  backface-visibility: hidden;
 
95
  }
 
 
 
 
96
  body.gmedia-blank div#gmedia-container {
97
  margin:0;
98
  position:static;
@@ -268,6 +281,20 @@ body.gmedia-blank .panel-absoluteHeader .panel-heading,
268
  div#gm-list-table {
269
  font-size:13px;
270
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  .list-group-item.row {
272
  position:relative;
273
  margin-left:0;
@@ -320,9 +347,6 @@ div#gmedia-container .item-after-limit {
320
  -ms-filter:blur(1px);
321
  filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='1');
322
  }
323
- .gm-img-thumbnail:not(.item-after-limit) + .item-after-limit {
324
- clear:left;
325
- }
326
  .bg-status-private {
327
  background-color:#d9edf7;
328
  -webkit-box-shadow:3px 0 0 5px #d9edf7, -2px 0 0 5px #6fbfff;
@@ -335,6 +359,17 @@ div#gmedia-container .item-after-limit {
335
  -moz-box-shadow:3px 0 0 5px #fcf8e3, -2px 0 0 5px #ffd87c;
336
  box-shadow:3px 0 0 5px #fcf8e3, -2px 0 0 5px #ffd87c;
337
  }
 
 
 
 
 
 
 
 
 
 
 
338
  .form-group .gmpost-com-count {font-size:16px;}
339
  .gmpost-com-count:hover {text-decoration:none}
340
  label.cb_media-object-gallery {
@@ -343,6 +378,7 @@ label.cb_media-object-gallery {
343
  left:5px;
344
  top:0; bottom:0;
345
  text-align:center;
 
346
  }
347
  .d-row .thumbnail {
348
  margin-bottom:0;
@@ -363,6 +399,7 @@ label.cb_media-object-gallery {
363
  max-width:340px;
364
  border-radius:14px;
365
  }
 
366
  .edit-gmedia .gmedia-actions { margin:10px; }
367
  .gm-item-cell .gmedia-actions {
368
  overflow:hidden;
@@ -409,7 +446,7 @@ label.cb_media-object-gallery {
409
  }
410
 
411
  .gm-item-cell:hover .gm-cell-title { opacity:0; pointer-events:none;}
412
- .gm-item-cell:hover .gmedia-actions { transform:translateY(0); opacity:1;}
413
 
414
  .display-as-grid div.thumbnail {
415
  cursor:pointer;
@@ -432,7 +469,8 @@ label.cb_media-object-gallery {
432
  box-shadow:0 0 0 7px #1e8cbe;
433
  border-radius:1px;
434
  }
435
- .display-as-grid div.thumbnail .cb_media-object {
 
436
  bottom:0px;
437
  left:0px;
438
  overflow:hidden;
@@ -493,22 +531,25 @@ label.cb_media-object-gallery {
493
  .display-as-grid div.thumbnail .gm-cell-more-content p {
494
  font-size:11px;
495
  }
496
- .display-as-grid div.thumbnail .cb_media-object .centered {
 
497
  height:100%;
498
  left:0;
499
  position:absolute;
500
  top:0;
501
- transform:translate(50%, 50%);
502
  width:100%;
503
  }
504
- .display-as-grid div.thumbnail.landscape .cb_media-object .centered {
505
- transform:translate(50%, 50.5%);
 
506
  }
507
- .display-as-grid div.thumbnail .cb_media-object img {
 
508
  left:0;
509
  position:absolute;
510
  top:0;
511
- transform:translate(-50%, -50%);
512
  }
513
  .display-as-grid div.thumbnail.landscape img {
514
  height:101%;
@@ -527,7 +568,8 @@ label.cb_media-object-gallery {
527
  width:auto;
528
  }
529
  .thumbnail img.gmedia-typethumb,
530
- .display-as-grid div.thumbnail .cb_media-object img.gmedia-typethumb {
 
531
  position:absolute;
532
  right:7px;
533
  bottom:7px;
@@ -535,7 +577,8 @@ label.cb_media-object-gallery {
535
  max-height:60%;
536
  width:auto;
537
  }
538
- .display-as-grid div.thumbnail .cb_media-object img.gmedia-typethumb {
 
539
  left:auto;
540
  top:auto;
541
  right:50%;
@@ -545,16 +588,27 @@ label.cb_media-object-gallery {
545
  opacity:0.9;
546
  }
547
  .thumbwrap { position:relative; margin-bottom:5px; }
548
- .gm-stack { position:absolute; right:-8px; bottom:-8px; padding:5px; margin:0; border:1px solid #1e8cbe; background-color:#ffffff; border-width:1px 0 0 1px; }
549
- .gm-stack input{ margin:0; padding:0; }
550
- .thumbwrap .gm-stack { right:1px; bottom:1px; border:1px solid #dddddd; border-radius:5px 0 5px 0; border-right-color:transparent; border-bottom-color:transparent; border-width:1px; }
 
 
 
 
 
 
 
 
 
 
 
 
551
  .thumbwrap .cb_media-object { width:100%; margin:0; display:flex; }
552
  .cb_media-object .thumbnail {
553
  width:100%;
554
  }
555
  .media-title {
556
- font-weight:bold;
557
- font-size:15px;
558
  }
559
  .media-caption:empty { display:none; }
560
  .media-caption.in-library {
@@ -589,36 +643,8 @@ label.cb_media-object-gallery {
589
  right:10px;
590
  top:10px;
591
  }
592
- .no-touch .gmedia_id,
593
- .no-touch .term_id {
594
- /*display:none;*/
595
- }
596
  .term_id {
597
- position:absolute;
598
- right:0;
599
- top:0;
600
- padding:10px 10px 0 0;
601
- background-color:#ffffff;
602
- display:none;
603
- height:100%;
604
- z-index:10;
605
- }
606
- .term_id:before {
607
- content: '';
608
- position:absolute;
609
- right:100%;
610
- top:0;
611
- bottom:0;
612
- width:17px;
613
- background: linear-gradient(to right, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 50%,rgba(255,255,255,1) 100%);
614
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#ffffff',GradientType=1 );
615
- }
616
- .term-list-item.gm-selected .term_id {
617
- display:block;
618
- }
619
- .no-touch #gm-list-table .list-group-item:hover .gmedia_id,
620
- .no-touch #gm-list-table .list-group-item:hover .term_id {
621
- display:block;
622
  }
623
  #gm-list-table .hidden {
624
  display:none !important;
@@ -648,8 +674,6 @@ form.changed .gm-last-edited {
648
  }
649
  div#pluploadUploader {
650
  padding:0;
651
- }
652
- div#pluploadUploader * {
653
  box-sizing:border-box;
654
  }
655
  div#pluploadUploader > div > div * {
@@ -725,22 +749,24 @@ div#gmedia-msg-panel .alert {
725
  padding-bottom:0;
726
  z-index:1;
727
  }
728
- #gmedia-container .cb_term-object { min-height:60px; }
729
- #gmedia-container .gmedia_album .cb_term-object { min-height:78px; }
730
  .object-actions { text-align:right; font-size:16px; }
731
  .object-actions.gallery-object-actions { text-align:left; margin-bottom:5px; }
732
  .object-actions > * { margin:0 0 0 10px; vertical-align:middle; display:inline-block; }
 
733
  .object-actions a:hover { text-decoration:none; }
734
- .gm_filter_in_lib { border:1px solid; border-radius:4px; font-size:14px; line-height:14px; padding:0 2px 0 4px; }
735
  .gm_term_count { font-size:13px; font-weight:bold; text-decoration:none; vertical-align:bottom; }
736
  a.trash-icon:hover { color:#843534; }
737
  .action-inactive { color:#b8b8b8; }
738
  .action-inactive:hover { color:#b8b8b8; }
739
  .term-list-item .term-label .checkbox {
740
  padding-left:35px;
 
 
741
  }
742
  .term-list-item .term-label .checkbox > input {
743
  margin-left:-35px;
 
744
  }
745
  .term-list-item .checkbox input {
746
  margin-top:0;
@@ -756,6 +782,12 @@ a.trash-icon:hover { color:#843534; }
756
  .term-list-item .term-description:empty {
757
  padding:0;
758
  }
 
 
 
 
 
 
759
  .term-list-item .term-images {
760
  padding-top:5px;
761
  padding-bottom:5px;
@@ -766,15 +798,12 @@ a.trash-icon:hover { color:#843534; }
766
  }
767
  .term-list-item .term-images img {
768
  position:relative;
769
- height:50px;
770
  width:auto;
771
  background-color:#ffffff;
772
  }
773
- .term-list-item .term_name {
774
- margin-right:10px;
775
- }
776
- .gmedia_album .term-list-item .term-images img { height:68px; }
777
- .gmedia_album .term-list-item .term_name { font-size:14px; font-weight:bold; }
778
  .term-list-item .term_info_author {
779
  font-size:80%;
780
  white-space:nowrap;
@@ -793,16 +822,21 @@ a.trash-icon:hover { color:#843534; }
793
  .no-touch .term-list-item .term-images img:hover {
794
  z-index:100 !important;
795
  }
 
796
  .edit_tag_form {
797
  display:inline-block;
798
  margin-left:-5px;
799
  margin-bottom:-1px;
800
  margin-top:-1px;
 
801
  }
 
802
  .edit_tag_form input.edit_tag_input {
803
  padding:0 5px;
804
  border-width:0 0 1px 0;
805
  margin:0;
 
 
806
  }
807
  a.edit_tag_save.btn {
808
  padding-top:0;
@@ -813,7 +847,6 @@ a.edit_tag_save.btn {
813
  }
814
  .gm-img-thumbnail {
815
  display:inline-block;
816
- float:left;
817
  position:relative;
818
  margin-right:5px;
819
  margin-bottom:25px;
@@ -825,63 +858,6 @@ a.edit_tag_save.btn {
825
  border:1px solid #dddddd;
826
  border-radius:4px;
827
  }
828
- .gm-img-thumbnail input {
829
- display:block;
830
- line-height:120%;
831
- position:absolute;
832
- right:-1px;
833
- top:-1px;
834
- width:42px;
835
- padding:0 2px;
836
- text-align:center;
837
- border-radius:4px;
838
- opacity:0.9;
839
- }
840
- .gm-img-thumbnail input:focus {
841
- opacity:1;
842
- }
843
- .gm-img-thumbnail .label {
844
- position:absolute;
845
- left:0;
846
- bottom:0;
847
- font-weight:normal;
848
- line-height:120%;
849
- pointer-events:none;
850
- }
851
- .gm-img-thumbnail .gm-img-thumb-title {
852
- position:absolute;
853
- left:0;
854
- top:100%;
855
- font-size:90%;
856
- line-height:120%;
857
- width:100%;
858
- padding:3px;
859
- text-overflow:ellipsis;
860
- white-space:nowrap;
861
- overflow:hidden;
862
- text-align:left;
863
- }
864
- .gm-img-thumbnail.ui-sortable-helper .gm-img-thumb-title {
865
- visibility:hidden;
866
- }
867
- .ui-highlight-placeholder {
868
- border:1px solid #0074a2;
869
- }
870
- .termItems {
871
- position:relative;
872
- }
873
- .termItems .gm-img-thumbnail {
874
- width:160px;
875
- height:120px;
876
- text-align:center;
877
- line-height:107px;
878
- }
879
- #gmedia-edit-term .gm-img-thumbnail {
880
- height:121px;
881
- text-align:center;
882
- margin:0;
883
- line-height:107px;
884
- }
885
  .gm-img-thumbnail img {
886
  height:auto;
887
  width:auto;
@@ -890,6 +866,12 @@ a.edit_tag_save.btn {
890
  display:inline-block;
891
  vertical-align:middle;
892
  }
 
 
 
 
 
 
893
  .choose-module {
894
  padding:10px;
895
  cursor:pointer;
@@ -909,16 +891,22 @@ a.edit_tag_save.btn {
909
  padding:4px;
910
  margin-right:10px
911
  }
912
- .media.module-gallery {
913
  border-bottom: 1px solid #444444;
914
  padding-bottom:15px;
915
  margin-bottom:30px;
916
  }
917
- .media.module-gallery:last-child {
918
  border-bottom: none;
919
  padding-bottom:0;
920
  margin-bottom:0;
921
  }
 
 
 
 
 
 
922
  .presetlist a { }
923
  .gm-preset-id {
924
  font-size:smaller;
@@ -1071,6 +1059,7 @@ body#media-upload .thumbnail.active .glyphicon {
1071
  body#media-upload .plupload_wrapper {
1072
  height:100%;
1073
  box-sizing:border-box;
 
1074
  }
1075
  .addtags-gap { height:200px; }
1076
  body#media-upload div#pluploadUploader .plupload_container {
@@ -1159,11 +1148,11 @@ body.gmedia_library .panel {
1159
  height:800px;
1160
  margin-bottom:-400px;
1161
  overflow:auto;
1162
- -moz-transform:scale(0.5, 0.5);
1163
- -webkit-transform:scale(0.5, 0.5);
1164
- -o-transform:scale(0.5, 0.5);
1165
- -ms-transform:scale(0.5, 0.5);
1166
- transform:scale(0.5, 0.5);
1167
  -moz-transform-origin:top left;
1168
  -webkit-transform-origin:top left;
1169
  -o-transform-origin:top left;
@@ -1195,13 +1184,38 @@ body.gmedia_library .panel {
1195
  z-index:9999;
1196
  overflow-x:auto;
1197
  }
 
 
 
 
1198
  .edit_gmedia_item .modal-header {display:none;}
1199
  .edit_gmedia_item .modal-body {padding:0;}
1200
  .edit_gmedia_item iframe {transition:height 0.2s linear; -webkit-transition:height 0.2s linear; max-height:calc(100vh - 110px)}
 
 
 
 
 
 
 
 
 
1201
  input.sharelink[readonly] { cursor:text; }
1202
  fieldset.gmediacustomstuff { margin:0 0 10px; padding:.35em .625em .4em; position:relative; border:1px solid silver }
1203
  .delete-custom-field { margin:4px 2px 0; cursor:pointer; }
1204
  .newcustomfield-modal { position:absolute; bottom:-0.6em; right:8px; font-size:100%; }
 
 
 
 
 
 
 
 
 
 
 
 
1205
  @media (min-width:782px) {
1206
  div.modal {
1207
  top:32px;
@@ -1327,6 +1341,17 @@ fieldset.gmediacustomstuff { margin:0 0 10px; padding:.35em .625em .4em; positio
1327
  border-color:#dddddd #dddddd #dddddd transparent;
1328
  *border-left-color:#ffffff;
1329
  }
 
 
 
 
 
 
 
 
 
 
 
1330
  /* custom *-xs size for form elements */
1331
  input[type="date"].input-xs,
1332
  input[type="time"].input-xs,
1
+ .grand-media-admin-page #wpbody-content > .update-nag,
2
+ .grand-media-admin-page #wpbody-content > .updated.fade {display:none;}
3
+ #adminmenuback {z-index:0}
4
  #adminmenu #toplevel_page_GrandMedia ul.wp-submenu {
5
  display:none;
6
  }
45
  iframe {
46
  background-color:#ffffff;
47
  }
48
+ select.disabled {pointer-events:none;}
49
  #gmedia-data-helper{
50
  background: #333;
51
  background: rgba(0,0,0,.8);
66
  position: absolute;
67
  z-index: 99;
68
  }
69
+ #gmedia-data-helper.tiptoleft:before{
70
+ left: auto;
71
+ right: 17px;
72
+ }
73
  body.gmedia-blank {
74
  height:auto;
75
  min-height:100%;
100
  min-width:560px;
101
  -webkit-backface-visibility: hidden;
102
  backface-visibility: hidden;
103
+ box-sizing:border-box;
104
  }
105
+ div#gmedia-container * {
106
+ box-sizing:inherit;
107
+ }
108
+
109
  body.gmedia-blank div#gmedia-container {
110
  margin:0;
111
  position:static;
281
  div#gm-list-table {
282
  font-size:13px;
283
  }
284
+ .GrandMedia_Albums_edit div#gm-list-table {
285
+ display:block;
286
+ display:flex;
287
+ flex-wrap:wrap;
288
+ }
289
+ .GrandMedia_Albums_edit div#gm-list-table::before {
290
+ display:block;
291
+ content:'';
292
+ float:left;
293
+ width:0;
294
+ height:auto;
295
+ overflow:hidden;
296
+ }
297
+ .list-group-item { width:100%; }
298
  .list-group-item.row {
299
  position:relative;
300
  margin-left:0;
347
  -ms-filter:blur(1px);
348
  filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius='1');
349
  }
 
 
 
350
  .bg-status-private {
351
  background-color:#d9edf7;
352
  -webkit-box-shadow:3px 0 0 5px #d9edf7, -2px 0 0 5px #6fbfff;
359
  -moz-box-shadow:3px 0 0 5px #fcf8e3, -2px 0 0 5px #ffd87c;
360
  box-shadow:3px 0 0 5px #fcf8e3, -2px 0 0 5px #ffd87c;
361
  }
362
+ input.gm-order-input {
363
+ float: right;
364
+ border: 1px solid #ccc;
365
+ border-radius: 3px;
366
+ padding: 1px 3px;
367
+ margin: 0;
368
+ font-size: 12px;
369
+ line-height: 120%;
370
+ width: 3em;
371
+ text-align: right;
372
+ }
373
  .form-group .gmpost-com-count {font-size:16px;}
374
  .gmpost-com-count:hover {text-decoration:none}
375
  label.cb_media-object-gallery {
378
  left:5px;
379
  top:0; bottom:0;
380
  text-align:center;
381
+ padding-top:4px;
382
  }
383
  .d-row .thumbnail {
384
  margin-bottom:0;
399
  max-width:340px;
400
  border-radius:14px;
401
  }
402
+ .display-as-grid .gm-item-cell.ui-highlight-placeholder {margin-bottom:0;background-color:#2c7c91;}
403
  .edit-gmedia .gmedia-actions { margin:10px; }
404
  .gm-item-cell .gmedia-actions {
405
  overflow:hidden;
446
  }
447
 
448
  .gm-item-cell:hover .gm-cell-title { opacity:0; pointer-events:none;}
449
+ .gm-item-cell:hover .gmedia-actions { transform:translateY(0) translateZ(0); opacity:1;}
450
 
451
  .display-as-grid div.thumbnail {
452
  cursor:pointer;
469
  box-shadow:0 0 0 7px #1e8cbe;
470
  border-radius:1px;
471
  }
472
+ .display-as-grid div.thumbnail .cb_media-object,
473
+ .display-as-grid div.thumbnail .gm-item-cell-media-object {
474
  bottom:0px;
475
  left:0px;
476
  overflow:hidden;
531
  .display-as-grid div.thumbnail .gm-cell-more-content p {
532
  font-size:11px;
533
  }
534
+ .display-as-grid div.thumbnail .cb_media-object .centered,
535
+ .display-as-grid div.thumbnail .gm-item-cell-media-object .centered {
536
  height:100%;
537
  left:0;
538
  position:absolute;
539
  top:0;
540
+ transform:translate(50%, 50%) translateZ(0);
541
  width:100%;
542
  }
543
+ .display-as-grid div.thumbnail.landscape .cb_media-object .centered,
544
+ .display-as-grid div.thumbnail.landscape .gm-item-cell-media-object .centered {
545
+ transform:translate(50%, 50.5%) translateZ(0);
546
  }
547
+ .display-as-grid div.thumbnail .cb_media-object img,
548
+ .display-as-grid div.thumbnail .gm-item-cell-media-object img {
549
  left:0;
550
  position:absolute;
551
  top:0;
552
+ transform:translate(-50%, -50%) translateZ(0);
553
  }
554
  .display-as-grid div.thumbnail.landscape img {
555
  height:101%;
568
  width:auto;
569
  }
570
  .thumbnail img.gmedia-typethumb,
571
+ .display-as-grid div.thumbnail .cb_media-object img.gmedia-typethumb,
572
+ .display-as-grid div.thumbnail .gm-item-cell-media-object img.gmedia-typethumb {
573
  position:absolute;
574
  right:7px;
575
  bottom:7px;
577
  max-height:60%;
578
  width:auto;
579
  }
580
+ .display-as-grid div.thumbnail .cb_media-object img.gmedia-typethumb,
581
+ .display-as-grid div.thumbnail .gm-item-cell-media-object img.gmedia-typethumb {
582
  left:auto;
583
  top:auto;
584
  right:50%;
588
  opacity:0.9;
589
  }
590
  .thumbwrap { position:relative; margin-bottom:5px; }
591
+ .gm-item-check,
592
+ .gm-order { position:absolute; right:-8px; bottom:-8px; padding:5px; margin:0; border:1px solid #1e8cbe; background-color:#ffffff; border-width:1px 0 0 1px; }
593
+ .gm-item-check input{ margin:0; padding:0; }
594
+ .gm-order input{
595
+ display:block;
596
+ line-height:120%;
597
+ width:42px;
598
+ padding:0 2px;
599
+ margin:0;
600
+ text-align:center;
601
+ border: 1px solid #ccc;
602
+ border-radius:4px;
603
+ }
604
+
605
+ .thumbwrap .gm-item-check { right:1px; bottom:1px; border:1px solid #dddddd; border-radius:5px 0 5px 0; border-right-color:transparent; border-bottom-color:transparent; border-width:1px; }
606
  .thumbwrap .cb_media-object { width:100%; margin:0; display:flex; }
607
  .cb_media-object .thumbnail {
608
  width:100%;
609
  }
610
  .media-title {
611
+ font-size:22px;
 
612
  }
613
  .media-caption:empty { display:none; }
614
  .media-caption.in-library {
643
  right:10px;
644
  top:10px;
645
  }
 
 
 
 
646
  .term_id {
647
+ font-size:80%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
648
  }
649
  #gm-list-table .hidden {
650
  display:none !important;
674
  }
675
  div#pluploadUploader {
676
  padding:0;
 
 
677
  box-sizing:border-box;
678
  }
679
  div#pluploadUploader > div > div * {
749
  padding-bottom:0;
750
  z-index:1;
751
  }
 
 
752
  .object-actions { text-align:right; font-size:16px; }
753
  .object-actions.gallery-object-actions { text-align:left; margin-bottom:5px; }
754
  .object-actions > * { margin:0 0 0 10px; vertical-align:middle; display:inline-block; }
755
+ .object-actions.gallery-object-actions > *:first-child { margin-left:0; }
756
  .object-actions a:hover { text-decoration:none; }
757
+ /*.gm_filter_in_lib { border:1px solid; border-radius:4px; font-size:14px; line-height:14px; padding:0 2px 0 4px; }*/
758
  .gm_term_count { font-size:13px; font-weight:bold; text-decoration:none; vertical-align:bottom; }
759
  a.trash-icon:hover { color:#843534; }
760
  .action-inactive { color:#b8b8b8; }
761
  .action-inactive:hover { color:#b8b8b8; }
762
  .term-list-item .term-label .checkbox {
763
  padding-left:35px;
764
+ padding-top:6px;
765
+ min-height:68px;
766
  }
767
  .term-list-item .term-label .checkbox > input {
768
  margin-left:-35px;
769
+ margin-top:2px;
770
  }
771
  .term-list-item .checkbox input {
772
  margin-top:0;
782
  .term-list-item .term-description:empty {
783
  padding:0;
784
  }
785
+ .term-list-item .object-actions {
786
+ position: absolute;
787
+ right: 0; left: auto; top: 4px;
788
+ line-height:165%;
789
+ }
790
+
791
  .term-list-item .term-images {
792
  padding-top:5px;
793
  padding-bottom:5px;
798
  }
799
  .term-list-item .term-images img {
800
  position:relative;
801
+ height:68px;
802
  width:auto;
803
  background-color:#ffffff;
804
  }
805
+ .term-list-item .term_name { margin-right:100px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:22px;}
806
+ .term-list-item .no-checkbox .term_name { margin-right:5px; font-size:16px;}
 
 
 
807
  .term-list-item .term_info_author {
808
  font-size:80%;
809
  white-space:nowrap;
822
  .no-touch .term-list-item .term-images img:hover {
823
  z-index:100 !important;
824
  }
825
+ .edit_tag_link { font-size:18px; }
826
  .edit_tag_form {
827
  display:inline-block;
828
  margin-left:-5px;
829
  margin-bottom:-1px;
830
  margin-top:-1px;
831
+ font-size:18px;
832
  }
833
+ .edit_tag_form a { font-size:18px; line-height:100%;}
834
  .edit_tag_form input.edit_tag_input {
835
  padding:0 5px;
836
  border-width:0 0 1px 0;
837
  margin:0;
838
+ font-size:18px;
839
+ line-height:100%;
840
  }
841
  a.edit_tag_save.btn {
842
  padding-top:0;
847
  }
848
  .gm-img-thumbnail {
849
  display:inline-block;
 
850
  position:relative;
851
  margin-right:5px;
852
  margin-bottom:25px;
858
  border:1px solid #dddddd;
859
  border-radius:4px;
860
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
861
  .gm-img-thumbnail img {
862
  height:auto;
863
  width:auto;
866
  display:inline-block;
867
  vertical-align:middle;
868
  }
869
+ #gmedia-edit-term .gm-img-thumbnail {
870
+ text-align:center;
871
+ margin:0;
872
+ }
873
+ #gmedia-edit-term .gm-img-thumbnail:empty {display:none;}
874
+ #gmedia-edit-term .gm-img-thumbnail img { max-height: 150px; }
875
  .choose-module {
876
  padding:10px;
877
  cursor:pointer;
891
  padding:4px;
892
  margin-right:10px
893
  }
894
+ #gmedia_modules .media {
895
  border-bottom: 1px solid #444444;
896
  padding-bottom:15px;
897
  margin-bottom:30px;
898
  }
899
+ #gmedia_modules .media:last-child {
900
  border-bottom: none;
901
  padding-bottom:0;
902
  margin-bottom:0;
903
  }
904
+ #chooseModuleModal .choose-module {
905
+ border-bottom: 1px solid #444444;
906
+ }
907
+ #chooseModuleModal .choose-module:last-child {
908
+ border-bottom: none;
909
+ }
910
  .presetlist a { }
911
  .gm-preset-id {
912
  font-size:smaller;
1059
  body#media-upload .plupload_wrapper {
1060
  height:100%;
1061
  box-sizing:border-box;
1062
+ overflow:hidden;
1063
  }
1064
  .addtags-gap { height:200px; }
1065
  body#media-upload div#pluploadUploader .plupload_container {
1148
  height:800px;
1149
  margin-bottom:-400px;
1150
  overflow:auto;
1151
+ -moz-transform:scale(0.5, 0.5) translateZ(0);
1152
+ -webkit-transform:scale(0.5, 0.5) translateZ(0);
1153
+ -o-transform:scale(0.5, 0.5) translateZ(0);
1154
+ -ms-transform:scale(0.5, 0.5) translateZ(0);
1155
+ transform:scale(0.5, 0.5) translateZ(0);
1156
  -moz-transform-origin:top left;
1157
  -webkit-transform-origin:top left;
1158
  -o-transform-origin:top left;
1184
  z-index:9999;
1185
  overflow-x:auto;
1186
  }
1187
+ #previewModal .modal-header .btn-primary {display:none;}
1188
+ #previewModal .select_gmedia .modal-header .btn-primary {display:inline-block;}
1189
+ #previewModal .select_gmedia_image .modal-header .btn-primary {display:inline-block;}
1190
+
1191
  .edit_gmedia_item .modal-header {display:none;}
1192
  .edit_gmedia_item .modal-body {padding:0;}
1193
  .edit_gmedia_item iframe {transition:height 0.2s linear; -webkit-transition:height 0.2s linear; max-height:calc(100vh - 110px)}
1194
+
1195
+ .select_gmedia .modal-body,
1196
+ .select_gmedia_image .modal-body {padding:0;}
1197
+ .select_gmedia iframe,
1198
+ .select_gmedia_image iframe {transition:height 0.2s linear; -webkit-transition:height 0.2s linear; max-height:calc(100vh - 160px)}
1199
+
1200
+ .checked_thumb {margin-top:-7px;text-align:center;}
1201
+ .checked_thumb img {max-height:60px;width:auto;height:auto;}
1202
+
1203
  input.sharelink[readonly] { cursor:text; }
1204
  fieldset.gmediacustomstuff { margin:0 0 10px; padding:.35em .625em .4em; position:relative; border:1px solid silver }
1205
  .delete-custom-field { margin:4px 2px 0; cursor:pointer; }
1206
  .newcustomfield-modal { position:absolute; bottom:-0.6em; right:8px; font-size:100%; }
1207
+
1208
+ .gmapp-description, .gmapp-description p {font-size:15px;}
1209
+
1210
+ div#wp-link-wrap {
1211
+ box-sizing: border-box;
1212
+ }
1213
+ div#wp-link-wrap label {
1214
+ font-weight: normal;
1215
+ display: block;
1216
+ margin: 0;
1217
+ }
1218
+
1219
  @media (min-width:782px) {
1220
  div.modal {
1221
  top:32px;
1341
  border-color:#dddddd #dddddd #dddddd transparent;
1342
  *border-left-color:#ffffff;
1343
  }
1344
+ /* custom badge colors */
1345
+ .badge-error {background-color: #b94a48;}
1346
+ .badge-error:hover {background-color: #953b39;}
1347
+ .badge-warning {background-color: #f89406;}
1348
+ .badge-warning:hover {background-color: #c67605;}
1349
+ .badge-success {background-color: #468847;}
1350
+ .badge-success:hover {background-color: #356635; }
1351
+ .badge-info {background-color: #3a87ad;}
1352
+ .badge-info:hover {background-color: #2d6987;}
1353
+ .badge-inverse {background-color: #333333;}
1354
+ .badge-inverse:hover {background-color: #1a1a1a;}
1355
  /* custom *-xs size for form elements */
1356
  input[type="date"].input-xs,
1357
  input[type="time"].input-xs,
admin/assets/img/application.png CHANGED
Binary file
admin/assets/img/archive.png CHANGED
Binary file
admin/assets/img/audio.png CHANGED
Binary file
admin/assets/img/clicked.png DELETED
Binary file
admin/assets/img/code.png CHANGED
Binary file
admin/assets/img/default.png CHANGED
Binary file
admin/assets/img/document.png CHANGED
Binary file
admin/assets/img/gm-icon.png CHANGED
Binary file
admin/assets/img/grand_icon.png DELETED
Binary file
admin/assets/img/icon-128x128.png ADDED
Binary file
admin/assets/img/icon.png DELETED
Binary file
admin/assets/img/icon_edit.png DELETED
Binary file
admin/assets/img/interactive.png CHANGED
Binary file
admin/assets/img/metabox.png DELETED
Binary file
admin/assets/img/pdf.png ADDED
Binary file
admin/assets/img/refresh.png DELETED
Binary file
admin/assets/img/reload.png DELETED
Binary file
admin/assets/img/slide1.jpg ADDED
Binary file
admin/assets/img/slide2.jpg ADDED
Binary file
admin/assets/img/slide3.jpg ADDED
Binary file
admin/assets/img/slide4.jpg ADDED
Binary file
admin/assets/img/slide5.jpg ADDED
Binary file
admin/assets/img/slide6.jpg ADDED
Binary file
admin/assets/img/social-footer.png DELETED
Binary file
admin/assets/img/spreadsheet.png CHANGED
Binary file
admin/assets/img/text.png CHANGED
Binary file
admin/assets/img/throbber.gif DELETED
Binary file
admin/assets/img/video.png CHANGED
Binary file
admin/assets/js/gmedia.admin.js CHANGED
@@ -1,19 +1,9 @@
1
  /**
2
  * Gmedia Library
3
  */
 
4
  var GmediaLibrary = {
5
  init: function() {
6
- jQuery('#gm-selected').on('change', function() {
7
- var val = jQuery(this).val();
8
- jQuery('.edit-mode-link').each(function() {
9
- if(val) {
10
- jQuery(this).attr('href', jQuery(this).data('href_sel'));
11
- } else {
12
- jQuery(this).attr('href', jQuery(this).data('href'));
13
- }
14
- });
15
- }).trigger('change');
16
-
17
  window.gm_wavesurfer = {};
18
  if(jQuery('.gmedia-audio-item').length) {
19
 
@@ -29,7 +19,7 @@ var GmediaLibrary = {
29
  GmediaLibrary.waveplayer(data);
30
  }
31
  });
32
- jQuery('.gm-waveform').on('click', function() {
33
  var parent = jQuery(this).parent(),
34
  data = parent.data();
35
 
@@ -58,14 +48,14 @@ var GmediaLibrary = {
58
  });
59
  }
60
  });
61
- jQuery('.gm-play, .gm-pause').on('click', function() {
62
  var parent = jQuery(this).parent(),
63
  data = parent.data();
64
  window.gm_wavesurfer[data.id].playPause();
65
  });
66
 
67
  var resize;
68
- jQuery(window).on('resize', function(){
69
  clearTimeout(resize);
70
  resize = setTimeout(function(){
71
  jQuery('.gm-waveform-player').each(function() {
@@ -84,13 +74,15 @@ var GmediaLibrary = {
84
  }
85
 
86
  if(jQuery('body').hasClass('gmedia_library')) {
87
- jQuery(window).on('load resize', function(){
88
  jQuery('#previewFrame', window.parent.document).height(window.document.getElementById('gmedia_iframe_content').offsetHeight + 2);
89
  });
90
-
91
  var observer = new MutationObserver(function(mutations) {
92
  jQuery('#previewFrame', window.parent.document).height(window.document.getElementById('gmedia_iframe_content').offsetHeight + 2);
93
- jQuery('#previewModal', window.parent.document).attr('data-refresh', 'true');
 
 
94
  });
95
  var gmedia_iframe_content = window.document.getElementById('gmedia_iframe_content');
96
  observer.observe(gmedia_iframe_content, {
@@ -170,6 +162,13 @@ var GmediaLibrary = {
170
  onBlur: function(){
171
  this.$input.removeClass('edit-gmedia-ignore');
172
  if(focus_input_val != this.$input.val()) {
 
 
 
 
 
 
 
173
  this.$input.trigger('change');
174
  }
175
  },
@@ -297,6 +296,39 @@ var GmediaLibrary = {
297
  });
298
  }
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
301
  };
302
 
@@ -307,7 +339,7 @@ var GmediaAddMedia = {
307
  init: function() {
308
 
309
  if(jQuery('body').hasClass('GrandMedia_AddMedia')) {
310
- jQuery('#uploader_runtime select').change(function() {
311
  if('html4' == jQuery(this).val()) {
312
  jQuery('#uploader_chunking').addClass('hide');
313
  jQuery('#uploader_urlstream_upload').addClass('hide');
@@ -435,26 +467,26 @@ var GmediaTerms = {
435
 
436
  if(jQuery('body').hasClass('GrandMedia_Tags')) {
437
  jQuery('#gm-list-table').data('edit', false);
438
- jQuery('input.edit_tag_input').keypress(function(e) {
439
  var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
440
  var charCode = e.charCode || e.keyCode || e.which;
441
  if(charCode == 13) {
442
  e.preventDefault();
443
  edit_tag(tagdiv);
444
  }
445
- }).blur(function() {
446
  var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
447
  edit_tag(tagdiv);
448
  });
449
 
450
- jQuery('.edit_tag_link').click(function(e) {
451
  e.preventDefault();
452
  var id = jQuery(this).attr('href');
453
  jQuery(this).hide();
454
  jQuery(id).find('.edit_tag_form').show().find('input').focus();
455
  jQuery('#gm-list-table').data('edit', true);
456
  });
457
- jQuery('.edit_tag_save').click(function(e) {
458
  e.preventDefault();
459
  });
460
 
@@ -491,15 +523,14 @@ var GmediaTerms = {
491
  }
492
  }
493
 
494
- var input = jQuery('.term-shortcode input');
495
- input.on('click', function() {
496
  this.setSelectionRange(0, 0);
497
  this.setSelectionRange(0, this.value.length);
498
  });
499
- input.on('change', function() {
500
  shortcode_inp_autowidth(this);
501
  });
502
- jQuery.each(input, function(i, e) {
503
  shortcode_inp_autowidth(this)
504
  });
505
  function shortcode_inp_autowidth(e) {
@@ -509,6 +540,51 @@ var GmediaTerms = {
509
  inp.width(buffer.width());
510
  }
511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  }
513
  };
514
 
@@ -538,8 +614,8 @@ var GmediaSelect = {
538
  }
539
 
540
  if(sel.data('userid')) {
541
- var storedData = getStorage('gmuser_' + sel.data('userid') + '_');
542
- storedData.set(sel.data('key'), arr);
543
  }
544
  jQuery('#gm-stack-qty').text(arr.length);
545
  if(arr.length) {
@@ -593,17 +669,21 @@ var GmediaSelect = {
593
  }
594
 
595
  if(sel.data('userid')) {
596
- var storedData = getStorage('gmuser_' + sel.data('userid') + '_');
597
- storedData.set(sel.data('key'), arr);
598
  }
599
  jQuery('#gm-selected-qty').text(arr.length);
 
 
600
  if(arr.length) {
601
- jQuery('#gm-selected-btn').removeClass('hidden');
602
  jQuery('.rel-selected-show').show();
603
  jQuery('.rel-selected-hide').hide();
604
  }
605
  else {
606
- jQuery('#gm-selected-btn').addClass('hidden');
 
 
607
  jQuery('.rel-selected-show').hide();
608
  jQuery('.rel-selected-hide').show();
609
  }
@@ -635,22 +715,21 @@ var GmediaSelect = {
635
  }
636
  },
637
  init: function() {
638
- var cb_global = jQuery('#cb_global'),
639
- cb_obj = cb_global.data('group');
640
 
641
  if(jQuery('#gm-selected').length) {
642
  GmediaSelect.msg_selected(cb_obj);
643
- jQuery('#gm-selected-clear').click(function(e) {
644
  jQuery('#gm-selected').val('');
645
  GmediaSelect.chk_none(false, cb_obj);
646
  GmediaSelect.msg_selected(cb_obj);
647
  e.preventDefault();
648
  });
649
- jQuery('#gm-selected-show').click(function(e) {
650
  jQuery('#gm-selected-btn').submit();
651
  e.preventDefault();
652
  });
653
- jQuery('#gm-stack-in').click(function(e) {
654
  e.preventDefault();
655
  var stack_obj = jQuery('#gm-stack'),
656
  sel_obj = jQuery('#gm-selected'),
@@ -667,7 +746,7 @@ var GmediaSelect = {
667
  //GmediaSelect.chk_none(false, cb_obj);
668
  //GmediaSelect.msg_selected(cb_obj);
669
  });
670
- jQuery('#gm-stack-out').click(function(e) {
671
  e.preventDefault();
672
  var stack_obj = jQuery('#gm-stack'),
673
  sel_obj = jQuery('#gm-selected'),
@@ -685,7 +764,7 @@ var GmediaSelect = {
685
  //GmediaSelect.msg_selected(cb_obj);
686
  });
687
  }
688
- cb_global.click(function() {
689
  if(jQuery(this).is(':checked')) {
690
  GmediaSelect.chk_all(false, cb_obj);
691
  } else {
@@ -693,7 +772,7 @@ var GmediaSelect = {
693
  }
694
  GmediaSelect.msg_selected(cb_obj, true);
695
  });
696
- jQuery('#cb_global-btn li a').click(function(e) {
697
  var sel = jQuery(this).data('select');
698
  switch(sel) {
699
  case 'total':
@@ -714,7 +793,7 @@ var GmediaSelect = {
714
  GmediaSelect.msg_selected(cb_obj, true);
715
  e.preventDefault();
716
  });
717
- jQuery('.cb_media-object input:checkbox, .cb_term-object input:checkbox').change(function() {
718
  var selected = jQuery('#gm-selected'),
719
  arr = selected.val();
720
  var cur = jQuery(this).val();
@@ -734,21 +813,34 @@ var GmediaSelect = {
734
  GmediaSelect.msg_selected(cb_obj);
735
  });
736
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  if(jQuery('#gm-stack').length) {
738
  GmediaSelect.msg_stack();
739
- jQuery('#gm-stack-clear').click(function(e) {
740
  jQuery('#gm-stack').val('');
741
  jQuery('.gm-stack input').prop('checked', false);
742
  GmediaSelect.msg_stack();
743
  e.preventDefault();
744
  });
745
- jQuery('#gm-stack-show').click(function(e) {
746
  jQuery('#gm-stack-btn').submit();
747
  e.preventDefault();
748
  });
749
 
750
  }
751
- jQuery('.gm-stack input:checkbox').change(function() {
752
  var selected = jQuery('#gm-stack'),
753
  arr = selected.val();
754
  var cur = jQuery(this).val();
@@ -767,7 +859,7 @@ var GmediaSelect = {
767
  GmediaSelect.msg_stack();
768
  });
769
 
770
- jQuery('.term-label').click(function(e) {
771
  if('DIV' == e.target.nodeName) {
772
  if(!jQuery('#gm-list-table').data('edit')) {
773
  var cb = jQuery('input:checkbox', this);
@@ -810,33 +902,36 @@ var GmediaFunction = {
810
  // jQuery('.panel-heading .spinner').removeClass('is-active');
811
  //});
812
 
813
- jQuery('[data-confirm]').click(function() {
814
  return GmediaFunction.confirm(jQuery(this).data('confirm'));
815
  });
816
 
817
- jQuery('.show-settings-link').click(function(e) {
818
  e.preventDefault();
819
  jQuery('#show-settings-link').trigger('click');
820
  });
821
 
822
- jQuery('.fit-thumbs').click(function(e) {
823
  e.preventDefault();
824
  jQuery(this).toggleClass('btn-success btn-default');
825
  jQuery('.display-as-grid').toggleClass('invert-ratio');
826
  jQuery.get(jQuery(this).attr('href'), {ajaxload: 1});
827
  });
828
 
829
- jQuery('.gm-cell-more-btn, .gm-cell-title').click(function() {
830
  jQuery(this).parent().toggleClass('gm-cell-more-active');
831
  });
832
 
833
- jQuery('div.gmedia-modal').appendTo('body');
834
- jQuery('a.gmedia-modal').click(function(e) {
 
 
 
 
835
  jQuery('body').addClass('gmedia-busy');
836
  var modal_div = jQuery(jQuery(this).attr('href'));
837
- var post_data = {
838
- action: jQuery(this).data('action'), modal: jQuery(this).data('modal'), _wpnonce: jQuery('#_wpnonce').val()
839
- };
840
  jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR) {
841
  if(!data || ('-1' == data)) {
842
  jQuery('body').removeClass('gmedia-busy');
@@ -856,7 +951,7 @@ var GmediaFunction = {
856
  e.preventDefault();
857
  });
858
 
859
- jQuery('a.gmedit-modal').click(function(e) {
860
  e.preventDefault();
861
  var modal_div = jQuery(jQuery(this).data('target'));
862
  jQuery('.modal-content', modal_div).html(
@@ -877,9 +972,10 @@ var GmediaFunction = {
877
  });
878
  });
879
 
880
- jQuery('a.preview-modal').click(function(e) {
881
  e.preventDefault();
882
- var data = jQuery(this).data(),
 
883
  modal_div = jQuery(data['target']),
884
  modal_dialog = jQuery('.modal-dialog', modal_div),
885
  modal_body = jQuery('.modal-body', modal_div),
@@ -911,6 +1007,7 @@ var GmediaFunction = {
911
  );
912
  }
913
 
 
914
  modal_div.modal({
915
  backdrop: true,
916
  show: true
@@ -925,18 +1022,45 @@ var GmediaFunction = {
925
  jQuery.get(url, function(data) {
926
  jQuery('#gmedia-panel').html(jQuery('#gmedia-panel', data).html());
927
  GmediaInit();
 
928
  });
929
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
  });
 
 
931
  });
932
 
933
- jQuery('input.sharelink').on('click focus', function() {
934
  this.setSelectionRange(0, this.value.length);
935
  });
936
- jQuery('input.sharetoemail').on('keyup', function() {
937
  jQuery('.sharebutton').prop('disabled', !validateEmail(this.value));
938
  });
939
- jQuery('.sharebutton').on('click', function() {
940
  var sharetoemail = jQuery('input.sharetoemail');
941
  if(!validateEmail(sharetoemail.val())) {
942
  sharetoemail.focus();
@@ -952,7 +1076,7 @@ var GmediaFunction = {
952
  });
953
  jQuery('#shareModal').modal('hide');
954
  });
955
- jQuery('a.share-modal').click(function(e) {
956
  e.preventDefault();
957
  var data = jQuery(this).data(),
958
  modal_div = jQuery(data['target']),
@@ -993,7 +1117,7 @@ var GmediaFunction = {
993
  });
994
  });
995
 
996
- jQuery('.buildquery-modal').click(function(e) {
997
  e.preventDefault();
998
  var data = jQuery(this).data(),
999
  modal_div = jQuery(jQuery(this).attr('href')),
@@ -1012,7 +1136,7 @@ var GmediaFunction = {
1012
  }).one('hidden.bs.modal', function() {});
1013
  });
1014
 
1015
- jQuery('.buildquerysubmit').on('click', function() {
1016
  var qform = jQuery('#buildQuery :input').filter(function() {
1017
  return !!jQuery(this).val();
1018
  });
@@ -1022,7 +1146,7 @@ var GmediaFunction = {
1022
  jQuery('#build_query_field').val(qform);
1023
  jQuery('#buildQuery').modal('hide');
1024
  });
1025
- jQuery('a.newcustomfield-modal').click(function(e) {
1026
  e.preventDefault();
1027
  var data = jQuery(this).data(),
1028
  modal_div = jQuery(jQuery(this).attr('href'));
@@ -1040,7 +1164,7 @@ var GmediaFunction = {
1040
  }
1041
  });
1042
  });
1043
- jQuery('.customfieldsubmit').on('click', function() {
1044
  var cform = jQuery('#newCustomFieldForm');
1045
  if(!jQuery('.newcustomfield-for-id', cform).val()) {
1046
  jQuery('#newCustomFieldModal').modal('hide');
@@ -1071,7 +1195,7 @@ var GmediaFunction = {
1071
  }
1072
  });
1073
  });
1074
- jQuery('.gmediacustomstuff').on('click', '.delete-custom-field', function() {
1075
  var t = jQuery(this).closest('.form-group'),
1076
  post_data = convertInputsToJSON(jQuery(':input', t));
1077
  if(!post_data) {
@@ -1100,7 +1224,7 @@ var GmediaFunction = {
1100
  });
1101
 
1102
 
1103
- jQuery('form.edit-gmedia').on('change', ':input', function() {
1104
  if(jQuery(this).hasClass('edit-gmedia-ignore')) {
1105
  return;
1106
  }
@@ -1116,9 +1240,12 @@ var GmediaFunction = {
1116
  //noinspection JSUnresolvedVariable
1117
  item.find('.status-album').attr('class', 'form-group status-album bg-status-' + data.album_status);
1118
  item.find('.status-item').attr('class', 'form-group status-item bg-status-' + data.status);
1119
- if(data.tags) {
1120
- item.find('.gmedia_tags_input').val(data.tags);
1121
  }
 
 
 
1122
  //noinspection JSUnresolvedVariable
1123
  if(data.meta_error) {
1124
  jQuery.each(data.meta_error, function(i, err) {
@@ -1141,11 +1268,11 @@ var GmediaFunction = {
1141
  });
1142
  e.preventDefault();
1143
  });
1144
- jQuery('.linkblock').on('click', '[data-href]', function() {
1145
  window.location.href = jQuery(this).data('href');
1146
  });
1147
 
1148
- jQuery('.gmedia-import').click(function() {
1149
  jQuery('#import-action').val(jQuery(this).attr('name'));
1150
  jQuery('#importModal').modal({
1151
  backdrop: 'static',
@@ -1160,7 +1287,7 @@ var GmediaFunction = {
1160
  });
1161
  });
1162
 
1163
- jQuery('#gmedia_modules').on('click', '.module_install', function(e) {
1164
  e.preventDefault();
1165
  jQuery('body').addClass('gmedia-busy');
1166
  var module = jQuery(this).data('module');
@@ -1169,14 +1296,26 @@ var GmediaFunction = {
1169
  var post_data = {
1170
  action: 'gmedia_module_install', download: jQuery(this).attr('href'), module: module, _wpnonce: jQuery('#_wpnonce').val()
1171
  };
1172
- var pathname = window.location.href;
1173
  jQuery.post(ajaxurl, post_data, function(data, status, xhr) {
1174
- jQuery('#gmedia_modules').load(pathname + ' #gmedia_modules > *').before(data);
 
 
 
 
 
 
 
 
 
 
 
 
1175
  jQuery('body').removeClass('gmedia-busy');
1176
  });
1177
  });
1178
 
1179
- jQuery('form').on('keydown', ':input:visible:not(:submit,:button,:reset,textarea)', function(e) {
1180
  var charCode = e.charCode || e.keyCode || e.which;
1181
  if(13 == charCode && !jQuery(this).parent().hasClass('selectize-input')) {
1182
  var inputs = jQuery(this).parents("form").eq(0).find(":input:visible");
@@ -1209,7 +1348,7 @@ var GmediaFunction = {
1209
  });
1210
  };
1211
  preset_popover();
1212
- jQuery('#module_preset').on('click', '.ajax-submit', function(e) {
1213
  e.preventDefault();
1214
  jQuery('body').addClass('gmedia-busy');
1215
  var form = jQuery('#gmedia-edit-term');
@@ -1226,14 +1365,20 @@ var GmediaFunction = {
1226
  preset_popover();
1227
  });
1228
  });
1229
- jQuery('body').on('click', function(e) {
1230
  if(jQuery(e.target).data('toggle') !== 'popover'
1231
  && jQuery(e.target).parents('.popover.in').length === 0) {
1232
  jQuery('[data-toggle="popover"]').popover('hide');
1233
  }
1234
  });
1235
 
1236
- jQuery('#module_preset, .module_presets').on('click', '.delpreset span', function() {
 
 
 
 
 
 
1237
  jQuery('body').addClass('gmedia-busy');
1238
  var module_preset = this;
1239
  var preset_item_li = jQuery(this).closest('li');
@@ -1260,23 +1405,23 @@ var GmediaFunction = {
1260
  setTimeout(function() {
1261
  setPanelHeadersWidth();
1262
  }, 800);
1263
- jQuery(window).resize(function() {
1264
  setPanelHeadersWidth();
1265
  });
1266
- jQuery('#collapse-menu').click(function() {
1267
  setTimeout(function() {
1268
  setPanelHeadersWidth();
1269
  }, 10);
1270
  });
1271
 
1272
- jQuery(window).scroll(function() {
1273
  UpdatePanelHeaders();
1274
  /*clearTimeout(jQuery.data(this, 'scrollTimer'));
1275
  jQuery.data(this, 'scrollTimer', setTimeout(function() {
1276
  UpdatePanelHeaders();
1277
  console.log("Haven't scrolled in 250ms!");
1278
  }, 250));*/
1279
- }).trigger("scroll");
1280
  }
1281
 
1282
  }
@@ -1291,9 +1436,11 @@ window.closeModal = function(id) {
1291
  /*
1292
  * jQuery functions for GRAND Flash Media
1293
  */
1294
- var gmedia_DOM;
1295
  function GmediaInit(){
1296
  gmedia_DOM = jQuery('#gmedia-container');
 
 
 
1297
 
1298
  GmediaSelect.init();
1299
  GmediaFunction.init();
@@ -1308,18 +1455,29 @@ function GmediaInit(){
1308
  GmediaTerms.init();
1309
  }
1310
 
1311
- var helper, title;
1312
  jQuery('[title]', gmedia_DOM).each(function(){
1313
  title = jQuery(this).attr('title');
1314
- jQuery(this).removeAttr('title').attr('data-title', title);
 
 
1315
  });
1316
- title = null;
1317
- jQuery(gmedia_DOM).on('mouseenter', '[data-title]', function(e) {
1318
- helper = jQuery('<div id="gmedia-data-helper">' + jQuery(this).attr('data-title') + '</div>').appendTo('body');
1319
- helper.css({left: e.clientX - 25, top: e.clientY + 25});
1320
- }).on('mousemove', '[data-title]', function(e) {
1321
- helper.css({left: e.clientX - 25, top: e.clientY + 25});
1322
- }).on('mouseleave', '[data-title]', function(e) {
 
 
 
 
 
 
 
 
 
1323
  jQuery('#gmedia-data-helper').remove();
1324
  helper = null;
1325
  });
@@ -1362,18 +1520,18 @@ function validateEmail(email) {
1362
  return re.test(email);
1363
  }
1364
 
1365
- function getStorage(keyPprefix) {
1366
  // use document.cookie:
1367
  return {
1368
  set: function(id, data) {
1369
- document.cookie = keyPprefix + id + '=' + encodeURIComponent(data);
1370
  },
1371
  get: function(id) {
1372
  var cookies = document.cookie, parsed = {};
1373
  cookies.replace(/([^=]+)=([^;]*);?\s*/g, function(whole, key, value) {
1374
  parsed[key] = decodeURIComponent(value);
1375
  });
1376
- return parsed[keyPprefix + id];
1377
  }
1378
  };
1379
  }
1
  /**
2
  * Gmedia Library
3
  */
4
+ var gmedia_DOM;
5
  var GmediaLibrary = {
6
  init: function() {
 
 
 
 
 
 
 
 
 
 
 
7
  window.gm_wavesurfer = {};
8
  if(jQuery('.gmedia-audio-item').length) {
9
 
19
  GmediaLibrary.waveplayer(data);
20
  }
21
  });
22
+ gmedia_DOM.on('click', '.gm-waveform', function() {
23
  var parent = jQuery(this).parent(),
24
  data = parent.data();
25
 
48
  });
49
  }
50
  });
51
+ gmedia_DOM.on('click', '.gm-play, .gm-pause', function() {
52
  var parent = jQuery(this).parent(),
53
  data = parent.data();
54
  window.gm_wavesurfer[data.id].playPause();
55
  });
56
 
57
  var resize;
58
+ jQuery(window).on('resize.gmedia', function(){
59
  clearTimeout(resize);
60
  resize = setTimeout(function(){
61
  jQuery('.gm-waveform-player').each(function() {
74
  }
75
 
76
  if(jQuery('body').hasClass('gmedia_library')) {
77
+ jQuery(window).on('load.gmedia resize.gmedia', function(){
78
  jQuery('#previewFrame', window.parent.document).height(window.document.getElementById('gmedia_iframe_content').offsetHeight + 2);
79
  });
80
+ var refresh = !jQuery('body').is('.GrandMedia_select_single, .GrandMedia_select_multiple');
81
  var observer = new MutationObserver(function(mutations) {
82
  jQuery('#previewFrame', window.parent.document).height(window.document.getElementById('gmedia_iframe_content').offsetHeight + 2);
83
+ if(refresh) {
84
+ jQuery('#previewModal', window.parent.document).attr('data-refresh', 'true');
85
+ }
86
  });
87
  var gmedia_iframe_content = window.document.getElementById('gmedia_iframe_content');
88
  observer.observe(gmedia_iframe_content, {
162
  onBlur: function(){
163
  this.$input.removeClass('edit-gmedia-ignore');
164
  if(focus_input_val != this.$input.val()) {
165
+ var inporder = this.$input.prev('.gm-order-input');
166
+ inporder.val('0');
167
+ if('' == this.$input.val()){
168
+ inporder.prop('disabled', true);
169
+ } else {
170
+ inporder.prop('disabled', false);
171
+ }
172
  this.$input.trigger('change');
173
  }
174
  },
296
  });
297
  }
298
 
299
+ if(jQuery('#wp-link-wrap').parent().hasClass('hidden')){
300
+ jQuery('#wp-link-backdrop, #wp-link-wrap').appendTo('body');
301
+ }
302
+ jQuery(document).on('click.gmedia', '.gmedia-custom-link', function(e) {
303
+ var editorId = jQuery(this).attr('data-target');
304
+ wpActiveEditor = true;
305
+ wpLink.open(editorId);
306
+ wpLink.gmediaCustomLinkTarget = editorId;
307
+ jQuery('#wp-link-wrap').removeClass('has-text-field').addClass('gmLinkModal').find('.link-target').css('visibility','hidden');
308
+
309
+ return false;
310
+ });
311
+ function closeLinkModal(){
312
+ jQuery('#wp-link-wrap').removeClass('gmLinkModal').find('.link-target').removeAttr('style');
313
+ wpLink.close();
314
+ }
315
+ jQuery(document).on('click.gmedia', '.gmLinkModal #wp-link-submit', function(e) {
316
+ e.preventDefault ? e.preventDefault() : e.returnValue = false;
317
+ e.stopPropagation();
318
+
319
+ var link = wpLink.getAttrs();
320
+ wpLink.textarea = jQuery('#' + wpLink.gmediaCustomLinkTarget);
321
+
322
+ if (!link.href) {
323
+ closeLinkModal();
324
+ return;
325
+ }
326
+ wpLink.textarea.val(link.href).trigger('change');
327
+ closeLinkModal();
328
+ });
329
+ jQuery(document).on('click.gmedia', '#wp-link-cancel, #wp-link-close, #wp-link-backdrop', function(e) {
330
+ closeLinkModal()
331
+ });
332
  }
333
  };
334
 
339
  init: function() {
340
 
341
  if(jQuery('body').hasClass('GrandMedia_AddMedia')) {
342
+ gmedia_DOM.on('change', '#uploader_runtime select', function() {
343
  if('html4' == jQuery(this).val()) {
344
  jQuery('#uploader_chunking').addClass('hide');
345
  jQuery('#uploader_urlstream_upload').addClass('hide');
467
 
468
  if(jQuery('body').hasClass('GrandMedia_Tags')) {
469
  jQuery('#gm-list-table').data('edit', false);
470
+ gmedia_DOM.on('keypress', 'input.edit_tag_input', function(e) {
471
  var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
472
  var charCode = e.charCode || e.keyCode || e.which;
473
  if(charCode == 13) {
474
  e.preventDefault();
475
  edit_tag(tagdiv);
476
  }
477
+ }).on('blur', 'input.edit_tag_input', function() {
478
  var tagdiv = jQuery('#tag_' + jQuery(this).data('tag_id'));
479
  edit_tag(tagdiv);
480
  });
481
 
482
+ gmedia_DOM.on('click', '.edit_tag_link', function(e) {
483
  e.preventDefault();
484
  var id = jQuery(this).attr('href');
485
  jQuery(this).hide();
486
  jQuery(id).find('.edit_tag_form').show().find('input').focus();
487
  jQuery('#gm-list-table').data('edit', true);
488
  });
489
+ gmedia_DOM.on('click', '.edit_tag_save', function(e) {
490
  e.preventDefault();
491
  });
492
 
523
  }
524
  }
525
 
526
+ gmedia_DOM.on('click', '.term-shortcode input', function() {
 
527
  this.setSelectionRange(0, 0);
528
  this.setSelectionRange(0, this.value.length);
529
  });
530
+ gmedia_DOM.on('change', '.term-shortcode input', function() {
531
  shortcode_inp_autowidth(this);
532
  });
533
+ jQuery('.term-shortcode input', gmedia_DOM).each(function(i, e) {
534
  shortcode_inp_autowidth(this)
535
  });
536
  function shortcode_inp_autowidth(e) {
540
  inp.width(buffer.width());
541
  }
542
 
543
+ var sortable = jQuery('#gm-sortable');
544
+ if(sortable.length && !jQuery('#gmedia-panel', sortable).hasClass('gmedia-filtered')) {
545
+ var sortdiv = jQuery('#gm-list-table', sortable);
546
+ var post_data = sortable.data();
547
+ post_data['idx0'] = parseInt(sortdiv.attr('data-idx0'));
548
+
549
+ var _ids = [];
550
+ jQuery('.gm-item-cell', sortdiv).each(function(index) {
551
+ _ids.push(jQuery(this).attr('data-id'));
552
+ });
553
+ sortdiv.sortable({
554
+ items: '.gm-item-cell',
555
+ handle: '.cb_media-object',
556
+ placeholder: 'cb_list-item gm-item-cell col-xs-6 col-sm-4 col-md-3 col-lg-2 gmedia-image-item ui-highlight-placeholder',
557
+ tolerance: 'pointer',
558
+ helper: 'clone',
559
+ revert: true,
560
+ forcePlaceholderSize: true,
561
+ stop: function(event, ui) {
562
+ var ids = [];
563
+ jQuery('.gm-item-cell', sortdiv).each(function(index) {
564
+ ids.push(jQuery(this).attr('data-id'));
565
+ });
566
+
567
+ if(_ids.toString() != ids.toString()) {
568
+ _ids = ids;
569
+ jQuery('.panel-heading .spinner', sortable).addClass('is-active');
570
+ post_data['ids'] = ids
571
+ jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR) {
572
+ jQuery('.panel-heading .spinner', sortable).removeClass('is-active');
573
+ console.log(data);
574
+ });
575
+ }
576
+ }
577
+ });
578
+ }
579
+
580
+ gmedia_DOM.on('change', '#gmedia_term_orderby', function(){
581
+ if('custom' == jQuery(this).val()){
582
+ jQuery('#gmedia_term_order').val('ASC').addClass('disabled');
583
+ } else {
584
+ jQuery('#gmedia_term_order').removeClass('disabled');
585
+ }
586
+ });
587
+
588
  }
589
  };
590
 
614
  }
615
 
616
  if(sel.data('userid')) {
617
+ var storedData = getStorage();
618
+ storedData.set(sel.data('key'), arr.join('.'));
619
  }
620
  jQuery('#gm-stack-qty').text(arr.length);
621
  if(arr.length) {
669
  }
670
 
671
  if(sel.data('userid')) {
672
+ var storedData = getStorage();
673
+ storedData.set(sel.data('key'), arr.join('.'));
674
  }
675
  jQuery('#gm-selected-qty').text(arr.length);
676
+
677
+ var selbtn = jQuery('#gm-selected-btn');
678
  if(arr.length) {
679
+ selbtn.removeClass('hidden');
680
  jQuery('.rel-selected-show').show();
681
  jQuery('.rel-selected-hide').hide();
682
  }
683
  else {
684
+ if(!selbtn.hasClass('gm-active')) {
685
+ jQuery('#gm-selected-btn').addClass('hidden');
686
+ }
687
  jQuery('.rel-selected-show').hide();
688
  jQuery('.rel-selected-hide').show();
689
  }
715
  }
716
  },
717
  init: function() {
718
+ var cb_obj = jQuery('#cb_global').data('group');
 
719
 
720
  if(jQuery('#gm-selected').length) {
721
  GmediaSelect.msg_selected(cb_obj);
722
+ gmedia_DOM.on('click', '#gm-selected-clear', function(e) {
723
  jQuery('#gm-selected').val('');
724
  GmediaSelect.chk_none(false, cb_obj);
725
  GmediaSelect.msg_selected(cb_obj);
726
  e.preventDefault();
727
  });
728
+ gmedia_DOM.on('click', '#gm-selected-show', function(e) {
729
  jQuery('#gm-selected-btn').submit();
730
  e.preventDefault();
731
  });
732
+ gmedia_DOM.on('click', '#gm-stack-in', function(e) {
733
  e.preventDefault();
734
  var stack_obj = jQuery('#gm-stack'),
735
  sel_obj = jQuery('#gm-selected'),
746
  //GmediaSelect.chk_none(false, cb_obj);
747
  //GmediaSelect.msg_selected(cb_obj);
748
  });
749
+ gmedia_DOM.on('click', '#gm-stack-out', function(e) {
750
  e.preventDefault();
751
  var stack_obj = jQuery('#gm-stack'),
752
  sel_obj = jQuery('#gm-selected'),
764
  //GmediaSelect.msg_selected(cb_obj);
765
  });
766
  }
767
+ gmedia_DOM.on('click', '#cb_global', function() {
768
  if(jQuery(this).is(':checked')) {
769
  GmediaSelect.chk_all(false, cb_obj);
770
  } else {
772
  }
773
  GmediaSelect.msg_selected(cb_obj, true);
774
  });
775
+ gmedia_DOM.on('click', '#cb_global-btn li a', function(e) {
776
  var sel = jQuery(this).data('select');
777
  switch(sel) {
778
  case 'total':
793
  GmediaSelect.msg_selected(cb_obj, true);
794
  e.preventDefault();
795
  });
796
+ gmedia_DOM.on('change', '.gm-item-check input:checkbox, .cb_object input:checkbox', function() {
797
  var selected = jQuery('#gm-selected'),
798
  arr = selected.val();
799
  var cur = jQuery(this).val();
813
  GmediaSelect.msg_selected(cb_obj);
814
  });
815
 
816
+ gmedia_DOM.on('click', '.gm-item-check input:radio', function() {
817
+ var id = jQuery(this).val(), img, checked_thumb, data;
818
+ jQuery('#list-item-' + id).addClass('gm-selected').siblings().removeClass('gm-selected');
819
+ img = jQuery(this).closest('.thumbnail').find('.gmedia-thumb').clone();
820
+ checked_thumb = jQuery('#gmedia-panel .panel-heading .checked_thumb');
821
+ if(!checked_thumb.length){
822
+ checked_thumb = jQuery('<div class="checked_thumb"></div>').appendTo(jQuery('#gmedia-panel .panel-heading'));
823
+ }
824
+ checked_thumb.html(img);
825
+ data = {'id':id, 'src':img.attr('src')};
826
+ window.parent.gmediaTempData = data;
827
+ });
828
+
829
  if(jQuery('#gm-stack').length) {
830
  GmediaSelect.msg_stack();
831
+ gmedia_DOM.on('click', '#gm-stack-clear', function(e) {
832
  jQuery('#gm-stack').val('');
833
  jQuery('.gm-stack input').prop('checked', false);
834
  GmediaSelect.msg_stack();
835
  e.preventDefault();
836
  });
837
+ gmedia_DOM.on('click', '#gm-stack-show', function(e) {
838
  jQuery('#gm-stack-btn').submit();
839
  e.preventDefault();
840
  });
841
 
842
  }
843
+ gmedia_DOM.on('change', '.gm-stack input:checkbox', function() {
844
  var selected = jQuery('#gm-stack'),
845
  arr = selected.val();
846
  var cur = jQuery(this).val();
859
  GmediaSelect.msg_stack();
860
  });
861
 
862
+ gmedia_DOM.on('click', '.term-label', function(e) {
863
  if('DIV' == e.target.nodeName) {
864
  if(!jQuery('#gm-list-table').data('edit')) {
865
  var cb = jQuery('input:checkbox', this);
902
  // jQuery('.panel-heading .spinner').removeClass('is-active');
903
  //});
904
 
905
+ gmedia_DOM.on('click', '[data-confirm]', function() {
906
  return GmediaFunction.confirm(jQuery(this).data('confirm'));
907
  });
908
 
909
+ gmedia_DOM.on('click', '.show-settings-link', function(e) {
910
  e.preventDefault();
911
  jQuery('#show-settings-link').trigger('click');
912
  });
913
 
914
+ gmedia_DOM.on('click', '.fit-thumbs', function(e) {
915
  e.preventDefault();
916
  jQuery(this).toggleClass('btn-success btn-default');
917
  jQuery('.display-as-grid').toggleClass('invert-ratio');
918
  jQuery.get(jQuery(this).attr('href'), {ajaxload: 1});
919
  });
920
 
921
+ gmedia_DOM.on('click', '.gm-cell-more-btn, .gm-cell-title', function() {
922
  jQuery(this).parent().toggleClass('gm-cell-more-active');
923
  });
924
 
925
+ jQuery('div.gmedia-modal', gmedia_DOM).each(function(){
926
+ var id = jQuery(this).attr('id');
927
+ jQuery('body').children('#' + id).remove();
928
+ jQuery(this).appendTo('body');
929
+ });
930
+ gmedia_DOM.on('click', 'a.gmedia-modal', function(e) {
931
  jQuery('body').addClass('gmedia-busy');
932
  var modal_div = jQuery(jQuery(this).attr('href'));
933
+ var post_data = jQuery(this).data();
934
+ post_data['_wpnonce'] = jQuery('#_wpnonce').val();
 
935
  jQuery.post(ajaxurl, post_data, function(data, textStatus, jqXHR) {
936
  if(!data || ('-1' == data)) {
937
  jQuery('body').removeClass('gmedia-busy');
951
  e.preventDefault();
952
  });
953
 
954
+ gmedia_DOM.on('click', 'a.gmedit-modal', function(e) {
955
  e.preventDefault();
956
  var modal_div = jQuery(jQuery(this).data('target'));
957
  jQuery('.modal-content', modal_div).html(
972
  });
973
  });
974
 
975
+ gmedia_DOM.on('click', 'a.preview-modal', function(e) {
976
  e.preventDefault();
977
+ var initiator = jQuery(this),
978
+ data = initiator.data(),
979
  modal_div = jQuery(data['target']),
980
  modal_dialog = jQuery('.modal-dialog', modal_div),
981
  modal_body = jQuery('.modal-body', modal_div),
1007
  );
1008
  }
1009
 
1010
+ initiator.addClass('previewModal_initiator');
1011
  modal_div.modal({
1012
  backdrop: true,
1013
  show: true
1022
  jQuery.get(url, function(data) {
1023
  jQuery('#gmedia-panel').html(jQuery('#gmedia-panel', data).html());
1024
  GmediaInit();
1025
+ jQuery('.panel-heading .spinner').removeClass('is-active');
1026
  });
1027
  }
1028
+ initiator.removeClass('previewModal_initiator');
1029
+ });
1030
+ });
1031
+
1032
+ jQuery(document).on('click.gmedia', '#previewModal .select_gmedia_image .btn-primary', function() {
1033
+ var img, form = jQuery('.previewModal_initiator').closest('form');
1034
+ form.find('.gmedia-cover-id').val(window.gmediaTempData.id).trigger('change');
1035
+ img = form.find('.gmedia-cover-image img:first-child');
1036
+ if(img.length){
1037
+ img.attr('src', window.gmediaTempData.src);
1038
+ } else {
1039
+ jQuery('<img src="" alt="" />').attr('src', window.gmediaTempData.src).appendTo(form.find('.gmedia-cover-image'));
1040
+ }
1041
+ jQuery('#previewModal').modal('hide');
1042
+ });
1043
+
1044
+ jQuery(document).on('click.gmedia', '#previewModal .assign_gmedia_term .btn-primary', function() {
1045
+ jQuery('.panel-heading .spinner').addClass('is-active');
1046
+ var url = window.location.href,
1047
+ post_data = jQuery('#gmedia-assign-term').serialize();
1048
+ jQuery.post(url, post_data, function(data) {
1049
+ jQuery('.gmedia_term__in').html(jQuery('.gmedia_term__in', data).html());
1050
+ GmediaInit();
1051
+ jQuery('.panel-heading .spinner').removeClass('is-active');
1052
  });
1053
+ jQuery('#previewModal').modal('hide');
1054
+ //console.log(window.gmediaTempData);
1055
  });
1056
 
1057
+ jQuery(document).on('click.gmedia focus.gmedia', 'input.sharelink', function() {
1058
  this.setSelectionRange(0, this.value.length);
1059
  });
1060
+ jQuery(document).on('keyup.gmedia', 'input.sharetoemail', function() {
1061
  jQuery('.sharebutton').prop('disabled', !validateEmail(this.value));
1062
  });
1063
+ jQuery(document).on('click.gmedia', '.sharebutton', function() {
1064
  var sharetoemail = jQuery('input.sharetoemail');
1065
  if(!validateEmail(sharetoemail.val())) {
1066
  sharetoemail.focus();
1076
  });
1077
  jQuery('#shareModal').modal('hide');
1078
  });
1079
+ gmedia_DOM.on('click', 'a.share-modal', function(e) {
1080
  e.preventDefault();
1081
  var data = jQuery(this).data(),
1082
  modal_div = jQuery(data['target']),
1117
  });
1118
  });
1119
 
1120
+ gmedia_DOM.on('click', '.buildquery-modal', function(e) {
1121
  e.preventDefault();
1122
  var data = jQuery(this).data(),
1123
  modal_div = jQuery(jQuery(this).attr('href')),
1136
  }).one('hidden.bs.modal', function() {});
1137
  });
1138
 
1139
+ jQuery(document).on('click.gmedia', '.buildquerysubmit', function() {
1140
  var qform = jQuery('#buildQuery :input').filter(function() {
1141
  return !!jQuery(this).val();
1142
  });
1146
  jQuery('#build_query_field').val(qform);
1147
  jQuery('#buildQuery').modal('hide');
1148
  });
1149
+ gmedia_DOM.on('click', 'a.newcustomfield-modal', function(e) {
1150
  e.preventDefault();
1151
  var data = jQuery(this).data(),
1152
  modal_div = jQuery(jQuery(this).attr('href'));
1164
  }
1165
  });
1166
  });
1167
+ jQuery(document).on('click.gmedia', '.customfieldsubmit', function() {
1168
  var cform = jQuery('#newCustomFieldForm');
1169
  if(!jQuery('.newcustomfield-for-id', cform).val()) {
1170
  jQuery('#newCustomFieldModal').modal('hide');
1195
  }
1196
  });
1197
  });
1198
+ gmedia_DOM.on('click', '.delete-custom-field', function() {
1199
  var t = jQuery(this).closest('.form-group'),
1200
  post_data = convertInputsToJSON(jQuery(':input', t));
1201
  if(!post_data) {
1224
  });
1225
 
1226
 
1227
+ gmedia_DOM.on('change', 'form.edit-gmedia :input', function() {
1228
  if(jQuery(this).hasClass('edit-gmedia-ignore')) {
1229
  return;
1230
  }
1240
  //noinspection JSUnresolvedVariable
1241
  item.find('.status-album').attr('class', 'form-group status-album bg-status-' + data.album_status);
1242
  item.find('.status-item').attr('class', 'form-group status-item bg-status-' + data.status);
1243
+ if(data.thumbnail) {
1244
+ item.find('.gmedia-cover-image').html(data.thumbnail);
1245
  }
1246
+ //if(data.tags) {
1247
+ // item.find('.gmedia_tags_input').val(data.tags);
1248
+ //}
1249
  //noinspection JSUnresolvedVariable
1250
  if(data.meta_error) {
1251
  jQuery.each(data.meta_error, function(i, err) {
1268
  });
1269
  e.preventDefault();
1270
  });
1271
+ jQuery(document).on('click.gmedia', '.linkblock [data-href]', function() {
1272
  window.location.href = jQuery(this).data('href');
1273
  });
1274
 
1275
+ gmedia_DOM.on('click', '.gmedia-import', function() {
1276
  jQuery('#import-action').val(jQuery(this).attr('name'));
1277
  jQuery('#importModal').modal({
1278
  backdrop: 'static',
1287
  });
1288
  });
1289
 
1290
+ gmedia_DOM.on('click', '.module_install', function(e) {
1291
  e.preventDefault();
1292
  jQuery('body').addClass('gmedia-busy');
1293
  var module = jQuery(this).data('module');
1296
  var post_data = {
1297
  action: 'gmedia_module_install', download: jQuery(this).attr('href'), module: module, _wpnonce: jQuery('#_wpnonce').val()
1298
  };
1299
+ var pathname = window.location.href + '&time=' + jQuery.now();
1300
  jQuery.post(ajaxurl, post_data, function(data, status, xhr) {
1301
+ setTimeout(function(){
1302
+ jQuery('#gmedia_modules').load(pathname + ' #gmedia_modules_wrapper', function(){
1303
+ setTimeout(function(){
1304
+ var update_count = jQuery('#gmedia_modules').find('#gmedia_modules_wrapper').attr('data-update');
1305
+ if(parseInt(update_count)){
1306
+ jQuery('.gm-module-count').html(update_count);
1307
+ } else {
1308
+ jQuery('.gm-module-count').remove();
1309
+ }
1310
+ }, 1);
1311
+ });
1312
+ }, 1);
1313
+ jQuery('#gmedia_modules').before(data);
1314
  jQuery('body').removeClass('gmedia-busy');
1315
  });
1316
  });
1317
 
1318
+ gmedia_DOM.on('keydown', 'form :input:visible:not(:submit,:button,:reset,textarea,#gmedia-search)', function(e) {
1319
  var charCode = e.charCode || e.keyCode || e.which;
1320
  if(13 == charCode && !jQuery(this).parent().hasClass('selectize-input')) {
1321
  var inputs = jQuery(this).parents("form").eq(0).find(":input:visible");
1348
  });
1349
  };
1350
  preset_popover();
1351
+ gmedia_DOM.on('click', '#module_preset .ajax-submit', function(e) {
1352
  e.preventDefault();
1353
  jQuery('body').addClass('gmedia-busy');
1354
  var form = jQuery('#gmedia-edit-term');
1365
  preset_popover();
1366
  });
1367
  });
1368
+ jQuery(document).on('click.gmedia', function(e) {
1369
  if(jQuery(e.target).data('toggle') !== 'popover'
1370
  && jQuery(e.target).parents('.popover.in').length === 0) {
1371
  jQuery('[data-toggle="popover"]').popover('hide');
1372
  }
1373
  });
1374
 
1375
+ gmedia_DOM.on('click', '[data-clicktarget]', function(e){
1376
+ e.preventDefault();
1377
+ var id = jQuery(this).attr('data-clicktarget');
1378
+ jQuery('#' + id).click();
1379
+ });
1380
+
1381
+ gmedia_DOM.on('click', '#module_preset .delpreset span, .module_presets .delpreset span', function() {
1382
  jQuery('body').addClass('gmedia-busy');
1383
  var module_preset = this;
1384
  var preset_item_li = jQuery(this).closest('li');
1405
  setTimeout(function() {
1406
  setPanelHeadersWidth();
1407
  }, 800);
1408
+ jQuery(window).on('resize.gmedia', function() {
1409
  setPanelHeadersWidth();
1410
  });
1411
+ jQuery(document).on('click.gmedia', '#collapse-menu', function() {
1412
  setTimeout(function() {
1413
  setPanelHeadersWidth();
1414
  }, 10);
1415
  });
1416
 
1417
+ jQuery(window).on('scroll.gmedia', function() {
1418
  UpdatePanelHeaders();
1419
  /*clearTimeout(jQuery.data(this, 'scrollTimer'));
1420
  jQuery.data(this, 'scrollTimer', setTimeout(function() {
1421
  UpdatePanelHeaders();
1422
  console.log("Haven't scrolled in 250ms!");
1423
  }, 250));*/
1424
+ }).trigger("scroll.gmedia");
1425
  }
1426
 
1427
  }
1436
  /*
1437
  * jQuery functions for GRAND Flash Media
1438
  */
 
1439
  function GmediaInit(){
1440
  gmedia_DOM = jQuery('#gmedia-container');
1441
+ gmedia_DOM.off();
1442
+ jQuery(window).off('.gmedia');
1443
+ jQuery(document).off('.gmedia');
1444
 
1445
  GmediaSelect.init();
1446
  GmediaFunction.init();
1455
  GmediaTerms.init();
1456
  }
1457
 
1458
+ var helper, helper_width, title;
1459
  jQuery('[title]', gmedia_DOM).each(function(){
1460
  title = jQuery(this).attr('title');
1461
+ if(title) {
1462
+ jQuery(this).attr('title','').attr('data-title', title);
1463
+ }
1464
  });
1465
+ gmedia_DOM.on('mouseenter', '[title]', function(e) {
1466
+ title = jQuery(this).attr('data-title');
1467
+ if(title) {
1468
+ helper = jQuery('<div id="gmedia-data-helper">' + title + '</div>').appendTo('body');
1469
+ helper_width = 0;
1470
+ if(e.pageX > (window.innerWidth / 2)) {
1471
+ helper_width = helper.width() - 25;
1472
+ helper.addClass('tiptoleft');
1473
+ }
1474
+ helper.css({left: e.clientX - helper_width - 25, top: e.clientY + 25});
1475
+ } else{
1476
+ jQuery(this).removeAttr('title');
1477
+ }
1478
+ }).on('mousemove', '[title]', function(e) {
1479
+ helper.css({left:e.clientX - helper_width - 25, top: e.clientY + 25});
1480
+ }).on('mouseleave', '[title]', function(e) {
1481
  jQuery('#gmedia-data-helper').remove();
1482
  helper = null;
1483
  });
1520
  return re.test(email);
1521
  }
1522
 
1523
+ function getStorage() {
1524
  // use document.cookie:
1525
  return {
1526
  set: function(id, data) {
1527
+ document.cookie = id + '=' + encodeURIComponent(data);
1528
  },
1529
  get: function(id) {
1530
  var cookies = document.cookie, parsed = {};
1531
  cookies.replace(/([^=]+)=([^;]*);?\s*/g, function(whole, key, value) {
1532
  parsed[key] = decodeURIComponent(value);
1533
  });
1534
+ return parsed[id];
1535
  }
1536
  };
1537
  }
admin/class.processor.php CHANGED
@@ -5,6 +5,7 @@
5
  */
6
  class GmediaProcessor{
7
 
 
8
  public $page;
9
  public $gmediablank;
10
  public $url;
@@ -12,6 +13,11 @@ class GmediaProcessor{
12
  public $error;
13
  public $user_options = array();
14
 
 
 
 
 
 
15
  /**
16
  * initiate the manage page
17
  */
@@ -19,8 +25,7 @@ class GmediaProcessor{
19
  global $pagenow, $gmCore;
20
  // GET variables
21
  $this->page = $gmCore->_get('page');
22
- $this->gmediablank = $gmCore->_get('gmediablank');
23
- $this->url = add_query_arg(array('page' => $this->page, 'gmediablank' => $this->gmediablank), admin_url('admin.php'));
24
  if('media.php' === $pagenow){
25
  add_filter('wp_redirect', array($this, 'redirect'), 10, 2);
26
  }
@@ -30,6 +35,34 @@ class GmediaProcessor{
30
 
31
  add_action('init', array($this, 'controller'));
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  /**
@@ -38,6 +71,8 @@ class GmediaProcessor{
38
  public function controller(){
39
 
40
  $this->user_options = self::user_options();
 
 
41
 
42
  if(!$this->page || strpos($this->page, 'GrandMedia') === false){
43
  return;
@@ -69,19 +104,19 @@ class GmediaProcessor{
69
  }
70
 
71
  /**
72
- * @param string $cookie_key
73
  * @param string $post_key
74
  *
75
  * @return array
76
  */
77
- public static function selected_items($cookie_key, $post_key = 'selected_items'){
78
 
79
  $selected_items = array();
80
- if($cookie_key){
81
  if(isset($_POST[ $post_key ])){
82
  $selected_items = array_filter(explode(',', $_POST[ $post_key ]), 'is_numeric');
83
- } elseif(isset($_COOKIE[ $cookie_key ])){
84
- $selected_items = array_filter(explode(',', $_COOKIE[ $cookie_key ]), 'is_numeric');
85
  }
86
  }
87
 
@@ -94,11 +129,9 @@ class GmediaProcessor{
94
  * @return array
95
  */
96
  public function clear_selected_items($cookie_key){
97
- global $user_ID;
98
-
99
  if($cookie_key){
100
- setcookie("gmuser_{$user_ID}_{$cookie_key}", '', time() - 3600);
101
- unset($_COOKIE["gmuser_{$user_ID}_{$cookie_key}"]);
102
  }
103
 
104
  return array();
@@ -177,40 +210,71 @@ class GmediaProcessor{
177
  * Autoloader
178
  */
179
  public static function autoload(){
180
- $path_ = GMEDIA_ABSPATH . '/admin/processor/class.processor.';
181
  $page = isset($_GET['page'])? $_GET['page'] : '';
182
  switch($page){
183
  case 'GrandMedia':
 
184
  include_once($path_ . 'library.php');
 
 
185
  break;
186
  case 'GrandMedia_AddMedia':
 
187
  include_once($path_ . 'addmedia.php');
 
 
188
  break;
189
  case 'GrandMedia_Albums':
190
  case 'GrandMedia_Categories':
 
 
 
 
 
 
 
191
  case 'GrandMedia_Tags':
 
192
  include_once($path_ . 'terms.php');
 
 
193
  break;
194
  case 'GrandMedia_Galleries':
 
195
  include_once($path_ . 'galleries.php');
 
 
196
  break;
197
  case 'GrandMedia_Modules':
 
198
  include_once($path_ . 'modules.php');
 
 
199
  break;
200
  case 'GrandMedia_Settings':
 
201
  include_once($path_ . 'settings.php');
 
 
202
  break;
203
  case 'GrandMedia_WordpressLibrary':
 
204
  include_once($path_ . 'wpmedia.php');
 
 
205
  break;
206
  default:
207
- global $gmProcessor;
208
- $gmProcessor = new GmediaProcessor();
 
 
 
209
  break;
210
  }
211
  }
212
 
213
-
214
  }
215
 
216
- GmediaProcessor::autoload();
 
5
  */
6
  class GmediaProcessor{
7
 
8
+ private static $me = null;
9
  public $page;
10
  public $gmediablank;
11
  public $url;
13
  public $error;
14
  public $user_options = array();
15
 
16
+ public $display_mode;
17
+ public $taxonomy;
18
+ public $taxterm;
19
+ public $edit_term;
20
+
21
  /**
22
  * initiate the manage page
23
  */
25
  global $pagenow, $gmCore;
26
  // GET variables
27
  $this->page = $gmCore->_get('page');
28
+ $this->url = add_query_arg(array('page' => $this->page), admin_url('admin.php'));
 
29
  if('media.php' === $pagenow){
30
  add_filter('wp_redirect', array($this, 'redirect'), 10, 2);
31
  }
35
 
36
  add_action('init', array($this, 'controller'));
37
 
38
+ if(!$this->page || strpos($this->page, 'GrandMedia') === false){
39
+ return;
40
+ }
41
+
42
+ $this->gmediablank = $gmCore->_get('gmediablank');
43
+ if($this->gmediablank){
44
+ $this->url = add_query_arg(array('gmediablank' => $this->gmediablank), $this->url);
45
+ }
46
+
47
+ switch($this->page){
48
+ case 'GrandMedia_Albums':
49
+ $this->taxonomy = 'gmedia_album';
50
+ break;
51
+ case 'GrandMedia_Categories':
52
+ $this->taxonomy = 'gmedia_category';
53
+ break;
54
+ case 'GrandMedia_Tags':
55
+ $this->taxonomy = 'gmedia_tag';
56
+ break;
57
+ case 'GrandMedia_Galleries':
58
+ $this->taxonomy = 'gmedia_gallery';
59
+ break;
60
+ }
61
+ if($this->taxonomy){
62
+ $this->taxterm = str_replace('gmedia_', '', $this->taxonomy);
63
+ $this->edit_term = $gmCore->_get('edit_term');
64
+ }
65
+
66
  }
67
 
68
  /**
71
  public function controller(){
72
 
73
  $this->user_options = self::user_options();
74
+ $view = $this->gmediablank? '_frame' : '';
75
+ $this->display_mode = $this->user_options["display_mode_gmedia{$view}"];
76
 
77
  if(!$this->page || strpos($this->page, 'GrandMedia') === false){
78
  return;
104
  }
105
 
106
  /**
107
+ * @param string $key
108
  * @param string $post_key
109
  *
110
  * @return array
111
  */
112
+ public static function selected_items($key, $post_key = 'selected_items'){
113
 
114
  $selected_items = array();
115
+ if($key){
116
  if(isset($_POST[ $post_key ])){
117
  $selected_items = array_filter(explode(',', $_POST[ $post_key ]), 'is_numeric');
118
+ } elseif(isset($_COOKIE[ $key ])){
119
+ $selected_items = array_filter(explode('.', $_COOKIE[ $key ]), 'is_numeric');
120
  }
121
  }
122
 
129
  * @return array
130
  */
131
  public function clear_selected_items($cookie_key){
 
 
132
  if($cookie_key){
133
+ setcookie($cookie_key, '', time() - 3600);
134
+ unset($_COOKIE[ $cookie_key ]);
135
  }
136
 
137
  return array();
210
  * Autoloader
211
  */
212
  public static function autoload(){
213
+ $path_ = GMEDIA_ABSPATH . 'admin/processor/class.processor.';
214
  $page = isset($_GET['page'])? $_GET['page'] : '';
215
  switch($page){
216
  case 'GrandMedia':
217
+ /** @var $gmProcessorLibrary */
218
  include_once($path_ . 'library.php');
219
+
220
+ return $gmProcessorLibrary;
221
  break;
222
  case 'GrandMedia_AddMedia':
223
+ /** @var $gmProcessorAddMedia */
224
  include_once($path_ . 'addmedia.php');
225
+
226
+ return $gmProcessorAddMedia;
227
  break;
228
  case 'GrandMedia_Albums':
229
  case 'GrandMedia_Categories':
230
+ /** @var $gmProcessorTerms */
231
+ include_once($path_ . 'terms.php');
232
+ /** @var $gmProcessorLibrary */
233
+ include_once($path_ . 'library.php');
234
+
235
+ return $gmProcessorTerms;
236
+ break;
237
  case 'GrandMedia_Tags':
238
+ /** @var $gmProcessorTerms */
239
  include_once($path_ . 'terms.php');
240
+
241
+ return $gmProcessorTerms;
242
  break;
243
  case 'GrandMedia_Galleries':
244
+ /** @var $gmProcessorGalleries */
245
  include_once($path_ . 'galleries.php');
246
+
247
+ return $gmProcessorGalleries;
248
  break;
249
  case 'GrandMedia_Modules':
250
+ /** @var $gmProcessorModules */
251
  include_once($path_ . 'modules.php');
252
+
253
+ return $gmProcessorModules;
254
  break;
255
  case 'GrandMedia_Settings':
256
+ /** @var $gmProcessorSettings */
257
  include_once($path_ . 'settings.php');
258
+
259
+ return $gmProcessorSettings;
260
  break;
261
  case 'GrandMedia_WordpressLibrary':
262
+ /** @var $gmProcessorWPMedia */
263
  include_once($path_ . 'wpmedia.php');
264
+
265
+ return $gmProcessorWPMedia;
266
  break;
267
  default:
268
+ if(self::$me == null){
269
+ self::$me = new GmediaProcessor();
270
+ }
271
+
272
+ return self::$me;
273
  break;
274
  }
275
  }
276
 
 
277
  }
278
 
279
+ global $gmProcessor;
280
+ $gmProcessor = GmediaProcessor::autoload();
admin/functions.php CHANGED
@@ -10,12 +10,6 @@ function gm_panel_classes($classes){
10
  echo implode(' ', (array)$classes);
11
  }
12
 
13
- function gm_user_can($capability){
14
- global $gmCore;
15
-
16
- return isset($gmCore->caps[ 'gmedia_' . $capability ])? $gmCore->caps[ 'gmedia_' . $capability ] : false;
17
- }
18
-
19
  function gmedia_term_choose_author_field($selected = false, $_args = array()){
20
  global $gmCore;
21
 
@@ -44,144 +38,3 @@ function gmedia_term_choose_author_field($selected = false, $_args = array()){
44
  echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
45
  }
46
  }
47
-
48
- /** Get available modules
49
- *
50
- * @param bool|true $including_remote
51
- *
52
- * @return array
53
- */
54
- function get_gmedia_modules($including_remote = true){
55
- global $gmCore, $gmGallery;
56
-
57
- $modules = array();
58
- $modules['in'] = $gmCore->modules_order();
59
- if(($plugin_modules = glob(GMEDIA_ABSPATH . 'module/*', GLOB_ONLYDIR | GLOB_NOSORT))){
60
- foreach($plugin_modules as $path){
61
- $mfold = basename($path);
62
- $modules['in'][ $mfold ] = array('place' => 'plugin',
63
- 'module_name' => $mfold,
64
- 'module_url' => $gmCore->gmedia_url . "/module/{$mfold}",
65
- 'module_path' => $path
66
- );
67
- }
68
- }
69
- if(($upload_modules = glob($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/*', GLOB_ONLYDIR | GLOB_NOSORT))){
70
- foreach($upload_modules as $path){
71
- $mfold = basename($path);
72
- $modules['in'][ $mfold ] = array('place' => 'upload',
73
- 'module_name' => $mfold,
74
- 'module_url' => $gmCore->upload['url'] . "/{$gmGallery->options['folder']['module']}/{$mfold}",
75
- 'module_path' => $path
76
- );
77
- }
78
- }
79
-
80
- $modules['in'] = array_filter($modules['in']);
81
-
82
- if(isset($modules['in']) && !empty($modules['in'])){
83
- foreach($modules['in'] as $mfold => $module){
84
- // todo: get broken modules folders and delete them
85
- if(!file_exists($module['module_path'] . '/index.php')){
86
- unset($modules['in'][ $mfold ]);
87
- continue;
88
- }
89
- $module_info = array();
90
- include($module['module_path'] . '/index.php');
91
- if(empty($module_info)){
92
- unset($modules['in'][ $mfold ]);
93
- continue;
94
- }
95
- $modules['in'][ $mfold ] = array_merge($module, (array)$module_info);
96
- $modules['in'][ $mfold ]['update'] = false;
97
- }
98
- }
99
-
100
- if($including_remote){
101
- $get_xml = wp_remote_get($gmGallery->options['modules_xml'], array('sslverify' => true));
102
- if(!is_wp_error($get_xml) && (200 == $get_xml['response']['code'])){
103
- $xml = @simplexml_load_string($get_xml['body']);
104
- if(!empty($xml)){
105
- foreach($xml as $m){
106
- $name = (string)$m->name;
107
- $modules['xml'][ $name ] = get_object_vars($m);
108
- $modules['xml'][ $name ]['place'] = 'remote';
109
- if(isset($modules['in'][ $name ]) && !empty($modules['in'][ $name ])){
110
- $modules['in'][ $name ] = array_merge(get_object_vars($m), $modules['in'][ $name ]);
111
- if(version_compare((float)$modules['xml'][ $name ]['version'], (float)$modules['in'][ $name ]['version'], '>')){
112
- $modules['in'][ $name ]['update'] = $modules['xml'][ $name ]['version'];
113
- $modules['out'][ $name ] = $modules['xml'][ $name ];
114
- }
115
- } else{
116
- $modules['out'][ $name ] = $modules['xml'][ $name ];
117
- }
118
- }
119
- }
120
- } else{
121
- $modules['error'] = array(__('Error loading remote xml...', 'grand-media'));
122
- if(is_wp_error($get_xml)){
123
- $modules['error'][] = $get_xml->get_error_message();
124
- }
125
- }
126
- }
127
-
128
- return $modules;
129
- }
130
-
131
- /**
132
- * @param array $query
133
- *
134
- * @return array
135
- */
136
- function gmedia_gallery_query_data($query = array()){
137
- $filter_data = array('author__in' => array(),
138
- 'author__not_in' => array(),
139
- 'category__and' => array(), /* use category id. Display posts that are tagged with all listed categories in array */
140
- 'category__in' => array(), /* use category id. Same as 'cat', but does not accept negative values */
141
- 'category__not_in' => array(), /* use category id. Exclude multiple categories */
142
- 'album__in' => array(), /* use album id. Same as 'alb' */
143
- 'album__not_in' => array(), /* use album id. Exclude multiple albums */
144
- 'tag__and' => array(), /* use tag ids. Display posts that are tagged with all listed tags in array */
145
- 'tag__in' => array(), /* use tag ids. To display posts from either tags listed in array. Same as 'tag' */
146
- 'tag__not_in' => array(), /* use tag ids. Display posts that do not have any of the listed tag ids */
147
- 'terms_relation' => '', /* allows you to describe the boolean relationship between the taxonomy queries. Possible values are 'OR', 'AND'. Default 'AND' */
148
- 'gmedia__in' => array(), /* use gmedia ids. Specify posts to retrieve */
149
- 'gmedia__not_in' => array(), /* use gmedia ids. Specify post NOT to retrieve */
150
- 'mime_type' => array(), /* mime types */
151
- 'limit' => '', /* (int) - set limit */
152
- 'page' => '', /* (int) - set limit */
153
- 'per_page' => '', /* (int) - set limit */
154
- 'order' => '', /* Designates the ascending or descending order of the 'orderby' parameter. Defaults to 'DESC' */
155
- 'orderby' => '', /* Sort retrieved posts by parameter. Defaults to 'ID' */
156
- 'year' => '', /* (int) - 4 digit year */
157
- 'monthnum' => '', /* (int) - Month number (from 1 to 12) */
158
- 'day' => '', /* (int) - Day of the month (from 1 to 31) */
159
- 'meta_query' => array(array('key' => '',
160
- 'value' => '',
161
- 'compare' => '',
162
- 'type' => ''
163
- )
164
- ),
165
- 's' => '', /* (string) - search string or terms separated by comma */
166
- 'exact' => false /* Search exactly string if 'exact' parameter set to true */
167
-
168
- );
169
-
170
- $filter_data = wp_parse_args($query, $filter_data);
171
-
172
- $query_args = (array)gmedia_array_filter_recursive($filter_data);
173
-
174
- return array('query_data' => $filter_data,
175
- 'query_args' => $query_args
176
- );
177
- }
178
-
179
- function gmedia_array_filter_recursive($input){
180
- foreach($input as &$value){
181
- if(is_array($value)){
182
- $value = gmedia_array_filter_recursive($value);
183
- }
184
- }
185
-
186
- return array_filter($input);
187
- }
10
  echo implode(' ', (array)$classes);
11
  }
12
 
 
 
 
 
 
 
13
  function gmedia_term_choose_author_field($selected = false, $_args = array()){
14
  global $gmCore;
15
 
38
  echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
39
  }
40
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/pages/addmedia/tpl/assign-terms.php CHANGED
@@ -10,7 +10,9 @@ if(!defined('ABSPATH')) {
10
  die('-1');
11
  }
12
 
13
- if(gm_user_can('terms')) { ?>
 
 
14
  <div class="form-group">
15
  <?php
16
  $term_type = 'gmedia_album';
@@ -19,6 +21,7 @@ if(gm_user_can('terms')) { ?>
19
 
20
  $terms_album = '';
21
  if(count($gm_terms)) {
 
22
  foreach($gm_terms as $term) {
23
  $author_name = '';
24
  if($term->global) {
@@ -31,7 +34,7 @@ if(gm_user_can('terms')) { ?>
31
  if('publish' != $term->status) {
32
  $author_name .= ' [' . $term->status . ']';
33
  }
34
- $terms_album .= '<option value="' . $term->term_id . '" data-name="' . esc_html($term->name) . '" data-meta="' . $author_name . '">' . esc_html($term->name) . $author_name . '</option>' . "\n";
35
  }
36
  }
37
  ?>
@@ -45,23 +48,27 @@ if(gm_user_can('terms')) { ?>
45
  <div class="form-group">
46
  <?php
47
  $term_type = 'gmedia_category';
48
- $gm_category_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
 
 
49
  ?>
50
  <label><?php _e('Assign Categories', 'grand-media'); ?></label>
51
- <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'); ?>"/>
52
  </div>
53
 
54
  <div class="form-group">
55
  <?php
56
  $term_type = 'gmedia_tag';
57
- $gm_tag_terms = $gmDB->get_terms($term_type, array('fields' => 'names'));
 
 
58
  ?>
59
  <label><?php _e('Add Tags', 'grand-media'); ?> </label>
60
- <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'); ?>"/>
61
  </div>
62
  <script type="text/javascript">
63
- var gmedia_categories = <?php echo json_encode($gm_category_terms); ?>;
64
- var gmedia_tags = <?php echo json_encode($gm_tag_terms); ?>;
65
  </script>
66
  <?php } else { ?>
67
  <p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
10
  die('-1');
11
  }
12
 
13
+ if(gm_user_can('terms')) {
14
+ global $gmCore;
15
+ ?>
16
  <div class="form-group">
17
  <?php
18
  $term_type = 'gmedia_album';
21
 
22
  $terms_album = '';
23
  if(count($gm_terms)) {
24
+ $selected = (int) $gmCore->_get('album');
25
  foreach($gm_terms as $term) {
26
  $author_name = '';
27
  if($term->global) {
34
  if('publish' != $term->status) {
35
  $author_name .= ' [' . $term->status . ']';
36
  }
37
+ $terms_album .= '<option value="' . $term->term_id . '" data-name="' . esc_html($term->name) . '" data-meta="' . $author_name . '"' . selected($selected, $term->term_id, false) . '>' . esc_html($term->name) . $author_name . '</option>' . "\n";
38
  }
39
  }
40
  ?>
48
  <div class="form-group">
49
  <?php
50
  $term_type = 'gmedia_category';
51
+ $gm_category_terms = $gmDB->get_terms($term_type, array('fields' => 'id=>names'));
52
+ $selected = (int) $gmCore->_get('category');
53
+ $selected = isset($gm_category_terms[$selected])? $gm_category_terms[$selected] : '';
54
  ?>
55
  <label><?php _e('Assign Categories', 'grand-media'); ?></label>
56
+ <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="<?php echo $selected ?>" placeholder="<?php _e('Uncategorized', 'grand-media'); ?>"/>
57
  </div>
58
 
59
  <div class="form-group">
60
  <?php
61
  $term_type = 'gmedia_tag';
62
+ $gm_tag_terms = $gmDB->get_terms($term_type, array('fields' => 'id=>names'));
63
+ $selected = (int) $gmCore->_get('tag');
64
+ $selected = isset($gm_tag_terms[$selected])? $gm_tag_terms[$selected] : '';
65
  ?>
66
  <label><?php _e('Add Tags', 'grand-media'); ?> </label>
67
+ <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="<?php echo $selected ?>" placeholder="<?php _e('Add Tags...', 'grand-media'); ?>"/>
68
  </div>
69
  <script type="text/javascript">
70
+ var gmedia_categories = <?php echo json_encode(array_values($gm_category_terms)); ?>;
71
+ var gmedia_tags = <?php echo json_encode(array_values($gm_tag_terms)); ?>;
72
  </script>
73
  <?php } else { ?>
74
  <p><?php _e('You are not allowed to assign terms', 'grand-media') ?></p>
admin/pages/addmedia/tpl/panel-heading.php CHANGED
@@ -12,11 +12,11 @@ $extra_tools = ($gmProcessor->gmediablank || (defined('GMEDIA_IFRAME') && GMEDIA
12
  ?>
13
  <div class="panel-heading clearfix">
14
  <?php if($extra_tools) { ?>
15
- <div class="btn-toolbar pull-left">
16
  <div class="btn-group">
17
- <a class="btn btn<?php echo !$import? '-primary active' : '-default'; ?>" href="<?php echo $url; ?>"><?php _e('Upload Files', 'grand-media'); ?></a>
18
  <?php if(gm_user_can('import')) { ?>
19
- <a class="btn btn<?php echo $import? '-primary active' : '-default'; ?>" href="<?php echo gm_get_admin_url(array('import' => 1), null, $url); ?>"><?php _e('Import', 'grand-media'); ?></a>
20
  <?php } ?>
21
  </div>
22
  <?php if($import && gm_user_can('import')) { ?>
12
  ?>
13
  <div class="panel-heading clearfix">
14
  <?php if($extra_tools) { ?>
15
+ <div class="btn-toolbar pull-left" style="white-space:nowrap;">
16
  <div class="btn-group">
17
+ <a class="btn btn<?php echo !$import? '-primary active' : '-default'; ?>" href="<?php echo gm_get_admin_url(array(), array('import'), $url); ?>"><?php _e('Upload Files', 'grand-media'); ?></a>
18
  <?php if(gm_user_can('import')) { ?>
19
+ <a class="btn btn<?php echo $import? '-primary active' : '-default'; ?>" href="<?php echo gm_get_admin_url(array('import' => 1), array(), $url); ?>"><?php _e('Import', 'grand-media'); ?></a>
20
  <?php } ?>
21
  </div>
22
  <?php if($import && gm_user_can('import')) { ?>
admin/pages/galleries/edit-gallery.php CHANGED
@@ -10,11 +10,11 @@ if(!defined('ABSPATH')){
10
 
11
  global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
12
 
13
- $term_id = $gmCore->_get('edit_item');
14
- $gmedia_url = add_query_arg(array('edit_item' => $term_id), $gmProcessor->url);
15
  $gmedia_user_options = $gmProcessor->user_options;
16
  $gmedia_term_taxonomy = $gmProcessor->taxonomy;
17
- $taxterm = str_replace('gmedia_', '', $gmedia_term_taxonomy);
18
 
19
  if(!gm_user_can("{$taxterm}_manage")){
20
  die('-1');
@@ -113,7 +113,7 @@ if(!empty($term->meta['_settings'][ $term->module['name'] ])){
113
  }
114
 
115
  /** @noinspection PhpIncludeInspection */
116
- include_once(GMEDIA_ABSPATH . '/inc/module.options.php');
117
 
118
  $reset_settings = $gmCore->array_diff_keyval_recursive($default_options, $gallery_settings, true);
119
 
@@ -135,4 +135,5 @@ do_action("gmedia_term_{$taxterm}_after_panel", $term);
135
  do_action('gmedia_gallery_after_panel');
136
 
137
  include(dirname(__FILE__) . "/tpl/choose-module.php");
 
138
  ?>
10
 
11
  global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
12
 
13
+ $term_id = $gmCore->_get('edit_term');
14
+ $gmedia_url = add_query_arg(array('edit_term' => $term_id), $gmProcessor->url);
15
  $gmedia_user_options = $gmProcessor->user_options;
16
  $gmedia_term_taxonomy = $gmProcessor->taxonomy;
17
+ $taxterm = $gmProcessor->taxterm;
18
 
19
  if(!gm_user_can("{$taxterm}_manage")){
20
  die('-1');
113
  }
114
 
115
  /** @noinspection PhpIncludeInspection */
116
+ include_once(GMEDIA_ABSPATH . 'inc/module.options.php');
117
 
118
  $reset_settings = $gmCore->array_diff_keyval_recursive($default_options, $gallery_settings, true);
119
 
135
  do_action('gmedia_gallery_after_panel');
136
 
137
  include(dirname(__FILE__) . "/tpl/choose-module.php");
138
+ include(GMEDIA_ABSPATH . 'admin/tpl/modal-share.php');
139
  ?>
admin/pages/galleries/functions.php CHANGED
@@ -3,107 +3,32 @@
3
  function gmedia_gallery_actions($item) {
4
  global $gmCore, $gmProcessor;
5
 
6
- $taxterm = str_replace('gmedia_', '', $item->taxonomy);
7
  $actions = array();
8
 
9
  $filter_href = $gmCore->get_admin_url(array('page' => 'GrandMedia', "gallery" => $item->term_id), array(), true);
10
  $filter_class = 'gm_filter_in_lib';
11
  $actions['filter'] = '<a title="' . __('Filter in Gmedia Library', 'grand-media') . '" href="' . $filter_href . '" class="' . $filter_class . '"><span class="glyphicon glyphicon-filter"></span></a>';
12
 
13
- $cloud_link = $gmCore->gmcloudlink($item->term_id, $taxterm);
14
- if(!empty($item->meta['_post_ID'])) {
15
- $post_link = get_permalink($item->meta['_post_ID']);
16
- } else {
17
- $post_link = '';
18
- }
19
  $share_icon = '<span class="glyphicon glyphicon-share"></span>';
20
  if('draft' !== $item->status) {
21
- $actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' . __('Share', 'grand-media') . '" data-gmediacloud="' . $cloud_link . '" href="' . $post_link . '">' . $share_icon . '</a>';
22
  } else {
23
  $actions['share'] = "<span class='action-inactive'>$share_icon</span>";
24
  }
25
 
26
  $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
27
  if($item->allow_edit) {
28
- $actions['edit'] = '<a title="' . __('Edit', 'grand-media') . '" href="' . add_query_arg(array("edit_item" => $item->term_id), $gmProcessor->url) . '">' . $edit_icon . '</a>';
29
  } else {
30
  $actions['edit'] = "<span class='action-inactive'>$edit_icon</span>";
31
  }
32
 
33
  $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
34
  if($item->allow_delete) {
35
- $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>';
36
  } else {
37
  $actions['delete'] = "<span class='action-inactive'>$trash_icon</span>";
38
  }
39
 
40
  return apply_filters('gmedia_gallery_actions', $actions);
41
  }
42
-
43
-
44
- function gmedia_gallery_more_data(&$item) {
45
- global $gmDB, $gmCore, $user_ID;
46
-
47
- $item->custom = array();
48
- $item->meta = array(
49
- '_edited' => '&#8212;',
50
- '_query' => array(),
51
- '_module' => $gmCore->_get('gallery_module', 'phantom')
52
- );
53
- $item->meta['_settings'] = array($item->meta['_module'] => array());
54
-
55
- if(empty($item->term_id)) {
56
- $item->term_id = 0;
57
- $item->name = '';
58
- $item->taxonomy = 'gmedia_gallery';
59
- $item->description = '';
60
- $item->global = $user_ID;
61
- $item->count = 0;
62
- $item->status = 'publish';
63
- $item->post_id = 0;
64
- $item->slug = '';
65
-
66
- } else {
67
- $meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
68
- foreach($meta as $key => $value) {
69
- if($gmCore->is_protected_meta($key, 'gmedia_term')) {
70
- $item->meta[$key] = $value[0];
71
- } else {
72
- $item->custom[$key] = $value;
73
- }
74
- }
75
-
76
- $post_id = isset($meta['_post_ID'][0])? (int)$meta['_post_ID'][0] : 0;
77
- $item->post_id = $post_id;
78
- if($post_id) {
79
- $post_item = get_post($post_id);
80
- if($post_item) {
81
- $item->slug = $post_item->post_name;
82
- $item->post_password = $post_item->post_password;
83
- $item->comment_count = $post_item->comment_count;
84
- $item->comment_status = $post_item->comment_status;
85
- }
86
- }
87
- }
88
-
89
- $_module_name = $gmCore->_get('gallery_module', $item->meta['_module']);
90
-
91
- $item->module = $gmCore->get_module_path($_module_name);
92
- $item->module['name'] = $_module_name;
93
- $module_info = array('type' => '&#8212;');
94
- if(file_exists($item->module['path'] . '/index.php')) {
95
- include($item->module['path'] . '/index.php');
96
-
97
- $item->module['info'] = $module_info;
98
- } else {
99
- $item->module['broken'] = true;
100
- }
101
-
102
- if($item->global) {
103
- $item->author_name = get_the_author_meta('display_name', $item->global);
104
- } else {
105
- $item->author_name = false;
106
- }
107
-
108
- $item = apply_filters('gmedia_gallery_more_data', $item);
109
- }
3
  function gmedia_gallery_actions($item) {
4
  global $gmCore, $gmProcessor;
5
 
 
6
  $actions = array();
7
 
8
  $filter_href = $gmCore->get_admin_url(array('page' => 'GrandMedia', "gallery" => $item->term_id), array(), true);
9
  $filter_class = 'gm_filter_in_lib';
10
  $actions['filter'] = '<a title="' . __('Filter in Gmedia Library', 'grand-media') . '" href="' . $filter_href . '" class="' . $filter_class . '"><span class="glyphicon glyphicon-filter"></span></a>';
11
 
 
 
 
 
 
 
12
  $share_icon = '<span class="glyphicon glyphicon-share"></span>';
13
  if('draft' !== $item->status) {
14
+ $actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' . __('Share', 'grand-media') . '" data-gmediacloud="' . $item->cloud_link . '" href="' . $item->post_link . '">' . $share_icon . '</a>';
15
  } else {
16
  $actions['share'] = "<span class='action-inactive'>$share_icon</span>";
17
  }
18
 
19
  $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
20
  if($item->allow_edit) {
21
+ $actions['edit'] = '<a title="' . __('Edit', 'grand-media') . '" href="' . add_query_arg(array("edit_term" => $item->term_id), $gmProcessor->url) . '">' . $edit_icon . '</a>';
22
  } else {
23
  $actions['edit'] = "<span class='action-inactive'>$edit_icon</span>";
24
  }
25
 
26
  $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
27
  if($item->allow_delete) {
28
+ $actions['delete'] = '<a class="trash-icon" title="' . __('Delete', 'grand-media') . '" href="' . wp_nonce_url(add_query_arg(array('do_gmedia_terms' => 'delete', 'ids' => $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>';
29
  } else {
30
  $actions['delete'] = "<span class='action-inactive'>$trash_icon</span>";
31
  }
32
 
33
  return apply_filters('gmedia_gallery_actions', $actions);
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/pages/galleries/galleries.php CHANGED
@@ -30,7 +30,7 @@ $gmedia_modules = get_gmedia_modules(false);
30
 
31
  <form class="list-group <?php echo $gmedia_term_taxonomy; ?>" id="gm-list-table" style="margin-bottom:4px;">
32
  <?php
33
- $taxterm = str_replace('gmedia_', '', $gmedia_term_taxonomy);
34
  if(count($gmedia_terms)) {
35
  foreach($gmedia_terms as &$item) {
36
  gmedia_gallery_more_data($item);
@@ -49,20 +49,6 @@ $gmedia_modules = get_gmedia_modules(false);
49
  $item->classes[] = 'gm-selected';
50
  }
51
 
52
- $allow_terms_delete = gm_user_can('terms_delete');
53
- if($item->global) {
54
- if((int)$item->global === get_current_user_id()) {
55
- $item->allow_edit = gm_user_can("{$taxterm}_manage");
56
- $item->allow_delete = $allow_terms_delete;
57
- } else {
58
- $item->allow_edit = gm_user_can('edit_others_media');
59
- $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
60
- }
61
- } else {
62
- $item->allow_edit = gm_user_can('edit_others_media');
63
- $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
64
- }
65
-
66
  include(dirname(__FILE__) . "/tpl/{$taxterm}-list-item.php");
67
 
68
  }
30
 
31
  <form class="list-group <?php echo $gmedia_term_taxonomy; ?>" id="gm-list-table" style="margin-bottom:4px;">
32
  <?php
33
+ $taxterm = $gmProcessor->taxterm;
34
  if(count($gmedia_terms)) {
35
  foreach($gmedia_terms as &$item) {
36
  gmedia_gallery_more_data($item);
49
  $item->classes[] = 'gm-selected';
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  include(dirname(__FILE__) . "/tpl/{$taxterm}-list-item.php");
53
 
54
  }
admin/pages/galleries/tpl/choose-module.php CHANGED
@@ -39,7 +39,7 @@ if(!defined('ABSPATH')) {
39
  ?>
40
  <div data-href="<?php echo add_query_arg(array('gallery_module' => $module_name), $gmedia_url); ?>" class="choose-module media<?php echo $mclass; ?>">
41
  <a href="<?php echo add_query_arg(array('gallery_module' => $module_name), $gmedia_url); ?>" class="thumbnail pull-left">
42
- <img class="media-object" src="<?php echo $module_url . '/screenshot.png'; ?>" alt="<?php echo esc_attr($module_info['title']); ?>" width="160" height="120"/>
43
  </a>
44
 
45
  <div class="media-body" style="margin-left:180px;">
39
  ?>
40
  <div data-href="<?php echo add_query_arg(array('gallery_module' => $module_name), $gmedia_url); ?>" class="choose-module media<?php echo $mclass; ?>">
41
  <a href="<?php echo add_query_arg(array('gallery_module' => $module_name), $gmedia_url); ?>" class="thumbnail pull-left">
42
+ <img class="media-object" src="<?php echo $module_url . '/screenshot.png'; ?>" alt="<?php esc_attr_e($module_info['title']); ?>" width="160" height="120"/>
43
  </a>
44
 
45
  <div class="media-body" style="margin-left:180px;">
admin/pages/galleries/tpl/galleries-panel-heading.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  // don't load directly
3
- if(!defined('ABSPATH')) {
4
  die('-1');
5
  }
6
 
7
  /**
8
  * Panel heading for terms
9
- *
10
  * @var $gmedia_term_taxonomy
11
  * @var $gmedia_terms_pager
12
  * @var $gmProcessor
@@ -31,7 +30,7 @@ if(!defined('ABSPATH')) {
31
  <div class="btn-toolbar pull-left" style="margin-bottom:7px;">
32
  <div class="btn-group gm-checkgroup" id="cb_global-btn">
33
  <span class="btn btn-default active"><input class="doaction" id="cb_global"
34
- data-group="cb_term-object" type="checkbox"/></span>
35
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
36
  <span class="caret"></span>
37
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
@@ -48,7 +47,7 @@ if(!defined('ABSPATH')) {
48
  <a class="btn btn-primary" href="#chooseModuleModal" data-toggle="modal"><?php _e('Create Gallery', 'grand-media'); ?></a>
49
  </div>
50
 
51
- <?php if(!empty($gmedia_terms)) { ?>
52
  <div class="btn-group">
53
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
54
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@@ -62,26 +61,30 @@ if(!defined('ABSPATH')) {
62
  <ul class="dropdown-menu" role="menu">
63
  <li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php _e("Select items to see more actions", "grand-media"); ?></span></li>
64
  <li class="<?php echo $rel_selected_show . (gm_user_can('terms_delete')? '' : ' disabled'); ?>">
65
- <a href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete') ?>" class="gmedia-delete" data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Delete Selected Items', 'grand-media'); ?></a>
 
 
66
  </li>
67
  <?php do_action('gmedia_galleries_action_list'); ?>
68
  </ul>
69
  </div>
70
 
71
  <?php
72
- $filter_selected = $gmCore->_req('filter');
 
 
73
  $filter_selected_arg = $filter_selected? false : 'selected';
74
  ?>
75
  <form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo add_query_arg(array('filter' => $filter_selected_arg), $gmedia_url); ?>" method="post">
76
  <button type="submit" class="btn btn<?php echo ('selected' == $filter_selected)? '-success' : '-info' ?>"><?php printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
77
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
78
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
79
- <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="<?php echo $gmedia_term_taxonomy; ?>" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
80
  <ul class="dropdown-menu" role="menu">
81
  <li><a id="gm-selected-show" href="#show"><?php
82
- if(!$filter_selected) {
83
  _e('Show only selected items', 'grand-media');
84
- } else {
85
  _e('Show all gmedia items', 'grand-media');
86
  }
87
  ?></a></li>
1
  <?php
2
  // don't load directly
3
+ if(!defined('ABSPATH')){
4
  die('-1');
5
  }
6
 
7
  /**
8
  * Panel heading for terms
 
9
  * @var $gmedia_term_taxonomy
10
  * @var $gmedia_terms_pager
11
  * @var $gmProcessor
30
  <div class="btn-toolbar pull-left" style="margin-bottom:7px;">
31
  <div class="btn-group gm-checkgroup" id="cb_global-btn">
32
  <span class="btn btn-default active"><input class="doaction" id="cb_global"
33
+ data-group="cb_object" type="checkbox"/></span>
34
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
35
  <span class="caret"></span>
36
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
47
  <a class="btn btn-primary" href="#chooseModuleModal" data-toggle="modal"><?php _e('Create Gallery', 'grand-media'); ?></a>
48
  </div>
49
 
50
+ <?php if(!empty($gmedia_terms)){ ?>
51
  <div class="btn-group">
52
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
53
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
61
  <ul class="dropdown-menu" role="menu">
62
  <li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php _e("Select items to see more actions", "grand-media"); ?></span></li>
63
  <li class="<?php echo $rel_selected_show . (gm_user_can('terms_delete')? '' : ' disabled'); ?>">
64
+ <a href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('do_gmedia_terms' => 'delete',
65
+ 'ids' => 'selected'
66
+ ), array('filter')), 'gmedia_delete') ?>" class="gmedia-delete" data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Delete Selected Items', 'grand-media'); ?></a>
67
  </li>
68
  <?php do_action('gmedia_galleries_action_list'); ?>
69
  </ul>
70
  </div>
71
 
72
  <?php
73
+ do_action('gmedia_galleries_btn_toolbar');
74
+
75
+ $filter_selected = $gmCore->_req('filter');
76
  $filter_selected_arg = $filter_selected? false : 'selected';
77
  ?>
78
  <form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo add_query_arg(array('filter' => $filter_selected_arg), $gmedia_url); ?>" method="post">
79
  <button type="submit" class="btn btn<?php echo ('selected' == $filter_selected)? '-success' : '-info' ?>"><?php printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
80
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
81
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
82
+ <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="<?php echo GmediaProcessor_Galleries::$cookie_key; ?>" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
83
  <ul class="dropdown-menu" role="menu">
84
  <li><a id="gm-selected-show" href="#show"><?php
85
+ if(!$filter_selected){
86
  _e('Show only selected items', 'grand-media');
87
+ } else{
88
  _e('Show all gmedia items', 'grand-media');
89
  }
90
  ?></a></li>
admin/pages/galleries/tpl/gallery-edit-item.php CHANGED
@@ -25,15 +25,25 @@ if(!defined('ABSPATH')){
25
  <div class="col-xs-6">
26
  <div class="form-group">
27
  <label><?php _e('Name', 'grand-media'); ?></label>
28
- <input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr($term->name); ?>" placeholder="<?php _e('Gallery Name', 'grand-media'); ?>" required/>
29
  </div>
30
  <div class="form-group">
31
  <label><?php _e('Slug', 'grand-media'); ?></label>
32
- <input type="text" class="form-control input-sm" name="term[slug]" value="<?php echo esc_attr($term->slug); ?>"/>
33
  </div>
34
  <div class="form-group">
35
  <label><?php _e('Description', 'grand-media'); ?></label>
36
- <textarea class="form-control input-sm" style="height:64px;" rows="2" name="term[description]"><?php echo $term->description; ?></textarea>
 
 
 
 
 
 
 
 
 
 
37
  </div>
38
  </div>
39
  <div class="col-xs-6">
@@ -50,18 +60,14 @@ if(!defined('ABSPATH')){
50
  </select>
51
  </div>
52
  <div class="form-group">
53
- <div class="pull-right"><a id="build_query" class="label label-primary buildquery-modal" href="#buildQuery" style="font-size:90%;"><?php _e('Build Query', 'grand-media'); ?></a></div>
54
  <label><?php _e('Query Args.', 'grand-media'); ?></label>
55
- <textarea class="form-control input-sm" id="build_query_field" style="height:64px;"
56
  placeholder="<?php _e("Click 'Build Query' button for help with Query Args.\nIf you leave this field empty then whole Library will be loaded. That's could exceed your server's PHP Memory Limit.", 'grand-media') ?>"
57
  rows="2" name="term[query]"><?php echo(empty($gmedia_filter['query_args'])? '' : urldecode(build_query($gmedia_filter['query_args']))); ?></textarea>
 
58
  </div>
59
  </div>
60
  </div>
61
- <?php
62
- $gmCore->gmedia_custom_meta_box($term->term_id, $meta_type = 'gmedia_term');
63
- do_action('gmedia_term_edit_form');
64
- ?>
65
  </div>
66
 
67
  <div class="col-sm-4">
@@ -75,7 +81,7 @@ if(!defined('ABSPATH')){
75
  ?>
76
  </label>
77
  <div>
78
- <div class="btn-group btn-group-sm" id="save_buttons">
79
  <?php if($term->module['name'] != $term->meta['_module']){ ?>
80
  <a href="<?php echo $gmedia_url; ?>" class="btn btn-default"><?php _e('Cancel preview module', 'grand-media'); ?></a>
81
  <button type="submit" name="gmedia_gallery_save" class="btn btn-primary"><?php _e('Save with new module', 'grand-media'); ?></button>
@@ -93,12 +99,12 @@ if(!defined('ABSPATH')){
93
 
94
  <p><b><?php _e('Gallery ID:'); ?></b> #<?php echo $term_id; ?></p>
95
  <p><b><?php _e('Last edited:'); ?></b> <?php echo $term->meta['_edited']; ?></p>
96
- <p><?php echo '<b>' . __('Gallery module:') . '</b> <a href="#chooseModuleModal" data-toggle="modal">' . $term->meta['_module'] . '</a>';
97
  if($term->module['name'] != $term->meta['_module']){
98
  echo '<br /><b>' . __('Preview module:') . '</b> ' . $term->module['name'];
99
  echo '<br /><span class="text-danger">' . sprintf(__('Note: Module changed to %s, but not saved yet'), $term->module['name']) . '</span>';
100
  } ?></p>
101
- <input type="hidden" name="term[module]" value="<?php echo esc_attr($term->module['name']); ?>">
102
  <?php if($term_id){
103
  $params = array();
104
  if($term->module['name'] != $term->meta['_module']){
@@ -132,6 +138,10 @@ if(!defined('ABSPATH')){
132
  <?php } ?>
133
  </div>
134
  </div>
 
 
 
 
135
 
136
  <hr/>
137
  <div class="well well-sm clearfix">
25
  <div class="col-xs-6">
26
  <div class="form-group">
27
  <label><?php _e('Name', 'grand-media'); ?></label>
28
+ <input type="text" class="form-control input-sm" name="term[name]" value="<?php esc_attr_e($term->name); ?>" placeholder="<?php _e('Gallery Name', 'grand-media'); ?>" required/>
29
  </div>
30
  <div class="form-group">
31
  <label><?php _e('Slug', 'grand-media'); ?></label>
32
+ <input type="text" class="form-control input-sm" name="term[slug]" value="<?php esc_attr_e($term->slug); ?>"/>
33
  </div>
34
  <div class="form-group">
35
  <label><?php _e('Description', 'grand-media'); ?></label>
36
+ <?php
37
+ wp_editor(esc_textarea($term->description), "gallery{$term->term_id}_description", array('editor_class' => 'form-control input-sm',
38
+ 'editor_height' => 120,
39
+ 'wpautop' => false,
40
+ 'media_buttons' => false,
41
+ 'textarea_name' => 'term[description]',
42
+ 'textarea_rows' => '4',
43
+ 'tinymce' => false,
44
+ 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
45
+ ));
46
+ ?>
47
  </div>
48
  </div>
49
  <div class="col-xs-6">
60
  </select>
61
  </div>
62
  <div class="form-group">
 
63
  <label><?php _e('Query Args.', 'grand-media'); ?></label>
64
+ <textarea class="form-control input-sm" id="build_query_field" style="height:120px;" title="<?php _e("Click 'Build Query' button and choose query arguments for this gallery"); ?>"
65
  placeholder="<?php _e("Click 'Build Query' button for help with Query Args.\nIf you leave this field empty then whole Library will be loaded. That's could exceed your server's PHP Memory Limit.", 'grand-media') ?>"
66
  rows="2" name="term[query]"><?php echo(empty($gmedia_filter['query_args'])? '' : urldecode(build_query($gmedia_filter['query_args']))); ?></textarea>
67
+ <p class="help-block text-right"><a id="build_query" class="btn btn-sm btn-success buildquery-modal" href="#buildQuery" style="font-size:90%;"><?php _e('Build Query', 'grand-media'); ?></a></p>
68
  </div>
69
  </div>
70
  </div>
 
 
 
 
71
  </div>
72
 
73
  <div class="col-sm-4">
81
  ?>
82
  </label>
83
  <div>
84
+ <div class="btn-group btn-group" id="save_buttons">
85
  <?php if($term->module['name'] != $term->meta['_module']){ ?>
86
  <a href="<?php echo $gmedia_url; ?>" class="btn btn-default"><?php _e('Cancel preview module', 'grand-media'); ?></a>
87
  <button type="submit" name="gmedia_gallery_save" class="btn btn-primary"><?php _e('Save with new module', 'grand-media'); ?></button>
99
 
100
  <p><b><?php _e('Gallery ID:'); ?></b> #<?php echo $term_id; ?></p>
101
  <p><b><?php _e('Last edited:'); ?></b> <?php echo $term->meta['_edited']; ?></p>
102
+ <p><?php echo '<b>' . __('Gallery module:') . '</b> <a href="#chooseModuleModal" data-toggle="modal" title="' . __('Change module for gallery', 'grand-media') . '">' . $term->meta['_module'] . '</a>';
103
  if($term->module['name'] != $term->meta['_module']){
104
  echo '<br /><b>' . __('Preview module:') . '</b> ' . $term->module['name'];
105
  echo '<br /><span class="text-danger">' . sprintf(__('Note: Module changed to %s, but not saved yet'), $term->module['name']) . '</span>';
106
  } ?></p>
107
+ <input type="hidden" name="term[module]" value="<?php esc_attr_e($term->module['name']); ?>">
108
  <?php if($term_id){
109
  $params = array();
110
  if($term->module['name'] != $term->meta['_module']){
138
  <?php } ?>
139
  </div>
140
  </div>
141
+ <?php
142
+ $gmCore->gmedia_custom_meta_box($term->term_id, $meta_type = 'gmedia_term');
143
+ do_action('gmedia_term_edit_form');
144
+ ?>
145
 
146
  <hr/>
147
  <div class="well well-sm clearfix">
admin/pages/galleries/tpl/gallery-list-item.php CHANGED
@@ -12,8 +12,7 @@ if(!defined('ABSPATH')) {
12
  */
13
  ?>
14
  <div class="cb_list-item list-group-item gallery-list-item <?php echo implode(' ', $item->classes); ?>" id="list-item-<?php echo $item->term_id; ?>" data-id="<?php echo $item->term_id; ?>" data-type="<?php echo $item->module['name']; ?>">
15
- <div class="row cb_term-object">
16
- <div class="term_id">#<?php echo $item->term_id; ?></div>
17
  <div class="col-xs-7">
18
  <label class="cb_media-object cb_media-object-gallery">
19
  <input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo $item->module['name']; ?>" value="<?php echo $item->term_id; ?>"/>
@@ -22,7 +21,7 @@ if(!defined('ABSPATH')) {
22
  <div class="media-info-body" style="margin-left:35px;">
23
  <p class="media-title">
24
  <?php if($item->allow_edit) { ?>
25
- <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>
26
  <?php } else { ?>
27
  <span class="term_name"><?php echo esc_html($item->name); ?></span>
28
  <?php } ?>
@@ -51,8 +50,7 @@ if(!defined('ABSPATH')) {
51
  <span class="bg-danger text-center"><?php _e('Module broken. Reinstall module', 'grand-media') ?></span>
52
  <?php } ?>
53
  <br><span class="label label-default"><?php _e('Last Edited', 'grand-media'); ?>:</span> <?php echo $item->meta['_edited']; ?>
54
- <br><span class="label label-default"><?php _e('Status', 'grand-media'); ?>:</span> <?php echo $item->status; ?>
55
- <br><span class="label label-default"><?php _e('Source', 'grand-media'); ?>:</span> <?php echo !empty($item->meta['_query'])? str_replace(',"', ', "', json_encode($item->meta['_query'])) : ''; ?>
56
  <?php
57
  /*
58
  $gallery_tabs = reset($term_meta['_query']);
12
  */
13
  ?>
14
  <div class="cb_list-item list-group-item gallery-list-item <?php echo implode(' ', $item->classes); ?>" id="list-item-<?php echo $item->term_id; ?>" data-id="<?php echo $item->term_id; ?>" data-type="<?php echo $item->module['name']; ?>">
15
+ <div class="row cb_object">
 
16
  <div class="col-xs-7">
17
  <label class="cb_media-object cb_media-object-gallery">
18
  <input name="doaction[]" type="checkbox"<?php echo $item->selected ? ' checked="checked"' : ''; ?> data-type="<?php echo $item->module['name']; ?>" value="<?php echo $item->term_id; ?>"/>
21
  <div class="media-info-body" style="margin-left:35px;">
22
  <p class="media-title">
23
  <?php if($item->allow_edit) { ?>
24
+ <a class="term_name" href="<?php echo add_query_arg(array('edit_term' => $item->term_id), $gmedia_url); ?>"><?php echo esc_html($item->name); ?></a>
25
  <?php } else { ?>
26
  <span class="term_name"><?php echo esc_html($item->name); ?></span>
27
  <?php } ?>
50
  <span class="bg-danger text-center"><?php _e('Module broken. Reinstall module', 'grand-media') ?></span>
51
  <?php } ?>
52
  <br><span class="label label-default"><?php _e('Last Edited', 'grand-media'); ?>:</span> <?php echo $item->meta['_edited']; ?>
53
+ <br><span class="label label-default"><?php _e('Query Args.', 'grand-media'); ?>:</span> <?php echo !empty($item->meta['_query'])? str_replace(',"', ', "', json_encode($item->meta['_query'])) : ''; ?>
 
54
  <?php
55
  /*
56
  $gallery_tabs = reset($term_meta['_query']);
admin/pages/galleries/tpl/gallery-panel-heading.php CHANGED
@@ -1,23 +1,26 @@
1
  <?php
2
  // don't load directly
3
- if(!defined('ABSPATH')) {
4
  die('-1');
5
  }
6
 
7
  /**
8
  * Panel heading for term
9
- *
10
  * @var $term_id
11
  * @var $gmedia_term_taxonomy
12
  * @var $gmProcessor
 
13
  */
 
 
 
14
  ?>
15
  <div class="panel-heading-fake"></div>
16
  <div class="panel-heading clearfix">
17
  <div class="btn-toolbar pull-left">
18
- <a class="btn btn-default pull-left" style="margin-right:20px;" href="<?php echo remove_query_arg(array('edit_item', 'gmedia_module'), wp_get_referer()); ?>"><?php _e('Go Back', 'grand-media'); ?></a>
19
 
20
- <?php if($term_id) { ?>
21
  <div class="btn-group">
22
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
23
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@@ -26,20 +29,31 @@ if(!defined('ABSPATH')) {
26
  </button>
27
  <ul class="dropdown-menu" role="menu">
28
  <li><a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gallery' => $term->term_id), $gmProcessor->url); ?>"><?php _e('Show in Gmedia Library', 'grand-media'); ?></a></li>
 
 
 
 
 
 
 
29
  </ul>
30
  </div>
31
  <?php } ?>
32
- <?php if($term_id) { ?>
33
- <div class="term-shortcode pull-left"><input type="text" title="<?php _e('Shortcode'); ?>" class="form-control pull-left" value="<?php echo "[gmedia id={$term_id}]"; ?>" readonly /><div class="input-buffer"></div></div>
34
- <?php } ?>
 
 
 
 
35
  </div>
36
 
37
  <div class="btn-group pull-right" id="save_buttons_duplicate">
38
- <?php if($term->module['name'] != $term->meta['_module']) { ?>
39
  <a href="<?php echo $gmedia_url; ?>" class="btn btn-default"><?php _e('Cancel preview module', 'grand-media'); ?></a>
40
  <button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php _e('Save with new module', 'grand-media'); ?></button>
41
- <?php } else { ?>
42
- <?php if(!empty($reset_settings)) { ?>
43
  <button type="button" onclick="jQuery('button[name=gmedia_gallery_reset]').trigger('click');" class="btn btn-default"><?php _e('Reset to default', 'grand-media'); ?></button>
44
  <?php } ?>
45
  <button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php _e('Save', 'grand-media'); ?></button>
1
  <?php
2
  // don't load directly
3
+ if(!defined('ABSPATH')){
4
  die('-1');
5
  }
6
 
7
  /**
8
  * Panel heading for term
 
9
  * @var $term_id
10
  * @var $gmedia_term_taxonomy
11
  * @var $gmProcessor
12
+ * @var $gmCore
13
  */
14
+ $curpage = $gmCore->_get('page', 'GrandMedia');
15
+ $refurl = strpos(wp_get_referer(), "page={$curpage}")? wp_get_referer() : $gmProcessor->url;
16
+ $referer = remove_query_arg(array('edit_term', 'gmedia_module'), $refurl);
17
  ?>
18
  <div class="panel-heading-fake"></div>
19
  <div class="panel-heading clearfix">
20
  <div class="btn-toolbar pull-left">
21
+ <a class="btn btn-default pull-left" style="margin-right:20px;" href="<?php echo $referer; ?>"><?php _e('Go Back', 'grand-media'); ?></a>
22
 
23
+ <?php if($term_id){ ?>
24
  <div class="btn-group">
25
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
26
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
29
  </button>
30
  <ul class="dropdown-menu" role="menu">
31
  <li><a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gallery' => $term->term_id), $gmProcessor->url); ?>"><?php _e('Show in Gmedia Library', 'grand-media'); ?></a></li>
32
+ <?php
33
+ echo '<li' . (('draft' !== $term->status)? '' : ' class="disabled"') . '><a target="_blank" class="share-modal" data-target="#shareModal" data-share="' . $term->term_id . '" data-gmediacloud="' . $term->cloud_link . '" href="' . $term->post_link . '">' . __('Share', 'grand-media') . '</a></li>';
34
+
35
+ echo '<li' . ($term->allow_delete? '' : ' class="disabled"') . '><a href="' . wp_nonce_url(gm_get_admin_url(array('do_gmedia_terms' => 'delete',
36
+ 'ids' => $term->term_id
37
+ ), array('edit_term'), $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") . '">' . __('Delete', 'grand-media') . '</a></li>';
38
+ ?>
39
  </ul>
40
  </div>
41
  <?php } ?>
42
+ <?php if($term_id){ ?>
43
+ <div class="term-shortcode pull-left"><input type="text" title="<?php _e('Shortcode'); ?>" class="form-control pull-left" value="<?php echo "[gmedia id={$term_id}]"; ?>" readonly/>
44
+ <div class="input-buffer"></div>
45
+ </div>
46
+ <?php }
47
+ do_action('gmedia_gallery_btn_toolbar');
48
+ ?>
49
  </div>
50
 
51
  <div class="btn-group pull-right" id="save_buttons_duplicate">
52
+ <?php if($term->module['name'] != $term->meta['_module']){ ?>
53
  <a href="<?php echo $gmedia_url; ?>" class="btn btn-default"><?php _e('Cancel preview module', 'grand-media'); ?></a>
54
  <button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php _e('Save with new module', 'grand-media'); ?></button>
55
+ <?php } else{ ?>
56
+ <?php if(!empty($reset_settings)){ ?>
57
  <button type="button" onclick="jQuery('button[name=gmedia_gallery_reset]').trigger('click');" class="btn btn-default"><?php _e('Reset to default', 'grand-media'); ?></button>
58
  <?php } ?>
59
  <button type="button" onclick="jQuery('button[name=gmedia_gallery_save]').trigger('click');" class="btn btn-primary"><?php _e('Save', 'grand-media'); ?></button>
admin/pages/galleries/tpl/modal-build-query.php CHANGED
@@ -16,7 +16,10 @@ global $user_ID, $gmDB, $gmCore
16
  <div class="modal-dialog" style="width:700px;">
17
  <div class="modal-content">
18
  <div class="modal-header">
19
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
 
 
20
  <h4 class="modal-title"><?php _e('Query Parameters'); ?></h4>
21
  </div>
22
  <div class="modal-body">
@@ -59,7 +62,7 @@ global $user_ID, $gmDB, $gmCore
59
 
60
  <div class="row">
61
  <div class="col-xs-8">
62
- <input id="query_album__" name="album__in" data-include="album__in" data-exclude="album__not_in" class="form-control input-sm" value="<?php echo implode(',', $query_gmedia_albums) ?>" placeholder="<?php echo esc_attr(__('Any Album...', 'grand-media')); ?>"/>
63
  </div>
64
  <div class="col-xs-4">
65
  <div class="checkbox"><label><input class="query_switch" data-target="query_album__" type="checkbox"<?php echo (empty($query_data['album__in']) && !empty($query_data['album__not_in']))? ' checked="checked"' : ''; ?> /> <?php _e('Exclude selected Albums', 'grand-media'); ?></label></div>
@@ -81,15 +84,15 @@ global $user_ID, $gmDB, $gmCore
81
  <div class="row">
82
  <div class="col-xs-4">
83
  <label><?php _e('[IN] Categories', 'grand-media'); ?></label>
84
- <input name="category__in" class="form-control input-sm combobox_gmedia_category" value="<?php echo implode(',', wp_parse_id_list($query_data['category__in'])); ?>" placeholder="<?php echo esc_attr(__('Either of chosen Categories...', 'grand-media')); ?>"/>
85
  </div>
86
  <div class="col-xs-4">
87
  <label><?php _e('[AND] Categories', 'grand-media'); ?></label>
88
- <input name="category__and" class="form-control input-sm combobox_gmedia_category" value="<?php echo implode(',', wp_parse_id_list($query_data['category__and'])); ?>" placeholder="<?php echo esc_attr(__('Have all chosen Categories...', 'grand-media')); ?>"/>
89
  </div>
90
  <div class="col-xs-4">
91
  <label><?php _e('[NOT IN] Categories', 'grand-media'); ?></label>
92
- <input name="category__not_in" class="form-control input-sm combobox_gmedia_category" value="<?php echo implode(',', wp_parse_id_list($query_data['category__not_in'])); ?>" placeholder="<?php echo esc_attr(__('Exclude Categories...', 'grand-media')); ?>"/>
93
  </div>
94
  </div>
95
  </div>
@@ -102,15 +105,15 @@ global $user_ID, $gmDB, $gmCore
102
  <div class="row">
103
  <div class="col-xs-4">
104
  <label><?php _e('[IN] Tags', 'grand-media'); ?> </label>
105
- <input name="tag__in" class="form-control input-sm combobox_gmedia_tag" value="<?php echo implode(',', wp_parse_id_list($query_data['tag__in'])); ?>" placeholder="<?php echo esc_attr(__('Either of chosen Tags...', 'grand-media')); ?>"/>
106
  </div>
107
  <div class="col-xs-4">
108
  <label><?php _e('[AND] Tags', 'grand-media'); ?> </label>
109
- <input name="tag__and" class="form-control input-sm combobox_gmedia_tag" value="<?php echo implode(',', wp_parse_id_list($query_data['tag__and'])); ?>" placeholder="<?php echo esc_attr(__('Have all chosen Tags...', 'grand-media')); ?>"/>
110
  </div>
111
  <div class="col-xs-4">
112
  <label><?php _e('[NOT IN] Tags', 'grand-media'); ?> </label>
113
- <input name="tag__not_in" class="form-control input-sm combobox_gmedia_tag" value="<?php echo implode(',', wp_parse_id_list($query_data['tag__not_in'])); ?>" placeholder="<?php echo esc_attr(__('Exclude Tags...', 'grand-media')); ?>"/>
114
  </div>
115
  </div>
116
  </div>
@@ -160,7 +163,7 @@ global $user_ID, $gmDB, $gmCore
160
  $query_gmedia_items = $query_data['gmedia__not_in'];
161
  }
162
  ?>
163
- <textarea id="query_gmedia__" name="gmedia__in" data-include="gmedia__in" data-exclude="gmedia__not_in" rows="1" class="form-control input-sm" style="resize:vertical;" placeholder="<?php echo esc_attr(__('Gmedia IDs...', 'grand-media')); ?>"><?php echo implode(',', wp_parse_id_list($query_gmedia_items)); ?></textarea>
164
  </div>
165
  <div class="col-xs-4">
166
  <div class="checkbox"><label><input class="query_switch" data-target="query_gmedia__" type="checkbox"<?php echo (empty($query_data['gmedia__in']) && !empty($query_data['gmedia__not_in']))? ' checked="checked"' : ''; ?> /> <?php _e('Exclude selected Items', 'grand-media'); ?></label></div>
@@ -314,10 +317,15 @@ global $user_ID, $gmDB, $gmCore
314
  <option <?php selected($query_data['orderby'], 'id'); ?> value=""><?php _e('ID', 'grand-media'); ?></option>
315
  <option <?php selected($query_data['orderby'], 'title'); ?> value="title"><?php _e('Title', 'grand-media'); ?></option>
316
  <option <?php selected($query_data['orderby'], 'gmuid'); ?> value="gmuid"><?php _e('Filename', 'grand-media'); ?></option>
 
 
317
  <option <?php selected($query_data['orderby'], 'date'); ?> value="date"><?php _e('Date', 'grand-media'); ?></option>
318
  <option <?php selected($query_data['orderby'], 'modified'); ?> value="modified"><?php _e('Modified Date', 'grand-media'); ?></option>
319
- <option <?php selected($query_data['orderby'], 'author'); ?> value="author"><?php _e('Author', 'grand-media'); ?></option>
320
- <option <?php selected($query_data['orderby'], 'gmedia__in'); ?> value="gmedia__in"><?php _e('Selected Order', 'grand-media'); ?></option>
 
 
 
321
  <option <?php selected($query_data['orderby'], 'meta_value'); ?> value="meta_value"><?php _e('Custom Field Value', 'grand-media'); ?></option>
322
  <option <?php selected($query_data['orderby'], 'meta_value_num'); ?> value="meta_value_num"><?php _e('Custom Field Value (Numeric)', 'grand-media'); ?></option>
323
  <option <?php selected($query_data['orderby'], 'rand'); ?> value="rand"><?php _e('Random', 'grand-media'); ?></option>
@@ -473,8 +481,8 @@ global $user_ID, $gmDB, $gmCore
473
  $('#use_lib_selected').on('click', function() {
474
  var field = $('#query_gmedia__');
475
  var valData = field.val().split(',');
476
- var storedData = getStorage('gmuser_<?php echo $user_ID; ?>_');
477
- storedData = storedData.get('library').split(',');
478
  valData = $.grep(valData, function(e) {
479
  return e;
480
  });
16
  <div class="modal-dialog" style="width:700px;">
17
  <div class="modal-content">
18
  <div class="modal-header">
19
+ <div class="pull-right" style="margin-top:-4px;">
20
+ <button type="button" class="btn btn-primary buildquerysubmit"><?php _e('Build Query', 'grand-media'); ?></button>
21
+ <button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Close', 'grand-media'); ?></button>
22
+ </div>
23
  <h4 class="modal-title"><?php _e('Query Parameters'); ?></h4>
24
  </div>
25
  <div class="modal-body">
62
 
63
  <div class="row">
64
  <div class="col-xs-8">
65
+ <input id="query_album__" name="album__in" data-include="album__in" data-exclude="album__not_in" class="form-control input-sm" value="<?php echo implode(',', $query_gmedia_albums) ?>" placeholder="<?php esc_attr_e(__('Any Album...', 'grand-media')); ?>"/>
66
  </div>
67
  <div class="col-xs-4">
68
  <div class="checkbox"><label><input class="query_switch" data-target="query_album__" type="checkbox"<?php echo (empty($query_data['album__in']) && !empty($query_data['album__not_in']))? ' checked="checked"' : ''; ?> /> <?php _e('Exclude selected Albums', 'grand-media'); ?></label></div>
84
  <div class="row">
85
  <div class="col-xs-4">
86
  <label><?php _e('[IN] Categories', 'grand-media'); ?></label>
87
+ <input name="category__in" class="form-control input-sm combobox_gmedia_category" value="<?php echo implode(',', wp_parse_id_list($query_data['category__in'])); ?>" placeholder="<?php esc_attr_e(__('Either of chosen Categories...', 'grand-media')); ?>"/>
88
  </div>
89
  <div class="col-xs-4">
90
  <label><?php _e('[AND] Categories', 'grand-media'); ?></label>
91
+ <input name="category__and" class="form-control input-sm combobox_gmedia_category" value="<?php echo implode(',', wp_parse_id_list($query_data['category__and'])); ?>" placeholder="<?php esc_attr_e(__('Have all chosen Categories...', 'grand-media')); ?>"/>
92
  </div>
93
  <div class="col-xs-4">
94
  <label><?php _e('[NOT IN] Categories', 'grand-media'); ?></label>
95
+ <input name="category__not_in" class="form-control input-sm combobox_gmedia_category" value="<?php echo implode(',', wp_parse_id_list($query_data['category__not_in'])); ?>" placeholder="<?php esc_attr_e(__('Exclude Categories...', 'grand-media')); ?>"/>
96
  </div>
97
  </div>
98
  </div>
105
  <div class="row">
106
  <div class="col-xs-4">
107
  <label><?php _e('[IN] Tags', 'grand-media'); ?> </label>
108
+ <input name="tag__in" class="form-control input-sm combobox_gmedia_tag" value="<?php echo implode(',', wp_parse_id_list($query_data['tag__in'])); ?>" placeholder="<?php esc_attr_e(__('Either of chosen Tags...', 'grand-media')); ?>"/>
109
  </div>
110
  <div class="col-xs-4">
111
  <label><?php _e('[AND] Tags', 'grand-media'); ?> </label>
112
+ <input name="tag__and" class="form-control input-sm combobox_gmedia_tag" value="<?php echo implode(',', wp_parse_id_list($query_data['tag__and'])); ?>" placeholder="<?php esc_attr_e(__('Have all chosen Tags...', 'grand-media')); ?>"/>
113
  </div>
114
  <div class="col-xs-4">
115
  <label><?php _e('[NOT IN] Tags', 'grand-media'); ?> </label>
116
+ <input name="tag__not_in" class="form-control input-sm combobox_gmedia_tag" value="<?php echo implode(',', wp_parse_id_list($query_data['tag__not_in'])); ?>" placeholder="<?php esc_attr_e(__('Exclude Tags...', 'grand-media')); ?>"/>
117
  </div>
118
  </div>
119
  </div>
163
  $query_gmedia_items = $query_data['gmedia__not_in'];
164
  }
165
  ?>
166
+ <textarea id="query_gmedia__" name="gmedia__in" data-include="gmedia__in" data-exclude="gmedia__not_in" rows="1" class="form-control input-sm" style="resize:vertical;" placeholder="<?php esc_attr_e(__('Gmedia IDs...', 'grand-media')); ?>"><?php echo implode(',', wp_parse_id_list($query_gmedia_items)); ?></textarea>
167
  </div>
168
  <div class="col-xs-4">
169
  <div class="checkbox"><label><input class="query_switch" data-target="query_gmedia__" type="checkbox"<?php echo (empty($query_data['gmedia__in']) && !empty($query_data['gmedia__not_in']))? ' checked="checked"' : ''; ?> /> <?php _e('Exclude selected Items', 'grand-media'); ?></label></div>
317
  <option <?php selected($query_data['orderby'], 'id'); ?> value=""><?php _e('ID', 'grand-media'); ?></option>
318
  <option <?php selected($query_data['orderby'], 'title'); ?> value="title"><?php _e('Title', 'grand-media'); ?></option>
319
  <option <?php selected($query_data['orderby'], 'gmuid'); ?> value="gmuid"><?php _e('Filename', 'grand-media'); ?></option>
320
+ <option <?php selected($query_data['orderby'], 'author'); ?> value="author"><?php _e('Author', 'grand-media'); ?></option>
321
+ <option <?php selected($query_data['orderby'], 'gmedia__in'); ?> value="gmedia__in"><?php _e('Selected Order', 'grand-media'); ?></option>
322
  <option <?php selected($query_data['orderby'], 'date'); ?> value="date"><?php _e('Date', 'grand-media'); ?></option>
323
  <option <?php selected($query_data['orderby'], 'modified'); ?> value="modified"><?php _e('Modified Date', 'grand-media'); ?></option>
324
+ <option <?php selected($query_data['orderby'], '_created_timestamp'); ?> value="_created_timestamp"><?php _e('Created Timestamp', 'grand-media'); ?></option>
325
+ <option <?php selected($query_data['orderby'], 'comment_count'); ?> value="comment_count"><?php _e('Comment Count', 'grand-media'); ?></option>
326
+ <option <?php selected($query_data['orderby'], 'views'); ?> value="views"><?php _e('Views Count', 'grand-media'); ?></option>
327
+ <option <?php selected($query_data['orderby'], 'likes'); ?> value="likes"><?php _e('Likes Count', 'grand-media'); ?></option>
328
+ <option <?php selected($query_data['orderby'], '_size'); ?> value="_size"><?php _e('File Size', 'grand-media'); ?></option>
329
  <option <?php selected($query_data['orderby'], 'meta_value'); ?> value="meta_value"><?php _e('Custom Field Value', 'grand-media'); ?></option>
330
  <option <?php selected($query_data['orderby'], 'meta_value_num'); ?> value="meta_value_num"><?php _e('Custom Field Value (Numeric)', 'grand-media'); ?></option>
331
  <option <?php selected($query_data['orderby'], 'rand'); ?> value="rand"><?php _e('Random', 'grand-media'); ?></option>
481
  $('#use_lib_selected').on('click', function() {
482
  var field = $('#query_gmedia__');
483
  var valData = field.val().split(',');
484
+ var storedData = getStorage();
485
+ storedData = storedData.get('library').split('.');
486
  valData = $.grep(valData, function(e) {
487
  return e;
488
  });
admin/pages/galleries/tpl/module-settings.php CHANGED
@@ -14,13 +14,13 @@ global $gmGallery;
14
  <ul class="nav nav-tabs" id="galleryTabs">
15
  <?php if(isset($module_info)){ ?>
16
  <li class="text-center">
17
- <strong><?php echo $module_info['title']; ?></strong><a href="#chooseModuleModal" data-toggle="modal" style="padding:5px 0;"><img src="<?php echo $term->module['url'] . '/screenshot.png'; ?>" alt="<?php echo esc_attr($module_info['title']); ?>" width="100" style="height:auto;"/></a>
18
  </li>
19
  <?php } else{ ?>
20
  <li class="text-center"><strong><?php echo $term->module['name']; ?></strong>
21
 
22
  <p><?php _e('This module is broken or outdated. Please, go to Modules page and update/install module or choose another one for this gallery', 'grand-media'); ?></p>
23
- <a href="#chooseModuleModal" data-toggle="modal" style="padding:5px 0;"><img src="<?php echo $term->module['url'] . '/screenshot.png'; ?>" alt="<?php echo esc_attr($term->module['name']); ?>" width="100" style="height:auto;"/></a>
24
  </li>
25
  <?php } ?>
26
  <?php
14
  <ul class="nav nav-tabs" id="galleryTabs">
15
  <?php if(isset($module_info)){ ?>
16
  <li class="text-center">
17
+ <strong><?php echo $module_info['title']; ?></strong><a href="#chooseModuleModal" data-toggle="modal" style="padding:5px 0;"><img src="<?php echo $term->module['url'] . '/screenshot.png'; ?>" alt="<?php esc_attr_e($module_info['title']); ?>" width="100" style="height:auto;"/></a>
18
  </li>
19
  <?php } else{ ?>
20
  <li class="text-center"><strong><?php echo $term->module['name']; ?></strong>
21
 
22
  <p><?php _e('This module is broken or outdated. Please, go to Modules page and update/install module or choose another one for this gallery', 'grand-media'); ?></p>
23
+ <a href="#chooseModuleModal" data-toggle="modal" style="padding:5px 0;"><img src="<?php echo $term->module['url'] . '/screenshot.png'; ?>" alt="<?php esc_attr_e($term->module['name']); ?>" width="100" style="height:auto;"/></a>
24
  </li>
25
  <?php } ?>
26
  <?php
admin/pages/library/functions.php CHANGED
@@ -3,140 +3,98 @@
3
  function gmedia_item_thumbnail($item){
4
  global $gmCore;
5
 
6
- echo '<img class="gmedia-thumb" src="' . $gmCore->gm_get_media_image($item, 'thumb') . '" alt=""/>';
7
 
8
  if(isset($item->meta['_cover'][0]) && !empty($item->meta['_cover'][0])){
9
- echo '<img class="gmedia-typethumb" src="' . $gmCore->gm_get_media_image($item, 'thumb', false) . '" alt=""/>';
10
  }
 
 
11
  }
12
 
13
  function gmedia_item_actions($item){
14
  global $gmCore, $gmProcessor;
15
 
16
- $actions = array();
 
 
 
 
 
 
 
 
 
 
 
17
 
18
- $share_icon = '<span class="glyphicon glyphicon-share"></span>';
19
- if('draft' !== $item->status){
20
- if(!empty($item->post_id)){
21
- $cloud_link = get_permalink($item->post_id);
 
 
22
  } else{
23
- $cloud_link = $gmCore->gmcloudlink($item->ID, 'single');
24
  }
25
- $actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->ID . '" class="share-modal" title="' . __('Share Gmedia Post', 'grand-media') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
26
- } else{
27
- $actions['share'] = "<span class='action-inactive'>$share_icon</span>";
28
- }
29
 
30
- $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
31
- if(gm_user_can('edit_media')){
32
- if(((int)$item->author == get_current_user_id()) || gm_user_can('edit_others_media')){
33
- $edit_data_data = $gmProcessor->gmediablank? '' : ' data-target="#previewModal" data-width="1200" data-height="500" data-cls="edit_gmedia_item" class="preview-modal"';
34
- $actions['edit_data'] = '<a href="' . add_query_arg(array('page' => 'GrandMedia', 'mode' => 'edit', 'gmediablank' => 'library', 'gmedia__in' => $item->ID), $gmProcessor->url) . '"' . $edit_data_data . ' title="' . __('Edit Data', 'grand-media') . '">' . $edit_icon . '</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
- } else {
37
- $actions['edit'] = "<span class='action-inactive'>$edit_icon</span>";
38
  }
39
 
40
  if('image' == $item->type){
41
  $edit_image_icon = '<span class="glyphicon glyphicon-adjust"></span>';
42
  if((gm_user_can('edit_media') && ((int)$item->author == get_current_user_id())) || gm_user_can('edit_others_media')){
43
- $actions['edit_image'] = '<a href="' . add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'image_editor', 'id' => $item->ID), $gmProcessor->url) . '" data-target="#gmeditModal" class="gmedit-modal" title="' . __('Edit Image', 'grand-media') . '">' . $edit_image_icon . '</a>';
44
- } else {
45
- $actions['edit'] = "<span class='action-inactive'>$edit_image_icon</span>";
46
  }
47
 
48
  $show_icon = '<span class="glyphicon glyphicon-fullscreen"></span>';
49
- $actions['show'] = '<a href="' . $gmCore->gm_get_media_image($item, 'web') . '" data-target="#previewModal" data-width="' . $item->msize['width'] . '" data-height="' . $item->msize['height'] . '" class="preview-modal" title="' . esc_attr( __('Show', 'grand-media') . ' ' . $item->title) . '">' . $show_icon . '</a>';
50
 
51
  } elseif(in_array($item->ext, array('mp3', 'ogg', 'wav', 'ogg', 'mp4', 'mpeg', 'webm'))){
52
  $show_icon = '<span class="glyphicon glyphicon-play"></span>';
53
- $actions['show'] = '<a href="' . $item->url . '" data-target="#previewModal" data-width="' . $item->msize['width'] . '" data-height="' . $item->msize['height'] . '" class="preview-modal" title="' . esc_attr(__('Play', 'grand-media') . ' ' . $item->title) . '">' . $show_icon . '</a>';
54
  } else{
55
  $show_icon = '<span class="glyphicon glyphicon-cloud-download"></span>';
56
- $actions['show'] = '<a href="' . $item->url . '" title="' . __('Download', 'grand-media') . '" download="' . $item->gmuid . '">' . $show_icon . '</a>';
57
- }
58
-
59
- $info_icon = '<span class="glyphicon glyphicon-info-sign"></span>';
60
- $metainfo = $gmCore->metadata_text($item->ID);
61
- if($metainfo){
62
- $actions['info'] = '<a href="#metaInfo" data-target="#previewModal" data-metainfo="' . $item->ID . '" class="preview-modal" title="' . __('Exif/Meta Info', 'grand-media') . '">' . $info_icon . '</a>';
63
- $actions['info'] .= '<div class="metainfo hidden" id="metainfo_' . $item->ID . '">' . nl2br($metainfo) . '</div>';
64
- } else {
65
- $actions['info'] = "<span class='action-inactive'>$info_icon</span>";
66
  }
67
 
68
  $duplicate_icon = '<span class="glyphicon glyphicon-duplicate"></span>';
69
- $actions['duplicate'] = '<a href="' . wp_nonce_url(gm_get_admin_url(array('duplicate' => $item->ID)), 'gmedia_duplicate') . '" title="' . __('Duplicate', 'grand-media') . '">' . $duplicate_icon . '</a>';
70
 
71
- $delete_icon = '<span class="glyphicon glyphicon-trash"></span>';
72
- if((gm_user_can('delete_media') && ((int)$item->author == get_current_user_id())) || gm_user_can('delete_others_media')){
73
- $actions['delete'] = '<a class="text-danger" href="' . wp_nonce_url(gm_get_admin_url(array('delete' => $item->ID)), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"), $item->gmuid) . '" title="' . __('Delete', 'grand-media') . '">' . $delete_icon . '</a>';
74
-
75
- if($gmCore->_get('showmore')){
76
- $erase_icon = '<span class="glyphicon glyphicon-erase"></span>';
77
- $actions['db_delete'] = '<a class="text-danger" href="' . wp_nonce_url(gm_get_admin_url(array('delete' => $item->ID,
78
- 'save_original_file' => 1
79
- )), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to delete record from DB for %s file.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"), $item->gmuid) . '" title="' . __('Delete DB record (leave file on the server)', 'grand-media') . '">' . $erase_icon . '</a>';
80
- }
81
- } else {
82
- $actions['delete'] = "<span class='action-inactive'>$delete_icon</span>";
83
- }
84
 
85
  return apply_filters('gmedia_item_actions', $actions);
86
  }
87
 
88
 
89
- function gmedia_item_more_data(&$item){
90
- global $gmDB, $gmCore, $gmGallery;
91
-
92
- $meta = $gmDB->get_metadata('gmedia', $item->ID);
93
- $metadata = isset($meta['_metadata'][0])? $meta['_metadata'][0] : array();
94
-
95
- $item->meta = $meta;
96
-
97
- $type = explode('/', $item->mime_type);
98
- $item->type = $type[0];
99
- $item->ext = pathinfo($item->gmuid, PATHINFO_EXTENSION);
100
-
101
- $item->url = $gmCore->upload['url'] . '/' . $gmGallery->options['folder'][ $type[0] ] . '/' . $item->gmuid;
102
- $item->path = $gmCore->upload['path'] . '/' . $gmGallery->options['folder'][ $type[0] ] . '/' . $item->gmuid;
103
-
104
- // if(function_exists('exif_imagetype')) {
105
- // $item->editor = (('image' == $type[0]) && in_array(exif_imagetype($item->path), array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)))? true : false;
106
- // } else {
107
- $item->editor = (('image' == $type[0]) && in_array($type[1], array('jpeg', 'png', 'gif')))? true : false;
108
- // }
109
- $item->gps = '';
110
- if($item->editor){
111
- $item->url_original = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image_original'] . '/' . $item->gmuid;
112
- $item->url_thumb = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image_thumb'] . '/' . $item->gmuid;
113
- $item->path_original = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original'] . '/' . $item->gmuid;
114
- $item->path_thumb = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_thumb'] . '/' . $item->gmuid;
115
- if(!empty($metadata['image_meta']['GPS'])){
116
- $item->gps = implode(', ', $metadata['image_meta']['GPS']);
117
- }
118
- }
119
- if(!empty($meta['_gps'][0])){
120
- $item->gps = implode(', ', $meta['_gps'][0]);
121
- }
122
-
123
- $item->msize['width'] = isset($metadata['web']['width'])? $metadata['web']['width'] : (isset($metadata['width'])? $metadata['width'] : '640');
124
- $item->msize['height'] = isset($metadata['web']['height'])? $metadata['web']['height'] : (isset($metadata['height'])? $metadata['height'] : '200');
125
-
126
- $item->thumb_ratio = 1;
127
- if(isset($metadata['thumb']['width']) && isset($metadata['thumb']['height'])){
128
- $item->thumb_ratio = $metadata['thumb']['width'] / $metadata['thumb']['height'];
129
- }
130
-
131
- $item->tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
132
- $item->album = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
133
- $item->categories = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category');
134
-
135
- $item = apply_filters('gmedia_item_more_data', $item);
136
- }
137
-
138
  function gmedia_filter_message(){
139
  global $gmProcessor;
 
140
  if(!empty($gmProcessor->filters)){
141
  echo '<div class="custom-message alert alert-info">';
142
  foreach($gmProcessor->filters as $key => $value){
@@ -151,6 +109,7 @@ function gmedia_filter_message(){
151
 
152
  function gmedia_alert_message(){
153
  global $gmProcessor;
 
154
  if(($gmProcessor->mode == 'edit') && gm_user_can('show_others_media') && !gm_user_can('edit_others_media')){
155
  ?>
156
  <div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
3
  function gmedia_item_thumbnail($item){
4
  global $gmCore;
5
 
6
+ $thumb = '<img class="gmedia-thumb" src="' . $gmCore->gm_get_media_image($item, 'thumb') . '" alt=""/>';
7
 
8
  if(isset($item->meta['_cover'][0]) && !empty($item->meta['_cover'][0])){
9
+ $thumb .= '<img class="gmedia-typethumb" src="' . $gmCore->gm_get_media_image($item, 'thumb', false) . '" alt=""/>';
10
  }
11
+
12
+ return $thumb;
13
  }
14
 
15
  function gmedia_item_actions($item){
16
  global $gmCore, $gmProcessor;
17
 
18
+ if(!in_array($gmProcessor->mode, array('select_single', 'select_multiple'))){
19
+ $share_icon = '<span class="glyphicon glyphicon-share"></span>';
20
+ if('draft' !== $item->status){
21
+ if(!empty($item->post_id)){
22
+ $cloud_link = get_permalink($item->post_id);
23
+ } else{
24
+ $cloud_link = $gmCore->gmcloudlink($item->ID, 'single');
25
+ }
26
+ $share = '<a target="_blank" data-target="#shareModal" data-share="' . $item->ID . '" class="share-modal" title="' . __('Share Gmedia Post', 'grand-media') . '" href="' . $cloud_link . '">' . $share_icon . '</a>';
27
+ } else{
28
+ $share = "<span class='action-inactive'>$share_icon</span>";
29
+ }
30
 
31
+ $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
32
+ if(gm_user_can('edit_media')){
33
+ if(((int)$item->author == get_current_user_id()) || gm_user_can('edit_others_media')){
34
+ $edit_data_data = $gmProcessor->gmediablank? '' : ' data-target="#previewModal" data-width="1200" data-height="500" data-cls="edit_gmedia_item" class="preview-modal"';
35
+ $edit_data = '<a href="' . add_query_arg(array('page' => 'GrandMedia', 'mode' => 'edit', 'gmediablank' => 'library', 'gmedia__in' => $item->ID), $gmProcessor->url) . '"' . $edit_data_data . ' id="gmdataedit' . $item->ID . '" title="' . __('Edit Data', 'grand-media') . '">' . $edit_icon . '</a>';
36
+ }
37
  } else{
38
+ $edit_data = "<span class='action-inactive'>$edit_icon</span>";
39
  }
 
 
 
 
40
 
41
+ $info_icon = '<span class="glyphicon glyphicon-info-sign"></span>';
42
+ $metainfo = $gmCore->metadata_text($item->ID);
43
+ if($metainfo){
44
+ $info = '<a href="#metaInfo" data-target="#previewModal" data-metainfo="' . $item->ID . '" class="preview-modal" title="' . __('Exif/Meta Info', 'grand-media') . '">' . $info_icon . '</a>';
45
+ $info .= '<div class="metainfo hidden" id="metainfo_' . $item->ID . '">' . nl2br($metainfo) . '</div>';
46
+ } else{
47
+ $info = "<span class='action-inactive'>$info_icon</span>";
48
+ }
49
+
50
+ $delete_icon = '<span class="glyphicon glyphicon-trash"></span>';
51
+ if((gm_user_can('delete_media') && ((int)$item->author == get_current_user_id())) || gm_user_can('delete_others_media')){
52
+ $delete = '<a class="text-danger" href="' . wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'delete',
53
+ 'ids' => $item->ID
54
+ )), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"), $item->gmuid) . '" title="' . __('Delete', 'grand-media') . '">' . $delete_icon . '</a>';
55
+
56
+ if($gmCore->_get('showmore')){
57
+ $erase_icon = '<span class="glyphicon glyphicon-erase"></span>';
58
+ $db_delete = '<a class="text-danger" href="' . wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'delete__save_original',
59
+ 'ids' => $item->ID
60
+ )), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to delete record from DB for %s file.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"), $item->gmuid) . '" title="' . __('Delete DB record (leave file on the server)', 'grand-media') . '">' . $erase_icon . '</a>';
61
+ }
62
+ } else{
63
+ $delete = "<span class='action-inactive'>$delete_icon</span>";
64
  }
 
 
65
  }
66
 
67
  if('image' == $item->type){
68
  $edit_image_icon = '<span class="glyphicon glyphicon-adjust"></span>';
69
  if((gm_user_can('edit_media') && ((int)$item->author == get_current_user_id())) || gm_user_can('edit_others_media')){
70
+ $edit_image = '<a href="' . add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'image_editor', 'id' => $item->ID), $gmProcessor->url) . '" data-target="#gmeditModal" class="gmedit-modal" id="gmimageedit' . $item->ID . '" title="' . __('Edit Image', 'grand-media') . '">' . $edit_image_icon . '</a>';
71
+ } else{
72
+ $edit_image = "<span class='action-inactive'>$edit_image_icon</span>";
73
  }
74
 
75
  $show_icon = '<span class="glyphicon glyphicon-fullscreen"></span>';
76
+ $show = '<a href="' . $gmCore->gm_get_media_image($item, 'web') . '" data-target="#previewModal" data-width="' . $item->msize['width'] . '" data-height="' . $item->msize['height'] . '" class="preview-modal" title="' . esc_attr(__('Show', 'grand-media') . ' ' . $item->title) . '">' . $show_icon . '</a>';
77
 
78
  } elseif(in_array($item->ext, array('mp3', 'ogg', 'wav', 'ogg', 'mp4', 'mpeg', 'webm'))){
79
  $show_icon = '<span class="glyphicon glyphicon-play"></span>';
80
+ $show = '<a href="' . $item->url . '" data-target="#previewModal" data-width="' . $item->msize['width'] . '" data-height="' . $item->msize['height'] . '" class="preview-modal" title="' . esc_attr(__('Play', 'grand-media') . ' ' . $item->title) . '">' . $show_icon . '</a>';
81
  } else{
82
  $show_icon = '<span class="glyphicon glyphicon-cloud-download"></span>';
83
+ $show = '<a href="' . $item->url . '" title="' . __('Download', 'grand-media') . '" download="' . $item->gmuid . '">' . $show_icon . '</a>';
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
  $duplicate_icon = '<span class="glyphicon glyphicon-duplicate"></span>';
87
+ $duplicate = '<a href="' . wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'duplicate', 'ids' => $item->ID)), 'gmedia_action') . '" title="' . __('Duplicate', 'grand-media') . '">' . $duplicate_icon . '</a>';
88
 
89
+ $actions = compact('share', 'edit_data', 'edit_image', 'show', 'info', 'duplicate', 'delete', 'db_delete');
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  return apply_filters('gmedia_item_actions', $actions);
92
  }
93
 
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  function gmedia_filter_message(){
96
  global $gmProcessor;
97
+ do_action('before_gmedia_filter_message');
98
  if(!empty($gmProcessor->filters)){
99
  echo '<div class="custom-message alert alert-info">';
100
  foreach($gmProcessor->filters as $key => $value){
109
 
110
  function gmedia_alert_message(){
111
  global $gmProcessor;
112
+ do_action('before_gmedia_alert_message');
113
  if(($gmProcessor->mode == 'edit') && gm_user_can('show_others_media') && !gm_user_can('edit_others_media')){
114
  ?>
115
  <div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
admin/pages/library/library.php CHANGED
@@ -8,24 +8,54 @@ if(!defined('ABSPATH')) {
8
  die('-1');
9
  }
10
 
11
- global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
12
 
 
13
  $gmedia_url = $gmProcessor->url;
14
  $gmedia_user_options = $gmProcessor->user_options;
15
 
16
- $gmedia_query = $gmDB->get_gmedias($gmProcessor->query_args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  $gmedia_count = $gmDB->count_gmedia();
18
  $gmedia_pager = $gmDB->query_pager();
19
 
20
- $view = $gmProcessor->gmediablank? '_frame' : '';
21
- $display_mode_gmedia = $gmedia_user_options["display_mode_gmedia{$view}"];
22
 
23
- $panel_class = array();
24
  $panel_class[] = 'panel-fixed-header';
25
  $panel_class[] = "display-as-{$display_mode_gmedia}";
26
  if($gmProcessor->user_options['grid_cell_fit_gmedia']) {
27
  $panel_class[] = 'invert-ratio';
28
  }
 
 
 
 
 
 
29
 
30
  ?>
31
 
@@ -36,7 +66,7 @@ if($gmProcessor->user_options['grid_cell_fit_gmedia']) {
36
  <?php include(dirname(__FILE__) . '/tpl/panel-heading.php'); ?>
37
 
38
  <div class="panel-body"></div>
39
- <div class="list-group clearfix" id="gm-list-table">
40
  <?php
41
  if(count($gmedia_query)) {
42
 
@@ -55,7 +85,7 @@ if($gmProcessor->user_options['grid_cell_fit_gmedia']) {
55
  }
56
  }
57
  $item->selected = in_array($item->ID, (array)$gmProcessor->selected_items);
58
- if($item->selected){
59
  $item->classes[] = 'gm-selected';
60
  }
61
  $item->in_stack = in_array($item->ID, (array)$gmProcessor->stack_items);
@@ -122,7 +152,10 @@ if($gmProcessor->user_options['grid_cell_fit_gmedia']) {
122
  <div class="modal-dialog">
123
  <div class="modal-content">
124
  <div class="modal-header">
125
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
 
 
126
  <h4 class="modal-title"></h4>
127
  </div>
128
  <div class="modal-body"></div>
8
  die('-1');
9
  }
10
 
11
+ global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor, $gmProcessorLibrary;
12
 
13
+ $panel_class = array();
14
  $gmedia_url = $gmProcessor->url;
15
  $gmedia_user_options = $gmProcessor->user_options;
16
 
17
+ $_get_filter = $gmCore->_get('filter');
18
+ if($_get_filter && ($_get_filter != 'selected')){
19
+ $gmProcessorLibrary->query_args['mime_type'] = $_get_filter;
20
+ }
21
+
22
+ $gmedia_query = $gmDB->get_gmedias($gmProcessorLibrary->query_args);
23
+
24
+ $gmedia_filter = $gmDB->filter;
25
+ $resultPerPage = $gmDB->resultPerPage;
26
+ $openPage = $gmDB->openPage;
27
+ $perPages = $gmDB->perPages;
28
+ $idx0 = $perPages * ($openPage - 1);
29
+
30
+ if($_get_filter && ($_get_filter != 'selected')){
31
+ unset($gmDB->filter['mime_type']);
32
+ unset($gmedia_filter['mime_type']);
33
+ }
34
+ if($gmProcessor->edit_term){
35
+ $taxin = "{$gmProcessor->taxterm}__in";
36
+ if(isset($gmedia_filter[$taxin]) && $gmedia_filter[$taxin] == $gmProcessorLibrary->query_args[$taxin]){
37
+ unset($gmDB->filter[$taxin]);
38
+ unset($gmedia_filter[$taxin]);
39
+ }
40
+ $gmProcessorLibrary->dbfilter = $gmedia_filter;
41
+ }
42
+
43
  $gmedia_count = $gmDB->count_gmedia();
44
  $gmedia_pager = $gmDB->query_pager();
45
 
46
+ $display_mode_gmedia = $gmProcessor->display_mode;
 
47
 
 
48
  $panel_class[] = 'panel-fixed-header';
49
  $panel_class[] = "display-as-{$display_mode_gmedia}";
50
  if($gmProcessor->user_options['grid_cell_fit_gmedia']) {
51
  $panel_class[] = 'invert-ratio';
52
  }
53
+ if(!empty($gmedia_filter)) {
54
+ $panel_class[] = 'gmedia-filtered';
55
+ }
56
+ if($gmProcessorLibrary->mode) {
57
+ $panel_class[] = "mode__{$gmProcessorLibrary->mode}";
58
+ }
59
 
60
  ?>
61
 
66
  <?php include(dirname(__FILE__) . '/tpl/panel-heading.php'); ?>
67
 
68
  <div class="panel-body"></div>
69
+ <div class="list-group clearfix" id="gm-list-table" data-idx0="<?php echo $idx0 + 1; ?>">
70
  <?php
71
  if(count($gmedia_query)) {
72
 
85
  }
86
  }
87
  $item->selected = in_array($item->ID, (array)$gmProcessor->selected_items);
88
+ if($item->selected && ($gmProcessor->mode != 'select_single')){
89
  $item->classes[] = 'gm-selected';
90
  }
91
  $item->in_stack = in_array($item->ID, (array)$gmProcessor->stack_items);
152
  <div class="modal-dialog">
153
  <div class="modal-content">
154
  <div class="modal-header">
155
+ <div class="btn-toolbar pull-right" style="margin-top:-4px;">
156
+ <button type="button" class="btn btn-primary"><?php _e('Submit', 'grand-media'); ?></button>
157
+ <button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Close', 'grand-media'); ?></button>
158
+ </div>
159
  <h4 class="modal-title"></h4>
160
  </div>
161
  <div class="modal-body"></div>
admin/pages/library/tpl/edit-item.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  // don't load directly
3
- if(!defined('ABSPATH')) {
4
  die('-1');
5
  }
6
 
@@ -12,13 +12,13 @@ if(!defined('ABSPATH')) {
12
  <div class="col-sm-4" style="max-width:340px;">
13
  <input name="ID" type="hidden" value="<?php echo $item->ID; ?>"/>
14
  <div class="thumbwrap">
15
- <label class="cb_media-object">
16
- <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" class="hidden edit-gmedia-ignore" value="<?php echo $item->ID; ?>"/>
17
- <span data-target="<?php echo $item->url; ?>" class="thumbnail">
18
- <?php gmedia_item_thumbnail($item); ?>
19
  </span>
20
- </label>
21
- <label class="gm-stack"><input title="<?php _e('Add to Stack', 'grand-media'); ?>" name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
 
22
  </div>
23
  <div class="gmedia-actions">
24
  <?php $media_action_links = gmedia_item_actions($item);
@@ -27,7 +27,7 @@ if(!defined('ABSPATH')) {
27
  ?>
28
  </div>
29
  <?php
30
- if('audio' == $item->type) {
31
  echo gmedia_waveform_player($item);
32
  }
33
  ?>
@@ -36,60 +36,62 @@ if(!defined('ABSPATH')) {
36
  <div class="row">
37
  <div class="form-group col-lg-6">
38
  <label><?php _e('Title', 'grand-media'); ?></label>
39
- <input name="title" type="text" class="form-control input-sm" placeholder="<?php _e('Title', 'grand-media'); ?>" value="<?php echo esc_attr($item->title); ?>">
40
  </div>
41
  <div class="form-group col-lg-6">
42
  <label><?php _e('Link URL', 'grand-media'); ?></label>
43
- <input name="link" type="text" class="form-control input-sm" value="<?php echo $item->link; ?>"/>
 
 
 
44
  </div>
45
  </div>
46
  <div class="row">
47
  <div class="form-group col-lg-6">
48
  <label><?php _e('Description', 'grand-media'); ?></label>
49
- <?php if('false' == $gmedia_user_options['library_edit_quicktags']) {
50
- echo "<textarea id='gm{$item->ID}_description' class='form-control input-sm' name='description' cols='20' rows='4' style='height:174px'>" . esc_html($item->description) . '</textarea>';
51
- } else {
52
- wp_editor(esc_html($item->description), "gm{$item->ID}_description", array(
53
- 'editor_class' => 'form-control input-sm',
54
- 'editor_height' => 140,
55
- 'wpautop' => false,
56
- 'media_buttons' => false,
57
- 'textarea_name' => 'description',
58
- 'textarea_rows' => '4',
59
- 'tinymce' => false,
60
- 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
61
  ));
 
 
62
  } ?>
63
  </div>
64
  <div class="col-lg-6">
65
- <?php if(gm_user_can('terms')) { ?>
66
  <?php
67
  $alb_id = empty($item->album)? 0 : reset($item->album)->term_id;
68
  $term_type = 'gmedia_album';
69
  $args = array();
70
- if(!gm_user_can('edit_others_media')) {
71
  $args = array('global' => array(0, $user_ID), 'orderby' => 'global_desc_name');
72
  }
73
  $gm_terms = $gmDB->get_terms($term_type, $args);
74
 
75
  $terms_album = '';
76
  $album_status = 'none';
77
- if(count($gm_terms)) {
78
- foreach($gm_terms as $term) {
79
  $author_name = '';
80
- if($term->global) {
81
- if(gm_user_can('edit_others_media')) {
82
  $author_name .= ' &nbsp; ' . sprintf(__('by %s', 'grand-media'), get_the_author_meta('display_name', $term->global));
83
  }
84
- } else {
85
  $author_name .= ' &nbsp; (' . __('shared', 'grand-media') . ')';
86
  }
87
- if('publish' != $term->status) {
88
  $author_name .= ' [' . $term->status . ']';
89
  }
90
 
91
  $selected_option = '';
92
- if($alb_id == $term->term_id) {
93
  $selected_option = ' selected="selected"';
94
  $album_status = $term->status;
95
  }
@@ -99,6 +101,7 @@ if(!defined('ABSPATH')) {
99
  ?>
100
  <div class="form-group status-album bg-status-<?php echo $album_status; ?>">
101
  <label><?php _e('Album ', 'grand-media'); ?></label>
 
102
  <select name="terms[gmedia_album]" data-create="<?php echo gm_user_can('album_manage')? 'true' : 'false'; ?>" class="combobox_gmedia_album form-control input-sm" placeholder="<?php _e('Album Name...', 'grand-media'); ?>">
103
  <option<?php echo $alb_id? '' : ' selected="selected"'; ?> value=""></option>
104
  <?php echo $terms_album; ?>
@@ -106,13 +109,13 @@ if(!defined('ABSPATH')) {
106
  </div>
107
 
108
  <?php
109
- if(!empty($item->categories)) {
110
  $terms_category = array();
111
- foreach($item->categories as $c) {
112
  $terms_category[] = esc_html($c->name);
113
  }
114
  $terms_category = join(',', $terms_category);
115
- } else {
116
  $terms_category = '';
117
  }
118
  ?>
@@ -122,13 +125,13 @@ if(!defined('ABSPATH')) {
122
  </div>
123
 
124
  <?php
125
- if(!empty($item->tags)) {
126
  $terms_tag = array();
127
- foreach($item->tags as $c) {
128
  $terms_tag[] = esc_html($c->name);
129
  }
130
  $terms_tag = join(',', $terms_tag);
131
- } else {
132
  $terms_tag = '';
133
  }
134
  ?>
@@ -141,8 +144,16 @@ if(!defined('ABSPATH')) {
141
  </div>
142
  <div class="row">
143
  <div class="col-lg-6">
 
 
 
 
 
 
144
  <div class="form-group">
145
- <label><?php _e('Filename', 'grand-media'); ?> <small style="white-space:nowrap;">(ext: .<?php echo $item->ext; ?>)</small></label>
 
 
146
  <input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php echo (!gm_user_can('delete_others_media') && ((int)$item->author !== $user_ID))? 'readonly' : ''; ?> value="<?php echo pathinfo($item->gmuid, PATHINFO_FILENAME); ?>"/>
147
  </div>
148
  <div class="form-group">
@@ -163,48 +174,55 @@ if(!defined('ABSPATH')) {
163
  </select>
164
  </div>
165
  <?php if(!empty($item->post_id)){ ?>
166
- <div class="form-group">
167
- <a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID), $gmProcessor->url); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count pull-right" title="<?php esc_attr_e('Comments', 'grand-media'); ?>">
168
- <b class="comment-count"><?php echo $item->comment_count; ?></b>
169
- <span class="glyphicon glyphicon-comment"></span>
170
- </a>
171
- <label><?php _e('Comment Status', 'grand-media'); ?></label>
172
- <select name="comment_status" class="form-control input-sm">
173
- <option <?php selected($item->comment_status, 'open'); ?> value="open"><?php _e('Open', 'grand-media'); ?></option>
174
- <option <?php selected($item->comment_status, 'closed'); ?> value="closed"><?php _e('Closed', 'grand-media'); ?></option>
175
- </select>
176
- </div>
177
  <?php } ?>
178
  </div>
179
  <div class="col-lg-6">
180
  <div class="form-group">
181
  <label><?php _e('Author', 'grand-media'); ?></label>
182
  <?php $user_ids = gm_user_can('delete_others_media')? $gmCore->get_editable_user_ids() : false;
183
- if($user_ids) {
184
- if(!in_array($user_ID, $user_ids)) {
185
  array_push($user_ids, $user_ID);
186
  }
187
- wp_dropdown_users(array(
188
- 'include' => $user_ids,
189
- 'include_selected' => true,
190
- 'name' => 'author',
191
- 'selected' => $item->author,
192
- 'class' => 'form-control',
193
- 'multi' => true
194
  ));
195
- } else {
196
  echo '<input type="hidden" name="author" value="' . $item->author . '"/>';
197
  echo '<div>' . get_the_author_meta('display_name', $item->author) . '</div>';
198
  }
199
  ?>
200
  </div>
201
- <?php if(('image' != $item->type)) { ?>
202
  <div class="form-group">
203
- <label><?php _e('Custom Cover', 'grand-media'); echo ' <small>('.__('media image ID', 'grand-media').')</small>'; ?></label>
204
- <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', 'grand-media'); ?>"/>
 
 
 
 
 
 
 
 
205
  </div>
206
  <?php } ?>
207
- <?php if(('image' == $item->type) || ('video' == $item->type)) { ?>
208
  <div class="form-group">
209
  <label><?php _e('GPS Location', 'grand-media'); ?></label>
210
 
@@ -218,7 +236,7 @@ if(!defined('ABSPATH')) {
218
  <p class="media-meta">
219
  <span class="label label-default"><?php _e('ID', 'grand-media') ?>:</span> <strong><?php echo $item->ID; ?></strong>
220
  <br/><span class="label label-default"><?php _e('Type', 'grand-media'); ?>:</span> <?php echo $item->mime_type; ?>
221
- <?php if(('image' == $item->type) && !empty($item->meta['_metadata'])) { ?>
222
  <br/><span class="label label-default"><?php _e('Dimensions', 'grand-media'); ?>:</span>
223
  <a href="<?php echo $item->url_original; ?>"
224
  data-target="#previewModal"
@@ -239,10 +257,10 @@ if(!defined('ABSPATH')) {
239
  class="preview-modal"
240
  title="<?php _e('Thumbnail', 'grand-media'); ?>"><?php echo $item->meta['_metadata'][0]['thumb']['width'] . '×' . $item->meta['_metadata'][0]['thumb']['height']; ?></a>
241
  <br/><span class="label label-default"><?php _e('File Size', 'grand-media') ?>:</span> <?php echo $gmCore->filesize($item->path_original) . ', ' . $gmCore->filesize($item->path) . ', ' . $gmCore->filesize($item->path_thumb); ?>
242
- <?php } else { ?>
243
  <br/><span class="label label-default"><?php _e('File Size', 'grand-media') ?>:</span> <?php echo $gmCore->filesize($item->path); ?>
244
  <?php } ?>
245
- <?php if(!empty($item->meta['_created_timestamp'][0])) { ?>
246
  <br/><span class="label label-default"><?php _e('Created', 'grand-media') ?>:</span> <?php echo date('Y-m-d H:i:s ', $item->meta['_created_timestamp'][0]); ?>
247
  <?php } ?>
248
  <br/><span class="label label-default"><?php _e('Uploaded', 'grand-media') ?>:</span> <?php echo $item->date; ?>
1
  <?php
2
  // don't load directly
3
+ if(!defined('ABSPATH')){
4
  die('-1');
5
  }
6
 
12
  <div class="col-sm-4" style="max-width:340px;">
13
  <input name="ID" type="hidden" value="<?php echo $item->ID; ?>"/>
14
  <div class="thumbwrap">
15
+ <div class="cb_media-object">
16
+ <span data-clicktarget="gmimageedit<?php echo $item->ID; ?>" class="thumbnail gmedia-cover-image">
17
+ <?php echo gmedia_item_thumbnail($item); ?>
 
18
  </span>
19
+ </div>
20
+ <label class="gm-item-check"><input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
21
+ <label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
22
  </div>
23
  <div class="gmedia-actions">
24
  <?php $media_action_links = gmedia_item_actions($item);
27
  ?>
28
  </div>
29
  <?php
30
+ if('audio' == $item->type){
31
  echo gmedia_waveform_player($item);
32
  }
33
  ?>
36
  <div class="row">
37
  <div class="form-group col-lg-6">
38
  <label><?php _e('Title', 'grand-media'); ?></label>
39
+ <input name="title" type="text" class="form-control input-sm" placeholder="<?php _e('Title', 'grand-media'); ?>" value="<?php esc_attr_e($item->title); ?>">
40
  </div>
41
  <div class="form-group col-lg-6">
42
  <label><?php _e('Link URL', 'grand-media'); ?></label>
43
+ <div class="input-group">
44
+ <input name="link" type="text" class="form-control input-sm gmedia-custom-link-field" id="gmlink<?php echo $item->ID; ?>" value="<?php echo $item->link; ?>"/>
45
+ <span class="input-group-btn"><button type="button" class="btn btn-sm btn-primary gmedia-custom-link" data-target="gmlink<?php echo $item->ID; ?>" title="<?php _e('Link to existing WP content', 'grand-media'); ?>"><span class="glyphicon glyphicon-link"></span></button></span>
46
+ </div>
47
  </div>
48
  </div>
49
  <div class="row">
50
  <div class="form-group col-lg-6">
51
  <label><?php _e('Description', 'grand-media'); ?></label>
52
+ <?php if(('false' != $gmedia_user_options['library_edit_quicktags']) || ($gmProcessor->gmediablank && (1 == $resultPerPage))){
53
+ wp_editor(esc_textarea($item->description), "gm{$item->ID}_description", array('editor_class' => 'form-control input-sm',
54
+ 'editor_height' => 140,
55
+ 'wpautop' => false,
56
+ 'media_buttons' => false,
57
+ 'textarea_name' => 'description',
58
+ 'textarea_rows' => '4',
59
+ 'tinymce' => false,
60
+ 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
 
 
 
61
  ));
62
+ } else{
63
+ echo "<textarea id='gm{$item->ID}_description' class='form-control input-sm' name='description' cols='20' rows='4' style='height:174px'>" . esc_textarea($item->description) . '</textarea>';
64
  } ?>
65
  </div>
66
  <div class="col-lg-6">
67
+ <?php if(gm_user_can('terms')){ ?>
68
  <?php
69
  $alb_id = empty($item->album)? 0 : reset($item->album)->term_id;
70
  $term_type = 'gmedia_album';
71
  $args = array();
72
+ if(!gm_user_can('edit_others_media')){
73
  $args = array('global' => array(0, $user_ID), 'orderby' => 'global_desc_name');
74
  }
75
  $gm_terms = $gmDB->get_terms($term_type, $args);
76
 
77
  $terms_album = '';
78
  $album_status = 'none';
79
+ if(count($gm_terms)){
80
+ foreach($gm_terms as $term){
81
  $author_name = '';
82
+ if($term->global){
83
+ if(gm_user_can('edit_others_media')){
84
  $author_name .= ' &nbsp; ' . sprintf(__('by %s', 'grand-media'), get_the_author_meta('display_name', $term->global));
85
  }
86
+ } else{
87
  $author_name .= ' &nbsp; (' . __('shared', 'grand-media') . ')';
88
  }
89
+ if('publish' != $term->status){
90
  $author_name .= ' [' . $term->status . ']';
91
  }
92
 
93
  $selected_option = '';
94
+ if($alb_id == $term->term_id){
95
  $selected_option = ' selected="selected"';
96
  $album_status = $term->status;
97
  }
101
  ?>
102
  <div class="form-group status-album bg-status-<?php echo $album_status; ?>">
103
  <label><?php _e('Album ', 'grand-media'); ?></label>
104
+ <input type="text" class="gm-order-input" name="gmedia_album_order" title="<?php _e('Sort order (custom) in the chosen Album', 'grand-media'); ?>" value="<?php echo $alb_id? reset($item->album)->gmedia_order : '0'; ?>" <?php echo $alb_id? '' : 'disabled' ?>/>
105
  <select name="terms[gmedia_album]" data-create="<?php echo gm_user_can('album_manage')? 'true' : 'false'; ?>" class="combobox_gmedia_album form-control input-sm" placeholder="<?php _e('Album Name...', 'grand-media'); ?>">
106
  <option<?php echo $alb_id? '' : ' selected="selected"'; ?> value=""></option>
107
  <?php echo $terms_album; ?>
109
  </div>
110
 
111
  <?php
112
+ if(!empty($item->categories)){
113
  $terms_category = array();
114
+ foreach($item->categories as $c){
115
  $terms_category[] = esc_html($c->name);
116
  }
117
  $terms_category = join(',', $terms_category);
118
+ } else{
119
  $terms_category = '';
120
  }
121
  ?>
125
  </div>
126
 
127
  <?php
128
+ if(!empty($item->tags)){
129
  $terms_tag = array();
130
+ foreach($item->tags as $c){
131
  $terms_tag[] = esc_html($c->name);
132
  }
133
  $terms_tag = join(',', $terms_tag);
134
+ } else{
135
  $terms_tag = '';
136
  }
137
  ?>
144
  </div>
145
  <div class="row">
146
  <div class="col-lg-6">
147
+ <?php if('image' == $item->type){ ?>
148
+ <div class="form-group">
149
+ <label><?php _e('Alternative Text', 'grand-media'); ?></label>
150
+ <input type="text" class="form-control input-sm" name="meta[_image_alt]" value="<?php echo isset($item->meta['_image_alt'][0])? esc_attr($item->meta['_image_alt'][0]) : ''; ?>" placeholder="<?php _e('if empty, same as Title', 'grand-media'); ?>"/>
151
+ </div>
152
+ <?php } ?>
153
  <div class="form-group">
154
+ <label><?php _e('Filename', 'grand-media'); ?>
155
+ <small style="white-space:nowrap;">(ext: .<?php echo $item->ext; ?>)</small>
156
+ </label>
157
  <input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php echo (!gm_user_can('delete_others_media') && ((int)$item->author !== $user_ID))? 'readonly' : ''; ?> value="<?php echo pathinfo($item->gmuid, PATHINFO_FILENAME); ?>"/>
158
  </div>
159
  <div class="form-group">
174
  </select>
175
  </div>
176
  <?php if(!empty($item->post_id)){ ?>
177
+ <div class="form-group">
178
+ <a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_id' => $item->ID), $gmProcessor->url); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count pull-right" title="<?php esc_attr_e('Comments', 'grand-media'); ?>">
179
+ <b class="comment-count"><?php echo $item->comment_count; ?></b>
180
+ <span class="glyphicon glyphicon-comment"></span>
181
+ </a>
182
+ <label><?php _e('Comment Status', 'grand-media'); ?></label>
183
+ <select name="comment_status" class="form-control input-sm">
184
+ <option <?php selected($item->comment_status, 'open'); ?> value="open"><?php _e('Open', 'grand-media'); ?></option>
185
+ <option <?php selected($item->comment_status, 'closed'); ?> value="closed"><?php _e('Closed', 'grand-media'); ?></option>
186
+ </select>
187
+ </div>
188
  <?php } ?>
189
  </div>
190
  <div class="col-lg-6">
191
  <div class="form-group">
192
  <label><?php _e('Author', 'grand-media'); ?></label>
193
  <?php $user_ids = gm_user_can('delete_others_media')? $gmCore->get_editable_user_ids() : false;
194
+ if($user_ids){
195
+ if(!in_array($user_ID, $user_ids)){
196
  array_push($user_ids, $user_ID);
197
  }
198
+ wp_dropdown_users(array('include' => $user_ids,
199
+ 'include_selected' => true,
200
+ 'name' => 'author',
201
+ 'selected' => $item->author,
202
+ 'class' => 'form-control',
203
+ 'multi' => true
 
204
  ));
205
+ } else{
206
  echo '<input type="hidden" name="author" value="' . $item->author . '"/>';
207
  echo '<div>' . get_the_author_meta('display_name', $item->author) . '</div>';
208
  }
209
  ?>
210
  </div>
211
+ <?php if('image' != $item->type){ ?>
212
  <div class="form-group">
213
+ <label><?php _e('Custom Cover', 'grand-media');
214
+ echo ' <small>(' . __('media image ID', 'grand-media') . ')</small>'; ?></label>
215
+ <div class="input-group">
216
+ <input type="text" class="form-control input-sm gmedia-cover-id" name="meta[_cover]" value="<?php echo isset($item->meta['_cover'][0])? $item->meta['_cover'][0] : ''; ?>" placeholder="<?php _e('Gmedia Image ID', 'grand-media'); ?>"/>
217
+ <span class="input-group-btn"><a href="<?php echo $gmCore->get_admin_url(array('page' => 'GrandMedia',
218
+ 'mode' => 'select_single',
219
+ 'gmediablank' => 'library',
220
+ 'filter' => 'image'
221
+ ), array(), true); ?>" class="btn btn-sm btn-primary preview-modal" data-target="#previewModal" data-width="1200" data-height="500" data-cls="select_gmedia_image" title="<?php _e('Choose Cover Image', 'grand-media'); ?>"><span class="glyphicon glyphicon-picture"></span></a></span>
222
+ </div>
223
  </div>
224
  <?php } ?>
225
+ <?php if(('image' == $item->type) || ('video' == $item->type)){ ?>
226
  <div class="form-group">
227
  <label><?php _e('GPS Location', 'grand-media'); ?></label>
228
 
236
  <p class="media-meta">
237
  <span class="label label-default"><?php _e('ID', 'grand-media') ?>:</span> <strong><?php echo $item->ID; ?></strong>
238
  <br/><span class="label label-default"><?php _e('Type', 'grand-media'); ?>:</span> <?php echo $item->mime_type; ?>
239
+ <?php if(('image' == $item->type) && !empty($item->meta['_metadata'])){ ?>
240
  <br/><span class="label label-default"><?php _e('Dimensions', 'grand-media'); ?>:</span>
241
  <a href="<?php echo $item->url_original; ?>"
242
  data-target="#previewModal"
257
  class="preview-modal"
258
  title="<?php _e('Thumbnail', 'grand-media'); ?>"><?php echo $item->meta['_metadata'][0]['thumb']['width'] . '×' . $item->meta['_metadata'][0]['thumb']['height']; ?></a>
259
  <br/><span class="label label-default"><?php _e('File Size', 'grand-media') ?>:</span> <?php echo $gmCore->filesize($item->path_original) . ', ' . $gmCore->filesize($item->path) . ', ' . $gmCore->filesize($item->path_thumb); ?>
260
+ <?php } else{ ?>
261
  <br/><span class="label label-default"><?php _e('File Size', 'grand-media') ?>:</span> <?php echo $gmCore->filesize($item->path); ?>
262
  <?php } ?>
263
+ <?php if(!empty($item->meta['_created_timestamp'][0])){ ?>
264
  <br/><span class="label label-default"><?php _e('Created', 'grand-media') ?>:</span> <?php echo date('Y-m-d H:i:s ', $item->meta['_created_timestamp'][0]); ?>
265
  <?php } ?>
266
  <br/><span class="label label-default"><?php _e('Uploaded', 'grand-media') ?>:</span> <?php echo $item->date; ?>
admin/pages/library/tpl/grid-item.php CHANGED
@@ -9,14 +9,20 @@ if(!defined('ABSPATH')){
9
  */
10
  ?>
11
  <div class="cb_list-item gm-item-cell col-xs-6 col-sm-4 col-md-3 col-lg-2 <?php echo implode(' ', $item->classes); ?>" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $item->type; ?>">
12
- <div class="thumbnail <?php echo ($item->thumb_ratio >= 1)? 'landscape' : 'portrait'; ?>">
13
- <label class="cb_media-object">
14
- <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" class="hidden" value="<?php echo $item->ID; ?>"/>
15
- <span data-target="<?php echo $item->url; ?>" class="centered">
16
- <?php gmedia_item_thumbnail($item); ?>
17
  </span>
 
 
 
 
 
 
 
18
  </label>
19
- <label class="gm-stack"><input title="<?php _e('Add to Stack', 'grand-media'); ?>" name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
20
  <div class="gm-cell-more">
21
  <span class="gm-cell-more-btn glyphicon glyphicon-menu-hamburger"></span>
22
  <div class="gm-cell-more-content">
@@ -26,11 +32,11 @@ if(!defined('ABSPATH')){
26
  if($item->album){
27
  $terms_album = array();
28
  foreach($item->album as $c){
29
- $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $c->term_id), $gmedia_url)), esc_html($c->name));
30
  }
31
  $terms_album = join(', ', $terms_album);
32
  } else{
33
- $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $gmedia_url)), '&#8212;');
34
  }
35
  echo $terms_album;
36
  ?>
@@ -39,11 +45,11 @@ if(!defined('ABSPATH')){
39
  if($item->categories){
40
  $terms_category = array();
41
  foreach($item->categories as $c){
42
- $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));
43
  }
44
  $terms_category = join(', ', $terms_category);
45
  } else{
46
- $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
47
  }
48
  echo $terms_category;
49
  ?>
@@ -52,7 +58,7 @@ if(!defined('ABSPATH')){
52
  if($item->tags){
53
  $terms_tag = array();
54
  foreach($item->tags as $c){
55
- $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $c->term_id), $gmedia_url)), esc_html($c->name));
56
  }
57
  $terms_tag = join(', ', $terms_tag);
58
  } else{
9
  */
10
  ?>
11
  <div class="cb_list-item gm-item-cell col-xs-6 col-sm-4 col-md-3 col-lg-2 <?php echo implode(' ', $item->classes); ?>" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $item->type; ?>">
12
+ <div class="thumbnail <?php echo ($item->img_ratio >= 1)? 'landscape' : 'portrait'; ?>">
13
+ <div class="cb_media-object">
14
+ <span<?php echo in_array($gmProcessor->mode, array('select_single', 'select_multiple'))? '' : ' data-clicktarget="gmdataedit' . $item->ID . '"'; ?> class="centered">
15
+ <?php echo gmedia_item_thumbnail($item); ?>
 
16
  </span>
17
+ </div>
18
+ <label class="gm-item-check">
19
+ <?php if($gmProcessor->mode != 'select_single'){ ?>
20
+ <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/>
21
+ <?php } else{ ?>
22
+ <input name="doaction[]" type="radio" data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/>
23
+ <?php } ?>
24
  </label>
25
+ <label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
26
  <div class="gm-cell-more">
27
  <span class="gm-cell-more-btn glyphicon glyphicon-menu-hamburger"></span>
28
  <div class="gm-cell-more-content">
32
  if($item->album){
33
  $terms_album = array();
34
  foreach($item->album as $c){
35
+ $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('album__in' => $c->term_id), $gmedia_url)), esc_html($c->name));
36
  }
37
  $terms_album = join(', ', $terms_album);
38
  } else{
39
+ $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('album__in' => 0), $gmedia_url)), '&#8212;');
40
  }
41
  echo $terms_album;
42
  ?>
45
  if($item->categories){
46
  $terms_category = array();
47
  foreach($item->categories as $c){
48
+ $terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('category__in' => $c->term_id), $gmedia_url)), esc_html($c->name));
49
  }
50
  $terms_category = join(', ', $terms_category);
51
  } else{
52
+ $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('category__in' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
53
  }
54
  echo $terms_category;
55
  ?>
58
  if($item->tags){
59
  $terms_tag = array();
60
  foreach($item->tags as $c){
61
+ $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag__in' => $c->term_id), $gmedia_url)), esc_html($c->name));
62
  }
63
  $terms_tag = join(', ', $terms_tag);
64
  } else{
admin/pages/library/tpl/list-item.php CHANGED
@@ -15,13 +15,13 @@ if(!defined('ABSPATH')) {
15
  <div class="gmedia_id">#<?php echo $item->ID; ?></div>
16
  <div class="col-sm-4" style="max-width:340px;">
17
  <div class="thumbwrap">
18
- <label class="cb_media-object">
19
- <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" class="hidden" value="<?php echo $item->ID; ?>"/>
20
- <span data-target="<?php echo $item->url; ?>" class="thumbnail">
21
- <?php gmedia_item_thumbnail($item); ?>
22
  </span>
23
- </label>
24
- <label class="gm-stack"><input title="<?php _e('Add to Stack', 'grand-media'); ?>" name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
 
25
  </div>
26
  <?php
27
  if('audio' == $item->type) {
@@ -43,11 +43,11 @@ if(!defined('ABSPATH')) {
43
  if($item->album) {
44
  $terms_album = array();
45
  foreach($item->album as $c) {
46
- $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $c->term_id), $gmedia_url)), esc_html($c->name));
47
  }
48
  $terms_album = join(', ', $terms_album);
49
  } else {
50
- $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $gmedia_url)), '&#8212;');
51
  }
52
  echo $terms_album;
53
  ?>
@@ -56,11 +56,11 @@ if(!defined('ABSPATH')) {
56
  if($item->categories) {
57
  $terms_category = array();
58
  foreach($item->categories as $c) {
59
- $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));
60
  }
61
  $terms_category = join(', ', $terms_category);
62
  } else {
63
- $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
64
  }
65
  echo $terms_category;
66
  ?>
@@ -69,7 +69,7 @@ if(!defined('ABSPATH')) {
69
  if($item->tags) {
70
  $terms_tag = array();
71
  foreach($item->tags as $c) {
72
- $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $c->term_id), $gmedia_url)), esc_html($c->name));
73
  }
74
  $terms_tag = join(', ', $terms_tag);
75
  } else {
15
  <div class="gmedia_id">#<?php echo $item->ID; ?></div>
16
  <div class="col-sm-4" style="max-width:340px;">
17
  <div class="thumbwrap">
18
+ <div class="cb_media-object">
19
+ <span data-clicktarget="gmdataedit<?php echo $item->ID; ?>" class="thumbnail">
20
+ <?php echo gmedia_item_thumbnail($item); ?>
 
21
  </span>
22
+ </div>
23
+ <label class="gm-item-check"><input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
24
+ <label class="gm-stack hidden"><input name="stack[]" type="checkbox"<?php echo $item->in_stack? ' checked="checked"' : ''; ?> data-type="<?php echo $item->type; ?>" value="<?php echo $item->ID; ?>"/></label>
25
  </div>
26
  <?php
27
  if('audio' == $item->type) {
43
  if($item->album) {
44
  $terms_album = array();
45
  foreach($item->album as $c) {
46
+ $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('album__in' => $c->term_id), $gmedia_url)), esc_html($c->name));
47
  }
48
  $terms_album = join(', ', $terms_album);
49
  } else {
50
+ $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('album__in' => 0), $gmedia_url)), '&#8212;');
51
  }
52
  echo $terms_album;
53
  ?>
56
  if($item->categories) {
57
  $terms_category = array();
58
  foreach($item->categories as $c) {
59
+ $terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('category__in' => $c->term_id), $gmedia_url)), esc_html($c->name));
60
  }
61
  $terms_category = join(', ', $terms_category);
62
  } else {
63
+ $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('category__in' => 0), $gmedia_url)), __('Uncategorized', 'grand-media'));
64
  }
65
  echo $terms_category;
66
  ?>
69
  if($item->tags) {
70
  $terms_tag = array();
71
  foreach($item->tags as $c) {
72
+ $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag__in' => $c->term_id), $gmedia_url)), esc_html($c->name));
73
  }
74
  $terms_tag = join(', ', $terms_tag);
75
  } else {
admin/pages/library/tpl/no-items.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  // don't load directly
3
- if(!defined('ABSPATH')) {
4
  die('-1');
5
  }
6
  global $gmCore, $gmProcessor;
@@ -11,9 +11,15 @@ global $gmCore, $gmProcessor;
11
  echo '<h4>' . __('No duplicates in Gmedia Library.', 'grand-media') . '</h4>';
12
  } else{
13
  echo '<h4>' . __('No items to show.', 'grand-media') . '</h4>';
14
- if(gm_user_can('upload') && !$gmProcessor->gmediablank) { ?>
 
 
 
 
 
 
15
  <p>
16
- <a href="<?php echo add_query_arg(array('page' => 'GrandMedia_AddMedia'), $gmProcessor->url); ?>" class="btn btn-success">
17
  <span class="glyphicon glyphicon-plus"></span> <?php _e('Add Media', 'grand-media'); ?>
18
  </a>
19
  </p>
1
  <?php
2
  // don't load directly
3
+ if(!defined('ABSPATH')){
4
  die('-1');
5
  }
6
  global $gmCore, $gmProcessor;
11
  echo '<h4>' . __('No duplicates in Gmedia Library.', 'grand-media') . '</h4>';
12
  } else{
13
  echo '<h4>' . __('No items to show.', 'grand-media') . '</h4>';
14
+ if(gm_user_can('upload') && !$gmProcessor->gmediablank){
15
+ $args = array('page' => 'GrandMedia_AddMedia');
16
+ if($gmProcessor->edit_term){
17
+ $taxterm = $gmProcessor->taxterm;
18
+ $args[ $taxterm ] = $gmProcessor->edit_term;
19
+ }
20
+ ?>
21
  <p>
22
+ <a href="<?php echo gm_get_admin_url($args, array(), true); ?>" class="btn btn-success">
23
  <span class="glyphicon glyphicon-plus"></span> <?php _e('Add Media', 'grand-media'); ?>
24
  </a>
25
  </p>
admin/pages/library/tpl/panel-heading.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  // don't load directly
3
- if(!defined('ABSPATH')) {
4
  die('-1');
5
  }
6
 
@@ -20,15 +20,17 @@ if(!defined('ABSPATH')) {
20
  <a title="<?php _e('More Screen Settings', 'grand-media'); ?>" class="show-settings-link pull-right btn btn-default btn-xs"><span class="glyphicon glyphicon-cog"></span></a>
21
  <?php } ?>
22
 
23
- <?php if(!($gmProcessor->mode == 'edit')) {
24
- $view = $gmProcessor->gmediablank? '_frame' : '';
25
- $display_mode_gmedia = $gmedia_user_options["display_mode_gmedia{$view}"];
26
- ?>
27
- <div class="btn-group pull-right">
28
- <a title="<?php _e('Show as Grid', 'grand-media'); ?>" href="<?php echo gm_get_admin_url(array('display_mode' => 'grid')); ?>" class="btn btn<?php echo ($display_mode_gmedia == 'grid')? '-primary active' : '-default'; ?> btn-xs"><span class="glyphicon glyphicon-th"></span></a>
29
- <a title="<?php _e('Show as List', 'grand-media'); ?>" href="<?php echo gm_get_admin_url(array('display_mode' => 'list')); ?>" class="btn btn<?php echo ($display_mode_gmedia == 'list')? '-primary active' : '-default'; ?> btn-xs"><span class="glyphicon glyphicon-th-list"></span></a>
30
- </div>
31
- <?php if($display_mode_gmedia == 'grid') { ?>
 
 
32
  <a title="<?php _e('Thumbnails Fit/Fill Cell', 'grand-media'); ?>" href="<?php echo gm_get_admin_url(array('grid_cell_fit' => 'toggle')); ?>" class="fit-thumbs pull-right btn btn<?php echo ($gmedia_user_options["grid_cell_fit_gmedia{$view}"] == 'true')? '-success active' : '-default'; ?> btn-xs"><span class="glyphicon glyphicon-eye-open"></span></a>
33
  <?php } ?>
34
  <?php } ?>
@@ -41,28 +43,36 @@ if(!defined('ABSPATH')) {
41
 
42
  </div>
43
  <div class="btn-toolbar pull-left" style="margin-bottom:7px;">
44
- <div class="btn-group gm-checkgroup" id="cb_global-btn">
45
- <span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="cb_media-object" type="checkbox"/></span>
46
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
47
- <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
48
- <ul class="dropdown-menu" role="menu">
49
- <li><a data-select="total" href="#"><?php _e('All', 'grand-media'); ?></a></li>
50
- <li><a data-select="none" href="#"><?php _e('None', 'grand-media'); ?></a></li>
51
- <li class="divider"></li>
52
- <li><a data-select="image" href="#"><?php _e('Images', 'grand-media'); ?></a></li>
53
- <li><a data-select="audio" href="#"><?php _e('Audio', 'grand-media'); ?></a></li>
54
- <li><a data-select="video" href="#"><?php _e('Video', 'grand-media'); ?></a></li>
55
- <li class="divider"></li>
56
- <li><a data-select="reverse" href="#" title="<?php _e('Reverse only visible items', 'grand-media'); ?>"><?php _e('Reverse', 'grand-media'); ?></a></li>
57
- </ul>
58
- </div>
 
 
59
 
60
  <div class="btn-group">
61
  <?php // todo: !!!!!
62
- $curr_mime = explode(',', $gmCore->_get('mime_type', 'total')); ?>
63
- <?php if($gmDB->filter) { ?>
 
 
 
 
 
 
64
  <a class="btn btn-warning" title="<?php _e('Reset Filter', 'grand-media'); ?>" rel="total" href="<?php echo gm_get_admin_url(array(), array(), $gmedia_url); ?>"><?php _e('Reset Filter', 'grand-media'); ?></a>
65
- <?php } else { ?>
66
  <button type="button" class="btn btn-default" data-toggle="dropdown"><?php _e('Filter', 'grand-media'); ?></button>
67
  <?php } ?>
68
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@@ -70,7 +80,7 @@ if(!defined('ABSPATH')) {
70
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
71
  </button>
72
  <ul class="dropdown-menu" role="menu">
73
- <?php if(gm_user_can('show_others_media')) { ?>
74
  <li role="presentation" class="dropdown-header"><?php _e('FILTER BY AUTHOR', 'grand-media'); ?></li>
75
  <li class="gmedia_author">
76
  <a href="#libModal" data-modal="filter_author" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Choose authors', 'grand-media'); ?></a>
@@ -78,155 +88,170 @@ if(!defined('ABSPATH')) {
78
  <?php } ?>
79
 
80
  <?php
81
- $gm_qty_badge = array(
82
- 'total' => '',
83
- 'image' => '',
84
- 'audio' => '',
85
- 'video' => '',
86
- 'text' => '',
87
- 'application' => '',
88
- 'other' => ''
89
  );
90
 
91
- foreach($gmedia_count as $key => $value) {
92
- $gm_qty_badge[$key] = '<span class="badge pull-right">' . (int)$value . '</span>';
93
  }
94
  ?>
95
  <li role="presentation" class="dropdown-header"><?php _e('TYPE', 'grand-media'); ?></li>
96
  <li class="total<?php echo in_array('total', $curr_mime)? ' active' : ''; ?>"><a rel="total" href="<?php echo gm_get_admin_url(array(), array('mime_type', 'pager')); ?>"><?php echo $gm_qty_badge['total'] . __('All', 'grand-media'); ?></a></li>
97
- <li class="image<?php echo (in_array('image', $curr_mime)? ' active' : '') . ($gmedia_count['image']? '' : ' disabled'); ?>"><a rel="image" href="<?php echo gm_get_admin_url(array('mime_type' => 'image'), array('pager')); ?>"><?php echo $gm_qty_badge['image'] . __('Images', 'grand-media'); ?></a></li>
98
- <li class="audio<?php echo (in_array('audio', $curr_mime)? ' active' : '') . ($gmedia_count['audio']? '' : ' disabled'); ?>"><a rel="audio" href="<?php echo gm_get_admin_url(array('mime_type' => 'audio'), array('pager')); ?>"><?php echo $gm_qty_badge['audio'] . __('Audio', 'grand-media'); ?></a></li>
99
- <li class="video<?php echo (in_array('video', $curr_mime)? ' active' : '') . ($gmedia_count['video']? '' : ' disabled'); ?>"><a rel="video" href="<?php echo gm_get_admin_url(array('mime_type' => 'video'), array('pager')); ?>"><?php echo $gm_qty_badge['video'] . __('Video', 'grand-media'); ?></a></li>
100
- <li class="application<?php echo ((in_array('application', $curr_mime) || in_array('text', $curr_mime))? ' active' : '') . ($gmedia_count['other']? '' : ' disabled'); ?>"><a rel="application" href="<?php echo gm_get_admin_url(array('mime_type' => 'application,text'), array('pager')); ?>"><?php echo $gm_qty_badge['other'] . __('Other', 'grand-media'); ?></a></li>
 
 
 
101
 
102
  <li role="presentation" class="dropdown-header"><?php _e('COLLECTIONS', 'grand-media'); ?></li>
103
- <li class="filter_categories<?php echo isset($gmDB->filter_tax['gmedia_category'])? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_categories" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Categories', 'grand-media'); ?></a></li>
104
- <li class="filter_albums<?php echo isset($gmDB->filter_tax['gmedia_album'])? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_albums" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Albums', 'grand-media'); ?></a></li>
105
- <li class="filter_tags<?php echo isset($gmDB->filter_tax['gmedia_tag'])? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Tags', 'grand-media'); ?></a></li>
 
 
106
  <?php do_action('gmedia_filter_list'); ?>
107
  </ul>
108
  </div>
109
 
110
- <div class="btn-group">
111
- <?php if(!($gmProcessor->mode == 'edit')) {
112
- $action_args = array('mode' => 'edit');
113
- $edit_mode_href = gm_get_admin_url($action_args);
114
- $action_args2 = array('mode' => 'edit', 'filter' => 'selected', 'pager' => false, 's' => false);
115
- $edit_mode_data = 'data-href="' . $edit_mode_href . '" data-href_sel="' . gm_get_admin_url($action_args2) . '"';
116
- } else {
117
- $edit_mode_href = gm_get_admin_url(array(), array('mode'));
118
- $edit_mode_data = '';
119
- } ?>
120
- <?php if(gm_user_can('edit_media')) { ?>
121
- <a class="btn btn-default edit-mode-link" title="<?php _e('Toggle Edit Mode', 'grand-media'); ?>" href="<?php echo $edit_mode_href; ?>" <?php echo $edit_mode_data; ?>><?php _e('Action', 'grand-media'); ?></a>
122
- <?php } else { ?>
123
- <button type="button" class="btn btn-default"><?php _e('Action', 'grand-media'); ?></button>
124
- <?php } ?>
125
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
126
- <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
127
- <?php
128
- $rel_selected_show = 'rel-selected-show';
129
- $rel_selected_hide = 'rel-selected-hide';
130
- ?>
131
- <ul class="dropdown-menu" role="menu">
132
- <?php if(!($gmProcessor->mode == 'edit')) { ?>
133
- <li class="<?php echo gm_user_can('edit_media')? '' : 'disabled'; ?>">
134
- <a class="edit-mode-link" href="<?php echo $edit_mode_href; ?>" <?php echo $edit_mode_data; ?>><?php _e('Enter Edit Mode', 'grand-media'); ?></a>
135
- </li>
136
- <?php } else { ?>
137
- <li><a href="<?php echo $edit_mode_href; ?>"><?php _e('Exit Edit Mode', 'grand-media'); ?></a></li>
138
  <?php } ?>
139
- <li class="<?php echo $rel_selected_show . (gm_user_can('edit_media')? '' : ' disabled'); ?>">
140
- <a href="#libModal" data-modal="batch_edit" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Batch Edit', 'grand-media'); ?></a></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
- <li class="divider <?php echo $rel_selected_show; ?>"></li>
143
- <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
144
- <a href="#libModal" data-modal="assign_album" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Move to Album...', 'grand-media'); ?></a>
145
- </li>
146
- <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
147
- <a href="#libModal" data-modal="assign_category" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Assign Categories...', 'grand-media'); ?></a>
148
- </li>
149
- <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
150
- <a href="#libModal" data-modal="unassign_category" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Unassign Categories...', 'grand-media'); ?></a>
151
- </li>
152
- <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
153
- <a href="#libModal" data-modal="add_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Add Tags...', 'grand-media'); ?></a></li>
154
- <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
155
- <a href="#libModal" data-modal="delete_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Delete Tags...', 'grand-media'); ?></a>
156
- </li>
157
- <li class="<?php echo $rel_selected_show . (gm_user_can('delete_media')? '' : ' disabled'); ?>">
158
- <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete') ?>" class="gmedia-delete" data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Delete Selected Items', 'grand-media'); ?></a>
159
- </li>
 
 
 
 
 
160
 
161
- <li class="divider <?php echo $rel_selected_show; ?>"></li>
162
- <li class="<?php echo $rel_selected_show . (gm_user_can('edit_media')? '' : ' disabled'); ?>">
163
- <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('recreate' => 'selected'), array()), 'gmedia_recreate') ?>" class="gmedia-update"><?php _e('Re-create Images (heavy process)', 'grand-media'); ?></a>
164
- </li>
165
- <li class="<?php echo $rel_selected_show . (gm_user_can('edit_media')? '' : ' disabled'); ?>">
166
- <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('update_meta' => 'selected'), array()), 'gmedia_update_meta') ?>" class="gmedia-update"><?php _e('Update Metadata in Database', 'grand-media'); ?></a>
167
- </li>
 
168
 
169
- <li class="divider"></li>
170
- <li class="">
171
- <a href="<?php echo gm_get_admin_url(array('gmedia__in' => 'duplicates'), array()); ?>"><?php _e('Show Duplicates in Library', 'grand-media'); ?></a>
172
- </li>
 
173
 
174
- <li class="divider <?php echo $rel_selected_hide; ?>"></li>
175
- <li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php _e("Select items to see more actions", "grand-media"); ?></span></li>
176
- <?php do_action('gmedia_action_list'); ?>
177
 
178
- </ul>
179
- </div>
 
 
 
180
 
181
  <?php
182
  $filter_stack = $gmCore->_req('stack');
183
  $filter_stack_arg = $filter_stack? false : 'show';
184
 
185
- $filter_selected = $gmCore->_req('filter');
186
  $filter_selected_arg = $filter_selected? false : 'selected';
187
  ?>
188
  <form class="btn-group" id="gm-stack-btn" name="gm-stack-form" action="<?php echo gm_get_admin_url(array('stack' => $filter_stack_arg, 'filter' => $filter_selected), array(), $gmedia_url); ?>" method="post">
189
  <button type="submit" class="btn btn<?php echo ('show' == $filter_stack)? '-success' : '-info' ?>"><?php printf(__('%s in Stack', 'grand-media'), '<span id="gm-stack-qty">' . count($gmProcessor->stack_items) . '</span>'); ?></button>
190
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
191
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
192
- <input type="hidden" id="gm-stack" data-userid="<?php echo $user_ID; ?>" data-key="library_stack" name="stack_items" value="<?php echo implode(',', $gmProcessor->stack_items); ?>"/>
193
  <ul class="dropdown-menu" role="menu">
194
  <li><a id="gm-stack-show" href="#show"><?php
195
- if(!$filter_stack) {
196
  _e('Show Stack', 'grand-media');
197
- } else {
198
  _e('Show Library', 'grand-media');
199
  }
200
  ?></a></li>
201
  <li><a id="gm-stack-clear" href="#clear"><?php _e('Clear Stack', 'grand-media'); ?></a></li>
202
  <li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
203
- <a href="#libModal" data-modal="quick_gallery_stack" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Quick Gallery from Stack', 'grand-media'); ?></a>
204
- </li>
205
- </ul>
206
- </form>
207
-
208
- <form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo gm_get_admin_url(array('stack' => $filter_stack, 'filter' => $filter_selected_arg), array(), $gmedia_url); ?>" method="post">
209
- <button type="submit" class="btn btn<?php echo ('selected' == $filter_selected)? '-success' : '-info' ?>"><?php printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
210
- <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
211
- <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
212
- <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="library" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
213
- <ul class="dropdown-menu" role="menu">
214
- <li><a id="gm-selected-show" href="#show"><?php
215
- if(!$filter_selected) {
216
- _e('Show only selected items', 'grand-media');
217
- } else {
218
- _e('Show all gmedia items', 'grand-media');
219
- }
220
- ?></a></li>
221
- <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'grand-media'); ?></a></li>
222
- <li><a id="gm-stack-in" href="#stack_add"><?php _e('Add selected items to Stack', 'grand-media'); ?></a></li>
223
- <li><a id="gm-stack-out" href="#stack_remove"><?php _e('Remove selected items from Stack', 'grand-media'); ?></a></li>
224
- <li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
225
- <a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Quick Gallery from Selected', 'grand-media'); ?></a>
226
  </li>
227
  </ul>
228
  </form>
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  </div>
231
 
232
  </div>
1
  <?php
2
  // don't load directly
3
+ if(!defined('ABSPATH')){
4
  die('-1');
5
  }
6
 
20
  <a title="<?php _e('More Screen Settings', 'grand-media'); ?>" class="show-settings-link pull-right btn btn-default btn-xs"><span class="glyphicon glyphicon-cog"></span></a>
21
  <?php } ?>
22
 
23
+ <?php if($gmProcessor->mode != 'edit'){
24
+ $view = $gmProcessor->gmediablank? '_frame' : '';
25
+ $display_mode_gmedia = $gmProcessor->display_mode;
26
+ if(!$gmProcessor->edit_term && !in_array($gmProcessor->mode, array('select_single', 'select_mutiple'))){ ?>
27
+ <div class="btn-group pull-right">
28
+ <a title="<?php _e('Show as Grid', 'grand-media'); ?>" href="<?php echo gm_get_admin_url(array('display_mode' => 'grid')); ?>" class="btn btn<?php echo ($display_mode_gmedia == 'grid')? '-primary active' : '-default'; ?> btn-xs"><span class="glyphicon glyphicon-th"></span></a>
29
+ <a title="<?php _e('Show as List', 'grand-media'); ?>" href="<?php echo gm_get_admin_url(array('display_mode' => 'list')); ?>" class="btn btn<?php echo ($display_mode_gmedia == 'list')? '-primary active' : '-default'; ?> btn-xs"><span class="glyphicon glyphicon-th-list"></span></a>
30
+ </div>
31
+ <?php
32
+ }
33
+ if($display_mode_gmedia == 'grid'){ ?>
34
  <a title="<?php _e('Thumbnails Fit/Fill Cell', 'grand-media'); ?>" href="<?php echo gm_get_admin_url(array('grid_cell_fit' => 'toggle')); ?>" class="fit-thumbs pull-right btn btn<?php echo ($gmedia_user_options["grid_cell_fit_gmedia{$view}"] == 'true')? '-success active' : '-default'; ?> btn-xs"><span class="glyphicon glyphicon-eye-open"></span></a>
35
  <?php } ?>
36
  <?php } ?>
43
 
44
  </div>
45
  <div class="btn-toolbar pull-left" style="margin-bottom:7px;">
46
+ <?php if($gmProcessor->mode != 'select_single'){ ?>
47
+ <div class="btn-group gm-checkgroup" id="cb_global-btn">
48
+ <span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="gm-item-check" type="checkbox"/></span>
49
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
50
+ <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
51
+ <ul class="dropdown-menu" role="menu">
52
+ <li><a data-select="total" href="#"><?php _e('All', 'grand-media'); ?></a></li>
53
+ <li><a data-select="none" href="#"><?php _e('None', 'grand-media'); ?></a></li>
54
+ <li class="divider"></li>
55
+ <li><a data-select="image" href="#"><?php _e('Images', 'grand-media'); ?></a></li>
56
+ <li><a data-select="audio" href="#"><?php _e('Audio', 'grand-media'); ?></a></li>
57
+ <li><a data-select="video" href="#"><?php _e('Video', 'grand-media'); ?></a></li>
58
+ <li class="divider"></li>
59
+ <li><a data-select="reverse" href="#" title="<?php _e('Reverse only visible items', 'grand-media'); ?>"><?php _e('Reverse', 'grand-media'); ?></a></li>
60
+ </ul>
61
+ </div>
62
+ <?php } ?>
63
 
64
  <div class="btn-group">
65
  <?php // todo: !!!!!
66
+ $curr_mime = explode(',', $gmCore->_get('mime_type', 'total'));
67
+ if(('show' == $gmCore->_get('stack') || 'selected' == $gmCore->_get('filter')) && isset($gmedia_filter['gmedia__in'])){
68
+ if($gmProcessor->selected_items == $gmedia_filter['gmedia__in'] || $gmProcessor->stack_items == $gmedia_filter['gmedia__in']){
69
+ unset($gmedia_filter['gmedia__in']);
70
+ }
71
+ }
72
+ ?>
73
+ <?php if(!empty($gmedia_filter)){ ?>
74
  <a class="btn btn-warning" title="<?php _e('Reset Filter', 'grand-media'); ?>" rel="total" href="<?php echo gm_get_admin_url(array(), array(), $gmedia_url); ?>"><?php _e('Reset Filter', 'grand-media'); ?></a>
75
+ <?php } else{ ?>
76
  <button type="button" class="btn btn-default" data-toggle="dropdown"><?php _e('Filter', 'grand-media'); ?></button>
77
  <?php } ?>
78
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
80
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
81
  </button>
82
  <ul class="dropdown-menu" role="menu">
83
+ <?php if(gm_user_can('show_others_media')){ ?>
84
  <li role="presentation" class="dropdown-header"><?php _e('FILTER BY AUTHOR', 'grand-media'); ?></li>
85
  <li class="gmedia_author">
86
  <a href="#libModal" data-modal="filter_author" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Choose authors', 'grand-media'); ?></a>
88
  <?php } ?>
89
 
90
  <?php
91
+
92
+ $gm_qty_badge = array('total' => '',
93
+ 'image' => '',
94
+ 'audio' => '',
95
+ 'video' => '',
96
+ 'text' => '',
97
+ 'application' => '',
98
+ 'other' => ''
99
  );
100
 
101
+ foreach($gmedia_count as $key => $value){
102
+ $gm_qty_badge[ $key ] = '<span class="badge pull-right">' . (int)$value . '</span>';
103
  }
104
  ?>
105
  <li role="presentation" class="dropdown-header"><?php _e('TYPE', 'grand-media'); ?></li>
106
  <li class="total<?php echo in_array('total', $curr_mime)? ' active' : ''; ?>"><a rel="total" href="<?php echo gm_get_admin_url(array(), array('mime_type', 'pager')); ?>"><?php echo $gm_qty_badge['total'] . __('All', 'grand-media'); ?></a></li>
107
+ <?php if($gmProcessor->mode != 'select_single'){ ?>
108
+ <li class="image<?php echo (in_array('image', $curr_mime)? ' active' : '') . ($gmedia_count['image']? '' : ' disabled'); ?>"><a rel="image" href="<?php echo gm_get_admin_url(array('mime_type' => 'image'), array('pager')); ?>"><?php echo $gm_qty_badge['image'] . __('Images', 'grand-media'); ?></a></li>
109
+ <li class="audio<?php echo (in_array('audio', $curr_mime)? ' active' : '') . ($gmedia_count['audio']? '' : ' disabled'); ?>"><a rel="audio" href="<?php echo gm_get_admin_url(array('mime_type' => 'audio'), array('pager')); ?>"><?php echo $gm_qty_badge['audio'] . __('Audio', 'grand-media'); ?></a></li>
110
+ <li class="video<?php echo (in_array('video', $curr_mime)? ' active' : '') . ($gmedia_count['video']? '' : ' disabled'); ?>"><a rel="video" href="<?php echo gm_get_admin_url(array('mime_type' => 'video'), array('pager')); ?>"><?php echo $gm_qty_badge['video'] . __('Video', 'grand-media'); ?></a></li>
111
+ <li class="application<?php echo ((in_array('application', $curr_mime) || in_array('text', $curr_mime))? ' active' : '') . ($gmedia_count['other']? '' : ' disabled'); ?>">
112
+ <a rel="application" href="<?php echo gm_get_admin_url(array('mime_type' => 'application,text'), array('pager')); ?>"><?php echo $gm_qty_badge['other'] . __('Other', 'grand-media'); ?></a></li>
113
+ <?php } ?>
114
 
115
  <li role="presentation" class="dropdown-header"><?php _e('COLLECTIONS', 'grand-media'); ?></li>
116
+ <li class="filter_categories<?php echo isset($gmedia_filter['category__in'])? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_categories" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Categories', 'grand-media'); ?></a></li>
117
+ <?php if(!($gmProcessor->edit_term && 'album' === $gmProcessor->taxterm)){ ?>
118
+ <li class="filter_albums<?php echo isset($gmedia_filter['album__in'])? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_albums" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Albums', 'grand-media'); ?></a></li>
119
+ <?php } ?>
120
+ <li class="filter_tags<?php echo isset($gmedia_filter['tag__in'])? ' active' : ''; ?>"><a href="#libModal" data-modal="filter_tags" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Tags', 'grand-media'); ?></a></li>
121
  <?php do_action('gmedia_filter_list'); ?>
122
  </ul>
123
  </div>
124
 
125
+ <?php if(!in_array($gmProcessor->mode, array('select_single', 'select_mutiple'))){ ?>
126
+ <div class="btn-group">
127
+ <?php if($gmProcessor->mode != 'edit'){
128
+ $edit_mode_href = gm_get_admin_url(array('mode' => 'edit'));
129
+ } else{
130
+ $edit_mode_href = gm_get_admin_url(array(), array('mode'));
131
+ } ?>
132
+ <?php if(gm_user_can('edit_media')){ ?>
133
+ <a class="btn btn-default edit-mode-link" title="<?php _e('Toggle Edit Mode', 'grand-media'); ?>" href="<?php echo $edit_mode_href; ?>"><?php _e('Action', 'grand-media'); ?></a>
134
+ <?php } else{ ?>
135
+ <button type="button" class="btn btn-default"><?php _e('Action', 'grand-media'); ?></button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  <?php } ?>
137
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
138
+ <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
139
+ <?php
140
+ $rel_selected_show = 'rel-selected-show';
141
+ $rel_selected_hide = 'rel-selected-hide';
142
+ ?>
143
+ <ul class="dropdown-menu" role="menu">
144
+ <?php if(!($gmProcessor->mode == 'edit')){ ?>
145
+ <li class="<?php echo gm_user_can('edit_media')? '' : 'disabled'; ?>">
146
+ <a class="edit-mode-link" href="<?php echo $edit_mode_href; ?>"><?php _e('Enter Edit Mode', 'grand-media'); ?></a>
147
+ </li>
148
+ <?php } else{ ?>
149
+ <li><a href="<?php echo $edit_mode_href; ?>"><?php _e('Exit Edit Mode', 'grand-media'); ?></a></li>
150
+ <?php } ?>
151
+ <li class="<?php echo $rel_selected_show . (gm_user_can('edit_media')? '' : ' disabled'); ?>">
152
+ <a href="#libModal" data-modal="batch_edit" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Batch Edit', 'grand-media'); ?></a></li>
153
 
154
+ <li class="divider <?php echo $rel_selected_show; ?>"></li>
155
+ <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
156
+ <a href="#libModal" data-modal="assign_album" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Move to Album...', 'grand-media'); ?></a>
157
+ </li>
158
+ <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
159
+ <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'unassign_album')), 'gmedia_action') ?>" data-confirm="<?php _e("You are about to remove the selected items from assigned albums.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Remove from Album', 'grand-media'); ?></a>
160
+ </li>
161
+ <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
162
+ <a href="#libModal" data-modal="assign_category" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Assign Categories...', 'grand-media'); ?></a>
163
+ </li>
164
+ <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
165
+ <a href="#libModal" data-modal="unassign_category" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Unassign Categories...', 'grand-media'); ?></a>
166
+ </li>
167
+ <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
168
+ <a href="#libModal" data-modal="add_tags" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Add Tags...', 'grand-media'); ?></a></li>
169
+ <li class="<?php echo $rel_selected_show . (gm_user_can('terms')? '' : ' disabled'); ?>">
170
+ <a href="#libModal" data-modal="delete_tags" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Delete Tags...', 'grand-media'); ?></a>
171
+ </li>
172
+ <li class="<?php echo $rel_selected_show . (gm_user_can('delete_media')? '' : ' disabled'); ?>">
173
+ <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'delete',
174
+ 'ids' => 'selected'
175
+ ), array('filter')), 'gmedia_delete') ?>" class="gmedia-delete" data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Delete Selected Items', 'grand-media'); ?></a>
176
+ </li>
177
 
178
+ <?php if(!$gmProcessor->gmediablank){ ?>
179
+ <li class="divider <?php echo $rel_selected_show; ?>"></li>
180
+ <li class="<?php echo $rel_selected_show . (gm_user_can('edit_media')? '' : ' disabled'); ?>">
181
+ <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'recreate'), array()), 'gmedia_action') ?>" class="gmedia-update"><?php _e('Re-create Images (heavy process)', 'grand-media'); ?></a>
182
+ </li>
183
+ <li class="<?php echo $rel_selected_show . (gm_user_can('edit_media')? '' : ' disabled'); ?>">
184
+ <a href="<?php echo wp_nonce_url(gm_get_admin_url(array('do_gmedia' => 'update_meta'), array()), 'gmedia_action') ?>" class="gmedia-update"><?php _e('Update Metadata in Database', 'grand-media'); ?></a>
185
+ </li>
186
 
187
+ <li class="divider"></li>
188
+ <li>
189
+ <a href="<?php echo gm_get_admin_url(array('page' => 'GrandMedia', 'gmedia__in' => 'duplicates'), array(), true); ?>"><?php _e('Show Duplicates in Library', 'grand-media'); ?></a>
190
+ </li>
191
+ <?php } ?>
192
 
193
+ <li class="divider <?php echo $rel_selected_hide; ?>"></li>
194
+ <li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php _e("Select items to see more actions", "grand-media"); ?></span></li>
195
+ <?php do_action('gmedia_action_list'); ?>
196
 
197
+ </ul>
198
+ </div>
199
+ <?php }
200
+ do_action('gmedia_library_btn_toolbar');
201
+ ?>
202
 
203
  <?php
204
  $filter_stack = $gmCore->_req('stack');
205
  $filter_stack_arg = $filter_stack? false : 'show';
206
 
207
+ $filter_selected = ('selected' == $gmCore->_req('filter'));
208
  $filter_selected_arg = $filter_selected? false : 'selected';
209
  ?>
210
  <form class="btn-group" id="gm-stack-btn" name="gm-stack-form" action="<?php echo gm_get_admin_url(array('stack' => $filter_stack_arg, 'filter' => $filter_selected), array(), $gmedia_url); ?>" method="post">
211
  <button type="submit" class="btn btn<?php echo ('show' == $filter_stack)? '-success' : '-info' ?>"><?php printf(__('%s in Stack', 'grand-media'), '<span id="gm-stack-qty">' . count($gmProcessor->stack_items) . '</span>'); ?></button>
212
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
213
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
214
+ <input type="hidden" id="gm-stack" data-userid="<?php echo $user_ID; ?>" data-key="gmedia_<?php echo $user_ID; ?>_libstack" name="stack_items" value="<?php echo implode(',', $gmProcessor->stack_items); ?>"/>
215
  <ul class="dropdown-menu" role="menu">
216
  <li><a id="gm-stack-show" href="#show"><?php
217
+ if(!$filter_stack){
218
  _e('Show Stack', 'grand-media');
219
+ } else{
220
  _e('Show Library', 'grand-media');
221
  }
222
  ?></a></li>
223
  <li><a id="gm-stack-clear" href="#clear"><?php _e('Clear Stack', 'grand-media'); ?></a></li>
224
  <li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
225
+ <a href="#libModal" data-modal="quick_gallery_stack" data-action="gmedia_get_modal" data-ckey="gmedia_<?php echo $user_ID; ?>_libstack" class="gmedia-modal"><?php _e('Quick Gallery from Stack', 'grand-media'); ?></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  </li>
227
  </ul>
228
  </form>
229
 
230
+ <?php if($gmProcessor->mode != 'select_single'){ ?>
231
+ <form class="btn-group<?php echo $filter_selected? ' gm-active' : ''; ?>" id="gm-selected-btn" name="gm-selected-form" action="<?php echo gm_get_admin_url(array('stack' => $filter_stack, 'filter' => $filter_selected_arg), array(), $gmedia_url); ?>" method="post">
232
+ <button type="submit" class="btn btn<?php echo ('selected' == $filter_selected)? '-success' : '-info' ?>"><?php printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
233
+ <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
234
+ <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
235
+ <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="<?php echo GmediaProcessor_Library::$cookie_key; ?>" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
236
+ <ul class="dropdown-menu" role="menu">
237
+ <li><a id="gm-selected-show" href="#show"><?php
238
+ if(!$filter_selected){
239
+ _e('Show only selected items', 'grand-media');
240
+ } else{
241
+ _e('Show all gmedia items', 'grand-media');
242
+ }
243
+ ?></a></li>
244
+ <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'grand-media'); ?></a></li>
245
+ <li><a id="gm-stack-in" href="#stack_add"><?php _e('Add selected items to Stack', 'grand-media'); ?></a></li>
246
+ <li><a id="gm-stack-out" href="#stack_remove"><?php _e('Remove selected items from Stack', 'grand-media'); ?></a></li>
247
+ <?php if($gmProcessor->mode != 'select_multiple'){ ?>
248
+ <li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
249
+ <a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Library::$cookie_key; ?>" class="gmedia-modal"><?php _e('Quick Gallery from Selected', 'grand-media'); ?></a>
250
+ </li>
251
+ <?php } ?>
252
+ </ul>
253
+ </form>
254
+ <?php } ?>
255
  </div>
256
 
257
  </div>
admin/pages/modules/edit-preset.php CHANGED
@@ -67,7 +67,7 @@ $params = array();
67
  $gallery_link_default = add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'module_preview', 'module' => $term->module['name'], 'preset' => $term->term_id, 'query' => $gmedia_filter['query_args'] ), admin_url( 'admin.php' ) );
68
 
69
  /** @noinspection PhpIncludeInspection */
70
- include_once( GMEDIA_ABSPATH . '/inc/module.options.php' );
71
 
72
  do_action( 'gmedia_module_preset_before_panel' );
73
  ?>
67
  $gallery_link_default = add_query_arg( array( 'page' => 'GrandMedia', 'gmediablank' => 'module_preview', 'module' => $term->module['name'], 'preset' => $term->term_id, 'query' => $gmedia_filter['query_args'] ), admin_url( 'admin.php' ) );
68
 
69
  /** @noinspection PhpIncludeInspection */
70
+ include_once( GMEDIA_ABSPATH . 'inc/module.options.php' );
71
 
72
  do_action( 'gmedia_module_preset_before_panel' );
73
  ?>
admin/pages/modules/modules.php CHANGED
@@ -4,71 +4,73 @@
4
  */
5
 
6
  // don't load directly
7
- if(!defined('ABSPATH')) {
8
  die('-1');
9
  }
10
 
11
  global $gmCore, $gmProcessor, $gmGallery, $gmDB;
12
 
13
  $gmedia_url = $gmProcessor->url;
14
- $modules = get_gmedia_modules();
15
 
16
- if(isset($modules['error'])) {
17
  echo $gmCore->alert('danger', $modules['error']);
18
  }
19
 
20
  ?>
21
  <div id="gmedia_modules">
22
- <div class="panel panel-default">
23
- <div class="panel-heading clearfix">
24
- <a href="#installModuleModal" class="btn btn-primary pull-right<?php echo current_user_can('manage_options')? '' : ' disabled'; ?>" data-toggle="modal"><?php _e('Install Module ZIP'); ?></a>
25
-
26
- <h3 class="panel-title"><?php _e('Installed Modules', 'grand-media'); ?></h3>
27
- </div>
28
- <div class="panel-body" id="gmedia-msg-panel"></div>
29
- <div class="panel-body">
30
- <?php
31
- // installed modules
32
- if(!empty($modules['in'])) {
33
- foreach($modules['in'] as $module) {
34
- $module['screenshot_url'] = $module['module_url'] . '/screenshot.png';
35
- $module['mclass'] = ' module-' . $module['type'] . ' module-' . $module['status'];
36
- if($module['update']) {
37
- $module['mclass'] .= ' module-update';
38
- }
39
-
40
- include(dirname(__FILE__) . '/tpl/module-item.php');
41
-
42
- }
43
- }
44
- ?>
45
- </div>
46
- </div>
47
-
48
- <?php if(!empty($modules['out'])) { ?>
49
  <div class="panel panel-default">
50
  <div class="panel-heading clearfix">
51
- <h3 class="panel-title"><?php _e('Not Installed Modules', 'grand-media'); ?></h3>
 
 
52
  </div>
53
  <div class="panel-body" id="gmedia-msg-panel"></div>
54
  <div class="panel-body">
55
  <?php
56
- $out_dirpath = dirname($gmGallery->options['modules_xml']);
57
- foreach($modules['out'] as $module) {
58
- $module['mclass'] = ' module-' . $module['type'] . ' module-' . $module['status'];
59
- $module['screenshot_url'] = $out_dirpath . '/' . $module['name'] . '.png';
 
 
 
 
60
 
61
- include(dirname(__FILE__) . '/tpl/module-item.php');
62
 
63
- } ?>
 
 
64
  </div>
65
  </div>
66
- <?php }
67
- wp_nonce_field('GmediaGallery');
68
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  </div>
70
 
71
- <?php if($gmCore->caps['gmedia_module_manage']) {
72
  include(dirname(__FILE__) . '/tpl/modal-modulezip.php');
73
  } ?>
74
 
4
  */
5
 
6
  // don't load directly
7
+ if(!defined('ABSPATH')){
8
  die('-1');
9
  }
10
 
11
  global $gmCore, $gmProcessor, $gmGallery, $gmDB;
12
 
13
  $gmedia_url = $gmProcessor->url;
14
+ $modules = $gmProcessor->modules;
15
 
16
+ if(isset($modules['error'])){
17
  echo $gmCore->alert('danger', $modules['error']);
18
  }
19
 
20
  ?>
21
  <div id="gmedia_modules">
22
+ <div id="gmedia_modules_wrapper" data-update="<?php echo $gmGallery->options['modules_update'] ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  <div class="panel panel-default">
24
  <div class="panel-heading clearfix">
25
+ <a href="#installModuleModal" class="btn btn-primary pull-right<?php echo current_user_can('manage_options')? '' : ' disabled'; ?>" data-toggle="modal"><?php _e('Install Module ZIP'); ?></a>
26
+
27
+ <h3 class="panel-title"><?php _e('Installed Modules', 'grand-media'); ?></h3>
28
  </div>
29
  <div class="panel-body" id="gmedia-msg-panel"></div>
30
  <div class="panel-body">
31
  <?php
32
+ // installed modules
33
+ if(!empty($modules['in'])){
34
+ foreach($modules['in'] as $module){
35
+ $module['screenshot_url'] = $module['module_url'] . '/screenshot.png';
36
+ $module['mclass'] = ' module-' . $module['type'] . ' module-' . $module['status'];
37
+ if($module['update']){
38
+ $module['mclass'] .= ' module-update';
39
+ }
40
 
41
+ include(dirname(__FILE__) . '/tpl/module-item.php');
42
 
43
+ }
44
+ }
45
+ ?>
46
  </div>
47
  </div>
48
+
49
+ <?php if(!empty($modules['out'])){ ?>
50
+ <div class="panel panel-default">
51
+ <div class="panel-heading clearfix">
52
+ <h3 class="panel-title"><?php _e('Not Installed Modules', 'grand-media'); ?></h3>
53
+ </div>
54
+ <div class="panel-body" id="gmedia-msg-panel"></div>
55
+ <div class="panel-body">
56
+ <?php
57
+ $out_dirpath = dirname($gmGallery->options['modules_xml']);
58
+ foreach($modules['out'] as $module){
59
+ $module['mclass'] = ' module-' . $module['type'] . ' module-' . $module['status'];
60
+ $module['screenshot_url'] = $out_dirpath . '/' . $module['name'] . '.png';
61
+
62
+ include(dirname(__FILE__) . '/tpl/module-item.php');
63
+
64
+ } ?>
65
+ </div>
66
+ </div>
67
+ <?php }
68
+ wp_nonce_field('GmediaGallery');
69
+ ?>
70
+ </div>
71
  </div>
72
 
73
+ <?php if($gmCore->caps['gmedia_module_manage']){
74
  include(dirname(__FILE__) . '/tpl/modal-modulezip.php');
75
  } ?>
76
 
admin/pages/modules/tpl/module-item.php CHANGED
@@ -14,7 +14,7 @@ global $gmDB, $gmCore, $user_ID;
14
  <div class="row">
15
  <div class="col-sm-3">
16
  <div class="thumbnail">
17
- <img class="media-object" src="<?php echo $module['screenshot_url']; ?>" alt="<?php echo esc_attr($module['title']); ?>" width="320" height="240"/>
18
  </div>
19
  </div>
20
  <div class="<?php echo(($module['place'] === 'remote')? 'col-sm-9' : 'col-sm-5'); ?>">
14
  <div class="row">
15
  <div class="col-sm-3">
16
  <div class="thumbnail">
17
+ <img class="media-object" src="<?php echo $module['screenshot_url']; ?>" alt="<?php esc_attr_e($module['title']); ?>" width="320" height="240"/>
18
  </div>
19
  </div>
20
  <div class="<?php echo(($module['place'] === 'remote')? 'col-sm-9' : 'col-sm-5'); ?>">
admin/pages/modules/tpl/module-preset-edit-item.php CHANGED
@@ -37,7 +37,7 @@ global $user_ID;
37
  <input type="text" class="form-control input-sm" name="term[name]" value="<?php $is_preset === 'global'? _e('Global Settings', 'grand-media') : _e('Default Settings', 'grand-media'); ?>" readonly/>
38
  <input type="hidden" name="module_preset_save_default" value="1"/>
39
  <?php } else{ ?>
40
- <input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr($term->name); ?>" placeholder="<?php echo $term->name? esc_attr($term->name) : __('Preset Name', 'grand-media'); ?>"/>
41
  <?php } ?>
42
  </div>
43
  <div class="form-group">
@@ -55,7 +55,7 @@ global $user_ID;
55
  } ?>
56
  </div>
57
  <input type="hidden" name="term[term_id]" value="<?php echo $term_id; ?>"/>
58
- <input type="hidden" name="term[module]" value="<?php echo esc_attr($term->module['name']); ?>"/>
59
  <input type="hidden" name="term[taxonomy]" value="<?php echo $gmedia_term_taxonomy; ?>"/>
60
  <?php
61
  wp_nonce_field('GmediaGallery');
37
  <input type="text" class="form-control input-sm" name="term[name]" value="<?php $is_preset === 'global'? _e('Global Settings', 'grand-media') : _e('Default Settings', 'grand-media'); ?>" readonly/>
38
  <input type="hidden" name="module_preset_save_default" value="1"/>
39
  <?php } else{ ?>
40
+ <input type="text" class="form-control input-sm" name="term[name]" value="<?php esc_attr_e($term->name); ?>" placeholder="<?php echo $term->name? esc_attr($term->name) : __('Preset Name', 'grand-media'); ?>"/>
41
  <?php } ?>
42
  </div>
43
  <div class="form-group">
55
  } ?>
56
  </div>
57
  <input type="hidden" name="term[term_id]" value="<?php echo $term_id; ?>"/>
58
+ <input type="hidden" name="term[module]" value="<?php esc_attr_e($term->module['name']); ?>"/>
59
  <input type="hidden" name="term[taxonomy]" value="<?php echo $gmedia_term_taxonomy; ?>"/>
60
  <?php
61
  wp_nonce_field('GmediaGallery');
admin/pages/settings/tpl/common.php CHANGED
@@ -28,6 +28,7 @@ if(!defined('ABSPATH')){
28
  <option value="gmuid" <?php selected($gmGallery->options['in_tag_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
29
  <option value="date" <?php selected($gmGallery->options['in_tag_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
30
  <option value="modified" <?php selected($gmGallery->options['in_tag_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
 
31
  <option value="rand" <?php selected($gmGallery->options['in_tag_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
32
  </select>
33
  </div>
@@ -49,6 +50,7 @@ if(!defined('ABSPATH')){
49
  <option value="gmuid" <?php selected($gmGallery->options['in_category_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
50
  <option value="date" <?php selected($gmGallery->options['in_category_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
51
  <option value="modified" <?php selected($gmGallery->options['in_category_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
 
52
  <option value="rand" <?php selected($gmGallery->options['in_category_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
53
  </select>
54
  </div>
@@ -72,6 +74,7 @@ if(!defined('ABSPATH')){
72
  <option value="gmuid" <?php selected($gmGallery->options['in_album_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
73
  <option value="date" <?php selected($gmGallery->options['in_album_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
74
  <option value="modified" <?php selected($gmGallery->options['in_album_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
 
75
  <option value="rand" <?php selected($gmGallery->options['in_album_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
76
  </select>
77
  </div>
@@ -126,6 +129,14 @@ if(!defined('ABSPATH')){
126
 
127
  <p class="help-block"><?php _e('Chosen module will be used for terms pages.', 'grand-media'); ?></p>
128
  </div>
 
 
 
 
 
 
 
 
129
  <div class="form-group">
130
  <label><?php _e('Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'grand-media') ?>:</label>
131
 
28
  <option value="gmuid" <?php selected($gmGallery->options['in_tag_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
29
  <option value="date" <?php selected($gmGallery->options['in_tag_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
30
  <option value="modified" <?php selected($gmGallery->options['in_tag_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
31
+ <option value="comment_count" <?php selected($gmGallery->options['in_tag_orderby'], 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
32
  <option value="rand" <?php selected($gmGallery->options['in_tag_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
33
  </select>
34
  </div>
50
  <option value="gmuid" <?php selected($gmGallery->options['in_category_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
51
  <option value="date" <?php selected($gmGallery->options['in_category_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
52
  <option value="modified" <?php selected($gmGallery->options['in_category_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
53
+ <option value="comment_count" <?php selected($gmGallery->options['in_category_orderby'], 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
54
  <option value="rand" <?php selected($gmGallery->options['in_category_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
55
  </select>
56
  </div>
74
  <option value="gmuid" <?php selected($gmGallery->options['in_album_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
75
  <option value="date" <?php selected($gmGallery->options['in_album_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
76
  <option value="modified" <?php selected($gmGallery->options['in_album_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
77
+ <option value="comment_count" <?php selected($gmGallery->options['in_album_orderby'], 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
78
  <option value="rand" <?php selected($gmGallery->options['in_album_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
79
  </select>
80
  </div>
129
 
130
  <p class="help-block"><?php _e('Chosen module will be used for terms pages.', 'grand-media'); ?></p>
131
  </div>
132
+ <div class="form-group">
133
+ <label><?php _e('When set title from filename', 'grand-media') ?>:</label>
134
+
135
+ <div class="checkbox" style="margin:0;">
136
+ <input type="hidden" name="set[name2title_capitalize]" value="0"/>
137
+ <label><input type="checkbox" name="set[name2title_capitalize]" value="1" <?php checked($gmGallery->options['name2title_capitalize'], '1'); ?> /> <?php _e('Make the first letter of each word capitalized (Title Case)', 'grand-media'); ?> </label>
138
+ </div>
139
+ </div>
140
  <div class="form-group">
141
  <label><?php _e('Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'grand-media') ?>:</label>
142
 
admin/pages/settings/tpl/permalinks.php CHANGED
@@ -113,10 +113,10 @@ if(!defined('ABSPATH')) {
113
  </div>
114
  <div class="form-group">
115
  <label><?php _e('Additional JS code for GmediaCloud Page', 'grand-media') ?>:</label>
116
- <textarea name="set[gmediacloud_footer_js]" rows="4" cols="20" class="form-control input-sm"><?php echo esc_html(stripslashes($gmGallery->options['gmediacloud_footer_js'])); ?></textarea>
117
  </div>
118
  <div class="form-group">
119
  <label><?php _e('Additional CSS code for GmediaCloud Page', 'grand-media') ?>:</label>
120
- <textarea name="set[gmediacloud_footer_css]" rows="4" cols="20" class="form-control input-sm"><?php echo esc_html(stripslashes($gmGallery->options['gmediacloud_footer_css'])); ?></textarea>
121
  </div>
122
  </fieldset>
113
  </div>
114
  <div class="form-group">
115
  <label><?php _e('Additional JS code for GmediaCloud Page', 'grand-media') ?>:</label>
116
+ <textarea name="set[gmediacloud_footer_js]" rows="4" cols="20" class="form-control input-sm"><?php echo esc_textarea(stripslashes($gmGallery->options['gmediacloud_footer_js'])); ?></textarea>
117
  </div>
118
  <div class="form-group">
119
  <label><?php _e('Additional CSS code for GmediaCloud Page', 'grand-media') ?>:</label>
120
+ <textarea name="set[gmediacloud_footer_css]" rows="4" cols="20" class="form-control input-sm"><?php echo esc_textarea(stripslashes($gmGallery->options['gmediacloud_footer_css'])); ?></textarea>
121
  </div>
122
  </fieldset>
admin/pages/settings/tpl/roles.php CHANGED
@@ -40,7 +40,7 @@ if(!defined('ABSPATH')) {
40
  <label><?php _e('Show Others Media in Library', 'grand-media') ?>:</label>
41
  <select name="capability[gmedia_show_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_show_others_media')); ?></select>
42
 
43
- <p class="help-block"><?php _e('Who can see files uploaded by other users', 'grand-media'); ?></p>
44
  </div>
45
  <div class="form-group">
46
  <label><?php _e('Edit Media', 'grand-media') ?>:</label>
40
  <label><?php _e('Show Others Media in Library', 'grand-media') ?>:</label>
41
  <select name="capability[gmedia_show_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_show_others_media')); ?></select>
42
 
43
+ <p class="help-block"><?php _e('Who can see files uploaded by other users. Also this setting allows to see private media when user logged in.', 'grand-media'); ?></p>
44
  </div>
45
  <div class="form-group">
46
  <label><?php _e('Edit Media', 'grand-media') ?>:</label>
admin/pages/terms/edit-term.php CHANGED
@@ -10,11 +10,11 @@ if(!defined('ABSPATH')) {
10
 
11
  global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
12
 
13
- $term_id = $gmCore->_get('edit_item');
14
- $gmedia_url = add_query_arg(array('edit_item' => $term_id), $gmProcessor->url);
15
  $gmedia_user_options = $gmProcessor->user_options;
16
  $gmedia_term_taxonomy = $gmProcessor->taxonomy;
17
- $taxterm = str_replace('gmedia_', '', $gmedia_term_taxonomy);
18
 
19
  if(!gm_user_can("{$taxterm}_manage")) {
20
  die('-1');
@@ -31,7 +31,7 @@ gmedia_term_item_more_data($term);
31
  do_action('gmedia_term_before_panel');
32
  ?>
33
 
34
- <div class="panel panel-default">
35
 
36
  <?php
37
  include(dirname(__FILE__) . '/tpl/term-panel-heading.php');
10
 
11
  global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
12
 
13
+ $term_id = $gmCore->_get('edit_term');
14
+ $gmedia_url = add_query_arg(array('edit_term' => $term_id), $gmProcessor->url);
15
  $gmedia_user_options = $gmProcessor->user_options;
16
  $gmedia_term_taxonomy = $gmProcessor->taxonomy;
17
+ $taxterm = $gmProcessor->taxterm;
18
 
19
  if(!gm_user_can("{$taxterm}_manage")) {
20
  die('-1');
31
  do_action('gmedia_term_before_panel');
32
  ?>
33
 
34
+ <div class="panel panel-default panel-fixed-header">
35
 
36
  <?php
37
  include(dirname(__FILE__) . '/tpl/term-panel-heading.php');
admin/pages/terms/functions.php CHANGED
@@ -1,44 +1,47 @@
1
  <?php
2
 
3
- function gmedia_term_item_thumbnails( $term_item, $qty = 7 ) {
4
  global $gmCore, $gmDB, $gmGallery;
5
  ?>
6
  <div class="term-images">
7
  <?php
8
- if ( $term_item->count ) {
9
- $term__in = str_replace( 'gmedia_', '', $term_item->taxonomy ) . '__in';
10
- switch ( $term_item->taxonomy ) {
11
- case 'gmedia_tag':
12
- $orderby = $gmGallery->options['in_tag_orderby'];
13
- $order = $gmGallery->options['in_tag_order'];
14
  break;
15
  case 'gmedia_category':
16
  $orderby = $gmGallery->options['in_category_orderby'];
17
  $order = $gmGallery->options['in_category_order'];
18
  break;
 
 
 
 
19
  default:
20
  $orderby = 'ID';
21
  $order = 'DESC';
22
  break;
23
  }
24
- $args = array(
25
- 'no_found_rows' => true,
26
- 'per_page' => $qty,
27
- $term__in => array( $term_item->term_id ),
28
- 'author' => gm_user_can( 'show_others_media' ) ? 0 : get_current_user_id(),
29
- 'orderby' => isset( $term_item->meta['_orderby'][0] ) ? $term_item->meta['_orderby'][0] : $orderby,
30
- 'order' => isset( $term_item->meta['_order'][0] ) ? $term_item->meta['_order'][0] : $order
31
  );
32
 
33
- $gmedias = $gmDB->get_gmedias( $args );
34
- if ( ! empty( $gmedias ) ) {
35
- foreach ( $gmedias as $gmedia_item ) {
36
  ?>
37
- <img style="z-index:<?php echo $qty --; ?>;" src="<?php echo $gmCore->gm_get_media_image( $gmedia_item, 'thumb', false ); ?>" alt="<?php echo $gmedia_item->ID; ?>" title="<?php echo esc_attr( $gmedia_item->title ); ?>"/>
38
  <?php
39
  }
40
  }
41
- if ( count( $gmedias ) < $term_item->count ) {
42
  echo '...';
43
  }
44
  }
@@ -47,126 +50,115 @@ function gmedia_term_item_thumbnails( $term_item, $qty = 7 ) {
47
  <?php
48
  }
49
 
50
- function gmedia_term_item_actions( $item ) {
51
  global $gmCore, $gmProcessor;
52
 
53
- $taxterm = str_replace( 'gmedia_', '', $item->taxonomy );
54
  $actions = array();
55
 
56
- $actions['shortcode'] = '<div class="term-shortcode"><input type="text" readonly value="[gm ' . $taxterm . '=' . $item->term_id . ']"><div class="input-buffer"></div></div>';
57
 
58
- $filter_href = $gmCore->get_admin_url( array( 'page' => 'GrandMedia', "{$taxterm}__in" => $item->term_id ), array(), true );
59
  $filter_class = 'gm_filter_in_lib';
60
  $count = '';
61
- if ( in_array( $item->taxonomy, array( 'gmedia_album', 'gmedia_tag', 'gmedia_category' ) ) ) {
62
  $count = '<span class="gm_term_count">' . $item->count . '</span>';
63
- if ( ! $item->count ) {
64
  $filter_class .= ' action-inactive';
65
  }
66
  }
67
- $actions['filter'] = '<a title="' . __( 'Filter in Gmedia Library', 'grand-media' ) . '" href="' . $filter_href . '" class="' . $filter_class . '">' . $count . '<span class="glyphicon glyphicon-filter"></span></a>';
68
 
69
- $cloud_link = $gmCore->gmcloudlink( $item->term_id, $taxterm );
70
- if ( ! empty( $item->meta['_post_ID'][0] ) ) {
71
- $post_link = get_permalink( $item->meta['_post_ID'][0] );
72
- } else {
73
- $post_link = '';
74
- }
75
  $share_icon = '<span class="glyphicon glyphicon-share"></span>';
76
- if ( 'draft' !== $item->status ) {
77
- $actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="share-modal" title="' . __( 'Share', 'grand-media' ) . '" data-gmediacloud="' . $cloud_link . '" href="' . $post_link . '">' . $share_icon . '</a>';
78
- } else {
79
- $actions['share'] = "<span class='action-inactive'>$share_icon</span>";
80
- }
81
-
82
- if ( 'gmedia_tag' != $item->taxonomy ) {
83
- $edit_icon = '<span class="glyphicon glyphicon-edit"></span>';
84
- if ( $item->allow_edit ) {
85
- $actions['edit'] = '<a title="' . __( 'Edit', 'grand-media' ) . '" href="' . add_query_arg( array( "edit_item" => $item->term_id ), $gmProcessor->url ) . '">' . $edit_icon . '</a>';
86
- } else {
87
- $actions['edit'] = "<span class='action-inactive'>$edit_icon</span>";
88
- }
89
  }
90
 
91
  $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
92
- if ( $item->allow_delete ) {
93
- $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>';
94
- } else {
95
  $actions['delete'] = "<span class='action-inactive'>$trash_icon</span>";
96
  }
97
 
98
- /*if(gm_user_can("{$item->taxonomy}_manage")) {
99
- if((int)$item->global === get_current_user_id() || gm_user_can('edit_others_media')) {
100
- $action['edit'] = '<a title="' . __('Edit', 'grand-media') . '" href="' . add_query_arg(array("edit_item" => $item->term_id), $gmProcessor->url) . '">' . $edit_icon . '</a>';
101
-
102
- if(gm_user_can('terms_delete')) {
103
- $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>';
104
- }
105
- }
106
- }*/
107
-
108
-
109
- return apply_filters( 'gmedia_term_item_actions', $actions );
110
  }
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;
118
-
119
- if ( $item->global ) {
120
- $item->author_name = get_the_author_meta( 'display_name', $item->global );
121
- } else {
122
- $item->author_name = false;
123
- }
124
-
125
- if ( 'gmedia_album' == $item->taxonomy ) {
126
- $post_id = isset( $meta['_post_ID'][0] ) ? (int) $meta['_post_ID'][0] : 0;
127
- $item->post_id = $post_id;
128
- if ( $post_id ) {
129
- $post_item = get_post( $post_id );
130
- if ( $post_item ) {
131
- $item->slug = $post_item->post_name;
132
- $item->post_password = $post_item->post_password;
133
- $item->comment_count = $post_item->comment_count;
134
- $item->comment_status = $post_item->comment_status;
135
- }
136
- }
137
- }
138
-
139
-
140
- $item = apply_filters( 'gmedia_term_item_more_data', $item );
141
  }
142
 
143
- function gmedia_terms_create_album_tpl() {
144
- include( dirname( __FILE__ ) . '/tpl/album-create-item.php' );
145
  }
146
 
147
- function gmedia_terms_create_category_tpl() {
148
- include( dirname( __FILE__ ) . '/tpl/category-create-item.php' );
149
  }
150
 
151
- function gmedia_terms_create_tag_tpl() {
152
- include( dirname( __FILE__ ) . '/tpl/tag-create-item.php' );
153
  }
154
 
155
- function gmedia_terms_create_alert_tpl() {
156
- include( dirname( __FILE__ ) . '/tpl/terms-create-alert.php' );
157
- }
 
 
 
 
 
 
 
 
 
 
158
 
159
- add_action( 'gmedia_term_album_after_panel', 'gmedia_term_album_after_panel' );
160
- function gmedia_term_album_after_panel( $term ) {
161
- include( dirname( __FILE__ ) . '/tpl/album-sort-gmedia.php' );
 
 
 
 
 
 
 
 
 
162
  }
163
 
164
- add_action( 'gmedia_term_category_after_panel', 'gmedia_term_category_after_panel' );
165
- function gmedia_term_category_after_panel( $term ) {
166
- include( dirname( __FILE__ ) . '/tpl/category-preview-gmedia.php' );
 
 
 
 
167
  }
168
 
169
- add_action( 'gmedia_term_filter_after_panel', 'gmedia_term_filter_after_panel' );
170
- function gmedia_term_filter_after_panel( $term ) {
171
- include( dirname( __FILE__ ) . '/tpl/filter-preview-query.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  }
1
  <?php
2
 
3
+ function gmedia_term_item_thumbnails($term_item, $qty = 7){
4
  global $gmCore, $gmDB, $gmGallery;
5
  ?>
6
  <div class="term-images">
7
  <?php
8
+ if($term_item->count){
9
+ $term__in = str_replace('gmedia_', '', $term_item->taxonomy) . '__in';
10
+ switch($term_item->taxonomy){
11
+ case 'gmedia_album':
12
+ $orderby = $gmGallery->options['in_album_orderby'];
13
+ $order = $gmGallery->options['in_album_order'];
14
  break;
15
  case 'gmedia_category':
16
  $orderby = $gmGallery->options['in_category_orderby'];
17
  $order = $gmGallery->options['in_category_order'];
18
  break;
19
+ case 'gmedia_tag':
20
+ $orderby = $gmGallery->options['in_tag_orderby'];
21
+ $order = $gmGallery->options['in_tag_order'];
22
+ break;
23
  default:
24
  $orderby = 'ID';
25
  $order = 'DESC';
26
  break;
27
  }
28
+ $args = array('no_found_rows' => true,
29
+ 'per_page' => $qty,
30
+ $term__in => array($term_item->term_id),
31
+ 'author' => gm_user_can('show_others_media')? 0 : get_current_user_id(),
32
+ 'orderby' => isset($term_item->meta['_orderby'][0])? $term_item->meta['_orderby'][0] : $orderby,
33
+ 'order' => isset($term_item->meta['_order'][0])? $term_item->meta['_order'][0] : $order
 
34
  );
35
 
36
+ $gmedias = $gmDB->get_gmedias($args);
37
+ if(!empty($gmedias)){
38
+ foreach($gmedias as $gmedia_item){
39
  ?>
40
+ <img style="z-index:<?php echo $qty --; ?>;" src="<?php echo $gmCore->gm_get_media_image($gmedia_item, 'thumb', false); ?>" alt="<?php echo $gmedia_item->ID; ?>" title="<?php esc_attr_e($gmedia_item->title); ?>"/>
41
  <?php
42
  }
43
  }
44
+ if(count($gmedias) < $term_item->count){
45
  echo '...';
46
  }
47
  }
50
  <?php
51
  }
52
 
53
+ function gmedia_term_item_actions($item){
54
  global $gmCore, $gmProcessor;
55
 
56
+ $taxterm = $gmProcessor->taxterm;
57
  $actions = array();
58
 
59
+ //$actions['shortcode'] = '<div class="term-shortcode"><input type="text" readonly value="[gm ' . $taxterm . '=' . $item->term_id . ']"><div class="input-buffer"></div></div>';
60
 
61
+ $filter_href = $gmCore->get_admin_url(array('page' => 'GrandMedia', "{$taxterm}__in" => $item->term_id), array(), true);
62
  $filter_class = 'gm_filter_in_lib';
63
  $count = '';
64
+ if(in_array($item->taxonomy, array('gmedia_album', 'gmedia_tag', 'gmedia_category'))){
65
  $count = '<span class="gm_term_count">' . $item->count . '</span>';
66
+ if(!$item->count){
67
  $filter_class .= ' action-inactive';
68
  }
69
  }
70
+ $actions['filter'] = '<a title="' . __('Filter in Gmedia Library', 'grand-media') . '" href="' . $filter_href . '" class="' . $filter_class . '">' . $count . '<span class="glyphicon glyphicon-filter"></span></a>';
71
 
 
 
 
 
 
 
72
  $share_icon = '<span class="glyphicon glyphicon-share"></span>';
73
+ if('draft' !== $item->status){
74
+ $actions['share'] = '<a target="_blank" data-target="#shareModal" data-share="' . $item->term_id . '" class="text-warning share-modal" title="' . __('Share', 'grand-media') . '" data-gmediacloud="' . $item->cloud_link . '" href="' . $item->post_link . '">' . $share_icon . ' ' . __('Share', 'grand-media') . '</a>';
75
+ } else{
76
+ $actions['share'] = '<span class="action-inactive">' . $share_icon . ' ' . __('Share', 'grand-media') . '</span>';
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  $trash_icon = '<span class="glyphicon glyphicon-trash"></span>';
80
+ if($item->allow_delete){
81
+ $actions['delete'] = '<a class="trash-icon" title="' . __('Delete', 'grand-media') . '" href="' . wp_nonce_url(add_query_arg(array('do_gmedia_terms' => 'delete', 'ids' => $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>';
82
+ } else{
83
  $actions['delete'] = "<span class='action-inactive'>$trash_icon</span>";
84
  }
85
 
86
+ return apply_filters('gmedia_term_item_actions', $actions);
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
+ function gmedia_terms_create_album_tpl(){
90
+ include(dirname(__FILE__) . '/tpl/album-create-item.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
 
93
+ function gmedia_terms_create_category_tpl(){
94
+ include(dirname(__FILE__) . '/tpl/category-create-item.php');
95
  }
96
 
97
+ function gmedia_terms_create_tag_tpl(){
98
+ include(dirname(__FILE__) . '/tpl/tag-create-item.php');
99
  }
100
 
101
+ function gmedia_terms_create_alert_tpl(){
102
+ include(dirname(__FILE__) . '/tpl/terms-create-alert.php');
103
  }
104
 
105
+ add_action('gmedia_term_album_after_panel', 'gmedia_term_album_after_panel');
106
+ function gmedia_term_album_after_panel($term){
107
+ global $gmCore, $gmProcessor, $gmProcessorLibrary;
108
+
109
+ $taxin = "{$gmProcessor->taxterm}__in";
110
+ $gmProcessorLibrary->query_args['terms_relation'] = 'AND';
111
+ if(!empty($gmProcessorLibrary->query_args[ $taxin ])){
112
+ $gmProcessorLibrary->query_args["{$gmProcessor->taxterm}__and"] = wp_parse_id_list(array_merge($gmProcessorLibrary->query_args[ $taxin ], array($term->term_id)));
113
+ unset($gmProcessorLibrary->query_args[ $taxin ]);
114
+ } else{
115
+ $gmProcessorLibrary->query_args[ $taxin ] = array((int)$term->term_id);
116
+ }
117
+ $gmProcessorLibrary->display_mode = 'grid';
118
 
119
+ $gmProcessor = $gmProcessorLibrary;
120
+
121
+ $atts = 'class="gmedia_term__in"';
122
+ if(isset($term->meta['_orderby'][0]) && ('custom' == $term->meta['_orderby'][0])){
123
+ $atts .= ' id="gm-sortable" data-term_id="' . $term->term_id . '" data-action="gmedia_term_sortorder" data-_wpnonce="' . wp_create_nonce('GmediaTerms') . '"';
124
+ add_action('before_gmedia_filter_message', 'before_gmedia_filter_message');
125
+ }
126
+ echo "<div {$atts}>";
127
+ echo $gmCore->alert('success', $gmProcessor->msg);
128
+ echo $gmCore->alert('danger', $gmProcessor->error);
129
+ include(GMEDIA_ABSPATH . 'admin/pages/library/library.php');
130
+ echo '</div>';
131
  }
132
 
133
+ function before_gmedia_filter_message(){
134
+ global $gmProcessorLibrary;
135
+ if(empty($gmProcessorLibrary->dbfilter)){
136
+ echo '<div class="custom-message alert alert-info">' . __("You can drag'n'drop items below to reorder. Order saves automatically after you drop the item. Also you can set order position number manually when edit item.", 'grand-media') . '</div>';
137
+ } else{
138
+ echo '<div class="custom-message alert alert-warning">' . __("Drag'n'drop functionality disabled. Reset filters to enable drag'n'drop.", 'grand-media') . '</div>';
139
+ }
140
  }
141
 
142
+ add_action('gmedia_term_category_after_panel', 'gmedia_term_category_after_panel');
143
+ function gmedia_term_category_after_panel($term){
144
+ global $gmCore, $gmProcessor, $gmProcessorLibrary;
145
+
146
+ $taxin = "{$gmProcessor->taxterm}__in";
147
+ $gmProcessorLibrary->query_args['terms_relation'] = 'AND';
148
+ if(!empty($gmProcessorLibrary->query_args[ $taxin ])){
149
+ $gmProcessorLibrary->query_args["{$gmProcessor->taxterm}__and"] = wp_parse_id_list(array_merge($gmProcessorLibrary->query_args[ $taxin ], array($term->term_id)));
150
+ unset($gmProcessorLibrary->query_args[ $taxin ]);
151
+ } else{
152
+ $gmProcessorLibrary->query_args[ $taxin ] = array((int)$term->term_id);
153
+ }
154
+ $gmProcessorLibrary->display_mode = 'grid';
155
+
156
+ $gmProcessor = $gmProcessorLibrary;
157
+
158
+ $atts = 'class="gmedia_term__in"';
159
+ echo "<div {$atts}>";
160
+ echo $gmCore->alert('success', $gmProcessor->msg);
161
+ echo $gmCore->alert('danger', $gmProcessor->error);
162
+ include(GMEDIA_ABSPATH . 'admin/pages/library/library.php');
163
+ echo '</div>';
164
  }
admin/pages/terms/terms.php CHANGED
@@ -29,7 +29,7 @@ $gmedia_terms_pager = $gmDB->query_pager();
29
 
30
  <form class="list-group <?php echo $gmedia_term_taxonomy; ?>" id="gm-list-table" style="margin-bottom:4px;">
31
  <?php
32
- $taxterm = str_replace('gmedia_', '', $gmedia_term_taxonomy);
33
  if(count($gmedia_terms)) {
34
  foreach($gmedia_terms as &$item) {
35
  gmedia_term_item_more_data($item);
@@ -48,20 +48,6 @@ $gmedia_terms_pager = $gmDB->query_pager();
48
  $item->classes[] = 'gm-selected';
49
  }
50
 
51
- $allow_terms_delete = gm_user_can('terms_delete');
52
- if($item->global) {
53
- if((int)$item->global === get_current_user_id()) {
54
- $item->allow_edit = gm_user_can("{$taxterm}_manage");
55
- $item->allow_delete = $allow_terms_delete;
56
- } else {
57
- $item->allow_edit = gm_user_can('edit_others_media');
58
- $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
59
- }
60
- } else {
61
- $item->allow_edit = gm_user_can('edit_others_media');
62
- $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
63
- }
64
-
65
  include(dirname(__FILE__) . "/tpl/{$taxterm}-list-item.php");
66
 
67
  }
29
 
30
  <form class="list-group <?php echo $gmedia_term_taxonomy; ?>" id="gm-list-table" style="margin-bottom:4px;">
31
  <?php
32
+ $taxterm = $gmProcessor->taxterm;
33
  if(count($gmedia_terms)) {
34
  foreach($gmedia_terms as &$item) {
35
  gmedia_term_item_more_data($item);
48
  $item->classes[] = 'gm-selected';
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  include(dirname(__FILE__) . "/tpl/{$taxterm}-list-item.php");
52
 
53
  }
admin/pages/terms/tpl/album-create-item.php CHANGED
@@ -19,38 +19,43 @@ $gmedia_url = $gmProcessor->url;
19
  </div>
20
  <div class="form-group">
21
  <label><?php _e('Description', 'grand-media'); ?></label>
22
- <textarea class="form-control input-sm" style="height:98px;" rows="2" name="term[description]"></textarea>
 
 
 
 
 
 
 
 
 
 
23
  </div>
24
  </div>
25
  <div class="col-xs-6">
26
- <div class="form-group row">
27
- <div class="col-xs-6">
28
- <label><?php _e('Order gmedia', 'grand-media'); ?></label>
29
- <select name="term[meta][_orderby]" class="form-control input-sm">
30
- <option value="ID" <?php selected($gmGallery->options['in_album_orderby'], 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
31
- <option value="title" <?php selected($gmGallery->options['in_album_orderby'], 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
32
- <option value="gmuid" <?php selected($gmGallery->options['in_album_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
33
- <option value="date" <?php selected($gmGallery->options['in_album_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
34
- <option value="modified" <?php selected($gmGallery->options['in_album_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
35
- <option value="rand" <?php selected($gmGallery->options['in_album_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
36
- </select>
37
- </div>
38
- <div class="col-xs-6">
39
- <label><?php _e('Sort order', 'grand-media'); ?></label>
40
- <select name="term[meta][_order]" class="form-control input-sm">
41
- <option value="DESC" <?php selected($gmGallery->options['in_album_order'], 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
42
- <option value="ASC" <?php selected($gmGallery->options['in_album_order'], 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
43
- </select>
44
- </div>
45
- </div>
46
  <div class="row">
47
  <div class="col-xs-6">
48
  <div class="form-group">
49
- <label><?php _e('Status', 'grand-media'); ?></label>
50
- <select name="term[status]" class="form-control input-sm">
51
- <option value="publish" <?php selected($gmGallery->options['in_album_status'], 'publish'); ?>><?php _e('Public', 'grand-media'); ?></option>
52
- <option value="private" <?php selected($gmGallery->options['in_album_status'], 'private'); ?>><?php _e('Private', 'grand-media'); ?></option>
53
- <option value="draft" <?php selected($gmGallery->options['in_album_status'], 'draft'); ?>><?php _e('Draft', 'grand-media'); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  </select>
55
  </div>
56
  <div class="form-group">
@@ -87,6 +92,20 @@ $gmedia_url = $gmProcessor->url;
87
  ?>
88
  </select>
89
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  <?php /* ?>
91
  <div class="form-group">
92
  <label><?php _e('Comment Status', 'grand-media'); ?></label>
@@ -96,12 +115,6 @@ $gmedia_url = $gmProcessor->url;
96
  </select>
97
  </div>
98
  <?php */ ?>
99
- </div>
100
- <div class="col-xs-6">
101
- <div class="form-group">
102
- <label><?php _e('Author', 'grand-media'); ?></label>
103
- <?php gmedia_term_choose_author_field(); ?>
104
- </div>
105
  <div class="form-group">
106
  <label>&nbsp;</label>
107
  <?php
19
  </div>
20
  <div class="form-group">
21
  <label><?php _e('Description', 'grand-media'); ?></label>
22
+ <?php
23
+ wp_editor('', "album_description", array('editor_class' => 'form-control input-sm',
24
+ 'editor_height' => 120,
25
+ 'wpautop' => false,
26
+ 'media_buttons' => false,
27
+ 'textarea_name' => 'term[description]',
28
+ 'textarea_rows' => '4',
29
+ 'tinymce' => false,
30
+ 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
31
+ ));
32
+ ?>
33
  </div>
34
  </div>
35
  <div class="col-xs-6">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  <div class="row">
37
  <div class="col-xs-6">
38
  <div class="form-group">
39
+ <label><?php _e('Order gmedia', 'grand-media'); ?></label>
40
+ <select name="term[meta][_orderby]" class="form-control input-sm">
41
+ <option value="ID" <?php selected($gmGallery->options['in_album_orderby'], 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
42
+ <option value="title" <?php selected($gmGallery->options['in_album_orderby'], 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
43
+ <option value="gmuid" <?php selected($gmGallery->options['in_album_orderby'], 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
44
+ <option value="date" <?php selected($gmGallery->options['in_album_orderby'], 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
45
+ <option value="modified" <?php selected($gmGallery->options['in_album_orderby'], 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
46
+ <option value="_created_timestamp" <?php selected($gmGallery->options['in_album_orderby'], '_created_timestamp'); ?>><?php _e('by created timestamp', 'grand-media'); ?></option>
47
+ <option value="comment_count" <?php selected($gmGallery->options['in_album_orderby'], 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
48
+ <option value="views" <?php selected($gmGallery->options['in_album_orderby'], 'views'); ?>><?php _e('by views', 'grand-media'); ?></option>
49
+ <option value="likes" <?php selected($gmGallery->options['in_album_orderby'], 'likes'); ?>><?php _e('by likes', 'grand-media'); ?></option>
50
+ <option value="_size" <?php selected($gmGallery->options['in_album_orderby'], '_size'); ?>><?php _e('by file size', 'grand-media'); ?></option>
51
+ <option value="rand" <?php selected($gmGallery->options['in_album_orderby'], 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
52
+ </select>
53
+ </div>
54
+ <div class="form-group">
55
+ <label><?php _e('Sort order', 'grand-media'); ?></label>
56
+ <select name="term[meta][_order]" class="form-control input-sm">
57
+ <option value="DESC" <?php selected($gmGallery->options['in_album_order'], 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
58
+ <option value="ASC" <?php selected($gmGallery->options['in_album_order'], 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
59
  </select>
60
  </div>
61
  <div class="form-group">
92
  ?>
93
  </select>
94
  </div>
95
+ </div>
96
+ <div class="col-xs-6">
97
+ <div class="form-group">
98
+ <label><?php _e('Author', 'grand-media'); ?></label>
99
+ <?php gmedia_term_choose_author_field(); ?>
100
+ </div>
101
+ <div class="form-group">
102
+ <label><?php _e('Status', 'grand-media'); ?></label>
103
+ <select name="term[status]" class="form-control input-sm">
104
+ <option value="publish" <?php selected($gmGallery->options['in_album_status'], 'publish'); ?>><?php _e('Public', 'grand-media'); ?></option>
105
+ <option value="private" <?php selected($gmGallery->options['in_album_status'], 'private'); ?>><?php _e('Private', 'grand-media'); ?></option>
106
+ <option value="draft" <?php selected($gmGallery->options['in_album_status'], 'draft'); ?>><?php _e('Draft', 'grand-media'); ?></option>
107
+ </select>
108
+ </div>
109
  <?php /* ?>
110
  <div class="form-group">
111
  <label><?php _e('Comment Status', 'grand-media'); ?></label>
115
  </select>
116
  </div>
117
  <?php */ ?>
 
 
 
 
 
 
118
  <div class="form-group">
119
  <label>&nbsp;</label>
120
  <?php
admin/pages/terms/tpl/album-edit-item.php CHANGED
@@ -7,9 +7,11 @@ if(!defined('ABSPATH')){
7
  /**
8
  * Edit Album Form
9
  */
 
 
10
  $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_preset'][0] : '';
11
  ?>
12
- <form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body" data-id="<?php echo $term->term_id; ?>">
13
  <h4 style="margin-top:0;">
14
  <span class="pull-right"><?php echo __('ID', 'grand-media') . ": {$term->term_id}"; ?></span>
15
  <?php _e('Edit Album'); ?>: <em><?php echo esc_html($term->name); ?></em>
@@ -19,11 +21,39 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
19
  <div class="col-xs-6">
20
  <div class="form-group">
21
  <label><?php _e('Name', 'grand-media'); ?></label>
22
- <input type="text" class="form-control input-sm" name="term[name]" value="<?php echo esc_attr($term->name); ?>" placeholder="<?php _e('Album Name', 'grand-media'); ?>" required/>
23
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  <div class="form-group">
25
  <label><?php _e('Description', 'grand-media'); ?></label>
26
- <textarea class="form-control input-sm" style="height:128px;" rows="2" name="term[description]"><?php echo $term->description; ?></textarea>
 
 
 
 
 
 
 
 
 
 
27
  </div>
28
  <div class="text-right">
29
  <?php
@@ -39,18 +69,30 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
39
  <div class="row">
40
  <div class="col-xs-6">
41
  <div class="form-group">
42
- <label><?php _e('Author', 'grand-media'); ?></label>
43
- <?php gmedia_term_choose_author_field($term->global); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  </div>
45
  <div class="form-group">
46
- <label><?php _e('Status', 'grand-media'); ?></label>
47
- <select name="term[status]" class="form-control input-sm">
48
- <option value="publish"<?php selected($term->status, 'publish'); ?>><?php _e('Public', 'grand-media'); ?></option>
49
- <option value="private"<?php selected($term->status, 'private'); ?>><?php _e('Private', 'grand-media'); ?></option>
50
- <option value="draft"<?php selected($term->status, 'draft'); ?>><?php _e('Draft', 'grand-media'); ?></option>
51
  </select>
52
  <div class="cb-help-block">
53
- <div class="checkbox"><label><input type="checkbox" name="term[status_global]" value="1"> <?php _e('Apply Status for all items in album', 'grand-media'); ?> </label></div>
54
  </div>
55
  </div>
56
  <div class="form-group">
@@ -90,7 +132,11 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
90
  ?>
91
  </select>
92
  </div>
93
- <?php
 
 
 
 
94
  /*if(isset($term->comment_status)){ ?>
95
  <div class="form-group">
96
  <a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_term_id' => $term->term_id), $gmProcessor->url); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count pull-right" title="<?php esc_attr_e('Comments', 'grand-media'); ?>">
@@ -109,26 +155,30 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
109
  <?php if(isset($term->slug)){ ?>
110
  <div class="form-group">
111
  <label><?php _e('Slug', 'grand-media'); ?></label>
112
- <input type="text" class="form-control input-sm" name="term[slug]" value="<?php echo esc_attr($term->slug); ?>"/>
113
  </div>
114
  <?php } ?>
115
  <?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
116
  <div class="form-group">
117
  <label><?php _e('Album Cover', 'grand-media'); ?></label>
118
- <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'); ?>"/>
 
 
 
 
 
 
 
119
  </div>
120
- <?php
121
- if(($cover_id = intval($cover_id))){
122
- if(($cover = $gmDB->get_gmedia($cover_id))){ ?>
123
- <div class="gm-img-thumbnail" data-gmid="<?php echo $cover->ID; ?>"><?php
124
- ?><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
125
- ?><span class="label label-default">ID: <?php echo $cover->ID; ?></span><?php
126
- ?></div>
127
- <?php } else{
128
- echo '<strong class="text-danger">' . __('No image with such ID', 'grand-media') . '</strong>';
129
  }
130
- }
131
- ?>
132
  </div>
133
  </div>
134
  </div>
@@ -139,6 +189,13 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
139
  do_action('gmedia_term_edit_form');
140
  ?>
141
  </form>
 
 
 
 
 
 
 
142
 
143
  <div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
144
  <div class="modal-dialog">
7
  /**
8
  * Edit Album Form
9
  */
10
+ $_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : $gmGallery->options['in_album_orderby'];
11
+ $_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : $gmGallery->options['in_album_order'];
12
  $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_preset'][0] : '';
13
  ?>
14
+ <form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body" data-id="<?php echo $term->term_id; ?>" action="<?php echo gm_get_admin_url(); ?>">
15
  <h4 style="margin-top:0;">
16
  <span class="pull-right"><?php echo __('ID', 'grand-media') . ": {$term->term_id}"; ?></span>
17
  <?php _e('Edit Album'); ?>: <em><?php echo esc_html($term->name); ?></em>
21
  <div class="col-xs-6">
22
  <div class="form-group">
23
  <label><?php _e('Name', 'grand-media'); ?></label>
24
+ <input type="text" class="form-control input-sm" name="term[name]" value="<?php esc_attr_e($term->name); ?>" placeholder="<?php _e('Album Name', 'grand-media'); ?>" required/>
25
  </div>
26
+ <div class="form-group row">
27
+ <div class="col-xs-6">
28
+ <label><?php _e('Author', 'grand-media'); ?></label>
29
+ <?php gmedia_term_choose_author_field($term->global); ?>
30
+ </div>
31
+ <div class="col-xs-6">
32
+ <label><?php _e('Status', 'grand-media'); ?></label>
33
+ <select name="term[status]" class="form-control input-sm">
34
+ <option value="publish"<?php selected($term->status, 'publish'); ?>><?php _e('Public', 'grand-media'); ?></option>
35
+ <option value="private"<?php selected($term->status, 'private'); ?>><?php _e('Private', 'grand-media'); ?></option>
36
+ <option value="draft"<?php selected($term->status, 'draft'); ?>><?php _e('Draft', 'grand-media'); ?></option>
37
+ </select>
38
+ <div class="cb-help-block">
39
+ <div class="checkbox" style="margin-bottom:0;"><label><input type="checkbox" name="term[status_global]" value="1"> <?php _e('Apply Status for all items in album', 'grand-media'); ?> </label></div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
  <div class="form-group">
45
  <label><?php _e('Description', 'grand-media'); ?></label>
46
+ <?php
47
+ wp_editor(esc_textarea($term->description), "album{$term->term_id}_description", array('editor_class' => 'form-control input-sm',
48
+ 'editor_height' => 120,
49
+ 'wpautop' => false,
50
+ 'media_buttons' => false,
51
+ 'textarea_name' => 'term[description]',
52
+ 'textarea_rows' => '4',
53
+ 'tinymce' => false,
54
+ 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
55
+ ));
56
+ ?>
57
  </div>
58
  <div class="text-right">
59
  <?php
69
  <div class="row">
70
  <div class="col-xs-6">
71
  <div class="form-group">
72
+ <label><?php _e('Order gmedia', 'grand-media'); ?></label>
73
+ <select name="term[meta][_orderby]" id="gmedia_term_orderby" class="form-control input-sm">
74
+ <option value="custom"<?php selected($_orderby, 'custom'); ?>><?php _e('Custom Order', 'grand-media'); ?></option>
75
+ <option value="ID"<?php selected($_orderby, 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
76
+ <option value="title"<?php selected($_orderby, 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
77
+ <option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
78
+ <option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
79
+ <option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
80
+ <option value="_created_timestamp" <?php selected($_orderby, '_created_timestamp'); ?>><?php _e('by created timestamp', 'grand-media'); ?></option>
81
+ <option value="comment_count" <?php selected($_orderby, 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
82
+ <option value="views" <?php selected($_orderby, 'views'); ?>><?php _e('by views', 'grand-media'); ?></option>
83
+ <option value="likes" <?php selected($_orderby, 'likes'); ?>><?php _e('by likes', 'grand-media'); ?></option>
84
+ <option value="_size" <?php selected($_orderby, '_size'); ?>><?php _e('by file size', 'grand-media'); ?></option>
85
+ <option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
86
+ </select>
87
  </div>
88
  <div class="form-group">
89
+ <label><?php _e('Sort order', 'grand-media'); ?></label>
90
+ <select id="gmedia_term_order" name="term[meta][_order]" class="form-control input-sm<?php echo ('custom' == $_orderby)? ' disabled' : ''; ?>">
91
+ <option value="DESC"<?php selected($_order, 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
92
+ <option value="ASC"<?php selected($_order, 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
 
93
  </select>
94
  <div class="cb-help-block">
95
+ <div class="checkbox" style="margin-bottom:0;"><label><input id="reset_order_option" type="checkbox" name="term[reset_custom_order]" value="1"> <?php _e('Reset custom order', 'grand-media'); ?> </label></div>
96
  </div>
97
  </div>
98
  <div class="form-group">
132
  ?>
133
  </select>
134
  </div>
135
+ <p><a href="<?php echo $term->cloud_link?>" target="_blank"><?php _e('View GmediaCloud Page', 'grand-media'); ?></a></p>
136
+ <?php if($term->post_link){ ?>
137
+ <p><a href="<?php echo $term->post_link ?>" target="_blank"><?php _e('View Wordpress Post', 'grand-media'); ?></a></p>
138
+ <?php }
139
+
140
  /*if(isset($term->comment_status)){ ?>
141
  <div class="form-group">
142
  <a href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'gmediablank' => 'comments', 'gmedia_term_id' => $term->term_id), $gmProcessor->url); ?>" data-target="#previewModal" data-width="900" data-height="500" class="preview-modal gmpost-com-count pull-right" title="<?php esc_attr_e('Comments', 'grand-media'); ?>">
155
  <?php if(isset($term->slug)){ ?>
156
  <div class="form-group">
157
  <label><?php _e('Slug', 'grand-media'); ?></label>
158
+ <input type="text" class="form-control input-sm" name="term[slug]" value="<?php esc_attr_e($term->slug); ?>"/>
159
  </div>
160
  <?php } ?>
161
  <?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
162
  <div class="form-group">
163
  <label><?php _e('Album Cover', 'grand-media'); ?></label>
164
+ <div class="input-group">
165
+ <input type="text" class="form-control input-sm gmedia-cover-id" name="term[meta][_cover]" value="<?php esc_attr_e($cover_id); ?>" placeholder="<?php _e('Gmedia Image ID', 'grand-media'); ?>"/>
166
+ <span class="input-group-btn"><a href="<?php echo $gmCore->get_admin_url(array('page' => 'GrandMedia',
167
+ 'mode' => 'select_single',
168
+ 'gmediablank' => 'library',
169
+ 'filter' => 'image'
170
+ ), array(), true); ?>" class="btn btn-sm btn-primary preview-modal" data-target="#previewModal" data-width="1200" data-height="500" data-cls="select_gmedia_image" title="<?php _e('Choose Cover Image', 'grand-media'); ?>"><span class="glyphicon glyphicon-picture"></span></a></span>
171
+ </div>
172
  </div>
173
+ <div class="gm-img-thumbnail gmedia-cover-image"><?php
174
+ if(($cover_id = intval($cover_id))){
175
+ if(($cover = $gmDB->get_gmedia($cover_id))){
176
+ ?><img src="<?php echo $gmCore->gm_get_media_image($cover, 'thumb', true); ?>" alt="" /><?php
177
+ } else{
178
+ echo '<strong class="text-danger">' . __('No image with such ID', 'grand-media') . '</strong>';
179
+ }
 
 
180
  }
181
+ ?></div>
 
182
  </div>
183
  </div>
184
  </div>
189
  do_action('gmedia_term_edit_form');
190
  ?>
191
  </form>
192
+ <form style="display:none;" id="gmedia-assign-term" autocomplete="off" method="post" action="<?php echo gm_get_admin_url(); ?>">
193
+ <input type="hidden" name="alb" value="<?php echo $term->term_id; ?>">
194
+ <input type="hidden" name="status_global" value="0">
195
+ <input type="hidden" name="cookie_key" value="gmedia_library:frame">
196
+ <input type="hidden" name="assign_album"/>
197
+ <?php wp_nonce_field('gmedia_action'); ?>
198
+ </form>
199
 
200
  <div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
201
  <div class="modal-dialog">
admin/pages/terms/tpl/album-list-item.php CHANGED
@@ -12,32 +12,30 @@ if(!defined('ABSPATH')) {
12
  */
13
  ?>
14
  <div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
15
- <div class="row cb_term-object">
16
- <div class="term_id">#<?php echo $item->term_id; ?></div>
17
  <div class="col-xs-6 term-label">
18
  <div class="checkbox">
19
  <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
20
  <?php if($item->allow_edit) { ?>
21
- <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>
22
  <?php } else { ?>
23
  <span class="term_name"><?php echo esc_html($item->name); ?></span>
24
  <?php } ?>
25
- <span class="term_info_author"><?php
26
  if($item->global) {
27
  echo $item->author_name? sprintf(__('by %s', 'grand-media'), $item->author_name) : '(' . __('deleted author', 'grand-media') . ')';
28
  } else {
29
  echo '(' . __('no author', 'grand-media') . ')';
30
  }
31
  ?></span>
 
32
 
33
  <div class="object-actions">
34
  <?php $action_links = gmedia_term_item_actions($item);
35
- echo implode('', $action_links);
 
36
  ?>
37
  </div>
38
- <?php if(!empty($item->description)) { ?>
39
- <div class="term-description"><?php echo esc_html(nl2br($item->description)); ?></div>
40
- <?php } ?>
41
  </div>
42
  </div>
43
  <div class="col-xs-6">
12
  */
13
  ?>
14
  <div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
15
+ <div class="row cb_object">
 
16
  <div class="col-xs-6 term-label">
17
  <div class="checkbox">
18
  <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
19
  <?php if($item->allow_edit) { ?>
20
+ <a class="term_name" href="<?php echo add_query_arg(array('edit_term' => $item->term_id), $gmedia_url); ?>"><?php echo esc_html($item->name); ?></a>
21
  <?php } else { ?>
22
  <span class="term_name"><?php echo esc_html($item->name); ?></span>
23
  <?php } ?>
24
+ <br/><span class="term_info_author"><?php
25
  if($item->global) {
26
  echo $item->author_name? sprintf(__('by %s', 'grand-media'), $item->author_name) : '(' . __('deleted author', 'grand-media') . ')';
27
  } else {
28
  echo '(' . __('no author', 'grand-media') . ')';
29
  }
30
  ?></span>
31
+ <br/><span class="term_id">ID: <?php echo $item->term_id; ?></span>
32
 
33
  <div class="object-actions">
34
  <?php $action_links = gmedia_term_item_actions($item);
35
+ echo $action_links['share'];
36
+ echo '<br/>' . $action_links['filter'] . $action_links['delete'];
37
  ?>
38
  </div>
 
 
 
39
  </div>
40
  </div>
41
  <div class="col-xs-6">
admin/pages/terms/tpl/album-sort-gmedia.php DELETED
@@ -1,193 +0,0 @@
1
- <?php // don't load directly
2
- if(!defined('ABSPATH')) {
3
- die('-1');
4
- }
5
-
6
- /**
7
- * Sort Gmedia in Album
8
- *
9
- * @var $term
10
- */
11
- global $gmDB, $gmCore, $gmProcessor;
12
-
13
- $_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : '';
14
- $_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : '';
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 40px 7px 0;" class="pull-left"><?php _e('Sort Album'); ?></h4>
34
- <a class="btn btn-default" href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'album__in' => $term->term_id), $gmProcessor->url); ?>"><?php _e('Open in Gmedia Library', 'grand-media'); ?></a>
35
- <?php echo $pager_html; ?>
36
-
37
- </div>
38
- <form method="post" id="gmedia-sort-term" name="gmSortTerm" class="panel-body">
39
- <div class="order-form" style="border-bottom:1px solid #ddd; margin-bottom:15px;">
40
- <div class="row">
41
- <div class="col-xs-3">
42
- <div class="form-group">
43
- <label><?php _e('Order gmedia', 'grand-media'); ?></label>
44
- <select name="term[meta][_orderby]" id="gmedia_term_orderby" class="form-control input-sm">
45
- <option value="custom"<?php selected($_orderby, 'custom'); ?>><?php _e('Custom Order', 'grand-media'); ?></option>
46
- <option value="ID"<?php selected($_orderby, 'ID'); ?>><?php _e('by ID', 'grand-media'); ?></option>
47
- <option value="title"<?php selected($_orderby, 'title'); ?>><?php _e('by title', 'grand-media'); ?></option>
48
- <option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
49
- <option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
50
- <option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
51
- <option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
52
- </select>
53
- </div>
54
- </div>
55
- <div class="col-xs-3">
56
- <div class="form-group">
57
- <label><?php _e('Sort order', 'grand-media'); ?></label>
58
- <select id="gmedia_term_order" name="term[meta][_order]" class="form-control input-sm">
59
- <option value="DESC"<?php selected($_order, 'DESC'); ?>><?php _e('DESC', 'grand-media'); ?></option>
60
- <option value="ASC"<?php selected($_order, 'ASC'); ?>><?php _e('ASC', 'grand-media'); ?></option>
61
- </select>
62
- </div>
63
- </div>
64
- <div class="col-xs-6">
65
- <div class="form-group pull-left" style="margin-right:30px;">
66
- <label style="visibility:hidden;">-</label>
67
-
68
- <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>
69
- </div>
70
- <div class="form-group pull-left">
71
- <label style="visibility:hidden;">-</label>
72
- <button style="display:block" type="submit" class="btn btn-primary btn-sm" name="gmedia_term_sort_save"><?php _e('Update', 'grand-media'); ?></button>
73
- </div>
74
- <?php
75
- wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
76
- wp_referer_field();
77
- ?>
78
- <input type="hidden" name="term[term_id]" value="<?php echo $term->term_id; ?>"/>
79
- <input type="hidden" name="term[taxonomy]" value="<?php echo $term->taxonomy; ?>"/>
80
- </div>
81
- </div>
82
- <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>
83
- </div>
84
- <div class="termItems clearfix" id="termItems">
85
- <?php if(!empty($termItems)) {
86
- foreach($termItems as $item) {
87
- ?>
88
- <div class="gm-img-thumbnail" data-gmid="<?php echo $item->ID; ?>"><?php
89
- ?><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
90
- ?><input type="text" name="term[gmedia_ids][<?php echo $item->ID; ?>]" value="<?php echo isset($item->gmedia_order)? $item->gmedia_order : '0'; ?>"/><?php
91
- ?><span class="label label-default">ID: <?php echo $item->ID; ?></span><?php
92
- ?>
93
- <div class="gm-img-thumb-title"><?php echo esc_html($item->title); ?></div>
94
- </div>
95
- <?php
96
- }
97
- } ?>
98
-
99
- </div>
100
- </form>
101
- <div class="panel-footer clearfix" style="margin-top:20px;"><?php echo $pager_html; ?>
102
- <div class="well well-sm pull-left" style="margin:0;"><?php printf(__('Total items: %d'), $term->count); ?></div>
103
- </div>
104
-
105
- <script type="text/javascript">
106
- jQuery(function($) {
107
- var sortdiv = $('#termItems');
108
- var items = $('.gm-img-thumbnail', sortdiv);
109
-
110
- sortdiv.sortable({
111
- items: '.gm-img-thumbnail',
112
- handle: 'img',
113
- placeholder: 'gm-img-thumbnail ui-highlight-placeholder',
114
- forcePlaceholderSize: true,
115
- //revert: true,
116
- stop: function(event, ui) {
117
- $('#gmedia_term_orderby').val('custom');
118
- $('#gmedia_term_order').val('ASC');
119
- var cur_order, prev_order, next_order;
120
- var self = ui.item,
121
- prev_item = self.prev(),
122
- next_item = self.next();
123
- prev_order = prev_item.length? parseInt($('input', prev_item).val()) : 0;
124
- var img_order_asc = ('ASC' == $('#gmedia_term_order').val());
125
- if(img_order_asc) {
126
- cur_order = prev_order + 1;
127
- $('input', self).val(cur_order);
128
- while(next_item.length) {
129
- next_order = parseInt(next_item.find('input').val());
130
- if(cur_order < next_order) {
131
- break;
132
- }
133
- cur_order += 1;
134
- next_item.find('input').val(cur_order);
135
- next_item = next_item.next();
136
- }
137
-
138
- } else {
139
- next_order = next_item.length? parseInt($('input', next_item).val()) : (prev_order? (prev_order - 1) : 0);
140
- cur_order = next_order + 1;
141
- $('input', self).val(cur_order);
142
- while(prev_item.length) {
143
- prev_order = parseInt(prev_item.find('input').val());
144
- if(cur_order < prev_order) {
145
- break;
146
- }
147
- cur_order += 1;
148
- prev_item.find('input').val(cur_order);
149
- prev_item = prev_item.prev();
150
- }
151
- }
152
- }
153
- });
154
-
155
- $('input', items).on('change', function() {
156
- $('#gmedia_term_orderby').val('custom');
157
- $('#gmedia_term_order').val('ASC');
158
- sortdiv.css({height: sortdiv.height()});
159
- var items = $('.gm-img-thumbnail', sortdiv);
160
-
161
- var new_order = $.isNumeric($(this).val())? parseInt($(this).val()) : -1;
162
- $(this).val(new_order).closest('.gm-img-thumbnail').css({zIndex: 1000});
163
-
164
- var ipos = [];
165
- items.each(function(i, el) {
166
- var pos = $(el).position();
167
- $.data(el, 'pos', pos);
168
- ipos[i] = pos;
169
- });
170
-
171
- var img_order_asc = ('ASC' == $('#gmedia_term_order').val());
172
- var order = img_order_asc? 'asc' : 'desc';
173
- items.tsort('input', {
174
- useVal: true,
175
- order: order
176
- }, 'span.label', {order: order}).each(function(i, el) {
177
- var from = $.data(el, 'pos');
178
- var to = ipos[i];
179
- $(el).css({position: 'absolute', top: from.top, left: from.left}).animate({
180
- top: to.top,
181
- left: to.left
182
- }, 500);
183
- }).promise().done(function() {
184
- items.removeAttr('style');
185
- sortdiv.removeAttr('style');
186
- });
187
-
188
- $(this).val(((0 > new_order)? 0 : new_order));
189
- });
190
- });
191
- </script>
192
-
193
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/pages/terms/tpl/category-create-item.php CHANGED
@@ -21,7 +21,17 @@ $_order = $gmGallery->options['in_category_order'];
21
  </div>
22
  <div class="form-group">
23
  <label><?php _e('Description', 'grand-media'); ?></label>
24
- <textarea class="form-control input-sm" style="height:49px;" rows="2" name="term[description]"></textarea>
 
 
 
 
 
 
 
 
 
 
25
  </div>
26
  </div>
27
  <div class="col-xs-6">
@@ -34,6 +44,11 @@ $_order = $gmGallery->options['in_category_order'];
34
  <option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
35
  <option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
36
  <option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
 
 
 
 
 
37
  <option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
38
  </select>
39
  </div>
21
  </div>
22
  <div class="form-group">
23
  <label><?php _e('Description', 'grand-media'); ?></label>
24
+ <?php
25
+ wp_editor('', "category_description", array('editor_class' => 'form-control input-sm',
26
+ 'editor_height' => 120,
27
+ 'wpautop' => false,
28
+ 'media_buttons' => false,
29
+ 'textarea_name' => 'term[description]',
30
+ 'textarea_rows' => '4',
31
+ 'tinymce' => false,
32
+ 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
33
+ ));
34
+ ?>
35
  </div>
36
  </div>
37
  <div class="col-xs-6">
44
  <option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
45
  <option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
46
  <option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
47
+ <option value="_created_timestamp" <?php selected($_orderby, '_created_timestamp'); ?>><?php _e('by created timestamp', 'grand-media'); ?></option>
48
+ <option value="comment_count" <?php selected($_orderby, 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
49
+ <option value="views" <?php selected($_orderby, 'views'); ?>><?php _e('by views', 'grand-media'); ?></option>
50
+ <option value="likes" <?php selected($_orderby, 'likes'); ?>><?php _e('by likes', 'grand-media'); ?></option>
51
+ <option value="_size" <?php selected($_orderby, '_size'); ?>><?php _e('by file size', 'grand-media'); ?></option>
52
  <option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
53
  </select>
54
  </div>
admin/pages/terms/tpl/category-edit-item.php CHANGED
@@ -4,14 +4,13 @@ if(!defined('ABSPATH')){
4
  }
5
 
6
  /**
7
- * Edit Album Form
8
  */
9
-
10
  $_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
11
  $_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
12
  $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_preset'][0] : '';
13
  ?>
14
- <form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body" data-id="<?php echo $term->term_id; ?>">
15
  <h4 style="margin-top:0;">
16
  <span class="pull-right"><?php echo __('ID', 'grand-media') . ": {$term->term_id}"; ?></span>
17
  <?php _e('Edit Category'); ?>: <em><?php echo esc_html($term->name); ?></em>
@@ -21,11 +20,21 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
21
  <div class="col-xs-6">
22
  <div class="form-group">
23
  <label><?php _e('Name', 'grand-media'); ?></label>
24
- <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/>
25
  </div>
26
  <div class="form-group">
27
  <label><?php _e('Description', 'grand-media'); ?></label>
28
- <textarea class="form-control input-sm" style="height:98px;" rows="2" name="term[description]"><?php echo $term->description; ?></textarea>
 
 
 
 
 
 
 
 
 
 
29
  </div>
30
  <div class="text-right">
31
  <?php
@@ -48,6 +57,11 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
48
  <option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
49
  <option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
50
  <option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
 
 
 
 
 
51
  <option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
52
  </select>
53
  </div>
@@ -97,25 +111,26 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
97
  ?>
98
  </select>
99
  </div>
 
100
  </div>
101
  <div class="col-xs-6">
102
  <?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
103
  <div class="form-group">
104
  <label><?php _e('Category Cover', 'grand-media'); ?></label>
105
- <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'); ?>"/>
 
 
 
106
  </div>
107
- <?php
108
  if(($cover_id = intval($cover_id))){
109
- if(($cover = $gmDB->get_gmedia($cover_id))){ ?>
110
- <div class="gm-img-thumbnail" data-gmid="<?php echo $cover->ID; ?>"><?php
111
- ?><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
112
- ?><span class="label label-default">ID: <?php echo $cover->ID; ?></span><?php
113
- ?></div>
114
- <?php } else{
115
  echo '<strong class="text-danger">' . __('No image with such ID', 'grand-media') . '</strong>';
116
  }
117
  }
118
- ?>
119
  </div>
120
  </div>
121
  </div>
@@ -126,6 +141,12 @@ $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_
126
  do_action('gmedia_term_edit_form');
127
  ?>
128
  </form>
 
 
 
 
 
 
129
 
130
  <div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
131
  <div class="modal-dialog">
4
  }
5
 
6
  /**
7
+ * Edit Category Form
8
  */
 
9
  $_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
10
  $_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
11
  $_module_preset = isset($term->meta['_module_preset'][0])? $term->meta['_module_preset'][0] : '';
12
  ?>
13
+ <form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body" data-id="<?php echo $term->term_id; ?>" action="<?php echo gm_get_admin_url(); ?>">
14
  <h4 style="margin-top:0;">
15
  <span class="pull-right"><?php echo __('ID', 'grand-media') . ": {$term->term_id}"; ?></span>
16
  <?php _e('Edit Category'); ?>: <em><?php echo esc_html($term->name); ?></em>
20
  <div class="col-xs-6">
21
  <div class="form-group">
22
  <label><?php _e('Name', 'grand-media'); ?></label>
23
+ <input type="text" class="form-control input-sm" name="term[name]" value="<?php esc_attr_e($term->name); ?>" placeholder="<?php _e('Category Name', 'grand-media'); ?>" required/>
24
  </div>
25
  <div class="form-group">
26
  <label><?php _e('Description', 'grand-media'); ?></label>
27
+ <?php
28
+ wp_editor(esc_textarea($term->description), "category{$term->term_id}_description", array('editor_class' => 'form-control input-sm',
29
+ 'editor_height' => 120,
30
+ 'wpautop' => false,
31
+ 'media_buttons' => false,
32
+ 'textarea_name' => 'term[description]',
33
+ 'textarea_rows' => '4',
34
+ 'tinymce' => false,
35
+ 'quicktags' => array('buttons' => apply_filters('gmedia_editor_quicktags', 'strong,em,link,ul,li,close'))
36
+ ));
37
+ ?>
38
  </div>
39
  <div class="text-right">
40
  <?php
57
  <option value="gmuid"<?php selected($_orderby, 'gmuid'); ?>><?php _e('by filename', 'grand-media'); ?></option>
58
  <option value="date"<?php selected($_orderby, 'date'); ?>><?php _e('by date', 'grand-media'); ?></option>
59
  <option value="modified"<?php selected($_orderby, 'modified'); ?>><?php _e('by last modified date', 'grand-media'); ?></option>
60
+ <option value="_created_timestamp" <?php selected($_orderby, '_created_timestamp'); ?>><?php _e('by created timestamp', 'grand-media'); ?></option>
61
+ <option value="comment_count" <?php selected($_orderby, 'comment_count'); ?>><?php _e('by comment count', 'grand-media'); ?></option>
62
+ <option value="views" <?php selected($_orderby, 'views'); ?>><?php _e('by views', 'grand-media'); ?></option>
63
+ <option value="likes" <?php selected($_orderby, 'likes'); ?>><?php _e('by likes', 'grand-media'); ?></option>
64
+ <option value="_size" <?php selected($_orderby, '_size'); ?>><?php _e('by file size', 'grand-media'); ?></option>
65
  <option value="rand"<?php selected($_orderby, 'rand'); ?>><?php _e('Random', 'grand-media'); ?></option>
66
  </select>
67
  </div>
111
  ?>
112
  </select>
113
  </div>
114
+ <p><a href="<?php echo $term->cloud_link?>" target="_blank"><?php _e('View GmediaCloud Page', 'grand-media'); ?></a></p>
115
  </div>
116
  <div class="col-xs-6">
117
  <?php $cover_id = isset($term->meta['_cover'][0])? $term->meta['_cover'][0] : ''; ?>
118
  <div class="form-group">
119
  <label><?php _e('Category Cover', 'grand-media'); ?></label>
120
+ <div class="input-group">
121
+ <input type="text" class="form-control input-sm gmedia-cover-id" name="term[meta][_cover]" value="<?php esc_attr_e($cover_id); ?>" placeholder="<?php _e('Gmedia Image ID', 'grand-media'); ?>"/>
122
+ <span class="input-group-btn"><a href="<?php echo $gmCore->get_admin_url(array('page' => 'GrandMedia', 'mode' => 'select_single', 'gmediablank' => 'library', 'filter' => 'image'), array(), true); ?>" class="btn btn-sm btn-primary preview-modal" data-target="#previewModal" data-width="1200" data-height="500" data-cls="select_gmedia_image" title="<?php _e('Choose Cover Image', 'grand-media'); ?>"><span class="glyphicon glyphicon-picture"></span></a></span>
123
+ </div>
124
  </div>
125
+ <div class="gm-img-thumbnail gmedia-cover-image"><?php
126
  if(($cover_id = intval($cover_id))){
127
+ if(($cover = $gmDB->get_gmedia($cover_id))){
128
+ ?><img src="<?php echo $gmCore->gm_get_media_image($cover, 'thumb', true); ?>" alt="" /><?php
129
+ } else{
 
 
 
130
  echo '<strong class="text-danger">' . __('No image with such ID', 'grand-media') . '</strong>';
131
  }
132
  }
133
+ ?></div>
134
  </div>
135
  </div>
136
  </div>
141
  do_action('gmedia_term_edit_form');
142
  ?>
143
  </form>
144
+ <form style="display:none;" id="gmedia-assign-term" autocomplete="off" method="post" action="<?php echo gm_get_admin_url(); ?>">
145
+ <input type="hidden" name="cat_names" value="<?php esc_attr_e($term->name); ?>">
146
+ <input type="hidden" name="cookie_key" value="gmedia_library:frame">
147
+ <input type="hidden" name="assign_category"/>
148
+ <?php wp_nonce_field('gmedia_action'); ?>
149
+ </form>
150
 
151
  <div class="modal fade gmedia-modal" id="newCustomFieldModal" tabindex="-1" role="dialog" aria-hidden="true">
152
  <div class="modal-dialog">
admin/pages/terms/tpl/category-list-item.php CHANGED
@@ -10,25 +10,23 @@ if(!defined('ABSPATH')) {
10
  */
11
  ?>
12
  <div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
13
- <div class="row cb_term-object">
14
- <div class="term_id">#<?php echo $item->term_id; ?></div>
15
  <div class="col-xs-6 term-label">
16
  <div class="checkbox">
17
  <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
18
  <?php if($item->allow_edit) { ?>
19
- <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>
20
  <?php } else { ?>
21
  <span class="term_name"><?php echo esc_html($item->name); ?></span>
22
  <?php } ?>
 
23
 
24
  <div class="object-actions">
25
  <?php $action_links = gmedia_term_item_actions($item);
26
- echo implode('', $action_links);
 
27
  ?>
28
  </div>
29
- <?php if(!empty($item->description)) { ?>
30
- <div class="term-description"><?php echo esc_html(nl2br($item->description)); ?></div>
31
- <?php } ?>
32
  </div>
33
  </div>
34
  <div class="col-xs-6">
10
  */
11
  ?>
12
  <div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
13
+ <div class="row cb_object">
 
14
  <div class="col-xs-6 term-label">
15
  <div class="checkbox">
16
  <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
17
  <?php if($item->allow_edit) { ?>
18
+ <a class="term_name" href="<?php echo add_query_arg(array('edit_term' => $item->term_id), $gmedia_url); ?>"><?php echo esc_html($item->name); ?></a>
19
  <?php } else { ?>
20
  <span class="term_name"><?php echo esc_html($item->name); ?></span>
21
  <?php } ?>
22
+ <br/><span class="term_id">ID: <?php echo $item->term_id; ?></span>
23
 
24
  <div class="object-actions">
25
  <?php $action_links = gmedia_term_item_actions($item);
26
+ echo $action_links['share'];
27
+ echo '<br/>' . $action_links['filter'] . $action_links['delete'];
28
  ?>
29
  </div>
 
 
 
30
  </div>
31
  </div>
32
  <div class="col-xs-6">
admin/pages/terms/tpl/category-preview-gmedia.php DELETED
@@ -1,59 +0,0 @@
1
- <?php // don't load directly
2
- if(!defined('ABSPATH')) {
3
- die('-1');
4
- }
5
-
6
- /**
7
- * Preview Gmedia in Category
8
- *
9
- * @var $term
10
- */
11
- if(!$term->count) {
12
- return;
13
- }
14
-
15
- global $gmDB, $gmCore, $gmGallery, $gmProcessor;
16
-
17
- $_orderby = isset($term->meta['_orderby'][0])? $term->meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
18
- $_order = isset($term->meta['_order'][0])? $term->meta['_order'][0] : $gmGallery->options['in_category_order'];
19
- $per_page = !empty($gmedia_user_options['per_page_sort_gmedia'])? $gmedia_user_options['per_page_sort_gmedia'] : 60;
20
- $cur_page = $gmCore->_get('pager', 1);
21
-
22
- $args = array(
23
- 'album__in' => $term->term_id,
24
- 'orderby' => $_orderby,
25
- 'order' => $_order,
26
- 'per_page' => $per_page,
27
- 'page' => $cur_page
28
- );
29
-
30
- $termItems = $gmDB->get_gmedias($args);
31
- $pager_html = $gmDB->query_pager();
32
-
33
-
34
- ?>
35
- <div class="panel panel-default">
36
- <div class="panel-heading clearfix">
37
- <h4 style="margin:7px 40px 7px 0;" class="pull-left"><?php _e('Category Preview'); ?></h4>
38
- <a class="btn btn-default" href="<?php echo add_query_arg(array('page' => 'GrandMedia', 'category__in' => $term->term_id), $gmProcessor->url); ?>"><?php _e('Open in Gmedia Library', 'grand-media'); ?></a>
39
- <?php echo $pager_html; ?></div>
40
- <div class="panel-body">
41
- <div class="termItems clearfix" id="termItems">
42
- <?php if(!empty($termItems)) {
43
- foreach($termItems as $item) {
44
- ?>
45
- <div class="gm-img-thumbnail" data-gmid="<?php echo $item->ID; ?>"><?php
46
- ?><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
47
- ?><span class="label label-default">ID: <?php echo $item->ID; ?></span><?php
48
- ?>
49
- <div class="gm-img-thumb-title"><?php echo esc_html($item->title); ?></div>
50
- </div>
51
- <?php
52
- }
53
- } ?>
54
- </div>
55
- </div>
56
- <div class="panel-footer clearfix" style="margin-top:20px;"><?php echo $pager_html; ?>
57
- <div class="well well-sm pull-left" style="margin:0;"><?php printf(__('Total items: %d'), $term->count); ?></div>
58
- </div>
59
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/pages/terms/tpl/tag-list-item.php CHANGED
@@ -10,26 +10,27 @@ if(!defined('ABSPATH')) {
10
  */
11
  ?>
12
  <div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
13
- <div class="row cb_term-object" id="tag_<?php echo $item->term_id; ?>">
14
- <div class="term_id">#<?php echo $item->term_id; ?></div>
15
  <div class="col-xs-6 term-label">
16
  <div class="checkbox">
17
  <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
18
  <?php if($item->allow_edit) { ?>
19
  <a class="edit_tag_link" href="#tag_<?php echo $item->term_id; ?>"><?php echo esc_html($item->name); ?></a>
20
- <span class="edit_tag_form" style="display:none;"><input class="edit_tag_input" type="text" data-tag_id="<?php echo $item->term_id; ?>" name="gmedia_tag_name[<?php echo $item->term_id; ?>]" value="<?php echo esc_attr($item->name); ?>" placeholder="<?php echo esc_attr($item->name); ?>"/><a href="#tag_<?php echo $item->term_id; ?>" class="edit_tag_save btn btn-link glyphicon glyphicon-pencil"></a></span>
21
  <?php } else { ?>
22
  <span><?php echo esc_html($item->name); ?></span>
23
  <?php } ?>
 
24
 
25
  <div class="object-actions">
26
  <?php $action_links = gmedia_term_item_actions($item);
27
- echo implode('', $action_links);
 
28
  ?>
29
  </div>
30
  </div>
31
  </div>
32
- <div class="col-xs-6 term-images">
33
  <?php gmedia_term_item_thumbnails($item); ?>
34
  </div>
35
  </div>
10
  */
11
  ?>
12
  <div class="cb_list-item list-group-item term-list-item <?php echo implode(' ', $item->classes); ?>">
13
+ <div class="row cb_object" id="tag_<?php echo $item->term_id; ?>">
 
14
  <div class="col-xs-6 term-label">
15
  <div class="checkbox">
16
  <input name="doaction[]" type="checkbox"<?php echo $item->selected? ' checked="checked"' : ''; ?> value="<?php echo $item->term_id; ?>"/>
17
  <?php if($item->allow_edit) { ?>
18
  <a class="edit_tag_link" href="#tag_<?php echo $item->term_id; ?>"><?php echo esc_html($item->name); ?></a>
19
+ <span class="edit_tag_form" style="display:none;"><input class="edit_tag_input" type="text" data-tag_id="<?php echo $item->term_id; ?>" name="gmedia_tag_name[<?php echo $item->term_id; ?>]" value="<?php esc_attr_e($item->name); ?>" placeholder="<?php esc_attr_e($item->name); ?>"/><a href="#tag_<?php echo $item->term_id; ?>" class="edit_tag_save btn btn-link glyphicon glyphicon-pencil"></a></span>
20
  <?php } else { ?>
21
  <span><?php echo esc_html($item->name); ?></span>
22
  <?php } ?>
23
+ <br/><span class="term_id">ID: <?php echo $item->term_id; ?></span>
24
 
25
  <div class="object-actions">
26
  <?php $action_links = gmedia_term_item_actions($item);
27
+ echo $action_links['share'];
28
+ echo '<br/>' . $action_links['filter'] . $action_links['delete'];
29
  ?>
30
  </div>
31
  </div>
32
  </div>
33
+ <div class="col-xs-6">
34
  <?php gmedia_term_item_thumbnails($item); ?>
35
  </div>
36
  </div>
admin/pages/terms/tpl/term-panel-heading.php CHANGED
@@ -1,23 +1,27 @@
1
  <?php // don't load directly
2
- if(!defined('ABSPATH')) {
3
  die('-1');
4
  }
5
 
6
  /**
7
  * Panel heading for term
8
- *
9
  * @var $term_id
10
  * @var $gmedia_term_taxonomy
11
  * @var $gmedia_terms_pager
12
  * @var $gmProcessor
 
13
  */
14
- $taxterm = str_replace('gmedia_', '', $gmedia_term_taxonomy);
 
 
 
15
  ?>
 
16
  <div class="panel-heading clearfix">
17
  <div class="btn-toolbar pull-left">
18
- <a class="btn btn-default pull-left" style="margin-right:20px;" href="<?php echo remove_query_arg(array('edit_item'), wp_get_referer()); ?>"><?php _e('Go Back', 'grand-media'); ?></a>
19
 
20
- <?php if($term_id) { ?>
21
  <div class="btn-group">
22
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
23
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@@ -27,10 +31,51 @@ $taxterm = str_replace('gmedia_', '', $gmedia_term_taxonomy);
27
  <ul class="dropdown-menu" role="menu">
28
  <?php $taxkey = $taxterm . '__in'; ?>
29
  <li><a href="<?php echo add_query_arg(array('page' => 'GrandMedia', $taxkey => $term->term_id), $gmProcessor->url); ?>"><?php _e('Show in Gmedia Library', 'grand-media'); ?></a></li>
 
 
 
 
 
 
 
30
  </ul>
31
  </div>
32
- <div class="term-shortcode pull-left"><input type="text" title="<?php _e('Shortcode'); ?>" class="form-control pull-left" value="<?php echo "[gm {$taxterm}={$term_id}]"; ?>" readonly /><div class="input-buffer"></div></div>
33
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </div>
35
 
36
  <div class="spinner"></div>
1
  <?php // don't load directly
2
+ if(!defined('ABSPATH')){
3
  die('-1');
4
  }
5
 
6
  /**
7
  * Panel heading for term
 
8
  * @var $term_id
9
  * @var $gmedia_term_taxonomy
10
  * @var $gmedia_terms_pager
11
  * @var $gmProcessor
12
+ * @var $gmCore
13
  */
14
+ $taxterm = $gmProcessor->taxterm;
15
+ $curpage = $gmCore->_get('page', 'GrandMedia');
16
+ $refurl = strpos(wp_get_referer(), "page={$curpage}")? wp_get_referer() : $gmProcessor->url;
17
+ $referer = remove_query_arg(array('edit_term'), $refurl);
18
  ?>
19
+ <div class="panel-heading-fake"></div>
20
  <div class="panel-heading clearfix">
21
  <div class="btn-toolbar pull-left">
22
+ <a class="btn btn-default pull-left" style="margin-right:20px;" href="<?php echo $referer; ?>"><?php _e('Go Back', 'grand-media'); ?></a>
23
 
24
+ <?php if($term_id){ ?>
25
  <div class="btn-group">
26
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
27
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
31
  <ul class="dropdown-menu" role="menu">
32
  <?php $taxkey = $taxterm . '__in'; ?>
33
  <li><a href="<?php echo add_query_arg(array('page' => 'GrandMedia', $taxkey => $term->term_id), $gmProcessor->url); ?>"><?php _e('Show in Gmedia Library', 'grand-media'); ?></a></li>
34
+ <?php
35
+ echo '<li' . (('draft' !== $term->status)? '' : ' class="disabled"') . '><a target="_blank" class="share-modal" data-target="#shareModal" data-share="' . $term->term_id . '" data-gmediacloud="' . $term->cloud_link . '" href="' . $term->post_link . '">' . __('Share', 'grand-media') . '</a></li>';
36
+
37
+ echo '<li' . ($term->allow_delete? '' : ' class="disabled"') . '><a href="' . wp_nonce_url(gm_get_admin_url(array('do_gmedia_terms' => 'delete',
38
+ 'ids' => $term->term_id
39
+ ), array('edit_term'), $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") . '">' . __('Delete', 'grand-media') . '</a></li>';
40
+ ?>
41
  </ul>
42
  </div>
43
+
44
+ <div class="btn-group" style="margin-left:20px;">
45
+ <?php
46
+ $add_args = array('page' => 'GrandMedia',
47
+ 'mode' => 'select_multiple',
48
+ 'gmediablank' => 'library'
49
+ );
50
+ $taxterm = $term->taxterm;
51
+ if('album' == $taxterm){
52
+ $add_args['album__in'] = 0;
53
+ } elseif('category' == $taxterm){
54
+ $add_args['category__not_in'] = $gmProcessor->edit_term;
55
+ }
56
+ echo '<a href="' . $gmCore->get_admin_url($add_args, array(), true) . '" class="btn btn-success preview-modal pull-left" data-target="#previewModal" data-width="1200" data-height="500" data-cls="select_gmedia assign_gmedia_term" data-title="' . __('Add from Library', 'grand-media') . '"><span class="glyphicon glyphicon-plus"></span> ' . __('Add from Library', 'grand-media') . '</a>';
57
+
58
+ if(gm_user_can('upload') && !$gmProcessor->gmediablank){
59
+ $args = array('page' => 'GrandMedia_AddMedia');
60
+ if($gmProcessor->edit_term){
61
+ $taxterm = $term->taxterm;
62
+ $args[ $taxterm ] = $gmProcessor->edit_term;
63
+ }
64
+ ?>
65
+ <a href="<?php echo gm_get_admin_url($args, array(), true); ?>" class="btn btn-success pull-left">
66
+ <span class="glyphicon glyphicon-upload" style="font-size: 130%;line-height: 0;vertical-align: sub;"></span> <?php _e('Upload', 'grand-media'); ?>
67
+ </a>
68
+ <?php
69
+ }
70
+ ?>
71
+ </div>
72
+
73
+ <div class="term-shortcode pull-left"><input type="text" title="<?php _e('Shortcode'); ?>" class="form-control pull-left" value="<?php echo "[gm {$taxterm}={$term_id}]"; ?>" readonly/>
74
+ <div class="input-buffer"></div>
75
+ </div>
76
+ <?php }
77
+ do_action('gmedia_term_btn_toolbar');
78
+ ?>
79
  </div>
80
 
81
  <div class="spinner"></div>
admin/pages/terms/tpl/terms-panel-heading.php CHANGED
@@ -1,11 +1,10 @@
1
  <?php // don't load directly
2
- if(!defined('ABSPATH')) {
3
  die('-1');
4
  }
5
 
6
  /**
7
  * Panel heading for terms
8
- *
9
  * @var $gmedia_term_taxonomy
10
  * @var $gmedia_terms_pager
11
  * @var $gmProcessor
@@ -30,7 +29,7 @@ if(!defined('ABSPATH')) {
30
  <div class="btn-toolbar pull-left" style="margin-bottom:7px;">
31
  <div class="btn-group gm-checkgroup" id="cb_global-btn">
32
  <span class="btn btn-default active"><input class="doaction" id="cb_global"
33
- data-group="cb_term-object" type="checkbox"/></span>
34
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
35
  <span class="caret"></span>
36
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
@@ -43,7 +42,7 @@ if(!defined('ABSPATH')) {
43
  </ul>
44
  </div>
45
 
46
- <?php if(!empty($gmedia_terms)) { ?>
47
  <div class="btn-group">
48
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
49
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@@ -57,33 +56,37 @@ if(!defined('ABSPATH')) {
57
  <ul class="dropdown-menu" role="menu">
58
  <li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php _e("Select items to see more actions", "grand-media"); ?></span></li>
59
  <li class="<?php echo $rel_selected_show . (gm_user_can('terms_delete')? '' : ' disabled'); ?>">
60
- <a href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete') ?>" class="gmedia-delete" data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Delete Selected Items', 'grand-media'); ?></a>
 
 
61
  </li>
62
  <?php do_action('gmedia_terms_action_list'); ?>
63
  </ul>
64
  </div>
65
 
66
  <?php
67
- $filter_selected = $gmCore->_req('filter');
 
 
68
  $filter_selected_arg = $filter_selected? false : 'selected';
69
  ?>
70
  <form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo add_query_arg(array('term' => $gmedia_term_taxonomy, 'filter' => $filter_selected_arg), $gmedia_url); ?>" method="post">
71
  <button type="submit" class="btn btn<?php echo ('selected' == $filter_selected)? '-success' : '-info' ?>"><?php printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
72
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
73
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
74
- <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="<?php echo $gmedia_term_taxonomy; ?>" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
75
  <ul class="dropdown-menu" role="menu">
76
  <li><a id="gm-selected-show" href="#show"><?php
77
- if(!$filter_selected) {
78
  _e('Show only selected items', 'grand-media');
79
- } else {
80
  _e('Show all gmedia items', 'grand-media');
81
  }
82
  ?></a></li>
83
  <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'grand-media'); ?></a></li>
84
  <?php /*
85
  <li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
86
- <a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" class="gmedia-modal"><?php _e('Quick Gallery from Selected', 'grand-media'); ?></a>
87
  </li>
88
  <?php */ ?>
89
  </ul>
1
  <?php // don't load directly
2
+ if(!defined('ABSPATH')){
3
  die('-1');
4
  }
5
 
6
  /**
7
  * Panel heading for terms
 
8
  * @var $gmedia_term_taxonomy
9
  * @var $gmedia_terms_pager
10
  * @var $gmProcessor
29
  <div class="btn-toolbar pull-left" style="margin-bottom:7px;">
30
  <div class="btn-group gm-checkgroup" id="cb_global-btn">
31
  <span class="btn btn-default active"><input class="doaction" id="cb_global"
32
+ data-group="cb_object" type="checkbox"/></span>
33
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
34
  <span class="caret"></span>
35
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span>
42
  </ul>
43
  </div>
44
 
45
+ <?php if(!empty($gmedia_terms)){ ?>
46
  <div class="btn-group">
47
  <a class="btn btn-default" href="#"><?php _e('Action', 'grand-media'); ?></a>
48
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
56
  <ul class="dropdown-menu" role="menu">
57
  <li class="dropdown-header <?php echo $rel_selected_hide; ?>"><span><?php _e("Select items to see more actions", "grand-media"); ?></span></li>
58
  <li class="<?php echo $rel_selected_show . (gm_user_can('terms_delete')? '' : ' disabled'); ?>">
59
+ <a href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('do_gmedia_terms' => 'delete',
60
+ 'ids' => 'selected'
61
+ ), array('filter')), 'gmedia_delete') ?>" class="gmedia-delete" data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "grand-media"); ?>"><?php _e('Delete Selected Items', 'grand-media'); ?></a>
62
  </li>
63
  <?php do_action('gmedia_terms_action_list'); ?>
64
  </ul>
65
  </div>
66
 
67
  <?php
68
+ do_action('gmedia_terms_btn_toolbar');
69
+
70
+ $filter_selected = $gmCore->_req('filter');
71
  $filter_selected_arg = $filter_selected? false : 'selected';
72
  ?>
73
  <form class="btn-group" id="gm-selected-btn" name="gm-selected-form" action="<?php echo add_query_arg(array('term' => $gmedia_term_taxonomy, 'filter' => $filter_selected_arg), $gmedia_url); ?>" method="post">
74
  <button type="submit" class="btn btn<?php echo ('selected' == $filter_selected)? '-success' : '-info' ?>"><?php printf(__('%s selected', 'grand-media'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
75
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span class="caret"></span>
76
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
77
+ <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="<?php echo GmediaProcessor_Terms::$cookie_key; ?>" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
78
  <ul class="dropdown-menu" role="menu">
79
  <li><a id="gm-selected-show" href="#show"><?php
80
+ if(!$filter_selected){
81
  _e('Show only selected items', 'grand-media');
82
+ } else{
83
  _e('Show all gmedia items', 'grand-media');
84
  }
85
  ?></a></li>
86
  <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'grand-media'); ?></a></li>
87
  <?php /*
88
  <li class="<?php echo gm_user_can('gallery_manage')? '' : 'disabled'; ?>">
89
+ <a href="#libModal" data-modal="quick_gallery" data-action="gmedia_get_modal" data-ckey="<?php echo GmediaProcessor_Terms::$cookie_key; ?>" class="gmedia-modal"><?php _e('Quick Gallery from Selected', 'grand-media'); ?></a>
90
  </li>
91
  <?php */ ?>
92
  </ul>
admin/processor/class.processor.addmedia.php CHANGED
@@ -5,6 +5,7 @@
5
  */
6
  class GmediaProcessor_AddMedia extends GmediaProcessor {
7
 
 
8
  public $url;
9
  public $import = false;
10
 
@@ -30,7 +31,14 @@ class GmediaProcessor_AddMedia extends GmediaProcessor {
30
 
31
  }
32
 
 
 
 
 
 
 
 
33
  }
34
 
35
- global $gmProcessor;
36
- $gmProcessor = new GmediaProcessor_AddMedia();
5
  */
6
  class GmediaProcessor_AddMedia extends GmediaProcessor {
7
 
8
+ private static $me = null;
9
  public $url;
10
  public $import = false;
11
 
31
 
32
  }
33
 
34
+ public static function getMe() {
35
+ if ( self::$me == null ) {
36
+ self::$me = new GmediaProcessor_AddMedia();
37
+ }
38
+
39
+ return self::$me;
40
+ }
41
  }
42
 
43
+ global $gmProcessorAddMedia;
44
+ $gmProcessorAddMedia = GmediaProcessor_AddMedia::getMe();
admin/processor/class.processor.galleries.php CHANGED
@@ -5,6 +5,7 @@
5
  */
6
  class GmediaProcessor_Galleries extends GmediaProcessor{
7
 
 
8
  public $taxonomy;
9
  public static $cookie_key = false;
10
  public $selected_items = array();
@@ -17,7 +18,7 @@ class GmediaProcessor_Galleries extends GmediaProcessor{
17
  global $user_ID;
18
 
19
  $this->taxonomy = 'gmedia_gallery';
20
- self::$cookie_key = "gmuser_{$user_ID}_{$this->taxonomy}";
21
  $this->selected_items = parent::selected_items(self::$cookie_key);
22
 
23
  parent::__construct();
@@ -92,7 +93,7 @@ class GmediaProcessor_Galleries extends GmediaProcessor{
92
  update_option('gmediaOptions', $gmGallery->options);
93
  }
94
 
95
- $edit_gallery = (int)$gmCore->_get('edit_item');
96
  do{
97
  $term = $gmCore->_post('term');
98
  if(((int)$term['global'] != $user_ID) && !$gmCore->caps['gmedia_edit_others_media']){
@@ -159,14 +160,14 @@ class GmediaProcessor_Galleries extends GmediaProcessor{
159
  if($edit_gallery){
160
  $this->msg[] = sprintf(__('Gallery #%d successfuly saved', 'grand-media'), $term_id);
161
  } else{
162
- $location = add_query_arg(array('edit_item' => $term_id, 'message' => 'save'), $this->url);
163
  set_transient('gmedia_new_gallery_id', $term_id, 60);
164
  wp_redirect($location);
165
  exit;
166
  }
167
  } while(0);
168
  }
169
- if(('save' == $gmCore->_get('message')) && ($term_id = $gmCore->_get('edit_item'))){
170
  $gmedia_new_gallery_id = get_transient('gmedia_new_gallery_id');
171
  if(false !== $gmedia_new_gallery_id){
172
  delete_transient('gmedia_new_gallery_id');
@@ -182,7 +183,7 @@ class GmediaProcessor_Galleries extends GmediaProcessor{
182
 
183
  if(isset($_POST['gmedia_gallery_reset'])){
184
  check_admin_referer('GmediaGallery');
185
- $edit_gallery = (int)$gmCore->_get('edit_item');
186
  do{
187
  if(!$gmDB->term_exists($edit_gallery)){
188
  $this->error[] = __('A term with the id provided do not exists', 'grand-media');
@@ -287,14 +288,12 @@ class GmediaProcessor_Galleries extends GmediaProcessor{
287
  } while(0);
288
  }
289
 
290
- if(($delete = $gmCore->_get('delete'))){
 
291
  check_admin_referer('gmedia_delete');
292
- $taxonomy = 'gmedia_gallery';
293
- if('selected' == $delete){
294
- $selected_items = $this->selected_items;
295
- } else{
296
- $selected_items = wp_parse_id_list($delete);
297
- }
298
  if(!$gmCore->caps['gmedia_delete_others_media']){
299
  $_selected_items = $gmDB->get_terms($taxonomy, array('fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items));
300
  if(count($_selected_items) < count($selected_items)){
@@ -316,15 +315,45 @@ class GmediaProcessor_Galleries extends GmediaProcessor{
316
  if($count){
317
  $this->msg[] = sprintf(__('%d item(s) deleted successfuly', 'grand-media'), $count);
318
  }
319
- setcookie("gmuser_{$user_ID}_{$taxonomy}", '', time() - 3600);
320
- unset($_COOKIE["gmuser_{$user_ID}_{$taxonomy}"]);
321
  $this->selected_items = array();
322
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
324
-
325
  }
326
 
 
 
 
 
 
 
 
327
  }
328
 
329
- global $gmProcessor;
330
- $gmProcessor = new GmediaProcessor_Galleries();
5
  */
6
  class GmediaProcessor_Galleries extends GmediaProcessor{
7
 
8
+ private static $me = null;
9
  public $taxonomy;
10
  public static $cookie_key = false;
11
  public $selected_items = array();
18
  global $user_ID;
19
 
20
  $this->taxonomy = 'gmedia_gallery';
21
+ self::$cookie_key = 'gmedia_terms:gallery';
22
  $this->selected_items = parent::selected_items(self::$cookie_key);
23
 
24
  parent::__construct();
93
  update_option('gmediaOptions', $gmGallery->options);
94
  }
95
 
96
+ $edit_gallery = (int)$gmCore->_get('edit_term');
97
  do{
98
  $term = $gmCore->_post('term');
99
  if(((int)$term['global'] != $user_ID) && !$gmCore->caps['gmedia_edit_others_media']){
160
  if($edit_gallery){
161
  $this->msg[] = sprintf(__('Gallery #%d successfuly saved', 'grand-media'), $term_id);
162
  } else{
163
+ $location = add_query_arg(array('edit_term' => $term_id, 'message' => 'save'), $this->url);
164
  set_transient('gmedia_new_gallery_id', $term_id, 60);
165
  wp_redirect($location);
166
  exit;
167
  }
168
  } while(0);
169
  }
170
+ if(('save' == $gmCore->_get('message')) && ($term_id = $gmCore->_get('edit_term'))){
171
  $gmedia_new_gallery_id = get_transient('gmedia_new_gallery_id');
172
  if(false !== $gmedia_new_gallery_id){
173
  delete_transient('gmedia_new_gallery_id');
183
 
184
  if(isset($_POST['gmedia_gallery_reset'])){
185
  check_admin_referer('GmediaGallery');
186
+ $edit_gallery = (int)$gmCore->_get('edit_term');
187
  do{
188
  if(!$gmDB->term_exists($edit_gallery)){
189
  $this->error[] = __('A term with the id provided do not exists', 'grand-media');
288
  } while(0);
289
  }
290
 
291
+ $do_gmedia_terms = $gmCore->_get('do_gmedia_terms');
292
+ if('delete' == $do_gmedia_terms){
293
  check_admin_referer('gmedia_delete');
294
+ $taxonomy = 'gmedia_gallery';
295
+ $ids = $gmCore->_get('ids', 'selected');
296
+ $selected_items = ('selected' == $ids)? $this->selected_items : wp_parse_id_list($ids);
 
 
 
297
  if(!$gmCore->caps['gmedia_delete_others_media']){
298
  $_selected_items = $gmDB->get_terms($taxonomy, array('fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items));
299
  if(count($_selected_items) < count($selected_items)){
315
  if($count){
316
  $this->msg[] = sprintf(__('%d item(s) deleted successfuly', 'grand-media'), $count);
317
  }
318
+ setcookie(self::$cookie_key, '', time() - 3600);
319
+ unset($_COOKIE[ self::$cookie_key ]);
320
  $this->selected_items = array();
321
  }
322
+ if(!empty($this->msg)){
323
+ set_transient('gmedia_action_msg', $this->msg, 30);
324
+ }
325
+ if(!empty($this->error)){
326
+ set_transient('gmedia_action_error', $this->error, 30);
327
+ }
328
+ }
329
+ if($do_gmedia_terms){
330
+ $location = remove_query_arg(array('do_gmedia_terms', 'ids', '_wpnonce'));
331
+ $location = add_query_arg('did_gmedia_terms', $do_gmedia_terms, $location);
332
+ wp_redirect($location);
333
+ exit;
334
+ }
335
+ if($gmCore->_get('did_gmedia_terms')){
336
+ $msg = get_transient('gmedia_action_msg');
337
+ if($msg){
338
+ delete_transient('gmedia_action_msg');
339
+ $this->msg = $msg;
340
+ }
341
+ $error = get_transient('gmedia_action_error');
342
+ if($error){
343
+ delete_transient('gmedia_action_error');
344
+ $this->error = $error;
345
+ }
346
  }
 
347
  }
348
 
349
+ public static function getMe(){
350
+ if(self::$me == null){
351
+ self::$me = new GmediaProcessor_Galleries();
352
+ }
353
+
354
+ return self::$me;
355
+ }
356
  }
357
 
358
+ global $gmProcessorGalleries;
359
+ $gmProcessorGalleries = GmediaProcessor_Galleries::getMe();
admin/processor/class.processor.library.php CHANGED
@@ -3,8 +3,9 @@
3
  /**
4
  * GmediaProcessor_Library
5
  */
6
- class GmediaProcessor_Library extends GmediaProcessor {
7
 
 
8
  public static $cookie_key = false;
9
  public $mode = false;
10
  public $selected_items = array();
@@ -15,30 +16,69 @@ class GmediaProcessor_Library extends GmediaProcessor {
15
  /**
16
  * GmediaProcessor_Library constructor.
17
  */
18
- public function __construct() {
19
  parent::__construct();
20
 
21
  global $gmCore;
22
 
23
- $user_ID = get_current_user_id();
24
- self::$cookie_key = "gmuser_{$user_ID}_library";
25
- $this->mode = $gmCore->_get('mode', false);
26
- $this->url = add_query_arg(array('mode' => $this->mode), $this->url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  $this->selected_items = parent::selected_items(self::$cookie_key);
28
- $this->stack_items = parent::selected_items("gmuser_{$user_ID}_library_stack", 'stack_items');
29
 
 
30
  }
31
 
32
  /**
33
  * @return array
34
  */
35
- public function query_args() {
36
- global $gmCore, $gmDB, $user_ID;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  $args['mime_type'] = $gmCore->_get('mime_type');
39
  $args['status'] = $gmCore->_get('status');
40
  $args['page'] = $gmCore->_get('pager');
41
- $args['per_page'] = $gmCore->_get('per_page', $this->user_options['per_page_gmedia']);
42
  $args['author__in'] = parent::filter_by_author($gmCore->_get('author'));
43
  $args['alb'] = $gmCore->_get('alb');
44
  $args['album__in'] = $gmCore->_get('album__in');
@@ -52,38 +92,43 @@ class GmediaProcessor_Library extends GmediaProcessor {
52
  $args['category__and'] = $gmCore->_get('category__and');
53
  $args['gmedia__in'] = $gmCore->_get('gmedia__in');
54
  $args['s'] = $gmCore->_get('s');
55
- $args['orderby'] = $gmCore->_get('orderby', $this->user_options['orderby_gmedia']);
56
- $args['order'] = $gmCore->_get('order', $this->user_options['sortorder_gmedia']);
57
-
58
- if('duplicates' === $args['gmedia__in']) {
59
- $duplicates = $gmDB->get_duplicates();
60
- $args['gmedia__in'] = $duplicates['duplicate_ids'];
61
- $args['orderby'] = 'gmedia__in';
62
-
63
- setcookie("gmuser_{$user_ID}_library", implode(',', $duplicates['duplicate_select']));
64
- $_COOKIE["gmuser_{$user_ID}_library"] = implode(',', $duplicates['duplicate_select']);
65
- $this->selected_items = $duplicates['duplicate_select'];
 
 
 
 
 
66
  }
67
 
68
- if($args['s'] && ('#' == substr($args['s'], 0, 1))) {
69
  $args['gmedia__in'] = substr($args['s'], 1);
70
  $args['s'] = false;
71
  }
72
 
73
  $show_stack = false;
74
- if(('show' == $gmCore->_req('stack')) && !empty($this->stack_items)) {
75
  $args['gmedia__in'] = $this->stack_items;
76
  $args['orderby'] = $gmCore->_get('orderby', 'gmedia__in');
77
  $args['order'] = $gmCore->_get('order', 'ASC');
78
  $show_stack = true;
79
  }
80
- if(('selected' == $gmCore->_req('filter')) && !empty($this->selected_items)) {
81
- if($show_stack) {
82
  $stack_items = wp_parse_id_list($this->stack_items);
83
  $selected_items = wp_parse_id_list($this->selected_items);
84
  $gmedia_in = array_intersect($stack_items, $selected_items);
85
  $args['gmedia__in'] = $gmedia_in;
86
- } else {
87
  $args['gmedia__in'] = $this->selected_items;
88
  $args['orderby'] = $gmCore->_get('orderby', 'gmedia__in');
89
  $args['order'] = $gmCore->_get('order', 'ASC');
@@ -92,81 +137,114 @@ class GmediaProcessor_Library extends GmediaProcessor {
92
 
93
  $query_args = apply_filters('gmedia_library_query_args', $args);
94
 
95
- foreach($query_args as $key => $val) {
96
- if(empty($val) && ('0' !== $val) && (0 !== $val)) {
97
- unset($query_args[$key]);
98
  }
99
  }
100
 
101
- if(!empty($query_args['author__in']) && $gmCore->caps['gmedia_show_others_media']) {
102
  $authors_names = $query_args['author__in'];
103
- foreach($authors_names as $i => $id) {
104
  if((int)$id){
105
  $authors_names[ $i ] = get_the_author_meta('display_name', $id);
106
  }
107
  }
108
- $this->filters['filter_author'] = array(
109
- 'title' => __('Filter Author', 'grand-media'),
110
- 'filter' => $authors_names
111
  );
112
  }
113
 
114
  $gmDB->gmedias_album_stuff($query_args);
115
- if(!empty($query_args['album__in'])) {
116
- $albums_names = $gmDB->get_terms('gmedia_album', array('fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['album__in']));
117
- if(!empty($albums_names)) {
118
- $this->filters['filter_albums'] = array(
119
- 'title' => __('Filter Album', 'grand-media'),
120
- 'filter' => $albums_names
 
 
 
 
 
 
 
 
 
121
  );
122
  }
123
  }
124
- if(!empty($query_args['album__not_in'])) {
125
- $albums_names = $gmDB->get_terms('gmedia_album', array('fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['album__not_in']));
126
- if(!empty($albums_names)) {
127
- $this->filters['exclude_albums'] = array(
128
- 'title' => __('Exclude Album', 'grand-media'),
129
- 'filter' => $albums_names
 
 
 
 
 
 
 
 
 
130
  );
131
  }
132
  }
133
 
134
  $gmDB->gmedias_category_stuff($query_args);
135
- if(!empty($query_args['category__in'])) {
136
- $category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__in']));
137
- if(!empty($category_names)) {
138
- $this->filters['filter_categories'] = array(
139
- 'title' => __('Filter Category', 'grand-media'),
140
- 'filter' => $category_names
 
 
 
 
 
 
 
 
 
141
  );
142
  }
143
  }
144
- if(!empty($query_args['category__not_in'])) {
145
- $category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__not_in']));
146
- if(!empty($category_names)) {
147
- $this->filters['exclude_categories'] = array(
148
- 'title' => __('Exclude Category', 'grand-media'),
149
- 'filter' => $category_names
 
 
 
 
 
 
 
 
 
150
  );
151
  }
152
  }
153
 
154
  $gmDB->gmedias_tag_stuff($query_args);
155
- if(!empty($query_args['tag__in'])) {
156
  $tag_names = $gmDB->get_terms('gmedia_tag', array('fields' => 'names', 'include' => $query_args['tag__in']));
157
- if(!empty($tag_names)) {
158
- $this->filters['filter_tags'] = array(
159
- 'title' => __('Filter Tag', 'grand-media'),
160
- 'filter' => $tag_names
161
  );
162
  }
163
  }
164
- if(!empty($query_args['tag__not_in'])) {
165
  $tag_names = $gmDB->get_terms('gmedia_tag', array('fields' => 'names', 'include' => $query_args['tag__not_in']));
166
- if(!empty($tag_names)) {
167
- $this->filters['exclude_tags'] = array(
168
- 'title' => __('Exclude Tag', 'grand-media'),
169
- 'filter' => $tag_names
170
  );
171
  }
172
  }
@@ -174,19 +252,22 @@ class GmediaProcessor_Library extends GmediaProcessor {
174
  return $query_args;
175
  }
176
 
177
- protected function processor() {
178
  global $user_ID, $gmCore, $gmDB, $gmGallery;
179
 
180
- if(!$gmCore->caps['gmedia_library']) {
181
  wp_die(__('You are not allowed to be here', 'grand-media'));
182
  }
183
 
184
  include_once(GMEDIA_ABSPATH . 'admin/pages/library/functions.php');
185
 
186
- if(isset($_GET['display_mode'])) {
 
 
 
187
  $display_mode = $_GET['display_mode'];
188
- if(in_array($display_mode, array('grid', 'list'))) {
189
- $view = $this->gmediablank? '_frame' : '';
190
  $this->user_options = array_merge($this->user_options, array("display_mode_gmedia{$view}" => $display_mode));
191
  update_user_meta($user_ID, 'gm_screen_options', $this->user_options);
192
  }
@@ -195,10 +276,10 @@ class GmediaProcessor_Library extends GmediaProcessor {
195
  exit;
196
  }
197
 
198
- if(isset($_GET['grid_cell_fit'])) {
199
  $this->user_options['grid_cell_fit_gmedia'] = !$this->user_options['grid_cell_fit_gmedia'];
200
  update_user_meta($user_ID, 'gm_screen_options', $this->user_options);
201
- if(isset($_GET['ajaxload'])) {
202
  exit;
203
  }
204
  $location = remove_query_arg('grid_cell_fit');
@@ -206,12 +287,12 @@ class GmediaProcessor_Library extends GmediaProcessor {
206
  exit;
207
  }
208
 
209
- if(isset($_GET['gallery'])) {
210
- $location = $this->url;
211
  $gallery_id = $gmCore->_get('gallery');
212
- if($gallery_id) {
213
  $gallery_query = $gmDB->get_metadata('gmedia_term', $gallery_id, '_query', true);
214
- $location = add_query_arg($gallery_query, $location);
215
  }
216
  wp_redirect($location);
217
  exit;
@@ -220,132 +301,127 @@ class GmediaProcessor_Library extends GmediaProcessor {
220
  $this->query_args = $this->query_args();
221
 
222
 
223
- if(isset($_POST['quick_gallery'])) {
224
- check_admin_referer('gmedia_modal');
225
- do {
226
- if(!$gmCore->caps['gmedia_gallery_manage']) {
227
  $this->error[] = __('You are not allowed to manage galleries', 'grand-media');
228
  break;
229
  }
230
  $gallery = $gmCore->_post('gallery');
231
  $gallery['name'] = trim($gallery['name']);
232
- if(empty($gallery['name'])) {
233
  $this->error[] = __('Gallery Name is not specified', 'grand-media');
234
  break;
235
  }
236
- if($gmCore->is_digit($gallery['name'])) {
237
  $this->error[] = __("Gallery name can't be only digits", 'grand-media');
238
  break;
239
  }
240
- if(empty($gallery['query']['gmedia__in'])) {
241
  $this->error[] = __('Choose gmedia from library for quick gallery', 'grand-media');
242
  break;
243
  }
244
  $taxonomy = 'gmedia_gallery';
245
- if(($term_id = $gmDB->term_exists($gallery['name'], $taxonomy))) {
246
  $this->error[] = __('A term with the name provided already exists', 'grand-media');
247
  break;
248
  }
249
  $term_id = $gmDB->insert_term($gallery['name'], $taxonomy);
250
- if(is_wp_error($term_id)) {
251
  $this->error[] = $term_id->get_error_message();
252
  break;
253
  }
254
- $getModulePreset = $gmCore->getModulePreset($gallery['module']);
255
  $gallery['query'] = array_merge($gallery['query'], array('order' => 'ASC', 'orderby' => 'gmedia__in'));
256
 
257
- $gallery_meta = array(
258
- '_edited' => gmdate('Y-m-d H:i:s'),
259
- '_query' => $gallery['query'],
260
- '_module' => $getModulePreset['module'],
261
- '_settings' => $getModulePreset['settings']
262
  );
263
- foreach($gallery_meta as $key => $value) {
264
  $gmDB->update_metadata('gmedia_term', $term_id, $key, $value);
265
  }
266
  $this->msg[] = sprintf(__('Gallery "%s" successfuly saved. Shortcode: [gmedia id=%d]', 'grand-media'), esc_attr($gallery['name']), $term_id);
267
  } while(0);
268
  }
269
 
270
- if(isset($_POST['filter_categories'])) {
271
- if(false !== ($term = $gmCore->_post('cat'))) {
272
  $location = add_query_arg(array('category__in' => implode(',', $term)), $this->url);
273
  wp_redirect($location);
274
  exit;
275
  }
276
  }
277
- if(isset($_POST['filter_albums'])) {
278
- if(false !== ($term = $gmCore->_post('alb'))) {
279
  $location = add_query_arg(array('album__in' => implode(',', $term)), $this->url);
280
  wp_redirect($location);
281
  exit;
282
  }
283
  }
284
- if(isset($_POST['filter_tags'])) {
285
- if(false !== ($term = $gmCore->_post('tag_ids'))) {
286
  $location = add_query_arg(array('tag__in' => $term), $this->url);
287
  wp_redirect($location);
288
  exit;
289
  }
290
  }
291
- if(isset($_POST['custom_filter'])) {
292
- if(false !== ($term = $gmCore->_post('custom_filter_id'))) {
293
- $location = add_query_arg(array('custom_filter' => $term), $this->url);
294
- wp_redirect($location);
295
- exit;
296
- }
297
- }
298
- if(isset($_POST['filter_author'])) {
299
  $authors = $gmCore->_post('author_ids');
300
  $location = add_query_arg(array('author' => (int)$authors), $this->url);
301
  wp_redirect($location);
302
  exit;
303
  }
304
 
305
- if(!empty($this->selected_items)) {
306
- if(isset($_POST['assign_album'])) {
307
- check_admin_referer('gmedia_modal');
308
- if($gmCore->caps['gmedia_terms']) {
309
- if(!$gmCore->caps['gmedia_edit_others_media']) {
310
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
311
- if(count($selected_items) < count($this->selected_items)) {
 
 
 
312
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
313
  }
314
- } else {
315
- $selected_items = $this->selected_items;
316
  }
317
  $term = $gmCore->_post('alb');
318
- if((false !== $term) && ($count = count($selected_items))) {
319
- if(empty($term)) {
320
- foreach($selected_items as $item) {
321
  $gmDB->delete_gmedia_term_relationships($item, 'gmedia_album');
322
  }
323
  $this->msg[] = sprintf(__('%d item(s) updated with "No Album"', 'grand-media'), $count);
324
- } else {
325
  $term_ids = array();
326
- foreach($selected_items as $item) {
327
  $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_album', $append = 0);
328
- if(is_wp_error($result)) {
329
  $this->error[] = $result;
330
- } elseif($result) {
331
- foreach($result as $t_id) {
332
- $term_ids[$t_id][] = $item;
333
  }
334
  }
335
  }
336
- if(!empty($term_ids)) {
337
  global $wpdb;
338
 
339
- foreach($term_ids as $term_id => $item_ids) {
340
  $term = $gmDB->get_term($term_id);
341
- if(isset($_POST['status_global'])) {
342
  $values = array();
343
- foreach($selected_items as $item) {
344
  $values[] = $wpdb->prepare("%d", $item);
345
  }
346
- if($values) {
347
  $status = esc_sql($term->status);
348
- if(false === $wpdb->query("UPDATE {$wpdb->prefix}gmedia SET status = '{$status}' WHERE ID IN (" . join(',', $values) . ")")) {
349
  $this->error[] = __('Could not update statuses for gmedia items in the database');
350
  }
351
  }
@@ -355,159 +431,174 @@ class GmediaProcessor_Library extends GmediaProcessor {
355
  }
356
  }
357
 
358
- $this->selected_items = $this->clear_selected_items('library');
 
359
  }
360
- } else {
361
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
362
  }
363
  }
364
- if(isset($_POST['assign_category'])) {
365
- check_admin_referer('gmedia_modal');
366
- if($gmCore->caps['gmedia_terms']) {
367
- if(!$gmCore->caps['gmedia_edit_others_media']) {
368
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
369
- if(count($selected_items) < count($this->selected_items)) {
 
 
370
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
371
  }
372
- } else {
373
- $selected_items = $this->selected_items;
374
  }
375
  $term = $gmCore->_post('cat_names');
376
  $term = explode(',', $term);
377
- if(!empty($term) && ($count = count($selected_items))) {
378
- foreach($selected_items as $item) {
379
  $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = 1);
380
- if(is_wp_error($result)) {
381
  $this->error[] = $result;
382
- $count--;
383
- } elseif(!$result) {
384
- $count--;
385
  }
386
  }
387
 
388
  $this->msg[] = sprintf(__("Categories assigned to %d image(s).", 'grand-media'), $count);
389
 
390
- $this->selected_items = $this->clear_selected_items('library');
 
391
  }
392
- } else {
393
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
394
  }
395
  }
396
- if(isset($_POST['unassign_category'])) {
397
- check_admin_referer('gmedia_modal');
398
- if(($term = $gmCore->_post('category_id')) && $gmCore->caps['gmedia_terms']) {
399
- if(!$gmCore->caps['gmedia_edit_others_media']) {
400
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
401
- if(count($selected_items) < count($this->selected_items)) {
 
 
402
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
403
  }
404
- } else {
405
- $selected_items = $this->selected_items;
406
  }
407
  $term = array_map('intval', $term);
408
- if(($count = count($selected_items))) {
409
- foreach($selected_items as $item) {
410
- $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = -1);
411
- if(is_wp_error($result)) {
412
  $this->error[] = $result;
413
- $count--;
414
- } elseif(!$result) {
415
- $count--;
416
  }
417
  }
418
  $this->msg[] = sprintf(__('%d category(ies) deleted from %d item(s)', 'grand-media'), count($term), $count);
419
 
420
- $this->selected_items = $this->clear_selected_items('library');
 
421
  }
422
- } else {
423
- $this->error[] = __('You are not allowed to assign terms', 'grand-media');
424
  }
425
  }
426
- if(isset($_POST['add_tags'])) {
427
- check_admin_referer('gmedia_modal');
428
- if(!$gmCore->caps['gmedia_terms']) {
429
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
430
- } else {
431
  $term = $gmCore->_post('tag_names');
432
  $iptc_tags = $gmCore->_post('iptc_tags');
433
- if($term || $iptc_tags) {
434
- if(!$gmCore->caps['gmedia_edit_others_media']) {
435
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
436
- if(count($selected_items) < count($this->selected_items)) {
 
 
437
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
438
  }
439
- } else {
440
- $selected_items = $this->selected_items;
441
  }
442
  $term = explode(',', $term);
443
- if(($count = count($selected_items))) {
444
- foreach($selected_items as $item) {
445
  $_term = $term;
446
- if($iptc_tags) {
447
  $_metadata = $gmDB->get_metadata('gmedia', $item, '_metadata', true);
448
- if(isset($_metadata['image_meta']['keywords']) && is_array($_metadata['image_meta']['keywords'])) {
449
  $_term = array_merge($_metadata['image_meta']['keywords'], $term);
450
  }
451
  }
452
  $result = $gmDB->set_gmedia_terms($item, $_term, 'gmedia_tag', $append = 1);
453
- if(is_wp_error($result)) {
454
  $this->error[] = $result;
455
- $count--;
456
- } elseif(!$result) {
457
- $count--;
458
  }
459
  }
460
  $this->msg[] = sprintf(__('Tags added to %d item(s)', 'grand-media'), $count);
461
 
462
- $this->selected_items = $this->clear_selected_items('library');
 
463
  }
464
- } else {
465
  $this->error[] = __('No tags specified', 'grand-media');
466
  }
467
  }
468
  }
469
- if(isset($_POST['delete_tags'])) {
470
- check_admin_referer('gmedia_modal');
471
- if(($term = $gmCore->_post('tag_id')) && $gmCore->caps['gmedia_terms']) {
472
- if(!$gmCore->caps['gmedia_edit_others_media']) {
473
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
474
- if(count($selected_items) < count($this->selected_items)) {
 
 
475
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
476
  }
477
- } else {
478
- $selected_items = $this->selected_items;
479
  }
480
  $term = array_map('intval', $term);
481
- if(($count = count($selected_items))) {
482
- foreach($selected_items as $item) {
483
- $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_tag', $append = -1);
484
- if(is_wp_error($result)) {
485
  $this->error[] = $result;
486
- $count--;
487
- } elseif(!$result) {
488
- $count--;
489
  }
490
  }
491
  $this->msg[] = sprintf(__('%d tag(s) deleted from %d item(s)', 'grand-media'), count($term), $count);
492
 
493
- $this->selected_items = $this->clear_selected_items('library');
 
494
  }
495
- } else {
496
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
497
  }
498
  }
499
- if(isset($_POST['batch_edit'])) {
500
- check_admin_referer('gmedia_modal');
501
- if($gmCore->caps['gmedia_edit_media']) {
502
- if(!$gmCore->caps['gmedia_edit_others_media']) {
503
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $this->selected_items));
504
- if(count($selected_items) < count($this->selected_items)) {
 
 
505
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
506
  }
507
- } else {
508
- $selected_items = $this->selected_items;
509
  }
510
- if(($count = count($selected_items))) {
511
  $batch_data = array();
512
  $b_filename = $gmCore->_post('batch_filename');
513
  $b_title = $gmCore->_post('batch_title');
@@ -515,51 +606,53 @@ class GmediaProcessor_Library extends GmediaProcessor {
515
  $b_link = $gmCore->_post('batch_link');
516
  $b_status = $gmCore->_post('batch_status');
517
  $b_comment_status = $gmCore->_post('batch_comment_status');
518
- if($b_status) {
519
  $batch_data['status'] = $b_status;
520
  }
521
- if($b_comment_status) {
522
  $batch_data['comment_status'] = $b_comment_status;
523
  }
524
  $b_author = $gmCore->_post('batch_author');
525
- if($b_author && ('-1' != $b_author)) {
526
  $batch_data['author'] = $b_author;
527
  }
528
  $i = 0;
529
- foreach($selected_items as $item) {
530
  $id = (int)$item;
531
  $gmedia = $gmDB->get_gmedia($id, ARRAY_A);
532
  $item_author = (int)$gmedia['author'];
533
 
534
- if('custom' == $b_filename && ($gmCore->caps['gmedia_delete_others_media'] || ($item_author == $user_ID))) {
535
  $filename_custom = $gmCore->_post('batch_filename_custom');
536
- if(!empty($filename_custom) && ('{filename}' !== $filename_custom)) {
537
 
538
  $gmuid = pathinfo($gmedia['gmuid']);
539
 
540
  $filename_vars = array('{filename}' => $gmuid['filename'], '{id}' => $gmedia['ID']);
541
- if(preg_match_all('/{index[:]?(\d+)?}/', $filename_custom, $matches_all)) {
542
- foreach($matches_all[0] as $key => $matches) {
543
- $index = intval($matches_all[1][$key]) + $i;
544
- $filename_vars[$matches] = $index;
 
 
545
  }
546
  }
547
  $filename_custom = strtr($filename_custom, $filename_vars);
548
 
549
  $filename_custom = preg_replace('/[^a-z0-9_\.-]+/i', '_', $filename_custom);
550
- if($filename_custom && $filename_custom != $gmuid['filename']) {
551
  $fileinfo = $gmCore->fileinfo($filename_custom . '.' . $gmuid['extension']);
552
- if(false !== $fileinfo) {
553
- if('image' == $fileinfo['dirname']) {
554
  /** WordPress Image Administration API */
555
  require_once(ABSPATH . 'wp-admin/includes/image.php');
556
 
557
- if(file_is_displayable_image($fileinfo['dirpath'] . '/' . $gmedia['gmuid'])) {
558
  @rename($fileinfo['dirpath_original'] . '/' . $gmedia['gmuid'], $fileinfo['filepath_original']);
559
  @rename($fileinfo['dirpath_thumb'] . '/' . $gmedia['gmuid'], $fileinfo['filepath_thumb']);
560
  }
561
  }
562
- if(@rename($fileinfo['dirpath'] . '/' . $gmedia['gmuid'], $fileinfo['filepath'])) {
563
  $gmedia['gmuid'] = $fileinfo['basename'];
564
  $batch_data['gmuid'] = $fileinfo['basename'];
565
  }
@@ -567,47 +660,50 @@ class GmediaProcessor_Library extends GmediaProcessor {
567
  }
568
  }
569
  }
570
- switch($b_title) {
571
  case 'empty':
572
  $batch_data['title'] = '';
573
  break;
574
  case 'filename':
575
  $title = pathinfo($gmedia['gmuid'], PATHINFO_FILENAME);
576
- $batch_data['title'] = ucwords(str_replace('_', ' ', $title));
 
 
 
577
  break;
578
  case 'custom':
579
  $title_custom = $gmCore->_post('batch_title_custom');
580
- if(false !== $title_custom) {
581
  $batch_data['title'] = $title_custom;
582
  }
583
  break;
584
  }
585
- switch($b_description) {
586
  case 'empty':
587
  $batch_data['description'] = '';
588
  break;
589
  case 'metadata':
590
  $metatext = $gmCore->metadata_text($id);
591
- if($gmedia['description']) {
592
  $gmedia['description'] .= "\n";
593
  }
594
  $batch_data['description'] = $gmedia['description'] . $metatext;
595
  break;
596
  case 'custom':
597
  $description_custom = $gmCore->_post('batch_description_custom');
598
- if(false !== $description_custom) {
599
  $what_description_custom = $gmCore->_post('what_description_custom');
600
- if('replace' == $what_description_custom) {
601
  $batch_data['description'] = $description_custom;
602
- } elseif('append' == $what_description_custom) {
603
  $batch_data['description'] = $gmedia['description'] . $description_custom;
604
- } elseif('prepend' == $what_description_custom) {
605
  $batch_data['description'] = $description_custom . $gmedia['description'];
606
  }
607
  }
608
  break;
609
  }
610
- switch($b_link) {
611
  case 'empty':
612
  $batch_data['link'] = '';
613
  break;
@@ -617,151 +713,255 @@ class GmediaProcessor_Library extends GmediaProcessor {
617
  break;
618
  case 'custom':
619
  $link_custom = $gmCore->_post('batch_link_custom');
620
- if(false !== $link_custom) {
621
  $batch_data['link'] = $link_custom;
622
  }
623
  break;
624
  }
625
- if(!empty($batch_data)) {
626
  $batch_data['modified'] = current_time('mysql');
627
  $gmedia_data = array_merge($gmedia, $batch_data);
628
  $gmDB->insert_gmedia($gmedia_data);
629
- } else {
630
- $count--;
631
  }
632
 
633
- $i++;
634
  }
635
  $this->msg[] = sprintf(__('%d item(s) updated successfuly', 'grand-media'), $count);
636
 
637
- $this->selected_items = $this->clear_selected_items('library');
 
638
  }
639
- } else {
640
  $this->error[] = __('You are not allowed to edit media', 'grand-media');
641
  }
642
  }
643
- if('selected' == $gmCore->_get('update_meta')) {
644
- check_admin_referer('gmedia_update_meta');
645
- if($gmCore->caps['gmedia_edit_media']) {
646
- $count = count($this->selected_items);
647
- if($count) {
648
- foreach($this->selected_items as $item) {
649
- $id = (int)$item;
650
- $media_metadata = $gmDB->generate_gmedia_metadata($id);
651
- $gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_metadata', $media_metadata);
652
- if(!empty($media_metadata['image_meta']['created_timestamp'])) {
653
- $gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_created_timestamp', $media_metadata['image_meta']['created_timestamp']);
654
  }
655
- if(!empty($media_metadata['image_meta']['GPS'])) {
656
- $gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_gps', $media_metadata['image_meta']['GPS']);
 
 
 
 
657
  }
 
 
 
 
 
658
  }
659
- $this->msg[] = sprintf(__('%d item(s) updated successfuly', 'grand-media'), $count);
 
 
660
  }
661
- $this->selected_items = $this->clear_selected_items('library');
662
- } else {
663
- $this->error[] = __('You are not allowed to edit media', 'grand-media');
664
  }
665
- }
666
- if('selected' == $gmCore->_get('recreate')) {
667
- check_admin_referer('gmedia_recreate');
668
- if($gmCore->caps['gmedia_edit_media']) {
669
- $selected_items = $this->selected_items;
670
- $count = count($selected_items);
671
- if($count) {
672
- if(!$gmCore->caps['gmedia_edit_others_media']) {
673
- $edit_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'mime_type' => 'image', 'gmedia__in' => $selected_items));
674
- $selected_items = $edit_items;
675
- } else {
676
- $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'mime_type' => 'image', 'gmedia__in' => $selected_items));
 
 
 
 
 
 
 
 
677
  }
678
- if(($count = count($selected_items))) {
679
- $ajax_operations = get_option('gmedia_ajax_long_operations', array());
680
- foreach($selected_items as $si){
681
- $ajax_operations['gmedia_recreate_images'][$si] = $si;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
682
  }
683
- update_option('gmedia_ajax_long_operations', $ajax_operations);
684
- $this->msg[] = sprintf(__('You\'ve added 4 image(s) to the re-creation queue.', 'grand-media'), $count);
685
  }
 
 
 
 
 
686
  }
687
- $this->selected_items = $this->clear_selected_items('library');
688
- } else {
689
- $this->error[] = __('You are not allowed to edit media', 'grand-media');
690
  }
691
  }
692
  }
693
- if(($duplicate_gmedia = $gmCore->_get('duplicate'))) {
694
- check_admin_referer('gmedia_duplicate');
695
- if($gmCore->caps['gmedia_upload'] || $gmCore->caps['gmedia_import']) {
696
- $selected_items = wp_parse_id_list($duplicate_gmedia);
697
- if(!empty($selected_items)) {
698
- if(($count = count($selected_items))) {
699
- foreach($selected_items as $gmid) {
 
 
700
  $gmCore->duplicate_gmedia($gmid);
701
  }
702
  $this->msg[] = sprintf(__('%d item duplicated (without terms)', 'grand-media'), $count);
 
703
  }
704
  }
705
- } else {
706
- $this->error[] = __('You are not allowed to upload files', 'grand-media');
 
707
  }
708
  }
709
 
710
- if(($delete_gmedia = $gmCore->_get('delete'))) {
711
  check_admin_referer('gmedia_delete');
712
- if($gmCore->caps['gmedia_delete_media']) {
713
- if('selected' == $delete_gmedia) {
714
- $selected_items = $this->selected_items;
715
- } else {
716
- $selected_items = wp_parse_id_list($delete_gmedia);
717
- }
718
- if(!empty($selected_items)) {
719
- if(!$gmCore->caps['gmedia_delete_others_media']) {
720
  $delete_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $selected_items));
721
- if(count($delete_items) < count($selected_items)) {
722
  $this->error[] = __('You are not allowed to delete others media', 'grand-media');
723
  }
724
  $selected_items = $delete_items;
725
  }
726
- if(($count = count($selected_items))) {
727
- $delete_original_file = intval($gmCore->_get('save_original_file'))? false : true;
728
- foreach($selected_items as $item) {
729
- if(!$gmDB->delete_gmedia((int)$item, $delete_original_file)) {
730
  $this->error[] = "#{$item}: " . __('Error in deleting...', 'grand-media');
731
- $count--;
732
  }
733
  }
734
- if($count) {
735
- if($delete_original_file) {
736
  $this->msg[] = sprintf(__('%d item(s) deleted successfuly', 'grand-media'), $count);
737
- } else {
738
  $this->msg[] = sprintf(__('%d record(s) deleted from database successfuly. Original file(s) safe', 'grand-media'), $count);
739
  }
740
  }
741
  $this->selected_items = array_diff($this->selected_items, $selected_items);
742
- if(empty($this->selected_items)) {
743
- $this->clear_selected_items('library');
744
- } else {
745
- setcookie("gmuser_{$user_ID}_library", implode(',', $this->selected_items));
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  }
747
- if(!empty($this->stack_items)) {
748
  $this->stack_items = array_diff($this->stack_items, $selected_items);
749
- if(empty($this->stack_items)) {
750
- $this->clear_selected_items('library_stack');;
751
- } else {
752
- setcookie("gmuser_{$user_ID}_library_stack", implode(',', $this->stack_items));
753
  }
754
  }
755
  }
756
  }
757
- } else {
758
  $this->error[] = __('You are not allowed to delete files', 'grand-media');
759
  }
 
 
 
 
 
 
760
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
  }
763
 
 
 
 
 
 
 
 
764
  }
765
 
766
- global $gmProcessor;
767
- $gmProcessor = new GmediaProcessor_Library();
3
  /**
4
  * GmediaProcessor_Library
5
  */
6
+ class GmediaProcessor_Library extends GmediaProcessor{
7
 
8
+ private static $me = null;
9
  public static $cookie_key = false;
10
  public $mode = false;
11
  public $selected_items = array();
16
  /**
17
  * GmediaProcessor_Library constructor.
18
  */
19
+ public function __construct(){
20
  parent::__construct();
21
 
22
  global $gmCore;
23
 
24
+ $user_ID = get_current_user_id();
25
+ self::$cookie_key = "gmedia_library";
26
+ $this->mode = $gmCore->_get('mode', false);
27
+ $stack = 'show' == $gmCore->_get('stack')? 'show' : false;
28
+ $filter = 'selected' == $gmCore->_get('filter')? 'selected' : false;
29
+ if($this->edit_term){
30
+ self::$cookie_key .= ':term' . $this->edit_term;
31
+ if($this->edit_term && !isset($_COOKIE[ self::$cookie_key ])){
32
+ foreach($_COOKIE as $key => $value){
33
+ if('gmedia_library:' === substr($key, 0, 15)){
34
+ setcookie($key, '', time() - 3600);
35
+ unset($_COOKIE[ $key ]);
36
+ }
37
+ }
38
+ }
39
+ } elseif($this->gmediablank && 'select_multiple' == $this->mode){
40
+ self::$cookie_key .= ':frame';
41
+ }
42
+ $this->url = add_query_arg(array('mode' => $this->mode, 'stack' => $stack, 'filter' => $filter, 'edit_term' => $this->edit_term), $this->url);
43
  $this->selected_items = parent::selected_items(self::$cookie_key);
44
+ $this->stack_items = parent::selected_items("gmedia_{$user_ID}_libstack", 'stack_items');
45
 
46
+ add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
47
  }
48
 
49
  /**
50
  * @return array
51
  */
52
+ public function query_args(){
53
+ global $gmCore, $gmDB, $gmGallery;
54
+
55
+ if($this->edit_term){
56
+ $per_page = $this->user_options["per_page_{$this->taxonomy}_edit"];
57
+ if('album' === $this->taxterm){
58
+ $alb_meta = $gmDB->get_metadata('gmedia_term', $this->edit_term);
59
+ $orderby = !empty($alb_meta['_orderby'][0])? $alb_meta['_orderby'][0] : $gmGallery->options['in_album_orderby'];
60
+ $order = !empty($alb_meta['_order'][0])? $alb_meta['_order'][0] : $gmGallery->options['in_album_order'];
61
+ } elseif('category' === $this->taxterm){
62
+ $cat_meta = $gmDB->get_metadata('gmedia_term', $this->edit_term);
63
+ $orderby = !empty($cat_meta['_orderby'][0])? $cat_meta['_orderby'][0] : $gmGallery->options['in_category_orderby'];
64
+ $order = !empty($cat_meta['_order'][0])? $cat_meta['_order'][0] : $gmGallery->options['in_category_order'];
65
+ } elseif('tag' === $this->taxterm){
66
+ $orderby = $gmGallery->options['in_tag_orderby'];
67
+ $order = $gmGallery->options['in_tag_order'];
68
+ } else{
69
+ $orderby = $this->user_options['orderby_gmedia'];
70
+ $order = $this->user_options['sortorder_gmedia'];
71
+ }
72
+ } else{
73
+ $per_page = $this->user_options["per_page_gmedia"];
74
+ $orderby = $this->user_options['orderby_gmedia'];
75
+ $order = $this->user_options['sortorder_gmedia'];
76
+ }
77
 
78
  $args['mime_type'] = $gmCore->_get('mime_type');
79
  $args['status'] = $gmCore->_get('status');
80
  $args['page'] = $gmCore->_get('pager');
81
+ $args['per_page'] = $gmCore->_get('per_page', $per_page);
82
  $args['author__in'] = parent::filter_by_author($gmCore->_get('author'));
83
  $args['alb'] = $gmCore->_get('alb');
84
  $args['album__in'] = $gmCore->_get('album__in');
92
  $args['category__and'] = $gmCore->_get('category__and');
93
  $args['gmedia__in'] = $gmCore->_get('gmedia__in');
94
  $args['s'] = $gmCore->_get('s');
95
+ $args['orderby'] = $gmCore->_get('orderby', $orderby);
96
+ $args['order'] = $gmCore->_get('order', $order);
97
+
98
+ if('duplicates' === $args['gmedia__in']){
99
+ $duplicates = $gmDB->get_duplicates();
100
+ if(!empty($duplicates['duplicate_ids'])){
101
+ $args['gmedia__in'] = $duplicates['duplicate_ids'];
102
+ $args['orderby'] = 'gmedia__in';
103
+
104
+ setcookie(self::$cookie_key, implode('.', $duplicates['duplicate_select']));
105
+ $_COOKIE[ self::$cookie_key ] = implode('.', $duplicates['duplicate_select']);
106
+ $this->selected_items = $duplicates['duplicate_select'];
107
+ } else{
108
+ unset($args['gmedia__in']);
109
+ $this->msg[] = __('No duplicates in Gmedia Library', 'grand-media');
110
+ }
111
  }
112
 
113
+ if($args['s'] && ('#' == substr($args['s'], 0, 1))){
114
  $args['gmedia__in'] = substr($args['s'], 1);
115
  $args['s'] = false;
116
  }
117
 
118
  $show_stack = false;
119
+ if(('show' == $gmCore->_req('stack')) && !empty($this->stack_items)){
120
  $args['gmedia__in'] = $this->stack_items;
121
  $args['orderby'] = $gmCore->_get('orderby', 'gmedia__in');
122
  $args['order'] = $gmCore->_get('order', 'ASC');
123
  $show_stack = true;
124
  }
125
+ if(('selected' == $gmCore->_req('filter')) && !empty($this->selected_items)){
126
+ if($show_stack){
127
  $stack_items = wp_parse_id_list($this->stack_items);
128
  $selected_items = wp_parse_id_list($this->selected_items);
129
  $gmedia_in = array_intersect($stack_items, $selected_items);
130
  $args['gmedia__in'] = $gmedia_in;
131
+ } else{
132
  $args['gmedia__in'] = $this->selected_items;
133
  $args['orderby'] = $gmCore->_get('orderby', 'gmedia__in');
134
  $args['order'] = $gmCore->_get('order', 'ASC');
137
 
138
  $query_args = apply_filters('gmedia_library_query_args', $args);
139
 
140
+ foreach($query_args as $key => $val){
141
+ if(empty($val) && ('0' !== $val) && (0 !== $val)){
142
+ unset($query_args[ $key ]);
143
  }
144
  }
145
 
146
+ if(!empty($query_args['author__in']) && $gmCore->caps['gmedia_show_others_media']){
147
  $authors_names = $query_args['author__in'];
148
+ foreach($authors_names as $i => $id){
149
  if((int)$id){
150
  $authors_names[ $i ] = get_the_author_meta('display_name', $id);
151
  }
152
  }
153
+ $this->filters['filter_author'] = array('title' => __('Filter Author', 'grand-media'),
154
+ 'filter' => $authors_names
 
155
  );
156
  }
157
 
158
  $gmDB->gmedias_album_stuff($query_args);
159
+ if(!empty($query_args['album__in'])){
160
+ if(isset($query_args['within_album'])){
161
+ $filter_title = __('Exclude Album', 'grand-media');
162
+ $albums_names = array();
163
+ if(!empty($query_args['with_album__not_in'])){
164
+ $albums_names = $gmDB->get_terms('gmedia_album', array('fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['with_album__not_in']));
165
+ }
166
+ array_push($albums_names, __('Hide items without album', 'grand-media'));
167
+ } else{
168
+ $filter_title = __('Filter Album', 'grand-media');
169
+ $albums_names = $gmDB->get_terms('gmedia_album', array('fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['album__in']));
170
+ }
171
+ if(!empty($albums_names)){
172
+ $this->filters['filter_albums'] = array('title' => $filter_title,
173
+ 'filter' => $albums_names
174
  );
175
  }
176
  }
177
+ if(!empty($query_args['album__not_in'])){
178
+ if(isset($query_args['without_album'])){
179
+ $filter_title = __('Filter Album', 'grand-media');
180
+ $albums_names = array();
181
+ if(!empty($query_args['with_album__in'])){
182
+ $albums_names = $gmDB->get_terms('gmedia_album', array('fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['with_album__in']));
183
+ }
184
+ array_push($albums_names, __('Show items without album', 'grand-media'));
185
+ } else{
186
+ $filter_title = __('Exclude Album', 'grand-media');
187
+ $albums_names = $gmDB->get_terms('gmedia_album', array('fields' => 'names', 'global' => $args['author__in'], 'include' => $query_args['album__not_in']));
188
+ }
189
+ if(!empty($albums_names)){
190
+ $this->filters['exclude_albums'] = array('title' => $filter_title,
191
+ 'filter' => $albums_names
192
  );
193
  }
194
  }
195
 
196
  $gmDB->gmedias_category_stuff($query_args);
197
+ if(!empty($query_args['category__in'])){
198
+ if(isset($query_args['within_category'])){
199
+ $filter_title = __('Exclude Category', 'grand-media');
200
+ $category_names = array();
201
+ if(!empty($query_args['with_category__not_in'])){
202
+ $category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['with_category__not_in']));
203
+ }
204
+ $category_names = array_push($category_names, __('Hide items without categories', 'grand-media'));
205
+ } else{
206
+ $filter_title = __('Filter Category', 'grand-media');
207
+ $category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__in']));
208
+ }
209
+ if(!empty($category_names)){
210
+ $this->filters['filter_categories'] = array('title' => $filter_title,
211
+ 'filter' => $category_names
212
  );
213
  }
214
  }
215
+ if(!empty($query_args['category__not_in'])){
216
+ if(isset($query_args['without_category'])){
217
+ $filter_title = __('Filter Category', 'grand-media');
218
+ $category_names = array();
219
+ if(!empty($query_args['with_category__in'])){
220
+ $category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['with_category__in']));
221
+ }
222
+ $category_names = array_push($category_names, __('Show items without categories', 'grand-media'));
223
+ } else{
224
+ $filter_title = __('Exclude Category', 'grand-media');
225
+ $category_names = $gmDB->get_terms('gmedia_category', array('fields' => 'names', 'include' => $query_args['category__not_in']));
226
+ }
227
+ if(!empty($category_names)){
228
+ $this->filters['exclude_categories'] = array('title' => $filter_title,
229
+ 'filter' => $category_names
230
  );
231
  }
232
  }
233
 
234
  $gmDB->gmedias_tag_stuff($query_args);
235
+ if(!empty($query_args['tag__in'])){
236
  $tag_names = $gmDB->get_terms('gmedia_tag', array('fields' => 'names', 'include' => $query_args['tag__in']));
237
+ if(!empty($tag_names)){
238
+ $this->filters['filter_tags'] = array('title' => __('Filter Tag', 'grand-media'),
239
+ 'filter' => $tag_names
 
240
  );
241
  }
242
  }
243
+ if(!empty($query_args['tag__not_in'])){
244
  $tag_names = $gmDB->get_terms('gmedia_tag', array('fields' => 'names', 'include' => $query_args['tag__not_in']));
245
+ if(!empty($tag_names)){
246
+ $this->filters['exclude_tags'] = array('title' => __('Exclude Tag', 'grand-media'),
247
+ 'filter' => $tag_names
 
248
  );
249
  }
250
  }
252
  return $query_args;
253
  }
254
 
255
+ protected function processor(){
256
  global $user_ID, $gmCore, $gmDB, $gmGallery;
257
 
258
+ if(!$gmCore->caps['gmedia_library']){
259
  wp_die(__('You are not allowed to be here', 'grand-media'));
260
  }
261
 
262
  include_once(GMEDIA_ABSPATH . 'admin/pages/library/functions.php');
263
 
264
+ if(in_array($this->mode, array('select_single', 'select_multiple'))){
265
+ $this->display_mode = 'grid';
266
+ }
267
+ if(isset($_GET['display_mode'])){
268
  $display_mode = $_GET['display_mode'];
269
+ if(in_array($display_mode, array('grid', 'list'))){
270
+ $view = $this->gmediablank? '_frame' : '';
271
  $this->user_options = array_merge($this->user_options, array("display_mode_gmedia{$view}" => $display_mode));
272
  update_user_meta($user_ID, 'gm_screen_options', $this->user_options);
273
  }
276
  exit;
277
  }
278
 
279
+ if(isset($_GET['grid_cell_fit'])){
280
  $this->user_options['grid_cell_fit_gmedia'] = !$this->user_options['grid_cell_fit_gmedia'];
281
  update_user_meta($user_ID, 'gm_screen_options', $this->user_options);
282
+ if(isset($_GET['ajaxload'])){
283
  exit;
284
  }
285
  $location = remove_query_arg('grid_cell_fit');
287
  exit;
288
  }
289
 
290
+ if(isset($_GET['gallery'])){
291
+ $location = $this->url;
292
  $gallery_id = $gmCore->_get('gallery');
293
+ if($gallery_id){
294
  $gallery_query = $gmDB->get_metadata('gmedia_term', $gallery_id, '_query', true);
295
+ $location = add_query_arg($gallery_query, $location);
296
  }
297
  wp_redirect($location);
298
  exit;
301
  $this->query_args = $this->query_args();
302
 
303
 
304
+ if(isset($_POST['quick_gallery'])){
305
+ check_admin_referer('gmedia_action');
306
+ do{
307
+ if(!$gmCore->caps['gmedia_gallery_manage']){
308
  $this->error[] = __('You are not allowed to manage galleries', 'grand-media');
309
  break;
310
  }
311
  $gallery = $gmCore->_post('gallery');
312
  $gallery['name'] = trim($gallery['name']);
313
+ if(empty($gallery['name'])){
314
  $this->error[] = __('Gallery Name is not specified', 'grand-media');
315
  break;
316
  }
317
+ if($gmCore->is_digit($gallery['name'])){
318
  $this->error[] = __("Gallery name can't be only digits", 'grand-media');
319
  break;
320
  }
321
+ if(empty($gallery['query']['gmedia__in'])){
322
  $this->error[] = __('Choose gmedia from library for quick gallery', 'grand-media');
323
  break;
324
  }
325
  $taxonomy = 'gmedia_gallery';
326
+ if(($term_id = $gmDB->term_exists($gallery['name'], $taxonomy))){
327
  $this->error[] = __('A term with the name provided already exists', 'grand-media');
328
  break;
329
  }
330
  $term_id = $gmDB->insert_term($gallery['name'], $taxonomy);
331
+ if(is_wp_error($term_id)){
332
  $this->error[] = $term_id->get_error_message();
333
  break;
334
  }
335
+ $getModulePreset = $gmCore->getModulePreset($gallery['module']);
336
  $gallery['query'] = array_merge($gallery['query'], array('order' => 'ASC', 'orderby' => 'gmedia__in'));
337
 
338
+ $gallery_meta = array('_edited' => gmdate('Y-m-d H:i:s'),
339
+ '_query' => $gallery['query'],
340
+ '_module' => $getModulePreset['module'],
341
+ '_settings' => $getModulePreset['settings']
 
342
  );
343
+ foreach($gallery_meta as $key => $value){
344
  $gmDB->update_metadata('gmedia_term', $term_id, $key, $value);
345
  }
346
  $this->msg[] = sprintf(__('Gallery "%s" successfuly saved. Shortcode: [gmedia id=%d]', 'grand-media'), esc_attr($gallery['name']), $term_id);
347
  } while(0);
348
  }
349
 
350
+ if(isset($_POST['filter_categories'])){
351
+ if(false !== ($term = $gmCore->_post('cat'))){
352
  $location = add_query_arg(array('category__in' => implode(',', $term)), $this->url);
353
  wp_redirect($location);
354
  exit;
355
  }
356
  }
357
+ if(isset($_POST['filter_albums'])){
358
+ if(false !== ($term = $gmCore->_post('alb'))){
359
  $location = add_query_arg(array('album__in' => implode(',', $term)), $this->url);
360
  wp_redirect($location);
361
  exit;
362
  }
363
  }
364
+ if(isset($_POST['filter_tags'])){
365
+ if(false !== ($term = $gmCore->_post('tag_ids'))){
366
  $location = add_query_arg(array('tag__in' => $term), $this->url);
367
  wp_redirect($location);
368
  exit;
369
  }
370
  }
371
+ if(isset($_POST['filter_author'])){
 
 
 
 
 
 
 
372
  $authors = $gmCore->_post('author_ids');
373
  $location = add_query_arg(array('author' => (int)$authors), $this->url);
374
  wp_redirect($location);
375
  exit;
376
  }
377
 
378
+ $do_gmedia = $gmCore->_get('do_gmedia');
379
+ if(!empty($this->selected_items) || isset($_POST['cookie_key'])){
380
+ if(isset($_POST['assign_album'])){
381
+ check_admin_referer('gmedia_action');
382
+ if($gmCore->caps['gmedia_terms']){
383
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
384
+ $ids = $this->selected_items($cookie_key);
385
+ if(!$gmCore->caps['gmedia_edit_others_media']){
386
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
387
+ if(count($selected_items) < count($ids)){
388
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
389
  }
390
+ } else{
391
+ $selected_items = $ids;
392
  }
393
  $term = $gmCore->_post('alb');
394
+ if((false !== $term) && ($count = count($selected_items))){
395
+ if(empty($term)){
396
+ foreach($selected_items as $item){
397
  $gmDB->delete_gmedia_term_relationships($item, 'gmedia_album');
398
  }
399
  $this->msg[] = sprintf(__('%d item(s) updated with "No Album"', 'grand-media'), $count);
400
+ } else{
401
  $term_ids = array();
402
+ foreach($selected_items as $item){
403
  $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_album', $append = 0);
404
+ if(is_wp_error($result)){
405
  $this->error[] = $result;
406
+ } elseif($result){
407
+ foreach($result as $t_id){
408
+ $term_ids[ $t_id ][] = $item;
409
  }
410
  }
411
  }
412
+ if(!empty($term_ids)){
413
  global $wpdb;
414
 
415
+ foreach($term_ids as $term_id => $item_ids){
416
  $term = $gmDB->get_term($term_id);
417
+ if(isset($_POST['status_global'])){
418
  $values = array();
419
+ foreach($selected_items as $item){
420
  $values[] = $wpdb->prepare("%d", $item);
421
  }
422
+ if($values){
423
  $status = esc_sql($term->status);
424
+ if(false === $wpdb->query("UPDATE {$wpdb->prefix}gmedia SET status = '{$status}' WHERE ID IN (" . join(',', $values) . ")")){
425
  $this->error[] = __('Could not update statuses for gmedia items in the database');
426
  }
427
  }
431
  }
432
  }
433
 
434
+ $this->clear_selected_items($cookie_key);
435
+ $this->selected_items = $this->selected_items(self::$cookie_key);
436
  }
437
+ } else{
438
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
439
  }
440
  }
441
+ if(isset($_POST['assign_category'])){
442
+ check_admin_referer('gmedia_action');
443
+ if($gmCore->caps['gmedia_terms']){
444
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
445
+ $ids = $this->selected_items($cookie_key);
446
+ if(!$gmCore->caps['gmedia_edit_others_media']){
447
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
448
+ if(count($selected_items) < count($ids)){
449
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
450
  }
451
+ } else{
452
+ $selected_items = $ids;
453
  }
454
  $term = $gmCore->_post('cat_names');
455
  $term = explode(',', $term);
456
+ if(!empty($term) && ($count = count($selected_items))){
457
+ foreach($selected_items as $item){
458
  $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = 1);
459
+ if(is_wp_error($result)){
460
  $this->error[] = $result;
461
+ $count --;
462
+ } elseif(!$result){
463
+ $count --;
464
  }
465
  }
466
 
467
  $this->msg[] = sprintf(__("Categories assigned to %d image(s).", 'grand-media'), $count);
468
 
469
+ $this->clear_selected_items($cookie_key);
470
+ $this->selected_items = $this->selected_items(self::$cookie_key);
471
  }
472
+ } else{
473
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
474
  }
475
  }
476
+ if(isset($_POST['unassign_category'])){
477
+ check_admin_referer('gmedia_action');
478
+ if(($term = $gmCore->_post('category_id')) && $gmCore->caps['gmedia_terms']){
479
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
480
+ $ids = $this->selected_items($cookie_key);
481
+ if(!$gmCore->caps['gmedia_edit_others_media']){
482
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
483
+ if(count($selected_items) < count($ids)){
484
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
485
  }
486
+ } else{
487
+ $selected_items = $ids;
488
  }
489
  $term = array_map('intval', $term);
490
+ if(($count = count($selected_items))){
491
+ foreach($selected_items as $item){
492
+ $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_category', $append = - 1);
493
+ if(is_wp_error($result)){
494
  $this->error[] = $result;
495
+ $count --;
496
+ } elseif(!$result){
497
+ $count --;
498
  }
499
  }
500
  $this->msg[] = sprintf(__('%d category(ies) deleted from %d item(s)', 'grand-media'), count($term), $count);
501
 
502
+ $this->clear_selected_items($cookie_key);
503
+ $this->selected_items = $this->selected_items(self::$cookie_key);
504
  }
505
+ } else{
506
+ $this->error[] = __('You are not allowed to assign terms', 'gmedia_grand-media');
507
  }
508
  }
509
+ if(isset($_POST['add_tags'])){
510
+ check_admin_referer('gmedia_action');
511
+ if(!$gmCore->caps['gmedia_terms']){
512
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
513
+ } else{
514
  $term = $gmCore->_post('tag_names');
515
  $iptc_tags = $gmCore->_post('iptc_tags');
516
+ if($term || $iptc_tags){
517
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
518
+ $ids = $this->selected_items($cookie_key);
519
+ if(!$gmCore->caps['gmedia_edit_others_media']){
520
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
521
+ if(count($selected_items) < count($ids)){
522
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
523
  }
524
+ } else{
525
+ $selected_items = $ids;
526
  }
527
  $term = explode(',', $term);
528
+ if(($count = count($selected_items))){
529
+ foreach($selected_items as $item){
530
  $_term = $term;
531
+ if($iptc_tags){
532
  $_metadata = $gmDB->get_metadata('gmedia', $item, '_metadata', true);
533
+ if(isset($_metadata['image_meta']['keywords']) && is_array($_metadata['image_meta']['keywords'])){
534
  $_term = array_merge($_metadata['image_meta']['keywords'], $term);
535
  }
536
  }
537
  $result = $gmDB->set_gmedia_terms($item, $_term, 'gmedia_tag', $append = 1);
538
+ if(is_wp_error($result)){
539
  $this->error[] = $result;
540
+ $count --;
541
+ } elseif(!$result){
542
+ $count --;
543
  }
544
  }
545
  $this->msg[] = sprintf(__('Tags added to %d item(s)', 'grand-media'), $count);
546
 
547
+ $this->clear_selected_items($cookie_key);
548
+ $this->selected_items = $this->selected_items(self::$cookie_key);
549
  }
550
+ } else{
551
  $this->error[] = __('No tags specified', 'grand-media');
552
  }
553
  }
554
  }
555
+ if(isset($_POST['delete_tags'])){
556
+ check_admin_referer('gmedia_action');
557
+ if(($term = $gmCore->_post('tag_id')) && $gmCore->caps['gmedia_terms']){
558
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
559
+ $ids = $this->selected_items($cookie_key);
560
+ if(!$gmCore->caps['gmedia_edit_others_media']){
561
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
562
+ if(count($selected_items) < count($ids)){
563
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
564
  }
565
+ } else{
566
+ $selected_items = $ids;
567
  }
568
  $term = array_map('intval', $term);
569
+ if(($count = count($selected_items))){
570
+ foreach($selected_items as $item){
571
+ $result = $gmDB->set_gmedia_terms($item, $term, 'gmedia_tag', $append = - 1);
572
+ if(is_wp_error($result)){
573
  $this->error[] = $result;
574
+ $count --;
575
+ } elseif(!$result){
576
+ $count --;
577
  }
578
  }
579
  $this->msg[] = sprintf(__('%d tag(s) deleted from %d item(s)', 'grand-media'), count($term), $count);
580
 
581
+ $this->clear_selected_items($cookie_key);
582
+ $this->selected_items = $this->selected_items(self::$cookie_key);
583
  }
584
+ } else{
585
  $this->error[] = __('You are not allowed to assign terms', 'grand-media');
586
  }
587
  }
588
+ if(isset($_POST['batch_edit'])){
589
+ check_admin_referer('gmedia_action');
590
+ if($gmCore->caps['gmedia_edit_media']){
591
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
592
+ $ids = $this->selected_items($cookie_key);
593
+ if(!$gmCore->caps['gmedia_edit_others_media']){
594
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
595
+ if(count($selected_items) < count($ids)){
596
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
597
  }
598
+ } else{
599
+ $selected_items = $ids;
600
  }
601
+ if(($count = count($selected_items))){
602
  $batch_data = array();
603
  $b_filename = $gmCore->_post('batch_filename');
604
  $b_title = $gmCore->_post('batch_title');
606
  $b_link = $gmCore->_post('batch_link');
607
  $b_status = $gmCore->_post('batch_status');
608
  $b_comment_status = $gmCore->_post('batch_comment_status');
609
+ if($b_status){
610
  $batch_data['status'] = $b_status;
611
  }
612
+ if($b_comment_status){
613
  $batch_data['comment_status'] = $b_comment_status;
614
  }
615
  $b_author = $gmCore->_post('batch_author');
616
+ if($b_author && ('-1' != $b_author)){
617
  $batch_data['author'] = $b_author;
618
  }
619
  $i = 0;
620
+ foreach($selected_items as $item){
621
  $id = (int)$item;
622
  $gmedia = $gmDB->get_gmedia($id, ARRAY_A);
623
  $item_author = (int)$gmedia['author'];
624
 
625
+ if('custom' == $b_filename && ($gmCore->caps['gmedia_delete_others_media'] || ($item_author == $user_ID))){
626
  $filename_custom = $gmCore->_post('batch_filename_custom');
627
+ if(!empty($filename_custom) && ('{filename}' !== $filename_custom)){
628
 
629
  $gmuid = pathinfo($gmedia['gmuid']);
630
 
631
  $filename_vars = array('{filename}' => $gmuid['filename'], '{id}' => $gmedia['ID']);
632
+ if(preg_match_all('/{index[:]?(\d+)?}/', $filename_custom, $matches_all)){
633
+ foreach($matches_all[0] as $key => $matches){
634
+ $strlen = strlen($matches_all[1][ $key ]);
635
+ $index = intval($matches_all[1][ $key ]) + $i;
636
+ $index = sprintf("%0{$strlen}d", $index);
637
+ $filename_vars[ $matches ] = $index;
638
  }
639
  }
640
  $filename_custom = strtr($filename_custom, $filename_vars);
641
 
642
  $filename_custom = preg_replace('/[^a-z0-9_\.-]+/i', '_', $filename_custom);
643
+ if($filename_custom && $filename_custom != $gmuid['filename']){
644
  $fileinfo = $gmCore->fileinfo($filename_custom . '.' . $gmuid['extension']);
645
+ if(false !== $fileinfo){
646
+ if('image' == $fileinfo['dirname']){
647
  /** WordPress Image Administration API */
648
  require_once(ABSPATH . 'wp-admin/includes/image.php');
649
 
650
+ if(file_is_displayable_image($fileinfo['dirpath'] . '/' . $gmedia['gmuid'])){
651
  @rename($fileinfo['dirpath_original'] . '/' . $gmedia['gmuid'], $fileinfo['filepath_original']);
652
  @rename($fileinfo['dirpath_thumb'] . '/' . $gmedia['gmuid'], $fileinfo['filepath_thumb']);
653
  }
654
  }
655
+ if(@rename($fileinfo['dirpath'] . '/' . $gmedia['gmuid'], $fileinfo['filepath'])){
656
  $gmedia['gmuid'] = $fileinfo['basename'];
657
  $batch_data['gmuid'] = $fileinfo['basename'];
658
  }
660
  }
661
  }
662
  }
663
+ switch($b_title){
664
  case 'empty':
665
  $batch_data['title'] = '';
666
  break;
667
  case 'filename':
668
  $title = pathinfo($gmedia['gmuid'], PATHINFO_FILENAME);
669
+ $batch_data['title'] = str_replace('_', ' ', $title);
670
+ if($gmGallery->options['name2title_capitalize']){
671
+ $batch_data['title'] = mb_convert_case($batch_data['title'], MB_CASE_TITLE, 'UTF-8');
672
+ }
673
  break;
674
  case 'custom':
675
  $title_custom = $gmCore->_post('batch_title_custom');
676
+ if(false !== $title_custom){
677
  $batch_data['title'] = $title_custom;
678
  }
679
  break;
680
  }
681
+ switch($b_description){
682
  case 'empty':
683
  $batch_data['description'] = '';
684
  break;
685
  case 'metadata':
686
  $metatext = $gmCore->metadata_text($id);
687
+ if($gmedia['description']){
688
  $gmedia['description'] .= "\n";
689
  }
690
  $batch_data['description'] = $gmedia['description'] . $metatext;
691
  break;
692
  case 'custom':
693
  $description_custom = $gmCore->_post('batch_description_custom');
694
+ if(false !== $description_custom){
695
  $what_description_custom = $gmCore->_post('what_description_custom');
696
+ if('replace' == $what_description_custom){
697
  $batch_data['description'] = $description_custom;
698
+ } elseif('append' == $what_description_custom){
699
  $batch_data['description'] = $gmedia['description'] . $description_custom;
700
+ } elseif('prepend' == $what_description_custom){
701
  $batch_data['description'] = $description_custom . $gmedia['description'];
702
  }
703
  }
704
  break;
705
  }
706
+ switch($b_link){
707
  case 'empty':
708
  $batch_data['link'] = '';
709
  break;
713
  break;
714
  case 'custom':
715
  $link_custom = $gmCore->_post('batch_link_custom');
716
+ if(false !== $link_custom){
717
  $batch_data['link'] = $link_custom;
718
  }
719
  break;
720
  }
721
+ if(!empty($batch_data)){
722
  $batch_data['modified'] = current_time('mysql');
723
  $gmedia_data = array_merge($gmedia, $batch_data);
724
  $gmDB->insert_gmedia($gmedia_data);
725
+ } else{
726
+ $count --;
727
  }
728
 
729
+ $i ++;
730
  }
731
  $this->msg[] = sprintf(__('%d item(s) updated successfuly', 'grand-media'), $count);
732
 
733
+ $this->clear_selected_items($cookie_key);
734
+ $this->selected_items = $this->selected_items(self::$cookie_key);
735
  }
736
+ } else{
737
  $this->error[] = __('You are not allowed to edit media', 'grand-media');
738
  }
739
  }
740
+
741
+ if($do_gmedia){
742
+ if('unassign_album' == $do_gmedia){
743
+ check_admin_referer('gmedia_action');
744
+ if($gmCore->caps['gmedia_terms']){
745
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
746
+ $ids = $this->selected_items($cookie_key);
747
+ if(!$gmCore->caps['gmedia_edit_others_media']){
748
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $ids));
749
+ if(count($selected_items) < count($ids)){
750
+ $this->error[] = __('You are not allowed to edit others media', 'grand-media');
751
  }
752
+ } else{
753
+ $selected_items = $ids;
754
+ }
755
+ if(($count = count($selected_items))){
756
+ foreach($selected_items as $item){
757
+ $gmDB->delete_gmedia_term_relationships($item, 'gmedia_album');
758
  }
759
+ $this->msg[] = sprintf(__('%d item(s) updated with "No Album"', 'grand-media'), $count);
760
+ set_transient('gmedia_action_msg', $this->msg, 30);
761
+
762
+ $this->clear_selected_items($cookie_key);
763
+ $this->selected_items = $this->selected_items(self::$cookie_key);
764
  }
765
+ } else{
766
+ $this->error[] = __('You are not allowed to assign terms', 'grand-media');
767
+ set_transient('gmedia_action_error', $this->error, 30);
768
  }
 
 
 
769
  }
770
+ if('update_meta' == $do_gmedia){
771
+ check_admin_referer('gmedia_action');
772
+ if($gmCore->caps['gmedia_edit_media']){
773
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
774
+ $selected_items = $this->selected_items($cookie_key);
775
+ $count = count($selected_items);
776
+ if($count){
777
+ foreach($selected_items as $item){
778
+ $id = (int)$item;
779
+ $media_metadata = $gmDB->generate_gmedia_metadata($id);
780
+ $gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_metadata', $media_metadata);
781
+ if(!empty($media_metadata['image_meta']['created_timestamp'])){
782
+ $gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_created_timestamp', $media_metadata['image_meta']['created_timestamp']);
783
+ }
784
+ if(!empty($media_metadata['image_meta']['GPS'])){
785
+ $gmDB->update_metadata($meta_type = 'gmedia', $id, $meta_key = '_gps', $media_metadata['image_meta']['GPS']);
786
+ }
787
+ }
788
+ $this->msg[] = sprintf(__('%d item(s) updated successfuly', 'grand-media'), $count);
789
+ set_transient('gmedia_action_msg', $this->msg, 30);
790
  }
791
+ $this->clear_selected_items($cookie_key);
792
+ $this->selected_items = $this->selected_items(self::$cookie_key);
793
+ } else{
794
+ $this->error[] = __('You are not allowed to edit media', 'grand-media');
795
+ set_transient('gmedia_action_error', $this->error, 30);
796
+ }
797
+ }
798
+ if('recreate' == $do_gmedia){
799
+ check_admin_referer('gmedia_action');
800
+ if($gmCore->caps['gmedia_edit_media']){
801
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
802
+ $selected_items = $this->selected_items($cookie_key);
803
+ $count = count($selected_items);
804
+ if($count){
805
+ if(!$gmCore->caps['gmedia_edit_others_media']){
806
+ $edit_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'mime_type' => 'image', 'gmedia__in' => $selected_items));
807
+ $selected_items = $edit_items;
808
+ } else{
809
+ $selected_items = $gmDB->get_gmedias(array('fields' => 'ids', 'mime_type' => 'image', 'gmedia__in' => $selected_items));
810
+ }
811
+ if(($count = count($selected_items))){
812
+ $ajax_operations = get_option('gmedia_ajax_long_operations', array());
813
+ foreach($selected_items as $si){
814
+ $ajax_operations['gmedia_recreate_images'][ $si ] = $si;
815
+ }
816
+ update_option('gmedia_ajax_long_operations', $ajax_operations);
817
+ $this->msg[] = sprintf(__('You\'ve added %d image(s) to the re-creation queue.', 'grand-media'), $count);
818
+ set_transient('gmedia_action_msg', $this->msg, 30);
819
  }
 
 
820
  }
821
+ $this->clear_selected_items($cookie_key);
822
+ $this->selected_items = $this->selected_items(self::$cookie_key);
823
+ } else{
824
+ $this->error[] = __('You are not allowed to edit media', 'grand-media');
825
+ set_transient('gmedia_action_error', $this->error, 30);
826
  }
 
 
 
827
  }
828
  }
829
  }
830
+ if('duplicate' == $do_gmedia){
831
+ check_admin_referer('gmedia_action');
832
+ if($gmCore->caps['gmedia_upload'] || $gmCore->caps['gmedia_import']){
833
+ $ids = $gmCore->_get('ids', 'selected');
834
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
835
+ $selected_items = ('selected' == $ids)? $this->selected_items($cookie_key) : wp_parse_id_list($ids);
836
+ if(!empty($selected_items)){
837
+ if(($count = count($selected_items))){
838
+ foreach($selected_items as $gmid){
839
  $gmCore->duplicate_gmedia($gmid);
840
  }
841
  $this->msg[] = sprintf(__('%d item duplicated (without terms)', 'grand-media'), $count);
842
+ set_transient('gmedia_action_msg', $this->msg, 30);
843
  }
844
  }
845
+ } else{
846
+ $this->error[] = __('You are not allowed to import files', 'grand-media');
847
+ set_transient('gmedia_action_error', $this->error, 30);
848
  }
849
  }
850
 
851
+ if('delete' == $do_gmedia || 'delete__save_original' == $do_gmedia){
852
  check_admin_referer('gmedia_delete');
853
+ if($gmCore->caps['gmedia_delete_media']){
854
+ $ids = $gmCore->_get('ids', 'selected');
855
+ $cookie_key = $gmCore->_post('cookie_key', self::$cookie_key);
856
+ $selected_items = ('selected' == $ids)? $this->selected_items($cookie_key) : wp_parse_id_list($ids);
857
+ if(!empty($selected_items)){
858
+ if(!$gmCore->caps['gmedia_delete_others_media']){
 
 
859
  $delete_items = $gmDB->get_gmedias(array('fields' => 'ids', 'author' => $user_ID, 'gmedia__in' => $selected_items));
860
+ if(count($delete_items) < count($selected_items)){
861
  $this->error[] = __('You are not allowed to delete others media', 'grand-media');
862
  }
863
  $selected_items = $delete_items;
864
  }
865
+ if(($count = count($selected_items))){
866
+ $delete_original_file = !('delete__save_original' == $do_gmedia);
867
+ foreach($selected_items as $item){
868
+ if(!$gmDB->delete_gmedia((int)$item, $delete_original_file)){
869
  $this->error[] = "#{$item}: " . __('Error in deleting...', 'grand-media');
870
+ $count --;
871
  }
872
  }
873
+ if($count){
874
+ if($delete_original_file){
875
  $this->msg[] = sprintf(__('%d item(s) deleted successfuly', 'grand-media'), $count);
876
+ } else{
877
  $this->msg[] = sprintf(__('%d record(s) deleted from database successfuly. Original file(s) safe', 'grand-media'), $count);
878
  }
879
  }
880
  $this->selected_items = array_diff($this->selected_items, $selected_items);
881
+ if(empty($this->selected_items)){
882
+ $this->clear_selected_items(self::$cookie_key);
883
+ } else{
884
+ setcookie(self::$cookie_key, implode('.', $this->selected_items));
885
+ }
886
+ if($cookie_key != self::$cookie_key){
887
+ if('selected' == $ids){
888
+ $this->clear_selected_items($cookie_key);
889
+ } else{
890
+ $_selected_items = $this->selected_items($cookie_key);
891
+ $_selected_items = array_diff($_selected_items, $selected_items);
892
+ if(empty($_selected_items)){
893
+ $this->clear_selected_items($cookie_key);
894
+ } else{
895
+ setcookie($cookie_key, implode('.', $_selected_items));
896
+ }
897
+ }
898
  }
899
+ if(!empty($this->stack_items)){
900
  $this->stack_items = array_diff($this->stack_items, $selected_items);
901
+ if(empty($this->stack_items)){
902
+ $this->clear_selected_items("gmedia_{$user_ID}_libstack");;
903
+ } else{
904
+ setcookie("gmedia_{$user_ID}_libstack", implode('.', $this->stack_items));
905
  }
906
  }
907
  }
908
  }
909
+ } else{
910
  $this->error[] = __('You are not allowed to delete files', 'grand-media');
911
  }
912
+ if(!empty($this->msg)){
913
+ set_transient('gmedia_action_msg', $this->msg, 30);
914
+ }
915
+ if(!empty($this->error)){
916
+ set_transient('gmedia_action_error', $this->error, 30);
917
+ }
918
  }
919
+ if($do_gmedia){
920
+ $location = remove_query_arg(array('do_gmedia', 'ids', '_wpnonce'));
921
+ $location = add_query_arg('did_gmedia', $do_gmedia, $location);
922
+ wp_redirect($location);
923
+ exit;
924
+ }
925
+ if($gmCore->_get('did_gmedia')){
926
+ $msg = get_transient('gmedia_action_msg');
927
+ if($msg){
928
+ delete_transient('gmedia_action_msg');
929
+ $this->msg = (array)$msg;
930
+ }
931
+ $error = get_transient('gmedia_action_error');
932
+ if($error){
933
+ delete_transient('gmedia_action_error');
934
+ $this->error = (array)$error;
935
+ }
936
+ }
937
+ }
938
 
939
+ public function admin_enqueue_scripts(){
940
+ if('edit' == $this->mode){
941
+ if('false' == $this->user_options['library_edit_quicktags']){
942
+ wp_enqueue_script('wplink');
943
+ wp_enqueue_style('editor-buttons');
944
+
945
+ add_action('admin_footer', array($this, 'wpLink'));
946
+ }
947
+ }
948
+ }
949
+
950
+ public function wpLink(){
951
+ if(!class_exists('_WP_Editors', false)){
952
+ require_once(ABSPATH . WPINC . '/class-wp-editor.php');
953
+ }
954
+ _WP_Editors::wp_link_dialog();
955
  }
956
 
957
+ public static function getMe(){
958
+ if(self::$me == null){
959
+ self::$me = new GmediaProcessor_Library();
960
+ }
961
+
962
+ return self::$me;
963
+ }
964
  }
965
 
966
+ global $gmProcessorLibrary;
967
+ $gmProcessorLibrary = GmediaProcessor_Library::getMe();
admin/processor/class.processor.modules.php CHANGED
@@ -4,6 +4,8 @@
4
  * GmediaProcessor_Modules
5
  */
6
  class GmediaProcessor_Modules extends GmediaProcessor{
 
 
7
 
8
  protected function processor(){
9
  global $gmDB, $gmCore, $gmGallery, $user_ID;
@@ -191,9 +193,20 @@ class GmediaProcessor_Modules extends GmediaProcessor{
191
  }
192
  }
193
 
 
 
 
 
194
  }
195
 
 
 
 
 
 
 
 
196
  }
197
 
198
- global $gmProcessor;
199
- $gmProcessor = new GmediaProcessor_Modules();
4
  * GmediaProcessor_Modules
5
  */
6
  class GmediaProcessor_Modules extends GmediaProcessor{
7
+ private static $me = null;
8
+ public $modules = array();
9
 
10
  protected function processor(){
11
  global $gmDB, $gmCore, $gmGallery, $user_ID;
193
  }
194
  }
195
 
196
+ $this->modules = get_gmedia_modules();
197
+ wp_clear_scheduled_hook('gmedia_modules_update');
198
+ wp_schedule_event(time(), 'daily', 'gmedia_modules_update');
199
+ $gmCore->modules_update($this->modules);
200
  }
201
 
202
+ public static function getMe() {
203
+ if ( self::$me == null ) {
204
+ self::$me = new GmediaProcessor_Modules();
205
+ }
206
+
207
+ return self::$me;
208
+ }
209
  }
210
 
211
+ global $gmProcessorModules;
212
+ $gmProcessorModules = GmediaProcessor_Modules::getMe();
admin/processor/class.processor.settings.php CHANGED
@@ -4,6 +4,7 @@
4
  * GmediaProcessor_Settings
5
  */
6
  class GmediaProcessor_Settings extends GmediaProcessor{
 
7
 
8
  protected function processor(){
9
  global $gmCore, $gmGallery, $gmDB;
@@ -181,7 +182,14 @@ class GmediaProcessor_Settings extends GmediaProcessor{
181
 
182
  }
183
 
 
 
 
 
 
 
 
184
  }
185
 
186
- global $gmProcessor;
187
- $gmProcessor = new GmediaProcessor_Settings();
4
  * GmediaProcessor_Settings
5
  */
6
  class GmediaProcessor_Settings extends GmediaProcessor{
7
+ private static $me = null;
8
 
9
  protected function processor(){
10
  global $gmCore, $gmGallery, $gmDB;
182
 
183
  }
184
 
185
+ public static function getMe() {
186
+ if ( self::$me == null ) {
187
+ self::$me = new GmediaProcessor_Settings();
188
+ }
189
+
190
+ return self::$me;
191
+ }
192
  }
193
 
194
+ global $gmProcessorSettings;
195
+ $gmProcessorSettings = GmediaProcessor_Settings::getMe();
admin/processor/class.processor.terms.php CHANGED
@@ -3,9 +3,9 @@
3
  /**
4
  * GmediaProcessor_Terms
5
  */
6
- class GmediaProcessor_Terms extends GmediaProcessor {
7
 
8
- public $taxonomy;
9
  public static $cookie_key = false;
10
  public $selected_items = array();
11
  public $query_args = array();
@@ -13,31 +13,25 @@ class GmediaProcessor_Terms extends GmediaProcessor {
13
  /**
14
  * GmediaProcessor_Library constructor.
15
  */
16
- public function __construct() {
17
  parent::__construct();
18
 
19
- global $user_ID;
20
-
21
- switch($this->page){
22
- case 'GrandMedia_Albums':
23
- $this->taxonomy = 'gmedia_album';
24
- break;
25
- case 'GrandMedia_Categories':
26
- $this->taxonomy = 'gmedia_category';
27
- break;
28
- case 'GrandMedia_Tags':
29
- $this->taxonomy = 'gmedia_tag';
30
- break;
31
  }
32
- self::$cookie_key = "gmuser_{$user_ID}_{$this->taxonomy}";
33
  $this->selected_items = parent::selected_items(self::$cookie_key);
34
-
35
  }
36
 
37
  /**
38
  * @return array
39
  */
40
- public function query_args() {
41
  global $gmCore;
42
 
43
  $args['status'] = $gmCore->_get('status');
@@ -51,32 +45,32 @@ class GmediaProcessor_Terms extends GmediaProcessor {
51
  $args['order'] = $gmCore->_get('order', $this->user_options["sortorder_{$this->taxonomy}"]);
52
  $args['hide_empty'] = $gmCore->_get('hide_empty');
53
 
54
- if($args['search'] && ('#' == substr($args['search'], 0, 1))) {
55
  $args['include'] = substr($args['search'], 1);
56
- $args['search'] = false;
57
  }
58
 
59
- if(('selected' == $gmCore->_req('filter')) && !empty($this->selected_items)) {
60
  $args['include'] = $this->selected_items;
61
- $args['orderby'] = $gmCore->_get('orderby', 'include');
62
- $args['order'] = $gmCore->_get('order', 'ASC');
63
  }
64
 
65
  $query_args = apply_filters('gmedia_terms_query_args', $args);
66
 
67
  foreach($query_args as $key => $val){
68
  if(empty($val) && ('0' !== $val) && (0 !== $val)){
69
- unset($query_args[$key]);
70
  }
71
  }
72
 
73
  return $query_args;
74
  }
75
 
76
- protected function processor() {
77
  global $user_ID, $gmCore, $gmDB;
78
 
79
- if(!$gmCore->caps['gmedia_library']) {
80
  wp_die(__('You are not allowed to be here', 'grand-media'));
81
  }
82
 
@@ -87,188 +81,123 @@ class GmediaProcessor_Terms extends GmediaProcessor {
87
  $taxonomy = $this->taxonomy;
88
  switch($taxonomy){
89
  case 'gmedia_album':
90
- if(gm_user_can('album_manage')) {
91
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_album_tpl');
92
- } else {
93
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
94
  }
95
  break;
96
  case 'gmedia_category':
97
- if(gm_user_can('category_manage')) {
98
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_category_tpl');
99
- } else {
100
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
101
  }
102
  break;
103
  case 'gmedia_tag':
104
- if(gm_user_can('tag_manage')) {
105
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_tag_tpl');
106
- } else {
107
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
108
  }
109
  break;
110
  }
111
 
112
- if(($delete = $gmCore->_get('delete'))) {
113
- check_admin_referer('gmedia_delete');
114
- if($gmCore->caps['gmedia_terms_delete']) {
115
- if('selected' == $gmCore->_get('delete')) {
116
- $selected_items = $this->selected_items;
117
- } else {
118
- $selected_items = wp_parse_id_list($delete);
119
- }
120
- if(!$gmCore->caps['gmedia_delete_others_media']) {
121
- $_selected_items = array();
122
- if('gmedia_album' == $taxonomy) {
123
- $_selected_items = $gmDB->get_terms($taxonomy, array('fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items));
124
- }
125
- if(count($_selected_items) < count($selected_items)) {
126
- $this->error[] = __('You are not allowed to delete others media', 'grand-media');
127
- }
128
- $selected_items = $_selected_items;
129
- }
130
- if(($count = count($selected_items))) {
131
- foreach($selected_items as $item) {
132
- $delete = $gmDB->delete_term($item);
133
- if(!$delete) {
134
- $count--;
135
- } elseif(is_wp_error($delete)) {
136
- $this->error[] = $delete->get_error_message();
137
- $count--;
138
- }
139
- }
140
- if($count) {
141
- $this->msg[] = sprintf(__('%d item(s) deleted successfuly', 'grand-media'), $count);
142
- }
143
- setcookie("gmuser_{$user_ID}_{$taxonomy}", '', time() - 3600);
144
- unset($_COOKIE["gmuser_{$user_ID}_{$taxonomy}"]);
145
- $this->selected_items = array();
146
- }
147
- } else {
148
- $this->error[] = __('You are not allowed to delete terms', 'grand-media');
149
- }
150
- } elseif(isset($_POST['gmedia_album_save'])) {
151
  check_admin_referer('GmediaTerms', 'term_save_wpnonce');
152
- $edit_term = (int)$gmCore->_get('edit_item');
153
- do {
154
- if(!$gmCore->caps['gmedia_album_manage']) {
155
  $this->error[] = __('You are not allowed to manage albums', 'grand-media');
156
  break;
157
  }
158
  $term = $gmCore->_post('term');
159
- if(($meta = $gmCore->_post('meta'))) {
160
  $term = array_merge_recursive(array('meta' => $meta), $term);
161
  }
162
  $term['name'] = trim($term['name']);
163
- if(empty($term['name'])) {
164
  $this->error[] = __('Term Name is not specified', 'grand-media');
165
  break;
166
  }
167
- if($gmCore->is_digit($term['name'])) {
168
  $this->error[] = __("Term Name can't be only digits", 'grand-media');
169
  break;
170
  }
171
  $taxonomy = 'gmedia_album';
172
- if($edit_term && !$gmDB->term_exists($edit_term)) {
173
  $this->error[] = __('A term with the id provided do not exists', 'grand-media');
174
  $edit_term = false;
175
  }
176
- if(($term_id = $gmDB->term_exists($term['name'], $taxonomy, $term['global']))) {
177
- if($term_id != $edit_term) {
178
  $this->error[] = __('A term with the name provided already exists', 'grand-media');
179
  break;
180
  }
181
  }
182
- if($edit_term) {
183
  $_term = $gmDB->get_term($edit_term);
184
- if(((int)$_term->global != (int)$user_ID) && !current_user_can('gmedia_edit_others_media')) {
185
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
186
  break;
187
  }
188
  $term_id = $gmDB->update_term($edit_term, $term);
189
- } else {
190
  $term_id = $gmDB->insert_term($term['name'], $term['taxonomy'], $term);
191
  }
192
- if(is_wp_error($term_id)) {
193
  $this->error[] = $term_id->get_error_message();
194
  break;
195
  }
196
-
197
- $this->msg[] = sprintf(__('Album `%s` successfuly saved', 'grand-media'), $term['name']);
198
-
199
- } while(0);
200
- } elseif(isset($_POST['gmedia_term_sort_save'])) {
201
- check_admin_referer('GmediaTerms', 'term_save_wpnonce');
202
- do {
203
- if(!$gmCore->caps['gmedia_album_manage']) {
204
- $this->error[] = __('You are not allowed to manage albums', 'grand-media');
205
- break;
206
  }
207
- $term_data = $gmCore->_post('term');
208
- $taxonomy = 'gmedia_album';
209
- if(!($term_id = $gmDB->term_exists($term_data['term_id']))) {
210
- $this->error[] = __('A term with the id provided do not exists', 'grand-media');
211
- break;
212
- } else {
213
- $_term = $gmDB->get_term($term_id);
214
- if(((int)$_term->global != (int)$user_ID) && !current_user_can('gmedia_edit_others_media')) {
215
- $this->error[] = __('You are not allowed to edit others media', 'grand-media');
216
- break;
217
- }
218
- //$term_meta = $term_data['meta'];
219
- $term_id = $gmDB->update_term_sortorder($term_id, $term_data);
220
-
221
- if(is_wp_error($term_id)) {
222
- $this->error[] = $term_id->get_error_message();
223
- break;
224
- }
225
 
226
- $this->msg[] = sprintf(__('Album `%s` successfuly saved', 'grand-media'), $_term->name);
227
- }
228
 
229
  } while(0);
230
- } elseif(isset($_POST['gmedia_category_save'])) {
231
  check_admin_referer('GmediaTerms', 'term_save_wpnonce');
232
- $edit_term = (int)$gmCore->_get('edit_item');
233
- do {
234
- if(!$gmCore->caps['gmedia_category_manage']) {
235
  $this->error[] = __('You are not allowed to manage categories', 'grand-media');
236
  break;
237
  }
238
  $term = $gmCore->_post('term');
239
- if(($meta = $gmCore->_post('meta'))) {
240
  $term = array_merge_recursive(array('meta' => $meta), $term);
241
  }
242
  $term['name'] = trim($term['name']);
243
- if(empty($term['name'])) {
244
  $this->error[] = __('Term Name is not specified', 'grand-media');
245
  break;
246
  }
247
- if($gmCore->is_digit($term['name'])) {
248
  $this->error[] = __("Term Name can't be only digits", 'grand-media');
249
  break;
250
  }
251
  $taxonomy = 'gmedia_category';
252
- if($edit_term && !$gmDB->term_exists($edit_term)) {
253
  $this->error[] = __('A term with the id provided do not exists', 'grand-media');
254
  $edit_term = false;
255
  }
256
- if(($term_id = $gmDB->term_exists($term['name'], $taxonomy))) {
257
- if($term_id != $edit_term) {
258
  $this->error[] = __('A term with the name provided already exists', 'grand-media');
259
  break;
260
  }
261
  }
262
- if($edit_term) {
263
- if(!current_user_can('gmedia_edit_others_media')) {
264
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
265
  break;
266
  }
267
  $term_id = $gmDB->update_term($edit_term, $term);
268
- } else {
269
  $term_id = $gmDB->insert_term($term['name'], $term['taxonomy'], $term);
270
  }
271
- if(is_wp_error($term_id)) {
272
  $this->error[] = $term_id->get_error_message();
273
  break;
274
  }
@@ -276,37 +205,106 @@ class GmediaProcessor_Terms extends GmediaProcessor {
276
  $this->msg[] = sprintf(__('Category `%s` successfuly saved', 'grand-media'), $term['name']);
277
 
278
  } while(0);
279
- } elseif(isset($_POST['gmedia_tag_add'])) {
280
- if($gmCore->caps['gmedia_tag_manage']) {
281
  check_admin_referer('GmediaTerms', 'term_save_wpnonce');
282
  $term = $gmCore->_post('term');
283
  $terms = array_filter(array_map('trim', explode(',', $term['name'])));
284
  $terms_added = 0;
285
  $terms_qty = count($terms);
286
- foreach($terms as $term_name) {
287
- if($gmCore->is_digit($term_name)) {
288
  $this->error['tag_name_digit'] = __("Term Name can't be only digits", 'grand-media');
289
  continue;
290
  }
291
 
292
- if(!$gmDB->term_exists($term_name, $term['taxonomy'])) {
293
  $term_id = $gmDB->insert_term($term_name, $term['taxonomy']);
294
- if(is_wp_error($term_id)) {
295
  $this->error[] = $term_id->get_error_message();
296
- } else {
297
- $this->msg['tag_add'] = sprintf(__('%d of %d tags successfuly added', 'grand-media'), ++$terms_added, $terms_qty);
298
  }
299
- } else {
300
  $this->error['tag_add'] = __('Some of provided tags are already exists', 'grand-media');
301
  }
302
  }
303
- } else {
304
  $this->error[] = __('You are not allowed to manage tags', 'grand-media');
305
  }
306
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  }
308
 
 
 
 
 
 
 
 
309
  }
310
 
311
- global $gmProcessor;
312
- $gmProcessor = new GmediaProcessor_Terms();
3
  /**
4
  * GmediaProcessor_Terms
5
  */
6
+ class GmediaProcessor_Terms extends GmediaProcessor{
7
 
8
+ private static $me = null;
9
  public static $cookie_key = false;
10
  public $selected_items = array();
11
  public $query_args = array();
13
  /**
14
  * GmediaProcessor_Library constructor.
15
  */
16
+ public function __construct(){
17
  parent::__construct();
18
 
19
+ self::$cookie_key = "gmedia_terms:{$this->taxterm}";
20
+ if(!isset($_COOKIE[ self::$cookie_key ])){
21
+ foreach($_COOKIE as $key => $value){
22
+ if('gmedia_terms' === substr($key, 0, 12)){
23
+ setcookie($key, '', time() - 3600);
24
+ unset($_COOKIE[ $key ]);
25
+ }
26
+ }
 
 
 
 
27
  }
 
28
  $this->selected_items = parent::selected_items(self::$cookie_key);
 
29
  }
30
 
31
  /**
32
  * @return array
33
  */
34
+ public function query_args(){
35
  global $gmCore;
36
 
37
  $args['status'] = $gmCore->_get('status');
45
  $args['order'] = $gmCore->_get('order', $this->user_options["sortorder_{$this->taxonomy}"]);
46
  $args['hide_empty'] = $gmCore->_get('hide_empty');
47
 
48
+ if($args['search'] && ('#' == substr($args['search'], 0, 1))){
49
  $args['include'] = substr($args['search'], 1);
50
+ $args['search'] = false;
51
  }
52
 
53
+ if(('selected' == $gmCore->_req('filter')) && !empty($this->selected_items)){
54
  $args['include'] = $this->selected_items;
55
+ $args['orderby'] = $gmCore->_get('orderby', 'include');
56
+ $args['order'] = $gmCore->_get('order', 'ASC');
57
  }
58
 
59
  $query_args = apply_filters('gmedia_terms_query_args', $args);
60
 
61
  foreach($query_args as $key => $val){
62
  if(empty($val) && ('0' !== $val) && (0 !== $val)){
63
+ unset($query_args[ $key ]);
64
  }
65
  }
66
 
67
  return $query_args;
68
  }
69
 
70
+ protected function processor(){
71
  global $user_ID, $gmCore, $gmDB;
72
 
73
+ if(!$gmCore->caps['gmedia_library']){
74
  wp_die(__('You are not allowed to be here', 'grand-media'));
75
  }
76
 
81
  $taxonomy = $this->taxonomy;
82
  switch($taxonomy){
83
  case 'gmedia_album':
84
+ if(gm_user_can('album_manage')){
85
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_album_tpl');
86
+ } else{
87
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
88
  }
89
  break;
90
  case 'gmedia_category':
91
+ if(gm_user_can('category_manage')){
92
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_category_tpl');
93
+ } else{
94
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
95
  }
96
  break;
97
  case 'gmedia_tag':
98
+ if(gm_user_can('tag_manage')){
99
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_tag_tpl');
100
+ } else{
101
  add_action('gmedia_before_terms_list', 'gmedia_terms_create_alert_tpl');
102
  }
103
  break;
104
  }
105
 
106
+ if(isset($_POST['gmedia_album_save'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  check_admin_referer('GmediaTerms', 'term_save_wpnonce');
108
+ $edit_term = (int)$gmCore->_get('edit_term');
109
+ do{
110
+ if(!$gmCore->caps['gmedia_album_manage']){
111
  $this->error[] = __('You are not allowed to manage albums', 'grand-media');
112
  break;
113
  }
114
  $term = $gmCore->_post('term');
115
+ if(($meta = $gmCore->_post('meta'))){
116
  $term = array_merge_recursive(array('meta' => $meta), $term);
117
  }
118
  $term['name'] = trim($term['name']);
119
+ if(empty($term['name'])){
120
  $this->error[] = __('Term Name is not specified', 'grand-media');
121
  break;
122
  }
123
+ if($gmCore->is_digit($term['name'])){
124
  $this->error[] = __("Term Name can't be only digits", 'grand-media');
125
  break;
126
  }
127
  $taxonomy = 'gmedia_album';
128
+ if($edit_term && !$gmDB->term_exists($edit_term)){
129
  $this->error[] = __('A term with the id provided do not exists', 'grand-media');
130
  $edit_term = false;
131
  }
132
+ if(($term_id = $gmDB->term_exists($term['name'], $taxonomy, $term['global']))){
133
+ if($term_id != $edit_term){
134
  $this->error[] = __('A term with the name provided already exists', 'grand-media');
135
  break;
136
  }
137
  }
138
+ if($edit_term){
139
  $_term = $gmDB->get_term($edit_term);
140
+ if(((int)$_term->global != (int)$user_ID) && !current_user_can('gmedia_edit_others_media')){
141
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
142
  break;
143
  }
144
  $term_id = $gmDB->update_term($edit_term, $term);
145
+ } else{
146
  $term_id = $gmDB->insert_term($term['name'], $term['taxonomy'], $term);
147
  }
148
+ if(is_wp_error($term_id)){
149
  $this->error[] = $term_id->get_error_message();
150
  break;
151
  }
152
+ if(isset($term['reset_custom_order'])){
153
+ $gmDB->update_term_sortorder($term_id);
 
 
 
 
 
 
 
 
154
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
+ $this->msg[] = sprintf(__('Album `%s` successfuly saved', 'grand-media'), $term['name']);
 
157
 
158
  } while(0);
159
+ } elseif(isset($_POST['gmedia_category_save'])){
160
  check_admin_referer('GmediaTerms', 'term_save_wpnonce');
161
+ $edit_term = (int)$gmCore->_get('edit_term');
162
+ do{
163
+ if(!$gmCore->caps['gmedia_category_manage']){
164
  $this->error[] = __('You are not allowed to manage categories', 'grand-media');
165
  break;
166
  }
167
  $term = $gmCore->_post('term');
168
+ if(($meta = $gmCore->_post('meta'))){
169
  $term = array_merge_recursive(array('meta' => $meta), $term);
170
  }
171
  $term['name'] = trim($term['name']);
172
+ if(empty($term['name'])){
173
  $this->error[] = __('Term Name is not specified', 'grand-media');
174
  break;
175
  }
176
+ if($gmCore->is_digit($term['name'])){
177
  $this->error[] = __("Term Name can't be only digits", 'grand-media');
178
  break;
179
  }
180
  $taxonomy = 'gmedia_category';
181
+ if($edit_term && !$gmDB->term_exists($edit_term)){
182
  $this->error[] = __('A term with the id provided do not exists', 'grand-media');
183
  $edit_term = false;
184
  }
185
+ if(($term_id = $gmDB->term_exists($term['name'], $taxonomy))){
186
+ if($term_id != $edit_term){
187
  $this->error[] = __('A term with the name provided already exists', 'grand-media');
188
  break;
189
  }
190
  }
191
+ if($edit_term){
192
+ if(!current_user_can('gmedia_edit_others_media')){
193
  $this->error[] = __('You are not allowed to edit others media', 'grand-media');
194
  break;
195
  }
196
  $term_id = $gmDB->update_term($edit_term, $term);
197
+ } else{
198
  $term_id = $gmDB->insert_term($term['name'], $term['taxonomy'], $term);
199
  }
200
+ if(is_wp_error($term_id)){
201
  $this->error[] = $term_id->get_error_message();
202
  break;
203
  }
205
  $this->msg[] = sprintf(__('Category `%s` successfuly saved', 'grand-media'), $term['name']);
206
 
207
  } while(0);
208
+ } elseif(isset($_POST['gmedia_tag_add'])){
209
+ if($gmCore->caps['gmedia_tag_manage']){
210
  check_admin_referer('GmediaTerms', 'term_save_wpnonce');
211
  $term = $gmCore->_post('term');
212
  $terms = array_filter(array_map('trim', explode(',', $term['name'])));
213
  $terms_added = 0;
214
  $terms_qty = count($terms);
215
+ foreach($terms as $term_name){
216
+ if($gmCore->is_digit($term_name)){
217
  $this->error['tag_name_digit'] = __("Term Name can't be only digits", 'grand-media');
218
  continue;
219
  }
220
 
221
+ if(!$gmDB->term_exists($term_name, $term['taxonomy'])){
222
  $term_id = $gmDB->insert_term($term_name, $term['taxonomy']);
223
+ if(is_wp_error($term_id)){
224
  $this->error[] = $term_id->get_error_message();
225
+ } else{
226
+ $this->msg['tag_add'] = sprintf(__('%d of %d tags successfuly added', 'grand-media'), ++ $terms_added, $terms_qty);
227
  }
228
+ } else{
229
  $this->error['tag_add'] = __('Some of provided tags are already exists', 'grand-media');
230
  }
231
  }
232
+ } else{
233
  $this->error[] = __('You are not allowed to manage tags', 'grand-media');
234
  }
235
  }
236
+
237
+ $do_gmedia_terms = $gmCore->_get('do_gmedia_terms');
238
+ if('delete' == $do_gmedia_terms){
239
+ check_admin_referer('gmedia_delete');
240
+ if($gmCore->caps['gmedia_terms_delete']){
241
+ $ids = $gmCore->_get('ids', 'selected');
242
+ $selected_items = ('selected' == $ids)? $this->selected_items : wp_parse_id_list($ids);
243
+ if(!$gmCore->caps['gmedia_delete_others_media']){
244
+ $_selected_items = array();
245
+ if('gmedia_album' == $taxonomy){
246
+ $_selected_items = $gmDB->get_terms($taxonomy, array('fields' => 'ids', 'global' => $user_ID, 'include' => $selected_items));
247
+ }
248
+ if(count($_selected_items) < count($selected_items)){
249
+ $this->error[] = __('You are not allowed to delete others media', 'grand-media');
250
+ }
251
+ $selected_items = $_selected_items;
252
+ }
253
+ if(($count = count($selected_items))){
254
+ foreach($selected_items as $item){
255
+ $delete = $gmDB->delete_term($item);
256
+ if(!$delete){
257
+ $count --;
258
+ } elseif(is_wp_error($delete)){
259
+ $this->error[] = $delete->get_error_message();
260
+ $count --;
261
+ }
262
+ }
263
+ if($count){
264
+ $this->msg[] = sprintf(__('%d item(s) deleted successfuly', 'grand-media'), $count);
265
+ }
266
+ setcookie(self::$cookie_key, '', time() - 3600);
267
+ unset($_COOKIE[ self::$cookie_key ]);
268
+ $this->selected_items = array();
269
+ }
270
+ } else{
271
+ $this->error[] = __('You are not allowed to delete terms', 'grand-media');
272
+ }
273
+ if(!empty($this->msg)){
274
+ set_transient('gmedia_action_msg', $this->msg, 30);
275
+ }
276
+ if(!empty($this->error)){
277
+ set_transient('gmedia_action_error', $this->error, 30);
278
+ }
279
+ }
280
+ if($do_gmedia_terms){
281
+ $location = remove_query_arg(array('do_gmedia_terms', 'ids', '_wpnonce'));
282
+ $location = add_query_arg('did_gmedia_terms', $do_gmedia_terms, $location);
283
+ wp_redirect($location);
284
+ exit;
285
+ }
286
+ if($gmCore->_get('did_gmedia_terms')){
287
+ $msg = get_transient('gmedia_action_msg');
288
+ if($msg){
289
+ delete_transient('gmedia_action_msg');
290
+ $this->msg = $msg;
291
+ }
292
+ $error = get_transient('gmedia_action_error');
293
+ if($error){
294
+ delete_transient('gmedia_action_error');
295
+ $this->error = $error;
296
+ }
297
+ }
298
  }
299
 
300
+ public static function getMe(){
301
+ if(self::$me == null){
302
+ self::$me = new GmediaProcessor_Terms();
303
+ }
304
+
305
+ return self::$me;
306
+ }
307
  }
308
 
309
+ global $gmProcessorTerms;
310
+ $gmProcessorTerms = GmediaProcessor_Terms::getMe();
admin/processor/class.processor.wpmedia.php CHANGED
@@ -5,6 +5,7 @@
5
  */
6
  class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
7
 
 
8
  public static $cookie_key = false;
9
  public $selected_items = array();
10
 
@@ -16,7 +17,7 @@ class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
16
 
17
  global $user_ID;
18
 
19
- self::$cookie_key = "gmuser_{$user_ID}_wpmedia";
20
  $this->selected_items = parent::selected_items(self::$cookie_key);
21
 
22
  }
@@ -30,7 +31,14 @@ class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
30
 
31
  }
32
 
 
 
 
 
 
 
 
33
  }
34
 
35
- global $gmProcessor;
36
- $gmProcessor = new GmediaProcessor_WordpressLibrary();
5
  */
6
  class GmediaProcessor_WordpressLibrary extends GmediaProcessor {
7
 
8
+ private static $me = null;
9
  public static $cookie_key = false;
10
  public $selected_items = array();
11
 
17
 
18
  global $user_ID;
19
 
20
+ self::$cookie_key = "gmedia_library:wpmedia";
21
  $this->selected_items = parent::selected_items(self::$cookie_key);
22
 
23
  }
31
 
32
  }
33
 
34
+ public static function getMe() {
35
+ if ( self::$me == null ) {
36
+ self::$me = new GmediaProcessor_WordpressLibrary();
37
+ }
38
+
39
+ return self::$me;
40
+ }
41
  }
42
 
43
+ global $gmProcessorWPMedia;
44
+ $gmProcessorWPMedia = GmediaProcessor_WordpressLibrary::getMe();
admin/tpl/comments.php CHANGED
@@ -43,7 +43,7 @@ $post = get_post($post_id);
43
  __('Open in new tab'));
44
  if($gmedia_id) { ?>
45
  <span class="thumbnail">
46
- <?php gmedia_item_thumbnail($gmedia); ?>
47
  </span>
48
  <?php } ?>
49
  <h4><?php echo $post->post_title; ?></h4>
43
  __('Open in new tab'));
44
  if($gmedia_id) { ?>
45
  <span class="thumbnail">
46
+ <?php echo gmedia_item_thumbnail($gmedia); ?>
47
  </span>
48
  <?php } ?>
49
  <h4><?php echo $post->post_title; ?></h4>
admin/tpl/modal-share.php CHANGED
@@ -19,7 +19,7 @@ if(!defined('ABSPATH')) {
19
  </span>
20
  <input type="text" class="form-control" readonly="readonly" value="" />
21
  <span class="input-group-btn">
22
- <a target="_blank" class="btn btn-default" href=""><span class="glyphicon glyphicon-new-window"></span></a>
23
  </span>
24
  </div>
25
  </div>
@@ -31,7 +31,7 @@ if(!defined('ABSPATH')) {
31
  </span>
32
  <input type="text" class="form-control" readonly="readonly" value="" />
33
  <span class="input-group-btn">
34
- <a target="_blank" class="btn btn-default" href=""><span class="glyphicon glyphicon-new-window"></span></a>
35
  </span>
36
  </div>
37
  </div>
19
  </span>
20
  <input type="text" class="form-control" readonly="readonly" value="" />
21
  <span class="input-group-btn">
22
+ <a target="_blank" class="btn btn-default" href="" title="<?php _e('Open in new Tab', 'grand-media') ?>"><span class="glyphicon glyphicon-new-window"></span></a>
23
  </span>
24
  </div>
25
  </div>
31
  </span>
32
  <input type="text" class="form-control" readonly="readonly" value="" />
33
  <span class="input-group-btn">
34
+ <a target="_blank" class="btn btn-default" href="" title="<?php _e('Open in new Tab', 'grand-media') ?>"><span class="glyphicon glyphicon-new-window"></span></a>
35
  </span>
36
  </div>
37
  </div>
admin/tpl/search-form.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php // don't load directly
2
- if(!defined('ABSPATH')) {
3
  die('-1');
4
  }
5
 
@@ -10,14 +10,19 @@ global $gmCore;
10
  ?>
11
  <form class="form-inline gmedia-search-form" role="search" method="get">
12
  <div class="form-group">
13
- <?php foreach($_GET as $key => $value) {
14
- if(in_array($key, array('page', 'mode', 'author', 'global', 'mime_type', 'tag_id', 'tag__in', 'cat', 'category__in', 'alb', 'album__in', 'term', 'chromeless', 'post_id', 'tab', 'orderby', 'order', 'number'))) {
 
 
 
15
  ?>
16
- <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
17
  <?php
18
  }
19
- } ?>
20
- <input id="gmedia-search" class="form-control input-xs" type="text" name="s" placeholder="<?php _e('Search...', 'grand-media'); ?>" value="<?php echo $gmCore->_get('s', ''); ?>"/>
 
 
21
  </div>
22
  <button type="submit" class="btn btn-default input-xs"><span class="glyphicon glyphicon-search"></span></button>
23
  </form>
1
  <?php // don't load directly
2
+ if(!defined('ABSPATH')){
3
  die('-1');
4
  }
5
 
10
  ?>
11
  <form class="form-inline gmedia-search-form" role="search" method="get">
12
  <div class="form-group">
13
+ <?php foreach($_GET as $key => $value){
14
+ if(!in_array($key, array('doing_wp_cron', '_wpnonce', 'do_gmedia', 'did_gmedia', 'do_gmedia_terms', 'did_gmedia_terms', 'ids', 's'))){
15
+ if(is_array($value)){
16
+ $value = implode(',', $value);
17
+ }
18
  ?>
19
+ <input type="hidden" name="<?php esc_attr_e($key); ?>" value="<?php esc_attr_e($value); ?>"/>
20
  <?php
21
  }
22
+ }
23
+ $gm_search_string = $gmCore->_get('s', '');
24
+ ?>
25
+ <input id="gmedia-search" class="form-control input-xs" type="text" name="s" placeholder="<?php _e('Search...', 'grand-media'); ?>" value="<?php esc_attr_e($gm_search_string); ?>"/>
26
  </div>
27
  <button type="submit" class="btn btn-default input-xs"><span class="glyphicon glyphicon-search"></span></button>
28
  </form>
admin/wpmedia.php CHANGED
@@ -28,6 +28,7 @@ function grandWPMedia() {
28
  's' => $gmCore->_get('s', '')
29
  );
30
  $wpMediaLib = $gmDB->get_wp_media_lib($arg);
 
31
 
32
  $gm_qty = array('total' => '', 'image' => '', 'audio' => '', 'video' => '', 'text' => '', 'application' => '', 'other' => '');
33
 
@@ -38,27 +39,27 @@ function grandWPMedia() {
38
  ?>
39
  <div class="panel panel-default panel-fixed-header">
40
  <div class="panel-heading-fake"></div>
41
- <div class="panel-heading clearfix">
42
- <form class="form-inline gmedia-search-form" role="search">
43
- <div class="form-group">
44
- <?php foreach($_GET as $key => $value) {
45
- if(in_array($key, array('page', 'mime_type'))) {
46
- ?>
47
- <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
48
- <?php
49
- }
50
- } ?>
51
- <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', ''); ?>"/>
52
  </div>
53
- <button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span>
54
- </button>
55
- </form>
56
- <?php echo $gmDB->query_pager(); ?>
57
- <div class="spinner"></div>
 
58
 
59
  <div class="btn-toolbar pull-left">
60
  <div class="btn-group gm-checkgroup" id="cb_global-btn">
61
- <span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="cb_media-object" type="checkbox"/></span>
62
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
63
  <span class="caret"></span>
64
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
@@ -78,7 +79,7 @@ function grandWPMedia() {
78
 
79
  <div class="btn-group">
80
  <?php $curr_mime = explode(',', $gmCore->_get('mime_type', 'total')); ?>
81
- <?php if($gmDB->filter) { ?>
82
  <a class="btn btn-warning" title="<?php _e('Reset Filter', 'grand-media'); ?>" rel="total" href="<?php echo $url; ?>"><?php _e('Filter', 'grand-media'); ?></a>
83
  <?php } else { ?>
84
  <button type="button" class="btn btn-default"><?php _e('Filter', 'grand-media'); ?></button>
@@ -129,7 +130,7 @@ function grandWPMedia() {
129
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
130
  <span class="caret"></span>
131
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
132
- <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="wpmedia" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
133
  <ul class="dropdown-menu" role="menu">
134
  <li><a id="gm-selected-show" href="#show"><?php _e('Show only selected items', 'grand-media'); ?></a></li>
135
  <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'grand-media'); ?></a></li>
@@ -151,7 +152,7 @@ function grandWPMedia() {
151
  <thead>
152
  <tr>
153
  <th class="cb"><span>#</span></th>
154
- <th class="id">
155
  <?php $new_order = ('ID' == $arg['orderby'])? (('DESC' == $arg['order'])? 'ASC' : 'DESC') : 'DESC'; ?>
156
  <a href="<?php echo $gmCore->get_admin_url(array('orderby' => 'ID', 'order' => $new_order)); ?>"><?php _e('ID', 'grand-media'); ?></a>
157
  </th>
@@ -163,7 +164,7 @@ function grandWPMedia() {
163
  )); ?>"><?php _e('File', 'grand-media'); ?></a>
164
  </th>
165
  <th class="type"><span><?php _e('Type', 'grand-media'); ?></span></th>
166
- <th class="title">
167
  <?php $new_order = ('title' == $arg['orderby'])? (('DESC' == $arg['order'])? 'ASC' : 'DESC') : 'DESC'; ?>
168
  <a href="<?php echo $gmCore->get_admin_url(array('orderby' => 'title', 'order' => $new_order)); ?>"><?php _e('Title', 'grand-media'); ?></a>
169
  </th>
@@ -186,7 +187,7 @@ function grandWPMedia() {
186
  ?>
187
  <tr data-id="<?php echo $item->ID; ?>">
188
  <td class="cb">
189
- <span class="cb_media-object"><input name="doaction[]" type="checkbox" data-type="<?php echo $type[0]; ?>" value="<?php echo $item->ID; ?>"<?php echo $is_selected? ' checked="checked"' : ''; ?>/></span>
190
  </td>
191
  <td class="id"><span><?php echo $item->ID; ?></span></td>
192
  <td class="file">
28
  's' => $gmCore->_get('s', '')
29
  );
30
  $wpMediaLib = $gmDB->get_wp_media_lib($arg);
31
+ $gmedia_pager = $gmDB->query_pager();
32
 
33
  $gm_qty = array('total' => '', 'image' => '', 'audio' => '', 'video' => '', 'text' => '', 'application' => '', 'other' => '');
34
 
39
  ?>
40
  <div class="panel panel-default panel-fixed-header">
41
  <div class="panel-heading-fake"></div>
42
+ <div class="panel-heading clearfix" style="padding-bottom:2px;">
43
+ <div class="pull-right" style="margin-bottom:3px;">
44
+ <div class="clearfix">
45
+ <?php include(GMEDIA_ABSPATH . 'admin/tpl/search-form.php'); ?>
46
+
47
+ <div class="btn-toolbar pull-right" style="margin-bottom:4px; margin-left:4px;">
48
+ <?php if(!$gmProcessor->gmediablank){ ?>
49
+ <a title="<?php _e('More Screen Settings', 'grand-media'); ?>" class="show-settings-link pull-right btn btn-default btn-xs"><span class="glyphicon glyphicon-cog"></span></a>
50
+ <?php } ?>
51
+ </div>
 
52
  </div>
53
+
54
+ <?php echo $gmedia_pager; ?>
55
+
56
+ <div class="spinner"></div>
57
+
58
+ </div>
59
 
60
  <div class="btn-toolbar pull-left">
61
  <div class="btn-group gm-checkgroup" id="cb_global-btn">
62
+ <span class="btn btn-default active"><input class="doaction" id="cb_global" data-group="cb_object" type="checkbox"/></span>
63
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
64
  <span class="caret"></span>
65
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
79
 
80
  <div class="btn-group">
81
  <?php $curr_mime = explode(',', $gmCore->_get('mime_type', 'total')); ?>
82
+ <?php if(!empty($gmDB->filter)) { ?>
83
  <a class="btn btn-warning" title="<?php _e('Reset Filter', 'grand-media'); ?>" rel="total" href="<?php echo $url; ?>"><?php _e('Filter', 'grand-media'); ?></a>
84
  <?php } else { ?>
85
  <button type="button" class="btn btn-default"><?php _e('Filter', 'grand-media'); ?></button>
130
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
131
  <span class="caret"></span>
132
  <span class="sr-only"><?php _e('Toggle Dropdown', 'grand-media'); ?></span></button>
133
+ <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>" data-key="gmedia_library:wpmedia" name="selected_items" value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
134
  <ul class="dropdown-menu" role="menu">
135
  <li><a id="gm-selected-show" href="#show"><?php _e('Show only selected items', 'grand-media'); ?></a></li>
136
  <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'grand-media'); ?></a></li>
152
  <thead>
153
  <tr>
154
  <th class="cb"><span>#</span></th>
155
+ <th class="id" title="<?php _e('Sort by ID', 'grand-media'); ?>">
156
  <?php $new_order = ('ID' == $arg['orderby'])? (('DESC' == $arg['order'])? 'ASC' : 'DESC') : 'DESC'; ?>
157
  <a href="<?php echo $gmCore->get_admin_url(array('orderby' => 'ID', 'order' => $new_order)); ?>"><?php _e('ID', 'grand-media'); ?></a>
158
  </th>
164
  )); ?>"><?php _e('File', 'grand-media'); ?></a>
165
  </th>
166
  <th class="type"><span><?php _e('Type', 'grand-media'); ?></span></th>
167
+ <th class="title" title="<?php _e('Sort by Title', 'grand-media'); ?>">
168
  <?php $new_order = ('title' == $arg['orderby'])? (('DESC' == $arg['order'])? 'ASC' : 'DESC') : 'DESC'; ?>
169
  <a href="<?php echo $gmCore->get_admin_url(array('orderby' => 'title', 'order' => $new_order)); ?>"><?php _e('Title', 'grand-media'); ?></a>
170
  </th>
187
  ?>
188
  <tr data-id="<?php echo $item->ID; ?>">
189
  <td class="cb">
190
+ <span class="cb_object"><input name="doaction[]" type="checkbox" data-type="<?php echo $type[0]; ?>" value="<?php echo $item->ID; ?>"<?php echo $is_selected? ' checked="checked"' : ''; ?>/></span>
191
  </td>
192
  <td class="id"><span><?php echo $item->ID; ?></span></td>
193
  <td class="file">
assets/fancybox/jquery.fancybox-1.3.4.pack.js CHANGED
@@ -1,46 +1 @@
1
- /*
2
- * FancyBox - jQuery Plugin
3
- * Simple and fancy lightbox alternative
4
- *
5
- * Examples and documentation at: http://fancybox.net
6
- *
7
- * Copyright (c) 2008 - 2010 Janis Skarnelis
8
- * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
- *
10
- * Version: 1.3.4 (11/11/2010)
11
- * Requires: jQuery v1.3+
12
- *
13
- * Dual licensed under the MIT and GPL licenses:
14
- * http://www.opensource.org/licenses/mit-license.php
15
- * http://www.gnu.org/licenses/gpl.html
16
- */
17
-
18
- ;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
19
- F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
20
- c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
21
- false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
22
- function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
23
- '"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
24
- "function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
25
- ";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
26
- opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
27
- d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
28
- y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
29
- i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
30
- f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
31
- 37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
32
- s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
33
- f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
34
- j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
35
- "image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
36
- 10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
37
- b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
38
- 0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
39
- 1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
40
- true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
41
- b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
42
- d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
43
- D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
44
- b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
45
- b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
46
- easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
47
  * FancyBox - jQuery Plugin
48
  * Simple and fancy lightbox alternative
49
  *
50
  * Examples and documentation at: http://fancybox.net
51
  *
52
  * Copyright (c) 2008 - 2010 Janis Skarnelis
53
  * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
54
  *
55
  * Version: 1.3.4 (11/11/2010)
56
  * Requires: jQuery v1.3+
57
  *
58
  * Dual licensed under the MIT and GPL licenses:
59
  * http://www.opensource.org/licenses/mit-license.php
60
  * http://www.gnu.org/licenses/gpl.html
61
  */
1
+ /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  * FancyBox - jQuery Plugin
3
  * Simple and fancy lightbox alternative
4
  *
5
  * Examples and documentation at: http://fancybox.net
6
  *
7
  * Copyright (c) 2008 - 2010 Janis Skarnelis
8
  * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
  *
10
  * Version: 1.3.4 (11/11/2010)
11
  * Requires: jQuery v1.3+
12
  *
13
  * Dual licensed under the MIT and GPL licenses:
14
  * http://www.opensource.org/licenses/mit-license.php
15
  * http://www.gnu.org/licenses/gpl.html
16
  */
assets/jq-plugins/jquery.tinysort.js DELETED
@@ -1,289 +0,0 @@
1
- /*! TinySort
2
- * Copyright (c) 2008-2013 Ron Valstar http://tinysort.sjeiti.com/
3
- *
4
- * Dual licensed under the MIT and GPL licenses:
5
- * http://www.opensource.org/licenses/mit-license.php
6
- * http://www.gnu.org/licenses/gpl.html
7
- *//*
8
- * Description:
9
- * A jQuery plugin to sort child nodes by (sub) contents or attributes.
10
- *
11
- * Contributors:
12
- * brian.gibson@gmail.com
13
- * michael.thornberry@gmail.com
14
- *
15
- * Usage:
16
- * $("ul#people>li").tsort();
17
- * $("ul#people>li").tsort("span.surname");
18
- * $("ul#people>li").tsort("span.surname",{order:"desc"});
19
- * $("ul#people>li").tsort({place:"end"});
20
- * $("ul#people>li").tsort("span.surname",{order:"desc"},span.name");
21
- *
22
- * Change default like so:
23
- * $.tinysort.defaults.order = "desc";
24
- *
25
- */
26
- ;(function($,undefined) {
27
- 'use strict';
28
- // private vars
29
- var fls = !1 // minify placeholder
30
- ,nll = null // minify placeholder
31
- ,prsflt = parseFloat // minify placeholder
32
- ,mathmn = Math.min // minify placeholder
33
- ,rxLastNr = /(-?\d+\.?\d*)$/g // regex for testing strings ending on numbers
34
- ,rxLastNrNoDash = /(\d+\.?\d*)$/g // regex for testing strings ending on numbers ignoring dashes
35
- ,aPluginPrepare = []
36
- ,aPluginSort = []
37
- ,isString = function(o){return typeof o=='string';}
38
- ,loop = function(array,func){
39
- var l = array.length
40
- ,i = l
41
- ,j;
42
- while (i--) {
43
- j = l-i-1;
44
- func(array[j],j);
45
- }
46
- }
47
- // Array.prototype.indexOf for IE (issue #26) (local variable to prevent unwanted prototype pollution)
48
- ,fnIndexOf = Array.prototype.indexOf||function(elm) {
49
- var len = this.length
50
- ,from = Number(arguments[1])||0;
51
- from = from<0?Math.ceil(from):Math.floor(from);
52
- if (from<0) from += len;
53
- for (;from<len;from++){
54
- if (from in this && this[from]===elm) return from;
55
- }
56
- return -1;
57
- }
58
- ;
59
- //
60
- // init plugin
61
- $.tinysort = {
62
- id: 'TinySort'
63
- ,version: '1.5.6'
64
- ,copyright: 'Copyright (c) 2008-2013 Ron Valstar'
65
- ,uri: 'http://tinysort.sjeiti.com/'
66
- ,licensed: {
67
- MIT: 'http://www.opensource.org/licenses/mit-license.php'
68
- ,GPL: 'http://www.gnu.org/licenses/gpl.html'
69
- }
70
- ,plugin: (function(){
71
- var fn = function(prepare,sort){
72
- aPluginPrepare.push(prepare); // function(settings){doStuff();}
73
- aPluginSort.push(sort); // function(valuesAreNumeric,sA,sB,iReturn){doStuff();return iReturn;}
74
- };
75
- // expose stuff to plugins
76
- fn.indexOf = fnIndexOf;
77
- return fn;
78
- })()
79
- ,defaults: { // default settings
80
-
81
- order: 'asc' // order: asc, desc or rand
82
-
83
- ,attr: nll // order by attribute value
84
- ,data: nll // use the data attribute for sorting
85
- ,useVal: fls // use element value instead of text
86
-
87
- ,place: 'start' // place ordered elements at position: start, end, org (original position), first
88
- ,returns: fls // return all elements or only the sorted ones (true/false)
89
-
90
- ,cases: fls // a case sensitive sort orders [aB,aa,ab,bb]
91
- ,forceStrings:fls // if false the string '2' will sort with the value 2, not the string '2'
92
-
93
- ,ignoreDashes:fls // ignores dashes when looking for numerals
94
-
95
- ,sortFunction: nll // override the default sort function
96
- }
97
- };
98
- $.fn.extend({
99
- tinysort: function() {
100
- var i,j,l
101
- ,oThis = this
102
- ,aNewOrder = []
103
- // sortable- and non-sortable list per parent
104
- ,aElements = []
105
- ,aElementsParent = [] // index reference for parent to aElements
106
- // multiple sort criteria (sort===0?iCriteria++:iCriteria=0)
107
- ,aCriteria = []
108
- ,iCriteria = 0
109
- ,iCriteriaMax
110
- //
111
- ,aFind = []
112
- ,aSettings = []
113
- //
114
- ,fnPluginPrepare = function(_settings){
115
- loop(aPluginPrepare,function(fn){
116
- fn.call(fn,_settings);
117
- });
118
- }
119
- //
120
- ,fnPrepareSortElement = function(settings,element){
121
- if (typeof element=='string') {
122
- // if !settings.cases
123
- if (!settings.cases) element = toLowerCase(element);
124
- element = element.replace(/^\s*(.*?)\s*$/i, '$1');
125
- }
126
- return element;
127
- }
128
- //
129
- ,fnSort = function(a,b) {
130
- var iReturn = 0;
131
- if (iCriteria!==0) iCriteria = 0;
132
- while (iReturn===0&&iCriteria<iCriteriaMax) {
133
- var oPoint = aCriteria[iCriteria]
134
- ,oSett = oPoint.oSettings
135
- ,rxLast = oSett.ignoreDashes?rxLastNrNoDash:rxLastNr
136
- ;
137
- //
138
- fnPluginPrepare(oSett);
139
- //
140
- if (oSett.sortFunction) { // custom sort
141
- iReturn = oSett.sortFunction(a,b);
142
- } else if (oSett.order=='rand') { // random sort
143
- iReturn = Math.random()<0.5?1:-1;
144
- } else { // regular sort
145
- var bNumeric = fls
146
- // prepare sort elements
147
- ,sA = fnPrepareSortElement(oSett,a.s[iCriteria])
148
- ,sB = fnPrepareSortElement(oSett,b.s[iCriteria])
149
- ;
150
- // maybe force Strings
151
- if (!oSett.forceStrings) {
152
- // maybe mixed
153
- var aAnum = isString(sA)?sA&&sA.match(rxLast):fls
154
- ,aBnum = isString(sB)?sB&&sB.match(rxLast):fls;
155
- if (aAnum&&aBnum) {
156
- var sAprv = sA.substr(0,sA.length-aAnum[0].length)
157
- ,sBprv = sB.substr(0,sB.length-aBnum[0].length);
158
- if (sAprv==sBprv) {
159
- bNumeric = !fls;
160
- sA = prsflt(aAnum[0]);
161
- sB = prsflt(aBnum[0]);
162
- }
163
- }
164
- }
165
- iReturn = oPoint.iAsc*(sA<sB?-1:(sA>sB?1:0));
166
- }
167
-
168
- loop(aPluginSort,function(fn){
169
- iReturn = fn.call(fn,bNumeric,sA,sB,iReturn);
170
- });
171
-
172
- if (iReturn===0) iCriteria++;
173
- }
174
-
175
- return iReturn;
176
- }
177
- ;
178
- // fill aFind and aSettings but keep length pairing up
179
- for (i=0,l=arguments.length;i<l;i++){
180
- var o = arguments[i];
181
- if (isString(o)) {
182
- if (aFind.push(o)-1>aSettings.length) aSettings.length = aFind.length-1;
183
- } else {
184
- if (aSettings.push(o)>aFind.length) aFind.length = aSettings.length;
185
- }
186
- }
187
- if (aFind.length>aSettings.length) aSettings.length = aFind.length; // todo: and other way around?
188
-
189
- // fill aFind and aSettings for arguments.length===0
190
- iCriteriaMax = aFind.length;
191
- if (iCriteriaMax===0) {
192
- iCriteriaMax = aFind.length = 1;
193
- aSettings.push({});
194
- }
195
-
196
- for (i=0,l=iCriteriaMax;i<l;i++) {
197
- var sFind = aFind[i]
198
- ,oSettings = $.extend({}, $.tinysort.defaults, aSettings[i])
199
- // has find, attr or data
200
- ,bFind = !(!sFind||sFind==='')
201
- // since jQuery's filter within each works on array index and not actual index we have to create the filter in advance
202
- ,bFilter = bFind&&sFind[0]===':'
203
- ;
204
- aCriteria.push({ // todo: only used locally, find a way to minify properties
205
- sFind: sFind
206
- ,oSettings: oSettings
207
- // has find, attr or data
208
- ,bFind: bFind
209
- ,bAttr: !(oSettings.attr===nll||oSettings.attr==='')
210
- ,bData: oSettings.data!==nll
211
- // filter
212
- ,bFilter: bFilter
213
- ,$Filter: bFilter?oThis.filter(sFind):oThis
214
- ,fnSort: oSettings.sortFunction
215
- ,iAsc: oSettings.order=='asc'?1:-1
216
- });
217
- }
218
- //
219
- // prepare oElements for sorting
220
- oThis.each(function(i,el) {
221
- var $Elm = $(el)
222
- ,mParent = $Elm.parent().get(0)
223
- ,mFirstElmOrSub // we still need to distinguish between sortable and non-sortable elements (might have unexpected results for multiple criteria)
224
- ,aSort = []
225
- ;
226
- for (j=0;j<iCriteriaMax;j++) {
227
- var oPoint = aCriteria[j]
228
- // element or sub selection
229
- ,mElmOrSub = oPoint.bFind?(oPoint.bFilter?oPoint.$Filter.filter(el):$Elm.find(oPoint.sFind)):$Elm;
230
- // text or attribute value
231
- aSort.push(oPoint.bData?mElmOrSub.data(oPoint.oSettings.data):(oPoint.bAttr?mElmOrSub.attr(oPoint.oSettings.attr):(oPoint.oSettings.useVal?mElmOrSub.val():mElmOrSub.text())));
232
- if (mFirstElmOrSub===undefined) mFirstElmOrSub = mElmOrSub;
233
- }
234
- // to sort or not to sort
235
- var iElmIndex = fnIndexOf.call(aElementsParent,mParent);
236
- if (iElmIndex<0) {
237
- iElmIndex = aElementsParent.push(mParent) - 1;
238
- aElements[iElmIndex] = {s:[],n:[]}; // s: sort, n: not sort
239
- }
240
- if (mFirstElmOrSub.length>0) aElements[iElmIndex].s.push({s:aSort,e:$Elm,n:i}); // s:string/pointer, e:element, n:number
241
- else aElements[iElmIndex].n.push({e:$Elm,n:i});
242
- });
243
- //
244
- // sort
245
- loop(aElements, function(oParent) { oParent.s.sort(fnSort); });
246
- //
247
- // order elements and fill new order
248
- loop(aElements, function(oParent) {
249
- var aSorted = oParent.s
250
- ,aUnsorted = oParent.n
251
- ,iSorted = aSorted.length
252
- ,iUnsorted = aUnsorted.length
253
- ,iNumElm = iSorted+iUnsorted
254
- ,aOriginal = [] // list for original position
255
- ,iLow = iNumElm
256
- ,aCount = [0,0] // count how much we've sorted for retrieval from either the sort list or the non-sort list (oParent.s/oParent.n)
257
- ;
258
- switch (oSettings.place) {
259
- case 'first': loop(aSorted,function(obj) { iLow = mathmn(iLow,obj.n); }); break;
260
- case 'org': loop(aSorted,function(obj) { aOriginal.push(obj.n); }); break;
261
- case 'end': iLow = iUnsorted; break;
262
- default: iLow = 0;
263
- }
264
- for (i=0;i<iNumElm;i++) {
265
- var bFromSortList = contains(aOriginal,i)?!fls:i>=iLow&&i<iLow+iSorted
266
- ,iCountIndex = bFromSortList?0:1
267
- ,mEl = (bFromSortList?aSorted:aUnsorted)[aCount[iCountIndex]].e;
268
- mEl.parent().append(mEl);
269
- if (bFromSortList||!oSettings.returns) aNewOrder.push(mEl.get(0));
270
- aCount[iCountIndex]++;
271
- }
272
- });
273
- oThis.length = 0;
274
- Array.prototype.push.apply(oThis,aNewOrder);
275
- return oThis;
276
- }
277
- });
278
- // toLowerCase // todo: dismantle, used only once
279
- function toLowerCase(s) {
280
- return s&&s.toLowerCase?s.toLowerCase():s;
281
- }
282
- // array contains
283
- function contains(a,n) {
284
- for (var i=0,l=a.length;i<l;i++) if (a[i]==n) return !fls;
285
- return fls;
286
- }
287
- // set functions
288
- $.fn.TinySort = $.fn.Tinysort = $.fn.tsort = $.fn.tinysort;
289
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/swiper/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Vladimir Kharlampidi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
assets/swiper/swiper.jquery.min.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Swiper 3.4.0
3
+ * Most modern mobile touch slider and framework with hardware accelerated transitions
4
+ *
5
+ * http://www.idangero.us/swiper/
6
+ *
7
+ * Copyright 2016, Vladimir Kharlampidi
8
+ * The iDangero.us
9
+ * http://www.idangero.us/
10
+ *
11
+ * Licensed under MIT
12
+ *
13
+ * Released on: October 16, 2016
14
+ */
15
+ !function(){"use strict";function e(e){e.fn.swiper=function(a){var s;return e(this).each(function(){var e=new t(this,a);s||(s=e)}),s}}var a,t=function(e,s){function i(e){return Math.floor(e)}function n(){var e=b.params.autoplay,a=b.slides.eq(b.activeIndex);a.attr("data-swiper-autoplay")&&(e=a.attr("data-swiper-autoplay")||b.params.autoplay),b.autoplayTimeoutId=setTimeout(function(){b.params.loop?(b.fixLoop(),b._slideNext(),b.emit("onAutoplay",b)):b.isEnd?s.autoplayStopOnLast?b.stopAutoplay():(b._slideTo(0),b.emit("onAutoplay",b)):(b._slideNext(),b.emit("onAutoplay",b))},e)}function o(e,t){var s=a(e.target);if(!s.is(t))if("string"==typeof t)s=s.parents(t);else if(t.nodeType){var r;return s.parents().each(function(e,a){a===t&&(r=t)}),r?t:void 0}if(0!==s.length)return s[0]}function l(e,a){a=a||{};var t=window.MutationObserver||window.WebkitMutationObserver,s=new t(function(e){e.forEach(function(e){b.onResize(!0),b.emit("onObserverUpdate",b,e)})});s.observe(e,{attributes:"undefined"==typeof a.attributes||a.attributes,childList:"undefined"==typeof a.childList||a.childList,characterData:"undefined"==typeof a.characterData||a.characterData}),b.observers.push(s)}function p(e){e.originalEvent&&(e=e.originalEvent);var a=e.keyCode||e.charCode;if(!b.params.allowSwipeToNext&&(b.isHorizontal()&&39===a||!b.isHorizontal()&&40===a))return!1;if(!b.params.allowSwipeToPrev&&(b.isHorizontal()&&37===a||!b.isHorizontal()&&38===a))return!1;if(!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||document.activeElement&&document.activeElement.nodeName&&("input"===document.activeElement.nodeName.toLowerCase()||"textarea"===document.activeElement.nodeName.toLowerCase()))){if(37===a||39===a||38===a||40===a){var t=!1;if(b.container.parents("."+b.params.slideClass).length>0&&0===b.container.parents("."+b.params.slideActiveClass).length)return;var s={left:window.pageXOffset,top:window.pageYOffset},r=window.innerWidth,i=window.innerHeight,n=b.container.offset();b.rtl&&(n.left=n.left-b.container[0].scrollLeft);for(var o=[[n.left,n.top],[n.left+b.width,n.top],[n.left,n.top+b.height],[n.left+b.width,n.top+b.height]],l=0;l<o.length;l++){var p=o[l];p[0]>=s.left&&p[0]<=s.left+r&&p[1]>=s.top&&p[1]<=s.top+i&&(t=!0)}if(!t)return}b.isHorizontal()?(37!==a&&39!==a||(e.preventDefault?e.preventDefault():e.returnValue=!1),(39===a&&!b.rtl||37===a&&b.rtl)&&b.slideNext(),(37===a&&!b.rtl||39===a&&b.rtl)&&b.slidePrev()):(38!==a&&40!==a||(e.preventDefault?e.preventDefault():e.returnValue=!1),40===a&&b.slideNext(),38===a&&b.slidePrev())}}function d(){var e="onwheel",a=e in document;if(!a){var t=document.createElement("div");t.setAttribute(e,"return;"),a="function"==typeof t[e]}return!a&&document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0&&(a=document.implementation.hasFeature("Events.wheel","3.0")),a}function u(e){e.originalEvent&&(e=e.originalEvent);var a=0,t=b.rtl?-1:1,s=m(e);if(b.params.mousewheelForceToAxis)if(b.isHorizontal()){if(!(Math.abs(s.pixelX)>Math.abs(s.pixelY)))return;a=s.pixelX*t}else{if(!(Math.abs(s.pixelY)>Math.abs(s.pixelX)))return;a=s.pixelY}else a=Math.abs(s.pixelX)>Math.abs(s.pixelY)?-s.pixelX*t:-s.pixelY;if(0!==a){if(b.params.mousewheelInvert&&(a=-a),b.params.freeMode){var r=b.getWrapperTranslate()+a*b.params.mousewheelSensitivity,i=b.isBeginning,n=b.isEnd;if(r>=b.minTranslate()&&(r=b.minTranslate()),r<=b.maxTranslate()&&(r=b.maxTranslate()),b.setWrapperTransition(0),b.setWrapperTranslate(r),b.updateProgress(),b.updateActiveIndex(),(!i&&b.isBeginning||!n&&b.isEnd)&&b.updateClasses(),b.params.freeModeSticky?(clearTimeout(b.mousewheel.timeout),b.mousewheel.timeout=setTimeout(function(){b.slideReset()},300)):b.params.lazyLoading&&b.lazy&&b.lazy.load(),b.emit("onScroll",b,e),b.params.autoplay&&b.params.autoplayDisableOnInteraction&&b.stopAutoplay(),0===r||r===b.maxTranslate())return}else{if((new window.Date).getTime()-b.mousewheel.lastScrollTime>60)if(a<0)if(b.isEnd&&!b.params.loop||b.animating){if(b.params.mousewheelReleaseOnEdges)return!0}else b.slideNext(),b.emit("onScroll",b,e);else if(b.isBeginning&&!b.params.loop||b.animating){if(b.params.mousewheelReleaseOnEdges)return!0}else b.slidePrev(),b.emit("onScroll",b,e);b.mousewheel.lastScrollTime=(new window.Date).getTime()}return e.preventDefault?e.preventDefault():e.returnValue=!1,!1}}function m(e){var a=10,t=40,s=800,r=0,i=0,n=0,o=0;return"detail"in e&&(i=e.detail),"wheelDelta"in e&&(i=-e.wheelDelta/120),"wheelDeltaY"in e&&(i=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(r=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(r=i,i=0),n=r*a,o=i*a,"deltaY"in e&&(o=e.deltaY),"deltaX"in e&&(n=e.deltaX),(n||o)&&e.deltaMode&&(1===e.deltaMode?(n*=t,o*=t):(n*=s,o*=s)),n&&!r&&(r=n<1?-1:1),o&&!i&&(i=o<1?-1:1),{spinX:r,spinY:i,pixelX:n,pixelY:o}}function c(e,t){e=a(e);var s,r,i,n=b.rtl?-1:1;s=e.attr("data-swiper-parallax")||"0",r=e.attr("data-swiper-parallax-x"),i=e.attr("data-swiper-parallax-y"),r||i?(r=r||"0",i=i||"0"):b.isHorizontal()?(r=s,i="0"):(i=s,r="0"),r=r.indexOf("%")>=0?parseInt(r,10)*t*n+"%":r*t*n+"px",i=i.indexOf("%")>=0?parseInt(i,10)*t+"%":i*t+"px",e.transform("translate3d("+r+", "+i+",0px)")}function g(e){return 0!==e.indexOf("on")&&(e=e[0]!==e[0].toUpperCase()?"on"+e[0].toUpperCase()+e.substring(1):"on"+e),e}if(!(this instanceof t))return new t(e,s);var h={direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,autoplay:!1,autoplayDisableOnInteraction:!0,autoplayStopOnLast:!1,iOSEdgeSwipeDetection:!1,iOSEdgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeMomentumVelocityRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",coverflow:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0},flip:{slideShadows:!0,limitRotation:!0},cube:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94},fade:{crossFade:!1},parallax:!1,zoom:!1,zoomMax:3,zoomMin:1,zoomToggle:!0,scrollbar:null,scrollbarHide:!0,scrollbarDraggable:!1,scrollbarSnapOnRelease:!1,keyboardControl:!1,mousewheelControl:!1,mousewheelReleaseOnEdges:!1,mousewheelInvert:!1,mousewheelForceToAxis:!1,mousewheelSensitivity:1,mousewheelEventsTarged:"container",hashnav:!1,hashnavWatchState:!1,history:!1,replaceState:!1,breakpoints:void 0,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,onlyExternal:!1,threshold:0,touchMoveStopPropagation:!0,touchReleaseOnEdges:!1,uniqueNavElements:!0,pagination:null,paginationElement:"span",paginationClickable:!1,paginationHide:!1,paginationBulletRender:null,paginationProgressRender:null,paginationFractionRender:null,paginationCustomRender:null,paginationType:"bullets",resistance:!0,resistanceRatio:.85,nextButton:null,prevButton:null,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,lazyLoading:!1,lazyLoadingInPrevNext:!1,lazyLoadingInPrevNextAmount:1,lazyLoadingOnTransitionStart:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,control:void 0,controlInverse:!1,controlBy:"slide",normalizeSlideIndex:!0,allowSwipeToPrev:!0,allowSwipeToNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",passiveListeners:!0,containerModifierClass:"swiper-container-",slideClass:"swiper-slide",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",buttonDisabledClass:"swiper-button-disabled",paginationCurrentClass:"swiper-pagination-current",paginationTotalClass:"swiper-pagination-total",paginationHiddenClass:"swiper-pagination-hidden",paginationProgressbarClass:"swiper-pagination-progressbar",paginationClickableClass:"swiper-pagination-clickable",paginationModifierClass:"swiper-pagination-",lazyLoadingClass:"swiper-lazy",lazyStatusLoadingClass:"swiper-lazy-loading",lazyStatusLoadedClass:"swiper-lazy-loaded",lazyPreloaderClass:"swiper-lazy-preloader",notificationClass:"swiper-notification",preloaderClass:"preloader",zoomContainerClass:"swiper-zoom-container",observer:!1,observeParents:!1,a11y:!1,prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",runCallbacksOnInit:!0},f=s&&s.virtualTranslate;s=s||{};var v={};for(var w in s)if("object"!=typeof s[w]||null===s[w]||(s[w].nodeType||s[w]===window||s[w]===document||"undefined"!=typeof Dom7&&s[w]instanceof Dom7||"undefined"!=typeof jQuery&&s[w]instanceof jQuery))v[w]=s[w];else{v[w]={};for(var y in s[w])v[w][y]=s[w][y]}for(var x in h)if("undefined"==typeof s[x])s[x]=h[x];else if("object"==typeof s[x])for(var T in h[x])"undefined"==typeof s[x][T]&&(s[x][T]=h[x][T]);var b=this;if(b.params=s,b.originalParams=v,b.classNames=[],"undefined"!=typeof a&&"undefined"!=typeof Dom7&&(a=Dom7),("undefined"!=typeof a||(a="undefined"==typeof Dom7?window.Dom7||window.Zepto||window.jQuery:Dom7))&&(b.$=a,b.currentBreakpoint=void 0,b.getActiveBreakpoint=function(){if(!b.params.breakpoints)return!1;var e,a=!1,t=[];for(e in b.params.breakpoints)b.params.breakpoints.hasOwnProperty(e)&&t.push(e);t.sort(function(e,a){return parseInt(e,10)>parseInt(a,10)});for(var s=0;s<t.length;s++)e=t[s],e>=window.innerWidth&&!a&&(a=e);return a||"max"},b.setBreakpoint=function(){var e=b.getActiveBreakpoint();if(e&&b.currentBreakpoint!==e){var a=e in b.params.breakpoints?b.params.breakpoints[e]:b.originalParams,t=b.params.loop&&a.slidesPerView!==b.params.slidesPerView;for(var s in a)b.params[s]=a[s];b.currentBreakpoint=e,t&&b.destroyLoop&&b.reLoop(!0)}},b.params.breakpoints&&b.setBreakpoint(),b.container=a(e),0!==b.container.length)){if(b.container.length>1){var C=[];return b.container.each(function(){C.push(new t(this,s))}),C}b.container[0].swiper=b,b.container.data("swiper",b),b.classNames.push(b.params.containerModifierClass+b.params.direction),b.params.freeMode&&b.classNames.push(b.params.containerModifierClass+"free-mode"),b.support.flexbox||(b.classNames.push(b.params.containerModifierClass+"no-flexbox"),b.params.slidesPerColumn=1),b.params.autoHeight&&b.classNames.push(b.params.containerModifierClass+"autoheight"),(b.params.parallax||b.params.watchSlidesVisibility)&&(b.params.watchSlidesProgress=!0),b.params.touchReleaseOnEdges&&(b.params.resistanceRatio=0),["cube","coverflow","flip"].indexOf(b.params.effect)>=0&&(b.support.transforms3d?(b.params.watchSlidesProgress=!0,b.classNames.push(b.params.containerModifierClass+"3d")):b.params.effect="slide"),"slide"!==b.params.effect&&b.classNames.push(b.params.containerModifierClass+b.params.effect),"cube"===b.params.effect&&(b.params.resistanceRatio=0,b.params.slidesPerView=1,b.params.slidesPerColumn=1,b.params.slidesPerGroup=1,b.params.centeredSlides=!1,b.params.spaceBetween=0,b.params.virtualTranslate=!0,b.params.setWrapperSize=!1),"fade"!==b.params.effect&&"flip"!==b.params.effect||(b.params.slidesPerView=1,b.params.slidesPerColumn=1,b.params.slidesPerGroup=1,b.params.watchSlidesProgress=!0,b.params.spaceBetween=0,b.params.setWrapperSize=!1,"undefined"==typeof f&&(b.params.virtualTranslate=!0)),b.params.grabCursor&&b.support.touch&&(b.params.grabCursor=!1),b.wrapper=b.container.children("."+b.params.wrapperClass),b.params.pagination&&(b.paginationContainer=a(b.params.pagination),b.params.uniqueNavElements&&"string"==typeof b.params.pagination&&b.paginationContainer.length>1&&1===b.container.find(b.params.pagination).length&&(b.paginationContainer=b.container.find(b.params.pagination)),"bullets"===b.params.paginationType&&b.params.paginationClickable?b.paginationContainer.addClass(b.params.paginationModifierClass+"clickable"):b.params.paginationClickable=!1,b.paginationContainer.addClass(b.params.paginationModifierClass+b.params.paginationType)),(b.params.nextButton||b.params.prevButton)&&(b.params.nextButton&&(b.nextButton=a(b.params.nextButton),b.params.uniqueNavElements&&"string"==typeof b.params.nextButton&&b.nextButton.length>1&&1===b.container.find(b.params.nextButton).length&&(b.nextButton=b.container.find(b.params.nextButton))),b.params.prevButton&&(b.prevButton=a(b.params.prevButton),b.params.uniqueNavElements&&"string"==typeof b.params.prevButton&&b.prevButton.length>1&&1===b.container.find(b.params.prevButton).length&&(b.prevButton=b.container.find(b.params.prevButton)))),b.isHorizontal=function(){return"horizontal"===b.params.direction},b.rtl=b.isHorizontal()&&("rtl"===b.container[0].dir.toLowerCase()||"rtl"===b.container.css("direction")),b.rtl&&b.classNames.push(b.params.containerModifierClass+"rtl"),b.rtl&&(b.wrongRTL="-webkit-box"===b.wrapper.css("display")),b.params.slidesPerColumn>1&&b.classNames.push(b.params.containerModifierClass+"multirow"),b.device.android&&b.classNames.push(b.params.containerModifierClass+"android"),b.container.addClass(b.classNames.join(" ")),b.translate=0,b.progress=0,b.velocity=0,b.lockSwipeToNext=function(){b.params.allowSwipeToNext=!1,b.params.allowSwipeToPrev===!1&&b.params.grabCursor&&b.unsetGrabCursor()},b.lockSwipeToPrev=function(){b.params.allowSwipeToPrev=!1,b.params.allowSwipeToNext===!1&&b.params.grabCursor&&b.unsetGrabCursor()},b.lockSwipes=function(){b.params.allowSwipeToNext=b.params.allowSwipeToPrev=!1,b.params.grabCursor&&b.unsetGrabCursor()},b.unlockSwipeToNext=function(){b.params.allowSwipeToNext=!0,b.params.allowSwipeToPrev===!0&&b.params.grabCursor&&b.setGrabCursor()},b.unlockSwipeToPrev=function(){b.params.allowSwipeToPrev=!0,b.params.allowSwipeToNext===!0&&b.params.grabCursor&&b.setGrabCursor()},b.unlockSwipes=function(){b.params.allowSwipeToNext=b.params.allowSwipeToPrev=!0,b.params.grabCursor&&b.setGrabCursor()},b.setGrabCursor=function(e){b.container[0].style.cursor="move",b.container[0].style.cursor=e?"-webkit-grabbing":"-webkit-grab",b.container[0].style.cursor=e?"-moz-grabbin":"-moz-grab",b.container[0].style.cursor=e?"grabbing":"grab"},b.unsetGrabCursor=function(){b.container[0].style.cursor=""},b.params.grabCursor&&b.setGrabCursor(),b.imagesToLoad=[],b.imagesLoaded=0,b.loadImage=function(e,a,t,s,r,i){function n(){i&&i()}var o;e.complete&&r?n():a?(o=new window.Image,o.onload=n,o.onerror=n,s&&(o.sizes=s),t&&(o.srcset=t),a&&(o.src=a)):n()},b.preloadImages=function(){function e(){"undefined"!=typeof b&&null!==b&&(void 0!==b.imagesLoaded&&b.imagesLoaded++,b.imagesLoaded===b.imagesToLoad.length&&(b.params.updateOnImagesReady&&b.update(),b.emit("onImagesReady",b)))}b.imagesToLoad=b.container.find("img");for(var a=0;a<b.imagesToLoad.length;a++)b.loadImage(b.imagesToLoad[a],b.imagesToLoad[a].currentSrc||b.imagesToLoad[a].getAttribute("src"),b.imagesToLoad[a].srcset||b.imagesToLoad[a].getAttribute("srcset"),b.imagesToLoad[a].sizes||b.imagesToLoad[a].getAttribute("sizes"),!0,e)},b.autoplayTimeoutId=void 0,b.autoplaying=!1,b.autoplayPaused=!1,b.startAutoplay=function(){return"undefined"==typeof b.autoplayTimeoutId&&(!!b.params.autoplay&&(!b.autoplaying&&(b.autoplaying=!0,b.emit("onAutoplayStart",b),void n())))},b.stopAutoplay=function(e){b.autoplayTimeoutId&&(b.autoplayTimeoutId&&clearTimeout(b.autoplayTimeoutId),b.autoplaying=!1,b.autoplayTimeoutId=void 0,b.emit("onAutoplayStop",b))},b.pauseAutoplay=function(e){b.autoplayPaused||(b.autoplayTimeoutId&&clearTimeout(b.autoplayTimeoutId),b.autoplayPaused=!0,0===e?(b.autoplayPaused=!1,n()):b.wrapper.transitionEnd(function(){b&&(b.autoplayPaused=!1,b.autoplaying?n():b.stopAutoplay())}))},b.minTranslate=function(){return-b.snapGrid[0]},b.maxTranslate=function(){return-b.snapGrid[b.snapGrid.length-1]},b.updateAutoHeight=function(){var e=[],a=0;if("auto"!==b.params.slidesPerView&&b.params.slidesPerView>1)for(r=0;r<Math.ceil(b.params.slidesPerView);r++){var t=b.activeIndex+r;if(t>b.slides.length)break;e.push(b.slides.eq(t)[0])}else e.push(b.slides.eq(b.activeIndex)[0]);for(r=0;r<e.length;r++)if("undefined"!=typeof e[r]){var s=e[r].offsetHeight;a=s>a?s:a}a&&b.wrapper.css("height",a+"px")},b.updateContainerSize=function(){var e,a;e="undefined"!=typeof b.params.width?b.params.width:b.container[0].clientWidth,a="undefined"!=typeof b.params.height?b.params.height:b.container[0].clientHeight,0===e&&b.isHorizontal()||0===a&&!b.isHorizontal()||(e=e-parseInt(b.container.css("padding-left"),10)-parseInt(b.container.css("padding-right"),10),a=a-parseInt(b.container.css("padding-top"),10)-parseInt(b.container.css("padding-bottom"),10),b.width=e,b.height=a,b.size=b.isHorizontal()?b.width:b.height)},b.updateSlidesSize=function(){b.slides=b.wrapper.children("."+b.params.slideClass),b.snapGrid=[],b.slidesGrid=[],b.slidesSizesGrid=[];var e,a=b.params.spaceBetween,t=-b.params.slidesOffsetBefore,s=0,r=0;if("undefined"!=typeof b.size){"string"==typeof a&&a.indexOf("%")>=0&&(a=parseFloat(a.replace("%",""))/100*b.size),b.virtualSize=-a,b.rtl?b.slides.css({marginLeft:"",marginTop:""}):b.slides.css({marginRight:"",marginBottom:""});var n;b.params.slidesPerColumn>1&&(n=Math.floor(b.slides.length/b.params.slidesPerColumn)===b.slides.length/b.params.slidesPerColumn?b.slides.length:Math.ceil(b.slides.length/b.params.slidesPerColumn)*b.params.slidesPerColumn,"auto"!==b.params.slidesPerView&&"row"===b.params.slidesPerColumnFill&&(n=Math.max(n,b.params.slidesPerView*b.params.slidesPerColumn)));var o,l=b.params.slidesPerColumn,p=n/l,d=p-(b.params.slidesPerColumn*p-b.slides.length);for(e=0;e<b.slides.length;e++){o=0;var u=b.slides.eq(e);if(b.params.slidesPerColumn>1){var m,c,g;"column"===b.params.slidesPerColumnFill?(c=Math.floor(e/l),g=e-c*l,(c>d||c===d&&g===l-1)&&++g>=l&&(g=0,c++),m=c+g*n/l,u.css({"-webkit-box-ordinal-group":m,"-moz-box-ordinal-group":m,"-ms-flex-order":m,"-webkit-order":m,order:m})):(g=Math.floor(e/p),c=e-g*p),u.css("margin-"+(b.isHorizontal()?"top":"left"),0!==g&&b.params.spaceBetween&&b.params.spaceBetween+"px").attr("data-swiper-column",c).attr("data-swiper-row",g)}"none"!==u.css("display")&&("auto"===b.params.slidesPerView?(o=b.isHorizontal()?u.outerWidth(!0):u.outerHeight(!0),b.params.roundLengths&&(o=i(o))):(o=(b.size-(b.params.slidesPerView-1)*a)/b.params.slidesPerView,b.params.roundLengths&&(o=i(o)),b.isHorizontal()?b.slides[e].style.width=o+"px":b.slides[e].style.height=o+"px"),b.slides[e].swiperSlideSize=o,b.slidesSizesGrid.push(o),b.params.centeredSlides?(t=t+o/2+s/2+a,0===e&&(t=t-b.size/2-a),Math.abs(t)<.001&&(t=0),r%b.params.slidesPerGroup===0&&b.snapGrid.push(t),b.slidesGrid.push(t)):(r%b.params.slidesPerGroup===0&&b.snapGrid.push(t),b.slidesGrid.push(t),t=t+o+a),b.virtualSize+=o+a,s=o,r++)}b.virtualSize=Math.max(b.virtualSize,b.size)+b.params.slidesOffsetAfter;var h;if(b.rtl&&b.wrongRTL&&("slide"===b.params.effect||"coverflow"===b.params.effect)&&b.wrapper.css({width:b.virtualSize+b.params.spaceBetween+"px"}),b.support.flexbox&&!b.params.setWrapperSize||(b.isHorizontal()?b.wrapper.css({width:b.virtualSize+b.params.spaceBetween+"px"}):b.wrapper.css({height:b.virtualSize+b.params.spaceBetween+"px"})),b.params.slidesPerColumn>1&&(b.virtualSize=(o+b.params.spaceBetween)*n,b.virtualSize=Math.ceil(b.virtualSize/b.params.slidesPerColumn)-b.params.spaceBetween,b.isHorizontal()?b.wrapper.css({width:b.virtualSize+b.params.spaceBetween+"px"}):b.wrapper.css({height:b.virtualSize+b.params.spaceBetween+"px"}),b.params.centeredSlides)){for(h=[],e=0;e<b.snapGrid.length;e++)b.snapGrid[e]<b.virtualSize+b.snapGrid[0]&&h.push(b.snapGrid[e]);b.snapGrid=h}if(!b.params.centeredSlides){for(h=[],e=0;e<b.snapGrid.length;e++)b.snapGrid[e]<=b.virtualSize-b.size&&h.push(b.snapGrid[e]);b.snapGrid=h,Math.floor(b.virtualSize-b.size)-Math.floor(b.snapGrid[b.snapGrid.length-1])>1&&b.snapGrid.push(b.virtualSize-b.size)}0===b.snapGrid.length&&(b.snapGrid=[0]),0!==b.params.spaceBetween&&(b.isHorizontal()?b.rtl?b.slides.css({marginLeft:a+"px"}):b.slides.css({marginRight:a+"px"}):b.slides.css({marginBottom:a+"px"})),b.params.watchSlidesProgress&&b.updateSlidesOffset()}},b.updateSlidesOffset=function(){for(var e=0;e<b.slides.length;e++)b.slides[e].swiperSlideOffset=b.isHorizontal()?b.slides[e].offsetLeft:b.slides[e].offsetTop},b.updateSlidesProgress=function(e){if("undefined"==typeof e&&(e=b.translate||0),0!==b.slides.length){"undefined"==typeof b.slides[0].swiperSlideOffset&&b.updateSlidesOffset();var a=-e;b.rtl&&(a=e),b.slides.removeClass(b.params.slideVisibleClass);for(var t=0;t<b.slides.length;t++){var s=b.slides[t],r=(a+(b.params.centeredSlides?b.minTranslate():0)-s.swiperSlideOffset)/(s.swiperSlideSize+b.params.spaceBetween);if(b.params.watchSlidesVisibility){var i=-(a-s.swiperSlideOffset),n=i+b.slidesSizesGrid[t],o=i>=0&&i<b.size||n>0&&n<=b.size||i<=0&&n>=b.size;o&&b.slides.eq(t).addClass(b.params.slideVisibleClass)}s.progress=b.rtl?-r:r}}},b.updateProgress=function(e){"undefined"==typeof e&&(e=b.translate||0);var a=b.maxTranslate()-b.minTranslate(),t=b.isBeginning,s=b.isEnd;0===a?(b.progress=0,b.isBeginning=b.isEnd=!0):(b.progress=(e-b.minTranslate())/a,b.isBeginning=b.progress<=0,b.isEnd=b.progress>=1),b.isBeginning&&!t&&b.emit("onReachBeginning",b),b.isEnd&&!s&&b.emit("onReachEnd",b),b.params.watchSlidesProgress&&b.updateSlidesProgress(e),b.emit("onProgress",b,b.progress)},b.updateActiveIndex=function(){var e,a,t,s=b.rtl?b.translate:-b.translate;for(a=0;a<b.slidesGrid.length;a++)"undefined"!=typeof b.slidesGrid[a+1]?s>=b.slidesGrid[a]&&s<b.slidesGrid[a+1]-(b.slidesGrid[a+1]-b.slidesGrid[a])/2?e=a:s>=b.slidesGrid[a]&&s<b.slidesGrid[a+1]&&(e=a+1):s>=b.slidesGrid[a]&&(e=a);b.params.normalizeSlideIndex&&(e<0||"undefined"==typeof e)&&(e=0),t=Math.floor(e/b.params.slidesPerGroup),t>=b.snapGrid.length&&(t=b.snapGrid.length-1),e!==b.activeIndex&&(b.snapIndex=t,b.previousIndex=b.activeIndex,b.activeIndex=e,b.updateClasses(),b.updateRealIndex())},b.updateRealIndex=function(){b.realIndex=b.slides.eq(b.activeIndex).attr("data-swiper-slide-index")||b.activeIndex},b.updateClasses=function(){b.slides.removeClass(b.params.slideActiveClass+" "+b.params.slideNextClass+" "+b.params.slidePrevClass+" "+b.params.slideDuplicateActiveClass+" "+b.params.slideDuplicateNextClass+" "+b.params.slideDuplicatePrevClass);var e=b.slides.eq(b.activeIndex);e.addClass(b.params.slideActiveClass),s.loop&&(e.hasClass(b.params.slideDuplicateClass)?b.wrapper.children("."+b.params.slideClass+":not(."+b.params.slideDuplicateClass+')[data-swiper-slide-index="'+b.realIndex+'"]').addClass(b.params.slideDuplicateActiveClass):b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+b.realIndex+'"]').addClass(b.params.slideDuplicateActiveClass));var t=e.next("."+b.params.slideClass).addClass(b.params.slideNextClass);b.params.loop&&0===t.length&&(t=b.slides.eq(0),t.addClass(b.params.slideNextClass));var r=e.prev("."+b.params.slideClass).addClass(b.params.slidePrevClass);if(b.params.loop&&0===r.length&&(r=b.slides.eq(-1),r.addClass(b.params.slidePrevClass)),s.loop&&(t.hasClass(b.params.slideDuplicateClass)?b.wrapper.children("."+b.params.slideClass+":not(."+b.params.slideDuplicateClass+')[data-swiper-slide-index="'+t.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicateNextClass):b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+t.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicateNextClass),r.hasClass(b.params.slideDuplicateClass)?b.wrapper.children("."+b.params.slideClass+":not(."+b.params.slideDuplicateClass+')[data-swiper-slide-index="'+r.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicatePrevClass):b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+r.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicatePrevClass)),b.paginationContainer&&b.paginationContainer.length>0){var i,n=b.params.loop?Math.ceil((b.slides.length-2*b.loopedSlides)/b.params.slidesPerGroup):b.snapGrid.length;if(b.params.loop?(i=Math.ceil((b.activeIndex-b.loopedSlides)/b.params.slidesPerGroup),i>b.slides.length-1-2*b.loopedSlides&&(i-=b.slides.length-2*b.loopedSlides),i>n-1&&(i-=n),i<0&&"bullets"!==b.params.paginationType&&(i=n+i)):i="undefined"!=typeof b.snapIndex?b.snapIndex:b.activeIndex||0,"bullets"===b.params.paginationType&&b.bullets&&b.bullets.length>0&&(b.bullets.removeClass(b.params.bulletActiveClass),b.paginationContainer.length>1?b.bullets.each(function(){a(this).index()===i&&a(this).addClass(b.params.bulletActiveClass)}):b.bullets.eq(i).addClass(b.params.bulletActiveClass)),"fraction"===b.params.paginationType&&(b.paginationContainer.find("."+b.params.paginationCurrentClass).text(i+1),b.paginationContainer.find("."+b.params.paginationTotalClass).text(n)),"progress"===b.params.paginationType){var o=(i+1)/n,l=o,p=1;b.isHorizontal()||(p=o,l=1),b.paginationContainer.find("."+b.params.paginationProgressbarClass).transform("translate3d(0,0,0) scaleX("+l+") scaleY("+p+")").transition(b.params.speed)}"custom"===b.params.paginationType&&b.params.paginationCustomRender&&(b.paginationContainer.html(b.params.paginationCustomRender(b,i+1,n)),b.emit("onPaginationRendered",b,b.paginationContainer[0]))}b.params.loop||(b.params.prevButton&&b.prevButton&&b.prevButton.length>0&&(b.isBeginning?(b.prevButton.addClass(b.params.buttonDisabledClass),b.params.a11y&&b.a11y&&b.a11y.disable(b.prevButton)):(b.prevButton.removeClass(b.params.buttonDisabledClass),b.params.a11y&&b.a11y&&b.a11y.enable(b.prevButton))),b.params.nextButton&&b.nextButton&&b.nextButton.length>0&&(b.isEnd?(b.nextButton.addClass(b.params.buttonDisabledClass),b.params.a11y&&b.a11y&&b.a11y.disable(b.nextButton)):(b.nextButton.removeClass(b.params.buttonDisabledClass),b.params.a11y&&b.a11y&&b.a11y.enable(b.nextButton))))},b.updatePagination=function(){if(b.params.pagination&&b.paginationContainer&&b.paginationContainer.length>0){var e="";if("bullets"===b.params.paginationType){for(var a=b.params.loop?Math.ceil((b.slides.length-2*b.loopedSlides)/b.params.slidesPerGroup):b.snapGrid.length,t=0;t<a;t++)e+=b.params.paginationBulletRender?b.params.paginationBulletRender(b,t,b.params.bulletClass):"<"+b.params.paginationElement+' class="'+b.params.bulletClass+'"></'+b.params.paginationElement+">";b.paginationContainer.html(e),b.bullets=b.paginationContainer.find("."+b.params.bulletClass),b.params.paginationClickable&&b.params.a11y&&b.a11y&&b.a11y.initPagination()}"fraction"===b.params.paginationType&&(e=b.params.paginationFractionRender?b.params.paginationFractionRender(b,b.params.paginationCurrentClass,b.params.paginationTotalClass):'<span class="'+b.params.paginationCurrentClass+'"></span> / <span class="'+b.params.paginationTotalClass+'"></span>',b.paginationContainer.html(e)),"progress"===b.params.paginationType&&(e=b.params.paginationProgressRender?b.params.paginationProgressRender(b,b.params.paginationProgressbarClass):'<span class="'+b.params.paginationProgressbarClass+'"></span>',b.paginationContainer.html(e)),"custom"!==b.params.paginationType&&b.emit("onPaginationRendered",b,b.paginationContainer[0])}},b.update=function(e){function a(){b.rtl?-b.translate:b.translate;s=Math.min(Math.max(b.translate,b.maxTranslate()),b.minTranslate()),b.setWrapperTranslate(s),b.updateActiveIndex(),b.updateClasses()}if(b.updateContainerSize(),b.updateSlidesSize(),b.updateProgress(),b.updatePagination(),b.updateClasses(),b.params.scrollbar&&b.scrollbar&&b.scrollbar.set(),e){var t,s;b.controller&&b.controller.spline&&(b.controller.spline=void 0),b.params.freeMode?(a(),b.params.autoHeight&&b.updateAutoHeight()):(t=("auto"===b.params.slidesPerView||b.params.slidesPerView>1)&&b.isEnd&&!b.params.centeredSlides?b.slideTo(b.slides.length-1,0,!1,!0):b.slideTo(b.activeIndex,0,!1,!0),t||a())}else b.params.autoHeight&&b.updateAutoHeight()},b.onResize=function(e){b.params.breakpoints&&b.setBreakpoint();var a=b.params.allowSwipeToPrev,t=b.params.allowSwipeToNext;b.params.allowSwipeToPrev=b.params.allowSwipeToNext=!0,b.updateContainerSize(),b.updateSlidesSize(),("auto"===b.params.slidesPerView||b.params.freeMode||e)&&b.updatePagination(),b.params.scrollbar&&b.scrollbar&&b.scrollbar.set(),b.controller&&b.controller.spline&&(b.controller.spline=void 0);var s=!1;if(b.params.freeMode){var r=Math.min(Math.max(b.translate,b.maxTranslate()),b.minTranslate());b.setWrapperTranslate(r),b.updateActiveIndex(),b.updateClasses(),b.params.autoHeight&&b.updateAutoHeight()}else b.updateClasses(),s=("auto"===b.params.slidesPerView||b.params.slidesPerView>1)&&b.isEnd&&!b.params.centeredSlides?b.slideTo(b.slides.length-1,0,!1,!0):b.slideTo(b.activeIndex,0,!1,!0);b.params.lazyLoading&&!s&&b.lazy&&b.lazy.load(),b.params.allowSwipeToPrev=a,b.params.allowSwipeToNext=t},b.touchEventsDesktop={start:"mousedown",move:"mousemove",end:"mouseup"},window.navigator.pointerEnabled?b.touchEventsDesktop={start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled&&(b.touchEventsDesktop={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}),b.touchEvents={start:b.support.touch||!b.params.simulateTouch?"touchstart":b.touchEventsDesktop.start,move:b.support.touch||!b.params.simulateTouch?"touchmove":b.touchEventsDesktop.move,end:b.support.touch||!b.params.simulateTouch?"touchend":b.touchEventsDesktop.end},(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&("container"===b.params.touchEventsTarget?b.container:b.wrapper).addClass("swiper-wp8-"+b.params.direction),b.initEvents=function(e){var a=e?"off":"on",t=e?"removeEventListener":"addEventListener",r="container"===b.params.touchEventsTarget?b.container[0]:b.wrapper[0],i=b.support.touch?r:document,n=!!b.params.nested;if(b.browser.ie)r[t](b.touchEvents.start,b.onTouchStart,!1),i[t](b.touchEvents.move,b.onTouchMove,n),i[t](b.touchEvents.end,b.onTouchEnd,!1);else{if(b.support.touch){var o=!("touchstart"!==b.touchEvents.start||!b.support.passiveListener||!b.params.passiveListeners)&&{passive:!0,capture:!1};r[t](b.touchEvents.start,b.onTouchStart,o),r[t](b.touchEvents.move,b.onTouchMove,n),r[t](b.touchEvents.end,b.onTouchEnd,o)}(s.simulateTouch&&!b.device.ios&&!b.device.android||s.simulateTouch&&!b.support.touch&&b.device.ios)&&(r[t]("mousedown",b.onTouchStart,!1),document[t]("mousemove",b.onTouchMove,n),document[t]("mouseup",b.onTouchEnd,!1))}window[t]("resize",b.onResize),b.params.nextButton&&b.nextButton&&b.nextButton.length>0&&(b.nextButton[a]("click",b.onClickNext),b.params.a11y&&b.a11y&&b.nextButton[a]("keydown",b.a11y.onEnterKey)),b.params.prevButton&&b.prevButton&&b.prevButton.length>0&&(b.prevButton[a]("click",b.onClickPrev),b.params.a11y&&b.a11y&&b.prevButton[a]("keydown",b.a11y.onEnterKey)),b.params.pagination&&b.params.paginationClickable&&(b.paginationContainer[a]("click","."+b.params.bulletClass,b.onClickIndex),b.params.a11y&&b.a11y&&b.paginationContainer[a]("keydown","."+b.params.bulletClass,b.a11y.onEnterKey)),(b.params.preventClicks||b.params.preventClicksPropagation)&&r[t]("click",b.preventClicks,!0)},b.attachEvents=function(){b.initEvents()},b.detachEvents=function(){b.initEvents(!0)},b.allowClick=!0,b.preventClicks=function(e){b.allowClick||(b.params.preventClicks&&e.preventDefault(),b.params.preventClicksPropagation&&b.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))},b.onClickNext=function(e){e.preventDefault(),b.isEnd&&!b.params.loop||b.slideNext()},b.onClickPrev=function(e){e.preventDefault(),b.isBeginning&&!b.params.loop||b.slidePrev();
16
+ },b.onClickIndex=function(e){e.preventDefault();var t=a(this).index()*b.params.slidesPerGroup;b.params.loop&&(t+=b.loopedSlides),b.slideTo(t)},b.updateClickedSlide=function(e){var t=o(e,"."+b.params.slideClass),s=!1;if(t)for(var r=0;r<b.slides.length;r++)b.slides[r]===t&&(s=!0);if(!t||!s)return b.clickedSlide=void 0,void(b.clickedIndex=void 0);if(b.clickedSlide=t,b.clickedIndex=a(t).index(),b.params.slideToClickedSlide&&void 0!==b.clickedIndex&&b.clickedIndex!==b.activeIndex){var i,n=b.clickedIndex;if(b.params.loop){if(b.animating)return;i=a(b.clickedSlide).attr("data-swiper-slide-index"),b.params.centeredSlides?n<b.loopedSlides-b.params.slidesPerView/2||n>b.slides.length-b.loopedSlides+b.params.slidesPerView/2?(b.fixLoop(),n=b.wrapper.children("."+b.params.slideClass+'[data-swiper-slide-index="'+i+'"]:not(.'+b.params.slideDuplicateClass+")").eq(0).index(),setTimeout(function(){b.slideTo(n)},0)):b.slideTo(n):n>b.slides.length-b.params.slidesPerView?(b.fixLoop(),n=b.wrapper.children("."+b.params.slideClass+'[data-swiper-slide-index="'+i+'"]:not(.'+b.params.slideDuplicateClass+")").eq(0).index(),setTimeout(function(){b.slideTo(n)},0)):b.slideTo(n)}else b.slideTo(n)}};var S,z,M,P,E,I,k,D,L,B,H="input, select, textarea, button, video",G=Date.now(),X=[];b.animating=!1,b.touches={startX:0,startY:0,currentX:0,currentY:0,diff:0};var Y,A;b.onTouchStart=function(e){if(e.originalEvent&&(e=e.originalEvent),Y="touchstart"===e.type,Y||!("which"in e)||3!==e.which){if(b.params.noSwiping&&o(e,"."+b.params.noSwipingClass))return void(b.allowClick=!0);if(!b.params.swipeHandler||o(e,b.params.swipeHandler)){var t=b.touches.currentX="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,s=b.touches.currentY="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY;if(!(b.device.ios&&b.params.iOSEdgeSwipeDetection&&t<=b.params.iOSEdgeSwipeThreshold)){if(S=!0,z=!1,M=!0,E=void 0,A=void 0,b.touches.startX=t,b.touches.startY=s,P=Date.now(),b.allowClick=!0,b.updateContainerSize(),b.swipeDirection=void 0,b.params.threshold>0&&(D=!1),"touchstart"!==e.type){var r=!0;a(e.target).is(H)&&(r=!1),document.activeElement&&a(document.activeElement).is(H)&&document.activeElement.blur(),r&&e.preventDefault()}b.emit("onTouchStart",b,e)}}}},b.onTouchMove=function(e){if(e.originalEvent&&(e=e.originalEvent),!Y||"mousemove"!==e.type){if(e.preventedByNestedSwiper)return b.touches.startX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,void(b.touches.startY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY);if(b.params.onlyExternal)return b.allowClick=!1,void(S&&(b.touches.startX=b.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,b.touches.startY=b.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,P=Date.now()));if(Y&&b.params.touchReleaseOnEdges&&!b.params.loop)if(b.isHorizontal()){if(b.touches.currentX<b.touches.startX&&b.translate<=b.maxTranslate()||b.touches.currentX>b.touches.startX&&b.translate>=b.minTranslate())return}else if(b.touches.currentY<b.touches.startY&&b.translate<=b.maxTranslate()||b.touches.currentY>b.touches.startY&&b.translate>=b.minTranslate())return;if(Y&&document.activeElement&&e.target===document.activeElement&&a(e.target).is(H))return z=!0,void(b.allowClick=!1);if(M&&b.emit("onTouchMove",b,e),!(e.targetTouches&&e.targetTouches.length>1)){if(b.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,b.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,"undefined"==typeof E){var t;b.isHorizontal()&&b.touches.currentY===b.touches.startY||!b.isHorizontal()&&b.touches.currentX!==b.touches.startX?E=!1:(t=180*Math.atan2(Math.abs(b.touches.currentY-b.touches.startY),Math.abs(b.touches.currentX-b.touches.startX))/Math.PI,E=b.isHorizontal()?t>b.params.touchAngle:90-t>b.params.touchAngle)}if(E&&b.emit("onTouchMoveOpposite",b,e),"undefined"==typeof A&&b.browser.ieTouch&&(b.touches.currentX===b.touches.startX&&b.touches.currentY===b.touches.startY||(A=!0)),S){if(E)return void(S=!1);if(A||!b.browser.ieTouch){b.allowClick=!1,b.emit("onSliderMove",b,e),e.preventDefault(),b.params.touchMoveStopPropagation&&!b.params.nested&&e.stopPropagation(),z||(s.loop&&b.fixLoop(),k=b.getWrapperTranslate(),b.setWrapperTransition(0),b.animating&&b.wrapper.trigger("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd"),b.params.autoplay&&b.autoplaying&&(b.params.autoplayDisableOnInteraction?b.stopAutoplay():b.pauseAutoplay()),B=!1,!b.params.grabCursor||b.params.allowSwipeToNext!==!0&&b.params.allowSwipeToPrev!==!0||b.setGrabCursor(!0)),z=!0;var r=b.touches.diff=b.isHorizontal()?b.touches.currentX-b.touches.startX:b.touches.currentY-b.touches.startY;r*=b.params.touchRatio,b.rtl&&(r=-r),b.swipeDirection=r>0?"prev":"next",I=r+k;var i=!0;if(r>0&&I>b.minTranslate()?(i=!1,b.params.resistance&&(I=b.minTranslate()-1+Math.pow(-b.minTranslate()+k+r,b.params.resistanceRatio))):r<0&&I<b.maxTranslate()&&(i=!1,b.params.resistance&&(I=b.maxTranslate()+1-Math.pow(b.maxTranslate()-k-r,b.params.resistanceRatio))),i&&(e.preventedByNestedSwiper=!0),!b.params.allowSwipeToNext&&"next"===b.swipeDirection&&I<k&&(I=k),!b.params.allowSwipeToPrev&&"prev"===b.swipeDirection&&I>k&&(I=k),b.params.threshold>0){if(!(Math.abs(r)>b.params.threshold||D))return void(I=k);if(!D)return D=!0,b.touches.startX=b.touches.currentX,b.touches.startY=b.touches.currentY,I=k,void(b.touches.diff=b.isHorizontal()?b.touches.currentX-b.touches.startX:b.touches.currentY-b.touches.startY)}b.params.followFinger&&((b.params.freeMode||b.params.watchSlidesProgress)&&b.updateActiveIndex(),b.params.freeMode&&(0===X.length&&X.push({position:b.touches[b.isHorizontal()?"startX":"startY"],time:P}),X.push({position:b.touches[b.isHorizontal()?"currentX":"currentY"],time:(new window.Date).getTime()})),b.updateProgress(I),b.setWrapperTranslate(I))}}}}},b.onTouchEnd=function(e){if(e.originalEvent&&(e=e.originalEvent),M&&b.emit("onTouchEnd",b,e),M=!1,S){b.params.grabCursor&&z&&S&&(b.params.allowSwipeToNext===!0||b.params.allowSwipeToPrev===!0)&&b.setGrabCursor(!1);var t=Date.now(),s=t-P;if(b.allowClick&&(b.updateClickedSlide(e),b.emit("onTap",b,e),s<300&&t-G>300&&(L&&clearTimeout(L),L=setTimeout(function(){b&&(b.params.paginationHide&&b.paginationContainer.length>0&&!a(e.target).hasClass(b.params.bulletClass)&&b.paginationContainer.toggleClass(b.params.paginationHiddenClass),b.emit("onClick",b,e))},300)),s<300&&t-G<300&&(L&&clearTimeout(L),b.emit("onDoubleTap",b,e))),G=Date.now(),setTimeout(function(){b&&(b.allowClick=!0)},0),!S||!z||!b.swipeDirection||0===b.touches.diff||I===k)return void(S=z=!1);S=z=!1;var r;if(r=b.params.followFinger?b.rtl?b.translate:-b.translate:-I,b.params.freeMode){if(r<-b.minTranslate())return void b.slideTo(b.activeIndex);if(r>-b.maxTranslate())return void(b.slides.length<b.snapGrid.length?b.slideTo(b.snapGrid.length-1):b.slideTo(b.slides.length-1));if(b.params.freeModeMomentum){if(X.length>1){var i=X.pop(),n=X.pop(),o=i.position-n.position,l=i.time-n.time;b.velocity=o/l,b.velocity=b.velocity/2,Math.abs(b.velocity)<b.params.freeModeMinimumVelocity&&(b.velocity=0),(l>150||(new window.Date).getTime()-i.time>300)&&(b.velocity=0)}else b.velocity=0;b.velocity=b.velocity*b.params.freeModeMomentumVelocityRatio,X.length=0;var p=1e3*b.params.freeModeMomentumRatio,d=b.velocity*p,u=b.translate+d;b.rtl&&(u=-u);var m,c=!1,g=20*Math.abs(b.velocity)*b.params.freeModeMomentumBounceRatio;if(u<b.maxTranslate())b.params.freeModeMomentumBounce?(u+b.maxTranslate()<-g&&(u=b.maxTranslate()-g),m=b.maxTranslate(),c=!0,B=!0):u=b.maxTranslate();else if(u>b.minTranslate())b.params.freeModeMomentumBounce?(u-b.minTranslate()>g&&(u=b.minTranslate()+g),m=b.minTranslate(),c=!0,B=!0):u=b.minTranslate();else if(b.params.freeModeSticky){var h,f=0;for(f=0;f<b.snapGrid.length;f+=1)if(b.snapGrid[f]>-u){h=f;break}u=Math.abs(b.snapGrid[h]-u)<Math.abs(b.snapGrid[h-1]-u)||"next"===b.swipeDirection?b.snapGrid[h]:b.snapGrid[h-1],b.rtl||(u=-u)}if(0!==b.velocity)p=b.rtl?Math.abs((-u-b.translate)/b.velocity):Math.abs((u-b.translate)/b.velocity);else if(b.params.freeModeSticky)return void b.slideReset();b.params.freeModeMomentumBounce&&c?(b.updateProgress(m),b.setWrapperTransition(p),b.setWrapperTranslate(u),b.onTransitionStart(),b.animating=!0,b.wrapper.transitionEnd(function(){b&&B&&(b.emit("onMomentumBounce",b),b.setWrapperTransition(b.params.speed),b.setWrapperTranslate(m),b.wrapper.transitionEnd(function(){b&&b.onTransitionEnd()}))})):b.velocity?(b.updateProgress(u),b.setWrapperTransition(p),b.setWrapperTranslate(u),b.onTransitionStart(),b.animating||(b.animating=!0,b.wrapper.transitionEnd(function(){b&&b.onTransitionEnd()}))):b.updateProgress(u),b.updateActiveIndex()}return void((!b.params.freeModeMomentum||s>=b.params.longSwipesMs)&&(b.updateProgress(),b.updateActiveIndex()))}var v,w=0,y=b.slidesSizesGrid[0];for(v=0;v<b.slidesGrid.length;v+=b.params.slidesPerGroup)"undefined"!=typeof b.slidesGrid[v+b.params.slidesPerGroup]?r>=b.slidesGrid[v]&&r<b.slidesGrid[v+b.params.slidesPerGroup]&&(w=v,y=b.slidesGrid[v+b.params.slidesPerGroup]-b.slidesGrid[v]):r>=b.slidesGrid[v]&&(w=v,y=b.slidesGrid[b.slidesGrid.length-1]-b.slidesGrid[b.slidesGrid.length-2]);var x=(r-b.slidesGrid[w])/y;if(s>b.params.longSwipesMs){if(!b.params.longSwipes)return void b.slideTo(b.activeIndex);"next"===b.swipeDirection&&(x>=b.params.longSwipesRatio?b.slideTo(w+b.params.slidesPerGroup):b.slideTo(w)),"prev"===b.swipeDirection&&(x>1-b.params.longSwipesRatio?b.slideTo(w+b.params.slidesPerGroup):b.slideTo(w))}else{if(!b.params.shortSwipes)return void b.slideTo(b.activeIndex);"next"===b.swipeDirection&&b.slideTo(w+b.params.slidesPerGroup),"prev"===b.swipeDirection&&b.slideTo(w)}}},b._slideTo=function(e,a){return b.slideTo(e,a,!0,!0)},b.slideTo=function(e,a,t,s){"undefined"==typeof t&&(t=!0),"undefined"==typeof e&&(e=0),e<0&&(e=0),b.snapIndex=Math.floor(e/b.params.slidesPerGroup),b.snapIndex>=b.snapGrid.length&&(b.snapIndex=b.snapGrid.length-1);var r=-b.snapGrid[b.snapIndex];if(b.params.autoplay&&b.autoplaying&&(s||!b.params.autoplayDisableOnInteraction?b.pauseAutoplay(a):b.stopAutoplay()),b.updateProgress(r),b.params.normalizeSlideIndex)for(var i=0;i<b.slidesGrid.length;i++)-Math.floor(100*r)>=Math.floor(100*b.slidesGrid[i])&&(e=i);return!(!b.params.allowSwipeToNext&&r<b.translate&&r<b.minTranslate())&&(!(!b.params.allowSwipeToPrev&&r>b.translate&&r>b.maxTranslate()&&(b.activeIndex||0)!==e)&&("undefined"==typeof a&&(a=b.params.speed),b.previousIndex=b.activeIndex||0,b.activeIndex=e,b.updateRealIndex(),b.rtl&&-r===b.translate||!b.rtl&&r===b.translate?(b.params.autoHeight&&b.updateAutoHeight(),b.updateClasses(),"slide"!==b.params.effect&&b.setWrapperTranslate(r),!1):(b.updateClasses(),b.onTransitionStart(t),0===a||b.browser.lteIE9?(b.setWrapperTranslate(r),b.setWrapperTransition(0),b.onTransitionEnd(t)):(b.setWrapperTranslate(r),b.setWrapperTransition(a),b.animating||(b.animating=!0,b.wrapper.transitionEnd(function(){b&&b.onTransitionEnd(t)}))),!0)))},b.onTransitionStart=function(e){"undefined"==typeof e&&(e=!0),b.params.autoHeight&&b.updateAutoHeight(),b.lazy&&b.lazy.onTransitionStart(),e&&(b.emit("onTransitionStart",b),b.activeIndex!==b.previousIndex&&(b.emit("onSlideChangeStart",b),b.activeIndex>b.previousIndex?b.emit("onSlideNextStart",b):b.emit("onSlidePrevStart",b)))},b.onTransitionEnd=function(e){b.animating=!1,b.setWrapperTransition(0),"undefined"==typeof e&&(e=!0),b.lazy&&b.lazy.onTransitionEnd(),e&&(b.emit("onTransitionEnd",b),b.activeIndex!==b.previousIndex&&(b.emit("onSlideChangeEnd",b),b.activeIndex>b.previousIndex?b.emit("onSlideNextEnd",b):b.emit("onSlidePrevEnd",b))),b.params.history&&b.history&&b.history.setHistory(b.params.history,b.activeIndex),b.params.hashnav&&b.hashnav&&b.hashnav.setHash()},b.slideNext=function(e,a,t){if(b.params.loop){if(b.animating)return!1;b.fixLoop();b.container[0].clientLeft;return b.slideTo(b.activeIndex+b.params.slidesPerGroup,a,e,t)}return b.slideTo(b.activeIndex+b.params.slidesPerGroup,a,e,t)},b._slideNext=function(e){return b.slideNext(!0,e,!0)},b.slidePrev=function(e,a,t){if(b.params.loop){if(b.animating)return!1;b.fixLoop();b.container[0].clientLeft;return b.slideTo(b.activeIndex-1,a,e,t)}return b.slideTo(b.activeIndex-1,a,e,t)},b._slidePrev=function(e){return b.slidePrev(!0,e,!0)},b.slideReset=function(e,a,t){return b.slideTo(b.activeIndex,a,e)},b.disableTouchControl=function(){return b.params.onlyExternal=!0,!0},b.enableTouchControl=function(){return b.params.onlyExternal=!1,!0},b.setWrapperTransition=function(e,a){b.wrapper.transition(e),"slide"!==b.params.effect&&b.effects[b.params.effect]&&b.effects[b.params.effect].setTransition(e),b.params.parallax&&b.parallax&&b.parallax.setTransition(e),b.params.scrollbar&&b.scrollbar&&b.scrollbar.setTransition(e),b.params.control&&b.controller&&b.controller.setTransition(e,a),b.emit("onSetTransition",b,e)},b.setWrapperTranslate=function(e,a,t){var s=0,r=0,n=0;b.isHorizontal()?s=b.rtl?-e:e:r=e,b.params.roundLengths&&(s=i(s),r=i(r)),b.params.virtualTranslate||(b.support.transforms3d?b.wrapper.transform("translate3d("+s+"px, "+r+"px, "+n+"px)"):b.wrapper.transform("translate("+s+"px, "+r+"px)")),b.translate=b.isHorizontal()?s:r;var o,l=b.maxTranslate()-b.minTranslate();o=0===l?0:(e-b.minTranslate())/l,o!==b.progress&&b.updateProgress(e),a&&b.updateActiveIndex(),"slide"!==b.params.effect&&b.effects[b.params.effect]&&b.effects[b.params.effect].setTranslate(b.translate),b.params.parallax&&b.parallax&&b.parallax.setTranslate(b.translate),b.params.scrollbar&&b.scrollbar&&b.scrollbar.setTranslate(b.translate),b.params.control&&b.controller&&b.controller.setTranslate(b.translate,t),b.emit("onSetTranslate",b,b.translate)},b.getTranslate=function(e,a){var t,s,r,i;return"undefined"==typeof a&&(a="x"),b.params.virtualTranslate?b.rtl?-b.translate:b.translate:(r=window.getComputedStyle(e,null),window.WebKitCSSMatrix?(s=r.transform||r.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(function(e){return e.replace(",",".")}).join(", ")),i=new window.WebKitCSSMatrix("none"===s?"":s)):(i=r.MozTransform||r.OTransform||r.MsTransform||r.msTransform||r.transform||r.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),t=i.toString().split(",")),"x"===a&&(s=window.WebKitCSSMatrix?i.m41:16===t.length?parseFloat(t[12]):parseFloat(t[4])),"y"===a&&(s=window.WebKitCSSMatrix?i.m42:16===t.length?parseFloat(t[13]):parseFloat(t[5])),b.rtl&&s&&(s=-s),s||0)},b.getWrapperTranslate=function(e){return"undefined"==typeof e&&(e=b.isHorizontal()?"x":"y"),b.getTranslate(b.wrapper[0],e)},b.observers=[],b.initObservers=function(){if(b.params.observeParents)for(var e=b.container.parents(),a=0;a<e.length;a++)l(e[a]);l(b.container[0],{childList:!1}),l(b.wrapper[0],{attributes:!1})},b.disconnectObservers=function(){for(var e=0;e<b.observers.length;e++)b.observers[e].disconnect();b.observers=[]},b.createLoop=function(){b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass).remove();var e=b.wrapper.children("."+b.params.slideClass);"auto"!==b.params.slidesPerView||b.params.loopedSlides||(b.params.loopedSlides=e.length),b.loopedSlides=parseInt(b.params.loopedSlides||b.params.slidesPerView,10),b.loopedSlides=b.loopedSlides+b.params.loopAdditionalSlides,b.loopedSlides>e.length&&(b.loopedSlides=e.length);var t,s=[],r=[];for(e.each(function(t,i){var n=a(this);t<b.loopedSlides&&r.push(i),t<e.length&&t>=e.length-b.loopedSlides&&s.push(i),n.attr("data-swiper-slide-index",t)}),t=0;t<r.length;t++)b.wrapper.append(a(r[t].cloneNode(!0)).addClass(b.params.slideDuplicateClass));for(t=s.length-1;t>=0;t--)b.wrapper.prepend(a(s[t].cloneNode(!0)).addClass(b.params.slideDuplicateClass))},b.destroyLoop=function(){b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass).remove(),b.slides.removeAttr("data-swiper-slide-index")},b.reLoop=function(e){var a=b.activeIndex-b.loopedSlides;b.destroyLoop(),b.createLoop(),b.updateSlidesSize(),e&&b.slideTo(a+b.loopedSlides,0,!1)},b.fixLoop=function(){var e;b.activeIndex<b.loopedSlides?(e=b.slides.length-3*b.loopedSlides+b.activeIndex,e+=b.loopedSlides,b.slideTo(e,0,!1,!0)):("auto"===b.params.slidesPerView&&b.activeIndex>=2*b.loopedSlides||b.activeIndex>b.slides.length-2*b.params.slidesPerView)&&(e=-b.slides.length+b.activeIndex+b.loopedSlides,e+=b.loopedSlides,b.slideTo(e,0,!1,!0))},b.appendSlide=function(e){if(b.params.loop&&b.destroyLoop(),"object"==typeof e&&e.length)for(var a=0;a<e.length;a++)e[a]&&b.wrapper.append(e[a]);else b.wrapper.append(e);b.params.loop&&b.createLoop(),b.params.observer&&b.support.observer||b.update(!0)},b.prependSlide=function(e){b.params.loop&&b.destroyLoop();var a=b.activeIndex+1;if("object"==typeof e&&e.length){for(var t=0;t<e.length;t++)e[t]&&b.wrapper.prepend(e[t]);a=b.activeIndex+e.length}else b.wrapper.prepend(e);b.params.loop&&b.createLoop(),b.params.observer&&b.support.observer||b.update(!0),b.slideTo(a,0,!1)},b.removeSlide=function(e){b.params.loop&&(b.destroyLoop(),b.slides=b.wrapper.children("."+b.params.slideClass));var a,t=b.activeIndex;if("object"==typeof e&&e.length){for(var s=0;s<e.length;s++)a=e[s],b.slides[a]&&b.slides.eq(a).remove(),a<t&&t--;t=Math.max(t,0)}else a=e,b.slides[a]&&b.slides.eq(a).remove(),a<t&&t--,t=Math.max(t,0);b.params.loop&&b.createLoop(),b.params.observer&&b.support.observer||b.update(!0),b.params.loop?b.slideTo(t+b.loopedSlides,0,!1):b.slideTo(t,0,!1)},b.removeAllSlides=function(){for(var e=[],a=0;a<b.slides.length;a++)e.push(a);b.removeSlide(e)},b.effects={fade:{setTranslate:function(){for(var e=0;e<b.slides.length;e++){var a=b.slides.eq(e),t=a[0].swiperSlideOffset,s=-t;b.params.virtualTranslate||(s-=b.translate);var r=0;b.isHorizontal()||(r=s,s=0);var i=b.params.fade.crossFade?Math.max(1-Math.abs(a[0].progress),0):1+Math.min(Math.max(a[0].progress,-1),0);a.css({opacity:i}).transform("translate3d("+s+"px, "+r+"px, 0px)")}},setTransition:function(e){if(b.slides.transition(e),b.params.virtualTranslate&&0!==e){var a=!1;b.slides.transitionEnd(function(){if(!a&&b){a=!0,b.animating=!1;for(var e=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],t=0;t<e.length;t++)b.wrapper.trigger(e[t])}})}}},flip:{setTranslate:function(){for(var e=0;e<b.slides.length;e++){var t=b.slides.eq(e),s=t[0].progress;b.params.flip.limitRotation&&(s=Math.max(Math.min(t[0].progress,1),-1));var r=t[0].swiperSlideOffset,i=-180*s,n=i,o=0,l=-r,p=0;if(b.isHorizontal()?b.rtl&&(n=-n):(p=l,l=0,o=-n,n=0),t[0].style.zIndex=-Math.abs(Math.round(s))+b.slides.length,b.params.flip.slideShadows){var d=b.isHorizontal()?t.find(".swiper-slide-shadow-left"):t.find(".swiper-slide-shadow-top"),u=b.isHorizontal()?t.find(".swiper-slide-shadow-right"):t.find(".swiper-slide-shadow-bottom");0===d.length&&(d=a('<div class="swiper-slide-shadow-'+(b.isHorizontal()?"left":"top")+'"></div>'),t.append(d)),0===u.length&&(u=a('<div class="swiper-slide-shadow-'+(b.isHorizontal()?"right":"bottom")+'"></div>'),t.append(u)),d.length&&(d[0].style.opacity=Math.max(-s,0)),u.length&&(u[0].style.opacity=Math.max(s,0))}t.transform("translate3d("+l+"px, "+p+"px, 0px) rotateX("+o+"deg) rotateY("+n+"deg)")}},setTransition:function(e){if(b.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),b.params.virtualTranslate&&0!==e){var t=!1;b.slides.eq(b.activeIndex).transitionEnd(function(){if(!t&&b&&a(this).hasClass(b.params.slideActiveClass)){t=!0,b.animating=!1;for(var e=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],s=0;s<e.length;s++)b.wrapper.trigger(e[s])}})}}},cube:{setTranslate:function(){var e,t=0;b.params.cube.shadow&&(b.isHorizontal()?(e=b.wrapper.find(".swiper-cube-shadow"),0===e.length&&(e=a('<div class="swiper-cube-shadow"></div>'),b.wrapper.append(e)),e.css({height:b.width+"px"})):(e=b.container.find(".swiper-cube-shadow"),0===e.length&&(e=a('<div class="swiper-cube-shadow"></div>'),b.container.append(e))));for(var s=0;s<b.slides.length;s++){var r=b.slides.eq(s),i=90*s,n=Math.floor(i/360);b.rtl&&(i=-i,n=Math.floor(-i/360));var o=Math.max(Math.min(r[0].progress,1),-1),l=0,p=0,d=0;s%4===0?(l=4*-n*b.size,d=0):(s-1)%4===0?(l=0,d=4*-n*b.size):(s-2)%4===0?(l=b.size+4*n*b.size,d=b.size):(s-3)%4===0&&(l=-b.size,d=3*b.size+4*b.size*n),b.rtl&&(l=-l),b.isHorizontal()||(p=l,l=0);var u="rotateX("+(b.isHorizontal()?0:-i)+"deg) rotateY("+(b.isHorizontal()?i:0)+"deg) translate3d("+l+"px, "+p+"px, "+d+"px)";if(o<=1&&o>-1&&(t=90*s+90*o,b.rtl&&(t=90*-s-90*o)),r.transform(u),b.params.cube.slideShadows){var m=b.isHorizontal()?r.find(".swiper-slide-shadow-left"):r.find(".swiper-slide-shadow-top"),c=b.isHorizontal()?r.find(".swiper-slide-shadow-right"):r.find(".swiper-slide-shadow-bottom");0===m.length&&(m=a('<div class="swiper-slide-shadow-'+(b.isHorizontal()?"left":"top")+'"></div>'),r.append(m)),0===c.length&&(c=a('<div class="swiper-slide-shadow-'+(b.isHorizontal()?"right":"bottom")+'"></div>'),r.append(c)),m.length&&(m[0].style.opacity=Math.max(-o,0)),c.length&&(c[0].style.opacity=Math.max(o,0))}}if(b.wrapper.css({"-webkit-transform-origin":"50% 50% -"+b.size/2+"px","-moz-transform-origin":"50% 50% -"+b.size/2+"px","-ms-transform-origin":"50% 50% -"+b.size/2+"px","transform-origin":"50% 50% -"+b.size/2+"px"}),b.params.cube.shadow)if(b.isHorizontal())e.transform("translate3d(0px, "+(b.width/2+b.params.cube.shadowOffset)+"px, "+-b.width/2+"px) rotateX(90deg) rotateZ(0deg) scale("+b.params.cube.shadowScale+")");else{var g=Math.abs(t)-90*Math.floor(Math.abs(t)/90),h=1.5-(Math.sin(2*g*Math.PI/360)/2+Math.cos(2*g*Math.PI/360)/2),f=b.params.cube.shadowScale,v=b.params.cube.shadowScale/h,w=b.params.cube.shadowOffset;e.transform("scale3d("+f+", 1, "+v+") translate3d(0px, "+(b.height/2+w)+"px, "+-b.height/2/v+"px) rotateX(-90deg)")}var y=b.isSafari||b.isUiWebView?-b.size/2:0;b.wrapper.transform("translate3d(0px,0,"+y+"px) rotateX("+(b.isHorizontal()?0:t)+"deg) rotateY("+(b.isHorizontal()?-t:0)+"deg)")},setTransition:function(e){b.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),b.params.cube.shadow&&!b.isHorizontal()&&b.container.find(".swiper-cube-shadow").transition(e)}},coverflow:{setTranslate:function(){for(var e=b.translate,t=b.isHorizontal()?-e+b.width/2:-e+b.height/2,s=b.isHorizontal()?b.params.coverflow.rotate:-b.params.coverflow.rotate,r=b.params.coverflow.depth,i=0,n=b.slides.length;i<n;i++){var o=b.slides.eq(i),l=b.slidesSizesGrid[i],p=o[0].swiperSlideOffset,d=(t-p-l/2)/l*b.params.coverflow.modifier,u=b.isHorizontal()?s*d:0,m=b.isHorizontal()?0:s*d,c=-r*Math.abs(d),g=b.isHorizontal()?0:b.params.coverflow.stretch*d,h=b.isHorizontal()?b.params.coverflow.stretch*d:0;Math.abs(h)<.001&&(h=0),Math.abs(g)<.001&&(g=0),Math.abs(c)<.001&&(c=0),Math.abs(u)<.001&&(u=0),Math.abs(m)<.001&&(m=0);var f="translate3d("+h+"px,"+g+"px,"+c+"px) rotateX("+m+"deg) rotateY("+u+"deg)";if(o.transform(f),o[0].style.zIndex=-Math.abs(Math.round(d))+1,b.params.coverflow.slideShadows){var v=b.isHorizontal()?o.find(".swiper-slide-shadow-left"):o.find(".swiper-slide-shadow-top"),w=b.isHorizontal()?o.find(".swiper-slide-shadow-right"):o.find(".swiper-slide-shadow-bottom");0===v.length&&(v=a('<div class="swiper-slide-shadow-'+(b.isHorizontal()?"left":"top")+'"></div>'),o.append(v)),0===w.length&&(w=a('<div class="swiper-slide-shadow-'+(b.isHorizontal()?"right":"bottom")+'"></div>'),o.append(w)),v.length&&(v[0].style.opacity=d>0?d:0),w.length&&(w[0].style.opacity=-d>0?-d:0)}}if(b.browser.ie){var y=b.wrapper[0].style;y.perspectiveOrigin=t+"px 50%"}},setTransition:function(e){b.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}}},b.lazy={initialImageLoaded:!1,loadImageInSlide:function(e,t){if("undefined"!=typeof e&&("undefined"==typeof t&&(t=!0),0!==b.slides.length)){var s=b.slides.eq(e),r=s.find("."+b.params.lazyLoadingClass+":not(."+b.params.lazyStatusLoadedClass+"):not(."+b.params.lazyStatusLoadingClass+")");!s.hasClass(b.params.lazyLoadingClass)||s.hasClass(b.params.lazyStatusLoadedClass)||s.hasClass(b.params.lazyStatusLoadingClass)||(r=r.add(s[0])),0!==r.length&&r.each(function(){var e=a(this);e.addClass(b.params.lazyStatusLoadingClass);var r=e.attr("data-background"),i=e.attr("data-src"),n=e.attr("data-srcset"),o=e.attr("data-sizes");b.loadImage(e[0],i||r,n,o,!1,function(){if(r?(e.css("background-image",'url("'+r+'")'),e.removeAttr("data-background")):(n&&(e.attr("srcset",n),e.removeAttr("data-srcset")),o&&(e.attr("sizes",o),e.removeAttr("data-sizes")),i&&(e.attr("src",i),e.removeAttr("data-src"))),e.addClass(b.params.lazyStatusLoadedClass).removeClass(b.params.lazyStatusLoadingClass),s.find("."+b.params.lazyPreloaderClass+", ."+b.params.preloaderClass).remove(),b.params.loop&&t){var a=s.attr("data-swiper-slide-index");if(s.hasClass(b.params.slideDuplicateClass)){var l=b.wrapper.children('[data-swiper-slide-index="'+a+'"]:not(.'+b.params.slideDuplicateClass+")");b.lazy.loadImageInSlide(l.index(),!1)}else{var p=b.wrapper.children("."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+a+'"]');b.lazy.loadImageInSlide(p.index(),!1)}}b.emit("onLazyImageReady",b,s[0],e[0])}),b.emit("onLazyImageLoad",b,s[0],e[0])})}},load:function(){var e,t=b.params.slidesPerView;if("auto"===t&&(t=0),b.lazy.initialImageLoaded||(b.lazy.initialImageLoaded=!0),b.params.watchSlidesVisibility)b.wrapper.children("."+b.params.slideVisibleClass).each(function(){b.lazy.loadImageInSlide(a(this).index())});else if(t>1)for(e=b.activeIndex;e<b.activeIndex+t;e++)b.slides[e]&&b.lazy.loadImageInSlide(e);else b.lazy.loadImageInSlide(b.activeIndex);if(b.params.lazyLoadingInPrevNext)if(t>1||b.params.lazyLoadingInPrevNextAmount&&b.params.lazyLoadingInPrevNextAmount>1){var s=b.params.lazyLoadingInPrevNextAmount,r=t,i=Math.min(b.activeIndex+r+Math.max(s,r),b.slides.length),n=Math.max(b.activeIndex-Math.max(r,s),0);for(e=b.activeIndex+t;e<i;e++)b.slides[e]&&b.lazy.loadImageInSlide(e);for(e=n;e<b.activeIndex;e++)b.slides[e]&&b.lazy.loadImageInSlide(e)}else{var o=b.wrapper.children("."+b.params.slideNextClass);o.length>0&&b.lazy.loadImageInSlide(o.index());var l=b.wrapper.children("."+b.params.slidePrevClass);l.length>0&&b.lazy.loadImageInSlide(l.index())}},onTransitionStart:function(){b.params.lazyLoading&&(b.params.lazyLoadingOnTransitionStart||!b.params.lazyLoadingOnTransitionStart&&!b.lazy.initialImageLoaded)&&b.lazy.load()},onTransitionEnd:function(){b.params.lazyLoading&&!b.params.lazyLoadingOnTransitionStart&&b.lazy.load()}},b.scrollbar={isTouched:!1,setDragPosition:function(e){var a=b.scrollbar,t=b.isHorizontal()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageX:e.pageX||e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageY:e.pageY||e.clientY,s=t-a.track.offset()[b.isHorizontal()?"left":"top"]-a.dragSize/2,r=-b.minTranslate()*a.moveDivider,i=-b.maxTranslate()*a.moveDivider;s<r?s=r:s>i&&(s=i),s=-s/a.moveDivider,b.updateProgress(s),b.setWrapperTranslate(s,!0)},dragStart:function(e){var a=b.scrollbar;a.isTouched=!0,e.preventDefault(),e.stopPropagation(),a.setDragPosition(e),clearTimeout(a.dragTimeout),a.track.transition(0),b.params.scrollbarHide&&a.track.css("opacity",1),b.wrapper.transition(100),a.drag.transition(100),b.emit("onScrollbarDragStart",b)},dragMove:function(e){var a=b.scrollbar;a.isTouched&&(e.preventDefault?e.preventDefault():e.returnValue=!1,a.setDragPosition(e),b.wrapper.transition(0),a.track.transition(0),a.drag.transition(0),b.emit("onScrollbarDragMove",b))},dragEnd:function(e){var a=b.scrollbar;a.isTouched&&(a.isTouched=!1,b.params.scrollbarHide&&(clearTimeout(a.dragTimeout),a.dragTimeout=setTimeout(function(){a.track.css("opacity",0),a.track.transition(400)},1e3)),b.emit("onScrollbarDragEnd",b),b.params.scrollbarSnapOnRelease&&b.slideReset())},draggableEvents:function(){return b.params.simulateTouch!==!1||b.support.touch?b.touchEvents:b.touchEventsDesktop}(),enableDraggable:function(){var e=b.scrollbar,t=b.support.touch?e.track:document;a(e.track).on(e.draggableEvents.start,e.dragStart),a(t).on(e.draggableEvents.move,e.dragMove),a(t).on(e.draggableEvents.end,e.dragEnd)},disableDraggable:function(){var e=b.scrollbar,t=b.support.touch?e.track:document;a(e.track).off(b.draggableEvents.start,e.dragStart),a(t).off(b.draggableEvents.move,e.dragMove),a(t).off(b.draggableEvents.end,e.dragEnd)},set:function(){if(b.params.scrollbar){var e=b.scrollbar;e.track=a(b.params.scrollbar),b.params.uniqueNavElements&&"string"==typeof b.params.scrollbar&&e.track.length>1&&1===b.container.find(b.params.scrollbar).length&&(e.track=b.container.find(b.params.scrollbar)),e.drag=e.track.find(".swiper-scrollbar-drag"),0===e.drag.length&&(e.drag=a('<div class="swiper-scrollbar-drag"></div>'),e.track.append(e.drag)),e.drag[0].style.width="",e.drag[0].style.height="",e.trackSize=b.isHorizontal()?e.track[0].offsetWidth:e.track[0].offsetHeight,e.divider=b.size/b.virtualSize,e.moveDivider=e.divider*(e.trackSize/b.size),e.dragSize=e.trackSize*e.divider,b.isHorizontal()?e.drag[0].style.width=e.dragSize+"px":e.drag[0].style.height=e.dragSize+"px",e.divider>=1?e.track[0].style.display="none":e.track[0].style.display="",b.params.scrollbarHide&&(e.track[0].style.opacity=0)}},setTranslate:function(){if(b.params.scrollbar){var e,a=b.scrollbar,t=(b.translate||0,a.dragSize);e=(a.trackSize-a.dragSize)*b.progress,b.rtl&&b.isHorizontal()?(e=-e,e>0?(t=a.dragSize-e,e=0):-e+a.dragSize>a.trackSize&&(t=a.trackSize+e)):e<0?(t=a.dragSize+e,e=0):e+a.dragSize>a.trackSize&&(t=a.trackSize-e),b.isHorizontal()?(b.support.transforms3d?a.drag.transform("translate3d("+e+"px, 0, 0)"):a.drag.transform("translateX("+e+"px)"),a.drag[0].style.width=t+"px"):(b.support.transforms3d?a.drag.transform("translate3d(0px, "+e+"px, 0)"):a.drag.transform("translateY("+e+"px)"),a.drag[0].style.height=t+"px"),b.params.scrollbarHide&&(clearTimeout(a.timeout),a.track[0].style.opacity=1,a.timeout=setTimeout(function(){a.track[0].style.opacity=0,a.track.transition(400)},1e3))}},setTransition:function(e){b.params.scrollbar&&b.scrollbar.drag.transition(e)}},b.controller={LinearSpline:function(e,a){this.x=e,this.y=a,this.lastIndex=e.length-1;var t,s;this.x.length;this.interpolate=function(e){return e?(s=r(this.x,e),t=s-1,(e-this.x[t])*(this.y[s]-this.y[t])/(this.x[s]-this.x[t])+this.y[t]):0};var r=function(){var e,a,t;return function(s,r){for(a=-1,e=s.length;e-a>1;)s[t=e+a>>1]<=r?a=t:e=t;return e}}()},getInterpolateFunction:function(e){b.controller.spline||(b.controller.spline=b.params.loop?new b.controller.LinearSpline(b.slidesGrid,e.slidesGrid):new b.controller.LinearSpline(b.snapGrid,e.snapGrid))},setTranslate:function(e,a){function s(a){e=a.rtl&&"horizontal"===a.params.direction?-b.translate:b.translate,"slide"===b.params.controlBy&&(b.controller.getInterpolateFunction(a),i=-b.controller.spline.interpolate(-e)),i&&"container"!==b.params.controlBy||(r=(a.maxTranslate()-a.minTranslate())/(b.maxTranslate()-b.minTranslate()),i=(e-b.minTranslate())*r+a.minTranslate()),b.params.controlInverse&&(i=a.maxTranslate()-i),a.updateProgress(i),a.setWrapperTranslate(i,!1,b),a.updateActiveIndex()}var r,i,n=b.params.control;if(b.isArray(n))for(var o=0;o<n.length;o++)n[o]!==a&&n[o]instanceof t&&s(n[o]);else n instanceof t&&a!==n&&s(n)},setTransition:function(e,a){function s(a){a.setWrapperTransition(e,b),0!==e&&(a.onTransitionStart(),a.wrapper.transitionEnd(function(){i&&(a.params.loop&&"slide"===b.params.controlBy&&a.fixLoop(),a.onTransitionEnd())}))}var r,i=b.params.control;if(b.isArray(i))for(r=0;r<i.length;r++)i[r]!==a&&i[r]instanceof t&&s(i[r]);else i instanceof t&&a!==i&&s(i)}},b.hashnav={onHashCange:function(e,a){var t=document.location.hash.replace("#",""),s=b.slides.eq(b.activeIndex).attr("data-hash");t!==s&&b.slideTo(b.wrapper.children("."+b.params.slideClass+'[data-hash="'+t+'"]').index());
17
+ },attachEvents:function(e){var t=e?"off":"on";a(window)[t]("hashchange",b.hashnav.onHashCange)},setHash:function(){if(b.hashnav.initialized&&b.params.hashnav)if(b.params.replaceState&&window.history&&window.history.replaceState)window.history.replaceState(null,null,"#"+b.slides.eq(b.activeIndex).attr("data-hash")||"");else{var e=b.slides.eq(b.activeIndex),a=e.attr("data-hash")||e.attr("data-history");document.location.hash=a||""}},init:function(){if(b.params.hashnav&&!b.params.history){b.hashnav.initialized=!0;var e=document.location.hash.replace("#","");if(e){for(var a=0,t=0,s=b.slides.length;t<s;t++){var r=b.slides.eq(t),i=r.attr("data-hash")||r.attr("data-history");if(i===e&&!r.hasClass(b.params.slideDuplicateClass)){var n=r.index();b.slideTo(n,a,b.params.runCallbacksOnInit,!0)}}b.params.hashnavWatchState&&b.hashnav.attachEvents()}}},destroy:function(){b.params.hashnavWatchState&&b.hashnav.attachEvents(!0)}},b.history={init:function(){if(b.params.history){if(!window.history||!window.history.pushState)return b.params.history=!1,void(b.params.hashnav=!0);b.history.initialized=!0,this.paths=this.getPathValues(),(this.paths.key||this.paths.value)&&(this.scrollToSlide(0,this.paths.value,b.params.runCallbacksOnInit),b.params.replaceState||window.addEventListener("popstate",this.setHistoryPopState))}},setHistoryPopState:function(){b.history.paths=b.history.getPathValues(),b.history.scrollToSlide(b.params.speed,b.history.paths.value,!1)},getPathValues:function(){var e=window.location.pathname.slice(1).split("/"),a=e.length,t=e[a-2],s=e[a-1];return{key:t,value:s}},setHistory:function(e,a){if(b.history.initialized&&b.params.history){var t=b.slides.eq(a),s=this.slugify(t.attr("data-history"));window.location.pathname.includes(e)||(s=e+"/"+s),b.params.replaceState?window.history.replaceState(null,null,s):window.history.pushState(null,null,s)}},slugify:function(e){return e.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")},scrollToSlide:function(e,a,t){if(a)for(var s=0,r=b.slides.length;s<r;s++){var i=b.slides.eq(s),n=this.slugify(i.attr("data-history"));if(n===a&&!i.hasClass(b.params.slideDuplicateClass)){var o=i.index();b.slideTo(o,e,t)}}else b.slideTo(0,e,t)}},b.disableKeyboardControl=function(){b.params.keyboardControl=!1,a(document).off("keydown",p)},b.enableKeyboardControl=function(){b.params.keyboardControl=!0,a(document).on("keydown",p)},b.mousewheel={event:!1,lastScrollTime:(new window.Date).getTime()},b.params.mousewheelControl&&(b.mousewheel.event=navigator.userAgent.indexOf("firefox")>-1?"DOMMouseScroll":d()?"wheel":"mousewheel"),b.disableMousewheelControl=function(){if(!b.mousewheel.event)return!1;var e=b.container;return"container"!==b.params.mousewheelEventsTarged&&(e=a(b.params.mousewheelEventsTarged)),e.off(b.mousewheel.event,u),!0},b.enableMousewheelControl=function(){if(!b.mousewheel.event)return!1;var e=b.container;return"container"!==b.params.mousewheelEventsTarged&&(e=a(b.params.mousewheelEventsTarged)),e.on(b.mousewheel.event,u),!0},b.parallax={setTranslate:function(){b.container.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){c(this,b.progress)}),b.slides.each(function(){var e=a(this);e.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var a=Math.min(Math.max(e[0].progress,-1),1);c(this,a)})})},setTransition:function(e){"undefined"==typeof e&&(e=b.params.speed),b.container.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var t=a(this),s=parseInt(t.attr("data-swiper-parallax-duration"),10)||e;0===e&&(s=0),t.transition(s)})}},b.zoom={scale:1,currentScale:1,isScaling:!1,gesture:{slide:void 0,slideWidth:void 0,slideHeight:void 0,image:void 0,imageWrap:void 0,zoomMax:b.params.zoomMax},image:{isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},velocity:{x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0},getDistanceBetweenTouches:function(e){if(e.targetTouches.length<2)return 1;var a=e.targetTouches[0].pageX,t=e.targetTouches[0].pageY,s=e.targetTouches[1].pageX,r=e.targetTouches[1].pageY,i=Math.sqrt(Math.pow(s-a,2)+Math.pow(r-t,2));return i},onGestureStart:function(e){var t=b.zoom;if(!b.support.gestures){if("touchstart"!==e.type||"touchstart"===e.type&&e.targetTouches.length<2)return;t.gesture.scaleStart=t.getDistanceBetweenTouches(e)}return t.gesture.slide&&t.gesture.slide.length||(t.gesture.slide=a(this),0===t.gesture.slide.length&&(t.gesture.slide=b.slides.eq(b.activeIndex)),t.gesture.image=t.gesture.slide.find("img, svg, canvas"),t.gesture.imageWrap=t.gesture.image.parent("."+b.params.zoomContainerClass),t.gesture.zoomMax=t.gesture.imageWrap.attr("data-swiper-zoom")||b.params.zoomMax,0!==t.gesture.imageWrap.length)?(t.gesture.image.transition(0),void(t.isScaling=!0)):void(t.gesture.image=void 0)},onGestureChange:function(e){var a=b.zoom;if(!b.support.gestures){if("touchmove"!==e.type||"touchmove"===e.type&&e.targetTouches.length<2)return;a.gesture.scaleMove=a.getDistanceBetweenTouches(e)}a.gesture.image&&0!==a.gesture.image.length&&(b.support.gestures?a.scale=e.scale*a.currentScale:a.scale=a.gesture.scaleMove/a.gesture.scaleStart*a.currentScale,a.scale>a.gesture.zoomMax&&(a.scale=a.gesture.zoomMax-1+Math.pow(a.scale-a.gesture.zoomMax+1,.5)),a.scale<b.params.zoomMin&&(a.scale=b.params.zoomMin+1-Math.pow(b.params.zoomMin-a.scale+1,.5)),a.gesture.image.transform("translate3d(0,0,0) scale("+a.scale+")"))},onGestureEnd:function(e){var a=b.zoom;!b.support.gestures&&("touchend"!==e.type||"touchend"===e.type&&e.changedTouches.length<2)||a.gesture.image&&0!==a.gesture.image.length&&(a.scale=Math.max(Math.min(a.scale,a.gesture.zoomMax),b.params.zoomMin),a.gesture.image.transition(b.params.speed).transform("translate3d(0,0,0) scale("+a.scale+")"),a.currentScale=a.scale,a.isScaling=!1,1===a.scale&&(a.gesture.slide=void 0))},onTouchStart:function(e,a){var t=e.zoom;t.gesture.image&&0!==t.gesture.image.length&&(t.image.isTouched||("android"===e.device.os&&a.preventDefault(),t.image.isTouched=!0,t.image.touchesStart.x="touchstart"===a.type?a.targetTouches[0].pageX:a.pageX,t.image.touchesStart.y="touchstart"===a.type?a.targetTouches[0].pageY:a.pageY))},onTouchMove:function(e){var a=b.zoom;if(a.gesture.image&&0!==a.gesture.image.length&&(b.allowClick=!1,a.image.isTouched&&a.gesture.slide)){a.image.isMoved||(a.image.width=a.gesture.image[0].offsetWidth,a.image.height=a.gesture.image[0].offsetHeight,a.image.startX=b.getTranslate(a.gesture.imageWrap[0],"x")||0,a.image.startY=b.getTranslate(a.gesture.imageWrap[0],"y")||0,a.gesture.slideWidth=a.gesture.slide[0].offsetWidth,a.gesture.slideHeight=a.gesture.slide[0].offsetHeight,a.gesture.imageWrap.transition(0));var t=a.image.width*a.scale,s=a.image.height*a.scale;if(!(t<a.gesture.slideWidth&&s<a.gesture.slideHeight)){if(a.image.minX=Math.min(a.gesture.slideWidth/2-t/2,0),a.image.maxX=-a.image.minX,a.image.minY=Math.min(a.gesture.slideHeight/2-s/2,0),a.image.maxY=-a.image.minY,a.image.touchesCurrent.x="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,a.image.touchesCurrent.y="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,!a.image.isMoved&&!a.isScaling){if(b.isHorizontal()&&Math.floor(a.image.minX)===Math.floor(a.image.startX)&&a.image.touchesCurrent.x<a.image.touchesStart.x||Math.floor(a.image.maxX)===Math.floor(a.image.startX)&&a.image.touchesCurrent.x>a.image.touchesStart.x)return void(a.image.isTouched=!1);if(!b.isHorizontal()&&Math.floor(a.image.minY)===Math.floor(a.image.startY)&&a.image.touchesCurrent.y<a.image.touchesStart.y||Math.floor(a.image.maxY)===Math.floor(a.image.startY)&&a.image.touchesCurrent.y>a.image.touchesStart.y)return void(a.image.isTouched=!1)}e.preventDefault(),e.stopPropagation(),a.image.isMoved=!0,a.image.currentX=a.image.touchesCurrent.x-a.image.touchesStart.x+a.image.startX,a.image.currentY=a.image.touchesCurrent.y-a.image.touchesStart.y+a.image.startY,a.image.currentX<a.image.minX&&(a.image.currentX=a.image.minX+1-Math.pow(a.image.minX-a.image.currentX+1,.8)),a.image.currentX>a.image.maxX&&(a.image.currentX=a.image.maxX-1+Math.pow(a.image.currentX-a.image.maxX+1,.8)),a.image.currentY<a.image.minY&&(a.image.currentY=a.image.minY+1-Math.pow(a.image.minY-a.image.currentY+1,.8)),a.image.currentY>a.image.maxY&&(a.image.currentY=a.image.maxY-1+Math.pow(a.image.currentY-a.image.maxY+1,.8)),a.velocity.prevPositionX||(a.velocity.prevPositionX=a.image.touchesCurrent.x),a.velocity.prevPositionY||(a.velocity.prevPositionY=a.image.touchesCurrent.y),a.velocity.prevTime||(a.velocity.prevTime=Date.now()),a.velocity.x=(a.image.touchesCurrent.x-a.velocity.prevPositionX)/(Date.now()-a.velocity.prevTime)/2,a.velocity.y=(a.image.touchesCurrent.y-a.velocity.prevPositionY)/(Date.now()-a.velocity.prevTime)/2,Math.abs(a.image.touchesCurrent.x-a.velocity.prevPositionX)<2&&(a.velocity.x=0),Math.abs(a.image.touchesCurrent.y-a.velocity.prevPositionY)<2&&(a.velocity.y=0),a.velocity.prevPositionX=a.image.touchesCurrent.x,a.velocity.prevPositionY=a.image.touchesCurrent.y,a.velocity.prevTime=Date.now(),a.gesture.imageWrap.transform("translate3d("+a.image.currentX+"px, "+a.image.currentY+"px,0)")}}},onTouchEnd:function(e,a){var t=e.zoom;if(t.gesture.image&&0!==t.gesture.image.length){if(!t.image.isTouched||!t.image.isMoved)return t.image.isTouched=!1,void(t.image.isMoved=!1);t.image.isTouched=!1,t.image.isMoved=!1;var s=300,r=300,i=t.velocity.x*s,n=t.image.currentX+i,o=t.velocity.y*r,l=t.image.currentY+o;0!==t.velocity.x&&(s=Math.abs((n-t.image.currentX)/t.velocity.x)),0!==t.velocity.y&&(r=Math.abs((l-t.image.currentY)/t.velocity.y));var p=Math.max(s,r);t.image.currentX=n,t.image.currentY=l;var d=t.image.width*t.scale,u=t.image.height*t.scale;t.image.minX=Math.min(t.gesture.slideWidth/2-d/2,0),t.image.maxX=-t.image.minX,t.image.minY=Math.min(t.gesture.slideHeight/2-u/2,0),t.image.maxY=-t.image.minY,t.image.currentX=Math.max(Math.min(t.image.currentX,t.image.maxX),t.image.minX),t.image.currentY=Math.max(Math.min(t.image.currentY,t.image.maxY),t.image.minY),t.gesture.imageWrap.transition(p).transform("translate3d("+t.image.currentX+"px, "+t.image.currentY+"px,0)")}},onTransitionEnd:function(e){var a=e.zoom;a.gesture.slide&&e.previousIndex!==e.activeIndex&&(a.gesture.image.transform("translate3d(0,0,0) scale(1)"),a.gesture.imageWrap.transform("translate3d(0,0,0)"),a.gesture.slide=a.gesture.image=a.gesture.imageWrap=void 0,a.scale=a.currentScale=1)},toggleZoom:function(e,t){var s=e.zoom;if(s.gesture.slide||(s.gesture.slide=e.clickedSlide?a(e.clickedSlide):e.slides.eq(e.activeIndex),s.gesture.image=s.gesture.slide.find("img, svg, canvas"),s.gesture.imageWrap=s.gesture.image.parent("."+e.params.zoomContainerClass)),s.gesture.image&&0!==s.gesture.image.length){var r,i,n,o,l,p,d,u,m,c,g,h,f,v,w,y,x,T;"undefined"==typeof s.image.touchesStart.x&&t?(r="touchend"===t.type?t.changedTouches[0].pageX:t.pageX,i="touchend"===t.type?t.changedTouches[0].pageY:t.pageY):(r=s.image.touchesStart.x,i=s.image.touchesStart.y),s.scale&&1!==s.scale?(s.scale=s.currentScale=1,s.gesture.imageWrap.transition(300).transform("translate3d(0,0,0)"),s.gesture.image.transition(300).transform("translate3d(0,0,0) scale(1)"),s.gesture.slide=void 0):(s.scale=s.currentScale=s.gesture.imageWrap.attr("data-swiper-zoom")||e.params.zoomMax,t?(x=s.gesture.slide[0].offsetWidth,T=s.gesture.slide[0].offsetHeight,n=s.gesture.slide.offset().left,o=s.gesture.slide.offset().top,l=n+x/2-r,p=o+T/2-i,m=s.gesture.image[0].offsetWidth,c=s.gesture.image[0].offsetHeight,g=m*s.scale,h=c*s.scale,f=Math.min(x/2-g/2,0),v=Math.min(T/2-h/2,0),w=-f,y=-v,d=l*s.scale,u=p*s.scale,d<f&&(d=f),d>w&&(d=w),u<v&&(u=v),u>y&&(u=y)):(d=0,u=0),s.gesture.imageWrap.transition(300).transform("translate3d("+d+"px, "+u+"px,0)"),s.gesture.image.transition(300).transform("translate3d(0,0,0) scale("+s.scale+")"))}},attachEvents:function(e){var t=e?"off":"on";if(b.params.zoom){var s=(b.slides,!("touchstart"!==b.touchEvents.start||!b.support.passiveListener||!b.params.passiveListeners)&&{passive:!0,capture:!1});b.support.gestures?(b.slides[t]("gesturestart",b.zoom.onGestureStart,s),b.slides[t]("gesturechange",b.zoom.onGestureChange,s),b.slides[t]("gestureend",b.zoom.onGestureEnd,s)):"touchstart"===b.touchEvents.start&&(b.slides[t](b.touchEvents.start,b.zoom.onGestureStart,s),b.slides[t](b.touchEvents.move,b.zoom.onGestureChange,s),b.slides[t](b.touchEvents.end,b.zoom.onGestureEnd,s)),b[t]("touchStart",b.zoom.onTouchStart),b.slides.each(function(e,s){a(s).find("."+b.params.zoomContainerClass).length>0&&a(s)[t](b.touchEvents.move,b.zoom.onTouchMove)}),b[t]("touchEnd",b.zoom.onTouchEnd),b[t]("transitionEnd",b.zoom.onTransitionEnd),b.params.zoomToggle&&b.on("doubleTap",b.zoom.toggleZoom)}},init:function(){b.zoom.attachEvents()},destroy:function(){b.zoom.attachEvents(!0)}},b._plugins=[];for(var O in b.plugins){var W=b.plugins[O](b,b.params[O]);W&&b._plugins.push(W)}return b.callPlugins=function(e){for(var a=0;a<b._plugins.length;a++)e in b._plugins[a]&&b._plugins[a][e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},b.emitterEventListeners={},b.emit=function(e){b.params[e]&&b.params[e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);var a;if(b.emitterEventListeners[e])for(a=0;a<b.emitterEventListeners[e].length;a++)b.emitterEventListeners[e][a](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);b.callPlugins&&b.callPlugins(e,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},b.on=function(e,a){return e=g(e),b.emitterEventListeners[e]||(b.emitterEventListeners[e]=[]),b.emitterEventListeners[e].push(a),b},b.off=function(e,a){var t;if(e=g(e),"undefined"==typeof a)return b.emitterEventListeners[e]=[],b;if(b.emitterEventListeners[e]&&0!==b.emitterEventListeners[e].length){for(t=0;t<b.emitterEventListeners[e].length;t++)b.emitterEventListeners[e][t]===a&&b.emitterEventListeners[e].splice(t,1);return b}},b.once=function(e,a){e=g(e);var t=function(){a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),b.off(e,t)};return b.on(e,t),b},b.a11y={makeFocusable:function(e){return e.attr("tabIndex","0"),e},addRole:function(e,a){return e.attr("role",a),e},addLabel:function(e,a){return e.attr("aria-label",a),e},disable:function(e){return e.attr("aria-disabled",!0),e},enable:function(e){return e.attr("aria-disabled",!1),e},onEnterKey:function(e){13===e.keyCode&&(a(e.target).is(b.params.nextButton)?(b.onClickNext(e),b.isEnd?b.a11y.notify(b.params.lastSlideMessage):b.a11y.notify(b.params.nextSlideMessage)):a(e.target).is(b.params.prevButton)&&(b.onClickPrev(e),b.isBeginning?b.a11y.notify(b.params.firstSlideMessage):b.a11y.notify(b.params.prevSlideMessage)),a(e.target).is("."+b.params.bulletClass)&&a(e.target)[0].click())},liveRegion:a('<span class="'+b.params.notificationClass+'" aria-live="assertive" aria-atomic="true"></span>'),notify:function(e){var a=b.a11y.liveRegion;0!==a.length&&(a.html(""),a.html(e))},init:function(){b.params.nextButton&&b.nextButton&&b.nextButton.length>0&&(b.a11y.makeFocusable(b.nextButton),b.a11y.addRole(b.nextButton,"button"),b.a11y.addLabel(b.nextButton,b.params.nextSlideMessage)),b.params.prevButton&&b.prevButton&&b.prevButton.length>0&&(b.a11y.makeFocusable(b.prevButton),b.a11y.addRole(b.prevButton,"button"),b.a11y.addLabel(b.prevButton,b.params.prevSlideMessage)),a(b.container).append(b.a11y.liveRegion)},initPagination:function(){b.params.pagination&&b.params.paginationClickable&&b.bullets&&b.bullets.length&&b.bullets.each(function(){var e=a(this);b.a11y.makeFocusable(e),b.a11y.addRole(e,"button"),b.a11y.addLabel(e,b.params.paginationBulletMessage.replace(/{{index}}/,e.index()+1))})},destroy:function(){b.a11y.liveRegion&&b.a11y.liveRegion.length>0&&b.a11y.liveRegion.remove()}},b.init=function(){b.params.loop&&b.createLoop(),b.updateContainerSize(),b.updateSlidesSize(),b.updatePagination(),b.params.scrollbar&&b.scrollbar&&(b.scrollbar.set(),b.params.scrollbarDraggable&&b.scrollbar.enableDraggable()),"slide"!==b.params.effect&&b.effects[b.params.effect]&&(b.params.loop||b.updateProgress(),b.effects[b.params.effect].setTranslate()),b.params.loop?b.slideTo(b.params.initialSlide+b.loopedSlides,0,b.params.runCallbacksOnInit):(b.slideTo(b.params.initialSlide,0,b.params.runCallbacksOnInit),0===b.params.initialSlide&&(b.parallax&&b.params.parallax&&b.parallax.setTranslate(),b.lazy&&b.params.lazyLoading&&(b.lazy.load(),b.lazy.initialImageLoaded=!0))),b.attachEvents(),b.params.observer&&b.support.observer&&b.initObservers(),b.params.preloadImages&&!b.params.lazyLoading&&b.preloadImages(),b.params.zoom&&b.zoom&&b.zoom.init(),b.params.autoplay&&b.startAutoplay(),b.params.keyboardControl&&b.enableKeyboardControl&&b.enableKeyboardControl(),b.params.mousewheelControl&&b.enableMousewheelControl&&b.enableMousewheelControl(),b.params.hashnavReplaceState&&(b.params.replaceState=b.params.hashnavReplaceState),b.params.history&&b.history&&b.history.init(),b.params.hashnav&&b.hashnav&&b.hashnav.init(),b.params.a11y&&b.a11y&&b.a11y.init(),b.emit("onInit",b)},b.cleanupStyles=function(){b.container.removeClass(b.classNames.join(" ")).removeAttr("style"),b.wrapper.removeAttr("style"),b.slides&&b.slides.length&&b.slides.removeClass([b.params.slideVisibleClass,b.params.slideActiveClass,b.params.slideNextClass,b.params.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-column").removeAttr("data-swiper-row"),b.paginationContainer&&b.paginationContainer.length&&b.paginationContainer.removeClass(b.params.paginationHiddenClass),b.bullets&&b.bullets.length&&b.bullets.removeClass(b.params.bulletActiveClass),b.params.prevButton&&a(b.params.prevButton).removeClass(b.params.buttonDisabledClass),b.params.nextButton&&a(b.params.nextButton).removeClass(b.params.buttonDisabledClass),b.params.scrollbar&&b.scrollbar&&(b.scrollbar.track&&b.scrollbar.track.length&&b.scrollbar.track.removeAttr("style"),b.scrollbar.drag&&b.scrollbar.drag.length&&b.scrollbar.drag.removeAttr("style"))},b.destroy=function(e,a){b.detachEvents(),b.stopAutoplay(),b.params.scrollbar&&b.scrollbar&&b.params.scrollbarDraggable&&b.scrollbar.disableDraggable(),b.params.loop&&b.destroyLoop(),a&&b.cleanupStyles(),b.disconnectObservers(),b.params.zoom&&b.zoom&&b.zoom.destroy(),b.params.keyboardControl&&b.disableKeyboardControl&&b.disableKeyboardControl(),b.params.mousewheelControl&&b.disableMousewheelControl&&b.disableMousewheelControl(),b.params.a11y&&b.a11y&&b.a11y.destroy(),b.params.history&&!b.params.replaceState&&window.removeEventListener("popstate",b.history.setHistoryPopState),b.params.hashnav&&b.hashnav&&b.hashnav.destroy(),b.emit("onDestroy"),e!==!1&&(b=null)},b.init(),b}};t.prototype={isSafari:function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}(),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},browser:{ie:window.navigator.pointerEnabled||window.navigator.msPointerEnabled,ieTouch:window.navigator.msPointerEnabled&&window.navigator.msMaxTouchPoints>1||window.navigator.pointerEnabled&&window.navigator.maxTouchPoints>1,lteIE9:function(){var e=document.createElement("div");return e.innerHTML="<!--[if lte IE 9]><i></i><![endif]-->",1===e.getElementsByTagName("i").length}()},device:function(){var e=navigator.userAgent,a=e.match(/(Android);?[\s\/]+([\d.]+)?/),t=e.match(/(iPad).*OS\s([\d_]+)/),s=e.match(/(iPod)(.*OS\s([\d_]+))?/),r=!t&&e.match(/(iPhone\sOS)\s([\d_]+)/);return{ios:t||r||s,android:a}}(),support:{touch:window.Modernizr&&Modernizr.touch===!0||function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}(),transforms3d:window.Modernizr&&Modernizr.csstransforms3d===!0||function(){var e=document.createElement("div").style;return"webkitPerspective"in e||"MozPerspective"in e||"OPerspective"in e||"MsPerspective"in e||"perspective"in e}(),flexbox:function(){for(var e=document.createElement("div").style,a="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" "),t=0;t<a.length;t++)if(a[t]in e)return!0}(),observer:function(){return"MutationObserver"in window||"WebkitMutationObserver"in window}(),passiveListener:function(){var e=!1;try{var a=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveListener",null,a)}catch(e){}return e}(),gestures:function(){return"ongesturestart"in window}()},plugins:{}};for(var s=["jQuery","Zepto","Dom7"],r=0;r<s.length;r++)window[s[r]]&&e(window[s[r]]);var i;i="undefined"==typeof Dom7?window.Dom7||window.Zepto||window.jQuery:Dom7,i&&("transitionEnd"in i.fn||(i.fn.transitionEnd=function(e){function a(i){if(i.target===this)for(e.call(this,i),t=0;t<s.length;t++)r.off(s[t],a)}var t,s=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],r=this;if(e)for(t=0;t<s.length;t++)r.on(s[t],a);return this}),"transform"in i.fn||(i.fn.transform=function(e){for(var a=0;a<this.length;a++){var t=this[a].style;t.webkitTransform=t.MsTransform=t.msTransform=t.MozTransform=t.OTransform=t.transform=e}return this}),"transition"in i.fn||(i.fn.transition=function(e){"string"!=typeof e&&(e+="ms");for(var a=0;a<this.length;a++){var t=this[a].style;t.webkitTransitionDuration=t.MsTransitionDuration=t.msTransitionDuration=t.MozTransitionDuration=t.OTransitionDuration=t.transitionDuration=e}return this}),"outerWidth"in i.fn||(i.fn.outerWidth=function(e){return this.length>0?e?this[0].offsetWidth+parseFloat(this.css("margin-right"))+parseFloat(this.css("margin-left")):this[0].offsetWidth:null})),window.Swiper=t}(),"undefined"!=typeof module?module.exports=window.Swiper:"function"==typeof define&&define.amd&&define([],function(){"use strict";return window.Swiper});
18
+ //# sourceMappingURL=maps/swiper.jquery.min.js.map
assets/swiper/swiper.min.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Swiper 3.4.0
3
+ * Most modern mobile touch slider and framework with hardware accelerated transitions
4
+ *
5
+ * http://www.idangero.us/swiper/
6
+ *
7
+ * Copyright 2016, Vladimir Kharlampidi
8
+ * The iDangero.us
9
+ * http://www.idangero.us/
10
+ *
11
+ * Licensed under MIT
12
+ *
13
+ * Released on: October 16, 2016
14
+ */
15
+ .swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;z-index:1}.swiper-container-no-flexbox .swiper-slide{float:left}.swiper-container-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-moz-box-orient:vertical;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-transition-property:-webkit-transform;-moz-transition-property:-moz-transform;-o-transition-property:-o-transform;-ms-transition-property:-ms-transform;transition-property:transform;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.swiper-container-android .swiper-slide,.swiper-wrapper{-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-o-transform:translate(0,0);-ms-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.swiper-container-multirow>.swiper-wrapper{-webkit-box-lines:multiple;-moz-box-lines:multiple;-ms-flex-wrap:wrap;-webkit-flex-wrap:wrap;flex-wrap:wrap}.swiper-container-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;-moz-transition-timing-function:ease-out;-ms-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-slide{-webkit-flex-shrink:0;-ms-flex:0 0 auto;flex-shrink:0;width:100%;height:100%;position:relative}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{-webkit-box-align:start;-ms-flex-align:start;-webkit-align-items:flex-start;align-items:flex-start;-webkit-transition-property:-webkit-transform,height;-moz-transition-property:-moz-transform;-o-transition-property:-o-transform;-ms-transition-property:-ms-transform;transition-property:transform,height}.swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-wp8-horizontal{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-wp8-vertical{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:27px;height:44px;margin-top:-22px;z-index:10;cursor:pointer;-moz-background-size:27px 44px;-webkit-background-size:27px 44px;background-size:27px 44px;background-position:center;background-repeat:no-repeat}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E");left:10px;right:auto}.swiper-button-prev.swiper-button-black,.swiper-container-rtl .swiper-button-next.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E")}.swiper-button-prev.swiper-button-white,.swiper-container-rtl .swiper-button-next.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E")}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E");right:10px;left:auto}.swiper-button-next.swiper-button-black,.swiper-container-rtl .swiper-button-prev.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E")}.swiper-button-next.swiper-button-white,.swiper-container-rtl .swiper-button-prev.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E")}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:.3s;-moz-transition:.3s;-o-transition:.3s;transition:.3s;-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;left:0;width:100%}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:100%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;-moz-appearance:none;-ms-appearance:none;-webkit-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-white .swiper-pagination-bullet{background:#fff}.swiper-pagination-bullet-active{opacity:1;background:#007aff}.swiper-pagination-white .swiper-pagination-bullet-active{background:#fff}.swiper-pagination-black .swiper-pagination-bullet-active{background:#000}.swiper-container-vertical>.swiper-pagination-bullets{right:10px;top:50%;-webkit-transform:translate3d(0,-50%,0);-moz-transform:translate3d(0,-50%,0);-o-transform:translate(0,-50%);-ms-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:5px 0;display:block}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 5px}.swiper-pagination-progress{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progress .swiper-pagination-progressbar{background:#007aff;position:absolute;left:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0);-webkit-transform-origin:left top;-moz-transform-origin:left top;-ms-transform-origin:left top;-o-transform-origin:left top;transform-origin:left top}.swiper-container-rtl .swiper-pagination-progress .swiper-pagination-progressbar{-webkit-transform-origin:right top;-moz-transform-origin:right top;-ms-transform-origin:right top;-o-transform-origin:right top;transform-origin:right top}.swiper-container-horizontal>.swiper-pagination-progress{width:100%;height:4px;left:0;top:0}.swiper-container-vertical>.swiper-pagination-progress{width:4px;height:100%;left:0;top:0}.swiper-pagination-progress.swiper-pagination-white{background:rgba(255,255,255,.5)}.swiper-pagination-progress.swiper-pagination-white .swiper-pagination-progressbar{background:#fff}.swiper-pagination-progress.swiper-pagination-black .swiper-pagination-progressbar{background:#000}.swiper-container-3d{-webkit-perspective:1200px;-moz-perspective:1200px;-o-perspective:1200px;perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));background-image:-webkit-linear-gradient(right,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-moz-linear-gradient(right,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-o-linear-gradient(right,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:linear-gradient(to left,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear,right top,left top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-moz-linear-gradient(left,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-o-linear-gradient(left,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:linear-gradient(to right,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));background-image:-webkit-linear-gradient(bottom,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-moz-linear-gradient(bottom,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-o-linear-gradient(bottom,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:linear-gradient(to top,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear,left bottom,left top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));background-image:-webkit-linear-gradient(top,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-moz-linear-gradient(top,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:-o-linear-gradient(top,rgba(0,0,0,.5),rgba(0,0,0,0));background-image:linear-gradient(to bottom,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-coverflow .swiper-wrapper,.swiper-container-flip .swiper-wrapper{-ms-perspective:1200px}.swiper-container-cube,.swiper-container-flip{overflow:visible}.swiper-container-cube .swiper-slide,.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-cube .swiper-slide .swiper-slide,.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active,.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top,.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-slide{visibility:hidden;-webkit-transform-origin:0 0;-moz-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;width:100%;height:100%}.swiper-container-cube.swiper-container-rtl .swiper-slide{-webkit-transform-origin:100% 0;-moz-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next+.swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0;width:100%;height:100%;background:#000;opacity:.6;-webkit-filter:blur(50px);filter:blur(50px);z-index:0}.swiper-container-fade.swiper-container-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;-moz-transition-timing-function:ease-out;-ms-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;-moz-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;object-fit:contain}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;left:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;right:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;-moz-transform-origin:50%;transform-origin:50%;-webkit-animation:swiper-preloader-spin 1s steps(12,end) infinite;-moz-animation:swiper-preloader-spin 1s steps(12,end) infinite;animation:swiper-preloader-spin 1s steps(12,end) infinite}.swiper-lazy-preloader:after{display:block;content:"";width:100%;height:100%;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");background-position:50%;-webkit-background-size:100%;background-size:100%;background-repeat:no-repeat}.swiper-lazy-preloader-white:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}@-webkit-keyframes swiper-preloader-spin{100%{-webkit-transform:rotate(360deg)}}@keyframes swiper-preloader-spin{100%{transform:rotate(360deg)}}
config/setup.php CHANGED
@@ -20,6 +20,8 @@ function gmedia_default_options(){
20
  $gm['site_description'] = '';
21
  $gm['mobile_app'] = 0;
22
 
 
 
23
  $gm['gmedia_post_slug'] = 'gmedia';
24
  $gm['gmedia_exclude_from_search'] = '0';
25
  $gm['gmedia_has_archive'] = '1';
@@ -38,6 +40,7 @@ function gmedia_default_options(){
38
 
39
  $gm['uninstall_dropdata'] = 'none'; // can be 'all', 'none', 'db'
40
 
 
41
  $gm['in_tag_orderby'] = 'ID';
42
  $gm['in_tag_order'] = 'DESC';
43
  $gm['in_category_orderby'] = 'ID';
@@ -47,7 +50,7 @@ function gmedia_default_options(){
47
  $gm['in_album_status'] = 'publish';
48
  $gm['default_gmedia_module'] = 'phantom';
49
 
50
- $gm['isolation_mode'] = '0';
51
  $gm['shortcode_raw'] = '0';
52
  $gm['debug_mode'] = WP_DEBUG? '1' : '';
53
 
@@ -83,16 +86,17 @@ function gmedia_default_options(){
83
  $gm['taxonomies']['gmedia_gallery'] = array(); // not linked with gmedia_term_relationships table
84
  $gm['taxonomies']['gmedia_module'] = array(); // not linked with gmedia_term_relationships table
85
 
86
- $gm['gm_screen_options']['per_page_sort_gmedia'] = 60;
87
-
88
- $gm['gm_screen_options']['per_page_gmedia'] = 30;
89
- $gm['gm_screen_options']['orderby_gmedia'] = 'ID';
90
- $gm['gm_screen_options']['sortorder_gmedia'] = 'DESC';
91
- $gm['gm_screen_options']['display_mode_gmedia'] = 'list';
92
- $gm['gm_screen_options']['grid_cell_fit_gmedia'] = false;
93
  $gm['gm_screen_options']['display_mode_gmedia_frame'] = 'grid';
94
  $gm['gm_screen_options']['grid_cell_fit_gmedia_frame'] = false;
95
 
 
 
 
96
  $gm['gm_screen_options']['per_page_gmedia_album'] = 30;
97
  $gm['gm_screen_options']['orderby_gmedia_album'] = 'name';
98
  $gm['gm_screen_options']['sortorder_gmedia_album'] = 'ASC';
@@ -118,7 +122,7 @@ function gmedia_default_options(){
118
  $gm['gm_screen_options']['uploader_chunk_size'] = 8; // in Mb
119
  $gm['gm_screen_options']['uploader_urlstream_upload'] = 'false';
120
 
121
- $gm['gm_screen_options']['library_edit_quicktags'] = 'false';
122
 
123
  return $gm;
124
 
20
  $gm['site_description'] = '';
21
  $gm['mobile_app'] = 0;
22
 
23
+ $gm['modules_update'] = 0;
24
+
25
  $gm['gmedia_post_slug'] = 'gmedia';
26
  $gm['gmedia_exclude_from_search'] = '0';
27
  $gm['gmedia_has_archive'] = '1';
40
 
41
  $gm['uninstall_dropdata'] = 'none'; // can be 'all', 'none', 'db'
42
 
43
+ $gm['name2title_capitalize'] = '1';
44
  $gm['in_tag_orderby'] = 'ID';
45
  $gm['in_tag_order'] = 'DESC';
46
  $gm['in_category_orderby'] = 'ID';
50
  $gm['in_album_status'] = 'publish';
51
  $gm['default_gmedia_module'] = 'phantom';
52
 
53
+ $gm['isolation_mode'] = '1';
54
  $gm['shortcode_raw'] = '0';
55
  $gm['debug_mode'] = WP_DEBUG? '1' : '';
56
 
86
  $gm['taxonomies']['gmedia_gallery'] = array(); // not linked with gmedia_term_relationships table
87
  $gm['taxonomies']['gmedia_module'] = array(); // not linked with gmedia_term_relationships table
88
 
89
+ $gm['gm_screen_options']['per_page_gmedia'] = 30;
90
+ $gm['gm_screen_options']['orderby_gmedia'] = 'ID';
91
+ $gm['gm_screen_options']['sortorder_gmedia'] = 'DESC';
92
+ $gm['gm_screen_options']['display_mode_gmedia'] = 'grid';
93
+ $gm['gm_screen_options']['grid_cell_fit_gmedia'] = false;
 
 
94
  $gm['gm_screen_options']['display_mode_gmedia_frame'] = 'grid';
95
  $gm['gm_screen_options']['grid_cell_fit_gmedia_frame'] = false;
96
 
97
+ $gm['gm_screen_options']['per_page_gmedia_album_edit'] = 60;
98
+ $gm['gm_screen_options']['per_page_gmedia_category_edit'] = 60;
99
+
100
  $gm['gm_screen_options']['per_page_gmedia_album'] = 30;
101
  $gm['gm_screen_options']['orderby_gmedia_album'] = 'name';
102
  $gm['gm_screen_options']['sortorder_gmedia_album'] = 'ASC';
122
  $gm['gm_screen_options']['uploader_chunk_size'] = 8; // in Mb
123
  $gm['gm_screen_options']['uploader_urlstream_upload'] = 'false';
124
 
125
+ $gm['gm_screen_options']['library_edit_quicktags'] = 'true';
126
 
127
  return $gm;
128
 
config/update.php CHANGED
@@ -855,6 +855,14 @@ function gmedia_quite_update(){
855
  $default_options['purchase_key'] = $options['license_key'];
856
  }
857
 
 
 
 
 
 
 
 
 
858
  $new_options = $gmCore->array_diff_key_recursive($default_options, $options);
859
  $gmGallery->options = $gmCore->array_replace_recursive($options, $new_options);
860
  update_option('gmediaOptions', $gmGallery->options);
855
  $default_options['purchase_key'] = $options['license_key'];
856
  }
857
 
858
+ if(version_compare($current_version, '1.8.85', '<')){
859
+ foreach($_COOKIE as $key => $value){
860
+ if('gmuser' === substr($key, 0, 6)){
861
+ setcookie($key, '', time() - 3600);
862
+ }
863
+ }
864
+ }
865
+
866
  $new_options = $gmCore->array_diff_key_recursive($default_options, $options);
867
  $gmGallery->options = $gmCore->array_replace_recursive($options, $new_options);
868
  update_option('gmediaOptions', $gmGallery->options);
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.80
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.80';
46
  var $dbversion = '1.8.0';
47
  var $minium_WP = '3.6';
48
  var $options = '';
@@ -102,13 +102,18 @@ if(!class_exists('Gmedia')){
102
  add_action('deleted_user', array(&$this, 'reassign_media'), 10, 2);
103
 
104
  add_action('init', array(&$this, 'gmedia_post_type'), 0);
 
 
 
 
105
 
106
  add_action('gmedia_app_cronjob', array(&$this, 'gmedia_app_cronjob'));
 
107
 
108
  //Add some message on the plugins page
109
  //add_action( 'after_plugin_row', array(&$this, 'check_message_version') );
110
  //Add some links on the plugins page
111
- //add_filter( 'plugin_row_meta', array( &$this, 'add_plugin_links' ), 10, 2 );
112
 
113
  }
114
 
@@ -124,6 +129,7 @@ if(!class_exists('Gmedia')){
124
  $this->upgrade();
125
 
126
  require_once(dirname(__FILE__) . '/inc/hashids.php');
 
127
  require_once(dirname(__FILE__) . '/inc/shortcodes.php');
128
 
129
  // Load the admin panel or the frontend functions
@@ -331,8 +337,8 @@ if(!class_exists('Gmedia')){
331
  'plugin_dirurl' => $gmCore->gmedia_url
332
  ));
333
 
334
- wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/assets/css/gmedia.admin.css', array(), '1.8.80', 'all');
335
- wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/assets/js/gmedia.admin.js', array('jquery', 'gmedia-global-backend'), '1.8.80');
336
  wp_localize_script('grand-media', 'grandMedia', array('error3' => __('Disable your Popup Blocker and try again.', 'grand-media'),
337
  'download' => __('downloading...', 'grand-media'),
338
  'wait' => __('Working. Wait please.', 'grand-media'),
@@ -368,6 +374,13 @@ if(!class_exists('Gmedia')){
368
  wp_register_script('wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array('jquery'), '1.1.5', true);
369
  }
370
 
 
 
 
 
 
 
 
371
  if(!wp_script_is('magnific-popup', 'registered') || version_compare($wp_scripts->registered['magnific-popup']->ver, '1.0.2', '<')){
372
  wp_deregister_style('magnific-popup');
373
  wp_deregister_script('magnific-popup');
@@ -516,11 +529,6 @@ if(!class_exists('Gmedia')){
516
  $this->network_propagate('gmedia_deactivate', $networkwide);
517
  }
518
 
519
- function gmedia_app_cronjob(){
520
- global $gmCore;
521
- $gmCore->app_service('app_updatecron');
522
- }
523
-
524
  /*
525
  static function uninstall($networkwide) {
526
  //wp_die( '<h1>This is run on <code>init</code> during uninstallation</h1>', 'Uninstallation hook example' );
@@ -575,6 +583,7 @@ if(!class_exists('Gmedia')){
575
  register_post_type('gmedia', $args);
576
 
577
  $args['label'] = __('Gmedia Albums', 'grand-media');
 
578
  $args['hierarchical'] = true;
579
  $args['has_archive'] = (bool)$this->options['gmedia_album_has_archive'];
580
  $args['exclude_from_search'] = (bool)$this->options['gmedia_album_exclude_from_search'];
@@ -582,7 +591,6 @@ if(!class_exists('Gmedia')){
582
  register_post_type('gmedia_album', $args);
583
 
584
  $args['label'] = __('Gmedia Galleries', 'grand-media');
585
- $args['show_in_nav_menus'] = true;
586
  $args['has_archive'] = (bool)$this->options['gmedia_gallery_has_archive'];
587
  $args['exclude_from_search'] = (bool)$this->options['gmedia_gallery_exclude_from_search'];
588
  $args['rewrite'] = array('slug' => $this->options['gmedia_gallery_post_slug']);
@@ -612,6 +620,7 @@ if(!class_exists('Gmedia')){
612
  );
613
  register_taxonomy('gmedia_tag', array('gmedia'), $args);
614
 
 
615
  }
616
 
617
  /**
@@ -641,9 +650,9 @@ if(!class_exists('Gmedia')){
641
  $term = $gmDB->get_term($term_id);
642
  if($term){
643
  if($term->taxonomy == 'gmedia_album'){
644
- $link = admin_url("admin.php?page=GrandMedia_Albums&edit_item={$term->term_id}");
645
  } elseif($term->taxonomy == 'gmedia_gallery'){
646
- $link = admin_url("admin.php?page=GrandMedia_Galleries&edit_item={$term->term_id}");
647
  }
648
  } else{
649
  wp_delete_post($post->ID, true);
@@ -655,15 +664,56 @@ if(!class_exists('Gmedia')){
655
  return $link;
656
  }
657
 
 
 
 
 
 
658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  function gmedia_cron_schedules($shedules){
660
- $gmedia_shedules = array('gmedia_app' => array('interval' => 5 * DAY_IN_SECONDS, 'display' => __('Gmedia App Defined'))
661
- );
662
  $shedules = array_merge($shedules, $gmedia_shedules);
663
 
664
  return $shedules;
665
  }
666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  /*
668
  // PLUGIN MESSAGE ON PLUGINS PAGE
669
  function check_message_version($file)
@@ -691,18 +741,18 @@ if(!class_exists('Gmedia')){
691
  }
692
  }
693
  }
 
694
 
695
- function add_plugin_links( $links, $file ) {
696
- // TODO plugin links
697
- if ( $file == plugin_basename( __FILE__ ) ) {
698
- $links[] = '<a href="admin.php?page=GrandMedia">' . __( 'Overview', 'grand-media' ) . '</a>';
699
- $links[] = '<a href="#">' . __( 'Get help', 'grand-media' ) . '</a>';
700
- $links[] = '<a href="#">' . __( 'Contribute', 'grand-media' ) . '</a>';
701
- $links[] = '<a href="#">' . __( 'Donate', 'grand-media' ) . '</a>';
702
  }
 
703
  return $links;
704
  }
705
- */
706
 
707
  }
708
 
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.94
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.94';
46
  var $dbversion = '1.8.0';
47
  var $minium_WP = '3.6';
48
  var $options = '';
102
  add_action('deleted_user', array(&$this, 'reassign_media'), 10, 2);
103
 
104
  add_action('init', array(&$this, 'gmedia_post_type'), 0);
105
+ add_action('init', array(&$this, 'gm_schedule_update_checks'), 0);
106
+
107
+ // register widget
108
+ add_action('widgets_init', array(&$this, 'register_gmedia_widget'));
109
 
110
  add_action('gmedia_app_cronjob', array(&$this, 'gmedia_app_cronjob'));
111
+ add_action('gmedia_modules_update', array(&$this, 'gmedia_modules_update'));
112
 
113
  //Add some message on the plugins page
114
  //add_action( 'after_plugin_row', array(&$this, 'check_message_version') );
115
  //Add some links on the plugins page
116
+ add_filter('plugin_row_meta', array(&$this, 'add_plugin_links'), 10, 2);
117
 
118
  }
119
 
129
  $this->upgrade();
130
 
131
  require_once(dirname(__FILE__) . '/inc/hashids.php');
132
+ require_once(dirname(__FILE__) . '/inc/functions.php');
133
  require_once(dirname(__FILE__) . '/inc/shortcodes.php');
134
 
135
  // Load the admin panel or the frontend functions
337
  'plugin_dirurl' => $gmCore->gmedia_url
338
  ));
339
 
340
+ wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/assets/css/gmedia.admin.css', array(), '1.8.92', 'all');
341
+ wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/assets/js/gmedia.admin.js', array('jquery', 'gmedia-global-backend'), '1.8.92');
342
  wp_localize_script('grand-media', 'grandMedia', array('error3' => __('Disable your Popup Blocker and try again.', 'grand-media'),
343
  'download' => __('downloading...', 'grand-media'),
344
  'wait' => __('Working. Wait please.', 'grand-media'),
374
  wp_register_script('wavesurfer', $gmCore->gmedia_url . '/assets/wavesurfer/wavesurfer.min.js', array('jquery'), '1.1.5', true);
375
  }
376
 
377
+ if(!wp_script_is('swiper', 'registered') || version_compare($wp_scripts->registered['swiper']->ver, '3.4.0', '<')){
378
+ wp_deregister_style('swiper');
379
+ wp_deregister_script('swiper');
380
+ wp_register_style('swiper', $gmCore->gmedia_url . '/assets/swiper/swiper.min.css', array(), '3.4.0', 'screen');
381
+ wp_register_script('swiper', $gmCore->gmedia_url . '/assets/swiper/swiper.jquery.min.js', array('jquery'), '3.4.0', true);
382
+ }
383
+
384
  if(!wp_script_is('magnific-popup', 'registered') || version_compare($wp_scripts->registered['magnific-popup']->ver, '1.0.2', '<')){
385
  wp_deregister_style('magnific-popup');
386
  wp_deregister_script('magnific-popup');
529
  $this->network_propagate('gmedia_deactivate', $networkwide);
530
  }
531
 
 
 
 
 
 
532
  /*
533
  static function uninstall($networkwide) {
534
  //wp_die( '<h1>This is run on <code>init</code> during uninstallation</h1>', 'Uninstallation hook example' );
583
  register_post_type('gmedia', $args);
584
 
585
  $args['label'] = __('Gmedia Albums', 'grand-media');
586
+ $args['show_in_nav_menus'] = true;
587
  $args['hierarchical'] = true;
588
  $args['has_archive'] = (bool)$this->options['gmedia_album_has_archive'];
589
  $args['exclude_from_search'] = (bool)$this->options['gmedia_album_exclude_from_search'];
591
  register_post_type('gmedia_album', $args);
592
 
593
  $args['label'] = __('Gmedia Galleries', 'grand-media');
 
594
  $args['has_archive'] = (bool)$this->options['gmedia_gallery_has_archive'];
595
  $args['exclude_from_search'] = (bool)$this->options['gmedia_gallery_exclude_from_search'];
596
  $args['rewrite'] = array('slug' => $this->options['gmedia_gallery_post_slug']);
620
  );
621
  register_taxonomy('gmedia_tag', array('gmedia'), $args);
622
 
623
+ add_filter('wp_link_query_args', array($this, 'exclude_gmedia_from_link_query'));
624
  }
625
 
626
  /**
650
  $term = $gmDB->get_term($term_id);
651
  if($term){
652
  if($term->taxonomy == 'gmedia_album'){
653
+ $link = admin_url("admin.php?page=GrandMedia_Albums&edit_term={$term->term_id}");
654
  } elseif($term->taxonomy == 'gmedia_gallery'){
655
+ $link = admin_url("admin.php?page=GrandMedia_Galleries&edit_term={$term->term_id}");
656
  }
657
  } else{
658
  wp_delete_post($post->ID, true);
664
  return $link;
665
  }
666
 
667
+ function register_gmedia_widget(){
668
+ require_once(dirname(__FILE__) . '/inc/widget.php');
669
+ register_widget('GrandMedia_Gallery_Widget');
670
+ register_widget('GrandMedia_Album_Widget');
671
+ }
672
 
673
+ /**
674
+ * @param $query
675
+ *
676
+ * @return mixed
677
+ */
678
+ function exclude_gmedia_from_link_query($query){
679
+ if(($key = array_search('gmedia', $query['post_type'])) !== false){
680
+ unset($query['post_type'][ $key ]);
681
+ }
682
+
683
+ return $query;
684
+ }
685
+
686
+ /**
687
+ * @param $shedules
688
+ *
689
+ * @return array
690
+ */
691
  function gmedia_cron_schedules($shedules){
692
+ $gmedia_shedules = array('gmedia_app' => array('interval' => 5 * DAY_IN_SECONDS, 'display' => __('Gmedia App Defined')));
 
693
  $shedules = array_merge($shedules, $gmedia_shedules);
694
 
695
  return $shedules;
696
  }
697
 
698
+ function gm_schedule_update_checks(){
699
+ $wp_installing = (bool)(defined( 'WP_INSTALLING' ) && WP_INSTALLING);
700
+
701
+ if(!wp_next_scheduled('gmedia_modules_update') && !$wp_installing){
702
+ wp_schedule_event(time(), 'daily', 'gmedia_modules_update');
703
+ }
704
+ }
705
+
706
+ function gmedia_app_cronjob(){
707
+ global $gmCore;
708
+ $gmCore->app_service('app_updatecron');
709
+ }
710
+
711
+ function gmedia_modules_update(){
712
+ global $gmCore;
713
+ $gmCore->modules_update();
714
+ }
715
+
716
+
717
  /*
718
  // PLUGIN MESSAGE ON PLUGINS PAGE
719
  function check_message_version($file)
741
  }
742
  }
743
  }
744
+ */
745
 
746
+ function add_plugin_links($links, $file){
747
+ if($file == plugin_basename(__FILE__)){
748
+ $links[] = '<a href="admin.php?page=GrandMedia_Settings">' . __('Settings', 'grand-media') . '</a>';
749
+ $links[] = '<a href="admin.php?page=GrandMedia_Modules">' . __('Modules', 'grand-media') . '</a>';
750
+ $links[] = '<a href="http://codeasily.com/product/one-site-license/">' . __('Get Premium', 'grand-media') . '</a>';
751
+ $links[] = '<a href="http://codeasily.com/donate/">' . __('Donate', 'grand-media') . '</a>';
 
752
  }
753
+
754
  return $links;
755
  }
 
756
 
757
  }
758
 
inc/core.php CHANGED
@@ -34,6 +34,8 @@ class GmediaCore{
34
  add_action('edited_gmedia_term', array(&$this, 'clear_cache'));
35
  add_action('deleted_gmedia_term', array(&$this, 'clear_cache'));
36
  // add_action( 'gmedia_clean_object_term_cache', array( &$this, 'clear_cache' ) );
 
 
37
  }
38
 
39
  function user_capabilities(){
@@ -145,7 +147,7 @@ class GmediaCore{
145
  $uri = admin_url('admin.php');
146
  }
147
  $remove_args = empty($remove_args)? array() : (array)$remove_args;
148
- $remove_args = array_unique(array_merge(array('doing_wp_cron', '_wpnonce', 'delete', 'duplicate', 'update_meta', 'recreate'), $remove_args, array_keys($add_args)));
149
  $new_uri = remove_query_arg($remove_args, $uri);
150
  if(!empty($preserve_args)){
151
  $_add_args = array();
@@ -159,6 +161,7 @@ class GmediaCore{
159
  if(!empty($add_args)){
160
  $new_uri = add_query_arg($add_args, $new_uri);
161
  }
 
162
  return esc_url_raw($new_uri);
163
  }
164
 
@@ -388,7 +391,10 @@ class GmediaCore{
388
  $fileinfo['basename_original'] = $pathinfo['filename'] . '.' . $fileinfo['extension'];
389
  $fileinfo['filename'] = $pathinfo['filename'] . $suffix;
390
  $fileinfo['basename'] = $fileinfo['filename'] . '.' . $fileinfo['extension'];
391
- $fileinfo['title'] = ucwords(str_replace('_', ' ', esc_sql($title)));
 
 
 
392
  $fileinfo['mime_type'] = (empty($filetype['type']))? 'application/' . $fileinfo['extension'] : $filetype['type'];
393
  list($dirname) = explode('/', $fileinfo['mime_type']);
394
  $fileinfo['dirname'] = $dirname;
@@ -2217,16 +2223,23 @@ class GmediaCore{
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();
@@ -2562,9 +2575,9 @@ class GmediaCore{
2562
 
2563
  }
2564
 
2565
- echo '<p><b>' . __('Category') . ':</b> ' . ((isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category']))? esc_html(str_replace(',', ', ', $_terms['gmedia_category'])) : '-') . PHP_EOL;
2566
- 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;
2567
- echo '<br /><b>' . __('Tags') . ':</b> ' . ((isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag']))? esc_html(str_replace(',', ', ', $_terms['gmedia_tag'])) : '-') . '</p>' . PHP_EOL;
2568
 
2569
  wp_ob_end_flush_all();
2570
  flush();
@@ -2938,6 +2951,37 @@ class GmediaCore{
2938
  return $result;
2939
  }
2940
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2941
  /**
2942
  * @param $key
2943
  *
@@ -3045,7 +3089,7 @@ class GmediaCore{
3045
  <?php if(!empty($metadata)){
3046
  //$count = 0;
3047
  foreach($metadata as $entry){
3048
- echo $this->_list_meta_item($entry);
3049
  }
3050
  } ?>
3051
  </div>
@@ -3058,11 +3102,12 @@ class GmediaCore{
3058
  /**
3059
  * @since 1.6.3
3060
  *
3061
- * @param $entry
 
3062
  *
3063
  * @return string|void
3064
  */
3065
- function _list_meta_item($entry){
3066
  if(is_serialized($entry['meta_value'])){
3067
  if(is_serialized_string($entry['meta_value'])){
3068
  // This is a serialized string, so we should display it.
@@ -3077,9 +3122,10 @@ class GmediaCore{
3077
  $entry['meta_value'] = esc_textarea($entry['meta_value']); // using a <textarea />
3078
  $entry['meta_id'] = (int)$entry['meta_id'];
3079
 
 
3080
  //$delete_nonce = wp_create_nonce( 'gmedia_custom_field', '_customfield_nonce' );
3081
  $item = '
3082
- <div class="form-group col-sm-6 gm-custom-meta-' . $entry['meta_id'] . '">
3083
  <span class="delete-custom-field glyphicon glyphicon-remove pull-right text-danger"></span>
3084
  <label>' . $entry['meta_key'] . '</label>
3085
  <textarea name="meta[' . $entry['meta_id'] . ']" class="gmedia-custom-field gm-custom-field-' . $entry['meta_id'] . ' vert form-control input-sm" style="height:30px;" placeholder="' . __('Value', 'grand-media') . '" rows="1" cols="30">' . $entry['meta_value'] . '</textarea>
@@ -3551,6 +3597,40 @@ class GmediaCore{
3551
  }
3552
  }
3553
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3554
  /**
3555
  * Converts IDN in given url address to its ASCII form, also known as punycode, if possible.
3556
  * This function silently returns unmodified address if:
34
  add_action('edited_gmedia_term', array(&$this, 'clear_cache'));
35
  add_action('deleted_gmedia_term', array(&$this, 'clear_cache'));
36
  // add_action( 'gmedia_clean_object_term_cache', array( &$this, 'clear_cache' ) );
37
+
38
+ add_filter('get_the_gmedia_terms', array(&$this, 'get_the_gmedia_terms'), 10, 3);
39
  }
40
 
41
  function user_capabilities(){
147
  $uri = admin_url('admin.php');
148
  }
149
  $remove_args = empty($remove_args)? array() : (array)$remove_args;
150
+ $remove_args = array_unique(array_merge(array('doing_wp_cron', '_wpnonce', 'do_gmedia', 'did_gmedia', 'do_gmedia_terms', 'did_gmedia_terms', 'ids'), $remove_args, array_keys($add_args)));
151
  $new_uri = remove_query_arg($remove_args, $uri);
152
  if(!empty($preserve_args)){
153
  $_add_args = array();
161
  if(!empty($add_args)){
162
  $new_uri = add_query_arg($add_args, $new_uri);
163
  }
164
+
165
  return esc_url_raw($new_uri);
166
  }
167
 
391
  $fileinfo['basename_original'] = $pathinfo['filename'] . '.' . $fileinfo['extension'];
392
  $fileinfo['filename'] = $pathinfo['filename'] . $suffix;
393
  $fileinfo['basename'] = $fileinfo['filename'] . '.' . $fileinfo['extension'];
394
+ $fileinfo['title'] = str_replace('_', ' ', esc_sql($title));
395
+ if((int)$gmGallery->options['name2title_capitalize']){
396
+ $fileinfo['title'] = mb_convert_case($fileinfo['title'], MB_CASE_TITLE, 'UTF-8');
397
+ }
398
  $fileinfo['mime_type'] = (empty($filetype['type']))? 'application/' . $fileinfo['extension'] : $filetype['type'];
399
  list($dirname) = explode('/', $fileinfo['mime_type']);
400
  $fileinfo['dirname'] = $dirname;
2223
  $_status = 'publish';
2224
  }
2225
 
2226
+ if(isset($_terms['gmedia_album']) && !empty($_terms['gmedia_album'])){
2227
+ if(is_array($_terms['gmedia_album'])){
2228
+ $_terms['gmedia_album'] = trim(reset($_terms['gmedia_album']));
2229
+ }
2230
+ } else {
2231
+ $_terms['gmedia_album'] = '';
2232
+ }
2233
  if(isset($_terms['gmedia_category']) && !empty($_terms['gmedia_category'])){
2234
  if(!is_array($_terms['gmedia_category'])){
2235
+ $_terms['gmedia_category'] = array_filter(array_map('trim', explode(',', $_terms['gmedia_category'])));
2236
  }
2237
  } else{
2238
  $_terms['gmedia_category'] = array();
2239
  }
2240
  if(isset($_terms['gmedia_tag']) && !empty($_terms['gmedia_tag'])){
2241
  if(!is_array($_terms['gmedia_tag'])){
2242
+ $_terms['gmedia_tag'] = array_filter(array_map('trim', explode(',', $_terms['gmedia_tag'])));
2243
  }
2244
  } else{
2245
  $_terms['gmedia_tag'] = array();
2575
 
2576
  }
2577
 
2578
+ echo '<p><b>' . __('Category') . ':</b> ' . (!empty($_terms['gmedia_category'])? esc_html(implode(', ', $_terms['gmedia_category'])) : '-') . PHP_EOL;
2579
+ echo '<br /><b>' . __('Album') . ':</b> ' . (!empty($_terms['gmedia_album'])? (isset($album_name)? $album_name : esc_html($_terms['gmedia_album'])) : '-') . PHP_EOL;
2580
+ echo '<br /><b>' . __('Tags') . ':</b> ' . (!empty($_terms['gmedia_tag'])? esc_html(implode(', ', $_terms['gmedia_tag'])) : '-') . '</p>' . PHP_EOL;
2581
 
2582
  wp_ob_end_flush_all();
2583
  flush();
2951
  return $result;
2952
  }
2953
 
2954
+ /**
2955
+ * @param null $modules
2956
+ */
2957
+ function modules_update($modules = null){
2958
+ $wp_installing = (bool)(defined( 'WP_INSTALLING' ) && WP_INSTALLING);
2959
+ if ( $wp_installing ) {
2960
+ return;
2961
+ }
2962
+
2963
+ if(!is_array($modules)){
2964
+ $modules = get_gmedia_modules();
2965
+ }
2966
+ if(isset($modules['error'])){
2967
+ return;
2968
+ }
2969
+
2970
+ global $gmGallery;
2971
+ $modules_update_count = 0;
2972
+
2973
+ foreach($modules['in'] as $module){
2974
+ if(!empty($module['update']) && 'remote' != $module['place']){
2975
+ $modules_update_count++;
2976
+ }
2977
+ }
2978
+
2979
+ $gmGallery->options = get_option('gmediaOptions');
2980
+ $gmGallery->options['modules_update'] = $modules_update_count;
2981
+
2982
+ update_option('gmediaOptions', $gmGallery->options);
2983
+ }
2984
+
2985
  /**
2986
  * @param $key
2987
  *
3089
  <?php if(!empty($metadata)){
3090
  //$count = 0;
3091
  foreach($metadata as $entry){
3092
+ echo $this->_list_meta_item($entry, $meta_type);
3093
  }
3094
  } ?>
3095
  </div>
3102
  /**
3103
  * @since 1.6.3
3104
  *
3105
+ * @param $entry
3106
+ * @param string $meta_type
3107
  *
3108
  * @return string|void
3109
  */
3110
+ function _list_meta_item($entry, $meta_type = 'gmedia'){
3111
  if(is_serialized($entry['meta_value'])){
3112
  if(is_serialized_string($entry['meta_value'])){
3113
  // This is a serialized string, so we should display it.
3122
  $entry['meta_value'] = esc_textarea($entry['meta_value']); // using a <textarea />
3123
  $entry['meta_id'] = (int)$entry['meta_id'];
3124
 
3125
+ $colsm = ('gmedia' == $meta_type)? 6 : 4;
3126
  //$delete_nonce = wp_create_nonce( 'gmedia_custom_field', '_customfield_nonce' );
3127
  $item = '
3128
+ <div class="form-group col-sm-' . $colsm . ' gm-custom-meta-' . $entry['meta_id'] . '">
3129
  <span class="delete-custom-field glyphicon glyphicon-remove pull-right text-danger"></span>
3130
  <label>' . $entry['meta_key'] . '</label>
3131
  <textarea name="meta[' . $entry['meta_id'] . ']" class="gmedia-custom-field gm-custom-field-' . $entry['meta_id'] . ' vert form-control input-sm" style="height:30px;" placeholder="' . __('Value', 'grand-media') . '" rows="1" cols="30">' . $entry['meta_value'] . '</textarea>
3597
  }
3598
  }
3599
 
3600
+ /**
3601
+ * Filter the gmedia terms (private and draft) for frontend and admin panel
3602
+ *
3603
+ * @param $terms
3604
+ * @param $gmedia_id
3605
+ * @param $taxonomy
3606
+ */
3607
+ function get_the_gmedia_terms($terms, $gmedia_id, $taxonomy){
3608
+ if('gmedia_album' === $taxonomy){
3609
+ if(!is_user_logged_in()){
3610
+ foreach($terms as $key => $term){
3611
+ if('publish' !== $term->status){
3612
+ unset($terms[ $key ]);
3613
+ }
3614
+ }
3615
+ } else {
3616
+ global $user_ID;
3617
+ foreach($terms as $key => $term){
3618
+ if('draft' === $term->status){
3619
+ if(!is_admin() || ($user_ID != $term->global && !gm_user_can('edit_others_media'))){
3620
+ unset($terms[ $key ]);
3621
+ }
3622
+ } elseif('private' === $term->status){
3623
+ if($user_ID != $term->global && !gm_user_can('show_others_media')){
3624
+ unset($terms[ $key ]);
3625
+ }
3626
+ }
3627
+ }
3628
+ }
3629
+ }
3630
+
3631
+ return $terms;
3632
+ }
3633
+
3634
  /**
3635
  * Converts IDN in given url address to its ASCII form, also known as punycode, if possible.
3636
  * This function silently returns unmodified address if:
inc/db.connect.php CHANGED
@@ -2,12 +2,12 @@
2
 
3
  /**
4
  * Gmedia Database Class
5
-
6
  */
7
  class GmediaDB{
8
 
9
  var $query; // User passed query
10
- var $filter = false; // is there filter for get_gmedias()
 
11
  var $filter_tax = array(); // is there filter by taxonomy for get_gmedias()
12
  var $resultLimited = 0; // Total records for limited query (with offset)
13
  var $resultPerPage = 0; // Total records in each pages
@@ -15,6 +15,7 @@ class GmediaDB{
15
  var $trueTotalResult = 0; // Total records in DB without limit
16
  var $totalResult = 0; // Total records in DB
17
  var $pages = 0; // Total number of pages required
 
18
  var $openPage = 0; // currently opened page
19
  var $clauses; // query clauses
20
  var $gmedia; // first gmedia object
@@ -48,9 +49,9 @@ class GmediaDB{
48
  if($selected){
49
  $sel_ids = wp_parse_id_list($selected);
50
  } else{
51
- $ckey = "gmuser_{$user_ID}_wpmedia";
52
  if(isset($_COOKIE[ $ckey ])){
53
- $sel_ids = array_filter(explode(',', $_COOKIE[ $ckey ]), 'is_numeric');
54
  }
55
  }
56
  switch($mime_type){
@@ -67,6 +68,9 @@ class GmediaDB{
67
  $and .= " AND post_mime_type NOT REGEXP 'image|audio|video'";
68
  break;
69
  }
 
 
 
70
  // If a search pattern is specified, load the posts that match
71
  if(!empty($s)){
72
  // added slashes screw with quote grouping when done early, so done later
@@ -91,7 +95,8 @@ class GmediaDB{
91
  }
92
 
93
  if(!empty($search)){
94
- $search = " AND ({$search}) ";
 
95
  }
96
  }
97
  if($orderby){
@@ -129,6 +134,7 @@ class GmediaDB{
129
  case 'selected':
130
  if(count($sel_ids)){
131
  $and .= ' AND ID IN (' . join(', ', $sel_ids) . ')';
 
132
  break;
133
  } else{
134
  $and .= ' AND ID = 0';
@@ -145,7 +151,8 @@ class GmediaDB{
145
  $offset = ($this->openPage - 1) * $limit;
146
  $lim = " LIMIT {$offset}, {$limit}";
147
  }
148
- $this->query = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE post_type = 'attachment' {$and} {$search} GROUP BY ID {$ord} {$lim}");
 
149
  $this->totalResult = (int)$wpdb->get_var("SELECT FOUND_ROWS()");
150
  if((1 > $limit) || (0 == $this->totalResult)){
151
  $limit = $this->totalResult;
@@ -160,12 +167,10 @@ class GmediaDB{
160
  $offset = ($this->openPage - 1) * $limit;
161
  $lim = " LIMIT {$offset}, {$limit}";
162
  }
163
- $this->query = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE post_type = 'attachment' {$and} {$search} GROUP BY ID {$ord} {$lim}");
 
164
  }
165
  $this->resultPerPage = count($this->query);
166
- if(!(empty($search) && empty($and))){
167
- $this->filter = true;
168
- }
169
 
170
  return $this->query;
171
  }
@@ -187,8 +192,8 @@ class GmediaDB{
187
  $search = '';
188
  if(isset($selected)){
189
  $sel_ids = wp_parse_id_list($selected);
190
- } elseif(isset($_COOKIE["gmuser_{$user_ID}_wpmedia"])){
191
- $sel_ids = array_filter(explode(',', $_COOKIE["gmuser_{$user_ID}_wpmedia"]), 'is_numeric');
192
  } else{
193
  $sel_ids = array();
194
  }
@@ -302,7 +307,7 @@ class GmediaDB{
302
  return '';
303
  }
304
  $params = $_GET;
305
- unset($params['pager'], $params['recreate'], $params['_wpnonce'], $params['update_meta'], $params['delete'], $params['duplicate'], $params['doing_wp_cron']);
306
  $new_query_string = http_build_query($params);
307
  //$self = admin_url( 'admin.php?' . $new_query_string );
308
  $self = '?' . $new_query_string;
@@ -966,8 +971,8 @@ class GmediaDB{
966
  default:
967
  $fields = "{$wpdb->prefix}gmedia.*";
968
  $fields .= ", wp.ID as post_id, wp.post_name, wp.post_password, wp.comment_status, wp.comment_count";
969
- $join .= " LEFT JOIN {$wpdb->posts} AS wp ON ({$wpdb->prefix}gmedia.post_id = wp.ID)";
970
  }
 
971
 
972
  // If a month is specified in the querystring, load that month
973
  if($q['m']){
@@ -988,73 +993,100 @@ class GmediaDB{
988
  if(strlen($q['m']) > 13){
989
  $where .= " AND SECOND({$wpdb->prefix}gmedia.date)=" . substr($q['m'], 12, 2);
990
  }
 
991
  }
992
 
993
  if('' !== $q['hour']){
994
  $where .= " AND HOUR({$wpdb->prefix}gmedia.date)='" . $q['hour'] . "'";
 
995
  }
996
 
997
  if('' !== $q['minute']){
998
  $where .= " AND MINUTE({$wpdb->prefix}gmedia.date)='" . $q['minute'] . "'";
 
999
  }
1000
 
1001
  if('' !== $q['second']){
1002
  $where .= " AND SECOND({$wpdb->prefix}gmedia.date)='" . $q['second'] . "'";
 
1003
  }
1004
 
1005
  if($q['year']){
1006
  $where .= " AND YEAR({$wpdb->prefix}gmedia.date)='" . $q['year'] . "'";
 
1007
  }
1008
 
1009
  if($q['monthnum']){
1010
  $where .= " AND MONTH({$wpdb->prefix}gmedia.date)='" . $q['monthnum'] . "'";
 
1011
  }
1012
 
1013
  if($q['day']){
1014
  $where .= " AND DAYOFMONTH({$wpdb->prefix}gmedia.date)='" . $q['day'] . "'";
 
 
 
 
 
 
1015
  }
1016
 
1017
  if('' != $q['name']){
1018
  $q['name'] = esc_sql($q['name']);
1019
  $where .= " AND {$wpdb->prefix}gmedia.title = '" . $q['name'] . "'";
1020
- }
1021
-
1022
- if($q['w']){
1023
- $where .= ' AND ' . _wp_mysql_week("`{$wpdb->prefix}gmedia`.`date`") . " = '" . $q['w'] . "'";
1024
  }
1025
 
1026
  // If a gmedia number is specified, load that gmedia
1027
  if($q['gmedia_id']){
1028
  $where .= " AND {$wpdb->prefix}gmedia.ID = " . $q['gmedia_id'];
 
1029
  } elseif($q['gmedia__in']){
1030
  if(!is_array($q['gmedia__in'])){
1031
  $q['gmedia__in'] = explode(',', $q['gmedia__in']);
1032
  }
1033
- $gmedia__in = implode(',', array_filter(array_map('absint', $q['gmedia__in'])));
1034
- $where .= " AND {$wpdb->prefix}gmedia.ID IN ($gmedia__in)";
 
 
 
 
1035
  } elseif($q['gmedia__not_in']){
1036
  if(!is_array($q['gmedia__not_in'])){
1037
  $q['gmedia__not_in'] = explode(',', $q['gmedia__not_in']);
1038
  }
1039
- $gmedia__not_in = implode(',', array_filter(array_map('absint', $q['gmedia__not_in'])));
1040
- $where .= " AND {$wpdb->prefix}gmedia.ID NOT IN ($gmedia__not_in)";
 
 
 
 
1041
  }
1042
 
1043
  // If a linked wp post number is specified, load that gmedia
1044
  if($q['wppost_id']){
1045
  $where .= " AND {$wpdb->prefix}gmedia.post_id = " . $q['wppost_id'];
 
1046
  } elseif($q['wppost__in']){
1047
  if(!is_array($q['wppost__in'])){
1048
  $q['wppost__in'] = explode(',', $q['wppost__in']);
1049
  }
1050
- $wppost__in = implode(',', array_filter(array_map('absint', $q['wppost__in'])));
1051
- $where .= " AND {$wpdb->prefix}gmedia.post_id IN ($wppost__in)";
 
 
 
 
1052
  } elseif($q['wppost__not_in']){
1053
  if(!is_array($q['wppost__not_in'])){
1054
  $q['wppost__not_in'] = explode(',', $q['wppost__not_in']);
1055
  }
1056
- $wppost__not_in = implode(',', array_filter(array_map('absint', $q['wppost__not_in'])));
1057
- $where .= " AND {$wpdb->prefix}gmedia.post_id NOT IN ($wppost__not_in)";
 
 
 
 
1058
  }
1059
 
1060
  // If a search pattern is specified, load the posts that match
@@ -1080,6 +1112,7 @@ class GmediaDB{
1080
  if ( !is_user_logged_in() )
1081
  $search .= " AND ({$wpdb->prefix}gmedia_meta.password = '') ";
1082
  */
 
1083
  }
1084
  }
1085
 
@@ -1192,7 +1225,7 @@ class GmediaDB{
1192
  */
1193
  extract($query);
1194
 
1195
- $this->filter_tax[ $taxonomy ] = true;
1196
 
1197
  if('IN' == $operator){
1198
 
@@ -1200,7 +1233,8 @@ class GmediaDB{
1200
  continue;
1201
  }
1202
 
1203
- $terms = implode(',', $terms);
 
1204
 
1205
  $alias = $i? 'tr' . $i : 'tr';
1206
 
@@ -1221,7 +1255,8 @@ class GmediaDB{
1221
  continue;
1222
  }
1223
 
1224
- $terms = implode(',', $terms);
 
1225
 
1226
  $clauses['where'][] = "{$wpdb->prefix}gmedia.ID NOT IN (
1227
  SELECT gmedia_id
@@ -1236,7 +1271,8 @@ class GmediaDB{
1236
 
1237
  $num_terms = count($terms);
1238
 
1239
- $terms = implode(',', $terms);
 
1240
 
1241
  $clauses['where'][] = "(
1242
  SELECT COUNT(1)
@@ -1391,6 +1427,8 @@ class GmediaDB{
1391
 
1392
  $join .= $clauses['join'];
1393
  $where .= $clauses['where'];
 
 
1394
  }
1395
  unset($clauses);
1396
 
@@ -1400,8 +1438,10 @@ class GmediaDB{
1400
 
1401
  // Status
1402
  if($q['status']){
1403
- $q['status'] = "'" . implode("','", array_map('esc_sql', array_unique((array)$q['status']))) . "'";
1404
- $whichstatus .= " AND {$wpdb->prefix}gmedia.status IN ({$q['status']})";
 
 
1405
  }
1406
 
1407
  // Author/user stuff for ID
@@ -1416,26 +1456,35 @@ class GmediaDB{
1416
  }
1417
 
1418
  if(!empty($q['author__not_in'])){
1419
- $author__not_in = implode(',', array_map('absint', array_unique(wp_parse_id_list($q['author__not_in']))));
 
 
1420
  $whichauthor .= " AND {$wpdb->prefix}gmedia.author NOT IN ($author__not_in) ";
1421
  } elseif(!empty($q['author__in'])){
1422
- $author__in = implode(',', array_map('absint', array_unique(wp_parse_id_list($q['author__in']))));
 
 
1423
  $whichauthor .= " AND {$wpdb->prefix}gmedia.author IN ($author__in) ";
1424
  }
1425
 
1426
  // Author stuff for name
1427
  if('' != $q['author_name']){
1428
  $q['author_name'] = esc_sql($q['author_name']);
1429
- $q['author'] = get_user_by('slug', $q['author_name']);
1430
- if($q['author']){
1431
- $q['author'] = $q['author']->ID;
 
 
1432
  }
1433
- $whichauthor .= " AND ({$wpdb->prefix}gmedia.author = " . absint($q['author']) . ')';
1434
  }
1435
 
1436
  // MIME-Type stuff
1437
  if(isset($q['mime_type']) && !empty($q['mime_type'])){
1438
- $whichmimetype = $this->gmedia_mime_type_where($q['mime_type'], $wpdb->prefix . 'gmedia');
 
 
 
 
1439
  }
1440
 
1441
  $where .= $whichstatus . $search;
@@ -1448,19 +1497,24 @@ class GmediaDB{
1448
  if(empty($q['orderby']) || ('none' == $q['orderby'])){
1449
  $orderby = "{$wpdb->prefix}gmedia.ID " . $q['order'];
1450
  } else{
1451
- // Used to filter values TODO make orderby comment count
1452
- $allowed_keys = array('ID', 'author', 'date', 'title', 'filename', 'gmuid', 'modified', 'mime_type', 'gmedia__in', 'rand');
1453
  if($album['order'] && !empty($album['alias'])){
1454
  $allowed_keys[] = 'custom';
1455
  }
 
 
 
 
 
 
 
1456
  if(!empty($q['meta_key'])){
1457
  $allowed_keys[] = $q['meta_key'];
1458
  $allowed_keys[] = 'meta_value';
1459
  $allowed_keys[] = 'meta_value_num';
1460
  }
1461
- $q['orderby'] = urldecode($q['orderby']);
1462
- $q['orderby'] = addslashes_gpc($q['orderby']);
1463
- if(in_array($q['orderby'], array('title', 'date', 'modified'))){
1464
  $q['orderby'] .= ' ID';
1465
  }
1466
 
@@ -1495,6 +1549,9 @@ class GmediaDB{
1495
  case 'custom':
1496
  $orderby = "{$album['alias']}.gmedia_order {$q['order']}, {$wpdb->prefix}gmedia.ID";
1497
  break;
 
 
 
1498
  default:
1499
  $orderby = "{$wpdb->prefix}gmedia." . $orderby;
1500
  }
@@ -1554,27 +1611,24 @@ class GmediaDB{
1554
  $found_rows = 'SQL_CALC_FOUND_ROWS';
1555
  }
1556
 
1557
- $request = " SELECT $found_rows $fields FROM {$wpdb->prefix}gmedia $join WHERE 1=1 $where $whichauthor $whichmimetype $groupby $orderby $limits";
1558
 
1559
  $clauses = compact('join', 'where', 'whichauthor', 'whichmimetype', 'groupby', 'orderby', 'limits');
1560
  $this->clauses = $clauses;
1561
 
1562
  if('ids' == $q['fields']){
1563
- $gmedias = $wpdb->get_col($request);
1564
 
1565
  return $gmedias;
1566
  }
 
 
 
1567
  if('post_ids' == $q['fields']){
1568
- $gmedias = $wpdb->get_results($request);
1569
 
1570
  return $gmedias;
1571
  }
1572
 
1573
- if(!empty($clauses['where']) || !empty($clauses['whichmimetype'])){
1574
- $this->filter = true;
1575
- }
1576
-
1577
- $gmedias = $wpdb->get_results($request);
1578
  $gmedia_count = count($gmedias);
1579
 
1580
  if(!$q['no_found_rows'] && !empty($limits)){
@@ -1591,9 +1645,11 @@ class GmediaDB{
1591
  $this->trueTotalResult = $this->totalResult;
1592
  }
1593
  if($q['per_page'] && (- 1 != $q['per_page'])){
1594
- $this->pages = ceil($this->totalResult / $q['per_page']);
 
1595
  } else{
1596
- $this->pages = 1;
 
1597
  }
1598
  $this->openPage = $page;
1599
  $this->resultPerPage = $gmedia_count;
@@ -1643,24 +1699,23 @@ class GmediaDB{
1643
  HAVING dupe_count > 1
1644
  ) AS g2 ON g.meta_value = g2.meta_value ORDER BY g.meta_value, g.gmedia_id ASC;";
1645
 
1646
- $duplicates = $wpdb->get_results($sql);
1647
- // we do this otherwise WP_Query's gmedia__in gets an empty array and returns all posts
1648
- if(!$duplicates){
1649
- return array('0');
1650
- }
1651
-
1652
  $duplicate_ids = array();
1653
  $duplicate_hashes = array();
1654
  $duplicate_select = array();
1655
- foreach($duplicates as $dups){
1656
- $duplicate_ids[] = $dups->gmedia_id;
1657
- if(!isset($duplicate_hashes[ $dups->meta_value ])){
1658
- $duplicate_hashes[ $dups->meta_value ] = $dups->dupe_count;
1659
- } else{
1660
- $duplicate_select[] = $dups->gmedia_id;
 
 
 
 
 
1661
  }
 
1662
  }
1663
- $duplicate_ids = array_reverse($duplicate_ids);
1664
 
1665
  return compact('duplicate_ids', 'duplicate_select', 'duplicate_hashes');
1666
  }
@@ -1706,6 +1761,7 @@ class GmediaDB{
1706
  $q['cat'] = implode(',', $req_cats);
1707
  } elseif(('0' === $q['cat']) || (0 === $q['cat'])){
1708
  $q['category__not_in'] = $this->get_terms('gmedia_category', array('fields' => 'ids'));
 
1709
  }
1710
  }
1711
 
@@ -1714,7 +1770,11 @@ class GmediaDB{
1714
  if(in_array(0, $q['category__in'])){
1715
  $q['category__in'] = array_filter($q['category__in']);
1716
  $q['category__not_in'] = array_diff($this->get_terms('gmedia_category', array('fields' => 'ids')), $q['category__in']);
1717
- $q['category__in'] = array();
 
 
 
 
1718
  }
1719
  }
1720
  if(isset($q['category__not_in']) && (!empty($q['category__not_in']) || ('0' === $q['category__not_in']) || (0 === $q['category__not_in']))){
@@ -1722,6 +1782,10 @@ class GmediaDB{
1722
  if(in_array(0, $q['category__not_in'])){
1723
  $q['category__not_in'] = array_filter($q['category__not_in']);
1724
  $q['category__in'] = array_diff($this->get_terms('gmedia_category', array('fields' => 'ids')), $q['category__not_in']);
 
 
 
 
1725
  $q['category__not_in'] = array();
1726
  }
1727
  }
@@ -1781,6 +1845,7 @@ class GmediaDB{
1781
  $q['alb'] = implode(',', $req_albs);
1782
  } elseif(('0' === $q['alb']) || (0 === $q['alb'])){
1783
  $q['album__not_in'] = $this->get_terms('gmedia_album', array('fields' => 'ids'));
 
1784
  }
1785
  }
1786
 
@@ -1793,7 +1858,11 @@ class GmediaDB{
1793
  if($without_album){
1794
  $q['album__in'] = array_filter($q['album__in']);
1795
  $q['album__not_in'] = array_diff($this->get_terms('gmedia_album', array('fields' => 'ids')), $q['album__in']);
1796
- $q['album__in'] = array();
 
 
 
 
1797
  }
1798
  }
1799
  if(isset($q['album__not_in']) && (!empty($q['album__not_in']) || ('0' === $q['album__not_in']) || (0 === $q['album__not_in']))){
@@ -1805,6 +1874,10 @@ class GmediaDB{
1805
  } else{
1806
  $q['album__in'] = array_diff($this->get_terms('gmedia_album', array('fields' => 'ids')), $q['album__not_in']);
1807
  }
 
 
 
 
1808
  $q['album__not_in'] = array();
1809
  }
1810
  }
@@ -2713,14 +2786,15 @@ class GmediaDB{
2713
  $cache_key = "gmedia_get_terms:$key:$last_changed";
2714
  $cache = wp_cache_get($cache_key, 'gmedia_terms');
2715
  if(false !== $cache){
2716
- $cache_counts = wp_cache_get($cache_key, 'gmedia_terms_counts');
2717
- if(false != $cache_counts){
2718
- $this->openPage = $cache_counts['openPage'];
2719
- $this->resultPerPage = $cache_counts['resultPerPage'];
2720
- $this->totalResult = $cache_counts['totalResult'];
2721
- $this->page = $cache_counts['pages'];
 
2722
  }
2723
- $args['terms_counts'] = $cache_counts;
2724
 
2725
  $cache = apply_filters('gmedia_get_terms', $cache, $taxonomies, $args);
2726
 
@@ -2748,6 +2822,8 @@ class GmediaDB{
2748
  $orderby = "ORDER BY t.global DESC, t.name $order";
2749
  } else if('global_asc_name' == $_orderby){
2750
  $orderby = "ORDER BY t.global ASC, t.name $order";
 
 
2751
  } else if('none' == $_orderby){
2752
  $orderby = '';
2753
  } elseif(empty($_orderby) || 'id' == $_orderby){
@@ -2762,8 +2838,10 @@ class GmediaDB{
2762
  $where = '';
2763
  $inclusions = '';
2764
  if(!empty($include)){
2765
- $exclude = '';
2766
- $inclusions = implode(',', wp_parse_id_list($include));
 
 
2767
  }
2768
 
2769
  if(!empty($inclusions)){
@@ -2773,7 +2851,8 @@ class GmediaDB{
2773
 
2774
  $exclusions = '';
2775
  if(!empty($exclude)){
2776
- $exterms = wp_parse_id_list($exclude);
 
2777
  if(empty($exclusions)){
2778
  $exclusions = implode(',', $exterms);
2779
  } else{
@@ -2791,12 +2870,14 @@ class GmediaDB{
2791
  }
2792
 
2793
  if(!empty($name__like)){
2794
- $name__like = addcslashes($name__like, '_%\\');
 
2795
  $where .= $wpdb->prepare(" AND t.name LIKE %s", $name__like . '%');
2796
  }
2797
 
2798
  if(!empty($global) || '0' === $global || 0 === $global){
2799
- $global = wp_parse_id_list($global);
 
2800
  $where .= " AND t.global IN ('" . implode("', '", $global) . "')";
2801
  }
2802
 
@@ -2877,17 +2958,17 @@ class GmediaDB{
2877
  }
2878
 
2879
  $where_where = $where_ . $where;
2880
- $query = "SELECT $found_rows $fields FROM {$wpdb->prefix}gmedia_term AS t $join WHERE $where_where $orderby $limits";
2881
 
2882
  $fields = $_fields;
2883
 
2884
  if('count' == $fields){
2885
- $term_count = $wpdb->get_var($query);
2886
 
2887
  return $term_count;
2888
  }
2889
 
2890
- $terms = $wpdb->get_results($query);
2891
 
2892
  $this->openPage = $page;
2893
  $this->resultPerPage = count($terms);
@@ -2895,21 +2976,21 @@ class GmediaDB{
2895
  if(!empty($limits)){
2896
  $this->totalResult = $wpdb->get_var('SELECT FOUND_ROWS()');
2897
  $this->pages = ceil($this->totalResult / $number);
 
2898
  } else{
2899
  $this->totalResult = $this->resultPerPage;
2900
  $this->pages = 1;
 
2901
  }
2902
  }
2903
  $terms_counts = array('openPage' => $this->openPage,
2904
  'resultPerPage' => $this->resultPerPage,
2905
  'totalResult' => $this->totalResult,
2906
- 'pages' => $this->pages
 
 
2907
  );
2908
 
2909
- if(!empty($where)){
2910
- $this->filter = true;
2911
- }
2912
-
2913
  if('all' == $fields){
2914
  $this->update_term_cache($terms);
2915
  }
@@ -3287,12 +3368,12 @@ class GmediaDB{
3287
  * @uses $wpdb
3288
  * @uses do_action() Will call both 'sort_gmedia_term' and 'sort_$taxonomy'.
3289
  *
3290
- * @param int $term_id The ID of the term
3291
- * @param array|string $args default array(_orderby => ID, _order => DESC)
3292
  *
3293
  * @return int|WP_Error Returns Term ID
3294
  */
3295
- function update_term_sortorder($term_id, $args = array()){
3296
  /** @var $wpdb wpdb */
3297
  global $wpdb;
3298
 
@@ -3303,53 +3384,34 @@ class GmediaDB{
3303
 
3304
  do_action("sort_gmedia_term", $term_id);
3305
 
3306
- $default_meta = array('_orderby' => 'ID',
3307
- '_order' => 'DESC'
3308
- );
3309
- $default_args = array('gmedia_ids' => array(), 'reset_custom_order' => false, 'meta' => $default_meta);
3310
- $args = array_merge($default_args, $args);
3311
-
3312
- /** @var $gmedia_ids
3313
- * @var $reset_custom_order
3314
- * @var $meta
3315
- */
3316
- extract($args, EXTR_SKIP);
3317
-
3318
- $sortorder_meta = array_intersect_key($meta, $default_meta) + $default_meta;
3319
- foreach($sortorder_meta as $key => $value){
3320
- $this->update_metadata('gmedia_term', $term_id, $key, $value);
3321
- }
3322
-
3323
- $save_order = false;
3324
-
3325
- if(!empty($reset_custom_order)){
3326
- if($sortorder_meta['_orderby'] == 'custom'){
3327
- $sortorder_meta['_orderby'] = $default_meta['_orderby'];
3328
- }
3329
- $gmedia_ids = $this->get_gmedias(array('no_found_rows' => true,
3330
- 'album__in' => $term_id,
3331
- 'orderby' => $sortorder_meta['_orderby'],
3332
- 'order' => 'ASC',
3333
- 'fields' => 'ids'
3334
- ));
3335
- $gmedia_ids = array_merge(array(0), $gmedia_ids);
3336
- unset($gmedia_ids[0]);
3337
- $gmedia_ids = array_flip($gmedia_ids);
3338
- $save_order = true;
3339
- }
3340
-
3341
- if('custom' == $sortorder_meta['_orderby']){
3342
- $save_order = true;
3343
- }
3344
-
3345
- if(!empty($gmedia_ids) && $save_order){
3346
  $_db_gmedia_ids = $this->get_gmedias(array('no_found_rows' => true, 'album__in' => $term_id, 'orderby' => 'custom', 'order' => 'ASC', 'fields' => 'ids'));
3347
  $db_gmedia_ids = array_merge(array(0), $_db_gmedia_ids);
3348
  unset($db_gmedia_ids[0]);
3349
  $db_gmedia_ids = array_flip($db_gmedia_ids);
3350
 
3351
- if($gmedia_ids != $db_gmedia_ids){
3352
- $final_gmedia_ids = array_intersect_key($gmedia_ids, $db_gmedia_ids) + $db_gmedia_ids;
3353
  asort($final_gmedia_ids, SORT_NUMERIC);
3354
  $final_gmedia_ids = array_keys($final_gmedia_ids);
3355
  $final_gmedia_ids = array_diff_assoc($final_gmedia_ids, $_db_gmedia_ids);
@@ -3371,7 +3433,7 @@ class GmediaDB{
3371
 
3372
  do_action("sorted_gmedia_term", $term_id);
3373
 
3374
- return $term_id;
3375
  }
3376
 
3377
  /**
@@ -3671,13 +3733,13 @@ class GmediaDB{
3671
 
3672
  $select_this = '';
3673
  if('all' == $fields){
3674
- $select_this = 't.*';
3675
  } else if('ids' == $fields){
3676
  $select_this = 't.term_id';
3677
  } else if('names' == $fields){
3678
  $select_this = 't.name';
3679
  } else if('all_with_object_id' == $fields){
3680
- $select_this = 't.*, tr.gmedia_id';
3681
  $groupby = '';
3682
  }
3683
 
2
 
3
  /**
4
  * Gmedia Database Class
 
5
  */
6
  class GmediaDB{
7
 
8
  var $query; // User passed query
9
+ var $sql_query; // User passed query
10
+ var $filter = array(); // is there filter for get_gmedias()
11
  var $filter_tax = array(); // is there filter by taxonomy for get_gmedias()
12
  var $resultLimited = 0; // Total records for limited query (with offset)
13
  var $resultPerPage = 0; // Total records in each pages
15
  var $trueTotalResult = 0; // Total records in DB without limit
16
  var $totalResult = 0; // Total records in DB
17
  var $pages = 0; // Total number of pages required
18
+ var $perPages = 0; // per page query
19
  var $openPage = 0; // currently opened page
20
  var $clauses; // query clauses
21
  var $gmedia; // first gmedia object
49
  if($selected){
50
  $sel_ids = wp_parse_id_list($selected);
51
  } else{
52
+ $ckey = "gmedia_library:wpmedia";
53
  if(isset($_COOKIE[ $ckey ])){
54
+ $sel_ids = array_filter(explode('.', $_COOKIE[ $ckey ]), 'is_numeric');
55
  }
56
  }
57
  switch($mime_type){
68
  $and .= " AND post_mime_type NOT REGEXP 'image|audio|video'";
69
  break;
70
  }
71
+ if(!empty($mime_type)){
72
+ $this->filter['mime_type'] = (array)$mime_type;
73
+ }
74
  // If a search pattern is specified, load the posts that match
75
  if(!empty($s)){
76
  // added slashes screw with quote grouping when done early, so done later
95
  }
96
 
97
  if(!empty($search)){
98
+ $search = " AND ({$search}) ";
99
+ $this->filter['s'] = (array)$search_terms;
100
  }
101
  }
102
  if($orderby){
134
  case 'selected':
135
  if(count($sel_ids)){
136
  $and .= ' AND ID IN (' . join(', ', $sel_ids) . ')';
137
+ $this->filter['post__in'] = $sel_ids;
138
  break;
139
  } else{
140
  $and .= ' AND ID = 0';
151
  $offset = ($this->openPage - 1) * $limit;
152
  $lim = " LIMIT {$offset}, {$limit}";
153
  }
154
+ $this->sql_query = "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE post_type = 'attachment' {$and} {$search} GROUP BY ID {$ord} {$lim}";
155
+ $this->query = $wpdb->get_results($this->sql_query);
156
  $this->totalResult = (int)$wpdb->get_var("SELECT FOUND_ROWS()");
157
  if((1 > $limit) || (0 == $this->totalResult)){
158
  $limit = $this->totalResult;
167
  $offset = ($this->openPage - 1) * $limit;
168
  $lim = " LIMIT {$offset}, {$limit}";
169
  }
170
+ $this->sql_query = "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE post_type = 'attachment' {$and} {$search} GROUP BY ID {$ord} {$lim}";
171
+ $this->query = $wpdb->get_results($this->sql_query);
172
  }
173
  $this->resultPerPage = count($this->query);
 
 
 
174
 
175
  return $this->query;
176
  }
192
  $search = '';
193
  if(isset($selected)){
194
  $sel_ids = wp_parse_id_list($selected);
195
+ } elseif(isset($_COOKIE["gmedia_library:wpmedia"])){
196
+ $sel_ids = array_filter(explode('.', $_COOKIE["gmedia_library:wpmedia"]), 'is_numeric');
197
  } else{
198
  $sel_ids = array();
199
  }
307
  return '';
308
  }
309
  $params = $_GET;
310
+ unset($params['pager'], $params['do_gmedia'], $params['did_gmedia'], $params['do_gmedia_terms'], $params['did_gmedia_terms'], $params['ids'], $params['_wpnonce'], $params['doing_wp_cron']);
311
  $new_query_string = http_build_query($params);
312
  //$self = admin_url( 'admin.php?' . $new_query_string );
313
  $self = '?' . $new_query_string;
971
  default:
972
  $fields = "{$wpdb->prefix}gmedia.*";
973
  $fields .= ", wp.ID as post_id, wp.post_name, wp.post_password, wp.comment_status, wp.comment_count";
 
974
  }
975
+ $join .= " LEFT JOIN {$wpdb->posts} AS wp ON ({$wpdb->prefix}gmedia.post_id = wp.ID)";
976
 
977
  // If a month is specified in the querystring, load that month
978
  if($q['m']){
993
  if(strlen($q['m']) > 13){
994
  $where .= " AND SECOND({$wpdb->prefix}gmedia.date)=" . substr($q['m'], 12, 2);
995
  }
996
+ $this->filter['m'] = $q['m'];
997
  }
998
 
999
  if('' !== $q['hour']){
1000
  $where .= " AND HOUR({$wpdb->prefix}gmedia.date)='" . $q['hour'] . "'";
1001
+ $this->filter['hour'] = $q['hour'];
1002
  }
1003
 
1004
  if('' !== $q['minute']){
1005
  $where .= " AND MINUTE({$wpdb->prefix}gmedia.date)='" . $q['minute'] . "'";
1006
+ $this->filter['minute'] = $q['minute'];
1007
  }
1008
 
1009
  if('' !== $q['second']){
1010
  $where .= " AND SECOND({$wpdb->prefix}gmedia.date)='" . $q['second'] . "'";
1011
+ $this->filter['second'] = $q['second'];
1012
  }
1013
 
1014
  if($q['year']){
1015
  $where .= " AND YEAR({$wpdb->prefix}gmedia.date)='" . $q['year'] . "'";
1016
+ $this->filter['year'] = $q['year'];
1017
  }
1018
 
1019
  if($q['monthnum']){
1020
  $where .= " AND MONTH({$wpdb->prefix}gmedia.date)='" . $q['monthnum'] . "'";
1021
+ $this->filter['monthnum'] = $q['monthnum'];
1022
  }
1023
 
1024
  if($q['day']){
1025
  $where .= " AND DAYOFMONTH({$wpdb->prefix}gmedia.date)='" . $q['day'] . "'";
1026
+ $this->filter['day'] = $q['day'];
1027
+ }
1028
+
1029
+ if($q['w']){
1030
+ $where .= ' AND ' . _wp_mysql_week("`{$wpdb->prefix}gmedia`.`date`") . " = '" . $q['w'] . "'";
1031
+ $this->filter['w'] = $q['w'];
1032
  }
1033
 
1034
  if('' != $q['name']){
1035
  $q['name'] = esc_sql($q['name']);
1036
  $where .= " AND {$wpdb->prefix}gmedia.title = '" . $q['name'] . "'";
1037
+ $this->filter['name'] = $q['name'];
 
 
 
1038
  }
1039
 
1040
  // If a gmedia number is specified, load that gmedia
1041
  if($q['gmedia_id']){
1042
  $where .= " AND {$wpdb->prefix}gmedia.ID = " . $q['gmedia_id'];
1043
+ $this->filter['gmedia__in'] = (array)$q['gmedia_id'];
1044
  } elseif($q['gmedia__in']){
1045
  if(!is_array($q['gmedia__in'])){
1046
  $q['gmedia__in'] = explode(',', $q['gmedia__in']);
1047
  }
1048
+ $gmedia__in = array_filter(array_map('absint', $q['gmedia__in']));
1049
+ $this->filter['gmedia__in'] = $gmedia__in;
1050
+ $gmedia__in = implode(',', $gmedia__in);
1051
+ if($gmedia__in){
1052
+ $where .= " AND {$wpdb->prefix}gmedia.ID IN ($gmedia__in)";
1053
+ }
1054
  } elseif($q['gmedia__not_in']){
1055
  if(!is_array($q['gmedia__not_in'])){
1056
  $q['gmedia__not_in'] = explode(',', $q['gmedia__not_in']);
1057
  }
1058
+ $gmedia__not_in = array_filter(array_map('absint', $q['gmedia__not_in']));
1059
+ $this->filter['gmedia__not_in'] = $gmedia__not_in;
1060
+ $gmedia__not_in = implode(',', $gmedia__not_in);
1061
+ if($gmedia__not_in){
1062
+ $where .= " AND {$wpdb->prefix}gmedia.ID NOT IN ($gmedia__not_in)";
1063
+ }
1064
  }
1065
 
1066
  // If a linked wp post number is specified, load that gmedia
1067
  if($q['wppost_id']){
1068
  $where .= " AND {$wpdb->prefix}gmedia.post_id = " . $q['wppost_id'];
1069
+ $this->filter['wppost__in'] = (array)$q['wppost_id'];
1070
  } elseif($q['wppost__in']){
1071
  if(!is_array($q['wppost__in'])){
1072
  $q['wppost__in'] = explode(',', $q['wppost__in']);
1073
  }
1074
+ $wppost__in = array_filter(array_map('absint', $q['wppost__in']));
1075
+ $this->filter['wppost__in'] = $wppost__in;
1076
+ $wppost__in = implode(',', $wppost__in);
1077
+ if($wppost__in){
1078
+ $where .= " AND {$wpdb->prefix}gmedia.post_id IN ($wppost__in)";
1079
+ }
1080
  } elseif($q['wppost__not_in']){
1081
  if(!is_array($q['wppost__not_in'])){
1082
  $q['wppost__not_in'] = explode(',', $q['wppost__not_in']);
1083
  }
1084
+ $wppost__not_in = array_filter(array_map('absint', $q['wppost__not_in']));
1085
+ $this->filter['wppost__not_in'] = $wppost__not_in;
1086
+ $wppost__not_in = implode(',', $wppost__not_in);
1087
+ if($wppost__not_in){
1088
+ $where .= " AND {$wpdb->prefix}gmedia.post_id NOT IN ($wppost__not_in)";
1089
+ }
1090
  }
1091
 
1092
  // If a search pattern is specified, load the posts that match
1112
  if ( !is_user_logged_in() )
1113
  $search .= " AND ({$wpdb->prefix}gmedia_meta.password = '') ";
1114
  */
1115
+ $this->filter['s'] = (array)$q['search_terms'];
1116
  }
1117
  }
1118
 
1225
  */
1226
  extract($query);
1227
 
1228
+ $taxterm = str_replace('gmedia_', '', $taxonomy);
1229
 
1230
  if('IN' == $operator){
1231
 
1233
  continue;
1234
  }
1235
 
1236
+ $this->filter["{$taxterm}__in"] = $terms;
1237
+ $terms = implode(',', $terms);
1238
 
1239
  $alias = $i? 'tr' . $i : 'tr';
1240
 
1255
  continue;
1256
  }
1257
 
1258
+ $this->filter["{$taxterm}__not_in"] = $terms;
1259
+ $terms = implode(',', $terms);
1260
 
1261
  $clauses['where'][] = "{$wpdb->prefix}gmedia.ID NOT IN (
1262
  SELECT gmedia_id
1271
 
1272
  $num_terms = count($terms);
1273
 
1274
+ $this->filter["{$taxterm}__and"] = $terms;
1275
+ $terms = implode(',', $terms);
1276
 
1277
  $clauses['where'][] = "(
1278
  SELECT COUNT(1)
1427
 
1428
  $join .= $clauses['join'];
1429
  $where .= $clauses['where'];
1430
+
1431
+ $this->filter['meta_query'] = $meta_query;
1432
  }
1433
  unset($clauses);
1434
 
1438
 
1439
  // Status
1440
  if($q['status']){
1441
+ $q['status'] = array_map('esc_sql', array_unique((array)$q['status']));
1442
+ $this->filter['status'] = $q['status'];
1443
+ $status = "'" . str_replace(",", "','", implode(",", $q['status'])) . "'";
1444
+ $whichstatus .= " AND {$wpdb->prefix}gmedia.status IN ({$status})";
1445
  }
1446
 
1447
  // Author/user stuff for ID
1456
  }
1457
 
1458
  if(!empty($q['author__not_in'])){
1459
+ $author__not_in = array_map('absint', array_unique(wp_parse_id_list($q['author__not_in'])));
1460
+ $this->filter['author__not_in'] = $author__not_in;
1461
+ $author__not_in = implode(',', $author__not_in);
1462
  $whichauthor .= " AND {$wpdb->prefix}gmedia.author NOT IN ($author__not_in) ";
1463
  } elseif(!empty($q['author__in'])){
1464
+ $author__in = array_map('absint', array_unique(wp_parse_id_list($q['author__in'])));
1465
+ $this->filter['author__in'] = $author__in;
1466
+ $author__in = implode(',', $author__in);
1467
  $whichauthor .= " AND {$wpdb->prefix}gmedia.author IN ($author__in) ";
1468
  }
1469
 
1470
  // Author stuff for name
1471
  if('' != $q['author_name']){
1472
  $q['author_name'] = esc_sql($q['author_name']);
1473
+ $author = get_user_by('slug', $q['author_name']);
1474
+ if($author){
1475
+ $q['author'] = $author->ID;
1476
+ $whichauthor .= " AND ({$wpdb->prefix}gmedia.author = " . absint($q['author']) . ')';
1477
+ $this->filter['author__in'] = $q['author'];
1478
  }
 
1479
  }
1480
 
1481
  // MIME-Type stuff
1482
  if(isset($q['mime_type']) && !empty($q['mime_type'])){
1483
+ if(is_string($q['mime_type'])){
1484
+ $q['mime_type'] = array_map('trim', explode(',', $q['mime_type']));
1485
+ }
1486
+ $whichmimetype = $this->gmedia_mime_type_where($q['mime_type'], $wpdb->prefix . 'gmedia');
1487
+ $this->filter['mime_type'] = $q['mime_type'];
1488
  }
1489
 
1490
  $where .= $whichstatus . $search;
1497
  if(empty($q['orderby']) || ('none' == $q['orderby'])){
1498
  $orderby = "{$wpdb->prefix}gmedia.ID " . $q['order'];
1499
  } else{
1500
+ // Used to filter values
1501
+ $allowed_keys = array('ID', 'author', 'date', 'title', 'filename', 'gmuid', 'modified', 'mime_type', 'gmedia__in', 'rand', 'comment_count');
1502
  if($album['order'] && !empty($album['alias'])){
1503
  $allowed_keys[] = 'custom';
1504
  }
1505
+ $q['orderby'] = urldecode($q['orderby']);
1506
+ $q['orderby'] = addslashes_gpc($q['orderby']);
1507
+ if(in_array($q['orderby'], array('_created_timestamp', 'views', 'likes', '_size'))){
1508
+ $q['meta_key'] = $q['orderby'];
1509
+ $q['orderby'] = 'meta_value_num';
1510
+ $join .= " LEFT JOIN {$wpdb->prefix}gmedia_meta ON ({$wpdb->prefix}gmedia.ID = {$wpdb->prefix}gmedia_meta.gmedia_id AND " . $wpdb->prepare("{$wpdb->prefix}gmedia_meta.meta_key = %s", $q['meta_key']) . ")";
1511
+ }
1512
  if(!empty($q['meta_key'])){
1513
  $allowed_keys[] = $q['meta_key'];
1514
  $allowed_keys[] = 'meta_value';
1515
  $allowed_keys[] = 'meta_value_num';
1516
  }
1517
+ if(in_array($q['orderby'], array('title', 'date', 'modified', 'comment_count', 'meta_value', 'meta_value_num'))){
 
 
1518
  $q['orderby'] .= ' ID';
1519
  }
1520
 
1549
  case 'custom':
1550
  $orderby = "{$album['alias']}.gmedia_order {$q['order']}, {$wpdb->prefix}gmedia.ID";
1551
  break;
1552
+ case 'comment_count':
1553
+ $orderby = "wp.comment_count";
1554
+ break;
1555
  default:
1556
  $orderby = "{$wpdb->prefix}gmedia." . $orderby;
1557
  }
1611
  $found_rows = 'SQL_CALC_FOUND_ROWS';
1612
  }
1613
 
1614
+ $this->sql_query = "SELECT $found_rows $fields FROM {$wpdb->prefix}gmedia $join WHERE 1=1 $where $whichauthor $whichmimetype $groupby $orderby $limits";
1615
 
1616
  $clauses = compact('join', 'where', 'whichauthor', 'whichmimetype', 'groupby', 'orderby', 'limits');
1617
  $this->clauses = $clauses;
1618
 
1619
  if('ids' == $q['fields']){
1620
+ $gmedias = $wpdb->get_col($this->sql_query);
1621
 
1622
  return $gmedias;
1623
  }
1624
+
1625
+ $gmedias = $wpdb->get_results($this->sql_query);
1626
+
1627
  if('post_ids' == $q['fields']){
 
1628
 
1629
  return $gmedias;
1630
  }
1631
 
 
 
 
 
 
1632
  $gmedia_count = count($gmedias);
1633
 
1634
  if(!$q['no_found_rows'] && !empty($limits)){
1645
  $this->trueTotalResult = $this->totalResult;
1646
  }
1647
  if($q['per_page'] && (- 1 != $q['per_page'])){
1648
+ $this->pages = ceil($this->totalResult / $q['per_page']);
1649
+ $this->perPages = (int)$q['per_page'];
1650
  } else{
1651
+ $this->pages = 1;
1652
+ $this->perPages = $gmedia_count;
1653
  }
1654
  $this->openPage = $page;
1655
  $this->resultPerPage = $gmedia_count;
1699
  HAVING dupe_count > 1
1700
  ) AS g2 ON g.meta_value = g2.meta_value ORDER BY g.meta_value, g.gmedia_id ASC;";
1701
 
 
 
 
 
 
 
1702
  $duplicate_ids = array();
1703
  $duplicate_hashes = array();
1704
  $duplicate_select = array();
1705
+
1706
+ $duplicates = $wpdb->get_results($sql);
1707
+
1708
+ if($duplicates){
1709
+ foreach($duplicates as $dups){
1710
+ $duplicate_ids[] = $dups->gmedia_id;
1711
+ if(!isset($duplicate_hashes[ $dups->meta_value ])){
1712
+ $duplicate_hashes[ $dups->meta_value ] = $dups->dupe_count;
1713
+ } else{
1714
+ $duplicate_select[] = $dups->gmedia_id;
1715
+ }
1716
  }
1717
+ $duplicate_ids = array_reverse($duplicate_ids);
1718
  }
 
1719
 
1720
  return compact('duplicate_ids', 'duplicate_select', 'duplicate_hashes');
1721
  }
1761
  $q['cat'] = implode(',', $req_cats);
1762
  } elseif(('0' === $q['cat']) || (0 === $q['cat'])){
1763
  $q['category__not_in'] = $this->get_terms('gmedia_category', array('fields' => 'ids'));
1764
+ $q['without_category'] = true;
1765
  }
1766
  }
1767
 
1770
  if(in_array(0, $q['category__in'])){
1771
  $q['category__in'] = array_filter($q['category__in']);
1772
  $q['category__not_in'] = array_diff($this->get_terms('gmedia_category', array('fields' => 'ids')), $q['category__in']);
1773
+ $q['without_category'] = true;
1774
+ if(!empty($q['category__in'])){
1775
+ $q['with_category__in'] = $q['category__in'];
1776
+ }
1777
+ $q['category__in'] = array();
1778
  }
1779
  }
1780
  if(isset($q['category__not_in']) && (!empty($q['category__not_in']) || ('0' === $q['category__not_in']) || (0 === $q['category__not_in']))){
1782
  if(in_array(0, $q['category__not_in'])){
1783
  $q['category__not_in'] = array_filter($q['category__not_in']);
1784
  $q['category__in'] = array_diff($this->get_terms('gmedia_category', array('fields' => 'ids')), $q['category__not_in']);
1785
+ $q['within_category'] = true;
1786
+ if(!empty($q['category__not_in'])){
1787
+ $q['with_category__not_in'] = $q['category__not_in'];
1788
+ }
1789
  $q['category__not_in'] = array();
1790
  }
1791
  }
1845
  $q['alb'] = implode(',', $req_albs);
1846
  } elseif(('0' === $q['alb']) || (0 === $q['alb'])){
1847
  $q['album__not_in'] = $this->get_terms('gmedia_album', array('fields' => 'ids'));
1848
+ $q['without_album'] = true;
1849
  }
1850
  }
1851
 
1858
  if($without_album){
1859
  $q['album__in'] = array_filter($q['album__in']);
1860
  $q['album__not_in'] = array_diff($this->get_terms('gmedia_album', array('fields' => 'ids')), $q['album__in']);
1861
+ $q['without_album'] = true;
1862
+ if(!empty($q['album__in'])){
1863
+ $q['with_album__in'] = $q['album__in'];
1864
+ }
1865
+ $q['album__in'] = array();
1866
  }
1867
  }
1868
  if(isset($q['album__not_in']) && (!empty($q['album__not_in']) || ('0' === $q['album__not_in']) || (0 === $q['album__not_in']))){
1874
  } else{
1875
  $q['album__in'] = array_diff($this->get_terms('gmedia_album', array('fields' => 'ids')), $q['album__not_in']);
1876
  }
1877
+ $q['within_album'] = true;
1878
+ if(!empty($q['album__not_in'])){
1879
+ $q['with_album__not_in'] = $q['album__not_in'];
1880
+ }
1881
  $q['album__not_in'] = array();
1882
  }
1883
  }
2786
  $cache_key = "gmedia_get_terms:$key:$last_changed";
2787
  $cache = wp_cache_get($cache_key, 'gmedia_terms');
2788
  if(false !== $cache){
2789
+ $cache_tax = wp_cache_get($cache_key, 'gmedia_terms_counts');
2790
+ if(false != $cache_tax){
2791
+ $this->openPage = $cache_tax['openPage'];
2792
+ $this->resultPerPage = $cache_tax['resultPerPage'];
2793
+ $this->totalResult = $cache_tax['totalResult'];
2794
+ $this->pages = $cache_tax['pages'];
2795
+ $this->filter_tax = $cache_tax['filter_tax'];
2796
  }
2797
+ $args['terms_counts'] = $cache_tax;
2798
 
2799
  $cache = apply_filters('gmedia_get_terms', $cache, $taxonomies, $args);
2800
 
2822
  $orderby = "ORDER BY t.global DESC, t.name $order";
2823
  } else if('global_asc_name' == $_orderby){
2824
  $orderby = "ORDER BY t.global ASC, t.name $order";
2825
+ } else if('rand' == $_orderby){
2826
+ $orderby = 'ORDER BY RAND()';
2827
  } else if('none' == $_orderby){
2828
  $orderby = '';
2829
  } elseif(empty($_orderby) || 'id' == $_orderby){
2838
  $where = '';
2839
  $inclusions = '';
2840
  if(!empty($include)){
2841
+ $exclude = '';
2842
+ $include = wp_parse_id_list($include);
2843
+ $inclusions = implode(',', $include);
2844
+ $this->filter_tax['term__in'] = $include;
2845
  }
2846
 
2847
  if(!empty($inclusions)){
2851
 
2852
  $exclusions = '';
2853
  if(!empty($exclude)){
2854
+ $exterms = wp_parse_id_list($exclude);
2855
+ $this->filter_tax['term__not_in'] = $exterms;
2856
  if(empty($exclusions)){
2857
  $exclusions = implode(',', $exterms);
2858
  } else{
2870
  }
2871
 
2872
  if(!empty($name__like)){
2873
+ $this->filter_tax['name__like'] = $name__like;
2874
+ $name__like = addcslashes($name__like, '_%\\');
2875
  $where .= $wpdb->prepare(" AND t.name LIKE %s", $name__like . '%');
2876
  }
2877
 
2878
  if(!empty($global) || '0' === $global || 0 === $global){
2879
+ $global = wp_parse_id_list($global);
2880
+ $this->filter_tax['global'] = $global;
2881
  $where .= " AND t.global IN ('" . implode("', '", $global) . "')";
2882
  }
2883
 
2958
  }
2959
 
2960
  $where_where = $where_ . $where;
2961
+ $this->sql_query = "SELECT $found_rows $fields FROM {$wpdb->prefix}gmedia_term AS t $join WHERE $where_where $orderby $limits";
2962
 
2963
  $fields = $_fields;
2964
 
2965
  if('count' == $fields){
2966
+ $term_count = $wpdb->get_var($this->sql_query);
2967
 
2968
  return $term_count;
2969
  }
2970
 
2971
+ $terms = $wpdb->get_results($this->sql_query);
2972
 
2973
  $this->openPage = $page;
2974
  $this->resultPerPage = count($terms);
2976
  if(!empty($limits)){
2977
  $this->totalResult = $wpdb->get_var('SELECT FOUND_ROWS()');
2978
  $this->pages = ceil($this->totalResult / $number);
2979
+ $this->perPages = (int)$number;
2980
  } else{
2981
  $this->totalResult = $this->resultPerPage;
2982
  $this->pages = 1;
2983
+ $this->perPages = $this->resultPerPage;
2984
  }
2985
  }
2986
  $terms_counts = array('openPage' => $this->openPage,
2987
  'resultPerPage' => $this->resultPerPage,
2988
  'totalResult' => $this->totalResult,
2989
+ 'pages' => $this->pages,
2990
+ 'perPages' => $this->perPages,
2991
+ 'filter_tax' => $this->filter_tax
2992
  );
2993
 
 
 
 
 
2994
  if('all' == $fields){
2995
  $this->update_term_cache($terms);
2996
  }
3368
  * @uses $wpdb
3369
  * @uses do_action() Will call both 'sort_gmedia_term' and 'sort_$taxonomy'.
3370
  *
3371
+ * @param int $term_id The ID of the term
3372
+ * @param array $gm_ids_order
3373
  *
3374
  * @return int|WP_Error Returns Term ID
3375
  */
3376
+ function update_term_sortorder($term_id, $gm_ids_order = array()){
3377
  /** @var $wpdb wpdb */
3378
  global $wpdb;
3379
 
3384
 
3385
  do_action("sort_gmedia_term", $term_id);
3386
 
3387
+ if(empty($gm_ids_order)){
3388
+ $term_meta = $this->get_metadata('gmedia_term', $term_id);
3389
+ $_orderby = isset($term_meta['_orderby'][0])? $term_meta['_orderby'][0] : 'ID';
3390
+ $_order = isset($term_meta['_order'][0])? $term_meta['_order'][0] : 'DESC';
3391
+ if($_orderby == 'custom'){
3392
+ $_orderby = 'ID';
3393
+ $_order = 'DESC';
3394
+ }
3395
+ $gm_ids_order = $this->get_gmedias(array('no_found_rows' => true,
3396
+ 'album__in' => $term_id,
3397
+ 'orderby' => $_orderby,
3398
+ 'order' => $_order,
3399
+ 'fields' => 'ids'
3400
+ ));
3401
+ $gm_ids_order = array_merge(array(0), $gm_ids_order);
3402
+ unset($gm_ids_order[0]);
3403
+ $gm_ids_order = array_flip($gm_ids_order);
3404
+ }
3405
+
3406
+ $final_gmedia_ids = array();
3407
+ if(!empty($gm_ids_order)){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3408
  $_db_gmedia_ids = $this->get_gmedias(array('no_found_rows' => true, 'album__in' => $term_id, 'orderby' => 'custom', 'order' => 'ASC', 'fields' => 'ids'));
3409
  $db_gmedia_ids = array_merge(array(0), $_db_gmedia_ids);
3410
  unset($db_gmedia_ids[0]);
3411
  $db_gmedia_ids = array_flip($db_gmedia_ids);
3412
 
3413
+ if($gm_ids_order != $db_gmedia_ids){
3414
+ $final_gmedia_ids = array_intersect_key($gm_ids_order, $db_gmedia_ids) + $db_gmedia_ids;
3415
  asort($final_gmedia_ids, SORT_NUMERIC);
3416
  $final_gmedia_ids = array_keys($final_gmedia_ids);
3417
  $final_gmedia_ids = array_diff_assoc($final_gmedia_ids, $_db_gmedia_ids);
3433
 
3434
  do_action("sorted_gmedia_term", $term_id);
3435
 
3436
+ return $final_gmedia_ids;
3437
  }
3438
 
3439
  /**
3733
 
3734
  $select_this = '';
3735
  if('all' == $fields){
3736
+ $select_this = 't.*, tr.term_order, tr.gmedia_order';
3737
  } else if('ids' == $fields){
3738
  $select_this = 't.term_id';
3739
  } else if('names' == $fields){
3740
  $select_this = 't.name';
3741
  } else if('all_with_object_id' == $fields){
3742
+ $select_this = 't.*, tr.gmedia_id, tr.term_order, tr.gmedia_order';
3743
  $groupby = '';
3744
  }
3745
 
inc/functions.php ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function gm_user_can($capability){
4
+ global $gmCore;
5
+
6
+ return isset($gmCore->caps[ 'gmedia_' . $capability ])? $gmCore->caps[ 'gmedia_' . $capability ] : false;
7
+ }
8
+
9
+ /** Get available modules
10
+ *
11
+ * @param bool|true $including_remote
12
+ *
13
+ * @return array
14
+ */
15
+ function get_gmedia_modules($including_remote = true){
16
+ global $gmCore, $gmGallery;
17
+
18
+ $modules = array();
19
+ $modules['in'] = $gmCore->modules_order();
20
+ if(($plugin_modules = glob(GMEDIA_ABSPATH . 'module/*', GLOB_ONLYDIR | GLOB_NOSORT))){
21
+ foreach($plugin_modules as $path){
22
+ $mfold = basename($path);
23
+ $modules['in'][ $mfold ] = array('place' => 'plugin',
24
+ 'module_name' => $mfold,
25
+ 'module_url' => $gmCore->gmedia_url . "/module/{$mfold}",
26
+ 'module_path' => $path
27
+ );
28
+ }
29
+ }
30
+ if(($upload_modules = glob($gmCore->upload['path'] . '/' . $gmGallery->options['folder']['module'] . '/*', GLOB_ONLYDIR | GLOB_NOSORT))){
31
+ foreach($upload_modules as $path){
32
+ $mfold = basename($path);
33
+ $modules['in'][ $mfold ] = array('place' => 'upload',
34
+ 'module_name' => $mfold,
35
+ 'module_url' => $gmCore->upload['url'] . "/{$gmGallery->options['folder']['module']}/{$mfold}",
36
+ 'module_path' => $path
37
+ );
38
+ }
39
+ }
40
+
41
+ $modules['in'] = array_filter($modules['in']);
42
+
43
+ if(isset($modules['in']) && !empty($modules['in'])){
44
+ foreach($modules['in'] as $mfold => $module){
45
+ // todo: get broken modules folders and delete them
46
+ if(!file_exists($module['module_path'] . '/index.php')){
47
+ unset($modules['in'][ $mfold ]);
48
+ continue;
49
+ }
50
+ $module_info = array();
51
+ include($module['module_path'] . '/index.php');
52
+ if(empty($module_info)){
53
+ unset($modules['in'][ $mfold ]);
54
+ continue;
55
+ }
56
+ $modules['in'][ $mfold ] = array_merge($module, (array)$module_info);
57
+ $modules['in'][ $mfold ]['update'] = false;
58
+ }
59
+ }
60
+
61
+ if($including_remote){
62
+ $get_xml = wp_remote_get($gmGallery->options['modules_xml'], array('sslverify' => true));
63
+ if(!is_wp_error($get_xml) && (200 == $get_xml['response']['code'])){
64
+ $xml = @simplexml_load_string($get_xml['body']);
65
+ if(!empty($xml)){
66
+ foreach($xml as $m){
67
+ $name = (string)$m->name;
68
+ $modules['xml'][ $name ] = get_object_vars($m);
69
+ $modules['xml'][ $name ]['place'] = 'remote';
70
+ if(isset($modules['in'][ $name ]) && !empty($modules['in'][ $name ])){
71
+ $modules['in'][ $name ] = array_merge(get_object_vars($m), $modules['in'][ $name ]);
72
+ if(version_compare((float)$modules['xml'][ $name ]['version'], (float)$modules['in'][ $name ]['version'], '>')){
73
+ $modules['in'][ $name ]['update'] = $modules['xml'][ $name ]['version'];
74
+ $modules['out'][ $name ] = $modules['xml'][ $name ];
75
+ }
76
+ } else{
77
+ $modules['out'][ $name ] = $modules['xml'][ $name ];
78
+ }
79
+ }
80
+ }
81
+ } else{
82
+ $modules['error'] = array(__('Error loading remote xml...', 'grand-media'));
83
+ if(is_wp_error($get_xml)){
84
+ $modules['error'][] = $get_xml->get_error_message();
85
+ }
86
+ }
87
+ }
88
+
89
+ return $modules;
90
+ }
91
+
92
+ /** More data for Gmedia Item
93
+ *
94
+ * @param $item
95
+ */
96
+ function gmedia_item_more_data(&$item){
97
+ global $gmDB, $gmCore, $gmGallery;
98
+
99
+ $meta = $gmDB->get_metadata('gmedia', $item->ID);
100
+ $metadata = isset($meta['_metadata'][0])? $meta['_metadata'][0] : array();
101
+
102
+ $item->meta = $meta;
103
+
104
+ $type = explode('/', $item->mime_type);
105
+ $item->type = $type[0];
106
+ $item->ext = pathinfo($item->gmuid, PATHINFO_EXTENSION);
107
+
108
+ $item->url = $gmCore->upload['url'] . '/' . $gmGallery->options['folder'][ $type[0] ] . '/' . $item->gmuid;
109
+ $item->path = $gmCore->upload['path'] . '/' . $gmGallery->options['folder'][ $type[0] ] . '/' . $item->gmuid;
110
+
111
+ $item->editor = (('image' == $type[0]) && in_array($type[1], array('jpeg', 'png', 'gif')))? true : false;
112
+ $item->gps = '';
113
+ if($item->editor){
114
+ $item->url_original = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image_original'] . '/' . $item->gmuid;
115
+ $item->url_thumb = $gmCore->upload['url'] . '/' . $gmGallery->options['folder']['image_thumb'] . '/' . $item->gmuid;
116
+ $item->path_original = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_original'] . '/' . $item->gmuid;
117
+ $item->path_thumb = $gmCore->upload['path'] . '/' . $gmGallery->options['folder']['image_thumb'] . '/' . $item->gmuid;
118
+ if(!empty($metadata['image_meta']['GPS'])){
119
+ $item->gps = implode(', ', $metadata['image_meta']['GPS']);
120
+ }
121
+ } else{
122
+ $item->url_thumb = $gmCore->gm_get_media_image($item, 'thumb');
123
+ }
124
+
125
+ $item->alttext = !empty($meta['_image_alt'][0])? $meta['_image_alt'][0] : $item->title;
126
+
127
+ if(!empty($meta['_gps'][0])){
128
+ $item->gps = implode(', ', $meta['_gps'][0]);
129
+ }
130
+
131
+ $item->img_width = isset($metadata['web']['width'])? (int)$metadata['web']['width'] : 300;
132
+ $item->img_height = isset($metadata['web']['height'])? (int)$metadata['web']['height'] : 300;
133
+ $item->thumb_width = isset($metadata['thumb']['width'])? (int)$metadata['thumb']['width'] : 300;
134
+ $item->thumb_height = isset($metadata['thumb']['height'])? (int)$metadata['thumb']['height'] : 300;
135
+ if(isset($item->meta['_cover'][0]) && !empty($item->meta['_cover'][0])){
136
+ $cover_metadata = $gmDB->get_metadata('gmedia', $item->meta['_cover'][0], '_metadata', true);
137
+ if(isset($cover_metadata['thumb']['width']) && isset($cover_metadata['thumb']['height'])){
138
+ $item->img_width = (int)$cover_metadata['web']['width'];
139
+ $item->img_height = (int)$cover_metadata['web']['height'];
140
+ $item->thumb_width = (int)$cover_metadata['thumb']['width'];
141
+ $item->thumb_height = (int)$cover_metadata['thumb']['height'];
142
+ }
143
+ }
144
+ $item->img_ratio = $item->img_width / $item->img_height;
145
+
146
+ $item->msize['width'] = max($item->img_width, (isset($metadata['width'])? (int)$metadata['width'] : 640));
147
+ $item->msize['height'] = max($item->img_height, (isset($metadata['height'])? (int)$metadata['height'] : 300));
148
+
149
+ $item->tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
150
+ if($item->tags){
151
+ usort($item->tags, 'gmterms_usort');
152
+ }
153
+ $item->album = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
154
+ $item->categories = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category');
155
+
156
+ $item = apply_filters('gmedia_item_more_data', $item);
157
+ }
158
+
159
+ /** Sort terms objects by term_order
160
+ *
161
+ * @param $a
162
+ * @param $b
163
+ *
164
+ * @return mixed
165
+ */
166
+ function gmterms_usort($a, $b){
167
+ return $a->term_order - $b->term_order;
168
+ }
169
+
170
+ /** More data for Gmedia Term Item
171
+ *
172
+ * @param $item
173
+ */
174
+ function gmedia_term_item_more_data(&$item){
175
+ global $gmDB, $gmCore;
176
+
177
+ $meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
178
+ $item->meta = $meta;
179
+
180
+ if($item->global){
181
+ $item->author_name = get_the_author_meta('display_name', $item->global);
182
+ } else{
183
+ $item->author_name = false;
184
+ }
185
+
186
+ $item->taxterm = str_replace('gmedia_', '', $item->taxonomy);
187
+ if('gmedia_album' == $item->taxonomy){
188
+ $post_id = isset($meta['_post_ID'][0])? (int)$meta['_post_ID'][0] : 0;
189
+ $item->post_id = $post_id;
190
+ if($post_id){
191
+ $post_item = get_post($post_id);
192
+ if($post_item){
193
+ $item->slug = $post_item->post_name;
194
+ $item->post_password = $post_item->post_password;
195
+ $item->comment_count = $post_item->comment_count;
196
+ $item->comment_status = $post_item->comment_status;
197
+ }
198
+ }
199
+ }
200
+
201
+ $item->cloud_link = $gmCore->gmcloudlink($item->term_id, $item->taxterm);
202
+ if(!empty($item->meta['_post_ID'][0])){
203
+ $item->post_link = get_permalink($item->meta['_post_ID'][0]);
204
+ } else{
205
+ $item->post_link = '';
206
+ }
207
+
208
+ if(is_user_logged_in()){
209
+ $allow_terms_delete = gm_user_can('terms_delete');
210
+ if($item->global){
211
+ if((int)$item->global === get_current_user_id()){
212
+ $item->allow_edit = gm_user_can("{$item->taxterm}_manage");
213
+ $item->allow_delete = $allow_terms_delete;
214
+ } else{
215
+ $item->allow_edit = gm_user_can('edit_others_media');
216
+ $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
217
+ }
218
+ } else{
219
+ $item->allow_edit = gm_user_can('edit_others_media');
220
+ $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
221
+ }
222
+ } else{
223
+ $item->allow_edit = false;
224
+ $item->allow_delete = false;
225
+ }
226
+
227
+ $item = apply_filters('gmedia_term_item_more_data', $item);
228
+ }
229
+
230
+ /** More data for Gmedia Gallery Item
231
+ *
232
+ * @param $item
233
+ */
234
+ function gmedia_gallery_more_data(&$item) {
235
+ global $gmDB, $gmCore, $user_ID;
236
+
237
+ $item->custom = array();
238
+ $item->meta = array(
239
+ '_edited' => '&#8212;',
240
+ '_query' => array(),
241
+ '_module' => $gmCore->_get('gallery_module', 'phantom')
242
+ );
243
+ $item->meta['_settings'] = array($item->meta['_module'] => array());
244
+
245
+ $item->allow_edit = false;
246
+ $item->allow_delete = false;
247
+
248
+ if(empty($item->term_id)) {
249
+ $item->term_id = 0;
250
+ $item->name = '';
251
+ $item->taxonomy = 'gmedia_gallery';
252
+ $item->taxterm = 'gallery';
253
+ $item->description = '';
254
+ $item->global = $user_ID;
255
+ $item->count = 0;
256
+ $item->status = 'publish';
257
+ $item->post_id = 0;
258
+ $item->slug = '';
259
+
260
+ $item->cloud_link = '';
261
+ $item->post_link = '';
262
+ } else {
263
+ $item->taxterm = str_replace('gmedia_', '', $item->taxonomy);
264
+
265
+ $meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
266
+ foreach($meta as $key => $value) {
267
+ if($gmCore->is_protected_meta($key, 'gmedia_term')) {
268
+ $item->meta[$key] = $value[0];
269
+ } else {
270
+ $item->custom[$key] = $value;
271
+ }
272
+ }
273
+
274
+ $post_id = isset($meta['_post_ID'][0])? (int)$meta['_post_ID'][0] : 0;
275
+ $item->post_id = $post_id;
276
+ if($post_id) {
277
+ $post_item = get_post($post_id);
278
+ if($post_item) {
279
+ $item->slug = $post_item->post_name;
280
+ $item->post_password = $post_item->post_password;
281
+ $item->comment_count = $post_item->comment_count;
282
+ $item->comment_status = $post_item->comment_status;
283
+ }
284
+ }
285
+
286
+ $item->cloud_link = $gmCore->gmcloudlink($item->term_id, $item->taxterm);
287
+ if(!empty($item->meta['_post_ID'][0])){
288
+ $item->post_link = get_permalink($item->meta['_post_ID'][0]);
289
+ } else{
290
+ $item->post_link = '';
291
+ }
292
+
293
+ if(is_user_logged_in()){
294
+ $allow_terms_delete = gm_user_can('terms_delete');
295
+ if($item->global){
296
+ if((int)$item->global === get_current_user_id()){
297
+ $item->allow_edit = gm_user_can("{$item->taxterm}_manage");
298
+ $item->allow_delete = $allow_terms_delete;
299
+ } else{
300
+ $item->allow_edit = gm_user_can('edit_others_media');
301
+ $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
302
+ }
303
+ } else{
304
+ $item->allow_edit = gm_user_can('edit_others_media');
305
+ $item->allow_delete = ($item->allow_edit && $allow_terms_delete);
306
+ }
307
+ }
308
+ }
309
+
310
+ $_module_name = $gmCore->_get('gallery_module', $item->meta['_module']);
311
+
312
+ $item->module = $gmCore->get_module_path($_module_name);
313
+ $item->module['name'] = $_module_name;
314
+ $module_info = array('type' => '&#8212;');
315
+ if(file_exists($item->module['path'] . '/index.php')) {
316
+ include($item->module['path'] . '/index.php');
317
+
318
+ $item->module['info'] = $module_info;
319
+ } else {
320
+ $item->module['broken'] = true;
321
+ }
322
+
323
+ if($item->global) {
324
+ $item->author_name = get_the_author_meta('display_name', $item->global);
325
+ } else {
326
+ $item->author_name = false;
327
+ }
328
+
329
+ $item = apply_filters('gmedia_gallery_more_data', $item);
330
+ }
331
+
332
+ /**
333
+ * @param array $query
334
+ *
335
+ * @return array
336
+ */
337
+ function gmedia_gallery_query_data($query = array()){
338
+ $filter_data = array('author__in' => array(),
339
+ 'author__not_in' => array(),
340
+ 'category__and' => array(), /* use category id. Display posts that are tagged with all listed categories in array */
341
+ 'category__in' => array(), /* use category id. Same as 'cat', but does not accept negative values */
342
+ 'category__not_in' => array(), /* use category id. Exclude multiple categories */
343
+ 'album__in' => array(), /* use album id. Same as 'alb' */
344
+ 'album__not_in' => array(), /* use album id. Exclude multiple albums */
345
+ 'tag__and' => array(), /* use tag ids. Display posts that are tagged with all listed tags in array */
346
+ 'tag__in' => array(), /* use tag ids. To display posts from either tags listed in array. Same as 'tag' */
347
+ 'tag__not_in' => array(), /* use tag ids. Display posts that do not have any of the listed tag ids */
348
+ 'terms_relation' => '', /* allows you to describe the boolean relationship between the taxonomy queries. Possible values are 'OR', 'AND'. Default 'AND' */
349
+ 'gmedia__in' => array(), /* use gmedia ids. Specify posts to retrieve */
350
+ 'gmedia__not_in' => array(), /* use gmedia ids. Specify post NOT to retrieve */
351
+ 'mime_type' => array(), /* mime types */
352
+ 'limit' => '', /* (int) - set limit */
353
+ 'page' => '', /* (int) - set limit */
354
+ 'per_page' => '', /* (int) - set limit */
355
+ 'order' => '', /* Designates the ascending or descending order of the 'orderby' parameter. Defaults to 'DESC' */
356
+ 'orderby' => '', /* Sort retrieved posts by parameter. Defaults to 'ID' */
357
+ 'year' => '', /* (int) - 4 digit year */
358
+ 'monthnum' => '', /* (int) - Month number (from 1 to 12) */
359
+ 'day' => '', /* (int) - Day of the month (from 1 to 31) */
360
+ 'meta_query' => array(array('key' => '',
361
+ 'value' => '',
362
+ 'compare' => '',
363
+ 'type' => ''
364
+ )
365
+ ),
366
+ 's' => '', /* (string) - search string or terms separated by comma */
367
+ 'exact' => false /* Search exactly string if 'exact' parameter set to true */
368
+
369
+ );
370
+
371
+ $filter_data = wp_parse_args($query, $filter_data);
372
+
373
+ $query_args = (array)gmedia_array_filter_recursive($filter_data);
374
+
375
+ return array('query_data' => $filter_data,
376
+ 'query_args' => $query_args
377
+ );
378
+ }
379
+
380
+ function gmedia_array_filter_recursive($input){
381
+ foreach($input as &$value){
382
+ if(is_array($value)){
383
+ $value = gmedia_array_filter_recursive($value);
384
+ }
385
+ }
386
+
387
+ return array_filter($input);
388
+ }
inc/media-upload.php CHANGED
@@ -280,9 +280,9 @@ function gmedia_add_media_galleries(){
280
 
281
  <p class="media-meta clear hidden">
282
  <span class="clearfix">
283
- <span class="media-object pull-left" style="width:77px;margin-right:5px;">
284
  <?php if(!$broken){ ?>
285
- <span class="thumbnail"><img src="<?php echo $module['url'] . '/screenshot.png'; ?>" alt="<?php echo esc_attr($term->name); ?>"/></span>
286
  <?php } else{ ?>
287
  <span class="bg-danger text-center"><?php _e('Module broken. Reinstall module', 'grand-media') ?></span>
288
  <?php } ?>
@@ -292,51 +292,13 @@ function gmedia_add_media_galleries(){
292
  <br><span class="label label-default"><?php _e('Status', 'grand-media'); ?>:</span> <?php echo $term->status; ?>
293
  </span>
294
  <span class="label label-default"><?php _e('Last Edited', 'grand-media'); ?>:</span> <?php echo $term_meta['_edited']; ?>
295
- <br><span class="label label-default"><?php _e('Source', 'grand-media'); ?>:</span>
296
- <?php
297
- $gallery_tabs = reset($term_meta['_query']);
298
- $tax_tabs = key($term_meta['_query']);
299
- if('gmedia__in' == $tax_tabs){
300
- _e('Selected Gmedia', 'grand-media');
301
- if(!(((int)$term->global != $user_ID) && !current_user_can('gmedia_show_others_media'))){
302
- $gmedia_ids = wp_parse_id_list($gallery_tabs[0]);
303
- $gal_source = sprintf('<a class="selected__in" target="_blank" href="%s">' . __('Show %d items in Gmedia Library', 'grand-media') . '</a>', esc_url(add_query_arg(array('gmedia__in' => implode(',', $gmedia_ids)), $lib_url)), count($gmedia_ids));
304
- echo " ($gal_source)";
305
- }
306
- } else{
307
- $tabs = $gmDB->get_terms($tax_tabs, array('include' => $gallery_tabs));
308
- $terms_source = array();
309
- if('gmedia_category' == $tax_tabs){
310
- _e('Categories', 'grand-media');
311
- foreach($tabs as $t){
312
- $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));
313
- }
314
- } elseif('gmedia_album' == $tax_tabs){
315
- _e('Albums', 'grand-media');
316
- foreach($tabs as $t){
317
- $terms_source[] = sprintf('<a class="gm_album" target="_blank" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $t->term_id), $lib_url)), esc_html($t->name));
318
- }
319
- } elseif('gmedia_tag' == $tax_tabs){
320
- _e('Tags', 'grand-media');
321
- foreach($tabs as $t){
322
- $terms_source[] = sprintf('<a class="gm_tag" target="_blank" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $t->term_id), $lib_url)), esc_html($t->name));
323
- }
324
- }
325
- if(!empty($terms_source)){
326
- $terms_source = join(', ', $terms_source);
327
- if(((int)$term->global != $user_ID) && !current_user_can('gmedia_show_others_media')){
328
- $terms_source = strip_tags($terms_source);
329
- }
330
- echo " ({$terms_source})";
331
- }
332
- }
333
- ?>
334
  </p>
335
  <?php if(current_user_can('gmedia_gallery_manage')){
336
  if(!(((int)$term->global != $user_ID) && !current_user_can('gmedia_edit_others_media'))){
337
  ?>
338
  <p class="media-meta hidden"><a target="_blank" href="<?php echo add_query_arg(array('page' => 'GrandMedia_Galleries',
339
- 'edit_item' => $term->term_id
340
  ), admin_url('admin.php')); ?>"><?php _e('Edit gallery', 'grand-media'); ?></a></p>
341
  <?php
342
  }
@@ -523,7 +485,7 @@ function gmedia_add_media_terms(){
523
  if('gmedia_album' == $taxonomy){
524
  $term_meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
525
  $term_meta = array_map('reset', $term_meta);
526
- $term_meta = array_merge(array('_orderby' => 'ID', '_order' => 'DESC'), $term_meta);
527
  $args = array('no_found_rows' => true,
528
  'per_page' => $per_page,
529
  'album__in' => array($item->term_id),
@@ -531,6 +493,17 @@ function gmedia_add_media_terms(){
531
  'orderby' => $term_meta['_orderby'],
532
  'order' => $term_meta['_order']
533
  );
 
 
 
 
 
 
 
 
 
 
 
534
  } elseif('gmedia_tag' == $taxonomy){
535
  $args = array('no_found_rows' => true,
536
  'per_page' => $per_page,
@@ -539,24 +512,35 @@ function gmedia_add_media_terms(){
539
  'orderby' => $gmGallery->options['in_tag_orderby'],
540
  'order' => $gmGallery->options['in_tag_order']
541
  );
542
- } elseif('gmedia_category' == $taxonomy){
543
- $args = array('no_found_rows' => true,
544
- 'per_page' => $per_page,
545
- 'category__in' => $item->term_id,
546
- 'author' => $author,
547
- 'orderby' => $gmGallery->options['in_category_orderby'],
548
- 'order' => $gmGallery->options['in_category_order']
549
- );
550
  }
551
  $termItems = $gmDB->get_gmedias($args);
552
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  ?>
554
  <div class="list-group-item term-list-item d-row<?php echo $list_row_class; ?>">
555
  <div class="row<?php echo $row_class; ?>">
556
- <div class="term_id">#<?php echo $item->term_id; ?></div>
557
  <div class="col-xs-5 term-label">
558
  <div class="no-checkbox">
559
- <strong class="term_name"><?php echo esc_html($item_name); ?></strong>
560
  <span class="term_info_author"><?php echo $author_name; ?></span>
561
  <span class="badge pull-right"><?php echo $item->count; ?></span>
562
  </div>
@@ -569,7 +553,7 @@ function gmedia_add_media_terms(){
569
  <img style="z-index:<?php echo $per_page --; ?>;"
570
  src="<?php echo $gmCore->gm_get_media_image($i, 'thumb', false); ?>"
571
  alt="<?php echo $i->ID; ?>"
572
- title="<?php echo esc_attr($i->title); ?>"/>
573
  <?php
574
  }
575
  }
@@ -589,9 +573,9 @@ function gmedia_add_media_terms(){
589
  'gmedia_tag' => __('Tag', 'grand-media'),
590
  'gmedia_category' => __('Category', 'grand-media')
591
  );
592
- $lib_arg = array('gmedia_album' => 'alb',
593
- 'gmedia_tag' => 'tag_id',
594
- 'gmedia_category' => 'cat'
595
  );
596
  ?>
597
  <input type="hidden" name="taxonomy" value="<?php echo $taxonomy; ?>"/>
@@ -599,7 +583,7 @@ function gmedia_add_media_terms(){
599
 
600
  <p><strong><?php echo $tax_name[ $taxonomy ]; ?>:</strong> <?php echo esc_html($item_name); ?>
601
  <br/><strong><?php _e('ID', 'grand-media'); ?>:</strong> <?php echo $item->term_id; ?>
602
- <?php if('gmedia_album' == $taxonomy){
603
  $orderby = array('custom' => __('user defined', 'grand-media'),
604
  'ID' => __('by ID', 'grand-media'),
605
  'title' => __('by title', 'grand-media'),
@@ -610,19 +594,26 @@ function gmedia_add_media_terms(){
610
  ); ?>
611
  <br/><strong><?php _e('Order', 'grand-media'); ?>:</strong> <?php echo $orderby[ $term_meta['_orderby'] ]; ?>
612
  <br/><strong><?php _e('Sort order', 'grand-media'); ?>:</strong> <?php echo $term_meta['_order']; ?>
613
- <br/><strong><?php _e('Status', 'grand-media'); ?>:</strong> <?php echo $item->status; ?>
 
614
  <br/><strong><?php _e('Author', 'grand-media'); ?>:</strong> <?php echo $owner; ?>
 
615
  <?php } ?>
 
616
  </p>
617
 
618
  <p>
619
  <a href="<?php echo add_query_arg(array('page' => 'GrandMedia',
620
  $lib_arg[ $taxonomy ] => $item->term_id
621
- ), admin_url('admin.php')); ?>" target="_blank"><?php _e('Open in Gmedia Library', 'grand-media'); ?></a>
622
  <?php if(('gmedia_album' == $taxonomy) && $allow_edit){ ?>
623
  &nbsp; | &nbsp; <a href="<?php echo add_query_arg(array('page' => 'GrandMedia_Albums',
624
- 'edit_item' => $item->term_id
625
  ), admin_url('admin.php')); ?>" target="_blank"><?php _e('Edit Album', 'grand-media'); ?></a>
 
 
 
 
626
  <?php } ?>
627
  </p>
628
  </div>
@@ -790,7 +781,7 @@ function gmedia_add_media_library(){
790
 
791
  <div class="form-group">
792
  <label><?php _e('Title', 'grand-media'); ?></label>
793
- <input name="title" type="text" class="form-control input-sm" placeholder="<?php _e('Title', 'grand-media'); ?>" value="<?php echo esc_attr($item->title); ?>">
794
  </div>
795
  <div class="form-group">
796
  <label><?php _e('Link To', 'grand-media'); ?></label>
@@ -805,7 +796,7 @@ function gmedia_add_media_library(){
805
  </div>
806
  <div class="form-group">
807
  <label><?php _e('Description', 'grand-media'); ?></label>
808
- <textarea name="description" class="form-control input-sm" rows="4" cols="10"><?php echo esc_html($item->description); ?></textarea>
809
  </div>
810
  <?php //if($is_webimage){
811
  ?>
@@ -1043,7 +1034,7 @@ function gmedia_add_media_upload(){
1043
  });
1044
  uploader.bind('UploadComplete', function(up, files) {
1045
  console.log('[UploadComplete]', files);
1046
- $('<div></div>').addClass('alert alert-success alert-dismissable').html(closebtn + "<?php echo esc_attr(__('Upload finished', 'grand-media')); ?>").appendTo('#gmedia-msg-panel');
1047
  $('#total-progress-info .progress-bar').css('width', '0').attr('aria-valuenow', '0');
1048
  });
1049
 
@@ -1152,7 +1143,7 @@ function gmedia_add_media_upload(){
1152
  <?php } ?>
1153
  delimiter: ',',
1154
  maxItems: null,
1155
- openOnFocus: false,
1156
  persist: false,
1157
  options: cat_items,
1158
  labelField: 'item',
@@ -1179,7 +1170,7 @@ function gmedia_add_media_upload(){
1179
  <?php } ?>
1180
  delimiter: ',',
1181
  maxItems: null,
1182
- openOnFocus: false,
1183
  persist: false,
1184
  options: tag_items,
1185
  labelField: 'item',
280
 
281
  <p class="media-meta clear hidden">
282
  <span class="clearfix">
283
+ <span class="media-object pull-left" style="width:85px;margin-right:5px;">
284
  <?php if(!$broken){ ?>
285
+ <span class="thumbnail"><img src="<?php echo $module['url'] . '/screenshot.png'; ?>" alt="<?php esc_attr_e($term->name); ?>"/></span>
286
  <?php } else{ ?>
287
  <span class="bg-danger text-center"><?php _e('Module broken. Reinstall module', 'grand-media') ?></span>
288
  <?php } ?>
292
  <br><span class="label label-default"><?php _e('Status', 'grand-media'); ?>:</span> <?php echo $term->status; ?>
293
  </span>
294
  <span class="label label-default"><?php _e('Last Edited', 'grand-media'); ?>:</span> <?php echo $term_meta['_edited']; ?>
295
+ <br><span class="label label-default"><?php _e('Query Args.', 'grand-media'); ?>:</span> <?php echo !empty($term_meta['_query'])? str_replace(',"', ', "', json_encode($term_meta['_query'])) : ''; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  </p>
297
  <?php if(current_user_can('gmedia_gallery_manage')){
298
  if(!(((int)$term->global != $user_ID) && !current_user_can('gmedia_edit_others_media'))){
299
  ?>
300
  <p class="media-meta hidden"><a target="_blank" href="<?php echo add_query_arg(array('page' => 'GrandMedia_Galleries',
301
+ 'edit_term' => $term->term_id
302
  ), admin_url('admin.php')); ?>"><?php _e('Edit gallery', 'grand-media'); ?></a></p>
303
  <?php
304
  }
485
  if('gmedia_album' == $taxonomy){
486
  $term_meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
487
  $term_meta = array_map('reset', $term_meta);
488
+ $term_meta = array_merge(array('_orderby' => $gmGallery->options['in_album_orderby'], '_order' => $gmGallery->options['in_album_order']), $term_meta);
489
  $args = array('no_found_rows' => true,
490
  'per_page' => $per_page,
491
  'album__in' => array($item->term_id),
493
  'orderby' => $term_meta['_orderby'],
494
  'order' => $term_meta['_order']
495
  );
496
+ } elseif('gmedia_category' == $taxonomy){
497
+ $term_meta = $gmDB->get_metadata('gmedia_term', $item->term_id);
498
+ $term_meta = array_map('reset', $term_meta);
499
+ $term_meta = array_merge(array('_orderby' => $gmGallery->options['in_category_orderby'], '_order' => $gmGallery->options['in_category_order']), $term_meta);
500
+ $args = array('no_found_rows' => true,
501
+ 'per_page' => $per_page,
502
+ 'category__in' => $item->term_id,
503
+ 'author' => $author,
504
+ 'orderby' => $term_meta['_orderby'],
505
+ 'order' => $term_meta['_order']
506
+ );
507
  } elseif('gmedia_tag' == $taxonomy){
508
  $args = array('no_found_rows' => true,
509
  'per_page' => $per_page,
512
  'orderby' => $gmGallery->options['in_tag_orderby'],
513
  'order' => $gmGallery->options['in_tag_order']
514
  );
 
 
 
 
 
 
 
 
515
  }
516
  $termItems = $gmDB->get_gmedias($args);
517
  }
518
+ if('gmedia_tag' != $taxonomy){
519
+ $_module_preset = isset($term_meta['_module_preset'][0])? $term_meta['_module_preset'][0] : $gmGallery->options['default_gmedia_module'];
520
+ } else{
521
+ $_module_preset = $gmGallery->options['default_gmedia_module'];
522
+ }
523
+ $by_author = '';
524
+ $preset_name = __('Default Settings');
525
+ if($gmCore->is_digit($_module_preset)){
526
+ $preset = $gmDB->get_term($_module_preset);
527
+ $mfold = $preset->status;
528
+ if((int)$preset->global){
529
+ $by_author = ' [' . get_the_author_meta('display_name', $preset->global) . ']';
530
+ }
531
+ if('[' . $mfold . ']' !== $preset->name){
532
+ $preset_name = str_replace('[' . $mfold . '] ', '', $preset->name);
533
+ }
534
+ } else {
535
+ $mfold = $_module_preset;
536
+ }
537
+ $module_preset = $gmedia_modules['in'][ $mfold ]['title'] . $by_author . ' - ' . $preset_name;
538
  ?>
539
  <div class="list-group-item term-list-item d-row<?php echo $list_row_class; ?>">
540
  <div class="row<?php echo $row_class; ?>">
 
541
  <div class="col-xs-5 term-label">
542
  <div class="no-checkbox">
543
+ <span class="term_name"><?php echo esc_html($item_name); ?></span>
544
  <span class="term_info_author"><?php echo $author_name; ?></span>
545
  <span class="badge pull-right"><?php echo $item->count; ?></span>
546
  </div>
553
  <img style="z-index:<?php echo $per_page --; ?>;"
554
  src="<?php echo $gmCore->gm_get_media_image($i, 'thumb', false); ?>"
555
  alt="<?php echo $i->ID; ?>"
556
+ title="<?php esc_attr_e($i->title); ?>"/>
557
  <?php
558
  }
559
  }
573
  'gmedia_tag' => __('Tag', 'grand-media'),
574
  'gmedia_category' => __('Category', 'grand-media')
575
  );
576
+ $lib_arg = array('gmedia_album' => 'album__in',
577
+ 'gmedia_tag' => 'tag__in',
578
+ 'gmedia_category' => 'category__in'
579
  );
580
  ?>
581
  <input type="hidden" name="taxonomy" value="<?php echo $taxonomy; ?>"/>
583
 
584
  <p><strong><?php echo $tax_name[ $taxonomy ]; ?>:</strong> <?php echo esc_html($item_name); ?>
585
  <br/><strong><?php _e('ID', 'grand-media'); ?>:</strong> <?php echo $item->term_id; ?>
586
+ <?php if('gmedia_tag' != $taxonomy){
587
  $orderby = array('custom' => __('user defined', 'grand-media'),
588
  'ID' => __('by ID', 'grand-media'),
589
  'title' => __('by title', 'grand-media'),
594
  ); ?>
595
  <br/><strong><?php _e('Order', 'grand-media'); ?>:</strong> <?php echo $orderby[ $term_meta['_orderby'] ]; ?>
596
  <br/><strong><?php _e('Sort order', 'grand-media'); ?>:</strong> <?php echo $term_meta['_order']; ?>
597
+ <?php if('gmedia_album' == $taxonomy){ ?>
598
+ <br/><strong><?php _e('Status', 'grand-media'); ?>:</strong> <?php echo $item->status; ?>
599
  <br/><strong><?php _e('Author', 'grand-media'); ?>:</strong> <?php echo $owner; ?>
600
+ <?php } ?>
601
  <?php } ?>
602
+ <br/><strong><?php _e('Module/Preset', 'grand-media'); ?>:</strong> <?php echo $module_preset; ?>
603
  </p>
604
 
605
  <p>
606
  <a href="<?php echo add_query_arg(array('page' => 'GrandMedia',
607
  $lib_arg[ $taxonomy ] => $item->term_id
608
+ ), admin_url('admin.php')); ?>" target="_blank"><?php _e('View in Gmedia Library', 'grand-media'); ?></a>
609
  <?php if(('gmedia_album' == $taxonomy) && $allow_edit){ ?>
610
  &nbsp; | &nbsp; <a href="<?php echo add_query_arg(array('page' => 'GrandMedia_Albums',
611
+ 'edit_term' => $item->term_id
612
  ), admin_url('admin.php')); ?>" target="_blank"><?php _e('Edit Album', 'grand-media'); ?></a>
613
+ <?php } elseif(('gmedia_category' == $taxonomy) && $allow_edit){ ?>
614
+ &nbsp; | &nbsp; <a href="<?php echo add_query_arg(array('page' => 'GrandMedia_Categories',
615
+ 'edit_term' => $item->term_id
616
+ ), admin_url('admin.php')); ?>" target="_blank"><?php _e('Edit Category', 'grand-media'); ?></a>
617
  <?php } ?>
618
  </p>
619
  </div>
781
 
782
  <div class="form-group">
783
  <label><?php _e('Title', 'grand-media'); ?></label>
784
+ <input name="title" type="text" class="form-control input-sm" placeholder="<?php _e('Title', 'grand-media'); ?>" value="<?php esc_attr_e($item->title); ?>">
785
  </div>
786
  <div class="form-group">
787
  <label><?php _e('Link To', 'grand-media'); ?></label>
796
  </div>
797
  <div class="form-group">
798
  <label><?php _e('Description', 'grand-media'); ?></label>
799
+ <textarea name="description" class="form-control input-sm" rows="4" cols="10"><?php echo esc_textarea($item->description); ?></textarea>
800
  </div>
801
  <?php //if($is_webimage){
802
  ?>
1034
  });
1035
  uploader.bind('UploadComplete', function(up, files) {
1036
  console.log('[UploadComplete]', files);
1037
+ $('<div></div>').addClass('alert alert-success alert-dismissable').html(closebtn + "<?php esc_attr_e(__('Upload finished', 'grand-media')); ?>").appendTo('#gmedia-msg-panel');
1038
  $('#total-progress-info .progress-bar').css('width', '0').attr('aria-valuenow', '0');
1039
  });
1040
 
1143
  <?php } ?>
1144
  delimiter: ',',
1145
  maxItems: null,
1146
+ openOnFocus: true,
1147
  persist: false,
1148
  options: cat_items,
1149
  labelField: 'item',
1170
  <?php } ?>
1171
  delimiter: ',',
1172
  maxItems: null,
1173
+ openOnFocus: true,
1174
  persist: false,
1175
  options: tag_items,
1176
  labelField: 'item',
inc/module.options.php CHANGED
@@ -85,7 +85,7 @@ function gmedia_gallery_options_formgroup($args) {
85
  ?>
86
  <div class="form-group" id="div_<?php echo $id; ?>">
87
  <label><?php echo $field['label']; ?></label>
88
- <input <?php echo $field['attr']; ?> id="<?php echo $id; ?>" class="form-control input-sm" name="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" data-value="<?php echo $default; ?>" placeholder="<?php echo $default; ?>"/>
89
  <?php if(!empty($field['text'])) {
90
  echo "<p class='help-block'>{$field['text']}</p>";
91
  } ?>
@@ -106,7 +106,7 @@ function gmedia_gallery_options_formgroup($args) {
106
  <label><?php echo $field['label']; ?></label>
107
  <select <?php echo $field['attr']; ?> id="<?php echo $id; ?>" class="form-control input-sm" name="<?php echo $name; ?>" data-value="<?php echo $default; ?>">
108
  <?php foreach($field['choices'] as $choice) { ?>
109
- <option value="<?php echo esc_attr($choice['value']); ?>" <?php echo selected($value, $choice['value']); ?>><?php echo $choice['label']; ?></option>
110
  <?php } ?>
111
  </select>
112
  <?php if(!empty($field['text'])) {
@@ -116,7 +116,7 @@ function gmedia_gallery_options_formgroup($args) {
116
  <?php } elseif('textarea' == $field['tag']) { ?>
117
  <div class="form-group" id="div_<?php echo $id; ?>">
118
  <label><?php echo $field['label']; ?></label>
119
- <textarea <?php echo $field['attr']; ?> id="<?php echo $id; ?>" class="form-control input-sm" name="<?php echo $name; ?>"><?php echo esc_html($value); ?></textarea>
120
  <?php if(!empty($field['text'])) {
121
  echo "<p class='help-block'>{$field['text']}</p>";
122
  } ?>
85
  ?>
86
  <div class="form-group" id="div_<?php echo $id; ?>">
87
  <label><?php echo $field['label']; ?></label>
88
+ <input <?php echo $field['attr']; ?> id="<?php echo $id; ?>" class="form-control input-sm" name="<?php echo $name; ?>" value="<?php esc_attr_e($value); ?>" data-value="<?php echo $default; ?>" placeholder="<?php echo $default; ?>"/>
89
  <?php if(!empty($field['text'])) {
90
  echo "<p class='help-block'>{$field['text']}</p>";
91
  } ?>
106
  <label><?php echo $field['label']; ?></label>
107
  <select <?php echo $field['attr']; ?> id="<?php echo $id; ?>" class="form-control input-sm" name="<?php echo $name; ?>" data-value="<?php echo $default; ?>">
108
  <?php foreach($field['choices'] as $choice) { ?>
109
+ <option value="<?php esc_attr_e($choice['value']); ?>" <?php echo selected($value, $choice['value']); ?>><?php echo $choice['label']; ?></option>
110
  <?php } ?>
111
  </select>
112
  <?php if(!empty($field['text'])) {
116
  <?php } elseif('textarea' == $field['tag']) { ?>
117
  <div class="form-group" id="div_<?php echo $id; ?>">
118
  <label><?php echo $field['label']; ?></label>
119
+ <textarea <?php echo $field['attr']; ?> id="<?php echo $id; ?>" class="form-control input-sm" name="<?php echo $name; ?>"><?php echo esc_textarea($value); ?></textarea>
120
  <?php if(!empty($field['text'])) {
121
  echo "<p class='help-block'>{$field['text']}</p>";
122
  } ?>
inc/permalinks.php CHANGED
@@ -183,7 +183,7 @@ class gmediaPermalinks {
183
  define('GMEDIACLOUD_PAGE', true);
184
 
185
  /** @noinspection PhpIncludeInspection */
186
- require_once(GMEDIA_ABSPATH . "/load-template.php");
187
 
188
  exit();
189
 
@@ -200,7 +200,7 @@ class gmediaPermalinks {
200
  $wp_query->is_search = false;
201
  $wp_query->is_home = false;
202
 
203
- $template = GMEDIA_ABSPATH . "/app/access.php";
204
 
205
  load_template($template, false);
206
  exit();
183
  define('GMEDIACLOUD_PAGE', true);
184
 
185
  /** @noinspection PhpIncludeInspection */
186
+ require_once(GMEDIA_ABSPATH . "load-template.php");
187
 
188
  exit();
189
 
200
  $wp_query->is_search = false;
201
  $wp_query->is_home = false;
202
 
203
+ $template = GMEDIA_ABSPATH . "app/access.php";
204
 
205
  load_template($template, false);
206
  exit();
inc/post-metabox.php CHANGED
@@ -191,7 +191,7 @@ function gmedia_post_metabox() {
191
  </div>
192
  </div>
193
  <div class="gmedia-selector"></div>
194
- <a href="<?php echo admin_url( "admin.php?page=GrandMedia_Galleries&amp;edit_item=" . $item->term_id ); ?>"
195
  title="Edit Gallery #<?php echo $item->term_id; ?> in New Window" target="_blank" class="gmedia-gallery-gear"><?php _e( 'edit', 'grand-media' ); ?></a>
196
  </li>
197
  <?php
191
  </div>
192
  </div>
193
  <div class="gmedia-selector"></div>
194
+ <a href="<?php echo admin_url( "admin.php?page=GrandMedia_Galleries&amp;edit_term=" . $item->term_id ); ?>"
195
  title="Edit Gallery #<?php echo $item->term_id; ?> in New Window" target="_blank" class="gmedia-gallery-gear"><?php _e( 'edit', 'grand-media' ); ?></a>
196
  </li>
197
  <?php
inc/shortcodes.php CHANGED
@@ -48,7 +48,7 @@ function gmedia_term_shortcode($atts, $content = ''){
48
  */
49
  function gmedia_shortcode($atts, $content = ''){
50
  global $gmDB, $gmGallery, $gmCore;
51
- global $gmedia_shortcode_instance;
52
 
53
  /**
54
  * @var $id
@@ -126,16 +126,6 @@ function gmedia_shortcode($atts, $content = ''){
126
  $module = $preview_module;
127
  }
128
 
129
- $module = $gmCore->get_module_path($module);
130
- if(!$module || !file_exists($module['path'] . '/index.php') || !file_exists($module['path'] . '/settings.php')){
131
- return '<div class="gmedia_gallery gmediaShortcodeError" data-id="' . $id . '" data-error="' . $_module . ': folder missed or module broken">' . $content . '</div>';
132
- }
133
-
134
- if($_module !== $module['name']){
135
- $_module = $module['name'];
136
- $settings = array($_module => array());
137
- }
138
-
139
  $gallery = array();
140
  if(!$id){
141
  $string2hash = json_encode(array($_module => $query));
@@ -147,6 +137,16 @@ function gmedia_shortcode($atts, $content = ''){
147
  );
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
150
  include($module['path'] . '/index.php');
151
  include($module['path'] . '/settings.php');
152
 
@@ -170,7 +170,7 @@ function gmedia_shortcode($atts, $content = ''){
170
  $query = array_merge(apply_filters('gmedia_shortcode_query', $query, $id), $protected_query_args);
171
 
172
  $gmGallery->do_module[ $_module ] = $module;
173
- $gmGallery->shortcode = compact('id', 'query', 'module', 'settings', 'term');
174
 
175
  $customCSS = (isset($settings['customCSS']) && ('' !== trim($settings['customCSS'])))? $settings['customCSS'] : '';
176
  unset($settings['customCSS']);
@@ -243,7 +243,7 @@ function gmedia_shortcode($atts, $content = ''){
243
  }
244
 
245
  if(0 === count($gmedia)){
246
- return '<div class="gmedia_gallery gmedia_gallery_empty">' . __('Gallery is empty') . '<br />' . $content . '</div>';
247
  }
248
  }
249
 
@@ -262,6 +262,25 @@ function gmedia_shortcode($atts, $content = ''){
262
  if(!empty($atts['class'])){
263
  $sc_classes .= ' ' . esc_attr($atts['class']);
264
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  $sc_id = str_replace(' ', '_', "GmediaGallery_{$id}");
266
 
267
  if(!empty($atts['style'])){
@@ -270,7 +289,7 @@ function gmedia_shortcode($atts, $content = ''){
270
 
271
  do_action('pre_gmedia_shortcode');
272
 
273
- $out = '<div class="' . $sc_classes . '" id="' . $sc_id . '" data-gallery="' . esc_attr($id) . '" data-module="' . $_module . '"' . $sc_styles . '>';
274
  $out .= $content;
275
 
276
  ob_start();
@@ -286,6 +305,10 @@ function gmedia_shortcode($atts, $content = ''){
286
  $out .= $module_content;
287
  $out .= '</div>';
288
 
 
 
 
 
289
  do_action('gmedia_shortcode');
290
 
291
  if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
@@ -363,7 +386,6 @@ function gmedia_raw_shortcode($atts, $content = ''){
363
  $shortcode_atts .= " {$key}='{$value}'";
364
  }
365
  if(!$noraw){
366
- //return "[raw]".gmedia_shortcode($atts, $content)."[/raw]";
367
  return "[raw][gmedia{$shortcode_atts}]{$content}[/gmedia][/raw]";
368
  } else{
369
  return "[gmedia{$shortcode_atts}]{$content}[/gmedia]";
48
  */
49
  function gmedia_shortcode($atts, $content = ''){
50
  global $gmDB, $gmGallery, $gmCore;
51
+ global $gmedia_shortcode_instance, $gmedia_shortcode_ids;
52
 
53
  /**
54
  * @var $id
126
  $module = $preview_module;
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
129
  $gallery = array();
130
  if(!$id){
131
  $string2hash = json_encode(array($_module => $query));
137
  );
138
  }
139
 
140
+ $module = $gmCore->get_module_path($module);
141
+ if(!$module || !file_exists($module['path'] . '/index.php') || !file_exists($module['path'] . '/settings.php')){
142
+ return '<div class="gmedia_gallery gmediaShortcodeError" data-gmid="' . $id . '" data-error="' . $_module . ': folder missed or module broken">' . $content . '</div>';
143
+ }
144
+
145
+ if($_module !== $module['name']){
146
+ $_module = $module['name'];
147
+ $settings = array($_module => array());
148
+ }
149
+
150
  include($module['path'] . '/index.php');
151
  include($module['path'] . '/settings.php');
152
 
170
  $query = array_merge(apply_filters('gmedia_shortcode_query', $query, $id), $protected_query_args);
171
 
172
  $gmGallery->do_module[ $_module ] = $module;
173
+ $gmGallery->shortcode[ $id ] = compact('id', 'query', 'module', 'settings', 'term');
174
 
175
  $customCSS = (isset($settings['customCSS']) && ('' !== trim($settings['customCSS'])))? $settings['customCSS'] : '';
176
  unset($settings['customCSS']);
243
  }
244
 
245
  if(0 === count($gmedia)){
246
+ return '<div class="gmedia_gallery gmedia_gallery_empty" data-gmid="' . esc_attr($id) . '" data-module="' . $_module . '">' . __('Gallery is empty') . '<br />' . $content . '</div>';
247
  }
248
  }
249
 
262
  if(!empty($atts['class'])){
263
  $sc_classes .= ' ' . esc_attr($atts['class']);
264
  }
265
+
266
+ $sc_duplicate = 0;
267
+ if(empty($gmedia_shortcode_ids)){
268
+ $gmedia_shortcode_ids[] = (string)$id;
269
+ } else{
270
+ if(in_array($id, $gmedia_shortcode_ids)){
271
+ $sc_duplicate = 1;
272
+ while(true){
273
+ if(in_array("{$id}_{$sc_duplicate}", $gmedia_shortcode_ids)){
274
+ $sc_duplicate ++;
275
+ } else{
276
+ $gmedia_shortcode_ids[] = "{$id}_{$sc_duplicate}";
277
+ break;
278
+ }
279
+ }
280
+ } else{
281
+ $gmedia_shortcode_ids[] = (string)$id;
282
+ }
283
+ }
284
  $sc_id = str_replace(' ', '_', "GmediaGallery_{$id}");
285
 
286
  if(!empty($atts['style'])){
289
 
290
  do_action('pre_gmedia_shortcode');
291
 
292
+ $out = '<div class="' . $sc_classes . '" id="' . $sc_id . '" data-gmid="' . esc_attr($id) . '" data-module="' . $_module . '"' . $sc_styles . '>';
293
  $out .= $content;
294
 
295
  ob_start();
305
  $out .= $module_content;
306
  $out .= '</div>';
307
 
308
+ if($sc_duplicate){
309
+ $out = str_replace($sc_id, "{$sc_id}_{$sc_duplicate}", $out);
310
+ }
311
+
312
  do_action('gmedia_shortcode');
313
 
314
  if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
386
  $shortcode_atts .= " {$key}='{$value}'";
387
  }
388
  if(!$noraw){
 
389
  return "[raw][gmedia{$shortcode_atts}]{$content}[/gmedia][/raw]";
390
  } else{
391
  return "[gmedia{$shortcode_atts}]{$content}[/gmedia]";
inc/sitemap.php CHANGED
@@ -49,19 +49,21 @@ class gmediaSitemaps{
49
  // Search now for shortcodes
50
  do_shortcode($content);
51
 
52
- if(isset($gmGallery->shortcode['query'])){
53
- $query = array_merge($gmGallery->shortcode['query'], array('status' => 'publish', 'mime_type' => 'image'));
54
- $gmedias = $gmDB->get_gmedias($query);
55
- foreach($gmedias as $item){
56
- $newimage = array();
57
- $newimage['src'] = $gmCore->gm_get_media_image($item, 'web');
58
- if(!empty($item->title)){
59
- $newimage['title'] = strip_tags($item->title);
 
 
 
 
 
 
60
  }
61
- if(!empty($item->description)){
62
- $newimage['alt'] = strip_tags($item->description);
63
- }
64
- $this->images[] = $newimage;
65
  }
66
  }
67
 
49
  // Search now for shortcodes
50
  do_shortcode($content);
51
 
52
+ if(count($gmGallery->shortcode)){
53
+ foreach($gmGallery->shortcode as $gmedia_shortcode){
54
+ $query = array_merge($gmedia_shortcode['query'], array('status' => 'publish', 'mime_type' => 'image'));
55
+ $gmedias = $gmDB->get_gmedias($query);
56
+ foreach($gmedias as $item){
57
+ $newimage = array();
58
+ $newimage['src'] = $gmCore->gm_get_media_image($item, 'web');
59
+ if(!empty($item->title)){
60
+ $newimage['title'] = strip_tags($item->title);
61
+ }
62
+ if(!empty($item->description)){
63
+ $newimage['alt'] = strip_tags($item->description);
64
+ }
65
+ $this->images[] = $newimage;
66
  }
 
 
 
 
67
  }
68
  }
69
 
inc/widget.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adds Gmedia Widgets.
5
+ */
6
+
7
+ class GrandMedia_Gallery_Widget extends WP_Widget{
8
+
9
+ /**
10
+ * Register widget with WordPress.
11
+ */
12
+ function __construct(){
13
+ parent::__construct('gmedia_gallery_widget', // Base ID
14
+ esc_html__('Gmedia Gallery', 'grand-media'), // Name
15
+ array('description' => esc_html__('Display Gmedia Gallery in the widget', 'grand-media'),) // Args
16
+ );
17
+ }
18
+
19
+ /**
20
+ * Front-end display of widget.
21
+ * @see WP_Widget::widget()
22
+ *
23
+ * @param array $args Widget arguments.
24
+ * @param array $instance Saved values from database.
25
+ */
26
+ public function widget($args, $instance){
27
+ if(empty($instance['term_id'])){
28
+ global $gmDB;
29
+ $term_id = $gmDB->get_terms('gmedia_gallery', array('status' => array('publish'), 'fields' => 'ids', 'number' => 1, 'orderby' => 'rand'));
30
+ if(empty($term_id)){
31
+ return;
32
+ }
33
+ $instance['term_id'] = $term_id[0];
34
+ }
35
+
36
+ echo $args['before_widget'];
37
+ if(!empty($instance['title'])){
38
+ echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
39
+ }
40
+
41
+ $atts = array('id' => (int)$instance['term_id']);
42
+ echo gmedia_shortcode($atts);
43
+
44
+ echo $args['after_widget'];
45
+ }
46
+
47
+ /**
48
+ * Back-end widget form.
49
+ * @see WP_Widget::form()
50
+ *
51
+ * @param array $instance Previously saved values from database.
52
+ *
53
+ * @return string|void
54
+ */
55
+ public function form($instance){
56
+ global $gmDB;
57
+ $title = !empty($instance['title'])? $instance['title'] : esc_html__('New title', 'grand-media');
58
+ $gmedia_terms = $gmDB->get_terms('gmedia_gallery', array('status' => array('publish', 'private'), 'orderby' => 'name', 'order' => 'ASC'));
59
+ ?>
60
+ <p>
61
+ <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'grand-media'); ?></label>
62
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>">
63
+ </p>
64
+ <p>
65
+ <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Choose Gallery', 'grand-media'); ?>:</label>
66
+ <select class="widefat" id="<?php echo esc_attr($this->get_field_id('term_id')); ?>" name="<?php echo esc_attr($this->get_field_name('term_id')); ?>">
67
+ <option value=""><?php _e('Random Gallery with status "publish"', 'grand-media'); ?></option>
68
+ <?php
69
+ foreach($gmedia_terms as &$item){
70
+ gmedia_gallery_more_data($item);
71
+ $selected = $instance['term_id']? selected($instance['term_id'], $item->term_id, false) : '';
72
+ echo "<option value='{$item->term_id}' {$selected}>{$item->name} [{$item->status}] " . ($item->author_name? sprintf(__('by %s', 'grand-media'), $item->author_name) : '(' . __('deleted author', 'grand-media') . ')') . '</option>';
73
+ }
74
+ ?>
75
+ </select>
76
+ </p>
77
+ <?php
78
+ }
79
+
80
+ /**
81
+ * Sanitize widget form values as they are saved.
82
+ * @see WP_Widget::update()
83
+ *
84
+ * @param array $new_instance Values just sent to be saved.
85
+ * @param array $old_instance Previously saved values from database.
86
+ *
87
+ * @return array Updated safe values to be saved.
88
+ */
89
+ public function update($new_instance, $old_instance){
90
+ $instance = array();
91
+ $instance['title'] = (!empty($new_instance['title']))? strip_tags($new_instance['title']) : '';
92
+ $instance['term_id'] = (!empty($new_instance['term_id']))? (int)$new_instance['term_id'] : '';
93
+
94
+ return $instance;
95
+ }
96
+
97
+ } // class GrandMedia_Gallery_Widget
98
+
99
+ class GrandMedia_Album_Widget extends WP_Widget{
100
+
101
+ /**
102
+ * Register widget with WordPress.
103
+ */
104
+ function __construct(){
105
+ parent::__construct('gmedia_album_widget', // Base ID
106
+ esc_html__('Gmedia Album', 'grand-media'), // Name
107
+ array('description' => esc_html__('Display Gmedia Album in the widget', 'grand-media'),) // Args
108
+ );
109
+ }
110
+
111
+ /**
112
+ * Front-end display of widget.
113
+ * @see WP_Widget::widget()
114
+ *
115
+ * @param array $args Widget arguments.
116
+ * @param array $instance Saved values from database.
117
+ */
118
+ public function widget($args, $instance){
119
+ if(empty($instance['term_id'])){
120
+ global $gmDB;
121
+ $term_id = $gmDB->get_terms('gmedia_album', array('status' => array('publish'), 'fields' => 'ids', 'number' => 1, 'orderby' => 'rand', 'hide_empty' => true));
122
+ if(empty($term_id)){
123
+ return;
124
+ }
125
+ $instance['term_id'] = $term_id[0];
126
+ }
127
+
128
+ echo $args['before_widget'];
129
+ if(!empty($instance['title'])){
130
+ echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
131
+ }
132
+
133
+ $atts = array('id' => (int)$instance['term_id']);
134
+ echo gmedia_shortcode($atts);
135
+
136
+ echo $args['after_widget'];
137
+ }
138
+
139
+ /**
140
+ * Back-end widget form.
141
+ * @see WP_Widget::form()
142
+ *
143
+ * @param array $instance Previously saved values from database.
144
+ *
145
+ * @return string|void
146
+ */
147
+ public function form($instance){
148
+ global $gmDB;
149
+ $title = !empty($instance['title'])? $instance['title'] : esc_html__('New title', 'grand-media');
150
+ $gmedia_terms = $gmDB->get_terms('gmedia_album', array('status' => array('publish', 'private'), 'orderby' => 'name', 'order' => 'ASC'));
151
+ ?>
152
+ <p>
153
+ <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'grand-media'); ?></label>
154
+ <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>">
155
+ </p>
156
+ <p>
157
+ <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Choose Album', 'grand-media'); ?>:</label>
158
+ <select class="widefat" id="<?php echo esc_attr($this->get_field_id('term_id')); ?>" name="<?php echo esc_attr($this->get_field_name('term_id')); ?>">
159
+ <option value=""><?php _e('Random Album with status "publish"', 'grand-media'); ?></option>
160
+ <?php
161
+ foreach($gmedia_terms as &$item){
162
+ gmedia_term_item_more_data($item);
163
+ $selected = $instance['term_id']? selected($instance['term_id'], $item->term_id, false) : '';
164
+ echo "<option value='{$item->term_id}' {$selected}>{$item->name} ({$item->count}) [{$item->status}] " . ($item->author_name? sprintf(__('by %s', 'grand-media'), $item->author_name) : '(' . __('deleted author', 'grand-media') . ')') . '</option>';
165
+ }
166
+ ?>
167
+ </select>
168
+ </p>
169
+ <?php
170
+ }
171
+
172
+ /**
173
+ * Sanitize widget form values as they are saved.
174
+ * @see WP_Widget::update()
175
+ *
176
+ * @param array $new_instance Values just sent to be saved.
177
+ * @param array $old_instance Previously saved values from database.
178
+ *
179
+ * @return array Updated safe values to be saved.
180
+ */
181
+ public function update($new_instance, $old_instance){
182
+ $instance = array();
183
+ $instance['title'] = (!empty($new_instance['title']))? strip_tags($new_instance['title']) : '';
184
+ $instance['term_id'] = (!empty($new_instance['term_id']))? (int)$new_instance['term_id'] : '';
185
+
186
+ return $instance;
187
+ }
188
+
189
+ } // class GrandMedia_Album_Widget
module/afflux/init.php CHANGED
@@ -89,8 +89,8 @@ if (! empty($content)) {
89
  foreach ($cat['data'] as $item) {
90
  $orientation = (1 < $item['thumbsize'][0] / $item['thumbsize'][1]) ? 'landscape' : 'portrait';
91
  ?><div class="gmcatimage gm_<?php echo $i; ?>" id="gmid_<?php echo $item['id']; ?>"><?php
92
- ?><a class="photoswipe" href="<?php echo $settings['libraryUrl'] . $item['image']; ?>" title="<?php echo esc_attr($item['title']); ?>" rel="<?php echo $cat['cID']; ?>" data-id="<?php echo $item['id']; ?>" data-width="<?php echo $item['websize'][0]; ?>" data-height="<?php echo $item['websize'][1]; ?>" data-date="<?php echo $item['date']; ?>"><?php
93
- ?><img class="<?php echo $orientation; ?>" src="<?php echo $settings['libraryUrl'] . $item['thumb']; ?>" alt="<?php echo esc_attr($item['title']); ?>" /><?php
94
  //$views = (intval($item['views']) < 10000) ? $item['views'] : round($item['views']/1000, 1).'k';
95
  //$likes = (intval($item['likes']) < 10000) ? $item['likes'] : round($item['likes']/1000, 1).'k';
96
  //echo '<span class="gmcatimage_counters"><i>'.$views.'</i><b>'.$likes.'</b></span>';
89
  foreach ($cat['data'] as $item) {
90
  $orientation = (1 < $item['thumbsize'][0] / $item['thumbsize'][1]) ? 'landscape' : 'portrait';
91
  ?><div class="gmcatimage gm_<?php echo $i; ?>" id="gmid_<?php echo $item['id']; ?>"><?php
92
+ ?><a class="photoswipe" href="<?php echo $settings['libraryUrl'] . $item['image']; ?>" title="<?php esc_attr_e($item['title']); ?>" rel="<?php echo $cat['cID']; ?>" data-id="<?php echo $item['id']; ?>" data-width="<?php echo $item['websize'][0]; ?>" data-height="<?php echo $item['websize'][1]; ?>" data-date="<?php echo $item['date']; ?>"><?php
93
+ ?><img class="<?php echo $orientation; ?>" src="<?php echo $settings['libraryUrl'] . $item['thumb']; ?>" alt="<?php esc_attr_e($item['title']); ?>" /><?php
94
  //$views = (intval($item['views']) < 10000) ? $item['views'] : round($item['views']/1000, 1).'k';
95
  //$likes = (intval($item['likes']) < 10000) ? $item['likes'] : round($item['likes']/1000, 1).'k';
96
  //echo '<span class="gmcatimage_counters"><i>'.$views.'</i><b>'.$likes.'</b></span>';
module/minima/init.php CHANGED
@@ -87,8 +87,8 @@ if (! empty($content)) {
87
  foreach ($cat['data'] as $item) {
88
  $orientation = (1 < $item['thumbsize'][0] / $item['thumbsize'][1]) ? 'landscape' : 'portrait';
89
  ?><div class="gmcatimage gm_<?php echo $i; ?>" id="gmid_<?php echo $item['pid']; ?>"><?php
90
- ?><a class="photoswipe" href="<?php echo $settings['libraryUrl'] . $item['filename']; ?>" title="<?php echo esc_attr($item['alttext']); ?>" rel="<?php echo $cat['gid']; ?>" data-id="<?php echo $item['pid']; ?>" data-width="<?php echo $item['websize'][0]; ?>" data-height="<?php echo $item['websize'][1]; ?>" data-date="<?php echo $item['date']; ?>"><?php
91
- ?><img class="<?php echo $orientation; ?>" src="<?php echo $settings['libraryUrl'] . $item['thumb']; ?>" alt="<?php echo esc_attr($item['alttext']); ?>" /><?php
92
  //$views = (intval($item['views']) < 10000) ? $item['views'] : round($item['views']/1000, 1).'k';
93
  //$likes = (intval($item['likes']) < 10000) ? $item['likes'] : round($item['likes']/1000, 1).'k';
94
  //echo '<span class="gmcatimage_counters"><i>'.$views.'</i><b>'.$likes.'</b></span>';
87
  foreach ($cat['data'] as $item) {
88
  $orientation = (1 < $item['thumbsize'][0] / $item['thumbsize'][1]) ? 'landscape' : 'portrait';
89
  ?><div class="gmcatimage gm_<?php echo $i; ?>" id="gmid_<?php echo $item['pid']; ?>"><?php
90
+ ?><a class="photoswipe" href="<?php echo $settings['libraryUrl'] . $item['filename']; ?>" title="<?php esc_attr_e($item['alttext']); ?>" rel="<?php echo $cat['gid']; ?>" data-id="<?php echo $item['pid']; ?>" data-width="<?php echo $item['websize'][0]; ?>" data-height="<?php echo $item['websize'][1]; ?>" data-date="<?php echo $item['date']; ?>"><?php
91
+ ?><img class="<?php echo $orientation; ?>" src="<?php echo $settings['libraryUrl'] . $item['thumb']; ?>" alt="<?php esc_attr_e($item['alttext']); ?>" /><?php
92
  //$views = (intval($item['views']) < 10000) ? $item['views'] : round($item['views']/1000, 1).'k';
93
  //$likes = (intval($item['likes']) < 10000) ? $item['likes'] : round($item['likes']/1000, 1).'k';
94
  //echo '<span class="gmcatimage_counters"><i>'.$views.'</i><b>'.$likes.'</b></span>';
module/phantom/css/style.css CHANGED
@@ -1,6 +1,17 @@
1
  @charset "utf-8";
2
  body.gmPhantom_zoom * { -webkit-user-select:none; }
3
- .phantom_module { position:relative; }
 
 
 
 
 
 
 
 
 
 
 
4
  .gmPhantom_Container * { -moz-box-sizing:content-box; box-sizing:content-box; }
5
  .gmPhantom_Container {
6
  direction:ltr;
@@ -9,8 +20,10 @@ body.gmPhantom_zoom * { -webkit-user-select:none; }
9
  padding:0;
10
  position:relative;
11
  height:auto;
 
12
  z-index:0;
13
  opacity:1;
 
14
  -moz-transition:opacity 1s;
15
  -webkit-transition:opacity 1s;
16
  -o-transition:opacity 1s;
@@ -19,81 +32,99 @@ body.gmPhantom_zoom * { -webkit-user-select:none; }
19
  -webkit-transform:translateZ(0);
20
  -moz-transform:translateZ(0);
21
  transform:translateZ(0);
 
22
  }
23
- .gmPhantom_Container.delay {
24
- opacity:0;
25
  }
26
-
27
  div.gmPhantom_Container img {
28
  border:medium none;
29
  margin:0;
30
  padding:0;
31
  }
32
- .gmPhantom_Background {
33
- margin:0;
34
- padding:0;
35
- position:absolute;
36
- left:0; top:0; right:0; bottom:0;
37
- z-index:0;
38
- }
39
  .gmPhantom_thumbsWrapper {
 
40
  background:none repeat scroll 0 0 transparent;
41
  height:auto;
42
- margin:0 auto;
43
  text-align:left;
44
- overflow:hidden;
45
- padding:0;
46
- position:relative;
47
  z-index:2;
 
 
 
48
  }
49
- .gmPhantom_pagination {
50
- position: relative;
51
- z-index: 1;
52
- padding: 5px 0;
53
- }
54
- .gmPhantom_pagination a{
55
- text-decoration: none;
56
- display: inline-block;
57
- padding: 2px;
58
- border: 1px solid #ccc;
59
- color: #000;
60
- background-color: rgba(0,0,0,0.1);
61
- margin: 0 5px;
62
- }
63
- .gmPhantom_ThumbContainer {
64
  cursor:pointer;
65
  float:left;
66
- margin:0;
67
- padding:5px;
68
- width:160px;
69
- height:120px;
70
  position:relative;
71
  border: 1px solid #cccccc;
72
  background-color:#ffffff;
73
- box-shadow: 0 0 5px -2px;
74
  overflow:hidden;
 
75
  background:url(../img/loader.gif) -100% -100% no-repeat;
76
  }
77
- .gmPhantom_MobileView .gmPhantom_ThumbContainer {
78
- width:96px;
79
- height:72px;
 
 
 
 
80
  }
81
- .gmPhantom_ThumbContainer.gmPhantom_ThumbLoader {
 
82
  background-position:50% 50%;
83
  }
84
- .gmPhantom_Thumb {
 
 
 
 
85
  display:block;
86
- outline:none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  margin:0;
88
  overflow:hidden;
89
  padding:0;
90
- position:static;
91
  width:100%; height:100%;
92
  -webkit-transition:0.2s; transition:0.2s;
93
- -webkit-transition-property: all !important;
94
- transition-property: all !important;
95
- opacity:0.85;
96
- filter: alpha(opacity=85);
97
  }
98
  .gmPhantom_Thumb:hover, .gmPhantom_Thumb:active {
99
  display:block;
@@ -111,8 +142,20 @@ div.gmPhantom_Container img {
111
  .gmPhantom_ThumbScale .gmPhantom_ThumbContainer:hover .gmPhantom_Thumb {
112
  transform:scale(1.2) translateZ(0); -webkit-transform:scale(1.2) translateZ(0);
113
  }
 
 
 
 
 
 
 
 
 
 
 
114
  .gmPhantom_Thumb img {
115
  position:relative;
 
116
  display:block;
117
  border:0;
118
  margin:0;
@@ -126,39 +169,60 @@ div.gmPhantom_Container img {
126
  .gmPhantom_Thumb img.portrait { height:auto !important; width:100% !important; }
127
  .gmPhantom_ThumbLabel {
128
  font-family:Arial, Helvetica, Verdana, sans-serif;
129
- font-size:11px;
130
  font-weight:bold;
131
  line-height:1em;
132
- padding:7px 2px;
133
  position:absolute;
134
  bottom:0; left:0; right:0;
135
  color:#0b0b0b;
136
  background-color:#ffffff;
137
- text-align:center;
138
  max-height:100%;
139
  overflow:hidden;
140
  -webkit-transition:0.2s; transition:0.2s;
141
  }
142
  .gmPhantom_ThumbLabel a {
143
  font-family:Arial, Helvetica, Verdana, sans-serif;
144
- font-size:11px;
145
  font-weight:bold;
146
  line-height:1em;
147
- color:#3695E7;
148
  background-color:transparent;
149
  display:inline;
150
  }
151
  .gmPhantom_LabelTolltip .gmPhantom_ThumbLabel,
152
- .gmPhantom_LabelNone .gmPhantom_ThumbLabel {display:none;}
153
  .gmPhantom_LabelInside .gmPhantom_ThumbLabel,
154
- .gmPhantom_LabelHover .gmPhantom_ThumbLabel {margin-bottom:-36px; color:#e7e7e7; background-color:rgba(0, 0, 0, 0.5);}
155
- .gmPhantom_LabelHover .gmPhantom_ThumbLabel a {color:#e7e179;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  .gmPhantom_LabelInside .gmPhantom_ThumbLabel,
157
- .gmPhantom_LabelHover .gmPhantom_ThumbContainer:hover .gmPhantom_ThumbLabel {margin-bottom:10px;}
158
-
159
- .gmPhantom_LabelBottom .gmPhantom_ThumbContainer {padding-bottom: 36px;}
160
- .gmPhantom_LabelBottom .gmPhantom_ThumbLabel {background-color:#ffffff;}
161
-
162
  .gmPhantom_Tooltip {
163
  border-radius:3px;
164
  border:1px solid #000000;
@@ -193,15 +257,12 @@ div.gmPhantom_Container img {
193
  width:0;
194
  }
195
  body .gmShowBuster { display:block !important; }
196
-
197
-
198
-
199
  /******* Custom MFP CSS *******/
200
 
201
  /* zoom-in animation on open */
202
  .mfp-ready .mfp-figure {
203
  opacity:0;
204
- filter: alpha(opacity=0);
205
  }
206
  .mfp-zoom-in {
207
  /* start state */
@@ -209,15 +270,14 @@ body .gmShowBuster { display:block !important; }
209
  /* animate out */
210
  }
211
  .mfp-zoom-in.mfp-bg,
212
- .mfp-zoom-in .mfp-preloader,
213
  .mfp-zoom-in .mfp-figure,
214
  .mfp-zoom-in .mfp-iframe-wrapper,
215
  .mfp-zoom-in button,
216
  .mfp-zoom-in .mfp-button,
217
- .mfp-zoom-in .mfp-gmedia-stuff08,
218
- .mfp-zoom-in .mfp-gmedia-stuff10 {
219
  opacity:0;
220
- filter: alpha(opacity=0);
221
  -webkit-backface-visibility:hidden;
222
  /* ideally, transition speed should match zoom duration */
223
  -webkit-transition:all 0.3s ease-out;
@@ -228,67 +288,69 @@ body .gmShowBuster { display:block !important; }
228
  .mfp-zoom-in .mfp-figure {
229
  transform:scale(0.9) translateZ(0);
230
  }
231
-
232
  .mfp-zoom-in.mfp-ready.mfp-bg,
233
  .mfp-zoom-in.mfp-ready button,
234
  .mfp-zoom-in.mfp-ready .mfp-button,
235
- .mfp-zoom-in.mfp-ready .mfp-gmedia-stuff08 {
236
  opacity:0.8;
237
- filter: alpha(opacity=80);
238
  }
239
-
240
  .mfp-zoom-in.mfp-image-loaded .mfp-figure,
241
- .mfp-zoom-in.mfp-iframe-loaded .mfp-iframe-wrapper ,
242
- .mfp-zoom-in.mfp-ready .mfp-gmedia-stuff10 {
243
  opacity:1;
244
- filter: alpha(opacity=100);
245
  }
246
  .mfp-zoom-in.mfp-image-loaded .mfp-figure {
247
- opacity:1;
248
- filter: alpha(opacity=100);
249
  transform:scale(1) translateZ(0);
250
  }
251
-
252
- .mfp-zoom-in.mfp-removing.mfp-bg,
253
- .mfp-zoom-in.mfp-removing .mfp-preloader,
254
- .mfp-zoom-in.mfp-removing .mfp-figure,
255
- .mfp-zoom-in.mfp-removing .mfp-iframe-wrapper,
256
- .mfp-zoom-in.mfp-removing .mfp-comments-container,
257
- .mfp-zoom-in.mfp-removing button,
258
- .mfp-zoom-in.mfp-removing .mfp-button,
259
- .mfp-zoom-in.mfp-removing .mfp-gmedia-stuff08,
260
- .mfp-zoom-in.mfp-removing .mfp-gmedia-stuff10 {
261
- opacity:0;
262
- filter: alpha(opacity=0);
263
  }
264
- .mfp-zoom-in.mfp-removing .mfp-figure {
265
- transform:scale(0.9);
 
 
 
 
 
 
 
 
 
 
 
 
266
  }
267
-
268
  .mfp-button:not(.mfp-close) {
269
  cursor:pointer;
270
  }
271
- .mfp-zoom-in button:hover,
272
- .mfp-zoom-in button:focus,
273
- .mfp-zoom-in .mfp-button:hover,
274
- .mfp-zoom-in .mfp-button:focus,
275
- .mfp-button.mfp-gmedia-stuff08:hover,
276
- .mfp-button.mfp-gmedia-stuff08:focus {
277
- opacity:1;
278
- filter: alpha(opacity=100);
279
- }
280
-
281
-
282
  /* CSS-based preloader */
283
  .mfp-preloader {
284
  width:30px !important;
285
  height:30px;
286
  background-color:#ffffff;
287
  opacity:0.65;
288
- filter: alpha(opacity=65);
289
  margin:0 auto;
290
  animation:rotateplane 1.2s infinite ease-in-out;
291
  }
 
 
 
 
 
 
 
 
 
292
  @keyframes rotateplane {
293
  0% {
294
  transform:perspective(120px) rotateX(0deg) rotateY(0deg) translateZ(0);
@@ -300,9 +362,6 @@ body .gmShowBuster { display:block !important; }
300
  transform:perspective(120px) rotateX(-180deg) rotateY(-179.9deg) translateZ(0);
301
  }
302
  }
303
-
304
-
305
-
306
  .mfp-bg {
307
  top:-10%;
308
  bottom:-100%;
@@ -312,10 +371,10 @@ body .gmShowBuster { display:block !important; }
312
  }
313
  .mfp-bg, .mfp-wrap {
314
  z-index:99999;
315
- -webkit-overflow-scrolling: touch;
316
- -webkit-transform: translateZ(0);
317
- -moz-transform: translateZ(0);
318
- transform: translateZ(0);
319
  }
320
  .mfp-close.mfp-button, .mfp-arrow, .mfp-preloader {
321
  position:fixed;
@@ -325,14 +384,14 @@ body .gmShowBuster { display:block !important; }
325
  z-index:1046;
326
  }
327
  .mfp-close.mfp-button {
328
- right: auto;
329
- left: 0;
330
- padding-right: 10px;
331
- padding-left: 0;
332
  }
333
  .mfp-arrow {
334
- bottom: 50%;
335
- top: auto;
336
  margin-top:auto;
337
  margin-bottom:-55px;
338
  }
@@ -341,35 +400,31 @@ body .gmShowBuster { display:block !important; }
341
  }
342
  img.mfp-img,
343
  img.mfp-img--comments-div {
344
- width: auto;
345
- max-width: 100%;
346
- height: auto;
347
- display: block;
348
- line-height: 0;
349
- -webkit-box-sizing: border-box;
350
- -moz-box-sizing: border-box;
351
- box-sizing: border-box;
352
- padding: 40px 0 40px;
353
- margin: 0 auto;
354
  }
355
  .mfp-prevent-click { pointer-events:none; }
356
-
357
- .mfp-title { font-weight:bold; font-size:larger; }
358
- .mfp-counter { color:#f3f3f3; opacity:0.9; filter: alpha(opacity=90); }
359
- .mfp-description {
 
 
360
  text-align:left;
361
  line-height:130%;
362
  color:#f3f3f3;
363
  word-wrap:break-word;
364
  padding:0;
365
- margin:10px 0;
366
- opacity:1;
367
- filter: alpha(opacity=100);
368
  min-width:250px;
369
- transition:opacity 0.6s, height 0.6s;
370
- -webkit-transition:opacity 0.3s, height 0.6s;
371
  }
372
-
373
  .mfp-buttons-bar {
374
  -webkit-user-select:none;
375
  -moz-user-select:none;
@@ -377,18 +432,27 @@ img.mfp-img--comments-div {
377
  -webkit-appearance:none;
378
  z-index:1046;
379
  position:fixed;
380
- right:0;
381
- top:0;
382
- padding:10px;
383
  color:#ffffff;
384
  font-style:normal;
385
  font-size:20px;
386
  font-family:Arial, Baskerville, monospace;
387
  transform:translateZ(0);
 
 
 
 
 
 
 
 
388
  }
389
  .mfp-buttons-bar .mfp-button {
390
  display:inline-block;
391
- margin-left:25px;
 
392
  }
393
  .mfp-share {
394
  cursor:pointer;
@@ -398,75 +462,66 @@ img.mfp-img--comments-div {
398
  opacity:0.65;
399
  filter:alpha(opacity=65);
400
  }
401
- .mfp-zoom-in.mfp-ready .mfp-share_open.mfp-share {
402
  opacity:1;
403
- filter:alpha(opacity=100); }
 
404
  .mfp-share:active > a {
405
  top:1px; }
406
-
407
- .mfp-comments-open .mfp-description {
408
- opacity:0;
409
- filter: alpha(opacity=0);
410
- height:0;
411
- margin:0;
412
- overflow:hidden;
413
- }
414
-
415
- .mfp-share_sharelizers { position:absolute; right:100%; top:0; display:block; margin:0; padding:0; list-style:none; white-space:nowrap; overflow:hidden; pointer-events:none;
416
- transition:padding 0.2s ease-in-out; -webkit-transition:padding 0.2s ease-in-out;}
417
- .mfp-share_open .mfp-share_sharelizers { pointer-events:auto; padding:0 5px; }
418
- .mfp-share_sharelizers li { list-style:none; margin:0; padding:0; display:inline-block; position:relative; left:100%;
419
- transition:left 0.2s ease-in-out; -webkit-transition:left 0.2s ease-in-out;}
420
- .mfp-share_open .mfp-share_sharelizers li { left:0; }
421
- .mfp-share_sharelizer { box-sizing:content-box; padding:1px; display:inline-block; text-decoration:none; border-radius:3px; border:none; cursor:pointer; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; line-height:100%; width:1em; height:1em; text-indent:-9999px; overflow:hidden; background:50% 50% no-repeat rgba(255, 255, 255, 0.14902);
422
- transition:background-color 0.2s ease-in-out; -webkit-transition:background-color 0.2s ease-in-out;}
423
- .mfp-share_facebook { background-image:url('../img/facebook@2x.png'); background-size:1em 1em; }
424
- .mfp-share_facebook:hover { background-color:#3b5998; }
425
- .mfp-share_twitter { background-image:url('../img/twitter@2x.png'); background-size:1em 1em; }
426
- .mfp-share_twitter:hover { background-color:#00aced; }
427
- .mfp-share_pinterest { background-image:url('../img/pinterest@2x.png'); background-size:1em 1em; }
428
- .mfp-share_pinterest:hover { background-color:#cc2127; }
429
- .mfp-share_google { background-image:url('../img/google@2x.png'); background-size:1em 1em; }
430
- .mfp-share_google:hover { background-color:#d64a2d; }
431
- .mfp-share_stumbleupon { background-image:url('../img/stumbleupon@2x.png'); background-size:1em 1em; }
432
- .mfp-share_stumbleupon:hover { background-color:#ea4b24; }
433
-
434
- @media screen and (max-width:800px) and (orientation:landscape), screen and (max-height:300px) {
435
- .mfp-img-mobile .mfp-buttons-bar {
436
- padding:8px;
437
- }
438
- }
439
-
440
  .mfp-comments,
441
- .mfp-likes,
442
- .mfp-views {
443
  cursor:pointer;
444
  display:inline-block;
445
  text-align:center;
446
  opacity:0.65;
447
  filter:alpha(opacity=65);
448
  }
 
 
 
 
 
 
 
 
 
 
449
  .mfp-comments-count,
450
- .mfp-likes-count,
451
- .mfp-views-count {
452
- font-size:0.8em;
453
  }
454
  .phantom-gmedia-liked .mfp_likes_icon {
455
  color:red;
456
  }
457
-
458
  .mfp-button > span,
459
  .mfp-button > a,
460
- .mfp-button > a:hover { display:block; position:relative; color:inherit !important; text-decoration:none !important; outline:none; }
461
  .mfp-button > span *,
462
  .mfp-button > a * { display:inline-block; }
463
- .mfp-button svg {
464
  display:block;
465
  width:1em;
466
  height:1em;
467
  fill:currentColor;
468
  }
469
-
470
  .mfp-container {
471
  bottom:0;
472
  height:auto;
@@ -479,6 +534,9 @@ img.mfp-img--comments-div {
479
  -webkit-transition:padding 0.6s, min-height 0.6s;
480
  box-sizing:border-box;
481
  }
 
 
 
482
  .mfp-iframe-holder {
483
  padding-top:0;
484
  padding-bottom:0;
@@ -505,39 +563,45 @@ img.mfp-img--comments-div {
505
  box-shadow:none;
506
  background-color:rgba(0, 0, 0, 0.5);
507
  }
508
-
509
  .mfp-comments-container {
 
 
510
  position:absolute;
511
  right:0;
512
  top:0;
513
  height:100%;
514
  width:0;
515
  opacity:0;
516
- filter: alpha(opacity=0);
517
  overflow:hidden;
518
  box-sizing:border-box;
519
  padding:40px 0;
520
  margin:0;
521
- transition:width 0.6s, height 0.6s, opacity 0.3s;
522
- -webkit-transition:width 0.6s, height 0.6s, opacity 0.3s;
523
  }
524
  .mfp-comments-container * {
525
  box-sizing:border-box;
526
  }
527
  .mfp-comments-content {
528
  position:relative;
529
- padding:0 30px 0 0;
530
  box-sizing:content-box;
531
  height:100%;
532
- width:100%;
533
  min-width:320px;
534
- background-color:rgba(255, 255, 255, 0.8);
535
  overflow:hidden;
536
- overflow-y:auto;
537
  }
538
  .mfp-comments-wrapper {
539
  width:100%;
540
  }
 
 
 
 
541
  .mfp-comments-content iframe {
542
  height:100%;
543
  width:100%;
@@ -549,6 +613,26 @@ img.mfp-img--comments-div {
549
  transition:opacity 0.4s;
550
  -webkit-transition:opacity 0.4s;
551
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  .mfp-comments-open .mfp-container,
553
  .mfp-comments-open .mfp-container:before {
554
  transition:height 0.6s;
@@ -564,30 +648,34 @@ img.mfp-img--comments-div {
564
  .mfp-comments-open .mfp-comments-container {
565
  width:320px;
566
  overflow-y:visible;
 
 
 
 
 
 
567
  opacity:1;
568
- filter: alpha(opacity=100);
569
  }
570
- .mfp-zoom-in.mfp-comments-open .mfp-arrow {
571
  opacity:0;
572
- filter: alpha(opacity=0);
573
  pointer-events:none;
574
  -webkit-pointer-events:none;
575
  }
576
- .mfp-comments-loading .mfp-comments-container {
577
  background-image:url(../img/loader.gif);
578
  background-repeat:no-repeat;
579
  background-position:50% 50%;
580
  }
581
  .mfp-comments-loading .mfp-comments-content iframe {
582
  opacity:0;
583
- filter: alpha(opacity=0);
584
  }
585
  .mfp-comments-loaded .mfp-comments-content iframe {
586
  opacity:1;
587
- filter: alpha(opacity=100);
588
  }
589
-
590
-
591
  @media screen and (max-width:800px) {
592
  .mfp-buttons-bar .mfp-button.mfp-share {
593
  display:none;
@@ -599,22 +687,21 @@ img.mfp-img--comments-div {
599
  .mfp-comments-open .mfp-content {
600
  padding-right:0;
601
  }
602
- .mfp-comments-wrapper {
603
- height:0;
604
- overflow:hidden;
605
- transition:height 0.3s;
606
- -webkit-transition:height 0.3s;
607
- }
608
- .mfp-comments-open .mfp-comments-wrapper {
609
- height:240px;
610
- }
611
  .mfp-comments-container {
612
  min-width:308px;
613
  padding:0;
614
  width:100%;
615
  position:relative;
616
- transition:margin 0.6s, opacity 0.3s;
617
- -webkit-transition:margin 0.6s, opacity 0.3s;
 
 
 
 
 
 
 
 
618
  }
619
  .mfp-comments-open .mfp-comments-container {
620
  margin-top:-5px;
@@ -622,3 +709,66 @@ img.mfp-img--comments-div {
622
  height:auto;
623
  }
624
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  @charset "utf-8";
2
  body.gmPhantom_zoom * { -webkit-user-select:none; }
3
+ .phantom_module {
4
+ position:relative;
5
+ font-family:"Helvetica Neue", HelveticaNeue, Helvetica, TeXGyreHeros, FreeSans, "Nimbus Sans L", "Liberation Sans", Arial, sans-serif;
6
+ text-rendering:optimizeLegibility;
7
+ -webkit-font-smoothing:antialiased;
8
+ z-index:1;
9
+ }
10
+ body.mfp-gmedia-open .mfp-content {
11
+ font-family:"Helvetica Neue", HelveticaNeue, Helvetica, TeXGyreHeros, FreeSans, "Nimbus Sans L", "Liberation Sans", Arial, sans-serif;
12
+ text-rendering:optimizeLegibility;
13
+ -webkit-font-smoothing:antialiased;
14
+ }
15
  .gmPhantom_Container * { -moz-box-sizing:content-box; box-sizing:content-box; }
16
  .gmPhantom_Container {
17
  direction:ltr;
20
  padding:0;
21
  position:relative;
22
  height:auto;
23
+ width:100%;
24
  z-index:0;
25
  opacity:1;
26
+ text-align:center;
27
  -moz-transition:opacity 1s;
28
  -webkit-transition:opacity 1s;
29
  -o-transition:opacity 1s;
32
  -webkit-transform:translateZ(0);
33
  -moz-transform:translateZ(0);
34
  transform:translateZ(0);
35
+ max-width:100%;
36
  }
37
+ div.gmPhantom_Container a {
38
+ box-shadow:none;
39
  }
 
40
  div.gmPhantom_Container img {
41
  border:medium none;
42
  margin:0;
43
  padding:0;
44
  }
45
+ .gmPhantom_thumbsWrapper::after { content:""; display:table; clear:both; }
 
 
 
 
 
 
46
  .gmPhantom_thumbsWrapper {
47
+ display:inline-block;
48
  background:none repeat scroll 0 0 transparent;
49
  height:auto;
50
+ margin:-8px 0 0 -8px;
51
  text-align:left;
52
+ padding:4px;
 
 
53
  z-index:2;
54
+ -webkit-backface-visibility:hidden;
55
+ backface-visibility:hidden;
56
+ max-width:100%;
57
  }
58
+ .gmPhantom_ThumbContainer,
59
+ .gmPhantom_LoadMore {
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  cursor:pointer;
61
  float:left;
62
+ padding:2px;
63
+ width:200px;
64
+ height:180px;
 
65
  position:relative;
66
  border: 1px solid #cccccc;
67
  background-color:#ffffff;
68
+ box-shadow: 0 0 4px -2px;
69
  overflow:hidden;
70
+ margin:8px 0 0 8px;
71
  background:url(../img/loader.gif) -100% -100% no-repeat;
72
  }
73
+ .gmPhantom_LoadMore {
74
+ background-color:transparent;
75
+ }
76
+ .gmPhantom_MobileView .gmPhantom_ThumbContainer,
77
+ .gmPhantom_MobileView .gmPhantom_LoadMore {
78
+ width:150px;
79
+ height:135px;
80
  }
81
+ .gmPhantom_ThumbContainer.gmPhantom_ThumbLoader,
82
+ .gmPhantom_LoadMore.gmPhantom_ThumbLoader {
83
  background-position:50% 50%;
84
  }
85
+ .gmPhantom_LoadMore .gmPhantom_pager {
86
+ font-size:98px;
87
+ line-height:180px;
88
+ text-decoration:none;
89
+ box-shadow:none;
90
  display:block;
91
+ text-align:center;
92
+ white-space:nowrap;
93
+ position:relative;
94
+ }
95
+ .gmPhantom_LoadMore .gmPhantom_pager span { -webkit-transition:0.2s; transition:0.2s; }
96
+ .gmPhantom_LoadMore .gmPhantom_pager .gmPhantom_dots { display:block; position:absolute; left:0; top:0; right:0; bottom:0; opacity:1; overflow:hidden; }
97
+ .gmPhantom_LoadMore .gmPhantom_pager .gmPhantom_page { opacity:0; }
98
+ .gmPhantom_LoadMore .gmPhantom_pager:hover .gmPhantom_dots { top:50%; }
99
+ .gmPhantom_LoadMore .gmPhantom_pager:hover .gmPhantom_page { opacity:1; }
100
+ .gmPhantom_MobileView .gmPhantom_LoadMore .gmPhantom_pager {
101
+ font-size:69px;
102
+ line-height:135px;
103
+ }
104
+ .gmPhantom_LoadMore.gmPhantom_ThumbLoader .gmPhantom_pager { display:none; }
105
+ .gmPhantom_LoadMore[data-col="1"] {
106
+ width:auto;
107
+ height:50px;
108
+ float:none;
109
+ transform:translate(0, 8px);
110
+ }
111
+ .gmPhantom_LoadMore[data-col="1"] .gmPhantom_pager,
112
+ .gmPhantom_MobileView .gmPhantom_LoadMore[data-col="1"] .gmPhantom_pager {
113
+ font-size:40px;
114
+ line-height:50px;
115
+ }
116
+ .gmPhantom_Thumb {
117
+ display:block !important;
118
  margin:0;
119
  overflow:hidden;
120
  padding:0;
121
+ position:static !important;
122
  width:100%; height:100%;
123
  -webkit-transition:0.2s; transition:0.2s;
124
+ -webkit-transition-property:all !important;
125
+ transition-property:all !important;
126
+ opacity:0.90;
127
+ filter:alpha(opacity=90);
128
  }
129
  .gmPhantom_Thumb:hover, .gmPhantom_Thumb:active {
130
  display:block;
142
  .gmPhantom_ThumbScale .gmPhantom_ThumbContainer:hover .gmPhantom_Thumb {
143
  transform:scale(1.2) translateZ(0); -webkit-transform:scale(1.2) translateZ(0);
144
  }
145
+ .gmPhantom_Thumb > div {
146
+ position:absolute;
147
+ left:0;
148
+ top:0;
149
+ bottom:0;
150
+ right:0;
151
+ width:100%;
152
+ height:100%;
153
+ padding:0 !important; margin:0 !important;
154
+ z-index:0 !important;
155
+ }
156
  .gmPhantom_Thumb img {
157
  position:relative;
158
+ left:50%; top:50%; transform:translate(-50%, -50%) translateZ(0);
159
  display:block;
160
  border:0;
161
  margin:0;
169
  .gmPhantom_Thumb img.portrait { height:auto !important; width:100% !important; }
170
  .gmPhantom_ThumbLabel {
171
  font-family:Arial, Helvetica, Verdana, sans-serif;
172
+ font-size:14px;
173
  font-weight:bold;
174
  line-height:1em;
175
+ padding:7px 10px;
176
  position:absolute;
177
  bottom:0; left:0; right:0;
178
  color:#0b0b0b;
179
  background-color:#ffffff;
180
+ text-align:left;
181
  max-height:100%;
182
  overflow:hidden;
183
  -webkit-transition:0.2s; transition:0.2s;
184
  }
185
  .gmPhantom_ThumbLabel a {
186
  font-family:Arial, Helvetica, Verdana, sans-serif;
187
+ font-size:inherit;
188
  font-weight:bold;
189
  line-height:1em;
190
+ color:#3695e7;
191
  background-color:transparent;
192
  display:inline;
193
  }
194
  .gmPhantom_LabelTolltip .gmPhantom_ThumbLabel,
195
+ .gmPhantom_LabelNone .gmPhantom_ThumbLabel { display:none; }
196
  .gmPhantom_LabelInside .gmPhantom_ThumbLabel,
197
+ .gmPhantom_LabelHover .gmPhantom_ThumbLabel {
198
+ color:#ffffff;
199
+ opacity:0;
200
+ padding:14px 10px 10px;
201
+ background:-webkit-gradient(linear, left top, left bottom, from(transparent), to(rgba(0, 0, 0, 0.6)));
202
+ background:-webkit-linear-gradient(top, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
203
+ background:-moz-linear-gradient(top, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
204
+ background:linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
205
+ -webkit-transition:opacity 0.3s;
206
+ -moz-transition:opacity 0.3s;
207
+ transition:opacity 0.3s;
208
+ }
209
+ .gmPhantom_LabelHover .gmPhantom_ThumbLabel .gmPhantom_ThumbLabel_title {
210
+ display:block;
211
+ transform:translateY(100%) translateZ(0);
212
+ opacity:0;
213
+ -webkit-transition:all 0.3s;
214
+ -moz-transition:all 0.3s;
215
+ transition:all 0.3s;
216
+ }
217
+ .gmPhantom_LabelHover .gmPhantom_ThumbContainer:hover .gmPhantom_ThumbLabel .gmPhantom_ThumbLabel_title { transform:translateY(0) translateZ(0); opacity:1; }
218
+ .gmPhantom_LabelInside .gmPhantom_ThumbLabel a,
219
+ .gmPhantom_LabelHover .gmPhantom_ThumbLabel a,
220
+ .gmPhantom_LabelInside .gmPhantom_ThumbLabel a:hover,
221
+ .gmPhantom_LabelHover .gmPhantom_ThumbLabel a:hover { color:#e7e179; }
222
  .gmPhantom_LabelInside .gmPhantom_ThumbLabel,
223
+ .gmPhantom_LabelHover .gmPhantom_ThumbContainer:hover .gmPhantom_ThumbLabel { opacity:1; }
224
+ .gmPhantom_LabelBottom .gmPhantom_ThumbContainer { padding-bottom:36px; }
225
+ .gmPhantom_LabelBottom .gmPhantom_ThumbLabel { background-color:#ffffff; min-height:36px; box-sizing:border-box; }
 
 
226
  .gmPhantom_Tooltip {
227
  border-radius:3px;
228
  border:1px solid #000000;
257
  width:0;
258
  }
259
  body .gmShowBuster { display:block !important; }
 
 
 
260
  /******* Custom MFP CSS *******/
261
 
262
  /* zoom-in animation on open */
263
  .mfp-ready .mfp-figure {
264
  opacity:0;
265
+ filter:alpha(opacity=0);
266
  }
267
  .mfp-zoom-in {
268
  /* start state */
270
  /* animate out */
271
  }
272
  .mfp-zoom-in.mfp-bg,
 
273
  .mfp-zoom-in .mfp-figure,
274
  .mfp-zoom-in .mfp-iframe-wrapper,
275
  .mfp-zoom-in button,
276
  .mfp-zoom-in .mfp-button,
277
+ .mfp-gmedia-stuff08,
278
+ .mfp-gmedia-stuff10 {
279
  opacity:0;
280
+ filter:alpha(opacity=0);
281
  -webkit-backface-visibility:hidden;
282
  /* ideally, transition speed should match zoom duration */
283
  -webkit-transition:all 0.3s ease-out;
288
  .mfp-zoom-in .mfp-figure {
289
  transform:scale(0.9) translateZ(0);
290
  }
 
291
  .mfp-zoom-in.mfp-ready.mfp-bg,
292
  .mfp-zoom-in.mfp-ready button,
293
  .mfp-zoom-in.mfp-ready .mfp-button,
294
+ .mfp-ready .mfp-gmedia-stuff08 {
295
  opacity:0.8;
296
+ filter:alpha(opacity=80);
297
  }
298
+ .mfp-zoom-in.mfp-ready .mfp-button.mfp-button-active,
299
  .mfp-zoom-in.mfp-image-loaded .mfp-figure,
300
+ .mfp-zoom-in.mfp-iframe-loaded .mfp-iframe-wrapper,
301
+ .mfp-ready .mfp-gmedia-stuff10 {
302
  opacity:1;
303
+ filter:alpha(opacity=100);
304
  }
305
  .mfp-zoom-in.mfp-image-loaded .mfp-figure {
 
 
306
  transform:scale(1) translateZ(0);
307
  }
308
+ button:hover,
309
+ button:focus,
310
+ .mfp-button:hover,
311
+ .mfp-button:focus,
312
+ .mfp-button.mfp-gmedia-stuff08:hover,
313
+ .mfp-button.mfp-gmedia-stuff08:focus {
314
+ opacity:1;
315
+ filter:alpha(opacity=100);
 
 
 
 
316
  }
317
+ .mfp-ready.mfp-removing.mfp-bg,
318
+ .mfp-ready.mfp-removing .mfp-preloader,
319
+ .mfp-ready.mfp-removing .mfp-figure,
320
+ .mfp-ready.mfp-removing .mfp-iframe-wrapper,
321
+ .mfp-ready.mfp-removing .mfp-comments-container,
322
+ .mfp-ready.mfp-removing button,
323
+ .mfp-ready.mfp-removing .mfp-button,
324
+ .mfp-ready.mfp-removing .mfp-gmedia-stuff08,
325
+ .mfp-ready.mfp-removing .mfp-gmedia-stuff10 {
326
+ opacity:0 !important;
327
+ filter:alpha(opacity=0) !important;
328
+ }
329
+ .mfp-zoom-in.mfp-ready.mfp-removing .mfp-figure {
330
+ transform:scale(0.9) translateZ(0);
331
  }
 
332
  .mfp-button:not(.mfp-close) {
333
  cursor:pointer;
334
  }
 
 
 
 
 
 
 
 
 
 
 
335
  /* CSS-based preloader */
336
  .mfp-preloader {
337
  width:30px !important;
338
  height:30px;
339
  background-color:#ffffff;
340
  opacity:0.65;
341
+ filter:alpha(opacity=65);
342
  margin:0 auto;
343
  animation:rotateplane 1.2s infinite ease-in-out;
344
  }
345
+ .mfp-s-error .mfp-preloader {
346
+ width:auto !important;
347
+ height:30px;
348
+ background-color:transparent;
349
+ opacity:1;
350
+ filter: alpha(opacity=100);
351
+ margin:0 auto;
352
+ animation:none;
353
+ }
354
  @keyframes rotateplane {
355
  0% {
356
  transform:perspective(120px) rotateX(0deg) rotateY(0deg) translateZ(0);
362
  transform:perspective(120px) rotateX(-180deg) rotateY(-179.9deg) translateZ(0);
363
  }
364
  }
 
 
 
365
  .mfp-bg {
366
  top:-10%;
367
  bottom:-100%;
371
  }
372
  .mfp-bg, .mfp-wrap {
373
  z-index:99999;
374
+ -webkit-overflow-scrolling:touch;
375
+ -webkit-transform:translateZ(0);
376
+ -moz-transform:translateZ(0);
377
+ transform:translateZ(0);
378
  }
379
  .mfp-close.mfp-button, .mfp-arrow, .mfp-preloader {
380
  position:fixed;
384
  z-index:1046;
385
  }
386
  .mfp-close.mfp-button {
387
+ right:auto;
388
+ left:0;
389
+ padding-right:10px;
390
+ padding-left:0;
391
  }
392
  .mfp-arrow {
393
+ bottom:50%;
394
+ top:auto;
395
  margin-top:auto;
396
  margin-bottom:-55px;
397
  }
400
  }
401
  img.mfp-img,
402
  img.mfp-img--comments-div {
403
+ width:auto;
404
+ max-width:100%;
405
+ height:auto;
406
+ display:block;
407
+ line-height:0;
408
+ -webkit-box-sizing:border-box;
409
+ -moz-box-sizing:border-box;
410
+ box-sizing:border-box;
411
+ padding:40px 0 40px;
412
+ margin:0 auto;
413
  }
414
  .mfp-prevent-click { pointer-events:none; }
415
+ .mfp-title { font-weight:bold; font-size:larger; white-space:nowrap; overflow:hidden; max-width:100%; text-overflow:ellipsis; }
416
+ .mfp-title a { color:inherit !important; }
417
+ .mfp-counter { color:#f3f3f3; opacity:0.9; filter:alpha(opacity=90); }
418
+ .mfp-description,
419
+ .gmPhantom_text,
420
+ .gmPhantom_terms{
421
  text-align:left;
422
  line-height:130%;
423
  color:#f3f3f3;
424
  word-wrap:break-word;
425
  padding:0;
 
 
 
426
  min-width:250px;
 
 
427
  }
 
428
  .mfp-buttons-bar {
429
  -webkit-user-select:none;
430
  -moz-user-select:none;
432
  -webkit-appearance:none;
433
  z-index:1046;
434
  position:fixed;
435
+ right:3px;
436
+ top:3px;
437
+ margin:5px 5px 0 0;
438
  color:#ffffff;
439
  font-style:normal;
440
  font-size:20px;
441
  font-family:Arial, Baskerville, monospace;
442
  transform:translateZ(0);
443
+ /*border: 1px solid #fefefe;*/
444
+ /*border-left-width:2px;*/
445
+ /*border-right-width:2px;*/
446
+ /*border-radius: 20px;*/
447
+ /*background-color:#000000;*/
448
+ line-height:0;
449
+ white-space:nowrap;
450
+ overflow:visible;
451
  }
452
  .mfp-buttons-bar .mfp-button {
453
  display:inline-block;
454
+ margin:0 10px;
455
+ vertical-align:middle;
456
  }
457
  .mfp-share {
458
  cursor:pointer;
462
  opacity:0.65;
463
  filter:alpha(opacity=65);
464
  }
465
+ .mfp-share_open.mfp-share {
466
  opacity:1;
467
+ filter:alpha(opacity=100);
468
+ }
469
  .mfp-share:active > a {
470
  top:1px; }
471
+ .mfp-buttons-bar .mfp-share_sharelizers { position:absolute; left:-30px; top:0; display:block; margin:0; padding:0; list-style:none; white-space:nowrap; overflow:hidden; pointer-events:none; opacity:0; transform:translateX(-100%) translateZ(0);
472
+ transition:opacity 0.2s ease-in-out; -webkit-transition:opacity 0.2s ease-in-out; }
473
+ .mfp-buttons-bar .mfp-share_open .mfp-share_sharelizers { pointer-events:auto; opacity:1; }
474
+ .mfp-buttons-bar .mfp-share_sharelizers li { list-style:none; margin:0; padding:0; display:inline-block; }
475
+ .mfp-buttons-bar .mfp-share_sharelizer { box-sizing:content-box; padding:1px; display:inline-block; text-decoration:none; border-radius:3px; border:none; cursor:pointer; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; line-height:100%; width:1em; height:1em; text-indent:-9999px; overflow:hidden; background:50% 50% no-repeat rgba(255, 255, 255, 0.14902);
476
+ transition:background-color 0.2s ease-in-out; -webkit-transition:background-color 0.2s ease-in-out; }
477
+ .mfp-buttons-bar .mfp-share_facebook { background-image:url('../img/facebook@2x.png'); background-size:1em 1em; }
478
+ .mfp-buttons-bar .mfp-share_facebook:hover { background-color:#3b5998; }
479
+ .mfp-buttons-bar .mfp-share_twitter { background-image:url('../img/twitter@2x.png'); background-size:1em 1em; }
480
+ .mfp-buttons-bar .mfp-share_twitter:hover { background-color:#00aced; }
481
+ .mfp-buttons-bar .mfp-share_pinterest { background-image:url('../img/pinterest@2x.png'); background-size:1em 1em; }
482
+ .mfp-buttons-bar .mfp-share_pinterest:hover { background-color:#cc2127; }
483
+ .mfp-buttons-bar .mfp-share_google { background-image:url('../img/google@2x.png'); background-size:1em 1em; }
484
+ .mfp-buttons-bar .mfp-share_google:hover { background-color:#d64a2d; }
485
+ .mfp-buttons-bar .mfp-share_stumbleupon { background-image:url('../img/stumbleupon@2x.png'); background-size:1em 1em; }
486
+ .mfp-buttons-bar .mfp-share_stumbleupon:hover { background-color:#ea4b24; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  .mfp-comments,
488
+ .mfp-details,
489
+ .mfp-likes {
490
  cursor:pointer;
491
  display:inline-block;
492
  text-align:center;
493
  opacity:0.65;
494
  filter:alpha(opacity=65);
495
  }
496
+ .mfp-details-open .mfp-buttons-bar {
497
+ height:0;
498
+ pointer-events:none;
499
+ }
500
+ .mfp-details-open .mfp-buttons-bar .mfp-share,
501
+ .mfp-details-open .mfp-buttons-bar .mfp-comments,
502
+ .mfp-details-open .mfp-buttons-bar .mfp-likes {
503
+ opacity:0 !important;
504
+ transform:translateY(-100%) translateZ(0);
505
+ }
506
  .mfp-comments-count,
507
+ .mfp-views-count,
508
+ .mfp-likes-count {
509
+ font-size:0.7em;
510
  }
511
  .phantom-gmedia-liked .mfp_likes_icon {
512
  color:red;
513
  }
 
514
  .mfp-button > span,
515
  .mfp-button > a,
516
+ .mfp-button > a:hover { display:inline-block; vertical-align:middle; position:relative; color:inherit !important; text-decoration:none !important; outline:none; font-size:inherit !important; }
517
  .mfp-button > span *,
518
  .mfp-button > a * { display:inline-block; }
519
+ .mfp-gmedia-open .mfp-content svg {
520
  display:block;
521
  width:1em;
522
  height:1em;
523
  fill:currentColor;
524
  }
 
525
  .mfp-container {
526
  bottom:0;
527
  height:auto;
534
  -webkit-transition:padding 0.6s, min-height 0.6s;
535
  box-sizing:border-box;
536
  }
537
+ .mfp-content a {
538
+ color:#0099e6;
539
+ }
540
  .mfp-iframe-holder {
541
  padding-top:0;
542
  padding-bottom:0;
563
  box-shadow:none;
564
  background-color:rgba(0, 0, 0, 0.5);
565
  }
566
+ .mfp-comments-container { z-index:2; }
567
  .mfp-comments-container {
568
+ display:block;
569
+ line-height:120%;
570
  position:absolute;
571
  right:0;
572
  top:0;
573
  height:100%;
574
  width:0;
575
  opacity:0;
576
+ filter:alpha(opacity=0);
577
  overflow:hidden;
578
  box-sizing:border-box;
579
  padding:40px 0;
580
  margin:0;
581
+ transition:transform 0.6s, width 0.6s, height 0.6s, opacity 0.3s;
582
+ -webkit-transition:transform 0.6s, width 0.6s, height 0.6s, opacity 0.3s;
583
  }
584
  .mfp-comments-container * {
585
  box-sizing:border-box;
586
  }
587
  .mfp-comments-content {
588
  position:relative;
589
+ padding:0;
590
  box-sizing:content-box;
591
  height:100%;
592
+ width:calc(100% + 16px);
593
  min-width:320px;
594
+ background-color:#ffffff;
595
  overflow:hidden;
596
+ overflow-y:scroll;
597
  }
598
  .mfp-comments-wrapper {
599
  width:100%;
600
  }
601
+ .mfp-comments-wrapper {
602
+ position:relative;
603
+ z-index:1;
604
+ }
605
  .mfp-comments-content iframe {
606
  height:100%;
607
  width:100%;
613
  transition:opacity 0.4s;
614
  -webkit-transition:opacity 0.4s;
615
  }
616
+ .mfp-close-comments {
617
+ position:absolute;
618
+ right:1px;
619
+ top:1px;
620
+ padding:2px;
621
+ color:#010101;
622
+ line-height:110%;
623
+ border:1px solid transparent;
624
+ border-radius:50%;
625
+ width:1em;
626
+ height:1em;
627
+ text-align:center;
628
+ font-weight:bold;
629
+ font-family:Arial, Baskerville, monospace;
630
+ box-sizing:content-box;
631
+ font-size:16px;
632
+ cursor:pointer;
633
+ z-index:2;
634
+ }
635
+ .mfp-close-comments:hover { background-color:#fefefe; border-color:#bebebe; }
636
  .mfp-comments-open .mfp-container,
637
  .mfp-comments-open .mfp-container:before {
638
  transition:height 0.6s;
648
  .mfp-comments-open .mfp-comments-container {
649
  width:320px;
650
  overflow-y:visible;
651
+ font-size:14px;
652
+ line-height:120%;
653
+ display:block;
654
+ }
655
+ .mfp-image-loaded.mfp-comments-open .mfp-comments-container,
656
+ .mfp-iframe-loaded.mfp-comments-open .mfp-comments-container {
657
  opacity:1;
658
+ filter:alpha(opacity=100);
659
  }
660
+ .mfp-zoom-in.mfp-ready.mfp-comments-open .mfp-arrow {
661
  opacity:0;
662
+ filter:alpha(opacity=0);
663
  pointer-events:none;
664
  -webkit-pointer-events:none;
665
  }
666
+ .mfp-comments-loading .mfp-comments-content {
667
  background-image:url(../img/loader.gif);
668
  background-repeat:no-repeat;
669
  background-position:50% 50%;
670
  }
671
  .mfp-comments-loading .mfp-comments-content iframe {
672
  opacity:0;
673
+ filter:alpha(opacity=0);
674
  }
675
  .mfp-comments-loaded .mfp-comments-content iframe {
676
  opacity:1;
677
+ filter:alpha(opacity=100);
678
  }
 
 
679
  @media screen and (max-width:800px) {
680
  .mfp-buttons-bar .mfp-button.mfp-share {
681
  display:none;
687
  .mfp-comments-open .mfp-content {
688
  padding-right:0;
689
  }
 
 
 
 
 
 
 
 
 
690
  .mfp-comments-container {
691
  min-width:308px;
692
  padding:0;
693
  width:100%;
694
  position:relative;
695
+ display:none;
696
+ margin-bottom:40px;
697
+ }
698
+ .mfp-comments-content {
699
+ min-width:308px !important;
700
+ }
701
+ .mfp-comments-content {
702
+ min-height:240px;
703
+ /*border-top: 1px solid #eeeff2;*/
704
+ padding-top:10px;
705
  }
706
  .mfp-comments-open .mfp-comments-container {
707
  margin-top:-5px;
709
  height:auto;
710
  }
711
  }
712
+ .gmPhantom_Details table { border-collapse:collapse; border-spacing:0px; margin:0; padding:0; border:none; width:auto; background:transparent none; color:inherit; }
713
+ .gmPhantom_clearfix::after { visibility:hidden; display:block; font-size:0px; content:" "; clear:both; height:0px; }
714
+ .gmPhantom_Details table tr,
715
+ .gmPhantom_Details table tr td { padding:0px; margin:0; border:none; background:transparent none; color: inherit; }
716
+ .gmPhantom_Details .gmPhantom_terms { padding-top:20px; margin-bottom:10px; text-align:left; }
717
+ .gmPhantom_Details .gmPhantom_terms a { margin-right:5px; }
718
+ .gmPhantom_Details .gmPhantom_terms a:last-child { margin-right:0; }
719
+ .gmPhantom_Details .gmPhantom_description { text-align:left; position:relative; }
720
+ .gmPhantom_Details .gmPhantom_description .gmPhantom_title { font-size:18px; line-height:120%; color:#ffffff; margin:0px; }
721
+ .gmPhantom_Details .gmPhantom_description .gmPhantom_title a { color:inherit }
722
+ .gmPhantom_Details .gmPhantom_description .gmPhantom_title:empty { display:none; }
723
+ .gmPhantom_Details .gmPhantom_description p { position:relative; font-size:12px; line-height:16px; word-wrap:break-word; }
724
+ .gmPhantom_Details .gmPhantom_description .gmPhantom_text { margin-top:10px; overflow:hidden; position:relative; }
725
+ .gmPhantom_Details .gmPhantom_description .gmPhantom_text:empty { display:none; }
726
+ .gmPhantom_Details .gmPhantom_tags_container { margin-bottom:10px; }
727
+ .gmPhantom_Details .gmPhantom_other_terms { color:#525558; font-size:14px; }
728
+ .gmPhantom_Details .gmPhantom_other_terms .gmPhantom_other_terms_table { text-align:left; }
729
+ .gmPhantom_Details .gmPhantom_other_terms .gmPhantom_other_terms_table .gmPhantom_term_key { width:120px; color:#b9c1c7; padding-right:4px; vertical-align:top; }
730
+ .gmPhantom_Details .gmPhantom_other_terms .gmPhantom_other_terms_table .gmPhantom_term_value { text-align:right; vertical-align:top; }
731
+ .gmPhantom_Details .gmPhantom_other_terms .gmPhantom_other_terms_table td { padding-bottom:4px; }
732
+ .gmPhantom_button {
733
+ display:inline-block;
734
+ padding:4px 16px;
735
+ margin:0 1px;
736
+ background-color:#f7f8fa;
737
+ border:1px solid rgba(185, 193, 199, 0.5);
738
+ color:#71767a;
739
+ text-decoration:none;
740
+ border-radius:4px;
741
+ font-size:14px;
742
+ line-height:14px;
743
+ cursor:pointer;
744
+ position:relative;
745
+ vertical-align:middle;
746
+ }
747
+ a.gmPhantom_button { color:#71767a; }
748
+ .gmPhantom_button span { font-size:12px; }
749
+ .gmPhantom_button.gmPhantom_button_like { background-color:#ff4c4c; border-color:#ff3333; color:#ffffff; float:left; }
750
+ .phantom-gmedia-liked .gmPhantom_button.gmPhantom_button_like { background-color:#525558; border-color:#46484b; color:#ffffff; }
751
+ .gmPhantom_button.gmPhantom_button_like span { display:none; }
752
+ .gmPhantom_button.gmPhantom_button_link span { display:none; }
753
+ .gmPhantom_button.gmPhantom_button_download span { display:none; }
754
+ .gmPhantom_button.gmPhantom_button_comment span { display:none; }
755
+ .gmPhantom_button.gmPhantom_button_share > span { display:none; }
756
+ .gmPhantom_button:first-child { margin-left:0; }
757
+ .gmPhantom_button:last-child { margin-right:0; }
758
+ .gmPhantom_sharelizers_wrapper { position:absolute; right:0; top:100%; z-index:10; padding-top:10px; display:none; }
759
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers { background-color:#ffffff; border:1px solid rgba(185, 193, 199, 0.5); border-radius:4px; position:relative; list-style:none; margin:0; padding:4px; box-shadow:1px 1px 3px rgba(185, 193, 199, 0.5); }
760
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers li { margin:0; padding:1px 0; }
761
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers .mfp-share_sharelizer { background-position:3px 50%; background-repeat:no-repeat; background-size:22px 22px; border-radius:0; display:block; padding:3px 3px 3px 25px; color:#ffffff; height:28px; border-radius:6px; text-decoration:none; box-shadow:none; }
762
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers .mfp-share_sharelizer:hover { color:#ffffff; }
763
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers .mfp-share_sharelizer span { display:block; margin:0 0 0 4px; line-height:22px; text-decoration:none; background-color:#ffffff; border-radius:4px; color:#444444; padding:0 4px; font-size:13px; transition:0.2s; }
764
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers .mfp-share_sharelizer:hover span { color:inherit; background-color:transparent; }
765
+ .gmPhantom_sharelizers_wrapper ul .mfp-share_facebook { background:#3b5998 url('../img/facebook@2x.png'); background-size:22px 22px; }
766
+ .gmPhantom_sharelizers_wrapper ul .mfp-share_twitter { background:#00aced url('../img/twitter@2x.png'); background-size:22px 22px; }
767
+ .gmPhantom_sharelizers_wrapper ul .mfp-share_pinterest { background:#cc2127 url('../img/pinterest@2x.png'); background-size:22px 22px; }
768
+ .gmPhantom_sharelizers_wrapper ul .mfp-share_google { background:#d64a2d url('../img/google@2x.png'); background-size:22px 22px; }
769
+ .gmPhantom_sharelizers_wrapper ul .mfp-share_stumbleupon { background:#ea4b24 url('../img/stumbleupon@2x.png'); background-size:22px 22px; }
770
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers:before { position:absolute; z-index:1; bottom:100%; right:13px; border-bottom:10px solid rgba(185, 193, 199, 0.5); border-left:10px solid transparent; border-right:10px solid transparent; content:""; display:block; }
771
+ .gmPhantom_sharelizers_wrapper .mfp-share_sharelizers:after { position:absolute; z-index:2; bottom:100%; right:14px; border-bottom:8px solid #ffffff; border-left:9px solid transparent; border-right:9px solid transparent; content:""; display:block; }
772
+ .mfp-share_open .gmPhantom_sharelizers_wrapper { display:block; }
773
+ .gmPhantom_button.mfp-share_open { background-color:#525558; border-color:#46484b; color:#ffffff; }
774
+ .gmPhantom_button.mfp-comments_open { background-color:#525558; border-color:#46484b; color:#ffffff; }
module/phantom/index.php CHANGED
@@ -1,25 +1,25 @@
1
  <?php
2
- $module_info = array(
3
- 'base' => 'phantom',
4
- 'name' => 'phantom',
5
- 'title' => 'Phantom',
6
- 'version' => '3.7',
7
- 'author' => 'CodEasily.com',
8
- 'description' => 'This module will help you to easily add a grid gallery to your WordPress website or blog. The gallery is completely customizable, resizable and is compatible with all browsers and devices (iPhone, iPad and Android smartphones).
9
 
10
  Responsive | Social Sharing integrated | Views/Likes Counters Support | Comments Support | Customize each gallery individually | Customizable lightbox | Deeplinking support | Change thumbnail size, border, spacing, transparency, background, controls ...
11
  ',
12
- 'type' => 'gallery',
13
- 'status' => 'free',
14
- 'price' => '0',
15
- 'demo' => 'http://codeasily.com/portfolio-item/gmedia-phantom/',
16
- 'download' => 'http://codeasily.com/download/phantom-module-zip/',
17
- 'dependencies' => 'magnific-popup'
 
18
  );
19
- if (preg_match('#' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
20
- if (isset($_GET['info'])) {
21
  echo '<pre>' . print_r($module_info, true) . '</pre>';
22
- } else {
23
  header("Location: {$module_info['demo']}");
24
  die();
25
  }
1
  <?php
2
+ $module_info = array('base' => 'phantom',
3
+ 'name' => 'phantom',
4
+ 'title' => 'Phantom',
5
+ 'version' => '3.8',
6
+ 'author' => 'CodEasily.com',
7
+ 'description' => 'This module will help you to easily add a grid gallery to your WordPress website or blog. The gallery is completely customizable, resizable and is compatible with all browsers and devices (iPhone, iPad and Android smartphones).
 
8
 
9
  Responsive | Social Sharing integrated | Views/Likes Counters Support | Comments Support | Customize each gallery individually | Customizable lightbox | Deeplinking support | Change thumbnail size, border, spacing, transparency, background, controls ...
10
  ',
11
+ 'type' => 'gallery',
12
+ 'branch' => '1',
13
+ 'status' => 'free',
14
+ 'price' => '0',
15
+ 'demo' => 'http://codeasily.com/portfolio-item/gmedia-phantom/',
16
+ 'download' => 'http://codeasily.com/download/phantom-module-zip/',
17
+ 'dependencies' => 'magnific-popup'
18
  );
19
+ if(preg_match('#' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
20
+ if(isset($_GET['info'])){
21
  echo '<pre>' . print_r($module_info, true) . '</pre>';
22
+ } else{
23
  header("Location: {$module_info['demo']}");
24
  die();
25
  }
module/phantom/init.php CHANGED
@@ -2,7 +2,6 @@
2
  /** @var $gmDB
3
  * @var $gmCore
4
  * @var $gmGallery
5
- * @var $gallery
6
  * @var $module
7
  * @var $settings
8
  * @var $terms
@@ -10,105 +9,238 @@
10
  * @var $is_bot
11
  **/
12
 
13
- $settings = array_merge($settings, array(
14
- 'ID' => $gallery['term_id'],
15
- 'module_dirurl' => $module['url'],
16
- 'ajax_actions' => array(
17
- 'comments' => array(
18
- 'action' => 'load_comments',
19
- 'data' => array('post_id' => 0)
20
- )
21
- ),
22
  ));
23
  $allsettings = array_merge($module['options'], $settings);
24
 
25
- $content = array();
26
- if(!isset($is_bot)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  $is_bot = false;
28
  }
29
- if(!isset($shortcode_raw)) {
30
  $shortcode_raw = false;
31
  }
32
- $tab = sanitize_title($gallery['name']);
33
- $base_url_host = parse_url($gmCore->upload['url'], PHP_URL_HOST);
34
- $i = 0;
35
- foreach($terms as $term) {
36
 
37
- foreach($gmedia[$term->term_id] as $item) {
38
- $meta = $gmDB->get_metadata('gmedia', $item->ID);
39
- $_metadata = isset($meta['_metadata'])? $meta['_metadata'][0] : array();
40
-
41
- $link_target = '';
42
- if($item->link) {
43
- $url_host = parse_url($item->link, PHP_URL_HOST);
44
- if($url_host == $base_url_host || empty($url_host)) {
45
- $link_target = '_self';
46
- } else {
47
- $link_target = '_blank';
48
  }
 
 
 
 
 
 
49
  }
50
- if(isset($meta['link_target'][0])) {
51
- $link_target = $meta['link_target'][0];
52
- }
 
 
 
 
 
 
 
 
53
 
54
- $image = $gmCore->gm_get_media_image($item->ID, 'web');
55
- $thumb = $gmCore->gm_get_media_image($item->ID, 'thumb');
56
- $type = explode('/', $item->mime_type);
57
- $type = $type[0];
58
- $ext = pathinfo($item->gmuid, PATHINFO_EXTENSION);
59
- if(!isset($_metadata['web'])) {
60
- $img_size = getimagesize($image);
61
- $_metadata['web'] = array_slice($img_size, 0, 2);
62
- $img_size = getimagesize($thumb);
63
- $_metadata['thumb'] = array_slice($img_size, 0, 2);
64
- }
65
 
66
- $content[$i] = array(
67
- 'id' => $item->ID,
68
- 'post_id' => $item->post_id,
69
- 'type' => $type,
70
- 'ext' => strtolower($ext),
71
- 'src' => "/{$gmGallery->options['folder'][$type]}/{$item->gmuid}",
72
- 'image' => $image,
73
- 'thumb' => $thumb,
74
- 'title' => $item->title,
75
- 'text' => str_replace(array("\r\n", "\r", "\n"), '', wpautop($item->description)),
76
- 'link' => $item->link,
77
- 'linkTarget' => $link_target,
78
- 'date' => $item->date,
79
- 'websize' => array_values($_metadata['web']),
80
- 'thumbsize' => array_values($_metadata['thumb'])
81
- );
82
 
83
- if(!empty($allsettings['viewsEnabled']) || !empty($allsettings['likesEnabled'])) {
84
- $content[$i]['views'] = empty($meta['views'][0])? 0 : (int)$meta['views'][0];
85
- if(!empty($allsettings['likesEnabled'])){
86
- $content[$i]['likes'] = empty($meta['likes'][0])? 0 : (int)$meta['likes'][0];
87
- }
88
- }
89
- if(!empty($allsettings['commentsEnabled'])) {
90
- if($item->post_id) {
91
- $cc = wp_count_comments($item->post_id);
92
- $content[$i]['cc'] = $cc->approved;
93
- } else {
94
- $content[$i]['cc'] = 0;
95
- }
96
- }
97
 
98
- if($allsettings['share_post_link']) {
99
- $content[$i]['post_link'] = get_permalink($item->post_id);
100
- }
101
- $i++;
102
- }
103
- }
 
 
 
 
 
 
 
104
 
105
- if(!empty($content)) {
106
- $content = array_values($content);
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- $mfp_id = "#mfp_gm_{$gallery['term_id']}";
109
- $mfp_css = '';
110
- if(isset($settings['lightboxControlsColor'])) {
111
- $mfp_css .= "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  {$mfp_id} .mfp-arrow-right:after,
113
  {$mfp_id} .mfp-arrow-right .mfp-a {border-left-color:#{$settings['lightboxControlsColor']};}
114
  {$mfp_id} .mfp-arrow-left:after,
@@ -116,206 +248,148 @@ if(!empty($content)) {
116
  {$mfp_id} .mfp-close,
117
  {$mfp_id} .mfp-comments,
118
  {$mfp_id} .mfp-likes,
119
- {$mfp_id} .mfp-views,
120
  {$mfp_id} .mfp-share {color:#{$settings['lightboxControlsColor']};}
121
  {$mfp_id} .mfp-preloader {background-color:#{$settings['lightboxControlsColor']};}";
122
- }
123
- if(isset($settings['lightboxTitleColor'])) {
124
- $mfp_css .= "
125
  {$mfp_id} .mfp-title,
126
  {$mfp_id} .mfp-counter {color:#{$settings['lightboxTitleColor']};}";
127
- }
128
- if(isset($settings['lightboxTextColor'])) {
129
- $mfp_css .= "
130
  {$mfp_id} .mfp-description {color:#{$settings['lightboxTextColor']};}";
131
- }
132
- if(isset($settings['lightboxBGColor'])) {
133
- $mfp_css .= "
134
  {$mfp_id}_bg.mfp-bg {background-color:#{$settings['lightboxBGColor']};}";
135
- }
136
- if(isset($settings['lightboxBGAlpha'])) {
137
- $alpha = $settings['lightboxBGAlpha'] / 100;
138
- $mfp_css .= "
139
  {$mfp_id}_bg.mfp-bg {opacity:{$alpha};}
140
  {$mfp_id}_bg.mfp-zoom-in.mfp-bg {opacity:0}
141
  {$mfp_id}_bg.mfp-zoom-in.mfp-ready.mfp-bg {opacity:{$alpha};}
142
  {$mfp_id}_bg.mfp-zoom-in.mfp-removing.mfp-bg {opacity:0}";
143
- }
144
- if(isset($settings['commentsBGColor']) || isset($settings['commentsBGAlpha'])) {
145
- if(method_exists($gmCore, 'hex2rgb')) {
146
- $rgb = implode(',', $gmCore->hex2rgb($allsettings['commentsBGColor']));
147
- $alpha = $allsettings['commentsBGAlpha'] / 100;
148
- $mfp_css .= "
149
- {$mfp_id} .mfp-comments-content {background-color:rgba({$rgb},{$alpha});}";
150
- } else {
151
- $mfp_css .= "
152
  {$mfp_id} .mfp-comments-content {background-color:#{$allsettings['commentsBGColor']};}";
153
- }
154
- }
155
- if($mfp_css) {
156
- $settings['mfp_css'] = $mfp_css;
157
- }
158
 
159
- $cssid = "#GmediaGallery_{$gallery['term_id']}";
160
- $dcss = '';
161
- if(isset($settings['thumbWidth']) || isset($settings['thumbHeight']) || isset($settings['thumbWidthMobile']) || isset($settings['thumbHeightMobile'])) {
162
- $dcss .= "
163
- {$cssid} .gmPhantom_ThumbContainer {width:{$allsettings['thumbWidth']}px; height:{$allsettings['thumbHeight']}px;}
164
- {$cssid} .gmPhantom_MobileView .gmPhantom_ThumbContainer {width:{$allsettings['thumbWidthMobile']}px; height:{$allsettings['thumbHeightMobile']}px;}";
165
- }
166
- if(isset($settings['thumbPadding'])) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  $dcss .= "
168
- {$cssid} .gmPhantom_ThumbContainer {padding:{$allsettings['thumbPadding']}px;}";
169
- }
170
- if(isset($settings['thumbBG'])) {
171
- if('' == $settings['thumbBG']) {
172
- $dcss .= "
173
  {$cssid} .gmPhantom_ThumbContainer {background-color:transparent;}";
174
- } else {
175
- $dcss .= "
176
  {$cssid} .gmPhantom_ThumbContainer,
177
  {$cssid} .gmPhantom_LabelBottom .gmPhantom_ThumbLabel {background-color:#{$settings['thumbBG']};}";
178
- }
179
  }
180
- if(isset($settings['thumbAlpha'])) {
181
- $alpha = $settings['thumbAlpha'] / 100;
182
- $dcss .= "
 
183
  {$cssid} .gmPhantom_ThumbContainer .gmPhantom_Thumb {opacity:{$alpha};}";
184
- }
185
- if(isset($settings['thumbAlphaHover'])) {
186
- $alpha = $settings['thumbAlphaHover'] / 100;
187
- $dcss .= "
188
  {$cssid} .gmPhantom_ThumbContainer:hover .gmPhantom_Thumb {opacity:{$alpha};}";
189
- }
190
- if(isset($settings['thumbBorderSize']) || isset($settings['thumbBorderColor'])) {
191
- if((int)$settings['thumbBorderSize']) {
192
- $dcss .= "
193
- {$cssid} .gmPhantom_ThumbContainer {border:{$allsettings['thumbBorderSize']}px solid #{$allsettings['thumbBorderColor']};}";
194
- } else {
195
- $dcss .= "
196
- {$cssid} .gmPhantom_ThumbContainer {border:none;}";
197
- }
198
- }
199
- if(isset($settings['thumbBorderSize'])) {
200
- if((int)$settings['thumbBorderSize'] > 1) {
201
- $dcss .= "
202
- {$cssid} .gmPhantom_ThumbContainer {box-shadow:0 0 5px -2px;}";
203
- } else {
204
- $dcss .= "
205
- {$cssid} .gmPhantom_ThumbContainer {box-shadow:none;}";
206
- }
207
- }
208
- if(isset($settings['label8TextColor'])) {
209
  $dcss .= "
210
- {$cssid} .gmPhantom_ThumbLabel {color:#{$allsettings['label8TextColor']};}";
 
211
  }
212
- if(isset($settings['label8LinkColor'])) {
 
 
213
  $dcss .= "
214
- {$cssid} .gmPhantom_ThumbLabel a {color:#{$allsettings['label8LinkColor']};}";
 
215
  }
216
- if(isset($settings['labelTextColor'])) {
217
- $dcss .= "
 
 
 
 
 
 
 
 
 
218
  {$cssid} .gmPhantom_LabelInside .gmPhantom_ThumbLabel,
219
  {$cssid} .gmPhantom_LabelHover .gmPhantom_ThumbLabel {color:#{$allsettings['labelTextColor']};}";
220
- }
221
- if(isset($settings['labelLinkColor'])) {
222
- $dcss .= "
223
  {$cssid} .gmPhantom_LabelInside .gmPhantom_ThumbLabel a,
224
- {$cssid} .gmPhantom_LabelHover .gmPhantom_ThumbLabel a {color:#{$allsettings['labelLinkColor']};}";
225
- }
226
- if($dcss) {
227
- $customCSS = $dcss . $customCSS;
 
 
 
 
 
 
 
 
 
228
  }
 
 
 
 
229
 
230
-
231
- $json_settings = json_encode($settings);
232
-
233
- ?>
234
- <?php if(!$is_bot) {
235
- if($shortcode_raw) {
236
- echo '<pre style="display:none">';
237
- }
238
- ?>
239
- <script type="text/javascript">
240
- jQuery(function() {
241
- var settings = <?php echo $json_settings; ?>;
242
- var content = <?php echo json_encode($content); ?>;
243
- jQuery('#GmediaGallery_<?php echo $gallery['term_id'] ?>').gmPhantom([content, settings]);
244
- });
245
- </script><?php
246
- if($shortcode_raw) {
247
- echo '</pre>';
248
- }
249
  }
250
  ?>
251
- <div class="gmPhantom_Container noLightbox delay">
252
- <div class="gmPhantom_Background"></div>
253
- <?php
254
- $thumbsWrapper_class = (int)$allsettings['thumbScale']? ' gmPhantom_ThumbScale' : '';
255
- if('label' == $allsettings['thumbsInfo']) {
256
- if((int)$allsettings['labelOnHover']) {
257
- $thumbsWrapper_class .= ' gmPhantom_LabelHover';
258
- } else {
259
- $thumbsWrapper_class .= ' gmPhantom_LabelInside';
260
- }
261
- } elseif('label_bottom' == $allsettings['thumbsInfo']) {
262
- $thumbsWrapper_class .= ' gmPhantom_LabelBottom';
263
- } elseif('tooltip' == $allsettings['thumbsInfo']) {
264
- $thumbsWrapper_class .= ' gmPhantom_LabelTooltip';
265
- } elseif('none' == $allsettings['thumbsInfo']) {
266
- $thumbsWrapper_class .= ' gmPhantom_LabelNone';
267
- }
268
- ?>
269
- <div class="gmPhantom_thumbsWrapper<?php echo $thumbsWrapper_class; ?>">
270
- <?php $i = 0;
271
- $wrapper_r = $allsettings['thumbWidth'] / $allsettings['thumbHeight'];
272
- $mobile_wrapper_r = $allsettings['thumbWidthMobile'] / $allsettings['thumbHeightMobile'];
273
- foreach($content as $item) {
274
- $thumb_r = $item['thumbsize'][0] / $item['thumbsize'][1];
275
- if($wrapper_r < $thumb_r) {
276
- $orientation = 'landscape';
277
- $margin = 'margin:0 0 0 -' . floor(($allsettings['thumbHeight'] * $thumb_r - $allsettings['thumbWidth']) / $allsettings['thumbWidth'] * 50) . '%;';
278
- } else {
279
- $orientation = 'portrait';
280
- $margin = 'margin:-' . floor(($allsettings['thumbWidth'] / $thumb_r - $allsettings['thumbHeight']) / $allsettings['thumbHeight'] * 25) . '% 0 0 0;';
281
- }
282
-
283
- $class = '';
284
- $style = 'left:50%; top:50%; transform:translate(-50%, -50%);'
285
- ?>
286
- <div class="gmPhantom_ThumbContainer gmPhantom_ThumbLoader<?php echo(!in_array($item['type'], array('image'))? " mfp-iframe" : ''); ?>" data-ratio="<?php echo $thumb_r; ?>" data-no="<?php echo $i++; ?>"><?php
287
- ?><a href="<?php echo $gmCore->upload['url'] . $item['src']; ?>" class="gmPhantom_Thumb"><img style="<?php echo $style; ?>" src="<?php echo $item['thumb']; ?>" alt="<?php echo esc_attr($item['title']); ?>"/></a><?php
288
- if(in_array($allsettings['thumbsInfo'], array('label', 'label_bottom')) && ($item['title'] != '')) {
289
- if(!empty($item['link'])) {
290
- $item['title'] = "<a href='{$item['link']}' target='{$item['linkTarget']}'>{$item['title']}</a>";
291
- }
292
- ?>
293
- <div class="gmPhantom_ThumbLabel"><?php echo $item['title']; ?></div>
294
- <div style="display:none;" class="gmPhantom_ThumbCaption"><?php echo $item['text']; ?></div><?php
295
- } ?></div><?php
296
- } ?><br style="clear:both;"/>
297
- </div>
298
-
299
- <?php if(isset($counts['total_pages']) && !empty($counts['total_pages']) && 1 < intval($counts['total_pages'])){ ?>
300
- <div class="gmPhantom_pagination">
301
- <?php
302
- $params = $_GET;
303
- $gmid = 'gm' . $gallery['term_id'];
304
- $counts['total_pages'] = (int)$counts['total_pages'];
305
- for($x = 1; $x <= $counts['total_pages']; $x++){
306
- $li_class = $x == $counts['current_page']? ' gmPhantom_current_page' : '';
307
- $params[$gmid]['page'] = $x;
308
- $new_query_string = http_build_query($params);
309
- $self = '?' . urldecode($new_query_string);
310
- echo "<a class='gmPhantom_pager{$li_class}' href='{$self}'>{$x}</a>";
311
- }
312
- ?>
313
- </div>
314
- <?php } ?>
315
- </div>
316
- <?php
317
- } else {
318
- echo '<div class="gmedia-no-files">' . GMEDIA_GALLERY_EMPTY . '</div>';
319
  }
320
-
321
-
2
  /** @var $gmDB
3
  * @var $gmCore
4
  * @var $gmGallery
 
5
  * @var $module
6
  * @var $settings
7
  * @var $terms
9
  * @var $is_bot
10
  **/
11
 
12
+ global $wp;
13
+ $settings = array_merge($settings, array('ID' => $id,
14
+ 'url' => add_query_arg($_SERVER['QUERY_STRING'], '', home_url($wp->request)),
15
+ 'module_dirurl' => $module['url'],
16
+ 'ajax_actions' => array('comments' => array('action' => 'load_comments',
17
+ 'data' => array('post_id' => 0)
18
+ )
19
+ ),
 
20
  ));
21
  $allsettings = array_merge($module['options'], $settings);
22
 
23
+ $base_url_host = parse_url($gmCore->upload['url'], PHP_URL_HOST);
24
+ $term_url = remove_query_arg('gm' . $id);
25
+
26
+ $query['per_page'] = $allsettings['per_page'];
27
+ $gmedias = $gmDB->get_gmedias($query);
28
+ if($gmDB->openPage < $gmDB->pages){
29
+ $load_query = $query;
30
+ $load_query['page'] = $gmDB->openPage + 1;
31
+ $load_more = urldecode(add_query_arg(array("gm{$id}" => $load_query), $term_url));
32
+ } else{
33
+ $load_more = false;
34
+ }
35
+
36
+ if(empty($gmedias)){
37
+ echo GMEDIA_GALLERY_EMPTY;
38
+
39
+ return;
40
+ }
41
+ $native = !empty($atts['native'])? true : false;
42
+
43
+ if(!isset($is_bot)){
44
  $is_bot = false;
45
  }
46
+ if(!isset($shortcode_raw)){
47
  $shortcode_raw = false;
48
  }
 
 
 
 
49
 
50
+ ?>
51
+ <div class="gmPhantom_Container noLightbox" <?php echo $is_bot? '' : 'style="opacity:0"'; ?>>
52
+ <?php
53
+ $thumbsWrapper_class = (int)$allsettings['thumbScale']? ' gmPhantom_ThumbScale' : '';
54
+ if('label' == $allsettings['thumbsInfo']){
55
+ if((int)$allsettings['labelOnHover']){
56
+ $thumbsWrapper_class .= ' gmPhantom_LabelHover';
57
+ } else{
58
+ $thumbsWrapper_class .= ' gmPhantom_LabelInside';
 
 
59
  }
60
+ } elseif('label_bottom' == $allsettings['thumbsInfo']){
61
+ $thumbsWrapper_class .= ' gmPhantom_LabelBottom';
62
+ } elseif('tooltip' == $allsettings['thumbsInfo']){
63
+ $thumbsWrapper_class .= ' gmPhantom_LabelTooltip';
64
+ } elseif('none' == $allsettings['thumbsInfo']){
65
+ $thumbsWrapper_class .= ' gmPhantom_LabelNone';
66
  }
67
+ ?>
68
+ <div class="gmPhantom_thumbsWrapper<?php echo $thumbsWrapper_class; ?>">
69
+ <?php
70
+ $web_size = array();
71
+ $thumb_size = array();
72
+ foreach($gmedias as $item){
73
+ $image = $gmCore->gm_get_media_image($item->ID, 'web');
74
+ $thumb = $gmCore->gm_get_media_image($item->ID, 'thumb');
75
+ $type = explode('/', $item->mime_type);
76
+ $type = $type[0];
77
+ $ext = strtolower(pathinfo($item->gmuid, PATHINFO_EXTENSION));
78
 
79
+ $meta = $gmDB->get_metadata('gmedia', $item->ID);
80
+ $_metadata = isset($meta['_metadata'])? $meta['_metadata'][0] : array();
81
+ if(!isset($_metadata['web'])){
82
+ if(!isset($web_size[ $image ])){
83
+ $web_size[ $image ] = getimagesize($image);
84
+ }
85
+ $_metadata['web'] = array('width' => $web_size[ $image ][0], 'height' => $web_size[ $image ][1]);
 
 
 
 
86
 
87
+ if(!isset($thumb_size[ $image ])){
88
+ $thumb_size[ $image ] = getimagesize($thumb);
89
+ }
90
+ $_metadata['thumb'] = array('width' => $thumb_size[ $image ][0], 'height' => $thumb_size[ $image ][1]);
91
+ }
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ $description = str_replace(array("\r\n", "\r", "\n"), '', wpautop($item->description));
94
+ $title = $item->title;
95
+ $alttext = !empty($meta['_image_alt'][0])? $meta['_image_alt'][0] : $item->title;
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ $link_target = '';
98
+ if($item->link){
99
+ $url_host = parse_url($item->link, PHP_URL_HOST);
100
+ if($url_host == $base_url_host || empty($url_host)){
101
+ $link_target = '_self';
102
+ } else{
103
+ $link_target = '_blank';
104
+ }
105
+ if(isset($meta['link_target'][0])){
106
+ $link_target = $meta['link_target'][0];
107
+ }
108
+ $title = "<a href='{$item->link}' target='{$link_target}'>" . ($title? $title : $item->gmuid) . '</a>';
109
+ }
110
 
111
+ if('image' === $type){
112
+ $download_link = "{$gmCore->upload['url']}/{$gmGallery->options['folder']['image_original']}/{$item->gmuid}";
113
+ } else{
114
+ $download_link = "{$gmCore->upload['url']}/{$gmGallery->options['folder'][$type]}/{$item->gmuid}";
115
+ }
116
+
117
+ $thumb_r = $_metadata['thumb']['width'] / $_metadata['thumb']['height'];
118
+ $item_data = array('id' => $item->ID,
119
+ 'post_id' => $item->post_id,
120
+ 'ratio' => $thumb_r,
121
+ 'type' => $type,
122
+ 'ext' => $ext
123
+ );
124
 
125
+ $item_data['views'] = empty($meta['views'][0])? 0 : (int)$meta['views'][0];
126
+ $item_data['likes'] = empty($meta['likes'][0])? 0 : (int)$meta['likes'][0];
127
+
128
+ if(!empty($allsettings['commentsEnabled'])){
129
+ $cc = 0;
130
+ if($item->post_id){
131
+ $cc = wp_count_comments($item->post_id);
132
+ $cc = $cc->approved;
133
+ }
134
+ $item_data['cc'] = $cc;
135
+ }
136
+
137
+ if($allsettings['share_post_link']){
138
+ $item_data['post_link'] = get_permalink($item->post_id);
139
+ }
140
+
141
+ if($allsettings['show_download_button']){
142
+ $item_data['download'] = $download_link;
143
+ $item_data['filename'] = $item->gmuid;
144
+ }
145
+
146
+ if($item->link){
147
+ $item_data['link'] = $item->link;
148
+ $item_data['target'] = $link_target;
149
+ }
150
+
151
+ $item_data_html = '';
152
+ foreach($item_data as $key => $val){
153
+ $item_data_html .= " data-{$key}=\"{$val}\"";
154
+ }
155
+ ?>
156
+ <div class="gmPhantom_ThumbContainer gmPhantom_ThumbLoader<?php echo(!in_array($type, array('image'))? " mfp-iframe" : ''); ?>"<?php echo $item_data_html; ?>>
157
+ <a href="<?php echo "{$gmCore->upload['url']}/{$gmGallery->options['folder'][$type]}/{$item->gmuid}"; ?>" class="gmPhantom_Thumb"><img src="<?php echo $thumb; ?>" data-src="<?php echo $image; ?>" alt="<?php esc_attr_e($alttext); ?>"/></a>
158
+ <?php
159
+ if(in_array($allsettings['thumbsInfo'], array('label', 'label_bottom'))){ ?>
160
+ <div class="gmPhantom_ThumbLabel"><span class="gmPhantom_ThumbLabel_title"><?php echo $title; ?></span></div>
161
+ <?php
162
+ } ?>
163
+ <div style="display:none;" class="gmPhantom_Details">
164
+ <?php
165
+ if(!(int)$allsettings['show_title']){
166
+ $title = '';
167
+ }
168
+ if($title || $description){ ?>
169
+ <div class="gmPhantom_description">
170
+ <div class="gmPhantom_title"><?php echo $title; ?></div>
171
+ <div class="gmPhantom_text"><?php echo $description; ?></div>
172
+ </div>
173
+ <?php } ?>
174
+ <?php
175
+ $tags = array();
176
+ if((int)$allsettings['show_tags'] && ($terms = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag'))){
177
+ foreach($terms as $_term){
178
+ $url = add_query_arg(array("gm{$id}" => array('tag__in' => $_term->term_id)), $term_url);
179
+ $tags[] = '<a href="' . urldecode($url) . '" class="gmPhantom_tag">#' . $_term->name . '</a>';
180
+ }
181
+ }
182
+
183
+ $categories = array();
184
+ if((int)$allsettings['show_categories'] && ($terms = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category'))){
185
+ foreach($terms as $_term){
186
+ $url = add_query_arg(array("gm{$id}" => array('category__in' => $_term->term_id)), $term_url);
187
+ $categories[] = '<a href="' . urldecode($url) . '" class="gmPhantom_cat">' . $_term->name . '</a>';
188
+ }
189
+ }
190
+
191
+ $albums = array();
192
+ if((int)$allsettings['show_albums'] && ($terms = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album'))){
193
+ foreach($terms as $_term){
194
+ $url = add_query_arg(array("gm{$id}" => array('album__in' => $_term->term_id)), $term_url);
195
+ $albums[] = '<a href="' . urldecode($url) . '" class="gmPhantom_alb">' . $_term->name . '</a>';
196
+ }
197
+ }
198
+ ?>
199
+ <div class="gmPhantom_terms">
200
+ <?php
201
+ if(count($tags)){
202
+ ?>
203
+ <div class="gmPhantom_tags_container"><?php echo implode(' ', $tags); ?></div>
204
+ <?php }
205
+
206
+ $details = array();
207
+ $details[ __('Album', 'grand-media') ] = implode(', ', $albums);
208
+ $cat_key = (count($categories) > 1)? __('Categories', 'grand-media') : __('Category', 'grand-media');
209
+ $details[ $cat_key ] = implode(', ', $categories);
210
+ $details = array_filter($details);
211
+ if(count($details)){
212
+ ?>
213
+ <div class="gmPhantom_other_terms">
214
+ <table class="gmPhantom_other_terms_table">
215
+ <?php foreach($details as $key => $value){ ?>
216
+ <tr class="gmPhantom_term_<?php echo sanitize_key($key); ?>">
217
+ <td class="gmPhantom_term_key"><?php echo ucwords($key); ?></td>
218
+ <td class="gmPhantom_term_value"><?php echo $value; ?></td>
219
+ </tr>
220
+ <?php } ?>
221
+ </table>
222
+ </div>
223
+ <?php
224
+ } ?>
225
+ </div>
226
+ </div>
227
+ </div><?php
228
+ }
229
+ if($load_more){ ?>
230
+ <div class="gmPhantom_LoadMore">
231
+ <?php $nextpage = $gmDB->openPage + 1;
232
+ echo "<a class='gmPhantom_pager' href='{$load_more}' title='" . __('Load more', 'grand-media') . "'><span class='gmPhantom_dots'>&bull;&bull;&bull;</span><span class='gmPhantom_page'>{$nextpage}</span></a>";
233
+ ?>
234
+ </div>
235
+ <?php } ?>
236
+ </div>
237
+ </div>
238
+ <?php
239
+ /* Dynamic CSS */
240
+ $mfp_id = "#mfp_gm_{$id}";
241
+ $mfp_css = '';
242
+ if(isset($settings['lightboxControlsColor'])){
243
+ $mfp_css .= "
244
  {$mfp_id} .mfp-arrow-right:after,
245
  {$mfp_id} .mfp-arrow-right .mfp-a {border-left-color:#{$settings['lightboxControlsColor']};}
246
  {$mfp_id} .mfp-arrow-left:after,
248
  {$mfp_id} .mfp-close,
249
  {$mfp_id} .mfp-comments,
250
  {$mfp_id} .mfp-likes,
 
251
  {$mfp_id} .mfp-share {color:#{$settings['lightboxControlsColor']};}
252
  {$mfp_id} .mfp-preloader {background-color:#{$settings['lightboxControlsColor']};}";
253
+ }
254
+ if(isset($settings['lightboxTitleColor'])){
255
+ $mfp_css .= "
256
  {$mfp_id} .mfp-title,
257
  {$mfp_id} .mfp-counter {color:#{$settings['lightboxTitleColor']};}";
258
+ }
259
+ if(isset($settings['lightboxTextColor'])){
260
+ $mfp_css .= "
261
  {$mfp_id} .mfp-description {color:#{$settings['lightboxTextColor']};}";
262
+ }
263
+ if(isset($settings['lightboxBGColor'])){
264
+ $mfp_css .= "
265
  {$mfp_id}_bg.mfp-bg {background-color:#{$settings['lightboxBGColor']};}";
266
+ }
267
+ if(isset($settings['lightboxBGAlpha'])){
268
+ $alpha = $settings['lightboxBGAlpha'] / 100;
269
+ $mfp_css .= "
270
  {$mfp_id}_bg.mfp-bg {opacity:{$alpha};}
271
  {$mfp_id}_bg.mfp-zoom-in.mfp-bg {opacity:0}
272
  {$mfp_id}_bg.mfp-zoom-in.mfp-ready.mfp-bg {opacity:{$alpha};}
273
  {$mfp_id}_bg.mfp-zoom-in.mfp-removing.mfp-bg {opacity:0}";
274
+ }
275
+ if(isset($settings['sidebarBGColor'])){
276
+ $mfp_css .= "
 
 
 
 
 
 
277
  {$mfp_id} .mfp-comments-content {background-color:#{$allsettings['commentsBGColor']};}";
278
+ }
279
+ if($mfp_css){
280
+ $settings['mfp_css'] = $mfp_css;
281
+ }
 
282
 
283
+ $cssid = "#GmediaGallery_{$id}";
284
+ $dcss = '';
285
+ if(isset($settings['thumbWidth']) || isset($settings['thumbHeight']) || isset($settings['thumbWidthMobile']) || isset($settings['thumbHeightMobile'])){
286
+ $fsize1 = $allsettings['thumbHeight'] / 2;
287
+ $fsize2 = $allsettings['thumbHeightMobile'] / 2;
288
+ $dcss .= "
289
+ {$cssid} .gmPhantom_ThumbContainer,
290
+ {$cssid} .gmPhantom_LoadMore {width:{$allsettings['thumbWidth']}px; height:{$allsettings['thumbHeight']}px;}
291
+ {$cssid} .gmPhantom_MobileView .gmPhantom_ThumbContainer,
292
+ {$cssid} .gmPhantom_MobileView .gmPhantom_LoadMore {width:{$allsettings['thumbWidthMobile']}px; height:{$allsettings['thumbHeightMobile']}px;}
293
+ {$cssid} .gmPhantom_LoadMore .gmPhantom_pager {font-size:{$fsize1}px;line-height:{$allsettings['thumbHeight']}px;}
294
+ {$cssid} .gmPhantom_MobileView .gmPhantom_LoadMore .gmPhantom_pager {font-size:{$fsize2}px;line-height:{$allsettings['thumbHeightMobile']}px;}
295
+ {$cssid} .gmPhantom_LoadMore[data-col=\"1\"] {width:100%;height:50px;}
296
+ {$cssid} .gmPhantom_LoadMore[data-col=\"1\"] .gmPhantom_pager,
297
+ {$cssid} .gmPhantom_MobileView .gmPhantom_LoadMore[data-col=\"1\"] .gmPhantom_pager {font-size:40px;line-height:50px;}";
298
+ }
299
+ if(isset($settings['thumbsSpacing'])){
300
+ $dcss .= "
301
+ {$cssid} .gmPhantom_ThumbContainer,
302
+ {$cssid} .gmPhantom_LoadMore {margin:{$settings['thumbsSpacing']}px 0 0 {$settings['thumbsSpacing']}px;}
303
+ {$cssid} .gmPhantom_LoadMore[data-col=\"1\"] {transform:translate(0, {$settings['thumbsSpacing']}px);}";
304
+ }
305
+ if(isset($settings['thumbPadding'])){
306
+ $dcss .= "
307
+ {$cssid} .gmPhantom_ThumbContainer,
308
+ {$cssid} .gmPhantom_LoadMore {padding:{$allsettings['thumbPadding']}px;}
309
+ {$cssid} .gmPhantom_LabelBottom .gmPhantom_ThumbContainer,
310
+ {$cssid} .gmPhantom_LabelBottom .gmPhantom_LoadMore {padding-bottom:36px;}";
311
+ }
312
+ if(isset($settings['thumbBG'])){
313
+ if('' == $settings['thumbBG']){
314
  $dcss .= "
 
 
 
 
 
315
  {$cssid} .gmPhantom_ThumbContainer {background-color:transparent;}";
316
+ } else{
317
+ $dcss .= "
318
  {$cssid} .gmPhantom_ThumbContainer,
319
  {$cssid} .gmPhantom_LabelBottom .gmPhantom_ThumbLabel {background-color:#{$settings['thumbBG']};}";
 
320
  }
321
+ }
322
+ if(isset($settings['thumbAlpha'])){
323
+ $alpha = $settings['thumbAlpha'] / 100;
324
+ $dcss .= "
325
  {$cssid} .gmPhantom_ThumbContainer .gmPhantom_Thumb {opacity:{$alpha};}";
326
+ }
327
+ if(isset($settings['thumbAlphaHover'])){
328
+ $alpha = $settings['thumbAlphaHover'] / 100;
329
+ $dcss .= "
330
  {$cssid} .gmPhantom_ThumbContainer:hover .gmPhantom_Thumb {opacity:{$alpha};}";
331
+ }
332
+ if(isset($settings['thumbBorderSize']) || isset($settings['thumbBorderColor'])){
333
+ if((int)$settings['thumbBorderSize']){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  $dcss .= "
335
+ {$cssid} .gmPhantom_ThumbContainer,
336
+ {$cssid} .gmPhantom_LoadMore {border:{$allsettings['thumbBorderSize']}px solid #{$allsettings['thumbBorderColor']};}";
337
  }
338
+ }
339
+ if(isset($settings['thumbBorderSize'])){
340
+ if((int)$settings['thumbBorderSize'] > 1){
341
  $dcss .= "
342
+ {$cssid} .gmPhantom_ThumbContainer,
343
+ {$cssid} .gmPhantom_LoadMore {box-shadow:0 0 5px -2px;}";
344
  }
345
+ }
346
+ if(isset($settings['label8TextColor'])){
347
+ $dcss .= "
348
+ {$cssid} .gmPhantom_ThumbLabel {color:#{$allsettings['label8TextColor']};}";
349
+ }
350
+ if(isset($settings['label8LinkColor'])){
351
+ $dcss .= "
352
+ {$cssid} .gmPhantom_ThumbLabel a {color:#{$allsettings['label8LinkColor']};}";
353
+ }
354
+ if(isset($settings['labelTextColor'])){
355
+ $dcss .= "
356
  {$cssid} .gmPhantom_LabelInside .gmPhantom_ThumbLabel,
357
  {$cssid} .gmPhantom_LabelHover .gmPhantom_ThumbLabel {color:#{$allsettings['labelTextColor']};}";
358
+ }
359
+ if(isset($settings['labelLinkColor'])){
360
+ $dcss .= "
361
  {$cssid} .gmPhantom_LabelInside .gmPhantom_ThumbLabel a,
362
+ {$cssid} .gmPhantom_LabelHover .gmPhantom_ThumbLabel a,
363
+ {$cssid} .gmPhantom_LabelInside .gmPhantom_ThumbLabel a:hover,
364
+ {$cssid} .gmPhantom_LabelHover .gmPhantom_ThumbLabel a:hover {color:#{$allsettings['labelLinkColor']};}";
365
+ }
366
+ if((int) $allsettings['bgAlpha'] > 0){
367
+ if(method_exists($gmCore, 'hex2rgb')) {
368
+ $rgb = implode(',', $gmCore->hex2rgb($allsettings['bgColor']));
369
+ $alpha = $allsettings['bgAlpha'] / 100;
370
+ $dcss .= "
371
+ {$cssid} .gmPhantom_Container {background-color:rgba({$rgb},{$alpha});}";
372
+ } else {
373
+ $dcss .= "
374
+ {$cssid} .gmPhantom_Container {background-color:#{$allsettings['bgColor']};}";
375
  }
376
+ }
377
+ if($dcss){
378
+ $customCSS = $dcss . $customCSS;
379
+ }
380
 
381
+ if(!$is_bot){
382
+ if($shortcode_raw){
383
+ echo '<pre style="display:none">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
385
  ?>
386
+ <script type="text/javascript">
387
+ jQuery(function() {
388
+ var settings = <?php echo json_encode($settings); ?>;
389
+ jQuery('#GmediaGallery_<?php echo $id; ?>').gmPhantom([settings]);
390
+ });
391
+ </script><?php
392
+ if($shortcode_raw){
393
+ echo '</pre>';
394
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  }
 
 
module/phantom/js/jquery.gmPhantom.js CHANGED
@@ -1,6 +1,6 @@
1
  /*
2
  * Title : gmPhantom
3
- * Version : 3.7
4
  * Copyright : 2013-2015 CodEasily.com
5
  * Website : http://www.codeasily.com
6
  */
@@ -9,14 +9,14 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
9
  $.fn.gmPhantom = function(method) {
10
  var Container = this,
11
  elID = $(this).attr('id'),
12
- ID = '',
13
  Content,
14
  opt,
15
  timeout,
16
 
17
  opt_str = {
18
  'thumbsNavigation': 'scroll', // Thumbnails Navigation (mouse, scroll). Default value: mouse. Set how you navigate through the thumbnails.
19
- 'thumbsAlign': 'left', // Thumbnails align. Default value: left.
20
  'thumbsInfo': 'label', // Info Thumbnails Display (none, tooltip, label). Default value: tooltip. Display a small info text on the thumbnails, a tooltip or a label on bottom.
21
  'mfp_css': '',
22
  'module_dirurl': '',
@@ -25,69 +25,57 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
25
  'bgColor': 'ffffff', // Background Color (color hex code). Default value: ffffff. Set gallery background color.
26
  'thumbBG': 'ffffff', // Thumbnail Border Color (color hex code). Default value: cccccc. Set the color of a thumbnail's border.
27
  'thumbBorderColor': 'cccccc', // Thumbnail Border Color (color hex code). Default value: cccccc. Set the color of a thumbnail's border.
28
- 'tooltipTextColor': '0b0b0b', // Tooltip Text Color (color hex code). Default value: 000000. Set tooltip text color.
29
- 'tooltipBgColor': 'ffffff', // Tooltip Background Color (color hex code). Default value: ffffff. Set tooltip background color.
30
- 'tooltipStrokeColor': '000000', // Tooltip Stroke Color (color hex code). Default value: 000000. Set tooltip stroke color.
31
- 'labelTextColor': 'e7e7e7', // Label-Over Text Color (color hex code). Default value: 000000.
32
  'labelLinkColor': 'e7e179',
33
  'label8TextColor': '0b0b0b', // Label Text Color (color hex code). Default value: 000000.
34
  'label8LinkColor': '3695E7',
 
35
  'lightboxControlsColor': 'ffffff', // Tooltip Text Color (color hex code). Default value: 000000.
36
  'lightboxTitleColor': 'f3f3f3', // Tooltip Text Color (color hex code). Default value: 000000.
37
  'lightboxTextColor': 'f3f3f3', // Tooltip Text Color (color hex code). Default value: 000000.
38
  'lightboxBGColor': '0b0b0b' // Lightbox Window Color (color hex code). Default value: 000000. Set the color for the lightbox window.
39
  },
40
  opt_int = {
41
- 'initRPdelay': 100,
42
  'maxheight': 0,
43
  'thumbCols': 0, // Number of Columns (auto, number). Default value: 0. Set the number of columns for the grid.
44
  'thumbRows': 0, // Number of Lines (auto, number). Default value: 0. Set the number of lines for the grid.
45
  'bgAlpha': 0, // Background Alpha (value from 0 to 100). Default value: 0. Set gallery background alpha.
46
- 'thumbWidth': 160, // Thumbnail Width (the size in pixels). Default value: 150. Set the width of a thumbnail.
47
- 'thumbHeight': 120, // Thumbnail Height (the size in pixels). Default value: 150. Set the height of a thumbnail.
48
- 'thumbWidthMobile': 96,
49
- 'thumbHeightMobile': 72,
50
- 'thumbsSpacing': 10, // Thumbnails Spacing (value in pixels). Default value: 10. Set the space between thumbnails.
51
- 'thumbsVerticalPadding': 5, // Thumbnails Padding Top (value in pixels). Default value: 5. Set the top padding for the thumbnails.
52
- 'thumbsHorizontalPadding': 3, // Thumbnails Padding Top (value in pixels). Default value: 5. Set the top padding for the thumbnails.
53
- 'thumbAlpha': 85, // Thumbnail Alpha (value from 0 to 100). Default value: 85. Set the transparancy of a thumbnail.
54
  'thumbAlphaHover': 100, // Thumbnail Alpha Hover (value from 0 to 100). Default value: 100. Set the transparancy of a thumbnail when hover.
55
  'thumbBorderSize': 1, // Thumbnail Border Size (value in pixels). Default value: 1. Set the size of a thumbnail's border.
56
- 'thumbPadding': 5, // Thumbnail Padding (value in pixels). Default value: 3. Set padding value of a thumbnail.
57
  'lightboxBGAlpha': 80 // Lightbox Window Alpha (value from 0 to 100). Default value: 80. Set the transparancy for the lightbox window.
58
  },
59
  opt_bool = {
60
  'deepLinks': true,
61
  'socialShareEnabled': true, // Social Share Enabled (true, false). Default value: true.
62
- 'share_post_link': false,
 
 
 
63
  'viewsEnabled': true,
64
  'likesEnabled': true,
65
  'commentsEnabled': true, // Comments Enabled (true, false). Default value: true.
66
  'lightbox800HideArrows': false, // Hide Arrows if window width less than 800px.
67
  'thumbScale': true, // Scale effect for thumb on mouseover
68
  'labelOnHover': true, // Show thumb label only on mouseover
69
- 'thumb2link': true // Open link instead of lightbox when item have "link" attr
70
  },
71
 
72
- IDs = [],
73
- Post_IDs = [],
74
- Types = [],
75
- Extentions = [],
76
- Sources = [],
77
- Images = [],
78
- Thumbs = [],
79
- CaptionTitle = [],
80
- CaptionText = [],
81
- CommentsCount = [],
82
- ViewsCount = [],
83
- LikesCount = [],
84
- PostLinks = [],
85
- Links = [],
86
- LinksTarget = [],
87
  noItems = 0,
88
 
89
- magItems = {},
90
- Storage = {},
91
 
92
  startGalleryID = 0,
93
  startWith = 0,
@@ -100,7 +88,8 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
100
 
101
  methods = {
102
  init: function(arguments) {// Init Plugin.
103
- opt = $.extend(true, {}, opt_str, opt_int, opt_bool, opt_hex, arguments[1]);
 
104
  $.each(opt, function(key, val) {
105
  if(key in opt_bool) {
106
  opt[key] = (!(!val || val == '0' || val == 'false'));
@@ -108,7 +97,6 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
108
  opt[key] = parseInt(val);
109
  }
110
  });
111
- ID = opt.ID;
112
  opt.initialHeight = opt.maxheight;
113
  opt.initialCols = opt.thumbCols;
114
  opt.initialRows = opt.thumbRows;
@@ -117,110 +105,100 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
117
  opt.dratio = opt.thumbWidthDesktop / opt.thumbHeightDesktop;
118
  opt.mratio = opt.thumbWidthMobile / opt.thumbHeightMobile;
119
 
120
- Content = arguments[0];
121
  methods.parseContent();
122
 
123
- $(window).bind('resize.gmPhantom', methods.initRP);
 
 
 
 
 
 
 
124
 
125
  setTimeout(methods.initRP, opt.initRPdelay);
126
  },
127
  parseContent: function() {// Parse Content.
128
- $.each(Content, function(index) {
129
- $.each(Content[index], function(key) {
130
- switch(key) {
131
- case 'id':
132
- IDs.push(Content[index][key]);
133
- break;
134
- case 'post_id':
135
- Post_IDs.push(Content[index][key]);
136
- break;
137
- case 'type':
138
- Types.push(Content[index][key]);
139
- break;
140
- case 'ext':
141
- Extentions.push(Content[index][key]);
142
- break;
143
- case 'src':
144
- Sources.push(GmediaGallery.upload_dirurl + Content[index][key]);
145
- break;
146
- case 'image':
147
- Images.push(Content[index][key]);
148
- break;
149
- case 'thumb':
150
- Thumbs.push(Content[index][key]);
151
- break;
152
- case 'title':
153
- CaptionTitle.push(Content[index][key]);
154
- break;
155
- case 'text':
156
- CaptionText.push(Content[index][key]);
157
- break;
158
- case 'cc':
159
- CommentsCount.push(Content[index][key]);
160
- break;
161
- case 'views':
162
- ViewsCount.push(Content[index][key]);
163
- break;
164
- case 'likes':
165
- LikesCount.push(Content[index][key]);
166
- break;
167
- case 'post_link':
168
- PostLinks.push(Content[index][key]);
169
- break;
170
- case 'link':
171
- Links.push(Content[index][key]);
172
- break;
173
- case 'linkTarget':
174
- if(Content[index][key] === '') {
175
- LinksTarget.push('_self');
176
- }
177
- else {
178
- LinksTarget.push(Content[index][key]);
179
- }
180
- break;
181
- }
182
- });
183
- });
184
 
185
- noItems = Thumbs.length;
186
  methods.rpResponsive();
187
 
188
- methods.initGallery();
 
 
 
189
 
190
  },
191
  initGallery: function() {// Init the Gallery
192
 
193
  var currentScrollPosition = 0;
194
- $(document).scroll(function(){
195
  currentScrollPosition = $(this).scrollTop();
196
  });
197
  window.onhashchange = function() {
198
  methods.loadGalleryDeepLink();
199
  };
200
 
201
- $("input, textarea").focus(function(){
202
  $(document).scrollTop(currentScrollPosition);
203
  });
204
 
205
  var browser_class = '';
206
- if (prototypes.isIEBrowser()) {
207
- if (prototypes.isIEBrowser() < 8) {
208
  browser_class += ' msie msie7';
209
  } else {
210
  browser_class += ' msie';
211
  }
212
  }
213
- if (prototypes.isTouchDevice()) {
214
  browser_class += ' istouch';
215
  }
216
 
217
  $('.gmPhantom_thumbsWrapper', Container).addClass(browser_class);
218
- if (opt.thumbsInfo == 'tooltip' && !prototypes.isTouchDevice()) {
219
  $('.gmPhantom_Container', Container).append('<div class="gmPhantom_Tooltip"></div>');
220
  }
221
 
222
  methods.initSettings();
223
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  var thumbs_wrapper = $('.gmPhantom_thumbsWrapper', Container);
225
  thumbs_wrapper.magnificPopup({
226
  type: 'image',
@@ -237,53 +215,19 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
237
  // Function will fire for each target element
238
  // "item.el" is a target DOM element (if present)
239
  // "item.src" is a source that you may modify
240
- var no = parseInt(item.el.data('no'));
241
- item.no = no;
242
- item.gm_id = IDs[no];
243
- item.gm_type = Types[no];
244
- item.gm_ext = Extentions[no];
245
- if('image' == item.gm_type) {
246
- item.src = Images[no];
247
- } else {
248
- item.src = Sources[no];
249
- }
250
- item.title = CaptionTitle[no];
251
- item.description = CaptionText[no];
252
- item.gm_link = Links[no];
253
- item.gm_link_target = LinksTarget[no];
254
 
255
- if(opt.viewsEnabled || opt.likesEnabled) {
256
- item.views = ViewsCount[no];
257
- if(opt.likesEnabled) {
258
- item.likes = LikesCount[no];
259
- }
260
- if(!Storage[item.gm_id]){
261
- Storage[item.gm_id] = {}
262
- }
263
- if (Storage[item.gm_id].status) {
264
- item.viewed = true;
265
- if(opt.likesEnabled) {
266
- if('liked' == Storage[item.gm_id].status) {
267
- item.liked = true;
268
- } else {
269
- item.liked = false;
270
- }
271
- }
272
- }
273
- }
274
 
275
- if(typeof(magItems[item.index]) == 'undefined') {
276
- magItems[item.index] = item;
277
- }
278
  },
279
  markupParse: function(template, values, item) {
280
- if(item.gm_link) {
281
- values.title = '<a href="' + item.gm_link + '" target="' + item.gm_link_target + '">' + item.title + '</a>';
282
- } else {
283
- values.title = item.title;
284
-
285
- }
286
- values.description = item.description;
287
  },
288
 
289
  imageLoadComplete: function() {
@@ -294,23 +238,64 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
294
  },
295
  open: function() {
296
  $(document.body).addClass('mfp-gmedia-open');
297
- itemLoaded = 1;
298
- if(opt.commentsEnabled){
299
  this.wrap.on('click.gmCloseComments', '.mfp-img--comments-div', function() {
300
  $('#mfp_comments_' + ID, this.wrap).trigger('click');
301
  return false;
302
  });
 
 
 
 
303
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  },
305
  close: function() {
306
  $(document.body).removeClass('mfp-gmedia-open');
307
- if('image' != magItems[this.currItem.index].gm_type) {
308
  $(document.body).removeClass('mfp-zoom-out-cur');
309
  this.wrap.removeClass('mfp-iframe-loaded');
310
  }
311
  this.wrap.removeClass('mfp-image-loaded');
312
 
313
- if(opt.commentsEnabled){
314
  this.wrap.off('click.gmCloseComments');
315
  }
316
  if(opt.deepLinks) {
@@ -322,13 +307,13 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
322
  location.replace(url);
323
  }
324
  }
325
- this.contentContainer.attr('data-gmtype', magItems[this.currItem.index].gm_type).attr('data-ext', magItems[this.currItem.index].gm_ext);
326
- $('#wpadminbar').css({'z-index':''});
327
- itemLoaded = 0;
328
  $(window).scrollTop(scrollTop);
 
329
  },
330
  beforeOpen: function() {
331
- $('#wpadminbar').css({'z-index':1000});
332
  $(this.wrap).attr('id', 'mfp_gm_' + ID);
333
  $(this.bgOverlay).attr('id', 'mfp_gm_' + ID + '_bg');
334
  if(opt.lightbox800HideArrows) {
@@ -341,7 +326,7 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
341
  },
342
  change: function() {
343
  if(opt.deepLinks) {
344
- var hash = "#!gallery-" + ID + '-' + magItems[this.currItem.index].gm_id,
345
  url = ('' + window.location).split('#')[0] + hash;
346
  if(!!(window.history && window.history.replaceState)) {
347
  window.history.replaceState({}, document.title, url);
@@ -349,7 +334,7 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
349
  location.replace(url);
350
  }
351
  }
352
- this.contentContainer.attr('data-gmtype', magItems[this.currItem.index].gm_type).attr('data-ext', magItems[this.currItem.index].gm_ext);
353
  if(opt.commentsEnabled) {
354
  this.wrap.removeClass('mfp-comments-open mfp-comments-loaded');
355
  $('.mfp-comments-wrapper', this.contentContainer).css({height: ''}).empty();
@@ -358,7 +343,7 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
358
  this.wrap.removeClass('phantom-gmedia-liked');
359
  }
360
  clearTimeout(timeout);
361
- if('image' != magItems[this.currItem.index].gm_type) {
362
  $(document.body).addClass('mfp-zoom-out-cur');
363
  var self = this;
364
  setTimeout(function() {
@@ -368,8 +353,13 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
368
  },
369
  afterChange: function() {
370
  if(opt.socialShareEnabled) {
371
- methods.initSocialShare(magItems[this.currItem.index].no, this);
372
  }
 
 
 
 
 
373
  if(opt.viewsEnabled || opt.likesEnabled) {
374
  var self = this;
375
  timeout = setTimeout(function() {
@@ -377,63 +367,61 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
377
  }, 1000);
378
 
379
  if(opt.viewsEnabled) {
380
- methods.initViews(magItems[this.currItem.index].no, this);
381
  }
382
  if(opt.likesEnabled) {
383
- methods.initLikes(magItems[this.currItem.index].no, this);
384
- if (Storage[magItems[this.currItem.index].gm_id] && Storage[magItems[this.currItem.index].gm_id].status && 'liked' == Storage[magItems[this.currItem.index].gm_id].status) {
385
  this.wrap.addClass('phantom-gmedia-liked');
386
  } else {
387
  this.wrap.removeClass('phantom-gmedia-liked');
388
  }
389
  }
390
  }
391
- if(opt.commentsEnabled) {
392
- methods.initComments(magItems[this.currItem.index].no, this);
393
- }
394
  },
395
  updateStatus: function(data) {
396
  //console.log(data);
397
- //if(data.status == 'ready') {}
 
 
398
  }
399
  },
400
  image: {
401
- markup: ''+
402
  '<div class="mfp-figure">' +
403
  ' <div class="mfp-close"></div>' +
404
  ' <figure>' +
405
  ' <div class="mfp-img"></div>' +
406
  ' <figcaption>' +
407
  ' <div class="mfp-bottom-bar">' +
408
- ' <div class="mfp-title"></div>' +
409
- ' <div class="mfp-description"></div>' +
410
  ' <div class="mfp-counter"></div>' +
411
  ' </div>' +
412
  ' </figcaption>' +
413
  ' </figure>' +
414
  '</div>' +
415
  '<div class="mfp-comments-container">' +
416
- ' <div class="mfp-comments-content"><div class="mfp-comments-wrapper"></div></div>' +
417
  '</div>' +
418
- '<div class="mfp-prevent-close mfp-buttons-bar"></div>'
419
  },
420
  iframe: {
421
- markup: ''+
422
  '<div class="mfp-iframe-wrapper">' +
423
  ' <div class="mfp-close"></div>' +
424
  ' <div class="mfp-iframe-scaler">' +
425
  ' <iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowtransparency="true" allowfullscreen></iframe>' +
426
  ' </div>' +
427
  ' <div class="mfp-bottom-bar gm-iframe-bottom-bar">' +
428
- ' <div class="mfp-title"></div>' +
429
- ' <div class="mfp-description"></div>' +
430
  ' <div class="mfp-counter"></div>' +
431
  ' </div>' +
432
  '</div>' +
433
  '<div class="mfp-comments-container">' +
434
- ' <div class="mfp-comments-content"><div class="mfp-comments-wrapper"></div></div>' +
435
  '</div>' +
436
- '<div class="mfp-prevent-close mfp-buttons-bar"></div>'
437
  },
438
  gallery: {
439
  enabled: true,
@@ -448,6 +436,19 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
448
 
449
  methods.loadGalleryDeepLink();
450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  },
452
  loadGalleryDeepLink: function() {
453
  var prefix = "#!gallery-";
@@ -457,7 +458,7 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
457
  if(h[0] && parseInt(h[0]) == ID) {
458
  $(document).scrollTop($(Container).offset().top);
459
  if(h[1]) {
460
- startWith = IDs.indexOf(h[1]);
461
  } else {
462
  startWith = 0;
463
  }
@@ -467,63 +468,29 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
467
  }
468
  }
469
  },
470
- initSocialShare: function(no, mfp) {
471
- var share_buttons = ''+
472
- '<div class="mfp-prevent-close mfp-button mfp-share mfp-gmedia-stuff08" id="mfp_share_' + ID + '">'+
473
- ' <a class="mfp-prevent-close" title="Share">'+
474
- ' <span class="mfp-prevent-click">'+
475
- ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-share2" viewBox="0 0 1024 1024"><path class="path1" d="M864 704c-45.16 0-85.92 18.738-115.012 48.83l-431.004-215.502c1.314-8.252 2.016-16.706 2.016-25.328s-0.702-17.076-2.016-25.326l431.004-215.502c29.092 30.090 69.852 48.828 115.012 48.828 88.366 0 160-71.634 160-160s-71.634-160-160-160-160 71.634-160 160c0 8.622 0.704 17.076 2.016 25.326l-431.004 215.504c-29.092-30.090-69.852-48.83-115.012-48.83-88.366 0-160 71.636-160 160 0 88.368 71.634 160 160 160 45.16 0 85.92-18.738 115.012-48.828l431.004 215.502c-1.312 8.25-2.016 16.704-2.016 25.326 0 88.368 71.634 160 160 160s160-71.632 160-160c0-88.364-71.634-160-160-160z"></path></symbol></svg>'+
476
- ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-share2"/></svg>'+
477
- ' </span>'+
478
- ' </a>'+
479
- ' <ul class="mfp-prevent-close mfp-share_sharelizers">'+
480
- ' <li><a class="mfp-prevent-close mfp-share_facebook mfp-share_sharelizer">Facebook</a></li>'+
481
- ' <li><a class="mfp-prevent-close mfp-share_twitter mfp-share_sharelizer">Twitter</a></li>'+
482
- ' <li><a class="mfp-prevent-close mfp-share_pinterest mfp-share_sharelizer">Pinterest</a></li>'+
483
- ' <li><a class="mfp-prevent-close mfp-share_google mfp-share_sharelizer">Google+</a></li>'+
484
- ' <li><a class="mfp-prevent-close mfp-share_stumbleupon mfp-share_sharelizer">StumbleUpon</a></li>'+
485
- ' </ul>'+
486
  '</div>';
487
 
488
  var mfp_share = $(share_buttons);
489
- mfp_share.on('click', function(){
490
  $(this).toggleClass('mfp-share_open');
491
  });
492
 
493
- $('.mfp-share_sharelizer', mfp_share).on('click', function () {
494
- var sharelink,
495
- title = CaptionTitle[no],
496
- imgsrc = Images[no],
497
- url = window.location.href;
498
- if(!opt.deepLinks) {
499
- var hash = "#!gallery-" + ID + '-' + IDs[no];
500
- url = ('' + window.location).split('#')[0] + hash;
501
- }
502
- if(opt.share_post_link){
503
- url = PostLinks[no];
504
- }
505
- if ($(this).hasClass('mfp-share_twitter')) {
506
- sharelink = 'https://twitter.com/home?status=' + encodeURIComponent(title + ' ' + url);
507
- window.open(sharelink, '_blank');
508
- }
509
- if ($(this).hasClass('mfp-share_facebook')) {
510
- sharelink = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url);
511
- window.open(sharelink, '_blank');
512
- }
513
- if ($(this).hasClass('mfp-share_pinterest')) {
514
- sharelink = 'https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(url) + '&media=' + encodeURIComponent(imgsrc) + '&description=' + encodeURIComponent(title);
515
- window.open(sharelink, '_blank');
516
- }
517
- if ($(this).hasClass('mfp-share_google')) {
518
- sharelink = 'https://plus.google.com/share?url=' + encodeURIComponent(url);
519
- window.open(sharelink, '_blank');
520
- }
521
- if ($(this).hasClass('mfp-share_stumbleupon')) {
522
- sharelink = 'http://www.stumbleupon.com/submit?url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title);
523
- window.open(sharelink, '_blank');
524
- }
525
- });
526
-
527
  var share_div = mfp.wrap.find('#mfp_share_' + ID);
528
  if(!share_div.length) {
529
  $('.mfp-buttons-bar', mfp.wrap).append(mfp_share);
@@ -531,37 +498,42 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
531
  $(share_div).replaceWith(mfp_share);
532
  }
533
  },
534
- initComments: function(no, mfp) {
535
- var comments_button = ''+
536
- '<div class="mfp-prevent-close mfp-button mfp-comments" id="mfp_comments_' + ID + '">'+
537
- ' <a class="mfp-prevent-close" title="Comments"><span class="mfp-prevent-close mfp-comments-count">' + CommentsCount[no] + '</span>'+
538
- ' <span class="mfp-prevent-click mfp_comments_icon">'+
539
- ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-bubbles2" viewBox="0 0 1152 1024"><path class="path1" d="M480 0v0c265.096 0 480 173.914 480 388.448s-214.904 388.448-480 388.448c-25.458 0-50.446-1.62-74.834-4.71-103.106 102.694-222.172 121.108-341.166 123.814v-25.134c64.252-31.354 116-88.466 116-153.734 0-9.106-0.712-18.048-2.030-26.794-108.558-71.214-177.97-179.988-177.97-301.89 0-214.534 214.904-388.448 480-388.448zM996 870.686c0 55.942 36.314 104.898 92 131.772v21.542c-103.126-2.318-197.786-18.102-287.142-106.126-21.14 2.65-42.794 4.040-64.858 4.040-95.47 0-183.408-25.758-253.614-69.040 144.674-0.506 281.26-46.854 384.834-130.672 52.208-42.252 93.394-91.826 122.414-147.348 30.766-58.866 46.366-121.582 46.366-186.406 0-10.448-0.45-20.836-1.258-31.168 72.57 59.934 117.258 141.622 117.258 231.676 0 104.488-60.158 197.722-154.24 258.764-1.142 7.496-1.76 15.16-1.76 22.966z"></path></symbol></svg>'+
540
- ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-bubbles2"/></svg>'+
541
- ' </span>'+
542
- ' </a>'+
543
  '</div>';
544
  var mfp_comments = $(comments_button);
545
- mfp_comments.on('click', function(){
546
  var comments_wrapper = $('.mfp-comments-wrapper', mfp.contentContainer);
547
  if(mfp.wrap.hasClass('mfp-comments-open')) {
 
548
  comments_wrapper.css({height: ''});
549
  $('figure > img', mfp.wrap).removeClass('mfp-img--comments-div').addClass('mfp-img');
550
  mfp.wrap.removeClass('mfp-comments-open');
551
  if($(window).width() <= 800) {
 
552
  $('body').delay(200).animate({scrollTop: $('#mfp_gm_' + ID).offset().top}, 400);
553
  } else {
554
  $(window).scrollTop($('#mfp_gm_' + ID).offset().top);
555
  }
556
  } else {
557
- comments_wrapper.css({height: $('iframe', comments_wrapper).height()});
 
 
558
  $('figure > img', mfp.wrap).removeClass('mfp-img').addClass('mfp-img--comments-div');
559
  mfp.wrap.addClass('mfp-comments-open')
560
  if(!mfp.wrap.hasClass('mfp-comments-loaded')) {
561
- methods.loadComments(no, mfp);
562
  }
563
- if($(window).width() <= 800){
564
- $('body').delay(200).animate({scrollTop: ($('.mfp-comments-container', '#mfp_gm_'+ID).offset().top - 250)}, 400);
 
565
  }
566
  }
567
  });
@@ -574,25 +546,58 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
574
  }
575
 
576
  },
577
- initLikes: function(no, mfp) {
578
- if(mfp.currItem.liked){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  mfp.wrap.addClass('phantom-gmedia-liked');
580
  }
581
 
582
- var likes = ''+
583
- '<div class="mfp-prevent-close mfp-button mfp-likes" id="mfp_likes_' + ID + '">'+
584
- ' <a class="mfp-prevent-close"><span class="mfp-prevent-close mfp-likes-count">' + LikesCount[no] + '</span>'+
585
- ' <span class="mfp-prevent-click mfp_likes_icon">'+
586
- ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-heart" viewBox="0 0 1024 1024"><path class="path1" d="M755.188 64c-107.63 0-200.258 87.554-243.164 179-42.938-91.444-135.578-179-243.216-179-148.382 0-268.808 120.44-268.808 268.832 0 301.846 304.5 380.994 512.022 679.418 196.154-296.576 511.978-387.206 511.978-679.418 0-148.392-120.43-268.832-268.812-268.832z"></path></symbol></svg>'+
587
- ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-heart"/></svg>'+
588
- ' </span>'+
589
- ' </a>'+
590
  '</div>';
591
  var likes_obj = $(likes);
592
- likes_obj.on('click', function(){
593
  methods.viewLike(mfp.currItem, true);
594
  mfp.wrap.addClass('phantom-gmedia-liked');
595
- $('.mfp-likes-count', this).text(LikesCount[no]);
596
  });
597
 
598
  var likes_div = $(mfp.wrap).find('#mfp_likes_' + ID);
@@ -603,14 +608,14 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
603
  }
604
 
605
  },
606
- initViews: function(no, mfp) {
607
- var views = ''+
608
- '<div class="mfp-prevent-close mfp-button mfp-views" id="mfp_views_' + ID + '">'+
609
- ' <span class="mfp-prevent-close mfp-prevent-click"><span class="mfp-prevent-close mfp-views-count">' + ViewsCount[no] + '</span>'+
610
- ' <span class="mfp-prevent-close mfp-prevent-click mfp_views_icon">'+
611
- ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-eye" viewBox="0 0 1024 1024"><path class="path1" d="M512 192c-223.318 0-416.882 130.042-512 320 95.118 189.958 288.682 320 512 320 223.312 0 416.876-130.042 512-320-95.116-189.958-288.688-320-512-320zM764.45 361.704c60.162 38.374 111.142 89.774 149.434 150.296-38.292 60.522-89.274 111.922-149.436 150.296-75.594 48.218-162.89 73.704-252.448 73.704-89.56 0-176.858-25.486-252.452-73.704-60.158-38.372-111.138-89.772-149.432-150.296 38.292-60.524 89.274-111.924 149.434-150.296 3.918-2.5 7.876-4.922 11.86-7.3-9.96 27.328-15.41 56.822-15.41 87.596 0 141.382 114.616 256 256 256 141.382 0 256-114.618 256-256 0-30.774-5.452-60.268-15.408-87.598 3.978 2.378 7.938 4.802 11.858 7.302v0zM512 416c0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96 96 42.982 96 96z"></path></symbol></svg>'+
612
- ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-eye"/></svg>'+
613
- ' </span></span>'+
614
  '</div>';
615
 
616
  var views_div = $(mfp.wrap).find('#mfp_views_' + ID);
@@ -621,108 +626,53 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
621
  }
622
 
623
  },
624
- loadComments: function(no, mfp){
625
- var comments_content = $('.mfp-comments-content', mfp.contentContainer),
626
- comments_wrapper = $('.mfp-comments-wrapper', comments_content);
627
- comments_wrapper.empty();
628
- mfp.wrap.removeClass('mfp-comments-loaded').addClass('mfp-comments-loading');
629
- if (GmediaGallery) {
630
- opt.ajax_actions['comments']['data']['post_id'] = Post_IDs[no];
631
- $.ajax({
632
- type : "post",
633
- dataType : "json",
634
- url: GmediaGallery.ajaxurl,
635
- data: {action: opt.ajax_actions['comments']['action'], _ajax_nonce: GmediaGallery.nonce, data: opt.ajax_actions['comments']['data']},
636
- }).done(function(data){
637
- if(data.comments_count){
638
- mfp.wrap.find('.mfp-comments-count').html(data.comments_count);
639
- CommentsCount[no] = data.comments_count
640
- }
641
- if(data.content) {
642
- $('.mfp-comments-wrapper', comments_content).html(data.content).find('iframe').on('load', function() {
643
- mfp.wrap.removeClass('mfp-comments-loading').addClass('mfp-comments-loaded');
644
- var body = this.contentWindow.document.body, html = this.contentWindow.document.documentElement;
645
- var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
646
- $(this).css({height: 20 + height, overflowY: 'hidden'}).parent().css({height: 20 + height});
647
- this.contentWindow.onbeforeunload = function() {
648
- mfp.wrap.removeClass('mfp-comments-loaded').addClass('mfp-comments-loading');
649
- };
650
- $.ajax({
651
- type : "post",
652
- dataType : "json",
653
- url: GmediaGallery.ajaxurl,
654
- data: {action: opt.ajax_actions['comments']['action'], _ajax_nonce: GmediaGallery.nonce, data: opt.ajax_actions['comments']['data']},
655
- }).done(function(data){
656
- if(data.comments_count){
657
- mfp.wrap.find('.mfp-comments-count').html(data.comments_count);
658
- CommentsCount[no] = data.comments_count
659
- }
660
- });
661
- });
662
- }
663
- }).fail(function(){
664
- mfp.wrap.removeClass('mfp-comments-loading');
665
- });
666
- }
667
- },
668
- viewLike: function (item, like) {
669
- var id = item.gm_id;
670
- if(!Storage[id]){
671
- Storage[id] = {}
672
- }
673
- if (Storage[id].status) {
674
- item.viewed = true;
675
- if(opt.likesEnabled) {
676
- if('liked' == Storage[id].status) {
677
- item.liked = true;
678
- }
679
- }
680
- }
681
- if (!item.viewed) {
682
- item.viewed = true;
683
- ViewsCount[item.no] += 1;
684
- Storage[id].status = 'viewed';
685
- sessionStorage.setItem(elID, JSON.stringify(Storage));
686
- if (GmediaGallery.ajaxurl) {
687
  $.ajax({
688
- type : "post",
689
- dataType : "json",
690
  url: GmediaGallery.ajaxurl,
691
  data: {action: 'gmedia_module_interaction', hit: id}
692
- }).done(function(r){
693
- if(r.views){
694
- item.views = ViewsCount[item.no] = r.views;
 
695
  }
696
  });
697
  }
698
  }
699
- if (opt.likesEnabled && like && !item.liked) {
700
- item.liked = true;
701
- item.likes += 1;
702
- LikesCount[item.no] = item.likes;
703
- Storage[id].status = 'liked';
704
- sessionStorage.setItem(elID, JSON.stringify(Storage));
705
- if (GmediaGallery.ajaxurl) {
706
  $.ajax({
707
- type : "post",
708
- dataType : "json",
709
  url: GmediaGallery.ajaxurl,
710
  data: {action: 'gmedia_module_interaction', hit: id, vote: 1}
711
- }).done(function(r){
712
- if(r.likes){
713
- item.likes = LikesCount[item.no] = r.likes;
 
714
  }
715
  });
716
  }
717
  }
718
  },
719
  initSettings: function() {// Init Settings
720
- if (window.sessionStorage) {
721
- Storage = sessionStorage.getItem(elID);
722
- if (Storage) {
723
- Storage = JSON.parse(Storage);
724
- } else {
725
- Storage = {};
726
  }
727
  }
728
  methods.initContainer();
@@ -733,21 +683,32 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
733
 
734
  },
735
  initRP: function() {// Init Resize & Positioning
736
- var rrr = methods.rpResponsive();
737
- if(!rrr && 50 > cc) {
738
- cc++;
739
- clearTimeout(timeout);
740
- timeout = setTimeout(function() {
741
  methods.initRP();
742
- }, 100);
743
  } else {
744
- cc = 0;
745
- methods.rpContainer();
746
- methods.rpThumbs();
 
 
 
 
 
 
 
 
 
 
 
747
  }
748
  },
749
  rpResponsive: function() {
750
- var hiddenBustedItems = prototypes.doHideBuster($(Container));
 
 
 
751
 
752
  if($(window).width() <= 640) {
753
  $('.gmPhantom_Container', Container).addClass('gmPhantom_MobileView');
@@ -761,71 +722,57 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
761
  opt.ratio = opt.dratio;
762
  }
763
 
764
- setTimeout(function(){ opt.width = $(Container).width(); }, 0);
765
- prototypes.undoHideBuster(hiddenBustedItems);
 
 
 
 
766
 
767
- return opt.width;
768
  },
769
 
770
  initContainer: function() {// Init Container
771
- $('.gmPhantom_Container', Container).removeClass('delay');
772
- $('.gmPhantom_Container', Container).css({'display': 'block', 'text-align': opt.thumbsAlign});
773
 
774
- if(opt.maxheight === 0) {
775
- $('.gmPhantom_Container', Container).css('overflow', 'visible');
776
- }
777
- $('.gmPhantom_Background', Container).css('opacity', opt.bgAlpha / 100);
778
- if(opt.bgAlpha !== 0) {
779
- $('.gmPhantom_Background', Container).css('background-color', '#' + opt.bgColor);
780
- }
781
  $('.gmPhantom_thumbsWrapper', Container).css({
782
  'padding-top': opt.thumbsVerticalPadding,
783
  'padding-bottom': opt.thumbsVerticalPadding,
784
  'padding-left': opt.thumbsHorizontalPadding,
785
  'padding-right': opt.thumbsHorizontalPadding
786
  });
787
- if(opt.thumbsAlign == 'left') {
788
- $('.gmPhantom_thumbsWrapper', Container).css({'margin-left': 0});
789
- } else if(opt.thumbsAlign == 'right') {
790
- $('.gmPhantom_thumbsWrapper', Container).css({'margin-right': 0});
791
- }
792
  methods.rpContainer();
793
  },
794
  rpContainer: function() {// Resize & Position Container
795
- $('.gmPhantom_Container', Container).width(opt.width);
796
- if(opt.maxheight === 0) {
797
- $('.gmPhantom_Container', Container).css('height', 'auto');
798
- $('.gmPhantom_thumbsWrapper', Container).css('height', 'auto');
799
- } else {
800
- $('.gmPhantom_Container', Container).css({height: 'auto', 'max-height': opt.maxheight});
801
  }
802
  },
803
 
804
  initThumbs: function() {//Init Thumbnails
805
- if(opt.maxheight === 0) {
806
- $('.gmPhantom_thumbsWrapper', Container).css({'overflow': 'visible', 'position': 'relative'});
807
- }
808
-
809
  var thumb_container = $('.gmPhantom_ThumbContainer', Container);
810
  if(opt.thumbsInfo == 'tooltip') {
811
  if(!prototypes.isTouchDevice()) {
812
  thumb_container.hover(function() {
813
- var no = $(this).data('no');
814
- methods.showTooltip(no);
815
- },
816
- function() {
817
- $('.gmPhantom_Tooltip', Container).css('display', 'none');
818
- });
819
  } else {
820
  $('.gmPhantom_thumbsWrapper', Container).removeClass('gmPhantom_LabelTolltip').addClass('gmPhantom_LabelInside');
821
  }
822
  }
823
 
824
  thumb_container.click(function(e) {
825
- var no = $(this).data('no');
826
- if(Links[no] !== '' && opt.thumb2link) {
 
827
  e.stopPropagation();
828
- prototypes.openLink(Links[no], LinksTarget[no]);
829
  return false;
830
  }
831
  });
@@ -839,15 +786,14 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
839
  e.stopPropagation();
840
  });
841
 
842
- $('.gmPhantom_Thumb img', Container).each(function() {
843
  var image = $(this);
844
  var img_holder = image.closest('.gmPhantom_ThumbContainer');
845
- image.css('opacity', 0);
846
  var load_img = new Image();
847
- $(load_img).load(function() {
848
  img_holder.removeClass('gmPhantom_ThumbLoader');
849
- image.animate({'opacity': opt.thumbAlpha}, 600, function(){
850
- $(this).css({'opacity':''});
851
  });
852
  }).attr('src', image.attr('src'));
853
  });
@@ -869,6 +815,8 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
869
  rpThumbs: function() {// Resize & Position Thumbnails
870
  var thumbW = opt.thumbWidth + opt.thumbBorderSize * 2 + opt.thumbPadding * 2,
871
  no = 0,
 
 
872
  hiddenBustedItems = prototypes.doHideBuster($(Container));
873
  if(opt.initialHeight === 0 || (opt.initialCols === 0 && opt.initialRows === 0)) {
874
  opt.thumbCols = parseInt((opt.width + opt.thumbsSpacing - opt.thumbsHorizontalPadding * 2) / (thumbW + opt.thumbsSpacing));
@@ -897,65 +845,48 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
897
  }
898
  }
899
 
900
- var thumbs_spacing = opt.thumbsSpacing;
901
- if(0 == thumbs_spacing){
902
- thumbs_spacing = -opt.thumbBorderSize;
903
-
904
- }
905
- $('.gmPhantom_ThumbContainer', Container).each(function() {
906
  no++;
 
907
 
908
- $(this).css({'margin': ''});
909
- if(thumbs_spacing) {
910
- if(no > opt.thumbCols) {
911
- $(this).css('margin-top', thumbs_spacing);
912
- }
913
- if(no % opt.thumbCols != 1 && opt.thumbCols != 1) {
914
- $(this).css('margin-left', thumbs_spacing);
915
- }
916
- }
917
  if(no % opt.thumbCols === 0) {
918
- $(this).css('margin-right', '-1px');
 
919
  }
920
 
921
  var img = $('.gmPhantom_Thumb > img', this);
922
  var thumb_ratio = $(this).data('ratio');
923
- if(opt.ratio < thumb_ratio){
924
- img.attr('class', 'landscape').attr('style', 'margin:0 0 0 -' + Math.floor((opt.thumbHeight * thumb_ratio - opt.thumbWidth) / opt.thumbWidth * 50) + '%');
925
  } else {
926
- img.attr('class', 'portrait').attr('style', 'margin:-' + Math.floor((opt.thumbWidth / thumb_ratio - opt.thumbHeight) / opt.thumbHeight * 25) + '% 0 0 0');
 
 
 
927
  }
928
 
929
  });
930
  var thumbs_el = $('.gmPhantom_thumbsWrapper', Container),
931
  thumbs_el_width = thumbW * opt.thumbCols + (opt.thumbCols - 1) * opt.thumbsSpacing,
932
  scrollbar_width = 0;
933
- thumbs_el.width(thumbs_el_width);
934
  if(thumbs_el_width >= $('.gmPhantom_Container', Container).width()) {
935
  scrollbar_width = methods.scrollbarWidth();
936
  }
937
 
938
  if(opt.initialHeight !== 0) {
939
  var thumbH = opt.thumbHeight + opt.thumbBorderSize * 2 + opt.thumbPadding * 2,
940
- thumbs_el_height = thumbH * opt.thumbRows + (opt.thumbRows - 1) * opt.thumbsSpacing;
941
  $('.gmPhantom_thumbsWrapper', Container).height(thumbs_el_height + scrollbar_width);
942
 
943
- if((opt.thumbsNavigation == 'mouse')) {
944
- if($('.gmPhantom_Container', Container).width() > thumbs_el.outerWidth()) {
945
- thumbs_el.css('margin-left', ($('.gmPhantom_Container', Container).width() - thumbs_el.outerWidth()) / 2);
946
- } else {
947
- thumbs_el.css('margin-left', 0);
948
  }
949
- thumbs_el.css('margin-top', 0);
950
- }
951
-
952
- if(opt.thumbsNavigation == 'scroll' && typeof(jQuery.fn.jScrollPane) != 'undefined') {
953
- $('.gmPhantom_Container .jspContainer', Container).width($('.gmPhantom_thumbsWrapper', Container).width());
954
  }
955
  }
956
 
957
- methods.rpContainer();
958
-
959
  prototypes.undoHideBuster(hiddenBustedItems);
960
  },
961
  moveThumbs: function() {// Init thumbnails move
@@ -964,35 +895,42 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
964
  if(itemLoaded) {
965
  return;
966
  }
967
- var thumbW, thumbH, mousePosition, thumbsPosition;
968
-
969
- if(thumbs_el.outerWidth() > $(this).width()) {
970
- thumbW = opt.thumbWidth + opt.thumbBorderSize * 2 + opt.thumbPadding * 2 + opt.thumbsSpacing - opt.thumbsSpacing / opt.thumbRows + opt.thumbsHorizontalPadding / opt.thumbCols;
971
- mousePosition = e.clientX - $(this).offset().left + parseInt($(this).css('margin-left')) + $(document).scrollLeft();
972
- thumbsPosition = 0 - (mousePosition - thumbW) * (thumbs_el.outerWidth() - $(this).width()) / ($(this).width() - 2 * thumbW);
973
- if(thumbsPosition < (-1) * (thumbs_el.outerWidth() - $(this).width())) {
974
- thumbsPosition = (-1) * (thumbs_el.outerWidth() - $(this).width());
975
- }
976
- if(thumbsPosition > 0) {
977
- thumbsPosition = 0;
978
- }
979
- thumbs_el.css('margin-left', thumbsPosition);
980
- //thumbs_el.animate({'margin-left': thumbsPosition}, { duration: 200, queue: false });
981
- }
982
 
983
- if(thumbs_el.outerHeight() > $(this).height()) {
984
- thumbH = opt.thumbHeight + opt.thumbBorderSize * 2 + opt.thumbPadding * 2 + opt.thumbsSpacing - opt.thumbsSpacing / opt.thumbRows + opt.thumbsVerticalPadding / opt.thumbRows;
985
- mousePosition = e.clientY - $(this).offset().top + parseInt($(this).css('margin-top')) + $(document).scrollTop();
986
- thumbsPosition = 0 - (mousePosition - thumbH) * (thumbs_el.outerHeight() - $(this).height()) / ($(this).height() - 2 * thumbH);
987
- if(thumbsPosition < (-1) * (thumbs_el.outerHeight() - $(this).height())) {
988
- thumbsPosition = (-1) * (thumbs_el.outerHeight() - $(this).height());
 
 
 
 
 
 
 
 
 
 
 
989
  }
990
- if(thumbsPosition > 0) {
991
- thumbsPosition = 0;
 
 
 
 
 
 
 
 
 
992
  }
993
- thumbs_el.css('margin-top', thumbsPosition);
994
- //thumbs_el.animate({'margin-top': thumbsPosition}, { duration: 200, queue: false });
995
  }
 
 
 
996
  });
997
  },
998
  initThumbsScroll: function() {//Init Thumbnails Scroll
@@ -1020,9 +958,10 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
1020
  $('.gmPhantom_Tooltip', Container).css('top', mousePositionY - $('.gmPhantom_Tooltip', Container).height() - 15);
1021
  });
1022
  },
1023
- showTooltip: function(no) {// Resize, Position & Display the Tooltip
1024
- var HTML = [];
1025
- HTML.push(CaptionTitle[no]);
 
1026
  HTML.push('<div class="gmPhantom_Tooltip_ArrowBorder"></div>');
1027
  HTML.push('<div class="gmPhantom_Tooltip_Arrow"></div>');
1028
  $('.gmPhantom_Tooltip', Container).html(HTML.join(""));
@@ -1037,16 +976,16 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
1037
  if(opt.tooltipTextColor != 'css') {
1038
  $('.gmPhantom_Tooltip', Container).css('color', '#' + opt.tooltipTextColor);
1039
  }
1040
- if(CaptionTitle[no] !== '') {
1041
  $('.gmPhantom_Tooltip', Container).css('display', 'block');
1042
  }
1043
  }
1044
  },
1045
 
1046
  prototypes = {
1047
- isIEBrowser: function () {// Detect the browser IE
1048
  var myNav = navigator.userAgent.toLowerCase();
1049
- return (myNav.indexOf('msie') == -1) ? false : parseInt(myNav.split('msie')[1]);
1050
  },
1051
  isTouchDevice: function() {// Detect Touchscreen devices
1052
  return 'ontouchend' in document;
@@ -1118,6 +1057,9 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
1118
  window.location = url;
1119
  }
1120
  },
 
 
 
1121
  $_GET: function(variable) {
1122
  var url = window.location.href.split('?')[1];
1123
  if(url) {
@@ -1138,7 +1080,7 @@ if(typeof jQuery.fn.gmPhantom == 'undefined') {
1138
  var parent = item.parent(),
1139
  items = [];
1140
 
1141
- if (typeof(item.prop('tagName')) !== 'undefined' && item.prop('tagName').toLowerCase() != 'body') {
1142
  items = this.doHideBuster(parent);
1143
 
1144
  item.addClass('gmShowBuster');
1
  /*
2
  * Title : gmPhantom
3
+ * Version : 3.8
4
  * Copyright : 2013-2015 CodEasily.com
5
  * Website : http://www.codeasily.com
6
  */
9
  $.fn.gmPhantom = function(method) {
10
  var Container = this,
11
  elID = $(this).attr('id'),
12
+ ID = elID.replace('GmediaGallery_', ''),
13
  Content,
14
  opt,
15
  timeout,
16
 
17
  opt_str = {
18
  'thumbsNavigation': 'scroll', // Thumbnails Navigation (mouse, scroll). Default value: mouse. Set how you navigate through the thumbnails.
19
+ 'thumbsAlign': 'center', // Thumbnails align. Default value: left.
20
  'thumbsInfo': 'label', // Info Thumbnails Display (none, tooltip, label). Default value: tooltip. Display a small info text on the thumbnails, a tooltip or a label on bottom.
21
  'mfp_css': '',
22
  'module_dirurl': '',
25
  'bgColor': 'ffffff', // Background Color (color hex code). Default value: ffffff. Set gallery background color.
26
  'thumbBG': 'ffffff', // Thumbnail Border Color (color hex code). Default value: cccccc. Set the color of a thumbnail's border.
27
  'thumbBorderColor': 'cccccc', // Thumbnail Border Color (color hex code). Default value: cccccc. Set the color of a thumbnail's border.
28
+ 'tooltipTextColor': 'css', // Tooltip Text Color (color hex code). Default value: 000000. Set tooltip text color.
29
+ 'tooltipBgColor': 'css', // Tooltip Background Color (color hex code). Default value: ffffff. Set tooltip background color.
30
+ 'tooltipStrokeColor': 'css', // Tooltip Stroke Color (color hex code). Default value: 000000. Set tooltip stroke color.
31
+ 'labelTextColor': 'ffffff', // Label-Over Text Color (color hex code). Default value: 000000.
32
  'labelLinkColor': 'e7e179',
33
  'label8TextColor': '0b0b0b', // Label Text Color (color hex code). Default value: 000000.
34
  'label8LinkColor': '3695E7',
35
+ 'sidebarBGColor': 'ffffff',
36
  'lightboxControlsColor': 'ffffff', // Tooltip Text Color (color hex code). Default value: 000000.
37
  'lightboxTitleColor': 'f3f3f3', // Tooltip Text Color (color hex code). Default value: 000000.
38
  'lightboxTextColor': 'f3f3f3', // Tooltip Text Color (color hex code). Default value: 000000.
39
  'lightboxBGColor': '0b0b0b' // Lightbox Window Color (color hex code). Default value: 000000. Set the color for the lightbox window.
40
  },
41
  opt_int = {
42
+ 'initRPdelay': 200,
43
  'maxheight': 0,
44
  'thumbCols': 0, // Number of Columns (auto, number). Default value: 0. Set the number of columns for the grid.
45
  'thumbRows': 0, // Number of Lines (auto, number). Default value: 0. Set the number of lines for the grid.
46
  'bgAlpha': 0, // Background Alpha (value from 0 to 100). Default value: 0. Set gallery background alpha.
47
+ 'thumbWidth': 200, // Thumbnail Width (the size in pixels). Default value: 150. Set the width of a thumbnail.
48
+ 'thumbHeight': 180, // Thumbnail Height (the size in pixels). Default value: 150. Set the height of a thumbnail.
49
+ 'thumbWidthMobile': 150,
50
+ 'thumbHeightMobile': 135,
51
+ 'thumbsSpacing': 8, // Thumbnails Spacing (value in pixels). Default value: 10. Set the space between thumbnails.
52
+ 'thumbsVerticalPadding': 4, // Thumbnails Padding Top (value in pixels). Default value: 5. Set the top padding for the thumbnails.
53
+ 'thumbsHorizontalPadding': 4, // Thumbnails Padding Top (value in pixels). Default value: 5. Set the top padding for the thumbnails.
54
+ 'thumbAlpha': 90, // Thumbnail Alpha (value from 0 to 100). Default value: 85. Set the transparancy of a thumbnail.
55
  'thumbAlphaHover': 100, // Thumbnail Alpha Hover (value from 0 to 100). Default value: 100. Set the transparancy of a thumbnail when hover.
56
  'thumbBorderSize': 1, // Thumbnail Border Size (value in pixels). Default value: 1. Set the size of a thumbnail's border.
57
+ 'thumbPadding': 2, // Thumbnail Padding (value in pixels). Default value: 3. Set padding value of a thumbnail.
58
  'lightboxBGAlpha': 80 // Lightbox Window Alpha (value from 0 to 100). Default value: 80. Set the transparancy for the lightbox window.
59
  },
60
  opt_bool = {
61
  'deepLinks': true,
62
  'socialShareEnabled': true, // Social Share Enabled (true, false). Default value: true.
63
+ 'share_post_link': true,
64
+ 'show_tags': true,
65
+ 'show_categories': true,
66
+ 'show_albums': true,
67
  'viewsEnabled': true,
68
  'likesEnabled': true,
69
  'commentsEnabled': true, // Comments Enabled (true, false). Default value: true.
70
  'lightbox800HideArrows': false, // Hide Arrows if window width less than 800px.
71
  'thumbScale': true, // Scale effect for thumb on mouseover
72
  'labelOnHover': true, // Show thumb label only on mouseover
73
+ 'thumb2link': false // Open link instead of lightbox when item have "link" attr
74
  },
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  noItems = 0,
77
 
78
+ Storage = {views: [], likes: []},
 
79
 
80
  startGalleryID = 0,
81
  startWith = 0,
88
 
89
  methods = {
90
  init: function(arguments) {// Init Plugin.
91
+ console.log(Container);
92
+ opt = $.extend(true, {}, opt_str, opt_int, opt_bool, opt_hex, arguments[0]);
93
  $.each(opt, function(key, val) {
94
  if(key in opt_bool) {
95
  opt[key] = (!(!val || val == '0' || val == 'false'));
97
  opt[key] = parseInt(val);
98
  }
99
  });
 
100
  opt.initialHeight = opt.maxheight;
101
  opt.initialCols = opt.thumbCols;
102
  opt.initialRows = opt.thumbRows;
105
  opt.dratio = opt.thumbWidthDesktop / opt.thumbHeightDesktop;
106
  opt.mratio = opt.thumbWidthMobile / opt.thumbHeightMobile;
107
 
 
108
  methods.parseContent();
109
 
110
+ var timeout;
111
+ $(window).on('resize.gmPhantom', function() {
112
+ methods.initRP();
113
+ clearTimeout(timeout);
114
+ timeout = setTimeout(function() {
115
+ methods.initRP();
116
+ }, 600);
117
+ });
118
 
119
  setTimeout(methods.initRP, opt.initRPdelay);
120
  },
121
  parseContent: function() {// Parse Content.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
+ noItems = $('.gmPhantom_thumbsWrapper', Container).find('> div').length;
124
  methods.rpResponsive();
125
 
126
+ if(!$(Container).data('gmPhantom_initialized')) {
127
+ methods.initGallery();
128
+ $(Container).data('gmPhantom_initialized', true);
129
+ }
130
 
131
  },
132
  initGallery: function() {// Init the Gallery
133
 
134
  var currentScrollPosition = 0;
135
+ $(document).scroll(function() {
136
  currentScrollPosition = $(this).scrollTop();
137
  });
138
  window.onhashchange = function() {
139
  methods.loadGalleryDeepLink();
140
  };
141
 
142
+ $("input, textarea").focus(function() {
143
  $(document).scrollTop(currentScrollPosition);
144
  });
145
 
146
  var browser_class = '';
147
+ if(prototypes.isIEBrowser()) {
148
+ if(prototypes.isIEBrowser() < 8) {
149
  browser_class += ' msie msie7';
150
  } else {
151
  browser_class += ' msie';
152
  }
153
  }
154
+ if(prototypes.isTouchDevice()) {
155
  browser_class += ' istouch';
156
  }
157
 
158
  $('.gmPhantom_thumbsWrapper', Container).addClass(browser_class);
159
+ if(opt.thumbsInfo == 'tooltip' && !prototypes.isTouchDevice()) {
160
  $('.gmPhantom_Container', Container).append('<div class="gmPhantom_Tooltip"></div>');
161
  }
162
 
163
  methods.initSettings();
164
 
165
+ $.magnificPopup.instance.next = function() {
166
+ if($.magnificPopup.instance.index < $.magnificPopup.instance.items.length - 1) {
167
+ $.magnificPopup.proto.next.call(this, arguments);
168
+ }
169
+ };
170
+ $.magnificPopup.instance.prev = function() {
171
+ if($.magnificPopup.instance.index > 0) {
172
+ $.magnificPopup.proto.prev.call(this, arguments);
173
+ }
174
+ };
175
+ $.magnificPopup.instance.toggleArrows = function() {
176
+ if($.magnificPopup.instance.index < $.magnificPopup.instance.items.length - 1) {
177
+ $(".mfp-arrow-right").show();
178
+ }
179
+ if($.magnificPopup.instance.index == $.magnificPopup.instance.items.length - 1) {
180
+ $(".mfp-arrow-right").hide();
181
+ }
182
+
183
+ if($.magnificPopup.instance.index > 0) {
184
+ $(".mfp-arrow-left").show();
185
+ }
186
+ if($.magnificPopup.instance.index == 0) {
187
+ $(".mfp-arrow-left").hide();
188
+ }
189
+ };
190
+ $.magnificPopup.instance.updateItemHTML = function() {
191
+ $.magnificPopup.instance.toggleArrows();
192
+ $.magnificPopup.proto.updateItemHTML.call(this, arguments);
193
+ };
194
+ var orig_checkIfClose = $.magnificPopup.instance._checkIfClose;
195
+ $.magnificPopup.instance._checkIfClose = function(target) {
196
+ if($(target).closest('.mfp-prevent-close').length) {
197
+ return;
198
+ }
199
+ return orig_checkIfClose(target);
200
+ };
201
+
202
  var thumbs_wrapper = $('.gmPhantom_thumbsWrapper', Container);
203
  thumbs_wrapper.magnificPopup({
204
  type: 'image',
215
  // Function will fire for each target element
216
  // "item.el" is a target DOM element (if present)
217
  // "item.src" is a source that you may modify
218
+ var data = item.el.data();
219
+ item.gm = data;
220
+ item.image = $('.gmPhantom_Thumb img', item.el).attr('data-src');
221
+ item.src = $('.gmPhantom_Thumb', item.el).attr('href');
222
+ item.title = $('.gmPhantom_title', item.el).html();
 
 
 
 
 
 
 
 
 
223
 
224
+ item.gm.viewed = prototypes.arrVal(Storage.views, parseInt(item.gm.id));
225
+ item.gm.liked = prototypes.arrVal(Storage.likes, parseInt(item.gm.id));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
 
 
 
 
227
  },
228
  markupParse: function(template, values, item) {
229
+ values.title = item.title;
230
+ values.description = $('.gmPhantom_Details', item.el).html();
 
 
 
 
 
231
  },
232
 
233
  imageLoadComplete: function() {
238
  },
239
  open: function() {
240
  $(document.body).addClass('mfp-gmedia-open');
241
+ itemLoaded = this.currItem.gm.id;
242
+ if(opt.commentsEnabled) {
243
  this.wrap.on('click.gmCloseComments', '.mfp-img--comments-div', function() {
244
  $('#mfp_comments_' + ID, this.wrap).trigger('click');
245
  return false;
246
  });
247
+ this.wrap.on('click', '.mfp-close-comments', function() {
248
+ $('#mfp_comments_' + ID, this.wrap).trigger('click');
249
+ return false;
250
+ });
251
  }
252
+ if(opt.socialShareEnabled) {
253
+ var mfp = this;
254
+ $(mfp.wrap).on('click', '.mfp-share_sharelizer', function() {
255
+ var sharelink,
256
+ title = mfp.currItem.title,
257
+ imgsrc = mfp.currItem.image,
258
+ url = window.location.href;
259
+ if(!opt.deepLinks) {
260
+ var hash = "#!gallery-" + ID + '-' + mfp.currItem.gm['id'];
261
+ url = ('' + window.location).split('#')[0] + hash;
262
+ }
263
+ if(opt.share_post_link) {
264
+ url = mfp.currItem.gm['post_link'];
265
+ }
266
+ if($(this).hasClass('mfp-share_twitter')) {
267
+ sharelink = 'https://twitter.com/home?status=' + encodeURIComponent(title + ' ' + url);
268
+ window.open(sharelink, '_blank');
269
+ }
270
+ if($(this).hasClass('mfp-share_facebook')) {
271
+ sharelink = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url);
272
+ window.open(sharelink, '_blank');
273
+ }
274
+ if($(this).hasClass('mfp-share_pinterest')) {
275
+ sharelink = 'https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(url) + '&media=' + encodeURIComponent(imgsrc) + '&description=' + encodeURIComponent(title);
276
+ window.open(sharelink, '_blank');
277
+ }
278
+ if($(this).hasClass('mfp-share_google')) {
279
+ sharelink = 'https://plus.google.com/share?url=' + encodeURIComponent(url);
280
+ window.open(sharelink, '_blank');
281
+ }
282
+ if($(this).hasClass('mfp-share_stumbleupon')) {
283
+ sharelink = 'http://www.stumbleupon.com/submit?url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title);
284
+ window.open(sharelink, '_blank');
285
+ }
286
+ });
287
+ }
288
+ this.toggleArrows.call(this);
289
  },
290
  close: function() {
291
  $(document.body).removeClass('mfp-gmedia-open');
292
+ if('image' != this.currItem.gm.type) {
293
  $(document.body).removeClass('mfp-zoom-out-cur');
294
  this.wrap.removeClass('mfp-iframe-loaded');
295
  }
296
  this.wrap.removeClass('mfp-image-loaded');
297
 
298
+ if(opt.commentsEnabled) {
299
  this.wrap.off('click.gmCloseComments');
300
  }
301
  if(opt.deepLinks) {
307
  location.replace(url);
308
  }
309
  }
310
+ //this.contentContainer.attr('data-gmtype', this.currItem.gm.type).attr('data-ext', this.currItem.gm.ext);
311
+ $('#wpadminbar').css({'z-index': ''});
 
312
  $(window).scrollTop(scrollTop);
313
+ itemLoaded = this.currItem.gm.id;
314
  },
315
  beforeOpen: function() {
316
+ $('#wpadminbar').css({'z-index': 1000});
317
  $(this.wrap).attr('id', 'mfp_gm_' + ID);
318
  $(this.bgOverlay).attr('id', 'mfp_gm_' + ID + '_bg');
319
  if(opt.lightbox800HideArrows) {
326
  },
327
  change: function() {
328
  if(opt.deepLinks) {
329
+ var hash = "#!gallery-" + ID + '-' + this.currItem.gm.id,
330
  url = ('' + window.location).split('#')[0] + hash;
331
  if(!!(window.history && window.history.replaceState)) {
332
  window.history.replaceState({}, document.title, url);
334
  location.replace(url);
335
  }
336
  }
337
+ this.contentContainer.attr('data-gmtype', this.currItem.gm.type).attr('data-ext', this.currItem.gm.ext);
338
  if(opt.commentsEnabled) {
339
  this.wrap.removeClass('mfp-comments-open mfp-comments-loaded');
340
  $('.mfp-comments-wrapper', this.contentContainer).css({height: ''}).empty();
343
  this.wrap.removeClass('phantom-gmedia-liked');
344
  }
345
  clearTimeout(timeout);
346
+ if('image' != this.currItem.gm.type) {
347
  $(document.body).addClass('mfp-zoom-out-cur');
348
  var self = this;
349
  setTimeout(function() {
353
  },
354
  afterChange: function() {
355
  if(opt.socialShareEnabled) {
356
+ methods.initSocialShare(this.currItem, this);
357
  }
358
+
359
+ if(opt.commentsEnabled) {
360
+ methods.initComments(this.currItem, this);
361
+ }
362
+
363
  if(opt.viewsEnabled || opt.likesEnabled) {
364
  var self = this;
365
  timeout = setTimeout(function() {
367
  }, 1000);
368
 
369
  if(opt.viewsEnabled) {
370
+ methods.initViews(this.currItem, this);
371
  }
372
  if(opt.likesEnabled) {
373
+ methods.initLikes(this.currItem, this);
374
+ if(this.currItem.gm.liked) {
375
  this.wrap.addClass('phantom-gmedia-liked');
376
  } else {
377
  this.wrap.removeClass('phantom-gmedia-liked');
378
  }
379
  }
380
  }
381
+ itemLoaded = this.currItem.gm.id;
 
 
382
  },
383
  updateStatus: function(data) {
384
  //console.log(data);
385
+ if(data.status == 'loading') {
386
+ this.wrap.removeClass('mfp-image-loaded mfp-iframe-loaded');
387
+ }
388
  }
389
  },
390
  image: {
391
+ markup: '' +
392
  '<div class="mfp-figure">' +
393
  ' <div class="mfp-close"></div>' +
394
  ' <figure>' +
395
  ' <div class="mfp-img"></div>' +
396
  ' <figcaption>' +
397
  ' <div class="mfp-bottom-bar">' +
398
+ ' <div class="mfp-description gmPhantom_Details"></div>' +
 
399
  ' <div class="mfp-counter"></div>' +
400
  ' </div>' +
401
  ' </figcaption>' +
402
  ' </figure>' +
403
  '</div>' +
404
  '<div class="mfp-comments-container">' +
405
+ ' <div class="mfp-comments-content mfp-prevent-close"><div class="mfp-close-comments">&times;</div><div class="mfp-comments-wrapper"></div></div>' +
406
  '</div>' +
407
+ '<div class="mfp-prevent-close mfp-buttons-bar mfp-gmedia-stuff10"></div>'
408
  },
409
  iframe: {
410
+ markup: '' +
411
  '<div class="mfp-iframe-wrapper">' +
412
  ' <div class="mfp-close"></div>' +
413
  ' <div class="mfp-iframe-scaler">' +
414
  ' <iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowtransparency="true" allowfullscreen></iframe>' +
415
  ' </div>' +
416
  ' <div class="mfp-bottom-bar gm-iframe-bottom-bar">' +
417
+ ' <div class="mfp-description gmPhantom_Details"></div>' +
 
418
  ' <div class="mfp-counter"></div>' +
419
  ' </div>' +
420
  '</div>' +
421
  '<div class="mfp-comments-container">' +
422
+ ' <div class="mfp-comments-content"><div class="mfp-close-comments">&times;</div><div class="mfp-comments-wrapper"></div></div>' +
423
  '</div>' +
424
+ '<div class="mfp-prevent-close mfp-buttons-bar mfp-gmedia-stuff10"></div>'
425
  },
426
  gallery: {
427
  enabled: true,
436
 
437
  methods.loadGalleryDeepLink();
438
 
439
+ $(Container).on('click', '.gmPhantom_pager', function(e) {
440
+ e.preventDefault();
441
+ $(this).parent().addClass('gmPhantom_ThumbLoader');
442
+ $.get($(this).attr('href'), function(data) {
443
+ var temp = $('<div style="visibility:hidden;position:absolute;pointer-events:none;"></div>').appendTo(Container);
444
+ temp.append($('#' + elID, data).html());
445
+ $('.gmPhantom_LoadMore', Container).replaceWith(temp.find('.gmPhantom_thumbsWrapper').html());
446
+ methods.initThumbs();
447
+ temp.remove();
448
+ });
449
+ return false;
450
+ });
451
+
452
  },
453
  loadGalleryDeepLink: function() {
454
  var prefix = "#!gallery-";
458
  if(h[0] && parseInt(h[0]) == ID) {
459
  $(document).scrollTop($(Container).offset().top);
460
  if(h[1]) {
461
+ startWith = $('.gmPhantom_ThumbContainer[data-id="' + h[1] + '"]', Container).index();
462
  } else {
463
  startWith = 0;
464
  }
468
  }
469
  }
470
  },
471
+ initSocialShare: function(item, mfp) {
472
+ var share_buttons = '' +
473
+ '<div class="mfp-prevent-close mfp-button mfp-share mfp-gmedia-stuff08" id="mfp_share_' + ID + '">' +
474
+ ' <a title="Share">' +
475
+ ' <span class="mfp-prevent-click">' +
476
+ ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-share2" viewBox="0 0 32 32"><path class="path1" d="M27 22c-1.411 0-2.685 0.586-3.594 1.526l-13.469-6.734c0.041-0.258 0.063-0.522 0.063-0.791s-0.022-0.534-0.063-0.791l13.469-6.734c0.909 0.94 2.183 1.526 3.594 1.526 2.761 0 5-2.239 5-5s-2.239-5-5-5-5 2.239-5 5c0 0.269 0.022 0.534 0.063 0.791l-13.469 6.734c-0.909-0.94-2.183-1.526-3.594-1.526-2.761 0-5 2.239-5 5s2.239 5 5 5c1.411 0 2.685-0.586 3.594-1.526l13.469 6.734c-0.041 0.258-0.063 0.522-0.063 0.791 0 2.761 2.239 5 5 5s5-2.239 5-5c0-2.761-2.239-5-5-5z"></path></symbol></svg>' +
477
+ ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-share2"/></svg>' +
478
+ ' </span>' +
479
+ ' </a>' +
480
+ ' <ul class="mfp-prevent-close mfp-share_sharelizers">' +
481
+ ' <li><a class="mfp-share_facebook mfp-share_sharelizer">Facebook</a></li>' +
482
+ ' <li><a class="mfp-share_twitter mfp-share_sharelizer">Twitter</a></li>' +
483
+ ' <li><a class="mfp-share_pinterest mfp-share_sharelizer">Pinterest</a></li>' +
484
+ ' <li><a class="mfp-share_google mfp-share_sharelizer">Google+</a></li>' +
485
+ ' <li><a class="mfp-share_stumbleupon mfp-share_sharelizer">StumbleUpon</a></li>' +
486
+ ' </ul>' +
487
  '</div>';
488
 
489
  var mfp_share = $(share_buttons);
490
+ mfp_share.on('click', function() {
491
  $(this).toggleClass('mfp-share_open');
492
  });
493
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  var share_div = mfp.wrap.find('#mfp_share_' + ID);
495
  if(!share_div.length) {
496
  $('.mfp-buttons-bar', mfp.wrap).append(mfp_share);
498
  $(share_div).replaceWith(mfp_share);
499
  }
500
  },
501
+ initComments: function(item, mfp) {
502
+ var comments_button = '' +
503
+ '<div class="mfp-prevent-close mfp-button mfp-comments" id="mfp_comments_' + ID + '">' +
504
+ ' <a title="Comments"><span class="mfp-prevent-close mfp-comments-count">' + item.gm['cc'] + '</span>' +
505
+ ' <span class="mfp-prevent-click mfp_comments_icon">' +
506
+ ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-bubbles2" viewBox="0 0 36 32"><path class="path1" d="M15 0v0c8.284 0 15 5.435 15 12.139s-6.716 12.139-15 12.139c-0.796 0-1.576-0.051-2.339-0.147-3.222 3.209-6.943 3.785-10.661 3.869v-0.785c2.008-0.98 3.625-2.765 3.625-4.804 0-0.285-0.022-0.564-0.063-0.837-3.392-2.225-5.562-5.625-5.562-9.434 0-6.704 6.716-12.139 15-12.139zM31.125 27.209c0 1.748 1.135 3.278 2.875 4.118v0.673c-3.223-0.072-6.181-0.566-8.973-3.316-0.661 0.083-1.337 0.126-2.027 0.126-2.983 0-5.732-0.805-7.925-2.157 4.521-0.016 8.789-1.464 12.026-4.084 1.631-1.32 2.919-2.87 3.825-4.605 0.961-1.84 1.449-3.799 1.449-5.825 0-0.326-0.014-0.651-0.039-0.974 2.268 1.873 3.664 4.426 3.664 7.24 0 3.265-1.88 6.179-4.82 8.086-0.036 0.234-0.055 0.474-0.055 0.718z"></path></symbol></svg>' +
507
+ ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-bubbles2"/></svg>' +
508
+ ' </span>' +
509
+ ' </a>' +
510
  '</div>';
511
  var mfp_comments = $(comments_button);
512
+ mfp_comments.on('click', function() {
513
  var comments_wrapper = $('.mfp-comments-wrapper', mfp.contentContainer);
514
  if(mfp.wrap.hasClass('mfp-comments-open')) {
515
+ $(this).removeClass('mfp-button-active');
516
  comments_wrapper.css({height: ''});
517
  $('figure > img', mfp.wrap).removeClass('mfp-img--comments-div').addClass('mfp-img');
518
  mfp.wrap.removeClass('mfp-comments-open');
519
  if($(window).width() <= 800) {
520
+ $('.mfp-wrap').animate({scrollTop: 0}, 200);
521
  $('body').delay(200).animate({scrollTop: $('#mfp_gm_' + ID).offset().top}, 400);
522
  } else {
523
  $(window).scrollTop($('#mfp_gm_' + ID).offset().top);
524
  }
525
  } else {
526
+ $(this).addClass('mfp-button-active');
527
+ var scrlbar = methods.scrollbarWidth();
528
+ comments_wrapper.css({height: $('iframe', comments_wrapper).height()}).parent().css({'width': 'calc(100% + ' + scrlbar + 'px)', 'min-width': 320 + scrlbar + 'px'});
529
  $('figure > img', mfp.wrap).removeClass('mfp-img').addClass('mfp-img--comments-div');
530
  mfp.wrap.addClass('mfp-comments-open')
531
  if(!mfp.wrap.hasClass('mfp-comments-loaded')) {
532
+ methods.loadComments(item, mfp);
533
  }
534
+ if($(window).width() <= 800) {
535
+ $('.mfp-wrap').animate({scrollTop: ($('.mfp-comments-container', '#mfp_gm_' + ID).offset().top + $('.mfp-wrap').scrollTop() - 150)}, 200);
536
+ $('body').delay(200).animate({scrollTop: ($('.mfp-comments-container', '#mfp_gm_' + ID).offset().top - 150)}, 400);
537
  }
538
  }
539
  });
546
  }
547
 
548
  },
549
+ loadComments: function(item, mfp) {
550
+ var comments_content = $('.mfp-comments-content', mfp.contentContainer),
551
+ comments_wrapper = $('.mfp-comments-wrapper', comments_content);
552
+ comments_wrapper.empty();
553
+ mfp.wrap.removeClass('mfp-comments-loaded').addClass('mfp-comments-loading');
554
+ if(GmediaGallery) {
555
+ opt.ajax_actions['comments']['data']['post_id'] = item.gm['post_id'];
556
+ $.ajax({
557
+ type: "post",
558
+ dataType: "json",
559
+ url: GmediaGallery.ajaxurl,
560
+ data: {action: opt.ajax_actions['comments']['action'], _ajax_nonce: GmediaGallery.nonce, data: opt.ajax_actions['comments']['data']},
561
+ }).done(function(data) {
562
+ if(data.comments_count) {
563
+ mfp.wrap.find('.mfp-comments-count').html(data.comments_count);
564
+ item.gm['cc'] = data.comments_count
565
+ }
566
+ if(data.content) {
567
+ $('.mfp-comments-wrapper', comments_content).html(data.content).find('iframe').on('load', function() {
568
+ mfp.wrap.removeClass('mfp-comments-loading').addClass('mfp-comments-loaded');
569
+ var body = this.contentWindow.document.body, html = this.contentWindow.document.documentElement;
570
+ var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
571
+ $(this).css({height: 20 + height, overflowY: 'hidden'}).parent().css({height: 20 + height});
572
+ this.contentWindow.onbeforeunload = function() {
573
+ mfp.wrap.removeClass('mfp-comments-loaded').addClass('mfp-comments-loading');
574
+ };
575
+ });
576
+ }
577
+ }).fail(function() {
578
+ mfp.wrap.removeClass('mfp-comments-loading');
579
+ });
580
+ }
581
+ },
582
+ initLikes: function(item, mfp) {
583
+ if(mfp.currItem.liked) {
584
  mfp.wrap.addClass('phantom-gmedia-liked');
585
  }
586
 
587
+ var likes = '' +
588
+ '<div class="mfp-prevent-close mfp-button mfp-likes" id="mfp_likes_' + ID + '">' +
589
+ ' <a><span class="mfp-likes-count">' + item.gm['likes'] + '</span>' +
590
+ ' <span class="mfp-prevent-click mfp_likes_icon">' +
591
+ ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-heart" viewBox="0 0 32 32"><path class="path1" d="M23.6 2c-3.363 0-6.258 2.736-7.599 5.594-1.342-2.858-4.237-5.594-7.601-5.594-4.637 0-8.4 3.764-8.4 8.401 0 9.433 9.516 11.906 16.001 21.232 6.13-9.268 15.999-12.1 15.999-21.232 0-4.637-3.763-8.401-8.4-8.401z"></path></symbol></svg>' +
592
+ ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-heart"/></svg>' +
593
+ ' </span>' +
594
+ ' </a>' +
595
  '</div>';
596
  var likes_obj = $(likes);
597
+ likes_obj.on('click', function() {
598
  methods.viewLike(mfp.currItem, true);
599
  mfp.wrap.addClass('phantom-gmedia-liked');
600
+ $('.mfp-likes-count', mfp.wrap).text(item.gm['likes']);
601
  });
602
 
603
  var likes_div = $(mfp.wrap).find('#mfp_likes_' + ID);
608
  }
609
 
610
  },
611
+ initViews: function(item, mfp) {
612
+ var views = '' +
613
+ '<div class="mfp-prevent-close mfp-button mfp-views" id="mfp_views_' + ID + '">' +
614
+ ' <span class="mfp-prevent-close mfp-prevent-click"><span class="mfp-prevent-close mfp-views-count">' + item.gm['views'] + '</span>' +
615
+ ' <span class="mfp-prevent-close mfp-prevent-click mfp_views_icon">' +
616
+ ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-eye" viewBox="0 0 1024 1024"><path class="path1" d="M512 192c-223.318 0-416.882 130.042-512 320 95.118 189.958 288.682 320 512 320 223.312 0 416.876-130.042 512-320-95.116-189.958-288.688-320-512-320zM764.45 361.704c60.162 38.374 111.142 89.774 149.434 150.296-38.292 60.522-89.274 111.922-149.436 150.296-75.594 48.218-162.89 73.704-252.448 73.704-89.56 0-176.858-25.486-252.452-73.704-60.158-38.372-111.138-89.772-149.432-150.296 38.292-60.524 89.274-111.924 149.434-150.296 3.918-2.5 7.876-4.922 11.86-7.3-9.96 27.328-15.41 56.822-15.41 87.596 0 141.382 114.616 256 256 256 141.382 0 256-114.618 256-256 0-30.774-5.452-60.268-15.408-87.598 3.978 2.378 7.938 4.802 11.858 7.302v0zM512 416c0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96 96 42.982 96 96z"></path></symbol></svg>' +
617
+ ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-eye"/></svg>' +
618
+ ' </span></span>' +
619
  '</div>';
620
 
621
  var views_div = $(mfp.wrap).find('#mfp_views_' + ID);
626
  }
627
 
628
  },
629
+ viewLike: function(item, like) {
630
+ var id = parseInt(item.gm.id);
631
+ if(!item.gm.viewed) {
632
+ item.gm.viewed = true;
633
+ item.gm['views'] += 1;
634
+ Storage.views.push(id);
635
+ sessionStorage.setItem('GmediaGallery', JSON.stringify(Storage));
636
+ if(GmediaGallery.ajaxurl) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  $.ajax({
638
+ type: "post",
639
+ dataType: "json",
640
  url: GmediaGallery.ajaxurl,
641
  data: {action: 'gmedia_module_interaction', hit: id}
642
+ }).done(function(r) {
643
+ if(r.views) {
644
+ item.gm.views = r.views;
645
+ $('.mfp-views-count', item.el).text(item.gm['views']);
646
  }
647
  });
648
  }
649
  }
650
+ if(like && !item.gm.liked) {
651
+ item.gm.liked = true;
652
+ item.gm.likes += 1;
653
+ Storage.likes.push(id);
654
+ sessionStorage.setItem('GmediaGallery', JSON.stringify(Storage));
655
+ $('.mfp-likes-count', item.el).text(item.gm['likes']);
656
+ if(GmediaGallery.ajaxurl) {
657
  $.ajax({
658
+ type: "post",
659
+ dataType: "json",
660
  url: GmediaGallery.ajaxurl,
661
  data: {action: 'gmedia_module_interaction', hit: id, vote: 1}
662
+ }).done(function(r) {
663
+ if(r.likes) {
664
+ item.gm.likes = r.likes;
665
+ $('.mfp-likes-count', item.el).text(item.gm['likes']);
666
  }
667
  });
668
  }
669
  }
670
  },
671
  initSettings: function() {// Init Settings
672
+ if(window.sessionStorage) {
673
+ var sesion_storage = sessionStorage.getItem('GmediaGallery');
674
+ if(sesion_storage) {
675
+ $.extend(true, Storage, JSON.parse(sesion_storage));
 
 
676
  }
677
  }
678
  methods.initContainer();
683
 
684
  },
685
  initRP: function() {// Init Resize & Positioning
686
+ if(!$(Container).is(':visible')) {
687
+ setTimeout(function() {
 
 
 
688
  methods.initRP();
689
+ }, 1200);
690
  } else {
691
+ methods.rpResponsive();
692
+ var rrr = opt.width;
693
+ if(!rrr && 50 > cc) {
694
+ cc++;
695
+ clearTimeout(timeout);
696
+ timeout = setTimeout(function() {
697
+ methods.initRP();
698
+ }, 100);
699
+ } else {
700
+ cc = 0;
701
+ methods.rpThumbs();
702
+
703
+ $('.gmPhantom_Container', Container).css({'opacity': ''});
704
+ }
705
  }
706
  },
707
  rpResponsive: function() {
708
+ var hiddenBustedItems;
709
+ setTimeout(function() {
710
+ hiddenBustedItems = prototypes.doHideBuster($(Container));
711
+ }, 0);
712
 
713
  if($(window).width() <= 640) {
714
  $('.gmPhantom_Container', Container).addClass('gmPhantom_MobileView');
722
  opt.ratio = opt.dratio;
723
  }
724
 
725
+ setTimeout(function() {
726
+ opt.width = $(Container).width();
727
+ }, 0);
728
+ setTimeout(function() {
729
+ prototypes.undoHideBuster(hiddenBustedItems);
730
+ }, 0);
731
 
 
732
  },
733
 
734
  initContainer: function() {// Init Container
735
+ $('.gmPhantom_Container', Container).css({'text-align': opt.thumbsAlign});
 
736
 
 
 
 
 
 
 
 
737
  $('.gmPhantom_thumbsWrapper', Container).css({
738
  'padding-top': opt.thumbsVerticalPadding,
739
  'padding-bottom': opt.thumbsVerticalPadding,
740
  'padding-left': opt.thumbsHorizontalPadding,
741
  'padding-right': opt.thumbsHorizontalPadding
742
  });
 
 
 
 
 
743
  methods.rpContainer();
744
  },
745
  rpContainer: function() {// Resize & Position Container
746
+ if(opt.maxheight !== 0) {
747
+ $('.gmPhantom_Container', Container).css({maxHeight: opt.maxheight});
748
+ $('.gmPhantom_thumbsWrapper', Container).css({maxWidth: 'none'});
749
+ }
750
+ if(opt.thumbsSpacing) {
751
+ $('.gmPhantom_thumbsWrapper', Container).css({marginTop: -opt.thumbsSpacing, marginLeft: -opt.thumbsSpacing});
752
  }
753
  },
754
 
755
  initThumbs: function() {//Init Thumbnails
 
 
 
 
756
  var thumb_container = $('.gmPhantom_ThumbContainer', Container);
757
  if(opt.thumbsInfo == 'tooltip') {
758
  if(!prototypes.isTouchDevice()) {
759
  thumb_container.hover(function() {
760
+ methods.showTooltip($(this));
761
+ },
762
+ function() {
763
+ $('.gmPhantom_Tooltip', Container).css('display', 'none');
764
+ });
 
765
  } else {
766
  $('.gmPhantom_thumbsWrapper', Container).removeClass('gmPhantom_LabelTolltip').addClass('gmPhantom_LabelInside');
767
  }
768
  }
769
 
770
  thumb_container.click(function(e) {
771
+ var link = $(this).data('link'),
772
+ target = $(this).data('target');
773
+ if(link && opt.thumb2link) {
774
  e.stopPropagation();
775
+ prototypes.openLink(link, target);
776
  return false;
777
  }
778
  });
786
  e.stopPropagation();
787
  });
788
 
789
+ $('.gmPhantom_ThumbLoader .gmPhantom_Thumb img', Container).css({opacity: 0}).each(function() {
790
  var image = $(this);
791
  var img_holder = image.closest('.gmPhantom_ThumbContainer');
 
792
  var load_img = new Image();
793
+ $(load_img).on('load', function() {
794
  img_holder.removeClass('gmPhantom_ThumbLoader');
795
+ image.animate({opacity: opt.thumbAlpha / 100}, 600, function() {
796
+ $(this).css({opacity: ''});
797
  });
798
  }).attr('src', image.attr('src'));
799
  });
815
  rpThumbs: function() {// Resize & Position Thumbnails
816
  var thumbW = opt.thumbWidth + opt.thumbBorderSize * 2 + opt.thumbPadding * 2,
817
  no = 0,
818
+ col = 0,
819
+ row = 1,
820
  hiddenBustedItems = prototypes.doHideBuster($(Container));
821
  if(opt.initialHeight === 0 || (opt.initialCols === 0 && opt.initialRows === 0)) {
822
  opt.thumbCols = parseInt((opt.width + opt.thumbsSpacing - opt.thumbsHorizontalPadding * 2) / (thumbW + opt.thumbsSpacing));
845
  }
846
  }
847
 
848
+ $('.gmPhantom_thumbsWrapper > div', Container).each(function() {
 
 
 
 
 
849
  no++;
850
+ col++;
851
 
852
+ $(this).attr('data-col', col).attr('data-row', row).css({'margin': ''});
 
 
 
 
 
 
 
 
853
  if(no % opt.thumbCols === 0) {
854
+ col = 0;
855
+ row++;
856
  }
857
 
858
  var img = $('.gmPhantom_Thumb > img', this);
859
  var thumb_ratio = $(this).data('ratio');
860
+ if(opt.ratio <= thumb_ratio) {
861
+ img.attr('class', 'landscape');
862
  } else {
863
+ img.attr('class', 'portrait');
864
+ if(1 != thumb_ratio) {
865
+ img.css('margin', Math.floor((opt.thumbWidth / thumb_ratio - opt.thumbHeight) / opt.thumbHeight * 10) + '% 0 0 0');
866
+ }
867
  }
868
 
869
  });
870
  var thumbs_el = $('.gmPhantom_thumbsWrapper', Container),
871
  thumbs_el_width = thumbW * opt.thumbCols + (opt.thumbCols - 1) * opt.thumbsSpacing,
872
  scrollbar_width = 0;
873
+ thumbs_el.width(thumbs_el_width + opt.thumbsSpacing);
874
  if(thumbs_el_width >= $('.gmPhantom_Container', Container).width()) {
875
  scrollbar_width = methods.scrollbarWidth();
876
  }
877
 
878
  if(opt.initialHeight !== 0) {
879
  var thumbH = opt.thumbHeight + opt.thumbBorderSize * 2 + opt.thumbPadding * 2,
880
+ thumbs_el_height = thumbH * opt.thumbRows + opt.thumbRows * opt.thumbsSpacing;
881
  $('.gmPhantom_thumbsWrapper', Container).height(thumbs_el_height + scrollbar_width);
882
 
883
+ if(!prototypes.isTouchDevice()) {
884
+ if(opt.thumbsNavigation == 'scroll' && typeof(jQuery.fn.jScrollPane) != 'undefined') {
885
+ $('.gmPhantom_Container .jspContainer', Container).width($('.gmPhantom_thumbsWrapper', Container).width());
 
 
886
  }
 
 
 
 
 
887
  }
888
  }
889
 
 
 
890
  prototypes.undoHideBuster(hiddenBustedItems);
891
  },
892
  moveThumbs: function() {// Init thumbnails move
895
  if(itemLoaded) {
896
  return;
897
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
898
 
899
+ var w1 = $(this).width(),
900
+ w2 = thumbs_el.outerWidth() - opt.thumbsSpacing,
901
+ h1 = $(this).height(),
902
+ h2 = thumbs_el.outerHeight() - opt.thumbsSpacing,
903
+ wdiff = w2 - w1,
904
+ hdiff = h2 - h1,
905
+ mpw, mph,
906
+ tx, ty;
907
+ if(wdiff < 0){
908
+ tx = 0;
909
+ } else {
910
+ mpw = e.clientX - 0.1*w1 - $(this).offset().left + parseInt($(this).css('margin-left')) + $(document).scrollLeft();
911
+ mpw = mpw / (w1 - w1 * 0.2);
912
+ if(mpw < 0) {
913
+ mpw = 0;
914
+ } else if(mpw > 1) {
915
+ mpw = 1;
916
  }
917
+ tx = wdiff * mpw;
918
+ }
919
+ if(hdiff < 0){
920
+ ty = 0;
921
+ } else {
922
+ mph = e.clientY - 0.1*h1 - $(this).offset().top + parseInt($(this).css('margin-top')) + $(document).scrollTop();
923
+ mph = mph / (h1 - h1 * 0.2);
924
+ if(mph < 0) {
925
+ mph = 0;
926
+ } else if(mph > 1) {
927
+ mph = 1;
928
  }
929
+ ty = hdiff * mph;
 
930
  }
931
+
932
+ thumbs_el.css('transform', 'translate(-' + tx + 'px, -' + ty + 'px)');
933
+
934
  });
935
  },
936
  initThumbsScroll: function() {//Init Thumbnails Scroll
958
  $('.gmPhantom_Tooltip', Container).css('top', mousePositionY - $('.gmPhantom_Tooltip', Container).height() - 15);
959
  });
960
  },
961
+ showTooltip: function(thumb) {// Resize, Position & Display the Tooltip
962
+ var title = $.trim($('.gmPhantom_title', thumb).text()),
963
+ HTML = [];
964
+ HTML.push(title);
965
  HTML.push('<div class="gmPhantom_Tooltip_ArrowBorder"></div>');
966
  HTML.push('<div class="gmPhantom_Tooltip_Arrow"></div>');
967
  $('.gmPhantom_Tooltip', Container).html(HTML.join(""));
976
  if(opt.tooltipTextColor != 'css') {
977
  $('.gmPhantom_Tooltip', Container).css('color', '#' + opt.tooltipTextColor);
978
  }
979
+ if(title !== '') {
980
  $('.gmPhantom_Tooltip', Container).css('display', 'block');
981
  }
982
  }
983
  },
984
 
985
  prototypes = {
986
+ isIEBrowser: function() {// Detect the browser IE
987
  var myNav = navigator.userAgent.toLowerCase();
988
+ return (myNav.indexOf('msie') == -1)? false : parseInt(myNav.split('msie')[1]);
989
  },
990
  isTouchDevice: function() {// Detect Touchscreen devices
991
  return 'ontouchend' in document;
1057
  window.location = url;
1058
  }
1059
  },
1060
+ arrVal: function(arr, val) {
1061
+ return $.inArray(val, arr) !== -1? val : false;
1062
+ },
1063
  $_GET: function(variable) {
1064
  var url = window.location.href.split('?')[1];
1065
  if(url) {
1080
  var parent = item.parent(),
1081
  items = [];
1082
 
1083
+ if(typeof(item.prop('tagName')) !== 'undefined' && item.prop('tagName').toLowerCase() != 'body') {
1084
  items = this.doHideBuster(parent);
1085
 
1086
  item.addClass('gmShowBuster');
module/phantom/settings.php CHANGED
@@ -1,415 +1,373 @@
1
  <?php
2
- $default_options = array(
3
- 'maxheight' => '0',
4
- 'thumbCols' => '0',
5
- 'thumbRows' => '0',
6
- 'thumbsNavigation' => 'scroll',
7
- 'bgColor' => 'ffffff',
8
- 'bgAlpha' => '0',
9
- 'thumbWidth' => '160',
10
- 'thumbHeight' => '120',
11
- 'thumbWidthMobile' => '96',
12
- 'thumbHeightMobile' => '72',
13
- 'thumbsSpacing' => '10',
14
- 'thumbsVerticalPadding' => '5',
15
- 'thumbsHorizontalPadding' => '3',
16
- 'thumbsAlign' => 'left',
17
- 'thumbScale' => '1',
18
- 'thumbBG' => 'ffffff',
19
- 'thumbAlpha' => '85',
20
- 'thumbAlphaHover' => '100',
21
- 'thumbBorderSize' => '1',
22
- 'thumbBorderColor' => 'cccccc',
23
- 'thumbPadding' => '5',
24
- 'thumbsInfo' => 'label',
25
- 'labelOnHover' => '1',
26
- 'labelTextColor' => 'e7e7e7',
27
- 'labelLinkColor' => 'e7e179',
28
- 'label8TextColor' => '0b0b0b',
29
- 'label8LinkColor' => '3695E7',
30
- 'tooltipTextColor' => '0b0b0b',
31
- 'tooltipBgColor' => 'ffffff',
32
- 'tooltipStrokeColor' => '000000',
33
- 'lightboxControlsColor' => 'ffffff',
34
- 'lightboxTitleColor' => 'f3f3f3',
35
- 'lightboxTextColor' => 'f3f3f3',
36
- 'lightboxBGColor' => '0b0b0b',
37
- 'lightboxBGAlpha' => '80',
38
- 'commentsBGColor' => 'ffffff',
39
- 'commentsBGAlpha' => '80',
40
- 'socialShareEnabled' => '1',
41
- 'share_post_link' => '0',
42
- 'deepLinks' => '1',
43
- 'lightbox800HideArrows' => '0',
44
- 'viewsEnabled' => '1',
45
- 'likesEnabled' => '1',
46
- 'commentsEnabled' => '1',
47
- 'thumb2link' => '1',
48
- 'initRPdelay' => '100',
49
- 'customCSS' => ''
 
 
 
 
 
50
  );
51
- $options_tree = array(
52
- array(
53
- 'label' => 'Common Settings',
54
- 'fields' => array(
55
- 'maxheight' => array(
56
- 'label' => 'Max-Height',
57
- 'tag' => 'input',
58
- 'attr' => 'type="number" min="0" data-watch="change"',
59
- 'text' => 'Set the maximum height of the gallery. Leave 0 to disable max-height. If value is 0, then Thumbnail Rows value ignored and Thumbnail Columns is a max value'
60
- ),
61
- 'thumbCols' => array(
62
- 'label' => 'Thumbnail Columns',
63
- 'tag' => 'input',
64
- 'attr' => 'type="number" min="0"',
65
- 'text' => 'Number of Columns (number, 0 = auto). Set the number of columns for the grid. If value is 0, then number of columns will be relative to content width or relative to Thumbnail Rows (if rows not auto). This will be ignored if Height value is 0'
66
- ),
67
- 'thumbRows' => array(
68
- 'label' => 'Thumbnail Rows',
69
- 'tag' => 'input',
70
- 'attr' => 'type="number" min="0"',
71
- 'text' => 'Number of Lines (number, 0 = auto). Default value: 0. Set the number of lines for the grid. This will be ignored if Thumbnail Columns value is not 0 or if Height value is 0'
72
- ),
73
- 'thumbsNavigation' => array(
74
- 'label' => 'Grid Navigation',
75
- 'tag' => 'select',
76
- 'attr' => 'data-maxheight="!=:0"',
77
- 'text' => 'Set how you navigate through the thumbnails. Ignore this option if Height value is 0',
78
- 'choices' => array(
79
- array(
80
- 'label' => 'Mouse Move',
81
- 'value' => 'mouse'
82
- ),
83
- array(
84
- 'label' => 'Scroll Bars',
85
- 'value' => 'scroll'
86
- )
87
- )
88
 
89
- ),
90
- 'bgColor' => array(
91
- 'label' => 'Background Color',
92
- 'tag' => 'input',
93
- 'attr' => 'type="text" data-type="color"',
94
- 'text' => 'Set gallery background color'
95
- ),
96
- 'bgAlpha' => array(
97
- 'label' => 'Background Alpha',
98
- 'tag' => 'input',
99
- 'attr' => 'type="number" min="0" max="100" step="5"',
100
- 'text' => 'Set gallery background alpha opacity'
101
- ),
102
- 'thumb2link' => array(
103
- 'label' => 'Thumbnail to Link',
104
- 'tag' => 'checkbox',
105
- 'attr' => '',
106
- 'text' => 'If item have Link, then open Link instead of lightbox. Note: Link also will be available via item Title on the thumbnail\'s label and in the lightbox'
107
- ),
108
- 'deepLinks' => array(
109
- 'label' => 'Deep Links',
110
- 'tag' => 'checkbox',
111
- 'attr' => '',
112
- 'text' => 'Change URL hash in the address bar for each big image'
113
- )
114
- )
115
- ),
116
- array(
117
- 'label' => 'Thumb Grid General',
118
- 'fields' => array(
119
- 'thumbWidth' => array(
120
- 'label' => 'Thumbnail Width',
121
- 'tag' => 'input',
122
- 'attr' => 'type="number" min="10" max="400"',
123
- 'text' => ''
124
- ),
125
- 'thumbHeight' => array(
126
- 'label' => 'Thumbnail Height',
127
- 'tag' => 'input',
128
- 'attr' => 'type="number" min="10" max="400"',
129
- 'text' => ''
130
- ),
131
- 'thumbWidthMobile' => array(
132
- 'label' => 'Thumbnail Width Mobile',
133
- 'tag' => 'input',
134
- 'attr' => 'type="number" min="10" max="400"',
135
- 'text' => 'Set width for thumbnail if window width is less than 640px'
136
- ),
137
- 'thumbHeightMobile' => array(
138
- 'label' => 'Thumbnail Height Mobile',
139
- 'tag' => 'input',
140
- 'attr' => 'type="number" min="10" max="400"',
141
- 'text' => 'Set height for thumbnail if window width is less than 640px'
142
- ),
143
- 'thumbsSpacing' => array(
144
- 'label' => 'Thumbnails Spacing',
145
- 'tag' => 'input',
146
- 'attr' => 'type="number" min="0"',
147
- 'text' => 'Set the space between thumbnails'
148
- ),
149
- 'thumbsVerticalPadding' => array(
150
- 'label' => 'Grid Vertical Padding',
151
- 'tag' => 'input',
152
- 'attr' => 'type="number" min="0"',
153
- 'text' => 'Set the vertical padding for the thumbnails grid'
154
- ),
155
- 'thumbsHorizontalPadding' => array(
156
- 'label' => 'Grid Horizontal Padding',
157
- 'tag' => 'input',
158
- 'attr' => 'type="number" min="0"',
159
- 'text' => 'Set the horizontal padding for the thumbnails grid'
160
- ),
161
- 'thumbsAlign' => array(
162
- 'label' => 'Thumbnails Align',
163
- 'tag' => 'select',
164
- 'attr' => '',
165
- 'text' => 'Align thumbnails grid in container. Applied only if grid width less than gallery width',
166
- 'choices' => array(
167
- array(
168
- 'label' => 'Left',
169
- 'value' => 'left'
170
- ),
171
- array(
172
- 'label' => 'Center',
173
- 'value' => 'center'
174
- ),
175
- array(
176
- 'label' => 'Right',
177
- 'value' => 'right'
178
- )
179
- )
180
- ),
181
- 'viewsEnabled' => array(
182
- 'label' => 'Views Counter',
183
- 'tag' => 'checkbox',
184
- 'attr' => '',
185
- 'text' => 'Show Views counter?'
186
- ),
187
- 'likesEnabled' => array(
188
- 'label' => 'Like Button',
189
- 'tag' => 'checkbox',
190
- 'attr' => '',
191
- 'text' => 'Enable Like Button?'
192
- ),
193
- 'commentsEnabled' => array(
194
- 'label' => 'Comments',
195
- 'tag' => 'checkbox',
196
- 'attr' => '',
197
- 'text' => 'Enable Comments?'
198
- )
199
- )
200
- ),
201
- array(
202
- 'label' => 'Thumbnail Style',
203
- 'fields' => array(
204
- 'thumbScale' => array(
205
- 'label' => 'Thumbnail Scale on mouseover',
206
- 'tag' => 'checkbox',
207
- 'attr' => '',
208
- 'text' => ''
209
- ),
210
- 'thumbBG' => array(
211
- 'label' => 'Thumbnail Container Background',
212
- 'tag' => 'input',
213
- 'attr' => 'type="text" data-type="color"',
214
- 'text' => 'Set empty for transparent background'
215
- ),
216
- 'thumbAlpha' => array(
217
- 'label' => 'Thumbnail Alpha',
218
- 'tag' => 'input',
219
- 'attr' => 'type="number" min="0" max="100" step="5"',
220
- 'text' => 'Set the transparency of a thumbnail'
221
- ),
222
- 'thumbAlphaHover' => array(
223
- 'label' => 'Thumbnail Alpha Hover',
224
- 'tag' => 'input',
225
- 'attr' => 'type="number" min="0" max="100" step="5"',
226
- 'text' => 'Set the transparancy of a thumbnail when hover'
227
- ),
228
- 'thumbBorderSize' => array(
229
- 'label' => 'Thumbnail Border Size',
230
- 'tag' => 'input',
231
- 'attr' => 'type="number" min="0"',
232
- 'text' => 'Set border size for thumbnail'
233
- ),
234
- 'thumbBorderColor' => array(
235
- 'label' => 'Thumbnail Border Color',
236
- 'tag' => 'input',
237
- 'attr' => 'type="text" data-type="color"',
238
- 'text' => 'Set the color of a thumbnail\'s border'
239
- ),
240
- 'thumbPadding' => array(
241
- 'label' => 'Thumbnail Padding',
242
- 'tag' => 'input',
243
- 'attr' => 'type="number" min="0"',
244
- 'text' => 'Set padding for the thumbnail'
245
- )
246
- )
247
- ),
248
- array(
249
- 'label' => 'Thumbnails Title',
250
- 'fields' => array(
251
- 'thumbsInfo' => array(
252
- 'label' => 'Display Thumbnails Title',
253
- 'tag' => 'select',
254
- 'attr' => 'data-watch="change"',
255
- 'text' => 'Default value: Label. Display a small info text on the thumbnails, a tooltip or a label.',
256
- 'choices' => array(
257
- array(
258
- 'label' => 'Label Over Image',
259
- 'value' => 'label'
260
- ),
261
- array(
262
- 'label' => 'Label Under Image',
263
- 'value' => 'label_bottom'
264
- ),
265
- array(
266
- 'label' => 'Tooltip',
267
- 'value' => 'tooltip'
268
- ),
269
- array(
270
- 'label' => 'None',
271
- 'value' => 'none'
272
- )
273
- )
274
 
275
- ),
276
- 'labelOnHover' => array(
277
- 'label' => 'Show Label on Mouseover',
278
- 'tag' => 'checkbox',
279
- 'attr' => 'data-thumbsinfo="is:label:0"',
280
- 'text' => 'Uncheck to show thumbnail\'s label all time'
281
- ),
282
- 'labelTextColor' => array(
283
- 'label' => 'Label-Over Text Color',
284
- 'tag' => 'input',
285
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label"',
286
- 'text' => 'Set Label-Over text color'
287
- ),
288
- 'labelLinkColor' => array(
289
- 'label' => 'Label-Over Link Color',
290
- 'tag' => 'input',
291
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label"',
292
- 'text' => 'Set Label-Over link color'
293
- ),
294
- 'label8TextColor' => array(
295
- 'label' => 'Label Text Color',
296
- 'tag' => 'input',
297
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label_bottom"',
298
- 'text' => 'Set Label text color'
299
- ),
300
- 'label8LinkColor' => array(
301
- 'label' => 'Label Link Color',
302
- 'tag' => 'input',
303
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label_bottom"',
304
- 'text' => 'Set Label-Bottom link color'
305
- ),
306
- 'tooltipTextColor' => array(
307
- 'label' => 'Tooltip Text Color',
308
- 'tag' => 'input',
309
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:tooltip"',
310
- 'text' => 'Set Tooltip text color'
311
- ),
312
- 'tooltipBgColor' => array(
313
- 'label' => 'Tooltip Background Color',
314
- 'tag' => 'input',
315
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:tooltip"',
316
- 'text' => 'Set tooltip background color. Ignore this if Display Thumbnails Title value is not Tooltip'
317
- ),
318
- 'tooltipStrokeColor' => array(
319
- 'label' => 'Tooltip Stroke Color',
320
- 'tag' => 'input',
321
- 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:tooltip"',
322
- 'text' => 'Set tooltip stroke color. Ignore this if Display Thumbnails Title value is not Tooltip'
323
- )
324
- )
325
- ),
326
- array(
327
- 'label' => 'Lightbox Settings',
328
- 'fields' => array(
329
- 'lightboxControlsColor' => array(
330
- 'label' => 'Lightbox Controls / Buttons Color',
331
- 'tag' => 'input',
332
- 'attr' => 'type="text" data-type="color"',
333
- 'text' => 'Set the color for lightbox control buttons'
334
- ),
335
- 'lightboxTitleColor' => array(
336
- 'label' => 'Lightbox Image Title Color',
337
- 'tag' => 'input',
338
- 'attr' => 'type="text" data-type="color"',
339
- 'text' => 'Set the text color for image title'
340
- ),
341
- 'lightboxTextColor' => array(
342
- 'label' => 'Lightbox Image Description Color',
343
- 'tag' => 'input',
344
- 'attr' => 'type="text" data-type="color"',
345
- 'text' => 'Set the text color for image caption'
346
- ),
347
- 'lightboxBGColor' => array(
348
- 'label' => 'Lightbox Window Color',
349
- 'tag' => 'input',
350
- 'attr' => 'type="text" data-type="color"',
351
- 'text' => 'Set the background color for the lightbox window'
352
- ),
353
- 'lightboxBGAlpha' => array(
354
- 'label' => 'Lightbox Window Alpha',
355
- 'tag' => 'input',
356
- 'attr' => 'type="number" min="0" max="100" step="5"',
357
- 'text' => 'Set the transparancy for the lightbox window'
358
- ),
359
- 'commentsBGColor' => array(
360
- 'label' => 'Comments Block BG Color',
361
- 'tag' => 'input',
362
- 'attr' => 'type="text" data-type="color"',
363
- 'text' => 'Set the background color for the comments block'
364
- ),
365
- 'commentsBGAlpha' => array(
366
- 'label' => 'Comments Block BG Alpha',
367
- 'tag' => 'input',
368
- 'attr' => 'type="number" min="0" max="100" step="5"',
369
- 'text' => 'Set the transparancy for the comments block'
370
- ),
371
- 'socialShareEnabled' => array(
372
- 'label' => 'Social Share',
373
- 'tag' => 'checkbox',
374
- 'attr' => 'data-watch="change"',
375
- 'text' => 'Enable AddThis Social Share?'
376
- ),
377
- 'share_post_link' => array(
378
- 'label' => 'Share link to Gmedia Post',
379
- 'tag' => 'checkbox',
380
- 'attr' => 'data-socialshareenabled="is:1"',
381
- 'text' => 'Share link to the individual Gmedia Post instead of to the image in gallery.'
382
- ),
383
- 'lightbox800HideArrows' => array(
384
- 'label' => 'Hide Arrows when small window',
385
- 'tag' => 'checkbox',
386
- 'attr' => '',
387
- 'text' => 'Hide Arrows if window width less than 800px'
388
- )
389
- )
390
- ),
391
- array(
392
- 'label' => 'Advanced Settings',
393
- 'fields' => array(
394
- 'initRPdelay' => array(
395
- 'label' => 'Delay for Thumbnail Positioning',
396
- 'tag' => 'input',
397
- 'attr' => 'type="number" min="0" max="5000" step="1"',
398
- 'text' => 'Set delay in miliseconds. Set more if gallery render wrong grid.'
399
- ),
400
- 'customCSS' => array(
401
- 'label' => 'Custom CSS',
402
- 'tag' => 'textarea',
403
- 'attr' => 'cols="20" rows="10"',
404
- 'text' => 'You can enter custom style rules into this box if you\'d like. IE: <i>a{color: red !important;}</i><br />This is an advanced option! This is not recommended for users not fluent in CSS... but if you do know CSS, anything you add here will override the default styles'
405
- )
406
- /*,
407
- 'loveLink' => array(
408
- 'label' => 'Display LoveLink?',
409
- 'tag' => 'checkbox',
410
- 'attr' => '',
411
- 'text' => 'Selecting "Yes" will show the lovelink icon (codeasily.com) somewhere on the gallery'
412
- )*/
413
- )
414
- )
415
  );
1
  <?php
2
+ $default_options = array('per_page' => '100',
3
+ 'maxheight' => '0',
4
+ 'thumbCols' => '0',
5
+ 'thumbRows' => '0',
6
+ 'thumbsNavigation' => 'scroll',
7
+ 'bgColor' => 'ffffff',
8
+ 'bgAlpha' => '0',
9
+ 'thumbWidth' => '200',
10
+ 'thumbHeight' => '180',
11
+ 'thumbWidthMobile' => '150',
12
+ 'thumbHeightMobile' => '135',
13
+ 'thumbsSpacing' => '8',
14
+ 'thumbsVerticalPadding' => '4',
15
+ 'thumbsHorizontalPadding' => '4',
16
+ 'thumbsAlign' => 'center',
17
+ 'thumbScale' => '1',
18
+ 'thumbBG' => 'ffffff',
19
+ 'thumbAlpha' => '90',
20
+ 'thumbAlphaHover' => '100',
21
+ 'thumbBorderSize' => '1',
22
+ 'thumbBorderColor' => 'cccccc',
23
+ 'thumbPadding' => '2',
24
+ 'thumbsInfo' => 'label',
25
+ 'labelOnHover' => '1',
26
+ 'labelTextColor' => 'ffffff',
27
+ 'labelLinkColor' => 'e7e179',
28
+ 'label8TextColor' => '0b0b0b',
29
+ 'label8LinkColor' => '3695E7',
30
+ 'tooltipTextColor' => '0b0b0b',
31
+ 'tooltipBgColor' => 'ffffff',
32
+ 'tooltipStrokeColor' => '000000',
33
+ 'lightboxControlsColor' => 'ffffff',
34
+ 'lightboxTitleColor' => 'f3f3f3',
35
+ 'lightboxTextColor' => 'f3f3f3',
36
+ 'lightboxBGColor' => '0b0b0b',
37
+ 'lightboxBGAlpha' => '80',
38
+ 'commentsBGColor' => 'ffffff',
39
+ 'socialShareEnabled' => '1',
40
+ 'share_post_link' => '1',
41
+ 'deepLinks' => '1',
42
+ 'sidebarBGColor' => 'ffffff',
43
+ 'lightbox800HideArrows' => '0',
44
+ 'viewsEnabled' => '1',
45
+ 'likesEnabled' => '1',
46
+ 'commentsEnabled' => '1',
47
+ 'thumb2link' => '0',
48
+ 'show_title' => '1',
49
+ 'show_tags' => '1',
50
+ 'show_categories' => '1',
51
+ 'show_albums' => '1',
52
+ 'show_download_button' => '1',
53
+ 'initRPdelay' => '200',
54
+ 'customCSS' => ''
55
  );
56
+ $options_tree = array(array('label' => 'Common Settings',
57
+ 'fields' => array('per_page' => array('label' => 'Items Per Page',
58
+ 'tag' => 'input',
59
+ 'attr' => 'type="number" min="1"',
60
+ 'text' => ''
61
+ ),
62
+ 'maxheight' => array('label' => 'Max-Height',
63
+ 'tag' => 'input',
64
+ 'attr' => 'type="number" min="0" data-watch="change"',
65
+ 'text' => 'Set the maximum height of the gallery. Leave 0 to disable max-height. If value is 0, then Thumbnail Rows value ignored and Thumbnail Columns is a max value'
66
+ ),
67
+ 'thumbCols' => array('label' => 'Thumbnail Columns',
68
+ 'tag' => 'input',
69
+ 'attr' => 'type="number" min="0"',
70
+ 'text' => 'Number of Columns (number, 0 = auto). Set the number of columns for the grid. If value is 0, then number of columns will be relative to content width or relative to Thumbnail Rows (if rows not auto). This will be ignored if Height value is 0'
71
+ ),
72
+ 'thumbRows' => array('label' => 'Thumbnail Rows',
73
+ 'tag' => 'input',
74
+ 'attr' => 'type="number" min="0"',
75
+ 'text' => 'Number of Lines (number, 0 = auto). Default value: 0. Set the number of lines for the grid. This will be ignored if Thumbnail Columns value is not 0 or if Height value is 0'
76
+ ),
77
+ 'thumbsNavigation' => array('label' => 'Grid Navigation',
78
+ 'tag' => 'select',
79
+ 'attr' => 'data-maxheight="!=:0"',
80
+ 'text' => 'Set how you navigate through the thumbnails. Ignore this option if Height value is 0',
81
+ 'choices' => array(array('label' => 'Mouse Move',
82
+ 'value' => 'mouse'
83
+ ),
84
+ array('label' => 'Scroll Bars',
85
+ 'value' => 'scroll'
86
+ )
87
+ )
 
 
 
 
 
88
 
89
+ ),
90
+ 'bgColor' => array('label' => 'Background Color',
91
+ 'tag' => 'input',
92
+ 'attr' => 'type="text" data-type="color"',
93
+ 'text' => 'Set gallery background color'
94
+ ),
95
+ 'bgAlpha' => array('label' => 'Background Alpha',
96
+ 'tag' => 'input',
97
+ 'attr' => 'type="number" min="0" max="100" step="5"',
98
+ 'text' => 'Set gallery background alpha opacity'
99
+ ),
100
+ 'thumb2link' => array('label' => 'Thumbnail to Link',
101
+ 'tag' => 'checkbox',
102
+ 'attr' => '',
103
+ 'text' => 'If item have Link, then open Link instead of lightbox. Note: Link also will be available via item Title on the thumbnail\'s label and in the lightbox'
104
+ ),
105
+ 'deepLinks' => array('label' => 'Deep Links',
106
+ 'tag' => 'checkbox',
107
+ 'attr' => '',
108
+ 'text' => 'Change URL hash in the address bar for each big image'
109
+ ),
110
+ 'viewsEnabled' => array('label' => 'Views Counter',
111
+ 'tag' => 'checkbox',
112
+ 'attr' => '',
113
+ 'text' => 'Show Views counter?'
114
+ ),
115
+ 'likesEnabled' => array('label' => 'Like Button',
116
+ 'tag' => 'checkbox',
117
+ 'attr' => '',
118
+ 'text' => 'Enable Like Button?'
119
+ ),
120
+ 'commentsEnabled' => array('label' => 'Comments',
121
+ 'tag' => 'checkbox',
122
+ 'attr' => '',
123
+ 'text' => 'Enable Comments?'
124
+ ),
125
+ 'socialShareEnabled' => array('label' => 'Show Share Button',
126
+ 'tag' => 'checkbox',
127
+ 'attr' => 'data-watch="change"',
128
+ 'text' => ''
129
+ ),
130
+ 'share_post_link' => array('label' => 'Share link to Gmedia Post',
131
+ 'tag' => 'checkbox',
132
+ 'attr' => 'data-socialshareenabled="is:1"',
133
+ 'text' => 'Share link to the individual Gmedia Post instead of to the image in gallery.'
134
+ ),
135
+ 'show_title' => array('label' => 'Show Title in Lightbox',
136
+ 'tag' => 'checkbox',
137
+ 'attr' => '',
138
+ 'text' => ''
139
+ ),
140
+ 'show_tags' => array('label' => 'Show Tags',
141
+ 'tag' => 'checkbox',
142
+ 'attr' => '',
143
+ 'text' => ''
144
+ ),
145
+ 'show_categories' => array('label' => 'Show Categories',
146
+ 'tag' => 'checkbox',
147
+ 'attr' => '',
148
+ 'text' => ''
149
+ ),
150
+ 'show_albums' => array('label' => 'Show Album',
151
+ 'tag' => 'checkbox',
152
+ 'attr' => '',
153
+ 'text' => ''
154
+ ),
155
+ 'show_download_button' => array('label' => 'Show Download Button',
156
+ 'tag' => 'checkbox',
157
+ 'attr' => '',
158
+ 'text' => ''
159
+ ),
160
+ )
161
+ ),
162
+ array('label' => 'Thumb Grid General',
163
+ 'fields' => array('thumbWidth' => array('label' => 'Thumbnail Width',
164
+ 'tag' => 'input',
165
+ 'attr' => 'type="number" min="10" max="400"',
166
+ 'text' => ''
167
+ ),
168
+ 'thumbHeight' => array('label' => 'Thumbnail Height',
169
+ 'tag' => 'input',
170
+ 'attr' => 'type="number" min="10" max="400"',
171
+ 'text' => ''
172
+ ),
173
+ 'thumbWidthMobile' => array('label' => 'Thumbnail Width Mobile',
174
+ 'tag' => 'input',
175
+ 'attr' => 'type="number" min="10" max="400"',
176
+ 'text' => 'Set width for thumbnail if window width is less than 640px'
177
+ ),
178
+ 'thumbHeightMobile' => array('label' => 'Thumbnail Height Mobile',
179
+ 'tag' => 'input',
180
+ 'attr' => 'type="number" min="10" max="400"',
181
+ 'text' => 'Set height for thumbnail if window width is less than 640px'
182
+ ),
183
+ 'thumbsSpacing' => array('label' => 'Thumbnails Spacing',
184
+ 'tag' => 'input',
185
+ 'attr' => 'type="number" min="0"',
186
+ 'text' => 'Set the space between thumbnails'
187
+ ),
188
+ 'thumbsVerticalPadding' => array('label' => 'Grid Vertical Padding',
189
+ 'tag' => 'input',
190
+ 'attr' => 'type="number" min="0"',
191
+ 'text' => 'Set the vertical padding for the thumbnails grid'
192
+ ),
193
+ 'thumbsHorizontalPadding' => array('label' => 'Grid Horizontal Padding',
194
+ 'tag' => 'input',
195
+ 'attr' => 'type="number" min="0"',
196
+ 'text' => 'Set the horizontal padding for the thumbnails grid'
197
+ ),
198
+ 'thumbsAlign' => array('label' => 'Thumbnails Align',
199
+ 'tag' => 'select',
200
+ 'attr' => '',
201
+ 'text' => 'Align thumbnails grid in container. Applied only if grid width less than gallery width',
202
+ 'choices' => array(array('label' => 'Left',
203
+ 'value' => 'left'
204
+ ),
205
+ array('label' => 'Center',
206
+ 'value' => 'center'
207
+ ),
208
+ array('label' => 'Right',
209
+ 'value' => 'right'
210
+ )
211
+ )
212
+ )
213
+ )
214
+ ),
215
+ array('label' => 'Thumbnail Style',
216
+ 'fields' => array('thumbScale' => array('label' => 'Thumbnail Scale on mouseover',
217
+ 'tag' => 'checkbox',
218
+ 'attr' => '',
219
+ 'text' => ''
220
+ ),
221
+ 'thumbBG' => array('label' => 'Thumbnail Container Background',
222
+ 'tag' => 'input',
223
+ 'attr' => 'type="text" data-type="color"',
224
+ 'text' => 'Set empty for transparent background'
225
+ ),
226
+ 'thumbAlpha' => array('label' => 'Thumbnail Alpha',
227
+ 'tag' => 'input',
228
+ 'attr' => 'type="number" min="0" max="100" step="5"',
229
+ 'text' => 'Set the transparency of a thumbnail'
230
+ ),
231
+ 'thumbAlphaHover' => array('label' => 'Thumbnail Alpha Hover',
232
+ 'tag' => 'input',
233
+ 'attr' => 'type="number" min="0" max="100" step="5"',
234
+ 'text' => 'Set the transparancy of a thumbnail when hover'
235
+ ),
236
+ 'thumbBorderSize' => array('label' => 'Thumbnail Border Size',
237
+ 'tag' => 'input',
238
+ 'attr' => 'type="number" min="0"',
239
+ 'text' => 'Set border size for thumbnail'
240
+ ),
241
+ 'thumbBorderColor' => array('label' => 'Thumbnail Border Color',
242
+ 'tag' => 'input',
243
+ 'attr' => 'type="text" data-type="color"',
244
+ 'text' => 'Set the color of a thumbnail\'s border'
245
+ ),
246
+ 'thumbPadding' => array('label' => 'Thumbnail Padding',
247
+ 'tag' => 'input',
248
+ 'attr' => 'type="number" min="0"',
249
+ 'text' => 'Set padding for the thumbnail'
250
+ )
251
+ )
252
+ ),
253
+ array('label' => 'Thumbnails Title',
254
+ 'fields' => array('thumbsInfo' => array('label' => 'Display Thumbnails Title',
255
+ 'tag' => 'select',
256
+ 'attr' => 'data-watch="change"',
257
+ 'text' => 'Default value: Label. Display a small info text on the thumbnails, a tooltip or a label.',
258
+ 'choices' => array(array('label' => 'Label Over Image',
259
+ 'value' => 'label'
260
+ ),
261
+ array('label' => 'Label Under Image',
262
+ 'value' => 'label_bottom'
263
+ ),
264
+ array('label' => 'Tooltip',
265
+ 'value' => 'tooltip'
266
+ ),
267
+ array('label' => 'None',
268
+ 'value' => 'none'
269
+ )
270
+ )
 
 
 
271
 
272
+ ),
273
+ 'labelOnHover' => array('label' => 'Show Label on Mouseover',
274
+ 'tag' => 'checkbox',
275
+ 'attr' => 'data-thumbsinfo="is:label:0"',
276
+ 'text' => 'Uncheck to show thumbnail\'s label all time'
277
+ ),
278
+ 'labelTextColor' => array('label' => 'Label-Over Text Color',
279
+ 'tag' => 'input',
280
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label"',
281
+ 'text' => 'Set Label-Over text color'
282
+ ),
283
+ 'labelLinkColor' => array('label' => 'Label-Over Link Color',
284
+ 'tag' => 'input',
285
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label"',
286
+ 'text' => 'Set Label-Over link color'
287
+ ),
288
+ 'label8TextColor' => array('label' => 'Label Text Color',
289
+ 'tag' => 'input',
290
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label_bottom"',
291
+ 'text' => 'Set Label text color'
292
+ ),
293
+ 'label8LinkColor' => array('label' => 'Label Link Color',
294
+ 'tag' => 'input',
295
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:label_bottom"',
296
+ 'text' => 'Set Label-Bottom link color'
297
+ ),
298
+ 'tooltipTextColor' => array('label' => 'Tooltip Text Color',
299
+ 'tag' => 'input',
300
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:tooltip"',
301
+ 'text' => 'Set Tooltip text color'
302
+ ),
303
+ 'tooltipBgColor' => array('label' => 'Tooltip Background Color',
304
+ 'tag' => 'input',
305
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:tooltip"',
306
+ 'text' => 'Set tooltip background color. Ignore this if Display Thumbnails Title value is not Tooltip'
307
+ ),
308
+ 'tooltipStrokeColor' => array('label' => 'Tooltip Stroke Color',
309
+ 'tag' => 'input',
310
+ 'attr' => 'type="text" data-type="color" data-thumbsinfo="is:tooltip"',
311
+ 'text' => 'Set tooltip stroke color. Ignore this if Display Thumbnails Title value is not Tooltip'
312
+ )
313
+ )
314
+ ),
315
+ array('label' => 'Lightbox Settings',
316
+ 'fields' => array('lightboxControlsColor' => array('label' => 'Lightbox Controls / Buttons Color',
317
+ 'tag' => 'input',
318
+ 'attr' => 'type="text" data-type="color"',
319
+ 'text' => 'Set the color for lightbox control buttons'
320
+ ),
321
+ 'lightboxTitleColor' => array('label' => 'Lightbox Image Title Color',
322
+ 'tag' => 'input',
323
+ 'attr' => 'type="text" data-type="color"',
324
+ 'text' => 'Set the text color for image title'
325
+ ),
326
+ 'lightboxTextColor' => array('label' => 'Lightbox Image Description Color',
327
+ 'tag' => 'input',
328
+ 'attr' => 'type="text" data-type="color"',
329
+ 'text' => 'Set the text color for image caption'
330
+ ),
331
+ 'lightboxBGColor' => array('label' => 'Lightbox Window Color',
332
+ 'tag' => 'input',
333
+ 'attr' => 'type="text" data-type="color"',
334
+ 'text' => 'Set the background color for the lightbox window'
335
+ ),
336
+ 'lightboxBGAlpha' => array('label' => 'Lightbox Window Alpha',
337
+ 'tag' => 'input',
338
+ 'attr' => 'type="number" min="0" max="100" step="5"',
339
+ 'text' => 'Set the transparancy for the lightbox window'
340
+ ),
341
+ 'sidebarBGColor' => array('label' => 'Comments Block BG Color',
342
+ 'tag' => 'input',
343
+ 'attr' => 'type="text" data-type="color"',
344
+ 'text' => 'Set the background color for the comments block'
345
+ ),
346
+ 'lightbox800HideArrows' => array('label' => 'Hide Arrows when small window',
347
+ 'tag' => 'checkbox',
348
+ 'attr' => '',
349
+ 'text' => 'Hide Arrows if window width less than 800px'
350
+ )
351
+ )
352
+ ),
353
+ array('label' => 'Advanced Settings',
354
+ 'fields' => array('initRPdelay' => array('label' => 'Delay for Thumbnail Positioning',
355
+ 'tag' => 'input',
356
+ 'attr' => 'type="number" min="0" max="5000" step="1"',
357
+ 'text' => 'Set delay in miliseconds. Set more if gallery render wrong grid.'
358
+ ),
359
+ 'customCSS' => array('label' => 'Custom CSS',
360
+ 'tag' => 'textarea',
361
+ 'attr' => 'cols="20" rows="10"',
362
+ 'text' => 'You can enter custom style rules into this box if you\'d like. IE: <i>a{color: red !important;}</i><br />This is an advanced option! This is not recommended for users not fluent in CSS... but if you do know CSS, anything you add here will override the default styles'
363
+ )
364
+ /*,
365
+ 'loveLink' => array(
366
+ 'label' => 'Display LoveLink?',
367
+ 'tag' => 'checkbox',
368
+ 'attr' => '',
369
+ 'text' => 'Selecting "Yes" will show the lovelink icon (codeasily.com) somewhere on the gallery'
370
+ )*/
371
+ )
372
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
  );
module/photomania/css/styles.photomania.css CHANGED
@@ -1,147 +1,56 @@
1
- /**
2
- * Swiper 3.1.2
3
- * Most modern mobile touch slider and framework with hardware accelerated transitions
4
- *
5
- * http://www.idangero.us/swiper/
6
- *
7
- * Copyright 2015, Vladimir Kharlampidi
8
- * The iDangero.us
9
- * http://www.idangero.us/
10
- *
11
- * Licensed under MIT
12
- *
13
- * Released on: August 22, 2015
14
- */
15
- .photomania_module .swiper-container { margin:0 auto; position:relative; overflow:hidden; z-index:1 }
16
- .photomania_module .swiper-container-no-flexbox .swiper-slide { float:left }
17
- .photomania_module .swiper-container-vertical > .swiper-wrapper { -webkit-box-orient:vertical; -moz-box-orient:vertical; -ms-flex-direction:column; -webkit-flex-direction:column; flex-direction:column }
18
- .photomania_module .swiper-wrapper { position:relative; width:100%; height:100%; z-index:1; display:-webkit-box; display:-moz-box; display:-ms-flexbox; display:-webkit-flex; display:flex; -webkit-transition-property:-webkit-transform; -moz-transition-property:-moz-transform; -o-transition-property:-o-transform; -ms-transition-property:-ms-transform; transition-property:transform; -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box }
19
- .photomania_module .swiper-container-android .swiper-slide,
20
- .photomania_module .swiper-wrapper { -webkit-transform:translate3d(0, 0, 0); -moz-transform:translate3d(0, 0, 0); -o-transform:translate(0, 0); -ms-transform:translate3d(0, 0, 0); transform:translate3d(0, 0, 0) }
21
- .photomania_module .swiper-container-multirow > .swiper-wrapper { -webkit-box-lines:multiple; -moz-box-lines:multiple; -ms-flex-wrap:wrap; -webkit-flex-wrap:wrap; flex-wrap:wrap }
22
- .photomania_module .swiper-container-free-mode > .swiper-wrapper { -webkit-transition-timing-function:ease-out; -moz-transition-timing-function:ease-out; -ms-transition-timing-function:ease-out; -o-transition-timing-function:ease-out; transition-timing-function:ease-out; margin:0 auto }
23
- .photomania_module .swiper-slide { -webkit-flex-shrink:0; -ms-flex:0 0 auto; flex-shrink:0; width:100%; height:100%; position:relative }
24
- .photomania_module .swiper-container .swiper-notification { position:absolute; left:0; top:0; pointer-events:none; opacity:0; z-index:-1000 }
25
- .photomania_module .swiper-wp8-horizontal { -ms-touch-action:pan-y; touch-action:pan-y }
26
- .photomania_module .swiper-wp8-vertical { -ms-touch-action:pan-x; touch-action:pan-x }
27
- .photomania_module .swiper-button-next,
28
- .photomania_module .swiper-button-prev { position:absolute; top:50%; width:27px; height:44px; margin-top:-22px; z-index:10; cursor:pointer; -moz-background-size:27px 44px; -webkit-background-size:27px 44px; background-size:27px 44px; background-position:center; background-repeat:no-repeat }
29
- .photomania_module .swiper-button-next.swiper-button-disabled,
30
- .photomania_module .swiper-button-prev.swiper-button-disabled { opacity:.35; cursor:auto; pointer-events:none }
31
- .photomania_module .swiper-button-prev,
32
- .photomania_module .swiper-container-rtl .swiper-button-next { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E"); left:10px; right:auto }
33
- .photomania_module .swiper-button-prev.swiper-button-black,
34
- .photomania_module .swiper-container-rtl .swiper-button-next.swiper-button-black { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E") }
35
- .photomania_module .swiper-button-prev.swiper-button-white,
36
- .photomania_module .swiper-container-rtl .swiper-button-next.swiper-button-white { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E") }
37
- .photomania_module .swiper-button-next,
38
- .photomania_module .swiper-container-rtl .swiper-button-prev { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E"); right:10px; left:auto }
39
- .photomania_module .swiper-button-next.swiper-button-black,
40
- .photomania_module .swiper-container-rtl .swiper-button-prev.swiper-button-black { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E") }
41
- .photomania_module .swiper-button-next.swiper-button-white,
42
- .photomania_module .swiper-container-rtl .swiper-button-prev.swiper-button-white { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E") }
43
- .photomania_module .swiper-pagination { position:absolute; text-align:center; -webkit-transition:300ms; -moz-transition:300ms; -o-transition:300ms; transition:300ms; -webkit-transform:translate3d(0, 0, 0); -ms-transform:translate3d(0, 0, 0); -o-transform:translate3d(0, 0, 0); transform:translate3d(0, 0, 0); z-index:10 }
44
- .photomania_module .swiper-pagination.swiper-pagination-hidden { opacity:0 }
45
- .photomania_module .swiper-pagination-bullet { width:8px; height:8px; display:inline-block; border-radius:100%; background:#000; opacity:.2 }
46
- .photomania_module button.swiper-pagination-bullet { border:none; margin:0; padding:0; box-shadow:none; -moz-appearance:none; -ms-appearance:none; -webkit-appearance:none; appearance:none }
47
- .photomania_module .swiper-pagination-clickable .swiper-pagination-bullet { cursor:pointer }
48
- .photomania_module .swiper-pagination-white .swiper-pagination-bullet { background:#fff }
49
- .photomania_module .swiper-pagination-bullet-active { opacity:1; background:#007aff }
50
- .photomania_module .swiper-pagination-white .swiper-pagination-bullet-active { background:#fff }
51
- .photomania_module .swiper-pagination-black .swiper-pagination-bullet-active { background:#000 }
52
- .photomania_module .swiper-container-vertical > .swiper-pagination { right:10px; top:50%; -webkit-transform:translate3d(0, -50%, 0); -moz-transform:translate3d(0, -50%, 0); -o-transform:translate(0, -50%); -ms-transform:translate3d(0, -50%, 0); transform:translate3d(0, -50%, 0) }
53
- .photomania_module .swiper-container-vertical > .swiper-pagination .swiper-pagination-bullet { margin:5px 0; display:block }
54
- .photomania_module .swiper-container-horizontal > .swiper-pagination { bottom:10px; left:0; width:100% }
55
- .photomania_module .swiper-container-horizontal > .swiper-pagination .swiper-pagination-bullet { margin:0 5px }
56
- .photomania_module .swiper-container-3d { -webkit-perspective:1200px; -moz-perspective:1200px; -o-perspective:1200px; perspective:1200px }
57
- .photomania_module .swiper-container-3d .swiper-cube-shadow,
58
- .photomania_module .swiper-container-3d .swiper-slide,
59
- .photomania_module .swiper-container-3d .swiper-slide-shadow-bottom,
60
- .photomania_module .swiper-container-3d .swiper-slide-shadow-left,
61
- .photomania_module .swiper-container-3d .swiper-slide-shadow-right,
62
- .photomania_module .swiper-container-3d .swiper-slide-shadow-top,
63
- .photomania_module .swiper-container-3d .swiper-wrapper { -webkit-transform-style:preserve-3d; -moz-transform-style:preserve-3d; -ms-transform-style:preserve-3d; transform-style:preserve-3d }
64
- .photomania_module .swiper-container-3d .swiper-slide-shadow-bottom,
65
- .photomania_module .swiper-container-3d .swiper-slide-shadow-left,
66
- .photomania_module .swiper-container-3d .swiper-slide-shadow-right,
67
- .photomania_module .swiper-container-3d .swiper-slide-shadow-top { position:absolute; left:0; top:0; width:100%; height:100%; pointer-events:none; z-index:10 }
68
- .photomania_module .swiper-container-3d .swiper-slide-shadow-left { background-image:-webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image:-webkit-linear-gradient(right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-moz-linear-gradient(right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-o-linear-gradient(right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:linear-gradient(to left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)) }
69
- .photomania_module .swiper-container-3d .swiper-slide-shadow-right { background-image:-webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image:-webkit-linear-gradient(left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-moz-linear-gradient(left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-o-linear-gradient(left, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:linear-gradient(to right, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)) }
70
- .photomania_module .swiper-container-3d .swiper-slide-shadow-top { background-image:-webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image:-webkit-linear-gradient(bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-moz-linear-gradient(bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-o-linear-gradient(bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:linear-gradient(to top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)) }
71
- .photomania_module .swiper-container-3d .swiper-slide-shadow-bottom { background-image:-webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, 0))); background-image:-webkit-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-moz-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:-o-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)); background-image:linear-gradient(to bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0)) }
72
- .photomania_module .swiper-container-coverflow .swiper-wrapper { -ms-perspective:1200px }
73
- .photomania_module .swiper-container-fade.swiper-container-free-mode .swiper-slide { -webkit-transition-timing-function:ease-out; -moz-transition-timing-function:ease-out; -ms-transition-timing-function:ease-out; -o-transition-timing-function:ease-out; transition-timing-function:ease-out }
74
- .photomania_module .swiper-container-fade .swiper-slide { pointer-events:none }
75
- .photomania_module .swiper-container-fade .swiper-slide .swiper-slide { pointer-events:none }
76
- .photomania_module .swiper-container-fade .swiper-slide-active,
77
- .photomania_module .swiper-container-fade .swiper-slide-active .swiper-slide-active { pointer-events:auto }
78
- .photomania_module .swiper-container-cube { overflow:visible }
79
- .photomania_module .swiper-container-cube .swiper-slide { pointer-events:none; visibility:hidden; -webkit-transform-origin:0 0; -moz-transform-origin:0 0; -ms-transform-origin:0 0; transform-origin:0 0; -webkit-backface-visibility:hidden; -moz-backface-visibility:hidden; -ms-backface-visibility:hidden; backface-visibility:hidden; width:100%; height:100%; z-index:1 }
80
- .photomania_module .swiper-container-cube.swiper-container-rtl .swiper-slide { -webkit-transform-origin:100% 0; -moz-transform-origin:100% 0; -ms-transform-origin:100% 0; transform-origin:100% 0 }
81
- .photomania_module .swiper-container-cube .swiper-slide-active,
82
- .photomania_module .swiper-container-cube .swiper-slide-next,
83
- .photomania_module .swiper-container-cube .swiper-slide-next + .swiper-slide,
84
- .photomania_module .swiper-container-cube .swiper-slide-prev { pointer-events:auto; visibility:visible }
85
- .photomania_module .swiper-container-cube .swiper-slide-shadow-bottom,
86
- .photomania_module .swiper-container-cube .swiper-slide-shadow-left,
87
- .photomania_module .swiper-container-cube .swiper-slide-shadow-right,
88
- .photomania_module .swiper-container-cube .swiper-slide-shadow-top { z-index:0; -webkit-backface-visibility:hidden; -moz-backface-visibility:hidden; -ms-backface-visibility:hidden; backface-visibility:hidden }
89
- .photomania_module .swiper-container-cube .swiper-cube-shadow { position:absolute; left:0; bottom:0; width:100%; height:100%; background:#000; opacity:.6; -webkit-filter:blur(50px); filter:blur(50px); z-index:0 }
90
- .photomania_module .swiper-scrollbar { border-radius:10px; position:relative; -ms-touch-action:none; background:rgba(0, 0, 0, .1) }
91
- .photomania_module .swiper-container-horizontal > .swiper-scrollbar { position:absolute; left:1%; bottom:3px; z-index:50; height:5px; width:98% }
92
- .photomania_module .swiper-container-vertical > .swiper-scrollbar { position:absolute; right:3px; top:1%; z-index:50; width:5px; height:98% }
93
- .photomania_module .swiper-scrollbar-drag { height:100%; width:100%; position:relative; background:rgba(0, 0, 0, .5); border-radius:10px; left:0; top:0 }
94
- .photomania_module .swiper-scrollbar-cursor-drag { cursor:move }
95
- .photomania_module .swiper-lazy-preloader { width:42px; height:42px; position:absolute; left:50%; top:50%; margin-left:-21px; margin-top:-21px; z-index:10; -webkit-transform-origin:50%; -moz-transform-origin:50%; transform-origin:50%; -webkit-animation:swiper-preloader-spin 1s steps(12, end) infinite; -moz-animation:swiper-preloader-spin 1s steps(12, end) infinite; animation:swiper-preloader-spin 1s steps(12, end) infinite }
96
- .photomania_module .swiper-lazy-preloader:after { display:block; content:""; width:100%; height:100%; background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); background-position:50%; -webkit-background-size:100%; background-size:100%; background-repeat:no-repeat }
97
- .photomania_module .swiper-lazy-preloader-white:after { background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") }
98
- @-webkit-keyframes swiper-preloader-spin {
99
- 100% { -webkit-transform:rotate(360deg) }
100
- }
101
- @keyframes swiper-preloader-spin {
102
- 100% { transform:rotate(360deg) }
103
- }
104
  /** Gallery Styles */
105
- .photomania_module { line-height:1.1; z-index:auto; }
106
  .photomania_module .swiper-lazy-preloader { animation:none; -moz-animation:none; -webkit-animation:none; }
107
- .gmpm_photo_show *:not(.swiper-wrapper) { box-sizing:border-box; }
 
 
108
  .gmpm_photo_show .clear { clear:both; height:0; visibility:hidden; }
109
  .gmpm_photo_show .gmpm_clearfix { display:block; }
110
  .gmpm_photo_show .gmpm_clearfix::after { visibility:hidden; display:block; font-size:0; content:' '; clear:both; height:0; }
111
- .gmpm_photo_show h1,
112
- .gmpm_photo_show h2 { text-rendering:optimizeLegibility; }
113
  .gmpm_photo_show p { text-rendering:optimizeLegibility; }
114
  .gmpm_photo_show a { color:#0099e5; }
115
  .gmpm_photo_show a:hover { color:#02adea; }
 
116
  .gmpm_photo_show .gmpm_photo_header a,
117
- .gmpm_photo_show .gmpm_focus_footer a { text-decoration:none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  .gmpm_va { display:inline-block; width:0; height:100%; vertical-align:middle; }
119
  .gmpm_wrapper { max-width:1180px; margin:0 auto; }
120
  .photomania_module .swiper-lazy { opacity:0;
121
- -webkit-transition:opacity 0.3s ease-in-out;
122
- -moz-transition:opacity 0.3s ease-in-out;
123
- transition:opacity 0.3s ease-in-out;
124
  }
125
  .photomania_module .swiper-lazy.swiper-lazy-loaded { opacity:1; }
126
- .gmpm_button { text-decoration:none; font-size:12px; display:inline-block; width:auto; height:32px; line-height:30px; padding:0 15px; color:#fff; font-weight:bold; border:none; cursor:pointer; outline:none; border-radius:3px; white-space:nowrap;
127
- transition:all 0.15s ease-out 0s; -webkit-transition:all 0.15s ease-out 0s; -webkit-appearance:none; }
128
- .gmpm_button:hover { background:#7d8387; }
129
- .gmpm_button.gmpm_inactive { color:#555; border:1px solid #65696d; background:#71767a; -webkit-box-shadow:rgba(255, 255, 255, 0.2) 0 1px 0 inset; box-shadow:rgba(255, 255, 255, 0.2) 0 1px 0 inset; }
130
- .gmpm_button.gmpm_inactive:hover { background:#7d8387; }
131
- .gmpm_button.btn_green { min-width:70px; border:1px solid #2fab41; -webkit-box-shadow:rgba(255, 255, 255, 0.2) 0px 1px 0px inset; box-shadow:rgba(255, 255, 255, 0.2) 0px 1px 0px inset; background:#34bf49; }
132
- .gmpm_button.btn_green:hover { cursor:pointer; background:#41cb56; }
133
- .gmpm_button.btn_blue { font-weight:bold; border:1px solid #08c; -webkit-box-shadow:rgba(255, 255, 255, 0.2) 0px 1px 0px inset; box-shadow:rgba(255, 255, 255, 0.2) 0px 1px 0px inset; background:#0099e5; }
134
- .gmpm_button.btn_blue:hover { background:#0af; }
135
- .gmpm_photo_show { background-color:white; overflow:hidden; position:relative; z-index:1; }
136
- .gmpm_photo_show .gmpm_photo_wrap { position:static; height:230px; padding:20px 0 10px; margin:0 auto; width:100%; text-align:center; line-height:0; }
137
  .gmedia-template .gmpm_photo_show .gmpm_photo_wrap { padding:20px; }
138
  .gmpm_photo_show:not(.gmpm_focus) .gmpm_photo_wrap { bottom:90px; top:90px;
139
- transition:height 0.4s ease-in-out; -webkit-transition:height 0.4s ease-in-out; -moz-transition:height 0.4s ease-in-out; }
 
 
 
 
 
 
140
  .gmpm_photo_show .gmpm_photo_wrap .swiper-container { height:100%; width:100%; }
141
  .swiper-big-images .gmpm_photo_arrow { display:block; cursor:pointer; position:absolute; z-index:10; height:100%; width:80px; top:0; opacity:1;
142
- transition:0.2s ease-in-out; -webkit-transition:0.2s ease-in-out; }
143
  .swiper-big-images .gmpm_photo_arrow .gmpm_arrow { opacity:0.5; position:absolute; top:50%; left:50%; margin:-35px 0 0 -25px; width:50px; height:60px; border-radius:3px; background:50% 50% no-repeat transparent;
144
- transition:0.2s ease-in-out; -webkit-transition:0.2s ease-in-out; }
145
  .swiper-big-images .gmpm_photo_arrow.gmpm_next { right:0; }
146
  .swiper-big-images .gmpm_photo_arrow.gmpm_next .gmpm_arrow { background-image:url('../img/arrow_next.png'); }
147
  .swiper-big-images .gmpm_photo_arrow.gmpm_prev { left:0; }
@@ -150,58 +59,98 @@
150
  .swiper-big-images .gmpm_photo_arrow.gmpm_prev.swiper-button-disabled { cursor:default; opacity:0.2; }
151
  .has_next_photo .swiper-big-images .gmpm_photo_arrow.gmpm_next:hover .gmpm_arrow,
152
  .has_prev_photo .swiper-big-images .gmpm_photo_arrow.gmpm_prev:hover .gmpm_arrow { opacity:1; background-color:rgba(0, 0, 0, 0.0980392); }
153
- .swiper-big-images img.gmpm_the_photo { max-height:100%; max-width:100%; cursor:pointer; display:inline; width:auto; height:auto; vertical-align:middle; cursor:zoom-in; }
154
- .gmpm_focus .swiper-big-images img.gmpm_the_photo { cursor:zoom-out; }
 
155
  .gmpm_photo_show .gmpm_photo_header { position:static; top:0; border-top:1px solid #f2f3f5; border-bottom:1px solid #f2f3f5; padding-bottom:20px; margin-bottom:20px; }
156
  .gmpm_photo_show.gmpm_focus_maximized .gmpm_photo_header { top:-90px; }
157
  .gmedia-template .gmpm_photo_show .gmpm_photo_header { padding-left:20px; padding-right:20px; }
158
- .gmpm_photo_header .gmpm_name_wrap { float:left; padding-top:20px; max-width:100%; overflow:hidden; white-space:nowrap; }
159
- .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar { margin-right:12px; display:inline-block; text-align:center; line-height:0; position:relative; vertical-align:top; }
160
- .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar a.gmpm_user_avatar_link { display:inline-block; text-decoration:none; }
 
161
  .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar img { height:50px; width:auto; }
162
- .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author { display:inline-block; vertical-align:top; }
163
- .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_title { color:#525558; font-weight:normal; font-size:26px; font-family:Helvetica, Arial, sans-serif; max-width:500px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; margin:2px 0 0; height:1.1em; line-height:1.1; }
164
- .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_author_name { font-size:14px; font-weight:normal; float:left; margin:1px 0 0; }
165
- .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_author_name a { font-size:14px; text-decoration:none; color:#525558; font-weight:bold; font-family:Helvetica, Arial, sans-serif;
166
- transition:all 0.15s ease-out 0s; -webkit-transition:all 0.15s ease-out 0s; }
167
- .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_author_name a:hover { color:#02adea; }
168
- .gmpm_photo_show .gmpm_photo_header .gmpm_actions { float:right; left:0; }
169
- .gmpm_photo_show .gmpm_carousel { position:relative; left:0; z-index:1; float:left; margin:20px 15px 0 0; user-select:none; -webkit-user-select:none; -moz-user-select:none; }
 
 
170
  .gmpm_photo_show .gmpm_carousel .gmpm_previous_button { z-index:1; position:absolute; margin:0; width:25px; height:50px; top:0; cursor:pointer; background:#333; border-radius:3px 0 0 3px;
171
- transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; -webkit-transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; }
172
  .gmpm_photo_show .gmpm_carousel .gmpm_previous_button:hover { cursor:not-allowed; }
173
  .gmpm_photo_show .gmpm_carousel .gmpm_previous_button::before { content:''; position:absolute; top:20px; left:10px; width:0; height:0; border-top:5px solid transparent; border-right:5px solid #666; border-bottom:5px solid transparent; }
174
  .gmpm_photo_show .gmpm_carousel.gmpm_has_previous .gmpm_previous_button { cursor:pointer; background:#525558; }
175
  .gmpm_photo_show .gmpm_carousel.gmpm_has_previous .gmpm_previous_button:hover { opacity:1; background:#71767a; }
176
  .gmpm_photo_show .gmpm_carousel.gmpm_has_previous .gmpm_previous_button::before { border-right:5px solid #fff; }
177
  .gmpm_photo_show .gmpm_carousel .gmpm_next_button { z-index:1; position:absolute; margin:0; width:25px; height:50px; top:0; right:0; cursor:pointer; background:#333; border-radius:0 3px 3px 0;
178
- transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; -webkit-transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; }
179
  .gmpm_photo_show .gmpm_carousel .gmpm_next_button:hover { cursor:not-allowed; }
180
  .gmpm_photo_show .gmpm_carousel .gmpm_next_button::before { content:''; position:absolute; top:20px; right:10px; width:0; height:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:5px solid #666; }
181
  .gmpm_photo_show .gmpm_carousel.gmpm_has_next .gmpm_next_button { cursor:pointer; background:#525558; }
182
  .gmpm_photo_show .gmpm_carousel.gmpm_has_next .gmpm_next_button:hover { opacity:1; background:#71767a; }
183
  .gmpm_photo_show .gmpm_carousel.gmpm_has_next .gmpm_next_button::before { border-left:5px solid #fff; }
184
- .gmpm_photo_show .gmpm_carousel .gmpm_photo_carousel { z-index:90; width:258px; overflow:hidden; position:relative; margin:0 26px; }
185
  .photomania_module .swiper-small-images { width:100%; height:50px; }
186
  .swiper-small-images div.gmpm_photo { position:relative; overflow:hidden; }
187
  .swiper-small-images div.gmpm_photo.swiper-slide-active { border:1px solid #02adea; cursor:default; }
188
  .swiper-small-images img.gmpm_photo { position:absolute; top:-300px; bottom:-300px; left:-300px; right:-300px; margin:auto; max-width:none; max-height:none; }
189
- .swiper-small-images img.gmpm_photo.landscape { width:auto; height:100%; }
190
- .swiper-small-images img.gmpm_photo.portrait { width:100%; height:auto; }
191
  .photomania_module .swiper-small-images .swiper-slide-placeholder { background-color:#292929; }
192
- .gmpm_photo_show .gmpm_big_button_wrap { float:left; }
193
- .gmpm_photo_show .gmpm_big_button { display:table; text-decoration:none; position:relative; width:70px; height:50px; border-radius:3px; border:none; color:white; font-size:12px; font-weight:bold; cursor:pointer; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; margin-top:20px; margin-right:9px; background-color:#0099e5;
194
- animation-duration:0.5s; -webkit-animation-duration:0.5s;
195
- transition:all 0.15s ease-out 0s; -webkit-transition:all 0.15s ease-out 0s; }
196
- .gmpm_photo_show .gmpm_big_button:hover { background:#02adea; }
197
- .gmpm_photo_show .gmpm_big_button.gmpm_inactive { background:#71767a; cursor:not-allowed; opacity:0.6; }
198
- .gmpm_photo_show .gmpm_big_button.gmpm_inactive:hover { background:#7d8387; }
199
  .gmpm_photo_show .gmpm_big_button .gmpm_label { display:block; position:absolute; bottom:7px; width:100%; text-align:center; font-size:11px; font-family:Helvetica, Arial, sans-serif; color:#ffffff; }
200
  .gmpm_photo_show .gmpm_big_button .gmpm_icon { display:block; position:relative; top:1px; width:20px; height:21px; margin:6px auto; text-align:center; background-repeat:no-repeat; background-size:cover; -webkit-background-size:cover; }
201
  .gmpm_photo_show .gmpm_big_button.gmpm_download_button .gmpm_icon { background-image:url('../img/download@2x.png'); }
202
  .gmpm_photo_show .gmpm_big_button.gmpm_link_button { margin-right:0; }
203
  .gmpm_photo_show .gmpm_big_button.gmpm_link_button .gmpm_icon { background-image:url('../img/open_link@2x.png'); }
204
- .gmpm_focus_actions { display:none; -webkit-user-select:none; float:right; margin:20px 40px 0 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  .gmpm_focus_actions ul { display:block; float:left; margin:0 0 0 10px; padding:0; list-style:none; }
206
  .gmpm_focus_actions ul:first-child { margin-left:0; }
207
  .gmpm_focus_actions ul:first-child li:first-child { margin-left:0; }
@@ -209,79 +158,137 @@
209
  .gmpm_focus_actions ul li ul { display:none; float:left; }
210
  .gmpm_focus_actions ul li ul:hover { display:block; }
211
  .gmpm_focus_actions ul li ul li { margin-left:0; }
212
- .gmpm_focus_actions ul .gmpm_button { color:white; display:block; line-height:0; width:50px; height:50px; border-radius:3px; text-indent:-9999px; overflow:hidden; cursor:pointer; border:none; background:50% 50% no-repeat rgba(255, 255, 255, 0.14902);
213
- transition:background-color 0.1s ease-in-out; -webkit-transition:background-color 0.1s ease-in-out; }
 
214
  .gmpm_focus_actions ul .gmpm_button:hover { background-color:rgba(255, 255, 255, 0.2); }
215
  .gmpm_focus_actions ul .gmpm_button.swiper-button-disabled { cursor:default; opacity:0.6; }
216
- .gmpm_focus_actions ul .gmpm_button.gmpm_like { -webkit-background-size:22px; background-image:url('../img/like@2x.png'); background-size:22px 22px; }
217
- .gmpm_focus_actions ul .gmpm_button.gmpm_like.gmpm_liked { background-color:#02adea; }
218
- .gmpm_focus_actions ul .gmpm_button.gmpm_prev { -webkit-background-size:11px; background-image:url('../img/prev@2x.png'); background-size:11px 11px; }
219
- .gmpm_focus_actions ul .gmpm_button.gmpm_next { -webkit-background-size:11px; background-image:url('../img/next@2x.png'); background-size:11px 11px; }
220
- .gmpm_focus_actions ul .gmpm_button.gmpm_full { -webkit-background-size:12px; background-image:url('../img/full@2x.png'); background-size:12px 12px; }
221
- .gmpm_focus_actions ul .gmpm_button.gmpm_close { -webkit-background-size:8px; background-image:url('../img/close@2x.png'); background-size:8px 8px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  .gmpm_focus_actions .gmpm_focus_arrows li { margin-left:1px; }
223
  .gmpm_focus_actions .gmpm_focus_arrows li .gmpm_button { width:40px; }
224
  .gmpm_focus_actions .gmpm_focus_arrows li:first-child .gmpm_button { border-radius:3px 0 0 3px; }
225
  .gmpm_focus_actions .gmpm_focus_arrows li:last-child .gmpm_button { border-radius:0 3px 3px 0; }
226
- .gmpm_focus_actions .gmpm_focus_close_full li { margin-left:1px; float:none; }
227
- .gmpm_focus_actions .gmpm_focus_close_full li .gmpm_button { width:30px; }
228
- .gmpm_focus_actions .gmpm_focus_close_full li .gmpm_button.gmpm_close { height:25px; border-radius:3px 3px 0 0; }
229
- .gmpm_focus_actions .gmpm_focus_close_full li .gmpm_button.gmpm_full { border-top:1px solid #000; height:24px; border-radius:0 0 3px 3px; }
230
  .gmpm_photo_details { color:#71767a; padding:0 0 40px; overflow-x:hidden; }
231
  .gmedia-template .gmpm_photo_details { padding-left:20px; padding-right:20px; }
232
- .gmpm_photo_details h2 { margin:0; padding:0; color:#71767a; text-transform:uppercase; font-size:14px; line-height:14px; font-weight:bold; height:14px; display:inline-block; overflow:visible; border:none; }
233
  .gmpm_photo_details p { margin:0 0 7px; padding:0; }
234
- .gmpm_description_wrap { float:left; overflow:hidden; width:100%; padding-right:350px; margin-right:-330px; }
235
- .gmpm_description_wrap .gmpm_description_text_wrap { position:relative; }
236
- .gmpm_description_wrap .gmpm_slide_description { color:#525558; font-size:14px; line-height:20px; font-weight:normal; overflow:hidden; margin-top:14px; }
237
- .gmpm_description_wrap .gmpm_slide_description:empty { display:none; }
 
238
  .gmpm_focus_footer { height:0; position:absolute; bottom:0; width:100%; z-index:10; overflow:hidden; }
239
  .gmpm_focus_footer .gmpm_focus_keyboard { width:100%; text-align:center; margin-bottom:-90px; padding:0; opacity:0; font-family:Helvetica, Arial, sans-serif;
240
- transition:all 0.6s ease-in-out; -webkit-transition:all 0.6s ease-in-out; }
241
  .gmpm_photo_show.gmpm_diskeys .gmpm_focus_footer .gmpm_focus_keyboard,
242
  .gmpm_photo_show.gmpm_focus.gmpm_diskeys .gmpm_focus_footer .gmpm_focus_keyboard { margin-bottom:-90px; opacity:0; display:none; }
243
- .gmpm_focus_keyboard h6 { font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#404243; font-weight:bold; padding:0 0 15px; margin:0; transition:padding 0.2s ease-in-out; -webkit-transition:padding 0.2s ease-in-out; border:none; }
244
- .gmpm_focus_keyboard h6 a { text-transform:uppercase; color:black; border-radius:2px; font-size:10px; padding:2px 4px 0; margin:-1px 0 0 4px; cursor:pointer; background-color:#404243; display:inline-block;
245
- transition:all 0.1s ease-in-out; -webkit-transition:all 0.1s ease-in-out; }
246
- .gmpm_focus_keyboard h6 a:hover { background-color:#525558; color:black; }
247
  .gmpm_focus_keyboard ul { font-size:0; margin:0; padding:0; list-style:none; }
248
- .gmpm_focus_keyboard ul li { display:inline-block; margin:0; padding:0; list-style:none; }
249
  .gmpm_focus_keyboard ul li:last-child .gmpm_label { padding-right:0; }
250
  .gmpm_focus_keyboard ul .gmpm_key { display:inline-block; font-size:12px; width:22px; height:22px; border-radius:3px; text-align:center; line-height:22px; color:white; border:1px solid #000; position:relative; background:50% 50% no-repeat #404243;
251
- box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset, rgba(255, 255, 255, 0.14902) 0 0 1px 1px; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset, rgba(255, 255, 255, 0.14902) 0 0 1px 1px; }
252
  .gmpm_focus_keyboard ul .gmpm_key[data-key="right"]::before { content:''; position:absolute; top:6px; right:7px; width:0; height:0; border-top:4px solid transparent; border-bottom:4px solid transparent; border-left:6px solid #fff; }
253
  .gmpm_focus_keyboard ul .gmpm_key[data-key="left"]::before { content:''; position:absolute; top:6px; left:7px; width:0; height:0; border-top:4px solid transparent; border-right:6px solid #fff; border-bottom:4px solid transparent; }
254
  .gmpm_focus_keyboard ul .gmpm_key.gmpm_esc { font-size:11px; line-height:19px; position:relative; top:-2px; }
255
  .gmpm_focus_keyboard ul .gmpm_label { font-size:12px; display:inline-block; padding:0 20px 0 8px; color:white; }
256
- .gmpm_photo_show.gmpm_focus { background:black none repeat scroll 0 0; bottom:0; height:100%; left:0; min-width:320px; overflow:hidden; position:fixed; right:0; top:0; width:100%; z-index:100000; }
 
257
  .gmpm_photo_show.gmpm_focus .gmpm_wrapper { max-width:none; }
 
258
  .gmpm_photo_show.gmpm_focus .gmpm_photo_wrap { bottom:90px; left:20px; position:absolute; right:20px; top:90px; z-index:20; padding:0; width:auto; height:auto !important;
259
- transition:bottom 0.4s ease-in-out, top 0.4s ease-in-out; -webkit-transition:bottom 0.4s ease-in-out, top 0.4s ease-in-out; -moz-transition:bottom 0.4s ease-in-out, top 0.4s ease-in-out;
260
  }
261
  .gmpm_photo_show.gmpm_diskeys .gmpm_photo_wrap { bottom:20px; }
262
  .gmpm_photo_show.gmpm_focus_maximized .gmpm_photo_wrap { top:20px; bottom:20px; }
263
- .gmpm_photo_show.gmpm_focus .gmpm_photo_header { height:90px; min-width:1240px; position:absolute; top:0; width:100%; z-index:10; border:none; margin:0; padding:0; opacity:1; overflow:hidden;
264
- transition:top 0.6s ease-in-out, opacity 0.6s ease-in-out; -webkit-transition:top 0.6s ease-in-out, opacity 0.6s ease-in-out; }
265
  .gmpm_photo_show.gmpm_focus.gmpm_focus_maximized .gmpm_photo_header { top:-90px; opacity:0; }
266
- .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap { float:left; margin:20px 0 0 40px; padding:0; }
 
267
  .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap .gmpm_title { color:#fff; }
268
- .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap .gmpm_author_name a { color:#ccc; }
269
- .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap .gmpm_author_name a:hover { color:#eee; }
270
  .gmpm_photo_show.gmpm_focus .gmpm_focus_actions { display:block; }
 
271
  .gmpm_photo_show.gmpm_focus .gmpm_actions { visibility:hidden; position:absolute; margin-left:-100%; z-index:-1; pointer-events:none; }
272
  .gmpm_photo_show.gmpm_focus .gmpm_photo_details { display:none; }
273
  .gmpm_photo_show.gmpm_focus .gmpm_photo_arrow { display:none; }
274
  .gmpm_photo_show.gmpm_focus .gmpm_focus_footer { height:auto; }
275
  .gmpm_photo_show.gmpm_focus .gmpm_focus_footer .gmpm_focus_keyboard { margin-bottom:20px; height:auto; padding-top:1px; opacity:1; }
276
  .gmpm_photo_show.gmpm_focus.gmpm_focus_maximized .gmpm_focus_footer .gmpm_focus_keyboard { margin-bottom:-90px; opacity:0; }
277
- .gmpm_photo_show.w800 .gmpm_photo_details .gmpm_description_wrap { float:none; padding:0; margin:0; }
278
- .gmpm_photo_show.w480 .gmpm_photo_show .gmpm_carousel { visibility:hidden; position:absolute; margin-left:-100%; z-index:-1; pointer-events:none; }
279
- .gmpm_photo_show.w480 .gmpm_photo_show .gmpm_big_button.gmpm_download_button { display:none; }
280
- .gmpm_photo_details.no-details-tab .gmpm_description_wrap { float:none; padding:0; margin:0; }
281
- .gmpm_photo_details.no-slide-description { display:none; }
282
  .gmpm_no-transition,
283
  .gmpm_no-transition > div {
284
- -webkit-transition:none !important;
285
- -moz-transition:none !important;
286
- transition:none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /** Gallery Styles */
2
+ .photomania_module { position:relative; z-index:auto; line-height:1.1; }
3
  .photomania_module .swiper-lazy-preloader { animation:none; -moz-animation:none; -webkit-animation:none; }
4
+ .gmpm_photo_show *:not(.swiper-wrapper),
5
+ .gmpm_photo_show :before,
6
+ .gmpm_photo_show :after { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
7
  .gmpm_photo_show .clear { clear:both; height:0; visibility:hidden; }
8
  .gmpm_photo_show .gmpm_clearfix { display:block; }
9
  .gmpm_photo_show .gmpm_clearfix::after { visibility:hidden; display:block; font-size:0; content:' '; clear:both; height:0; }
 
 
10
  .gmpm_photo_show p { text-rendering:optimizeLegibility; }
11
  .gmpm_photo_show a { color:#0099e5; }
12
  .gmpm_photo_show a:hover { color:#02adea; }
13
+ .gmpm_photo_show a:visited { color:HyperlinkText; }
14
  .gmpm_photo_show .gmpm_photo_header a,
15
+ .gmpm_photo_show .gmpm_focus_footer a { text-decoration:none; box-shadow:none; }
16
+ .gmpm_photo_show { opacity:1;
17
+ -webkit-transition:opacity 0.4s ease-in;
18
+ -moz-transition:opacity 0.4s ease-in;
19
+ -ms-transition:opacity 0.4s ease-in;
20
+ -o-transition:opacity 0.4s ease-in;
21
+ transition:opacity 0.4s ease-in;
22
+ }
23
+ .gmpm_photo_show.gmpm_focus {
24
+ -webkit-transition:opacity 0.1s ease-in;
25
+ -moz-transition:opacity 0.1s ease-in;
26
+ -ms-transition:opacity 0.1s ease-in;
27
+ -o-transition:opacity 0.1s ease-in;
28
+ transition:opacity 0.1s ease-in;
29
+ }
30
  .gmpm_va { display:inline-block; width:0; height:100%; vertical-align:middle; }
31
  .gmpm_wrapper { max-width:1180px; margin:0 auto; }
32
  .photomania_module .swiper-lazy { opacity:0;
33
+ -webkit-transition:opacity 0.3s ease-in-out;
34
+ -moz-transition:opacity 0.3s ease-in-out;
35
+ transition:opacity 0.3s ease-in-out;
36
  }
37
  .photomania_module .swiper-lazy.swiper-lazy-loaded { opacity:1; }
38
+ .gmpm_photo_show { overflow:hidden; position:relative; z-index:1; }
39
+ .gmpm_photo_show .gmpm_photo_wrap { position:static; height:400px; padding:20px 0 10px; margin:0 auto; width:100%; text-align:center; line-height:0; }
 
 
 
 
 
 
 
 
 
40
  .gmedia-template .gmpm_photo_show .gmpm_photo_wrap { padding:20px; }
41
  .gmpm_photo_show:not(.gmpm_focus) .gmpm_photo_wrap { bottom:90px; top:90px;
42
+ transition:height 0.4s ease-in-out; -webkit-transition:height 0.4s ease-in-out; -moz-transition:height 0.4s ease-in-out; }
43
+ .gmpm_preload .gmpm_photo_wrap, .gmpm_prepare .gmpm_photo_wrap {
44
+ -webkit-transition:none !important;
45
+ -moz-transition:none !important;
46
+ -ms-transition:none !important;
47
+ -o-transition:none !important;
48
+ }
49
  .gmpm_photo_show .gmpm_photo_wrap .swiper-container { height:100%; width:100%; }
50
  .swiper-big-images .gmpm_photo_arrow { display:block; cursor:pointer; position:absolute; z-index:10; height:100%; width:80px; top:0; opacity:1;
51
+ transition:0.2s ease-in-out; -webkit-transition:0.2s ease-in-out; }
52
  .swiper-big-images .gmpm_photo_arrow .gmpm_arrow { opacity:0.5; position:absolute; top:50%; left:50%; margin:-35px 0 0 -25px; width:50px; height:60px; border-radius:3px; background:50% 50% no-repeat transparent;
53
+ transition:0.2s ease-in-out; -webkit-transition:0.2s ease-in-out; }
54
  .swiper-big-images .gmpm_photo_arrow.gmpm_next { right:0; }
55
  .swiper-big-images .gmpm_photo_arrow.gmpm_next .gmpm_arrow { background-image:url('../img/arrow_next.png'); }
56
  .swiper-big-images .gmpm_photo_arrow.gmpm_prev { left:0; }
59
  .swiper-big-images .gmpm_photo_arrow.gmpm_prev.swiper-button-disabled { cursor:default; opacity:0.2; }
60
  .has_next_photo .swiper-big-images .gmpm_photo_arrow.gmpm_next:hover .gmpm_arrow,
61
  .has_prev_photo .swiper-big-images .gmpm_photo_arrow.gmpm_prev:hover .gmpm_arrow { opacity:1; background-color:rgba(0, 0, 0, 0.0980392); }
62
+ .swiper-big-images img.gmpm_the_photo { max-height:100%; max-width:100%; display:inline; width:auto; height:auto; object-fit:unset; vertical-align:middle; cursor:zoom-in; border:none; }
63
+ .gmpm_focus .swiper-big-images img.gmpm_the_photo { cursor:zoom-out; width:auto; height:auto; object-fit:unset; }
64
+
65
  .gmpm_photo_show .gmpm_photo_header { position:static; top:0; border-top:1px solid #f2f3f5; border-bottom:1px solid #f2f3f5; padding-bottom:20px; margin-bottom:20px; }
66
  .gmpm_photo_show.gmpm_focus_maximized .gmpm_photo_header { top:-90px; }
67
  .gmedia-template .gmpm_photo_show .gmpm_photo_header { padding-left:20px; padding-right:20px; }
68
+ .gmpm_photo_header .gmpm_name_wrap { float:left; padding:20px 0 2px 62px; max-width:100%; overflow:hidden; white-space:nowrap; position:relative; }
69
+ .gmpm_photo_header .gmpm_name_wrap.gmpm_no_avatar { padding-left:0; }
70
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar { position:absolute; top:20px; left:0; }
71
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar a.gmpm_user_avatar_link { display:block; text-decoration:none; }
72
  .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar img { height:50px; width:auto; }
73
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author { display:inline-block; vertical-align:top; font-size:10px; max-width:100%; }
74
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_title { text-rendering:auto; color:#525558; font-weight:normal; font-size:260%; width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; margin:0; padding:1px 0; height:1.1em; font-family:Helvetica, Arial, sans-serif; line-height:1; box-sizing:content-box; text-transform:none; }
75
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author > div { font-size:140%; }
76
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_author_name { font-weight:normal; float:left; margin:1px 0 0; padding:2px 0 0; }
77
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author a { font-size:inherit; text-decoration:none; color:#525558; font-weight:bold; font-family:Helvetica, Arial, sans-serif;
78
+ transition:all 0.15s ease-out 0s; -webkit-transition:all 0.15s ease-out 0s; }
79
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author a:hover { color:#02adea; }
80
+
81
+ .gmpm_photo_show .gmpm_photo_header .gmpm_actions { float:right; }
82
+ .gmpm_photo_show .gmpm_carousel { position:relative; z-index:1; float:left; margin:20px 6px 0 0; user-select:none; -webkit-user-select:none; -moz-user-select:none; }
83
  .gmpm_photo_show .gmpm_carousel .gmpm_previous_button { z-index:1; position:absolute; margin:0; width:25px; height:50px; top:0; cursor:pointer; background:#333; border-radius:3px 0 0 3px;
84
+ transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; -webkit-transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; }
85
  .gmpm_photo_show .gmpm_carousel .gmpm_previous_button:hover { cursor:not-allowed; }
86
  .gmpm_photo_show .gmpm_carousel .gmpm_previous_button::before { content:''; position:absolute; top:20px; left:10px; width:0; height:0; border-top:5px solid transparent; border-right:5px solid #666; border-bottom:5px solid transparent; }
87
  .gmpm_photo_show .gmpm_carousel.gmpm_has_previous .gmpm_previous_button { cursor:pointer; background:#525558; }
88
  .gmpm_photo_show .gmpm_carousel.gmpm_has_previous .gmpm_previous_button:hover { opacity:1; background:#71767a; }
89
  .gmpm_photo_show .gmpm_carousel.gmpm_has_previous .gmpm_previous_button::before { border-right:5px solid #fff; }
90
  .gmpm_photo_show .gmpm_carousel .gmpm_next_button { z-index:1; position:absolute; margin:0; width:25px; height:50px; top:0; right:0; cursor:pointer; background:#333; border-radius:0 3px 3px 0;
91
+ transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; -webkit-transition:opacity 0.2s ease-in-out, background-color 0.15s ease-in-out; }
92
  .gmpm_photo_show .gmpm_carousel .gmpm_next_button:hover { cursor:not-allowed; }
93
  .gmpm_photo_show .gmpm_carousel .gmpm_next_button::before { content:''; position:absolute; top:20px; right:10px; width:0; height:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:5px solid #666; }
94
  .gmpm_photo_show .gmpm_carousel.gmpm_has_next .gmpm_next_button { cursor:pointer; background:#525558; }
95
  .gmpm_photo_show .gmpm_carousel.gmpm_has_next .gmpm_next_button:hover { opacity:1; background:#71767a; }
96
  .gmpm_photo_show .gmpm_carousel.gmpm_has_next .gmpm_next_button::before { border-left:5px solid #fff; }
97
+ .gmpm_photo_show .gmpm_carousel .gmpm_photo_carousel { z-index:90; width:206px; overflow:hidden; position:relative; margin:0 26px; }
98
  .photomania_module .swiper-small-images { width:100%; height:50px; }
99
  .swiper-small-images div.gmpm_photo { position:relative; overflow:hidden; }
100
  .swiper-small-images div.gmpm_photo.swiper-slide-active { border:1px solid #02adea; cursor:default; }
101
  .swiper-small-images img.gmpm_photo { position:absolute; top:-300px; bottom:-300px; left:-300px; right:-300px; margin:auto; max-width:none; max-height:none; }
102
+ .swiper-small-images img.gmpm_photo.gmpm_photo_landscape { width:auto; height:100%; }
103
+ .swiper-small-images img.gmpm_photo.gmpm_photo_portrait { width:100%; height:auto; }
104
  .photomania_module .swiper-small-images .swiper-slide-placeholder { background-color:#292929; }
105
+ .gmpm_photo_show .gmpm_big_button_wrap { position:relative; float:left; margin-top:20px; margin-left:9px; }
106
+ .gmpm_photo_show .gmpm_big_button { display:table; text-decoration:none; position:relative; width:70px; height:50px; border-radius:3px; border:none; color:white; font-size:12px; font-weight:bold; cursor:pointer; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; background-color:#0099e5;
107
+ animation-duration:0.5s; -webkit-animation-duration:0.5s;
108
+ transition:all 0.15s ease-out 0s; -webkit-transition:all 0.15s ease-out 0s; }
109
+ .gmpm_photo_show .gmpm_big_button:hover { background-color:#02adea; }
110
+ .gmpm_photo_show .gmpm_big_button.gmpm_inactive { background-color:#71767a; cursor:not-allowed; opacity:0.6; }
111
+ .gmpm_photo_show .gmpm_big_button.gmpm_inactive:hover { background-color:#7d8387; }
112
  .gmpm_photo_show .gmpm_big_button .gmpm_label { display:block; position:absolute; bottom:7px; width:100%; text-align:center; font-size:11px; font-family:Helvetica, Arial, sans-serif; color:#ffffff; }
113
  .gmpm_photo_show .gmpm_big_button .gmpm_icon { display:block; position:relative; top:1px; width:20px; height:21px; margin:6px auto; text-align:center; background-repeat:no-repeat; background-size:cover; -webkit-background-size:cover; }
114
  .gmpm_photo_show .gmpm_big_button.gmpm_download_button .gmpm_icon { background-image:url('../img/download@2x.png'); }
115
  .gmpm_photo_show .gmpm_big_button.gmpm_link_button { margin-right:0; }
116
  .gmpm_photo_show .gmpm_big_button.gmpm_link_button .gmpm_icon { background-image:url('../img/open_link@2x.png'); }
117
+ .gmpm_big_button_wrap .gmpm_button { display:inline-block; background-color:#525558; text-decoration:none; border-radius:3px; border:none; color:white; font-size:12px; font-weight:bold; cursor:pointer; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset; background-repeat:no-repeat;
118
+ animation-duration:0.5s; -webkit-animation-duration:0.5s;
119
+ transition:background 0.15s ease-out 0s; -webkit-transition:background 0.15s ease-out 0s;
120
+ }
121
+ .gmpm_big_button_wrap .gmpm_comments_button .gmpm_count_icon { display: block; text-align: center; line-height: 210%; font-size: 160%; color:#ffffff; }
122
+ .gmpm_big_button_wrap .gmpm_comments_button .gmpm_comments_count { font-size: 70%; font-weight: 300; vertical-align: bottom; }
123
+ .gmpm_big_button_wrap .gmpm_comments_button .gmpm_comments_icon { display:inline-block; }
124
+ .gmpm_big_button_wrap svg { display:block; width:1em; height:1em; fill:currentColor; }
125
+ .gmpm_big_button_wrap .gmpm_button:hover { background-color:#71767a; }
126
+ .gmpm_big_button_wrap .gmpm_button.gmpm_share { display:block; width:35px; height:24px; text-indent:-999px; overflow:hidden; background-image:url('../img/share@2x.png'); background-position:50% 50%; background-size:18px 18px; -webkit-background-size:18px; }
127
+ .gmpm_big_button_wrap.gmpm_one_button .gmpm_button.gmpm_share { height:50px; }
128
+ .gmpm_big_button_wrap .gmpm_share_opened .gmpm_button.gmpm_share { background-color:#71767a; }
129
+ .gmpm_big_button_wrap .gmpm_button.gmpm_like { display:block; margin-top:2px; width:35px; height:24px; text-indent:-999px; overflow:hidden; background-image:url('../img/like@2x.png'); background-position:50% 50%; background-size:16px 16px; -webkit-background-size:16px; }
130
+ .gmpm_big_button_wrap.gmpm_one_button .gmpm_button.gmpm_like { height:50px; margin-top:0; }
131
+ .gmpm_big_button_wrap .gmpm_button.gmpm_like.gmpm_liked,
132
+ .gmpm_big_button_wrap .gmpm_button.gmpm_like.gmpm_liked:hover { background-color:#02adea; }
133
+ .gmpm_big_button_wrap .gmpm_sharelizers_wrap { position:absolute; right:0; bottom:100%; z-index:10; display:none; padding-bottom:10px; }
134
+ .gmpm_big_button_wrap .gmpm_sharelizers { background-color:#fff; border:1px solid #aaa; border-radius:3px; position:relative; list-style:none; margin:0; padding:0; }
135
+ .gmpm_big_button_wrap .gmpm_sharelizers li { border-top:1px solid #aaa; margin:0; padding:0; }
136
+ .gmpm_big_button_wrap ul.gmpm_sharelizers li:first-child { border-top-style:none; }
137
+ .gmpm_big_button_wrap .gmpm_sharelizers .gmpm_button { background-color:#71767a!important; background-position:7px 50%!important; background-repeat:no-repeat!important; background-size:16px auto!important; border-radius:0; display:block; padding:7px 7px 7px 30px !important; }
138
+ .gmpm_big_button_wrap .gmpm_sharelizers .gmpm_button:hover { color:#fff; }
139
+ .gmpm_big_button_wrap ul .gmpm_facebook { background:#262626 url('../img/facebook@2x.png')!important; background-size:22px 22px!important; }
140
+ .gmpm_big_button_wrap ul .gmpm_facebook:hover { background-color:#3b5998!important; }
141
+ .gmpm_big_button_wrap ul .gmpm_twitter { background:#262626 url('../img/twitter@2x.png')!important; background-size:22px 22px!important; }
142
+ .gmpm_big_button_wrap ul .gmpm_twitter:hover { background-color:#00aced!important; }
143
+ .gmpm_big_button_wrap ul .gmpm_pinterest { background:#262626 url('../img/pinterest@2x.png')!important; background-size:22px 22px!important; }
144
+ .gmpm_big_button_wrap ul .gmpm_pinterest:hover { background-color:#cc2127!important; }
145
+ .gmpm_big_button_wrap ul .gmpm_google { background:#262626 url('../img/google@2x.png')!important; background-size:22px 22px!important; }
146
+ .gmpm_big_button_wrap ul .gmpm_google:hover { background-color:#d64a2d!important; }
147
+ .gmpm_big_button_wrap ul .gmpm_stumbleupon { background:#262626 url('../img/stumbleupon@2x.png')!important; background-size:22px 22px!important; }
148
+ .gmpm_big_button_wrap ul .gmpm_stumbleupon:hover { background-color:#ea4b24!important; }
149
+ .gmpm_big_button_wrap .gmpm_sharelizers:before { position:absolute; z-index:1; top:100%; right:9px; border-top:10px solid #aaa; border-left:10px solid transparent; border-right:10px solid transparent; content:""; display:block; }
150
+ .gmpm_big_button_wrap .gmpm_sharelizers:after { position:absolute; z-index:2; top:100%; right:10px; border-top:9px solid #71767a; border-left:9px solid transparent; border-right:9px solid transparent; content:""; display:block; }
151
+ .gmpm_big_button_wrap .gmpm_share_opened .gmpm_sharelizers_wrap { display:block; }
152
+
153
+ .gmpm_focus_actions { display:none; position:relative; z-index:1; -webkit-user-select:none; float:right; margin:20px 40px 0 0; padding-right:41px; }
154
  .gmpm_focus_actions ul { display:block; float:left; margin:0 0 0 10px; padding:0; list-style:none; }
155
  .gmpm_focus_actions ul:first-child { margin-left:0; }
156
  .gmpm_focus_actions ul:first-child li:first-child { margin-left:0; }
158
  .gmpm_focus_actions ul li ul { display:none; float:left; }
159
  .gmpm_focus_actions ul li ul:hover { display:block; }
160
  .gmpm_focus_actions ul li ul li { margin-left:0; }
161
+ .gmpm_focus_actions ul .gmpm_button,
162
+ .gmpm_focus_close_full .gmpm_button { color:white; display:block; line-height:0; width:50px; height:50px; border-radius:3px; text-indent:-9999px; overflow:hidden; cursor:pointer; border:none; background:50% 50% no-repeat rgba(255, 255, 255, 0.14902);
163
+ transition:background-color 0.1s ease-in-out; -webkit-transition:background-color 0.1s ease-in-out; }
164
  .gmpm_focus_actions ul .gmpm_button:hover { background-color:rgba(255, 255, 255, 0.2); }
165
  .gmpm_focus_actions ul .gmpm_button.swiper-button-disabled { cursor:default; opacity:0.6; }
166
+ .gmpm_focus_actions ul .gmpm_button.gmpm_share { -webkit-background-size:26px!important; background-image:url('../img/share@2x.png')!important; background-size:26px 26px!important; background-position:14px 50%!important; }
167
+ .gmpm_focus_actions ul .gmpm_share_opened .gmpm_button.gmpm_share { background-color:rgba(255, 255, 255, 0.2)!important; }
168
+ .gmpm_focus_actions ul .gmpm_button.gmpm_like { -webkit-background-size:22px!important; background-image:url('../img/like@2x.png')!important; background-size:22px 22px!important; }
169
+ .gmpm_focus_actions ul .gmpm_button.gmpm_like.gmpm_liked { background-color:#02adea!important; }
170
+ .gmpm_focus_actions ul .gmpm_button.gmpm_prev { -webkit-background-size:11px!important; background-image:url('../img/prev@2x.png')!important; background-size:11px 11px!important; }
171
+ .gmpm_focus_actions ul .gmpm_button.gmpm_next { -webkit-background-size:11px!important; background-image:url('../img/next@2x.png')!important; background-size:11px 11px!important; }
172
+ .gmpm_focus_close_full .gmpm_button.gmpm_full { -webkit-background-size:12px!important; background-image:url('../img/full@2x.png')!important; background-size:12px 12px!important; }
173
+ .gmpm_focus_close_full .gmpm_button.gmpm_close { -webkit-background-size:8px!important; background-image:url('../img/close@2x.png')!important; background-size:8px 8px!important; }
174
+ .gmpm_focus_actions .gmpm_focus_share .gmpm_sharelizers { position:absolute; right:51px; width:254px; display:none; }
175
+ .gmpm_focus_actions .gmpm_focus_share .gmpm_sharelizers li { border-left:1px solid #000; }
176
+ .gmpm_focus_actions .gmpm_focus_share .gmpm_sharelizers li:first-child { border-left-style:none; }
177
+ .gmpm_focus_actions ul .gmpm_facebook { background:#262626 url('../img/facebook@2x.png'); background-size:22px 22px; }
178
+ .gmpm_focus_actions ul .gmpm_facebook:hover { background-color:#3b5998; }
179
+ .gmpm_focus_actions ul .gmpm_twitter { background:#262626 url('../img/twitter@2x.png'); background-size:22px 22px; }
180
+ .gmpm_focus_actions ul .gmpm_twitter:hover { background-color:#00aced; }
181
+ .gmpm_focus_actions ul .gmpm_pinterest { background:#262626 url('../img/pinterest@2x.png'); background-size:22px 22px; }
182
+ .gmpm_focus_actions ul .gmpm_pinterest:hover { background-color:#cc2127; }
183
+ .gmpm_focus_actions ul .gmpm_google { background:#262626 url('../img/google@2x.png'); background-size:22px 22px; }
184
+ .gmpm_focus_actions ul .gmpm_google:hover { background-color:#d64a2d; }
185
+ .gmpm_focus_actions ul .gmpm_stumbleupon { background:#262626 url('../img/stumbleupon@2x.png'); background-size:22px 22px; }
186
+ .gmpm_focus_actions ul .gmpm_stumbleupon:hover { background-color:#ea4b24; }
187
+ .gmpm_focus_actions .gmpm_focus_share .gmpm_sharelizers .gmpm_button { background-repeat:no-repeat; background-position:center center; }
188
+ .gmpm_focus_actions .gmpm_share_opened .gmpm_share { border-radius:0 3px 3px 0; float:right; border-left:1px solid #000; width:51px;
189
+ transition:none 0.1s ease-in-out; -webkit-transition:none 0.1s ease-in-out;
190
+ }
191
+ .gmpm_focus_actions .gmpm_share_opened .gmpm_share + ul { display:block; }
192
+ .gmpm_focus_actions .gmpm_share_opened .gmpm_share + ul li:first-child .gmpm_button { border-radius:3px 0 0 3px; }
193
+ .gmpm_focus_actions ul li ul li .gmpm_button { border-radius:0; }
194
  .gmpm_focus_actions .gmpm_focus_arrows li { margin-left:1px; }
195
  .gmpm_focus_actions .gmpm_focus_arrows li .gmpm_button { width:40px; }
196
  .gmpm_focus_actions .gmpm_focus_arrows li:first-child .gmpm_button { border-radius:3px 0 0 3px; }
197
  .gmpm_focus_actions .gmpm_focus_arrows li:last-child .gmpm_button { border-radius:0 3px 3px 0; }
198
+ .gmpm_photo_show .gmpm_focus_close_full { display:none; position:absolute; z-index:20; right:40px; top:20px; }
199
+ .gmpm_photo_show .gmpm_focus_close_full .gmpm_button { width:30px; }
200
+ .gmpm_photo_show .gmpm_focus_close_full .gmpm_button.gmpm_close { height:25px; border-radius:3px 3px 0 0; }
201
+ .gmpm_photo_show .gmpm_focus_close_full .gmpm_button.gmpm_full { border-top:1px solid #000; height:25px; border-radius:0 0 3px 3px; }
202
  .gmpm_photo_details { color:#71767a; padding:0 0 40px; overflow-x:hidden; }
203
  .gmedia-template .gmpm_photo_details { padding-left:20px; padding-right:20px; }
204
+ .gmpm_photo_details .details_title { margin:0; padding:0; color:#71767a; text-transform:uppercase; font-size:14px; line-height:14px; font-weight:bold; height:14px; display:inline-block; overflow:visible; border:none; }
205
  .gmpm_photo_details p { margin:0 0 7px; padding:0; }
206
+ .gmpm_description_wrap { overflow:hidden; max-width:100%; margin-bottom:10px; }
207
+ .gmpm_description_wrap .gmpm_description_text_wrap { position:relative; color:#525558; font-size:14px; line-height:20px; font-weight:normal; overflow:hidden; margin-top:14px; }
208
+ .gmpm_description_wrap .gmpm_hidden { display:none; }
209
+ .gmpm_description_wrap.empty-item-description { display:none; }
210
+
211
  .gmpm_focus_footer { height:0; position:absolute; bottom:0; width:100%; z-index:10; overflow:hidden; }
212
  .gmpm_focus_footer .gmpm_focus_keyboard { width:100%; text-align:center; margin-bottom:-90px; padding:0; opacity:0; font-family:Helvetica, Arial, sans-serif;
213
+ transition:all 0.6s ease-in-out; -webkit-transition:all 0.6s ease-in-out; }
214
  .gmpm_photo_show.gmpm_diskeys .gmpm_focus_footer .gmpm_focus_keyboard,
215
  .gmpm_photo_show.gmpm_focus.gmpm_diskeys .gmpm_focus_footer .gmpm_focus_keyboard { margin-bottom:-90px; opacity:0; display:none; }
216
+ .gmpm_focus_keyboard .gmpm_focus_keyboard_title { font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#404243; font-weight:bold; padding:2px 0 15px; margin:0; transition:padding 0.2s ease-in-out; -webkit-transition:padding 0.2s ease-in-out; border:none; }
217
+ .gmpm_focus_keyboard .gmpm_focus_keyboard_title a { text-transform:uppercase; color:#000000 !important; border-radius:2px; font-size:10px; padding:2px 4px 0; margin:-1px 0 0 4px; cursor:pointer; background-color:#404243; display:inline-block;
218
+ transition:all 0.1s ease-in-out; -webkit-transition:all 0.1s ease-in-out; }
219
+ .gmpm_focus_keyboard .gmpm_focus_keyboard_title a:hover { background-color:#525558; color:black; }
220
  .gmpm_focus_keyboard ul { font-size:0; margin:0; padding:0; list-style:none; }
221
+ .gmpm_focus_keyboard ul li { display:inline-block; margin:0; padding:0; list-style:none; font-family:Helvetica, Arial, sans-serif; }
222
  .gmpm_focus_keyboard ul li:last-child .gmpm_label { padding-right:0; }
223
  .gmpm_focus_keyboard ul .gmpm_key { display:inline-block; font-size:12px; width:22px; height:22px; border-radius:3px; text-align:center; line-height:22px; color:white; border:1px solid #000; position:relative; background:50% 50% no-repeat #404243;
224
+ box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset, rgba(255, 255, 255, 0.14902) 0 0 1px 1px; -webkit-box-shadow:rgba(255, 255, 255, 0.0980392) 0 1px 0 inset, rgba(255, 255, 255, 0.14902) 0 0 1px 1px; }
225
  .gmpm_focus_keyboard ul .gmpm_key[data-key="right"]::before { content:''; position:absolute; top:6px; right:7px; width:0; height:0; border-top:4px solid transparent; border-bottom:4px solid transparent; border-left:6px solid #fff; }
226
  .gmpm_focus_keyboard ul .gmpm_key[data-key="left"]::before { content:''; position:absolute; top:6px; left:7px; width:0; height:0; border-top:4px solid transparent; border-right:6px solid #fff; border-bottom:4px solid transparent; }
227
  .gmpm_focus_keyboard ul .gmpm_key.gmpm_esc { font-size:11px; line-height:19px; position:relative; top:-2px; }
228
  .gmpm_focus_keyboard ul .gmpm_label { font-size:12px; display:inline-block; padding:0 20px 0 8px; color:white; }
229
+ .gmpm_focus { position:static !important; }
230
+ .gmpm_photo_show.gmpm_focus { background:black none repeat scroll 0 0; bottom:0; height:100%; left:0; min-width:320px; overflow:hidden; position:fixed !important; right:0; top:0; width:100%; z-index:100001; }
231
  .gmpm_photo_show.gmpm_focus .gmpm_wrapper { max-width:none; }
232
+ .gmpm_photo_show.gmpm_focus .gmpm_gallery_sources_menu { display:none; }
233
  .gmpm_photo_show.gmpm_focus .gmpm_photo_wrap { bottom:90px; left:20px; position:absolute; right:20px; top:90px; z-index:20; padding:0; width:auto; height:auto !important;
234
+ transition:bottom 0.4s ease-in-out, top 0.4s ease-in-out; -webkit-transition:bottom 0.4s ease-in-out, top 0.4s ease-in-out; -moz-transition:bottom 0.4s ease-in-out, top 0.4s ease-in-out;
235
  }
236
  .gmpm_photo_show.gmpm_diskeys .gmpm_photo_wrap { bottom:20px; }
237
  .gmpm_photo_show.gmpm_focus_maximized .gmpm_photo_wrap { top:20px; bottom:20px; }
238
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header { height:auto; position:absolute; top:0; width:100%; z-index:20; border:none; margin:0; padding:0; opacity:1; overflow:hidden;
239
+ transition:top 0.6s ease-in-out, opacity 0.6s ease-in-out; -webkit-transition:top 0.6s ease-in-out, opacity 0.6s ease-in-out; }
240
  .gmpm_photo_show.gmpm_focus.gmpm_focus_maximized .gmpm_photo_header { top:-90px; opacity:0; }
241
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap { float:left; margin:20px 0 0 40px; padding-top:0; color:#ccc; width:calc(100% - 340px); }
242
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar { top:0; }
243
  .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap .gmpm_title { color:#fff; }
244
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap a { color:#ccc; }
245
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap a:hover { color:#eee; }
246
  .gmpm_photo_show.gmpm_focus .gmpm_focus_actions { display:block; }
247
+ .gmpm_photo_show.gmpm_focus .gmpm_focus_close_full { display:block; }
248
  .gmpm_photo_show.gmpm_focus .gmpm_actions { visibility:hidden; position:absolute; margin-left:-100%; z-index:-1; pointer-events:none; }
249
  .gmpm_photo_show.gmpm_focus .gmpm_photo_details { display:none; }
250
  .gmpm_photo_show.gmpm_focus .gmpm_photo_arrow { display:none; }
251
  .gmpm_photo_show.gmpm_focus .gmpm_focus_footer { height:auto; }
252
  .gmpm_photo_show.gmpm_focus .gmpm_focus_footer .gmpm_focus_keyboard { margin-bottom:20px; height:auto; padding-top:1px; opacity:1; }
253
  .gmpm_photo_show.gmpm_focus.gmpm_focus_maximized .gmpm_focus_footer .gmpm_focus_keyboard { margin-bottom:-90px; opacity:0; }
254
+
255
+ .gmpm_photo_show.gmpm_w480 .gmpm_carousel { visibility:hidden; position:absolute; margin-left:-100%; z-index:-1; pointer-events:none; }
256
+ .gmpm_photo_show.gmpm_w480 .gmpm_big_button.gmpm_download_button { display:none; }
257
+ .gmpm_hide { display:none; }
 
258
  .gmpm_no-transition,
259
  .gmpm_no-transition > div {
260
+ -webkit-transition:none !important;
261
+ -moz-transition:none !important;
262
+ transition:none !important;
263
+ }
264
+ .is_mobile .gmpm_focus_actions ul.gmpm_focus_share { display:none; }
265
+ .is_mobile .gmpm_focus_footer { display:none; }
266
+ .is_mobile .gmpm_photo_show .gmpm_photo_wrap { bottom:20px; }
267
+ @media all and (max-width:989px) {
268
+ .gmpm_focus_actions ul.gmpm_focus_share { display:none; }
269
+ .gmpm_focus_actions ul.gmpm_focus_like_fave { margin-left:0; }
270
+ .gmpm_focus_footer { display:none; }
271
+ .gmpm_photo_show .gmpm_photo_wrap { bottom:20px !important; }
272
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap { margin-left:20px; width:calc(100% - 235px); }
273
+ .gmpm_photo_show .gmpm_focus_actions { margin-right:20px; }
274
+ .gmpm_photo_show .gmpm_focus_close_full { right:20px; }
275
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_title { font-size:220%; padding:4px 0 1px; }
276
+ }
277
+ @media all and (max-width:800px) {
278
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap { width:calc(100% - 142px); }
279
+ .gmpm_focus_actions ul.gmpm_focus_arrows { display:none; }
280
+ }
281
+ @media all and (max-width:640px) {
282
+ .gmpm_photo_show .gmpm_photo_wrap { bottom:10px !important; left:5px !important; right:5px !important; }
283
+ .gmpm_photo_show.gmpm_focus .gmpm_photo_header .gmpm_name_wrap { margin-left:10px; width:calc(100% - 122px); }
284
+ .gmpm_photo_show .gmpm_focus_actions { margin-right:10px; }
285
+ .gmpm_photo_show .gmpm_focus_close_full { right:10px; }
286
+ .gmpm_photo_header .gmpm_name_wrap { white-space:normal; }
287
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author .gmpm_title { font-size:180%; padding:6px 0 3px; }
288
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author > div { font-size:120%; }
289
+ }
290
+ @media all and (max-width:480px) {
291
+ .gmpm_photo_header .gmpm_name_wrap .gmpm_user_avatar { display:none; }
292
+ .gmpm_photo_show .gmpm_photo_header .gmpm_name_wrap { padding-left:0; }
293
  }
294
+
module/photomania/img/facebook@2x.png ADDED
Binary file
module/photomania/img/google@2x.png ADDED
Binary file
module/photomania/img/pinterest@2x.png ADDED
Binary file
module/photomania/img/share@2x.png ADDED
Binary file
module/photomania/img/stumbleupon@2x.png ADDED
Binary file
module/photomania/img/twitter@2x.png ADDED
Binary file
module/photomania/index.php CHANGED
@@ -3,15 +3,16 @@ $module_info = array(
3
  'base' => 'photomania',
4
  'name' => 'photomania',
5
  'title' => 'PhotoMania',
6
- 'version' => '1.1',
7
  'author' => 'CodEasily.com',
8
  'description' => 'Responsive Gallery based on jQuery with keyboard control, displaying thumbs, author, title and optional description, download, link button, like button, full window and full screen mode',
9
  'type' => 'gallery',
 
10
  'status' => 'free',
11
  'price' => '0',
12
  'demo' => 'http://codeasily.com/portfolio-item/gmedia-photomania/',
13
  'download' => 'http://codeasily.com/download/photomania-module-zip/',
14
- 'dependencies' => 'mousetrap'
15
  );
16
  if (preg_match('#' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
17
  if (isset($_GET['info'])) {
3
  'base' => 'photomania',
4
  'name' => 'photomania',
5
  'title' => 'PhotoMania',
6
+ 'version' => '1.3',
7
  'author' => 'CodEasily.com',
8
  'description' => 'Responsive Gallery based on jQuery with keyboard control, displaying thumbs, author, title and optional description, download, link button, like button, full window and full screen mode',
9
  'type' => 'gallery',
10
+ 'branch' => '1',
11
  'status' => 'free',
12
  'price' => '0',
13
  'demo' => 'http://codeasily.com/portfolio-item/gmedia-photomania/',
14
  'download' => 'http://codeasily.com/download/photomania-module-zip/',
15
+ 'dependencies' => 'swiper,mousetrap'
16
  );
17
  if (preg_match('#' . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
18
  if (isset($_GET['info'])) {
module/photomania/init.php CHANGED
@@ -2,140 +2,182 @@
2
  /** @var $gmDB
3
  * @var $gmCore
4
  * @var $gmGallery
5
- * @var $gallery
 
6
  * @var $module
7
  * @var $settings
8
- * @var $terms
9
- * @var $gmedia
10
  * @var $is_bot
 
11
  **/
12
 
13
- $settings = array_merge($settings, array(
14
- 'ID' => $gallery['term_id'],
15
- 'name' => $gallery['name'],
16
- 'moduleUrl' => $module['url'],
17
- 'pluginUrl' => $gmCore->gmedia_url,
18
- 'libraryUrl' => $gmCore->upload['url'],
19
- 'ajaxurl' => admin_url('admin-ajax.php')
20
- ));
21
- if ($gmCore->_get('slide', false)) {
22
- $iSlide = (int)$_GET['slide'];
23
- $settings['initial_slide'] = $iSlide;
24
- } else {
25
- $iSlide = 0;
26
- }
27
- $allsettings = array_merge($module['options'], $settings);
28
 
29
  $content = array(
30
- 'term' => array(),
31
- 'data' => array()
32
  );
33
- if (! isset($shortcode_raw)) {
34
- $shortcode_raw = false;
35
- }
36
- foreach ($terms as $term) {
37
 
38
- $content['term'][$term->term_id] = array(
39
- 'term_id' => $term->term_id,
40
- 'title' => $term->name,
41
- 'description' => str_replace(array("\r\n", "\r", "\n"), '', wpautop($term->description))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  );
43
 
44
- foreach ($gmedia[$term->term_id] as $item) {
45
- $type = substr($item->mime_type, 0, 5);
46
- $meta = $gmDB->get_metadata('gmedia', $item->ID);
47
- $_metadata = $meta['_metadata'][0];
48
- unset($meta['_metadata'], $_metadata['image']);
49
 
50
- $author['posts_link'] = get_author_posts_url($item->author);
51
- if (function_exists('get_avatar_url')) {
52
- $author['avatar'] = get_avatar_url($item->author, array('size' => 50));
 
 
 
 
 
 
 
 
 
53
  } else {
54
- $avatar_img = get_avatar($item->author, 50);
55
- if (preg_match("/src=['\"](.*?)['\"]/i", $avatar_img, $matches)) {
56
- $author['avatar'] = $matches[1];
 
 
 
 
 
 
 
 
 
 
57
  }
58
  }
59
- $author['name'] = get_the_author_meta('display_name', $item->author);
 
 
 
 
60
 
 
61
  $download = '';
62
- if (! empty($allsettings['show_download_button'])) {
63
- if (isset($meta['download'])) {
64
- $download = $meta['download'][0];
 
 
65
  } else {
66
- if ('image' == $type) {
67
- $download = $gmCore->gm_get_media_image($item->ID, 'original');
68
- } else {
69
- $download = "{$gmCore->upload['url']}/{$gmGallery->options['folder'][$type]}/{$item->gmuid}";
70
- }
71
  }
72
  }
73
- $link = empty($allsettings['show_link_button']) ? '' : $item->link;
74
- $description = empty($allsettings['show_description']) ? '' : str_replace(array("\r\n", "\r", "\n"), '', wpautop($item->description));
75
-
76
-
77
- $content['data'][$item->ID] = array(
78
- 'id' => $item->ID,
79
- 'type' => $type,
80
- 'file' => $item->gmuid,
81
- 'title' => $item->title,
82
- 'description' => $description,
83
- 'download' => $download,
84
- 'link' => $link,
85
- 'date' => $item->date,
86
- 'meta' => $_metadata,
87
- 'author' => $author,
88
- 'term_id' => $term->term_id
89
- );
90
-
91
  }
 
92
  }
93
 
94
 
95
- if (! empty($content['data'])) {
96
- $json_settings = json_encode($settings);
97
 
98
- $slides = array();
99
- $slides_thumbs = array();
100
- foreach ($content['data'] as $id => $item) {
101
- $web = $gmCore->gm_get_media_image($item['id'], 'web');
102
- $thumb = $gmCore->gm_get_media_image($item['id'], 'thumb');
103
- if ('image' == $item['type']) {
104
- $ratio = $item['meta']['web']['width'] / $item['meta']['web']['height'];
105
- } elseif (isset($item['meta']['width']) && isset($item['meta']['height'])) {
106
- $ratio = $item['meta']['width'] / $item['meta']['height'];
107
- } else {
108
- $ratio = 1.5;
109
- }
110
- $content['data'][$id]['ratio'] = $ratio;
111
- if (1 <= $ratio) {
112
- $orientation = 'landscape';
113
- } else {
114
- $orientation = 'portrait';
115
- }
116
- $slides[] = '
117
- <div class="swiper-slide" id="gmpm_ID_' . $item['id'] . '"><span class="gmpm_va"></span>' . '<img data-src="' . $web . '" alt="' . esc_attr($item['title']) . '" data-protect="' . $item['author']['name'] . '" class="gmpm_the_photo swiper-lazy">' . '<div class="swiper-lazy-preloader swiper-lazy-preloader-black"></div>' . '</div>';
118
- $slides_thumbs[] = '
119
- <div class="swiper-slide gmpm_photo" data-photo-id="' . $item['id'] . '">' . '<img data-src="' . $thumb . '" alt="" class="gmpm_photo swiper-lazy ' . $orientation . '">' . '<span class="swiper-lazy-preloader swiper-lazy-preloader-black"></span>' . '</div>';
120
- }
121
- $content['data'] = array_values($content['data']);
122
 
123
- $photo_show_class = '';
124
- if (! empty($allsettings['gallery_maximized'])) {
125
- $photo_show_class .= ' gmpm_maximized';
 
 
 
 
 
 
 
 
126
  }
127
- if (! empty($allsettings['gallery_focus'])) {
128
- $photo_show_class .= ' gmpm_focus';
 
 
 
129
  }
130
- if (! empty($allsettings['gallery_focus_maximized'])) {
131
- $photo_show_class .= ' gmpm_focus_maximized';
 
 
 
132
  }
133
- if (empty($allsettings['keyboard_help'])) {
134
- $photo_show_class .= ' gmpm_diskeys';
 
 
 
135
  }
136
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
- <div class="gmpm_photo_show<?php echo $photo_show_class; ?>">
139
 
140
  <div class="gmpm_photo_wrap has_prev_photo has_next_photo">
141
  <div class="swiper-container swiper-big-images">
@@ -147,7 +189,7 @@ if (! empty($content['data'])) {
147
  </div>
148
  <div class="swiper-wrapper">
149
  <?php
150
- echo implode('', $slides);
151
  ?>
152
  </div>
153
  </div>
@@ -155,17 +197,44 @@ if (! empty($content['data'])) {
155
 
156
  <div class="gmpm_photo_header">
157
  <div class="gmpm_wrapper gmpm_clearfix">
158
- <div class="gmpm_name_wrap gmpm_clearfix">
159
- <?php if (! empty($allsettings['show_author_avatar'])) { ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  <div class="gmpm_user_avatar">
161
- <a class="gmpm_user_avatar_link" href="<?php echo $content['data'][$iSlide]['author']['posts_link']; ?>"><img src="<?php echo $content['data'][$iSlide]['author']['avatar']; ?>" alt=""/></a>
162
  </div>
163
  <?php } ?>
164
  <div class="gmpm_title_author">
165
- <h1 class="gmpm_title"><?php echo $content['data'][$iSlide]['title']; ?></h1>
166
 
167
  <div class="gmpm_author_name">
168
- <a class="gmpm_author_link" href="<?php echo $content['data'][$iSlide]['author']['posts_link']; ?>"><?php echo $content['data'][$iSlide]['author']['name']; ?></a>
169
  </div>
170
  </div>
171
  </div>
@@ -175,88 +244,172 @@ if (! empty($content['data'])) {
175
  <div class="gmpm_photo_carousel">
176
  <div class="swiper-container swiper-small-images">
177
  <div class="swiper-wrapper">
178
- <?php echo implode('', $slides_thumbs); ?>
179
  </div>
180
  </div>
181
  </div>
182
  <div class="gmpm_next_button"></div>
183
  </div>
184
- <?php if (! empty($allsettings['show_download_button'])) { ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  <div class="gmpm_big_button_wrap">
186
- <a class="gmpm_big_button gmpm_download_button" href="<?php echo $content['data'][$iSlide]['download']; ?>" download="<?php echo esc_attr($content['data'][$iSlide]['file']); ?>">
187
  <span class="gmpm_icon"></span>
188
  <span class="gmpm_label"><?php echo $allsettings['download_button_text']; ?></span>
189
  </a>
190
  </div>
191
  <?php } ?>
192
- <?php if (! empty($allsettings['show_link_button'])) { ?>
 
 
 
 
 
 
 
 
193
  <div class="gmpm_big_button_wrap">
194
- <a class="gmpm_big_button gmpm_link_button<?php echo empty($content['data'][$iSlide]['link']) ? ' inactive' : '' ?>" href="<?php echo $content['data'][$iSlide]['link']; ?>" target="<?php echo $allsettings['link_button_target']; ?>">
195
  <span class="gmpm_icon"></span>
196
  <span class="gmpm_label"><?php echo $allsettings['link_button_text']; ?></span>
197
  </a>
198
  </div>
199
  <?php } ?>
200
  </div>
201
- <div class="gmpm_focus_actions">
202
- <?php if (! empty($allsettings['show_like_button'])) { ?>
203
- <ul class="gmpm_focus_like_fave gmpm_clearfix">
204
- <li><a class="gmpm_button gmpm_like"><?php _e('Like', 'grand-media'); ?></a></li>
205
- </ul>
206
- <?php } ?>
207
- <ul class="gmpm_focus_arrows gmpm_clearfix">
208
- <li><a class="gmpm_button gmpm_photo_arrow_previous gmpm_prev"><?php _e('Previous', 'grand-media'); ?></a></li>
209
- <li><a class="gmpm_button gmpm_photo_arrow_next gmpm_next"><?php _e('Next', 'grand-media'); ?></a></li>
210
- </ul>
211
- <ul class="gmpm_focus_close_full gmpm_clearfix">
212
- <li><a class="gmpm_button gmpm_close"><?php _e('Close', 'grand-media'); ?></a></li>
213
- <li><a class="gmpm_button gmpm_full"><?php _e('Full', 'grand-media'); ?></a></li>
214
- </ul>
215
- </div>
216
  </div>
217
  </div>
218
- <?php if (! empty($allsettings['show_description'])) { ?>
219
- <div class="gmpm_photo_details no-details-tab<?php echo empty($content['data'][$iSlide]['description']) ? ' no-slide-description' : ''; ?>">
220
- <div class="gmpm_wrapper gmpm_clearfix">
221
- <div class="gmpm_description_wrap">
222
- <?php if (! empty($allsettings['description_title'])) { ?>
223
- <h2><?php echo $allsettings['description_title']; ?></h2>
224
- <?php } ?>
225
-
226
- <div class="gmpm_description_text_wrap">
227
- <div class="gmpm_slide_description"><?php echo $content['data'][$iSlide]['description']; ?></div>
228
- </div>
 
229
  </div>
230
- </div>
231
  </div>
232
- <?php } ?>
233
 
234
  <div class="gmpm_focus_footer">
235
  <div class="gmpm_focus_keyboard">
236
- <h6><?php _e('Keyboard Shortcuts', 'grand-media'); ?> <a class="gmpm_focus_keyboard_dismiss"><?php _e('Dismiss', 'grand-media'); ?></a></h6>
237
  <ul>
238
- <li><a data-key="p" class="gmpm_key">S</a><span class="gmpm_label"><?php _e('Slideshow', 'grand-media'); ?></span></li>
239
- <li><a data-key="m" class="gmpm_key">M</a><span class="gmpm_label"><?php _e('Maximize', 'grand-media'); ?></span></li>
240
- <li><a data-key="left" class="gmpm_key">&nbsp;</a><span class="gmpm_label"><?php _e('Previous', 'grand-media'); ?></span></li>
241
- <li><a data-key="right" class="gmpm_key">&nbsp;</a><span class="gmpm_label"><?php _e('Next', 'grand-media'); ?></span></li>
242
- <li><a data-key="escape" class="gmpm_key gmpm_esc">esc</a><span class="gmpm_label"><?php _e('Close', 'grand-media'); ?></span></li>
243
  </ul>
244
  </div>
245
  </div>
246
 
247
  </div>
248
 
249
- <?php if ($shortcode_raw) { echo '<pre style="display:none">'; }
250
- ?><script type="text/javascript">
251
- jQuery(function ($) {
252
- var settings = <?php echo $json_settings; ?>;
 
 
 
253
  var content = <?php echo json_encode($content); ?>;
254
- var container = $('#GmediaGallery_<?php echo $gallery['term_id'] ?>');
255
- container.photomanialite(settings, content);
256
- window.GmediaGallery_<?php echo $gallery['term_id'] ?> = container.data('photomanialite');
257
  });
258
- </script><?php if ($shortcode_raw) { echo '</pre>'; } ?>
259
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  } else {
261
- echo GMEDIA_GALLERY_EMPTY;
 
262
  }
 
 
 
 
 
 
 
2
  /** @var $gmDB
3
  * @var $gmCore
4
  * @var $gmGallery
5
+ * @var $id
6
+ * @var $query
7
  * @var $module
8
  * @var $settings
9
+ * @var $term
 
10
  * @var $is_bot
11
+ * @var $shortcode_raw
12
  **/
13
 
14
+ global $wp;
15
+ $settings = array_merge( $settings, array(
16
+ 'ID' => $id,
17
+ 'url' => remove_query_arg( 'gm' . $id . '_slide', add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) ) ),
18
+ 'moduleUrl' => $module['url']
19
+ ) );
20
+ $iSlide = $settings['initial_slide'] = (int) $gmCore->_get( 'gm' . $id . '_slide', 0 );
21
+ $base_url_host = parse_url( $gmCore->upload['url'], PHP_URL_HOST );
22
+ $term_url = remove_query_arg( 'gm' . $id, $settings['url'] );
23
+
24
+ $allsettings = array_merge( $module['options'], $settings );
25
+ $gmedias = $gmDB->get_gmedias( $query );
 
 
 
26
 
27
  $content = array(
28
+ 'data' => array(),
29
+ 'terms' => array()
30
  );
 
 
 
 
31
 
32
+ foreach ( $gmedias as $item ) {
33
+ $type = explode( '/', $item->mime_type );
34
+
35
+ $_meta = $gmDB->get_metadata( 'gmedia', $item->ID );
36
+ $metadata = $_meta['_metadata'][0];
37
+ $meta = array(
38
+ 'width' => empty( $metadata['web']['width'] ) ? ( empty( $metadata['width'] ) ? null : $metadata['width'] ) : $metadata['web']['width'],
39
+ 'height' => empty( $metadata['web']['height'] ) ? ( empty( $metadata['height'] ) ? null : $metadata['height'] ) : $metadata['web']['height'],
40
+ 'views' => empty( $_meta['views'][0] ) ? 0 : (int) $_meta['views'][0],
41
+ 'likes' => empty( $_meta['likes'][0] ) ? 0 : (int) $_meta['likes'][0]
42
+ );
43
+
44
+ $author['name'] = get_the_author_meta( 'display_name', $item->author );
45
+ $author['posts_link'] = get_author_posts_url( $item->author );
46
+ if ( ! empty( $allsettings['show_author_avatar'] ) ) {
47
+ $avatar_img = get_avatar( $item->author, 60 );
48
+ if ( preg_match( "/src=['\"](.*?)['\"]/i", $avatar_img, $matches ) ) {
49
+ $author['avatar'] = $matches[1];
50
+ }
51
+ }
52
+ $alttext = !empty($_meta['_image_alt'][0])? $_meta['_image_alt'][0] : $item->title;
53
+
54
+ $content['data'][ $item->ID ] = array(
55
+ 'id' => $item->ID,
56
+ 'type' => $type[0],
57
+ 'file' => $item->gmuid,
58
+ 'meta' => $meta,
59
+ 'title' => $item->title,
60
+ 'alt' => $alttext,
61
+ 'author' => $author
62
  );
63
 
64
+ if ( ! empty( $allsettings['show_description'] ) ) {
65
+ $content['data'][ $item->ID ]['description'] = str_replace( array( "\r\n", "\r", "\n" ), '', wpautop( $item->description ) );
66
+ }
 
 
67
 
68
+ if ( ! empty( $item->post_id ) ) {
69
+ $content['data'][ $item->ID ]['post_link'] = get_permalink( $item->post_id );
70
+ }
71
+ if ( ! empty( $allsettings['show_share_button'] ) ) {
72
+ if ( empty( $item->post_id ) ) {
73
+ $content['data'][ $item->ID ]['post_link'] = $gmCore->gmcloudlink( $item->ID, 'single' );
74
+ }
75
+ }
76
+ if ( ! empty( $allsettings['show_comments'] ) ) {
77
+ if ( ! empty( $item->post_id ) ) {
78
+ $cc = wp_count_comments( $item->post_id );
79
+ $content['data'][ $item->ID ]['cc'] = $cc->approved;
80
  } else {
81
+ $content['data'][ $item->ID ]['cc'] = '';
82
+ }
83
+ }
84
+
85
+ if ( ! empty( $allsettings['show_link_button'] ) ) {
86
+ $content['data'][ $item->ID ]['link'] = $item->link;
87
+ $link_target = '';
88
+ if ( $item->link ) {
89
+ $url_host = parse_url( $item->link, PHP_URL_HOST );
90
+ if ( $url_host == $base_url_host || empty( $url_host ) ) {
91
+ $link_target = '_self';
92
+ } else {
93
+ $link_target = '_blank';
94
  }
95
  }
96
+ if ( isset( $_meta['link_target'][0] ) ) {
97
+ $link_target = $_meta['link_target'][0];
98
+ }
99
+ $content['data'][ $item->ID ]['link_target'] = $link_target;
100
+ }
101
 
102
+ if ( ! empty( $allsettings['show_download_button'] ) ) {
103
  $download = '';
104
+ if ( ! empty( $_meta['download'][0] ) ) {
105
+ $download = $_meta['download'][0];
106
+ } else {
107
+ if ( 'image' == $type[0] ) {
108
+ $download = $gmCore->gm_get_media_image( $item->ID, 'original' );
109
  } else {
110
+ $download = "{$gmCore->upload['url']}/{$gmGallery->options['folder'][$type[0]]}/{$item->gmuid}";
 
 
 
 
111
  }
112
  }
113
+ $content['data'][ $item->ID ]['download'] = $download;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
+
116
  }
117
 
118
 
119
+ if ( empty( $content['data'] ) ) {
120
+ echo GMEDIA_GALLERY_EMPTY;
121
 
122
+ return;
123
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
+ $slides = array();
126
+ $slides_thumbs = array();
127
+ $i = 0;
128
+ foreach ( $content['data'] as $item_id => $item ) {
129
+ $i ++;
130
+ $web = $gmCore->gm_get_media_image( $item['id'], 'web' );
131
+ $thumb = $gmCore->gm_get_media_image( $item['id'], 'thumb' );
132
+ if ( ! empty( $item['meta']['width'] ) && ! empty( $item['meta']['height'] ) ) {
133
+ $ratio = $item['meta']['width'] / $item['meta']['height'];
134
+ } else {
135
+ $ratio = 1.5;
136
  }
137
+ $content['data'][ $item_id ]['ratio'] = $ratio;
138
+ if ( 1 <= $ratio ) {
139
+ $orientation = 'gmpm_photo_landscape';
140
+ } else {
141
+ $orientation = 'gmpm_photo_portrait';
142
  }
143
+ $img_src = '';
144
+ $thumb_src = '';
145
+ if ( $is_bot || 1 === $i ) {
146
+ $img_src = 'src="' . $web . '"';
147
+ $thumb_src = 'src="' . $thumb . '"';
148
  }
149
+ $img_class = '';
150
+ $img_preloader = '';
151
+ if ( ! $is_bot ) {
152
+ $img_class .= ' swiper-lazy';
153
+ $img_preloader = '<div class="swiper-lazy-preloader swiper-lazy-preloader-black"></div>';
154
  }
155
+ $slides[] = '
156
+ <div class="swiper-slide" data-hash="gmedia' . $item['id'] . '" data-photo-id="' . $item['id'] . '"><span class="gmpm_va"></span>' . '<img ' . $img_src . ' data-src="' . $web . '" alt="' . esc_attr( $item['alt'] ) . '" data-protect="' . $item['author']['name'] . '" class="gmpm_the_photo' . $img_class . '">' . $img_preloader . '</div>';
157
+ $slides_thumbs[] = '
158
+ <div class="swiper-slide gmpm_photo" data-photo-id="' . $item['id'] . '">' . '<img ' . $thumb_src . ' data-src="' . $thumb . '" alt="' . esc_attr( $item['alt'] ) . '" class="gmpm_photo swiper-lazy ' . $orientation . '">' . '<span class="swiper-lazy-preloader swiper-lazy-preloader-black"></span>' . '</div>';
159
+ }
160
+ $content['data'] = array_values( $content['data'] );
161
+
162
+ $photo_show_class = '';
163
+ if ( ! empty( $allsettings['gallery_maximized'] ) ) {
164
+ $photo_show_class .= ' gmpm_maximized';
165
+ }
166
+ if ( ! empty( $allsettings['gallery_focus'] ) ) {
167
+ $photo_show_class .= ' gmpm_focus';
168
+ }
169
+ if ( ! empty( $allsettings['gallery_focus_maximized'] ) ) {
170
+ $photo_show_class .= ' gmpm_focus_maximized';
171
+ }
172
+ if ( empty( $allsettings['keyboard_help'] ) ) {
173
+ $photo_show_class .= ' gmpm_diskeys';
174
+ }
175
+ if ( ! $is_bot ) {
176
+ $photo_show_class .= ' gmpm_preload';
177
+ }
178
+ ?>
179
 
180
+ <div class="gmpm_photo_show gmpm_w960 gmpm_w640 gmpm_w480<?php echo $photo_show_class; ?>">
181
 
182
  <div class="gmpm_photo_wrap has_prev_photo has_next_photo">
183
  <div class="swiper-container swiper-big-images">
189
  </div>
190
  <div class="swiper-wrapper">
191
  <?php
192
+ echo implode( '', $slides );
193
  ?>
194
  </div>
195
  </div>
197
 
198
  <div class="gmpm_photo_header">
199
  <div class="gmpm_wrapper gmpm_clearfix">
200
+ <div class="gmpm_focus_actions">
201
+ <?php if ( ! empty( $allsettings['show_share_button'] ) ) { ?>
202
+ <ul class="gmpm_focus_share">
203
+ <li class="gmpm_share_wrapper">
204
+ <a class="gmpm_button gmpm_share"><?php _e( 'Share', 'grand-media' ); ?></a>
205
+ <ul class="gmpm_sharelizers gmpm_clearfix">
206
+ <li><a class="gmpm_button gmpm_facebook gmpm_sharelizer"><?php _e( 'Facebook', 'grand-media' ); ?></a></li>
207
+ <li><a class="gmpm_button gmpm_twitter gmpm_sharelizer"><?php _e( 'Twitter', 'grand-media' ); ?></a></li>
208
+ <li><a class="gmpm_button gmpm_pinterest gmpm_sharelizer"><?php _e( 'Pinterest', 'grand-media' ); ?></a></li>
209
+ <li><a class="gmpm_button gmpm_google gmpm_sharelizer"><?php _e( 'Google+', 'grand-media' ); ?></a></li>
210
+ <li><a class="gmpm_button gmpm_stumbleupon gmpm_sharelizer"><?php _e( 'StumbleUpon', 'grand-media' ); ?></a></li>
211
+ </ul>
212
+ </li>
213
+ </ul>
214
+ <?php } ?>
215
+ <?php if ( ! empty( $allsettings['show_like_button'] ) ) { ?>
216
+ <ul class="gmpm_focus_like_fave gmpm_clearfix">
217
+ <li><a class="gmpm_button gmpm_like"><?php _e( 'Like', 'grand-media' ); ?></a></li>
218
+ </ul>
219
+ <?php } ?>
220
+ <ul class="gmpm_focus_arrows gmpm_clearfix">
221
+ <li><a class="gmpm_button gmpm_photo_arrow_previous gmpm_prev"><?php _e( 'Previous', 'grand-media' ); ?></a></li>
222
+ <li><a class="gmpm_button gmpm_photo_arrow_next gmpm_next"><?php _e( 'Next', 'grand-media' ); ?></a></li>
223
+ </ul>
224
+ </div>
225
+ <div class="gmpm_name_wrap gmpm_clearfix<?php if ( empty( $allsettings['show_author_avatar'] ) ) {
226
+ echo ' gmpm_no_avatar';
227
+ } ?>">
228
+ <?php if ( ! empty( $allsettings['show_author_avatar'] ) ) { ?>
229
  <div class="gmpm_user_avatar">
230
+ <a class="gmpm_user_avatar_link" href="<?php echo urldecode( $content['data'][ $iSlide ]['author']['posts_link'] ); ?>"><img src="<?php echo $content['data'][ $iSlide ]['author']['avatar']; ?>" alt=""/></a>
231
  </div>
232
  <?php } ?>
233
  <div class="gmpm_title_author">
234
+ <div class="gmpm_title"><?php echo $content['data'][ $iSlide ]['title']; ?></div>
235
 
236
  <div class="gmpm_author_name">
237
+ <a class="gmpm_author_link" href="<?php echo urldecode( $content['data'][ $iSlide ]['author']['posts_link'] ); ?>"><?php echo $content['data'][ $iSlide ]['author']['name']; ?></a>
238
  </div>
239
  </div>
240
  </div>
244
  <div class="gmpm_photo_carousel">
245
  <div class="swiper-container swiper-small-images">
246
  <div class="swiper-wrapper">
247
+ <?php echo implode( '', $slides_thumbs ); ?>
248
  </div>
249
  </div>
250
  </div>
251
  <div class="gmpm_next_button"></div>
252
  </div>
253
+ <?php
254
+ $show_share_button = ! empty( $allsettings['show_share_button'] );
255
+ $show_like_button = ! empty( $allsettings['show_like_button'] );
256
+ if ( $show_share_button || $show_like_button ) { ?>
257
+ <div class="gmpm_big_button_wrap<?php echo ( ! $show_share_button || ! $show_like_button ) ? ' gmpm_one_button' : ''; ?>">
258
+ <?php if ( $show_share_button ) { ?>
259
+ <div class="gmpm_share_wrapper">
260
+ <a class="gmpm_button gmpm_share"><?php _e( 'Share', 'grand-media' ); ?></a>
261
+
262
+ <div class="gmpm_sharelizers_wrap">
263
+ <ul class="gmpm_sharelizers">
264
+ <li><a class="gmpm_button gmpm_facebook gmpm_sharelizer"><?php _e( 'Facebook', 'grand-media' ); ?></a></li>
265
+ <li><a class="gmpm_button gmpm_twitter gmpm_sharelizer"><?php _e( 'Twitter', 'grand-media' ); ?></a></li>
266
+ <li><a class="gmpm_button gmpm_pinterest gmpm_sharelizer"><?php _e( 'Pinterest', 'grand-media' ); ?></a></li>
267
+ <li><a class="gmpm_button gmpm_google gmpm_sharelizer"><?php _e( 'Google+', 'grand-media' ); ?></a></li>
268
+ <li><a class="gmpm_button gmpm_stumbleupon gmpm_sharelizer"><?php _e( 'StumbleUpon', 'grand-media' ); ?></a></li>
269
+ </ul>
270
+ </div>
271
+ </div>
272
+ <?php } ?>
273
+ <?php if ( $show_like_button ) { ?>
274
+ <a class="gmpm_button gmpm_like"><?php _e( 'Like', 'grand-media' ); ?></a>
275
+ <?php } ?>
276
+ </div>
277
+ <?php } ?>
278
+ <?php if ( ! empty( $allsettings['show_comments'] ) ) {
279
+ if ( '' === $content['data'][ $iSlide ]['cc'] ) {
280
+ $link_class = ' gmpm_inactive';
281
+ $link_href = '';
282
+ } else {
283
+ $link_class = '';
284
+ $link_href = "href='{$content['data'][$iSlide]['post_link']}#comments' target='_blank'";
285
+ }
286
+ ?>
287
+ <div class="gmpm_big_button_wrap">
288
+ <a class="gmpm_big_button gmpm_comments_button<?php echo $link_class; ?>" <?php echo $link_href; ?>>
289
+ <span class="gmpm_count_icon">
290
+ <span class="gmpm_comments_count"><?php echo $content['data'][ $iSlide ]['cc'] ?></span>
291
+ <span class="gmpm_comments_icon">
292
+ <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
293
+ <symbol id="icon-bubbles2" viewBox="0 0 1152 1024">
294
+ <path class="path1" d="M480 0v0c265.096 0 480 173.914 480 388.448s-214.904 388.448-480 388.448c-25.458 0-50.446-1.62-74.834-4.71-103.106 102.694-222.172 121.108-341.166 123.814v-25.134c64.252-31.354 116-88.466 116-153.734 0-9.106-0.712-18.048-2.030-26.794-108.558-71.214-177.97-179.988-177.97-301.89 0-214.534 214.904-388.448 480-388.448zM996 870.686c0 55.942 36.314 104.898 92 131.772v21.542c-103.126-2.318-197.786-18.102-287.142-106.126-21.14 2.65-42.794 4.040-64.858 4.040-95.47 0-183.408-25.758-253.614-69.040 144.674-0.506 281.26-46.854 384.834-130.672 52.208-42.252 93.394-91.826 122.414-147.348 30.766-58.866 46.366-121.582 46.366-186.406 0-10.448-0.45-20.836-1.258-31.168 72.57 59.934 117.258 141.622 117.258 231.676 0 104.488-60.158 197.722-154.24 258.764-1.142 7.496-1.76 15.16-1.76 22.966z"></path>
295
+ </symbol>
296
+ </svg>
297
+ <svg class="gmMosaic-svgicon">
298
+ <use xlink:href="#icon-bubbles2"/>
299
+ </svg>
300
+ </span>
301
+ </span>
302
+ <span class="gmpm_label"><?php echo $allsettings['comments_button_text']; ?></span>
303
+ </a>
304
+ </div>
305
+ <?php } ?>
306
+ <?php if ( ! empty( $allsettings['show_download_button'] ) ) { ?>
307
  <div class="gmpm_big_button_wrap">
308
+ <a class="gmpm_big_button gmpm_download_button" href="<?php echo $content['data'][ $iSlide ]['download']; ?>" download="<?php esc_attr_e( $content['data'][ $iSlide ]['file'] ); ?>">
309
  <span class="gmpm_icon"></span>
310
  <span class="gmpm_label"><?php echo $allsettings['download_button_text']; ?></span>
311
  </a>
312
  </div>
313
  <?php } ?>
314
+ <?php if ( ! empty( $allsettings['show_link_button'] ) ) {
315
+ if ( empty( $content['data'][ $iSlide ]['link'] ) ) {
316
+ $link_class = ' gmpm_inactive';
317
+ $link_href = '';
318
+ } else {
319
+ $link_class = '';
320
+ $link_href = "href='{$content['data'][$iSlide]['link']}' target='{$content['data'][$iSlide]['link_target']}'";
321
+ }
322
+ ?>
323
  <div class="gmpm_big_button_wrap">
324
+ <a class="gmpm_big_button gmpm_link_button<?php echo $link_class; ?>" <?php echo $link_href; ?>>
325
  <span class="gmpm_icon"></span>
326
  <span class="gmpm_label"><?php echo $allsettings['link_button_text']; ?></span>
327
  </a>
328
  </div>
329
  <?php } ?>
330
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  </div>
332
  </div>
333
+ <div class="gmpm_focus_close_full">
334
+ <span><a class="gmpm_button gmpm_close"><?php _e( 'Close', 'grand-media' ); ?></a></span>
335
+ <span><a class="gmpm_button gmpm_full"><?php _e( 'Full', 'grand-media' ); ?></a></span>
336
+ </div>
337
+ <div class="gmpm_photo_details">
338
+ <div class="gmpm_description_wrap<?php echo empty( $content['data'][ $iSlide ]['description'] ) ? ' empty-item-description' : ''; ?>">
339
+ <?php if ( ! empty( $allsettings['show_description'] ) ) { ?>
340
+ <?php if ( ! empty( $allsettings['description_title'] ) ) { ?>
341
+ <div class="details_title"><?php echo $allsettings['description_title']; ?></div>
342
+ <?php } ?>
343
+ <div class="gmpm_description_text_wrap">
344
+ <div class="gmpm_slide_description"><?php echo $content['data'][ $iSlide ]['description']; ?></div>
345
  </div>
346
+ <?php } ?>
347
  </div>
348
+ </div>
349
 
350
  <div class="gmpm_focus_footer">
351
  <div class="gmpm_focus_keyboard">
352
+ <div class="gmpm_focus_keyboard_title"><?php _e( 'Keyboard Shortcuts', 'grand-media' ); ?> <a class="gmpm_focus_keyboard_dismiss"><?php _e( 'Dismiss', 'grand-media' ); ?></a></div>
353
  <ul>
354
+ <li><a data-key="p" class="gmpm_key">S</a><span class="gmpm_label"><?php _e( 'Slideshow', 'grand-media' ); ?></span></li>
355
+ <li><a data-key="m" class="gmpm_key">M</a><span class="gmpm_label"><?php _e( 'Maximize', 'grand-media' ); ?></span></li>
356
+ <li><a data-key="left" class="gmpm_key">&nbsp;</a><span class="gmpm_label"><?php _e( 'Previous', 'grand-media' ); ?></span></li>
357
+ <li><a data-key="right" class="gmpm_key">&nbsp;</a><span class="gmpm_label"><?php _e( 'Next', 'grand-media' ); ?></span></li>
358
+ <li><a data-key="escape" class="gmpm_key gmpm_esc">esc</a><span class="gmpm_label"><?php _e( 'Close', 'grand-media' ); ?></span></li>
359
  </ul>
360
  </div>
361
  </div>
362
 
363
  </div>
364
 
365
+ <?php if ( $shortcode_raw ) {
366
+ echo '<pre style="display:none">';
367
+ }
368
+ ?>
369
+ <script type="text/javascript">
370
+ jQuery(function($) {
371
+ var settings = <?php echo json_encode($settings); ?>;
372
  var content = <?php echo json_encode($content); ?>;
373
+ var container = $('#GmediaGallery_<?php echo $id; ?>');
374
+ container.photomania(settings, content);
375
+ window.GmediaGallery_<?php echo $id; ?> = container.data('photomania');
376
  });
377
+ </script><?php if ( $shortcode_raw ) {
378
+ echo '</pre>';
379
+ } ?>
380
+ <?php
381
+
382
+ $cssid = "#GmediaGallery_{$id}";
383
+ $color_css = '';
384
+ if ( isset( $settings['link_color'] ) ) {
385
+ $color_css .= "
386
+ {$cssid} .gmpm_photo_details .gmpm_description_wrap a,
387
+ {$cssid} .gmpm_big_button_wrap .gmpm_button.gmpm_like.gmpm_liked,
388
+ {$cssid} .gmpm_big_button_wrap .gmpm_button.gmpm_like.gmpm_liked:hover {color:#{$settings['link_color']};}
389
+ {$cssid} .gmpm_photo_show .gmpm_big_button {background-color:#{$settings['link_color']};}";
390
+ }
391
+ if ( isset( $settings['link_color_hover'] ) ) {
392
+ $color_css .= "
393
+ {$cssid} .swiper-small-images div.gmpm_photo.swiper-slide-active {border-color:#{$settings['link_color_hover']};}
394
+ {$cssid} .gmpm_photo_header .gmpm_name_wrap .gmpm_title_author a:hover,
395
+ {$cssid} .gmpm_photo_details .gmpm_description_wrap a:hover {color:#{$settings['link_color_hover']};}
396
+ {$cssid} .gmpm_photo_show .gmpm_big_button:hover,
397
+ {$cssid} .gmpm_focus_actions ul .gmpm_button.like.gmpm_liked {background-color:#{$settings['link_color_hover']};}";
398
+ }
399
+
400
+ $gmpm_css = "
401
+ {$cssid} .gmpm_preload {opacity:0;}";
402
+ if ( 'fit' == $allsettings['scale_mode'] ) {
403
+ $gmpm_css .= "
404
+ {$cssid} .swiper-big-images img.gmpm_the_photo { max-height:100%; max-width:100%; display:inline; width:auto; height:auto; object-fit:unset; vertical-align:middle; border:none; }";
405
  } else {
406
+ $gmpm_css .= "
407
+ {$cssid} .swiper-big-images img.gmpm_the_photo { max-height:100%; max-width:100%; display:inline; width:100%; height:100%; object-fit:cover; vertical-align:middle; border:none; }";
408
  }
409
+ $gmpm_css .= "
410
+ {$cssid} .gmpm_focus .swiper-big-images img.gmpm_the_photo { width:auto; height:auto; object-fit:unset; }
411
+ {$cssid} .swiper-small-images img.gmpm_photo { max-width:none; max-height:none; }
412
+ {$cssid} .swiper-small-images img.gmpm_photo.gmpm_photo_landscape { width:auto; height:100%; }
413
+ {$cssid} .swiper-small-images img.gmpm_photo.gmpm_photo_portrait { width:100%; height:auto; }
414
+ {$cssid} .gmpm_gallery_sources_list p { margin:7px 0; padding:0; font-size:inherit; }";
415
+ $customCSS = $gmpm_css . $color_css . $customCSS;
module/photomania/js/1-script.swiper.js DELETED
@@ -1,17 +0,0 @@
1
- /** @preserve
2
- * Swiper 3.1.2
3
- * Most modern mobile touch slider and framework with hardware accelerated transitions
4
- *
5
- * http://www.idangero.us/swiper/
6
- *
7
- * Copyright 2015, Vladimir Kharlampidi
8
- * The iDangero.us
9
- * http://www.idangero.us/
10
- *
11
- * Licensed under MIT
12
- *
13
- * Released on: August 22, 2015
14
- */
15
- !function(){"use strict";function e(e){e.fn.swiper=function(a){var s;return e(this).each(function(){var e=new t(this,a);s||(s=e)}),s}}var a,t=function(e,s){function r(){return"horizontal"===v.params.direction}function i(e){return Math.floor(e)}function n(){v.autoplayTimeoutId=setTimeout(function(){v.params.loop?(v.fixLoop(),v._slideNext()):v.isEnd?s.autoplayStopOnLast?v.stopAutoplay():v._slideTo(0):v._slideNext()},v.params.autoplay)}function o(e,t){var s=a(e.target);if(!s.is(t))if("string"==typeof t)s=s.parents(t);else if(t.nodeType){var r;return s.parents().each(function(e,a){a===t&&(r=t)}),r?t:void 0}return 0===s.length?void 0:s[0]}function l(e,a){a=a||{};var t=window.MutationObserver||window.WebkitMutationObserver,s=new t(function(e){e.forEach(function(e){v.onResize(!0),v.emit("onObserverUpdate",v,e)})});s.observe(e,{attributes:"undefined"==typeof a.attributes?!0:a.attributes,childList:"undefined"==typeof a.childList?!0:a.childList,characterData:"undefined"==typeof a.characterData?!0:a.characterData}),v.observers.push(s)}function p(e){e.originalEvent&&(e=e.originalEvent);var a=e.keyCode||e.charCode;if(!v.params.allowSwipeToNext&&(r()&&39===a||!r()&&40===a))return!1;if(!v.params.allowSwipeToPrev&&(r()&&37===a||!r()&&38===a))return!1;if(!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||document.activeElement&&document.activeElement.nodeName&&("input"===document.activeElement.nodeName.toLowerCase()||"textarea"===document.activeElement.nodeName.toLowerCase()))){if(37===a||39===a||38===a||40===a){var t=!1;if(v.container.parents(".swiper-slide").length>0&&0===v.container.parents(".swiper-slide-active").length)return;var s={left:window.pageXOffset,top:window.pageYOffset},i=window.innerWidth,n=window.innerHeight,o=v.container.offset();v.rtl&&(o.left=o.left-v.container[0].scrollLeft);for(var l=[[o.left,o.top],[o.left+v.width,o.top],[o.left,o.top+v.height],[o.left+v.width,o.top+v.height]],p=0;p<l.length;p++){var d=l[p];d[0]>=s.left&&d[0]<=s.left+i&&d[1]>=s.top&&d[1]<=s.top+n&&(t=!0)}if(!t)return}r()?((37===a||39===a)&&(e.preventDefault?e.preventDefault():e.returnValue=!1),(39===a&&!v.rtl||37===a&&v.rtl)&&v.slideNext(),(37===a&&!v.rtl||39===a&&v.rtl)&&v.slidePrev()):((38===a||40===a)&&(e.preventDefault?e.preventDefault():e.returnValue=!1),40===a&&v.slideNext(),38===a&&v.slidePrev())}}function d(e){e.originalEvent&&(e=e.originalEvent);var a=v.mousewheel.event,t=0;if(e.detail)t=-e.detail;else if("mousewheel"===a)if(v.params.mousewheelForceToAxis)if(r()){if(!(Math.abs(e.wheelDeltaX)>Math.abs(e.wheelDeltaY)))return;t=e.wheelDeltaX}else{if(!(Math.abs(e.wheelDeltaY)>Math.abs(e.wheelDeltaX)))return;t=e.wheelDeltaY}else t=e.wheelDelta;else if("DOMMouseScroll"===a)t=-e.detail;else if("wheel"===a)if(v.params.mousewheelForceToAxis)if(r()){if(!(Math.abs(e.deltaX)>Math.abs(e.deltaY)))return;t=-e.deltaX}else{if(!(Math.abs(e.deltaY)>Math.abs(e.deltaX)))return;t=-e.deltaY}else t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?-e.deltaX:-e.deltaY;if(v.params.mousewheelInvert&&(t=-t),v.params.freeMode){var s=v.getWrapperTranslate()+t*v.params.mousewheelSensitivity;if(s>0&&(s=0),s<v.maxTranslate()&&(s=v.maxTranslate()),v.setWrapperTransition(0),v.setWrapperTranslate(s),v.updateProgress(),v.updateActiveIndex(),v.params.freeModeSticky&&(clearTimeout(v.mousewheel.timeout),v.mousewheel.timeout=setTimeout(function(){v.slideReset()},300)),0===s||s===v.maxTranslate())return}else{if((new window.Date).getTime()-v.mousewheel.lastScrollTime>60)if(0>t)if(v.isEnd&&!v.params.loop||v.animating){if(v.params.mousewheelReleaseOnEdges)return!0}else v.slideNext();else if(v.isBeginning&&!v.params.loop||v.animating){if(v.params.mousewheelReleaseOnEdges)return!0}else v.slidePrev();v.mousewheel.lastScrollTime=(new window.Date).getTime()}return v.params.autoplay&&v.stopAutoplay(),e.preventDefault?e.preventDefault():e.returnValue=!1,!1}function u(e,t){e=a(e);var s,i,n;s=e.attr("data-swiper-parallax")||"0",i=e.attr("data-swiper-parallax-x"),n=e.attr("data-swiper-parallax-y"),i||n?(i=i||"0",n=n||"0"):r()?(i=s,n="0"):(n=s,i="0"),i=i.indexOf("%")>=0?parseInt(i,10)*t+"%":i*t+"px",n=n.indexOf("%")>=0?parseInt(n,10)*t+"%":n*t+"px",e.transform("translate3d("+i+", "+n+",0px)")}function c(e){return 0!==e.indexOf("on")&&(e=e[0]!==e[0].toUpperCase()?"on"+e[0].toUpperCase()+e.substring(1):"on"+e),e}if(!(this instanceof t))return new t(e,s);var m={direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,autoplay:!1,autoplayDisableOnInteraction:!0,iOSEdgeSwipeDetection:!1,iOSEdgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeSticky:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",coverflow:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0},cube:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94},fade:{crossFade:!1},parallax:!1,scrollbar:null,scrollbarHide:!0,keyboardControl:!1,mousewheelControl:!1,mousewheelReleaseOnEdges:!1,mousewheelInvert:!1,mousewheelForceToAxis:!1,mousewheelSensitivity:1,hashnav:!1,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,onlyExternal:!1,threshold:0,touchMoveStopPropagation:!0,pagination:null,paginationElement:"span",paginationClickable:!1,paginationHide:!1,paginationBulletRender:null,resistance:!0,resistanceRatio:.85,nextButton:null,prevButton:null,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,lazyLoading:!1,lazyLoadingInPrevNext:!1,lazyLoadingOnTransitionStart:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,control:void 0,controlInverse:!1,controlBy:"slide",allowSwipeToPrev:!0,allowSwipeToNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",slideClass:"swiper-slide",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",buttonDisabledClass:"swiper-button-disabled",paginationHiddenClass:"swiper-pagination-hidden",observer:!1,observeParents:!1,a11y:!1,prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",runCallbacksOnInit:!0},f=s&&s.virtualTranslate;s=s||{};for(var h in m)if("undefined"==typeof s[h])s[h]=m[h];else if("object"==typeof s[h])for(var g in m[h])"undefined"==typeof s[h][g]&&(s[h][g]=m[h][g]);var v=this;if(v.version="3.1.0",v.params=s,v.classNames=[],"undefined"!=typeof a&&"undefined"!=typeof Dom7&&(a=Dom7),("undefined"!=typeof a||(a="undefined"==typeof Dom7?window.Dom7||window.Zepto||window.jQuery:Dom7))&&(v.$=a,v.container=a(e),0!==v.container.length)){if(v.container.length>1)return void v.container.each(function(){new t(this,s)});v.container[0].swiper=v,v.container.data("swiper",v),v.classNames.push("swiper-container-"+v.params.direction),v.params.freeMode&&v.classNames.push("swiper-container-free-mode"),v.support.flexbox||(v.classNames.push("swiper-container-no-flexbox"),v.params.slidesPerColumn=1),(v.params.parallax||v.params.watchSlidesVisibility)&&(v.params.watchSlidesProgress=!0),["cube","coverflow"].indexOf(v.params.effect)>=0&&(v.support.transforms3d?(v.params.watchSlidesProgress=!0,v.classNames.push("swiper-container-3d")):v.params.effect="slide"),"slide"!==v.params.effect&&v.classNames.push("swiper-container-"+v.params.effect),"cube"===v.params.effect&&(v.params.resistanceRatio=0,v.params.slidesPerView=1,v.params.slidesPerColumn=1,v.params.slidesPerGroup=1,v.params.centeredSlides=!1,v.params.spaceBetween=0,v.params.virtualTranslate=!0,v.params.setWrapperSize=!1),"fade"===v.params.effect&&(v.params.slidesPerView=1,v.params.slidesPerColumn=1,v.params.slidesPerGroup=1,v.params.watchSlidesProgress=!0,v.params.spaceBetween=0,"undefined"==typeof f&&(v.params.virtualTranslate=!0)),v.params.grabCursor&&v.support.touch&&(v.params.grabCursor=!1),v.wrapper=v.container.children("."+v.params.wrapperClass),v.params.pagination&&(v.paginationContainer=a(v.params.pagination),v.params.paginationClickable&&v.paginationContainer.addClass("swiper-pagination-clickable")),v.rtl=r()&&("rtl"===v.container[0].dir.toLowerCase()||"rtl"===v.container.css("direction")),v.rtl&&v.classNames.push("swiper-container-rtl"),v.rtl&&(v.wrongRTL="-webkit-box"===v.wrapper.css("display")),v.params.slidesPerColumn>1&&v.classNames.push("swiper-container-multirow"),v.device.android&&v.classNames.push("swiper-container-android"),v.container.addClass(v.classNames.join(" ")),v.translate=0,v.progress=0,v.velocity=0,v.lockSwipeToNext=function(){v.params.allowSwipeToNext=!1},v.lockSwipeToPrev=function(){v.params.allowSwipeToPrev=!1},v.lockSwipes=function(){v.params.allowSwipeToNext=v.params.allowSwipeToPrev=!1},v.unlockSwipeToNext=function(){v.params.allowSwipeToNext=!0},v.unlockSwipeToPrev=function(){v.params.allowSwipeToPrev=!0},v.unlockSwipes=function(){v.params.allowSwipeToNext=v.params.allowSwipeToPrev=!0},v.params.grabCursor&&(v.container[0].style.cursor="move",v.container[0].style.cursor="-webkit-grab",v.container[0].style.cursor="-moz-grab",v.container[0].style.cursor="grab"),v.imagesToLoad=[],v.imagesLoaded=0,v.loadImage=function(e,a,t,s){function r(){s&&s()}var i;e.complete&&t?r():a?(i=new window.Image,i.onload=r,i.onerror=r,i.src=a):r()},v.preloadImages=function(){function e(){"undefined"!=typeof v&&null!==v&&(void 0!==v.imagesLoaded&&v.imagesLoaded++,v.imagesLoaded===v.imagesToLoad.length&&(v.params.updateOnImagesReady&&v.update(),v.emit("onImagesReady",v)))}v.imagesToLoad=v.container.find("img");for(var a=0;a<v.imagesToLoad.length;a++)v.loadImage(v.imagesToLoad[a],v.imagesToLoad[a].currentSrc||v.imagesToLoad[a].getAttribute("src"),!0,e)},v.autoplayTimeoutId=void 0,v.autoplaying=!1,v.autoplayPaused=!1,v.startAutoplay=function(){return"undefined"!=typeof v.autoplayTimeoutId?!1:v.params.autoplay?v.autoplaying?!1:(v.autoplaying=!0,v.emit("onAutoplayStart",v),void n()):!1},v.stopAutoplay=function(e){v.autoplayTimeoutId&&(v.autoplayTimeoutId&&clearTimeout(v.autoplayTimeoutId),v.autoplaying=!1,v.autoplayTimeoutId=void 0,v.emit("onAutoplayStop",v))},v.pauseAutoplay=function(e){v.autoplayPaused||(v.autoplayTimeoutId&&clearTimeout(v.autoplayTimeoutId),v.autoplayPaused=!0,0===e?(v.autoplayPaused=!1,n()):v.wrapper.transitionEnd(function(){v&&(v.autoplayPaused=!1,v.autoplaying?n():v.stopAutoplay())}))},v.minTranslate=function(){return-v.snapGrid[0]},v.maxTranslate=function(){return-v.snapGrid[v.snapGrid.length-1]},v.updateContainerSize=function(){var e,a;e="undefined"!=typeof v.params.width?v.params.width:v.container[0].clientWidth,a="undefined"!=typeof v.params.height?v.params.height:v.container[0].clientHeight,0===e&&r()||0===a&&!r()||(e=e-parseInt(v.container.css("padding-left"),10)-parseInt(v.container.css("padding-right"),10),a=a-parseInt(v.container.css("padding-top"),10)-parseInt(v.container.css("padding-bottom"),10),v.width=e,v.height=a,v.size=r()?v.width:v.height)},v.updateSlidesSize=function(){v.slides=v.wrapper.children("."+v.params.slideClass),v.snapGrid=[],v.slidesGrid=[],v.slidesSizesGrid=[];var e,a=v.params.spaceBetween,t=-v.params.slidesOffsetBefore,s=0,n=0;"string"==typeof a&&a.indexOf("%")>=0&&(a=parseFloat(a.replace("%",""))/100*v.size),v.virtualSize=-a,v.slides.css(v.rtl?{marginLeft:"",marginTop:""}:{marginRight:"",marginBottom:""});var o;v.params.slidesPerColumn>1&&(o=Math.floor(v.slides.length/v.params.slidesPerColumn)===v.slides.length/v.params.slidesPerColumn?v.slides.length:Math.ceil(v.slides.length/v.params.slidesPerColumn)*v.params.slidesPerColumn);var l,p=v.params.slidesPerColumn,d=o/p,u=d-(v.params.slidesPerColumn*d-v.slides.length);for(e=0;e<v.slides.length;e++){l=0;var c=v.slides.eq(e);if(v.params.slidesPerColumn>1){var m,f,h;"column"===v.params.slidesPerColumnFill?(f=Math.floor(e/p),h=e-f*p,(f>u||f===u&&h===p-1)&&++h>=p&&(h=0,f++),m=f+h*o/p,c.css({"-webkit-box-ordinal-group":m,"-moz-box-ordinal-group":m,"-ms-flex-order":m,"-webkit-order":m,order:m})):(h=Math.floor(e/d),f=e-h*d),c.css({"margin-top":0!==h&&v.params.spaceBetween&&v.params.spaceBetween+"px"}).attr("data-swiper-column",f).attr("data-swiper-row",h)}"none"!==c.css("display")&&("auto"===v.params.slidesPerView?(l=r()?c.outerWidth(!0):c.outerHeight(!0),v.params.roundLengths&&(l=i(l))):(l=(v.size-(v.params.slidesPerView-1)*a)/v.params.slidesPerView,v.params.roundLengths&&(l=i(l)),r()?v.slides[e].style.width=l+"px":v.slides[e].style.height=l+"px"),v.slides[e].swiperSlideSize=l,v.slidesSizesGrid.push(l),v.params.centeredSlides?(t=t+l/2+s/2+a,0===e&&(t=t-v.size/2-a),Math.abs(t)<.001&&(t=0),n%v.params.slidesPerGroup===0&&v.snapGrid.push(t),v.slidesGrid.push(t)):(n%v.params.slidesPerGroup===0&&v.snapGrid.push(t),v.slidesGrid.push(t),t=t+l+a),v.virtualSize+=l+a,s=l,n++)}v.virtualSize=Math.max(v.virtualSize,v.size)+v.params.slidesOffsetAfter;var g;if(v.rtl&&v.wrongRTL&&("slide"===v.params.effect||"coverflow"===v.params.effect)&&v.wrapper.css({width:v.virtualSize+v.params.spaceBetween+"px"}),(!v.support.flexbox||v.params.setWrapperSize)&&v.wrapper.css(r()?{width:v.virtualSize+v.params.spaceBetween+"px"}:{height:v.virtualSize+v.params.spaceBetween+"px"}),v.params.slidesPerColumn>1&&(v.virtualSize=(l+v.params.spaceBetween)*o,v.virtualSize=Math.ceil(v.virtualSize/v.params.slidesPerColumn)-v.params.spaceBetween,v.wrapper.css({width:v.virtualSize+v.params.spaceBetween+"px"}),v.params.centeredSlides)){for(g=[],e=0;e<v.snapGrid.length;e++)v.snapGrid[e]<v.virtualSize+v.snapGrid[0]&&g.push(v.snapGrid[e]);v.snapGrid=g}if(!v.params.centeredSlides){for(g=[],e=0;e<v.snapGrid.length;e++)v.snapGrid[e]<=v.virtualSize-v.size&&g.push(v.snapGrid[e]);v.snapGrid=g,Math.floor(v.virtualSize-v.size)>Math.floor(v.snapGrid[v.snapGrid.length-1])&&v.snapGrid.push(v.virtualSize-v.size)}0===v.snapGrid.length&&(v.snapGrid=[0]),0!==v.params.spaceBetween&&v.slides.css(r()?v.rtl?{marginLeft:a+"px"}:{marginRight:a+"px"}:{marginBottom:a+"px"}),v.params.watchSlidesProgress&&v.updateSlidesOffset()},v.updateSlidesOffset=function(){for(var e=0;e<v.slides.length;e++)v.slides[e].swiperSlideOffset=r()?v.slides[e].offsetLeft:v.slides[e].offsetTop},v.updateSlidesProgress=function(e){if("undefined"==typeof e&&(e=v.translate||0),0!==v.slides.length){"undefined"==typeof v.slides[0].swiperSlideOffset&&v.updateSlidesOffset();var a=-e;v.rtl&&(a=e);{v.container[0].getBoundingClientRect(),r()?"left":"top",r()?"right":"bottom"}v.slides.removeClass(v.params.slideVisibleClass);for(var t=0;t<v.slides.length;t++){var s=v.slides[t],i=(a-s.swiperSlideOffset)/(s.swiperSlideSize+v.params.spaceBetween);if(v.params.watchSlidesVisibility){var n=-(a-s.swiperSlideOffset),o=n+v.slidesSizesGrid[t],l=n>=0&&n<v.size||o>0&&o<=v.size||0>=n&&o>=v.size;l&&v.slides.eq(t).addClass(v.params.slideVisibleClass)}s.progress=v.rtl?-i:i}}},v.updateProgress=function(e){"undefined"==typeof e&&(e=v.translate||0);var a=v.maxTranslate()-v.minTranslate();0===a?(v.progress=0,v.isBeginning=v.isEnd=!0):(v.progress=(e-v.minTranslate())/a,v.isBeginning=v.progress<=0,v.isEnd=v.progress>=1),v.isBeginning&&v.emit("onReachBeginning",v),v.isEnd&&v.emit("onReachEnd",v),v.params.watchSlidesProgress&&v.updateSlidesProgress(e),v.emit("onProgress",v,v.progress)},v.updateActiveIndex=function(){var e,a,t,s=v.rtl?v.translate:-v.translate;for(a=0;a<v.slidesGrid.length;a++)"undefined"!=typeof v.slidesGrid[a+1]?s>=v.slidesGrid[a]&&s<v.slidesGrid[a+1]-(v.slidesGrid[a+1]-v.slidesGrid[a])/2?e=a:s>=v.slidesGrid[a]&&s<v.slidesGrid[a+1]&&(e=a+1):s>=v.slidesGrid[a]&&(e=a);(0>e||"undefined"==typeof e)&&(e=0),t=Math.floor(e/v.params.slidesPerGroup),t>=v.snapGrid.length&&(t=v.snapGrid.length-1),e!==v.activeIndex&&(v.snapIndex=t,v.previousIndex=v.activeIndex,v.activeIndex=e,v.updateClasses())},v.updateClasses=function(){v.slides.removeClass(v.params.slideActiveClass+" "+v.params.slideNextClass+" "+v.params.slidePrevClass);var e=v.slides.eq(v.activeIndex);if(e.addClass(v.params.slideActiveClass),e.next("."+v.params.slideClass).addClass(v.params.slideNextClass),e.prev("."+v.params.slideClass).addClass(v.params.slidePrevClass),v.bullets&&v.bullets.length>0){v.bullets.removeClass(v.params.bulletActiveClass);var t;v.params.loop?(t=Math.ceil(v.activeIndex-v.loopedSlides)/v.params.slidesPerGroup,t>v.slides.length-1-2*v.loopedSlides&&(t-=v.slides.length-2*v.loopedSlides),t>v.bullets.length-1&&(t-=v.bullets.length)):t="undefined"!=typeof v.snapIndex?v.snapIndex:v.activeIndex||0,v.paginationContainer.length>1?v.bullets.each(function(){a(this).index()===t&&a(this).addClass(v.params.bulletActiveClass)}):v.bullets.eq(t).addClass(v.params.bulletActiveClass)}v.params.loop||(v.params.prevButton&&(v.isBeginning?(a(v.params.prevButton).addClass(v.params.buttonDisabledClass),v.params.a11y&&v.a11y&&v.a11y.disable(a(v.params.prevButton))):(a(v.params.prevButton).removeClass(v.params.buttonDisabledClass),v.params.a11y&&v.a11y&&v.a11y.enable(a(v.params.prevButton)))),v.params.nextButton&&(v.isEnd?(a(v.params.nextButton).addClass(v.params.buttonDisabledClass),v.params.a11y&&v.a11y&&v.a11y.disable(a(v.params.nextButton))):(a(v.params.nextButton).removeClass(v.params.buttonDisabledClass),v.params.a11y&&v.a11y&&v.a11y.enable(a(v.params.nextButton)))))},v.updatePagination=function(){if(v.params.pagination&&v.paginationContainer&&v.paginationContainer.length>0){for(var e="",a=v.params.loop?Math.ceil((v.slides.length-2*v.loopedSlides)/v.params.slidesPerGroup):v.snapGrid.length,t=0;a>t;t++)e+=v.params.paginationBulletRender?v.params.paginationBulletRender(t,v.params.bulletClass):"<"+v.params.paginationElement+' class="'+v.params.bulletClass+'"></'+v.params.paginationElement+">";v.paginationContainer.html(e),v.bullets=v.paginationContainer.find("."+v.params.bulletClass),v.params.paginationClickable&&v.params.a11y&&v.a11y&&v.a11y.initPagination()}},v.update=function(e){function a(){s=Math.min(Math.max(v.translate,v.maxTranslate()),v.minTranslate()),v.setWrapperTranslate(s),v.updateActiveIndex(),v.updateClasses()}if(v.updateContainerSize(),v.updateSlidesSize(),v.updateProgress(),v.updatePagination(),v.updateClasses(),v.params.scrollbar&&v.scrollbar&&v.scrollbar.set(),e){var t,s;v.controller&&v.controller.spline&&(v.controller.spline=void 0),v.params.freeMode?a():(t=("auto"===v.params.slidesPerView||v.params.slidesPerView>1)&&v.isEnd&&!v.params.centeredSlides?v.slideTo(v.slides.length-1,0,!1,!0):v.slideTo(v.activeIndex,0,!1,!0),t||a())}},v.onResize=function(e){var a=v.params.allowSwipeToPrev,t=v.params.allowSwipeToNext;if(v.params.allowSwipeToPrev=v.params.allowSwipeToNext=!0,v.updateContainerSize(),v.updateSlidesSize(),("auto"===v.params.slidesPerView||v.params.freeMode||e)&&v.updatePagination(),v.params.scrollbar&&v.scrollbar&&v.scrollbar.set(),v.controller&&v.controller.spline&&(v.controller.spline=void 0),v.params.freeMode){var s=Math.min(Math.max(v.translate,v.maxTranslate()),v.minTranslate());v.setWrapperTranslate(s),v.updateActiveIndex(),v.updateClasses()}else v.updateClasses(),("auto"===v.params.slidesPerView||v.params.slidesPerView>1)&&v.isEnd&&!v.params.centeredSlides?v.slideTo(v.slides.length-1,0,!1,!0):v.slideTo(v.activeIndex,0,!1,!0);v.params.allowSwipeToPrev=a,v.params.allowSwipeToNext=t};var w=["mousedown","mousemove","mouseup"];window.navigator.pointerEnabled?w=["pointerdown","pointermove","pointerup"]:window.navigator.msPointerEnabled&&(w=["MSPointerDown","MSPointerMove","MSPointerUp"]),v.touchEvents={start:v.support.touch||!v.params.simulateTouch?"touchstart":w[0],move:v.support.touch||!v.params.simulateTouch?"touchmove":w[1],end:v.support.touch||!v.params.simulateTouch?"touchend":w[2]},(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&("container"===v.params.touchEventsTarget?v.container:v.wrapper).addClass("swiper-wp8-"+v.params.direction),v.initEvents=function(e){var t=e?"off":"on",r=e?"removeEventListener":"addEventListener",i="container"===v.params.touchEventsTarget?v.container[0]:v.wrapper[0],n=v.support.touch?i:document,o=v.params.nested?!0:!1;v.browser.ie?(i[r](v.touchEvents.start,v.onTouchStart,!1),n[r](v.touchEvents.move,v.onTouchMove,o),n[r](v.touchEvents.end,v.onTouchEnd,!1)):(v.support.touch&&(i[r](v.touchEvents.start,v.onTouchStart,!1),i[r](v.touchEvents.move,v.onTouchMove,o),i[r](v.touchEvents.end,v.onTouchEnd,!1)),!s.simulateTouch||v.device.ios||v.device.android||(i[r]("mousedown",v.onTouchStart,!1),document[r]("mousemove",v.onTouchMove,o),document[r]("mouseup",v.onTouchEnd,!1))),window[r]("resize",v.onResize),v.params.nextButton&&(a(v.params.nextButton)[t]("click",v.onClickNext),v.params.a11y&&v.a11y&&a(v.params.nextButton)[t]("keydown",v.a11y.onEnterKey)),v.params.prevButton&&(a(v.params.prevButton)[t]("click",v.onClickPrev),v.params.a11y&&v.a11y&&a(v.params.prevButton)[t]("keydown",v.a11y.onEnterKey)),v.params.pagination&&v.params.paginationClickable&&(a(v.paginationContainer)[t]("click","."+v.params.bulletClass,v.onClickIndex),v.params.a11y&&v.a11y&&a(v.paginationContainer)[t]("keydown","."+v.params.bulletClass,v.a11y.onEnterKey)),(v.params.preventClicks||v.params.preventClicksPropagation)&&i[r]("click",v.preventClicks,!0)},v.attachEvents=function(e){v.initEvents()},v.detachEvents=function(){v.initEvents(!0)},v.allowClick=!0,v.preventClicks=function(e){v.allowClick||(v.params.preventClicks&&e.preventDefault(),v.params.preventClicksPropagation&&v.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))},v.onClickNext=function(e){e.preventDefault(),(!v.isEnd||v.params.loop)&&v.slideNext()},v.onClickPrev=function(e){e.preventDefault(),(!v.isBeginning||v.params.loop)&&v.slidePrev()},v.onClickIndex=function(e){e.preventDefault();var t=a(this).index()*v.params.slidesPerGroup;v.params.loop&&(t+=v.loopedSlides),v.slideTo(t)},v.updateClickedSlide=function(e){var t=o(e,"."+v.params.slideClass),s=!1;if(t)for(var r=0;r<v.slides.length;r++)v.slides[r]===t&&(s=!0);if(!t||!s)return v.clickedSlide=void 0,void(v.clickedIndex=void 0);if(v.clickedSlide=t,v.clickedIndex=a(t).index(),v.params.slideToClickedSlide&&void 0!==v.clickedIndex&&v.clickedIndex!==v.activeIndex){var i,n=v.clickedIndex;if(v.params.loop)if(i=a(v.clickedSlide).attr("data-swiper-slide-index"),n>v.slides.length-v.params.slidesPerView)v.fixLoop(),n=v.wrapper.children("."+v.params.slideClass+'[data-swiper-slide-index="'+i+'"]').eq(0).index(),setTimeout(function(){v.slideTo(n)},0);else if(n<v.params.slidesPerView-1){v.fixLoop();var l=v.wrapper.children("."+v.params.slideClass+'[data-swiper-slide-index="'+i+'"]');n=l.eq(l.length-1).index(),setTimeout(function(){v.slideTo(n)},0)}else v.slideTo(n);else v.slideTo(n)}};var y,x,b,T,S,C,M,P,z,I="input, select, textarea, button",E=Date.now(),k=[];v.animating=!1,v.touches={startX:0,startY:0,currentX:0,currentY:0,diff:0};var D,G;if(v.onTouchStart=function(e){if(e.originalEvent&&(e=e.originalEvent),D="touchstart"===e.type,D||!("which"in e)||3!==e.which){if(v.params.noSwiping&&o(e,"."+v.params.noSwipingClass))return void(v.allowClick=!0);if(!v.params.swipeHandler||o(e,v.params.swipeHandler)){var t=v.touches.currentX="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,s=v.touches.currentY="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY;if(!(v.device.ios&&v.params.iOSEdgeSwipeDetection&&t<=v.params.iOSEdgeSwipeThreshold)){if(y=!0,x=!1,T=void 0,G=void 0,v.touches.startX=t,v.touches.startY=s,b=Date.now(),v.allowClick=!0,v.updateContainerSize(),v.swipeDirection=void 0,v.params.threshold>0&&(M=!1),"touchstart"!==e.type){var r=!0;a(e.target).is(I)&&(r=!1),document.activeElement&&a(document.activeElement).is(I)&&document.activeElement.blur(),r&&e.preventDefault()}v.emit("onTouchStart",v,e)}}}},v.onTouchMove=function(e){if(e.originalEvent&&(e=e.originalEvent),!(D&&"mousemove"===e.type||e.preventedByNestedSwiper)){if(v.params.onlyExternal)return v.allowClick=!1,void(y&&(v.touches.startX=v.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,v.touches.startY=v.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,b=Date.now()));if(D&&document.activeElement&&e.target===document.activeElement&&a(e.target).is(I))return x=!0,void(v.allowClick=!1);if(v.emit("onTouchMove",v,e),!(e.targetTouches&&e.targetTouches.length>1)){if(v.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,v.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,"undefined"==typeof T){var t=180*Math.atan2(Math.abs(v.touches.currentY-v.touches.startY),Math.abs(v.touches.currentX-v.touches.startX))/Math.PI;T=r()?t>v.params.touchAngle:90-t>v.params.touchAngle}if(T&&v.emit("onTouchMoveOpposite",v,e),"undefined"==typeof G&&v.browser.ieTouch&&(v.touches.currentX!==v.touches.startX||v.touches.currentY!==v.touches.startY)&&(G=!0),y){if(T)return void(y=!1);if(G||!v.browser.ieTouch){v.allowClick=!1,v.emit("onSliderMove",v,e),e.preventDefault(),v.params.touchMoveStopPropagation&&!v.params.nested&&e.stopPropagation(),x||(s.loop&&v.fixLoop(),C=v.getWrapperTranslate(),v.setWrapperTransition(0),v.animating&&v.wrapper.trigger("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd"),v.params.autoplay&&v.autoplaying&&(v.params.autoplayDisableOnInteraction?v.stopAutoplay():v.pauseAutoplay()),z=!1,v.params.grabCursor&&(v.container[0].style.cursor="move",v.container[0].style.cursor="-webkit-grabbing",v.container[0].style.cursor="-moz-grabbin",v.container[0].style.cursor="grabbing")),x=!0;var i=v.touches.diff=r()?v.touches.currentX-v.touches.startX:v.touches.currentY-v.touches.startY;i*=v.params.touchRatio,v.rtl&&(i=-i),v.swipeDirection=i>0?"prev":"next",S=i+C;var n=!0;if(i>0&&S>v.minTranslate()?(n=!1,v.params.resistance&&(S=v.minTranslate()-1+Math.pow(-v.minTranslate()+C+i,v.params.resistanceRatio))):0>i&&S<v.maxTranslate()&&(n=!1,v.params.resistance&&(S=v.maxTranslate()+1-Math.pow(v.maxTranslate()-C-i,v.params.resistanceRatio))),n&&(e.preventedByNestedSwiper=!0),!v.params.allowSwipeToNext&&"next"===v.swipeDirection&&C>S&&(S=C),!v.params.allowSwipeToPrev&&"prev"===v.swipeDirection&&S>C&&(S=C),v.params.followFinger){if(v.params.threshold>0){if(!(Math.abs(i)>v.params.threshold||M))return void(S=C);if(!M)return M=!0,v.touches.startX=v.touches.currentX,v.touches.startY=v.touches.currentY,S=C,void(v.touches.diff=r()?v.touches.currentX-v.touches.startX:v.touches.currentY-v.touches.startY)}(v.params.freeMode||v.params.watchSlidesProgress)&&v.updateActiveIndex(),v.params.freeMode&&(0===k.length&&k.push({position:v.touches[r()?"startX":"startY"],time:b}),k.push({position:v.touches[r()?"currentX":"currentY"],time:(new window.Date).getTime()})),v.updateProgress(S),v.setWrapperTranslate(S)}}}}}},v.onTouchEnd=function(e){if(e.originalEvent&&(e=e.originalEvent),v.emit("onTouchEnd",v,e),y){v.params.grabCursor&&x&&y&&(v.container[0].style.cursor="move",v.container[0].style.cursor="-webkit-grab",v.container[0].style.cursor="-moz-grab",v.container[0].style.cursor="grab");var t=Date.now(),s=t-b;if(v.allowClick&&(v.updateClickedSlide(e),v.emit("onTap",v,e),300>s&&t-E>300&&(P&&clearTimeout(P),P=setTimeout(function(){v&&(v.params.paginationHide&&v.paginationContainer.length>0&&!a(e.target).hasClass(v.params.bulletClass)&&v.paginationContainer.toggleClass(v.params.paginationHiddenClass),v.emit("onClick",v,e))},300)),300>s&&300>t-E&&(P&&clearTimeout(P),v.emit("onDoubleTap",v,e))),E=Date.now(),setTimeout(function(){v&&(v.allowClick=!0)},0),!y||!x||!v.swipeDirection||0===v.touches.diff||S===C)return void(y=x=!1);y=x=!1;var r;if(r=v.params.followFinger?v.rtl?v.translate:-v.translate:-S,v.params.freeMode){if(r<-v.minTranslate())return void v.slideTo(v.activeIndex);if(r>-v.maxTranslate())return void v.slideTo(v.slides.length<v.snapGrid.length?v.snapGrid.length-1:v.slides.length-1);if(v.params.freeModeMomentum){if(k.length>1){var i=k.pop(),n=k.pop(),o=i.position-n.position,l=i.time-n.time;v.velocity=o/l,v.velocity=v.velocity/2,Math.abs(v.velocity)<.02&&(v.velocity=0),(l>150||(new window.Date).getTime()-i.time>300)&&(v.velocity=0)}else v.velocity=0;k.length=0;var p=1e3*v.params.freeModeMomentumRatio,d=v.velocity*p,u=v.translate+d;v.rtl&&(u=-u);var c,m=!1,f=20*Math.abs(v.velocity)*v.params.freeModeMomentumBounceRatio;if(u<v.maxTranslate())v.params.freeModeMomentumBounce?(u+v.maxTranslate()<-f&&(u=v.maxTranslate()-f),c=v.maxTranslate(),m=!0,z=!0):u=v.maxTranslate();else if(u>v.minTranslate())v.params.freeModeMomentumBounce?(u-v.minTranslate()>f&&(u=v.minTranslate()+f),c=v.minTranslate(),m=!0,z=!0):u=v.minTranslate();else if(v.params.freeModeSticky){var h,g=0;for(g=0;g<v.snapGrid.length;g+=1)if(v.snapGrid[g]>-u){h=g;break}u=Math.abs(v.snapGrid[h]-u)<Math.abs(v.snapGrid[h-1]-u)||"next"===v.swipeDirection?v.snapGrid[h]:v.snapGrid[h-1],v.rtl||(u=-u)}if(0!==v.velocity)p=Math.abs(v.rtl?(-u-v.translate)/v.velocity:(u-v.translate)/v.velocity);else if(v.params.freeModeSticky)return void v.slideReset();v.params.freeModeMomentumBounce&&m?(v.updateProgress(c),v.setWrapperTransition(p),v.setWrapperTranslate(u),v.onTransitionStart(),v.animating=!0,v.wrapper.transitionEnd(function(){v&&z&&(v.emit("onMomentumBounce",v),v.setWrapperTransition(v.params.speed),v.setWrapperTranslate(c),v.wrapper.transitionEnd(function(){v&&v.onTransitionEnd()}))})):v.velocity?(v.updateProgress(u),v.setWrapperTransition(p),v.setWrapperTranslate(u),v.onTransitionStart(),v.animating||(v.animating=!0,v.wrapper.transitionEnd(function(){v&&v.onTransitionEnd()}))):v.updateProgress(u),v.updateActiveIndex()}return void((!v.params.freeModeMomentum||s>=v.params.longSwipesMs)&&(v.updateProgress(),v.updateActiveIndex()))}var w,T=0,M=v.slidesSizesGrid[0];for(w=0;w<v.slidesGrid.length;w+=v.params.slidesPerGroup)"undefined"!=typeof v.slidesGrid[w+v.params.slidesPerGroup]?r>=v.slidesGrid[w]&&r<v.slidesGrid[w+v.params.slidesPerGroup]&&(T=w,M=v.slidesGrid[w+v.params.slidesPerGroup]-v.slidesGrid[w]):r>=v.slidesGrid[w]&&(T=w,M=v.slidesGrid[v.slidesGrid.length-1]-v.slidesGrid[v.slidesGrid.length-2]);var I=(r-v.slidesGrid[T])/M;if(s>v.params.longSwipesMs){if(!v.params.longSwipes)return void v.slideTo(v.activeIndex);"next"===v.swipeDirection&&v.slideTo(I>=v.params.longSwipesRatio?T+v.params.slidesPerGroup:T),"prev"===v.swipeDirection&&v.slideTo(I>1-v.params.longSwipesRatio?T+v.params.slidesPerGroup:T)}else{if(!v.params.shortSwipes)return void v.slideTo(v.activeIndex);"next"===v.swipeDirection&&v.slideTo(T+v.params.slidesPerGroup),"prev"===v.swipeDirection&&v.slideTo(T)}}},v._slideTo=function(e,a){return v.slideTo(e,a,!0,!0)},v.slideTo=function(e,a,t,s){"undefined"==typeof t&&(t=!0),"undefined"==typeof e&&(e=0),0>e&&(e=0),v.snapIndex=Math.floor(e/v.params.slidesPerGroup),v.snapIndex>=v.snapGrid.length&&(v.snapIndex=v.snapGrid.length-1);var i=-v.snapGrid[v.snapIndex];v.params.autoplay&&v.autoplaying&&(s||!v.params.autoplayDisableOnInteraction?v.pauseAutoplay(a):v.stopAutoplay()),v.updateProgress(i);for(var n=0;n<v.slidesGrid.length;n++)-Math.floor(100*i)>=Math.floor(100*v.slidesGrid[n])&&(e=n);if(!v.params.allowSwipeToNext&&i<v.translate&&i<v.minTranslate())return!1;if(!v.params.allowSwipeToPrev&&i>v.translate&&i>v.maxTranslate()&&(v.activeIndex||0)!==e)return!1;if("undefined"==typeof a&&(a=v.params.speed),v.previousIndex=v.activeIndex||0,v.activeIndex=e,i===v.translate)return v.updateClasses(),!1;v.updateClasses(),v.onTransitionStart(t);r()?i:0,r()?0:i;return 0===a?(v.setWrapperTransition(0),v.setWrapperTranslate(i),v.onTransitionEnd(t)):(v.setWrapperTransition(a),v.setWrapperTranslate(i),v.animating||(v.animating=!0,v.wrapper.transitionEnd(function(){v&&v.onTransitionEnd(t)}))),!0},v.onTransitionStart=function(e){"undefined"==typeof e&&(e=!0),
16
- v.lazy&&v.lazy.onTransitionStart(),e&&(v.emit("onTransitionStart",v),v.activeIndex!==v.previousIndex&&v.emit("onSlideChangeStart",v))},v.onTransitionEnd=function(e){v.animating=!1,v.setWrapperTransition(0),"undefined"==typeof e&&(e=!0),v.lazy&&v.lazy.onTransitionEnd(),e&&(v.emit("onTransitionEnd",v),v.activeIndex!==v.previousIndex&&v.emit("onSlideChangeEnd",v)),v.params.hashnav&&v.hashnav&&v.hashnav.setHash()},v.slideNext=function(e,a,t){if(v.params.loop){if(v.animating)return!1;v.fixLoop();{v.container[0].clientLeft}return v.slideTo(v.activeIndex+v.params.slidesPerGroup,a,e,t)}return v.slideTo(v.activeIndex+v.params.slidesPerGroup,a,e,t)},v._slideNext=function(e){return v.slideNext(!0,e,!0)},v.slidePrev=function(e,a,t){if(v.params.loop){if(v.animating)return!1;v.fixLoop();{v.container[0].clientLeft}return v.slideTo(v.activeIndex-1,a,e,t)}return v.slideTo(v.activeIndex-1,a,e,t)},v._slidePrev=function(e){return v.slidePrev(!0,e,!0)},v.slideReset=function(e,a,t){return v.slideTo(v.activeIndex,a,e)},v.setWrapperTransition=function(e,a){v.wrapper.transition(e),"slide"!==v.params.effect&&v.effects[v.params.effect]&&v.effects[v.params.effect].setTransition(e),v.params.parallax&&v.parallax&&v.parallax.setTransition(e),v.params.scrollbar&&v.scrollbar&&v.scrollbar.setTransition(e),v.params.control&&v.controller&&v.controller.setTransition(e,a),v.emit("onSetTransition",v,e)},v.setWrapperTranslate=function(e,a,t){var s=0,i=0,n=0;r()?s=v.rtl?-e:e:i=e,v.params.virtualTranslate||v.wrapper.transform(v.support.transforms3d?"translate3d("+s+"px, "+i+"px, "+n+"px)":"translate("+s+"px, "+i+"px)"),v.translate=r()?s:i,a&&v.updateActiveIndex(),"slide"!==v.params.effect&&v.effects[v.params.effect]&&v.effects[v.params.effect].setTranslate(v.translate),v.params.parallax&&v.parallax&&v.parallax.setTranslate(v.translate),v.params.scrollbar&&v.scrollbar&&v.scrollbar.setTranslate(v.translate),v.params.control&&v.controller&&v.controller.setTranslate(v.translate,t),v.emit("onSetTranslate",v,v.translate)},v.getTranslate=function(e,a){var t,s,r,i;return"undefined"==typeof a&&(a="x"),v.params.virtualTranslate?v.rtl?-v.translate:v.translate:(r=window.getComputedStyle(e,null),window.WebKitCSSMatrix?i=new window.WebKitCSSMatrix("none"===r.webkitTransform?"":r.webkitTransform):(i=r.MozTransform||r.OTransform||r.MsTransform||r.msTransform||r.transform||r.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),t=i.toString().split(",")),"x"===a&&(s=window.WebKitCSSMatrix?i.m41:parseFloat(16===t.length?t[12]:t[4])),"y"===a&&(s=window.WebKitCSSMatrix?i.m42:parseFloat(16===t.length?t[13]:t[5])),v.rtl&&s&&(s=-s),s||0)},v.getWrapperTranslate=function(e){return"undefined"==typeof e&&(e=r()?"x":"y"),v.getTranslate(v.wrapper[0],e)},v.observers=[],v.initObservers=function(){if(v.params.observeParents)for(var e=v.container.parents(),a=0;a<e.length;a++)l(e[a]);l(v.container[0],{childList:!1}),l(v.wrapper[0],{attributes:!1})},v.disconnectObservers=function(){for(var e=0;e<v.observers.length;e++)v.observers[e].disconnect();v.observers=[]},v.createLoop=function(){v.wrapper.children("."+v.params.slideClass+"."+v.params.slideDuplicateClass).remove();var e=v.wrapper.children("."+v.params.slideClass);"auto"!==v.params.slidesPerView||v.params.loopedSlides||(v.params.loopedSlides=e.length),v.loopedSlides=parseInt(v.params.loopedSlides||v.params.slidesPerView,10),v.loopedSlides=v.loopedSlides+v.params.loopAdditionalSlides,v.loopedSlides>e.length&&(v.loopedSlides=e.length);var t,s=[],r=[];for(e.each(function(t,i){var n=a(this);t<v.loopedSlides&&r.push(i),t<e.length&&t>=e.length-v.loopedSlides&&s.push(i),n.attr("data-swiper-slide-index",t)}),t=0;t<r.length;t++)v.wrapper.append(a(r[t].cloneNode(!0)).addClass(v.params.slideDuplicateClass));for(t=s.length-1;t>=0;t--)v.wrapper.prepend(a(s[t].cloneNode(!0)).addClass(v.params.slideDuplicateClass))},v.destroyLoop=function(){v.wrapper.children("."+v.params.slideClass+"."+v.params.slideDuplicateClass).remove(),v.slides.removeAttr("data-swiper-slide-index")},v.fixLoop=function(){var e;v.activeIndex<v.loopedSlides?(e=v.slides.length-3*v.loopedSlides+v.activeIndex,e+=v.loopedSlides,v.slideTo(e,0,!1,!0)):("auto"===v.params.slidesPerView&&v.activeIndex>=2*v.loopedSlides||v.activeIndex>v.slides.length-2*v.params.slidesPerView)&&(e=-v.slides.length+v.activeIndex+v.loopedSlides,e+=v.loopedSlides,v.slideTo(e,0,!1,!0))},v.appendSlide=function(e){if(v.params.loop&&v.destroyLoop(),"object"==typeof e&&e.length)for(var a=0;a<e.length;a++)e[a]&&v.wrapper.append(e[a]);else v.wrapper.append(e);v.params.loop&&v.createLoop(),v.params.observer&&v.support.observer||v.update(!0)},v.prependSlide=function(e){v.params.loop&&v.destroyLoop();var a=v.activeIndex+1;if("object"==typeof e&&e.length){for(var t=0;t<e.length;t++)e[t]&&v.wrapper.prepend(e[t]);a=v.activeIndex+e.length}else v.wrapper.prepend(e);v.params.loop&&v.createLoop(),v.params.observer&&v.support.observer||v.update(!0),v.slideTo(a,0,!1)},v.removeSlide=function(e){v.params.loop&&(v.destroyLoop(),v.slides=v.wrapper.children("."+v.params.slideClass));var a,t=v.activeIndex;if("object"==typeof e&&e.length){for(var s=0;s<e.length;s++)a=e[s],v.slides[a]&&v.slides.eq(a).remove(),t>a&&t--;t=Math.max(t,0)}else a=e,v.slides[a]&&v.slides.eq(a).remove(),t>a&&t--,t=Math.max(t,0);v.params.loop&&v.createLoop(),v.params.observer&&v.support.observer||v.update(!0),v.params.loop?v.slideTo(t+v.loopedSlides,0,!1):v.slideTo(t,0,!1)},v.removeAllSlides=function(){for(var e=[],a=0;a<v.slides.length;a++)e.push(a);v.removeSlide(e)},v.effects={fade:{setTranslate:function(){for(var e=0;e<v.slides.length;e++){var a=v.slides.eq(e),t=a[0].swiperSlideOffset,s=-t;v.params.virtualTranslate||(s-=v.translate);var i=0;r()||(i=s,s=0);var n=v.params.fade.crossFade?Math.max(1-Math.abs(a[0].progress),0):1+Math.min(Math.max(a[0].progress,-1),0);a.css({opacity:n}).transform("translate3d("+s+"px, "+i+"px, 0px)")}},setTransition:function(e){if(v.slides.transition(e),v.params.virtualTranslate&&0!==e){var a=!1;v.slides.transitionEnd(function(){if(!a&&v){a=!0,v.animating=!1;for(var e=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],t=0;t<e.length;t++)v.wrapper.trigger(e[t])}})}}},cube:{setTranslate:function(){var e,t=0;v.params.cube.shadow&&(r()?(e=v.wrapper.find(".swiper-cube-shadow"),0===e.length&&(e=a('<div class="swiper-cube-shadow"></div>'),v.wrapper.append(e)),e.css({height:v.width+"px"})):(e=v.container.find(".swiper-cube-shadow"),0===e.length&&(e=a('<div class="swiper-cube-shadow"></div>'),v.container.append(e))));for(var s=0;s<v.slides.length;s++){var i=v.slides.eq(s),n=90*s,o=Math.floor(n/360);v.rtl&&(n=-n,o=Math.floor(-n/360));var l=Math.max(Math.min(i[0].progress,1),-1),p=0,d=0,u=0;s%4===0?(p=4*-o*v.size,u=0):(s-1)%4===0?(p=0,u=4*-o*v.size):(s-2)%4===0?(p=v.size+4*o*v.size,u=v.size):(s-3)%4===0&&(p=-v.size,u=3*v.size+4*v.size*o),v.rtl&&(p=-p),r()||(d=p,p=0);var c="rotateX("+(r()?0:-n)+"deg) rotateY("+(r()?n:0)+"deg) translate3d("+p+"px, "+d+"px, "+u+"px)";if(1>=l&&l>-1&&(t=90*s+90*l,v.rtl&&(t=90*-s-90*l)),i.transform(c),v.params.cube.slideShadows){var m=i.find(r()?".swiper-slide-shadow-left":".swiper-slide-shadow-top"),f=i.find(r()?".swiper-slide-shadow-right":".swiper-slide-shadow-bottom");0===m.length&&(m=a('<div class="swiper-slide-shadow-'+(r()?"left":"top")+'"></div>'),i.append(m)),0===f.length&&(f=a('<div class="swiper-slide-shadow-'+(r()?"right":"bottom")+'"></div>'),i.append(f));{i[0].progress}m.length&&(m[0].style.opacity=-i[0].progress),f.length&&(f[0].style.opacity=i[0].progress)}}if(v.wrapper.css({"-webkit-transform-origin":"50% 50% -"+v.size/2+"px","-moz-transform-origin":"50% 50% -"+v.size/2+"px","-ms-transform-origin":"50% 50% -"+v.size/2+"px","transform-origin":"50% 50% -"+v.size/2+"px"}),v.params.cube.shadow)if(r())e.transform("translate3d(0px, "+(v.width/2+v.params.cube.shadowOffset)+"px, "+-v.width/2+"px) rotateX(90deg) rotateZ(0deg) scale("+v.params.cube.shadowScale+")");else{var h=Math.abs(t)-90*Math.floor(Math.abs(t)/90),g=1.5-(Math.sin(2*h*Math.PI/360)/2+Math.cos(2*h*Math.PI/360)/2),w=v.params.cube.shadowScale,y=v.params.cube.shadowScale/g,x=v.params.cube.shadowOffset;e.transform("scale3d("+w+", 1, "+y+") translate3d(0px, "+(v.height/2+x)+"px, "+-v.height/2/y+"px) rotateX(-90deg)")}var b=v.isSafari||v.isUiWebView?-v.size/2:0;v.wrapper.transform("translate3d(0px,0,"+b+"px) rotateX("+(r()?0:t)+"deg) rotateY("+(r()?-t:0)+"deg)")},setTransition:function(e){v.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),v.params.cube.shadow&&!r()&&v.container.find(".swiper-cube-shadow").transition(e)}},coverflow:{setTranslate:function(){for(var e=v.translate,t=r()?-e+v.width/2:-e+v.height/2,s=r()?v.params.coverflow.rotate:-v.params.coverflow.rotate,i=v.params.coverflow.depth,n=0,o=v.slides.length;o>n;n++){var l=v.slides.eq(n),p=v.slidesSizesGrid[n],d=l[0].swiperSlideOffset,u=(t-d-p/2)/p*v.params.coverflow.modifier,c=r()?s*u:0,m=r()?0:s*u,f=-i*Math.abs(u),h=r()?0:v.params.coverflow.stretch*u,g=r()?v.params.coverflow.stretch*u:0;Math.abs(g)<.001&&(g=0),Math.abs(h)<.001&&(h=0),Math.abs(f)<.001&&(f=0),Math.abs(c)<.001&&(c=0),Math.abs(m)<.001&&(m=0);var w="translate3d("+g+"px,"+h+"px,"+f+"px) rotateX("+m+"deg) rotateY("+c+"deg)";if(l.transform(w),l[0].style.zIndex=-Math.abs(Math.round(u))+1,v.params.coverflow.slideShadows){var y=l.find(r()?".swiper-slide-shadow-left":".swiper-slide-shadow-top"),x=l.find(r()?".swiper-slide-shadow-right":".swiper-slide-shadow-bottom");0===y.length&&(y=a('<div class="swiper-slide-shadow-'+(r()?"left":"top")+'"></div>'),l.append(y)),0===x.length&&(x=a('<div class="swiper-slide-shadow-'+(r()?"right":"bottom")+'"></div>'),l.append(x)),y.length&&(y[0].style.opacity=u>0?u:0),x.length&&(x[0].style.opacity=-u>0?-u:0)}}if(v.browser.ie){var b=v.wrapper[0].style;b.perspectiveOrigin=t+"px 50%"}},setTransition:function(e){v.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}}},v.lazy={initialImageLoaded:!1,loadImageInSlide:function(e,t){if("undefined"!=typeof e&&("undefined"==typeof t&&(t=!0),0!==v.slides.length)){var s=v.slides.eq(e),r=s.find(".swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)");!s.hasClass("swiper-lazy")||s.hasClass("swiper-lazy-loaded")||s.hasClass("swiper-lazy-loading")||r.add(s[0]),0!==r.length&&r.each(function(){var e=a(this);e.addClass("swiper-lazy-loading");var r=e.attr("data-background"),i=e.attr("data-src");v.loadImage(e[0],i||r,!1,function(){if(r?(e.css("background-image","url("+r+")"),e.removeAttr("data-background")):(e.attr("src",i),e.removeAttr("data-src")),e.addClass("swiper-lazy-loaded").removeClass("swiper-lazy-loading"),s.find(".swiper-lazy-preloader, .preloader").remove(),v.params.loop&&t){var a=s.attr("data-swiper-slide-index");if(s.hasClass(v.params.slideDuplicateClass)){var n=v.wrapper.children('[data-swiper-slide-index="'+a+'"]:not(.'+v.params.slideDuplicateClass+")");v.lazy.loadImageInSlide(n.index(),!1)}else{var o=v.wrapper.children("."+v.params.slideDuplicateClass+'[data-swiper-slide-index="'+a+'"]');v.lazy.loadImageInSlide(o.index(),!1)}}v.emit("onLazyImageReady",v,s[0],e[0])}),v.emit("onLazyImageLoad",v,s[0],e[0])})}},load:function(){var e;if(v.params.watchSlidesVisibility)v.wrapper.children("."+v.params.slideVisibleClass).each(function(){v.lazy.loadImageInSlide(a(this).index())});else if(v.params.slidesPerView>1)for(e=v.activeIndex;e<v.activeIndex+v.params.slidesPerView;e++)v.slides[e]&&v.lazy.loadImageInSlide(e);else v.lazy.loadImageInSlide(v.activeIndex);if(v.params.lazyLoadingInPrevNext)if(v.params.slidesPerView>1){for(e=v.activeIndex+v.params.slidesPerView;e<v.activeIndex+v.params.slidesPerView+v.params.slidesPerView;e++)v.slides[e]&&v.lazy.loadImageInSlide(e);for(e=v.activeIndex-v.params.slidesPerView;e<v.activeIndex;e++)v.slides[e]&&v.lazy.loadImageInSlide(e)}else{var t=v.wrapper.children("."+v.params.slideNextClass);t.length>0&&v.lazy.loadImageInSlide(t.index());var s=v.wrapper.children("."+v.params.slidePrevClass);s.length>0&&v.lazy.loadImageInSlide(s.index())}},onTransitionStart:function(){v.params.lazyLoading&&(v.params.lazyLoadingOnTransitionStart||!v.params.lazyLoadingOnTransitionStart&&!v.lazy.initialImageLoaded)&&v.lazy.load()},onTransitionEnd:function(){v.params.lazyLoading&&!v.params.lazyLoadingOnTransitionStart&&v.lazy.load()}},v.scrollbar={set:function(){if(v.params.scrollbar){var e=v.scrollbar;e.track=a(v.params.scrollbar),e.drag=e.track.find(".swiper-scrollbar-drag"),0===e.drag.length&&(e.drag=a('<div class="swiper-scrollbar-drag"></div>'),e.track.append(e.drag)),e.drag[0].style.width="",e.drag[0].style.height="",e.trackSize=r()?e.track[0].offsetWidth:e.track[0].offsetHeight,e.divider=v.size/v.virtualSize,e.moveDivider=e.divider*(e.trackSize/v.size),e.dragSize=e.trackSize*e.divider,r()?e.drag[0].style.width=e.dragSize+"px":e.drag[0].style.height=e.dragSize+"px",e.track[0].style.display=e.divider>=1?"none":"",v.params.scrollbarHide&&(e.track[0].style.opacity=0)}},setTranslate:function(){if(v.params.scrollbar){var e,a=v.scrollbar,t=(v.translate||0,a.dragSize);e=(a.trackSize-a.dragSize)*v.progress,v.rtl&&r()?(e=-e,e>0?(t=a.dragSize-e,e=0):-e+a.dragSize>a.trackSize&&(t=a.trackSize+e)):0>e?(t=a.dragSize+e,e=0):e+a.dragSize>a.trackSize&&(t=a.trackSize-e),r()?(a.drag.transform(v.support.transforms3d?"translate3d("+e+"px, 0, 0)":"translateX("+e+"px)"),a.drag[0].style.width=t+"px"):(a.drag.transform(v.support.transforms3d?"translate3d(0px, "+e+"px, 0)":"translateY("+e+"px)"),a.drag[0].style.height=t+"px"),v.params.scrollbarHide&&(clearTimeout(a.timeout),a.track[0].style.opacity=1,a.timeout=setTimeout(function(){a.track[0].style.opacity=0,a.track.transition(400)},1e3))}},setTransition:function(e){v.params.scrollbar&&v.scrollbar.drag.transition(e)}},v.controller={LinearSpline:function(e,a){this.x=e,this.y=a,this.lastIndex=e.length-1;{var t,s;this.x.length}this.interpolate=function(e){return e?(s=r(this.x,e),t=s-1,(e-this.x[t])*(this.y[s]-this.y[t])/(this.x[s]-this.x[t])+this.y[t]):0};var r=function(){var e,a,t;return function(s,r){for(a=-1,e=s.length;e-a>1;)s[t=e+a>>1]<=r?a=t:e=t;return e}}()},getInterpolateFunction:function(e){v.controller.spline||(v.controller.spline=v.params.loop?new v.controller.LinearSpline(v.slidesGrid,e.slidesGrid):new v.controller.LinearSpline(v.snapGrid,e.snapGrid))},setTranslate:function(e,a){function s(a){e=a.rtl&&"horizontal"===a.params.direction?-v.translate:v.translate,"slide"===v.params.controlBy&&(v.controller.getInterpolateFunction(a),i=-v.controller.spline.interpolate(-e)),i&&"container"!==v.params.controlBy||(r=(a.maxTranslate()-a.minTranslate())/(v.maxTranslate()-v.minTranslate()),i=(e-v.minTranslate())*r+a.minTranslate()),v.params.controlInverse&&(i=a.maxTranslate()-i),a.updateProgress(i),a.setWrapperTranslate(i,!1,v),a.updateActiveIndex()}var r,i,n=v.params.control;if(v.isArray(n))for(var o=0;o<n.length;o++)n[o]!==a&&n[o]instanceof t&&s(n[o]);else n instanceof t&&a!==n&&s(n)},setTransition:function(e,a){function s(a){a.setWrapperTransition(e,v),0!==e&&(a.onTransitionStart(),a.wrapper.transitionEnd(function(){i&&(a.params.loop&&"slide"===v.params.controlBy&&a.fixLoop(),a.onTransitionEnd())}))}var r,i=v.params.control;if(v.isArray(i))for(r=0;r<i.length;r++)i[r]!==a&&i[r]instanceof t&&s(i[r]);else i instanceof t&&a!==i&&s(i)}},v.hashnav={init:function(){if(v.params.hashnav){v.hashnav.initialized=!0;var e=document.location.hash.replace("#","");if(e)for(var a=0,t=0,s=v.slides.length;s>t;t++){var r=v.slides.eq(t),i=r.attr("data-hash");if(i===e&&!r.hasClass(v.params.slideDuplicateClass)){var n=r.index();v.slideTo(n,a,v.params.runCallbacksOnInit,!0)}}}},setHash:function(){v.hashnav.initialized&&v.params.hashnav&&(document.location.hash=v.slides.eq(v.activeIndex).attr("data-hash")||"")}},v.disableKeyboardControl=function(){a(document).off("keydown",p)},v.enableKeyboardControl=function(){a(document).on("keydown",p)},v.mousewheel={event:!1,lastScrollTime:(new window.Date).getTime()},v.params.mousewheelControl){try{new window.WheelEvent("wheel"),v.mousewheel.event="wheel"}catch(L){}v.mousewheel.event||void 0===document.onmousewheel||(v.mousewheel.event="mousewheel"),v.mousewheel.event||(v.mousewheel.event="DOMMouseScroll")}v.disableMousewheelControl=function(){return v.mousewheel.event?(v.container.off(v.mousewheel.event,d),!0):!1},v.enableMousewheelControl=function(){return v.mousewheel.event?(v.container.on(v.mousewheel.event,d),!0):!1},v.parallax={setTranslate:function(){v.container.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){u(this,v.progress)}),v.slides.each(function(){var e=a(this);e.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var a=Math.min(Math.max(e[0].progress,-1),1);u(this,a)})})},setTransition:function(e){"undefined"==typeof e&&(e=v.params.speed),v.container.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var t=a(this),s=parseInt(t.attr("data-swiper-parallax-duration"),10)||e;0===e&&(s=0),t.transition(s)})}},v._plugins=[];for(var B in v.plugins){var O=v.plugins[B](v,v.params[B]);O&&v._plugins.push(O)}return v.callPlugins=function(e){for(var a=0;a<v._plugins.length;a++)e in v._plugins[a]&&v._plugins[a][e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},v.emitterEventListeners={},v.emit=function(e){v.params[e]&&v.params[e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);var a;if(v.emitterEventListeners[e])for(a=0;a<v.emitterEventListeners[e].length;a++)v.emitterEventListeners[e][a](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);v.callPlugins&&v.callPlugins(e,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},v.on=function(e,a){return e=c(e),v.emitterEventListeners[e]||(v.emitterEventListeners[e]=[]),v.emitterEventListeners[e].push(a),v},v.off=function(e,a){var t;if(e=c(e),"undefined"==typeof a)return v.emitterEventListeners[e]=[],v;if(v.emitterEventListeners[e]&&0!==v.emitterEventListeners[e].length){for(t=0;t<v.emitterEventListeners[e].length;t++)v.emitterEventListeners[e][t]===a&&v.emitterEventListeners[e].splice(t,1);return v}},v.once=function(e,a){e=c(e);var t=function(){a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),v.off(e,t)};return v.on(e,t),v},v.a11y={makeFocusable:function(e){return e.attr("tabIndex","0"),e},addRole:function(e,a){return e.attr("role",a),e},addLabel:function(e,a){return e.attr("aria-label",a),e},disable:function(e){return e.attr("aria-disabled",!0),e},enable:function(e){return e.attr("aria-disabled",!1),e},onEnterKey:function(e){13===e.keyCode&&(a(e.target).is(v.params.nextButton)?(v.onClickNext(e),v.a11y.notify(v.isEnd?v.params.lastSlideMessage:v.params.nextSlideMessage)):a(e.target).is(v.params.prevButton)&&(v.onClickPrev(e),v.a11y.notify(v.isBeginning?v.params.firstSlideMessage:v.params.prevSlideMessage)),a(e.target).is("."+v.params.bulletClass)&&a(e.target)[0].click())},liveRegion:a('<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>'),notify:function(e){var a=v.a11y.liveRegion;0!==a.length&&(a.html(""),a.html(e))},init:function(){if(v.params.nextButton){var e=a(v.params.nextButton);v.a11y.makeFocusable(e),v.a11y.addRole(e,"button"),v.a11y.addLabel(e,v.params.nextSlideMessage)}if(v.params.prevButton){var t=a(v.params.prevButton);v.a11y.makeFocusable(t),v.a11y.addRole(t,"button"),v.a11y.addLabel(t,v.params.prevSlideMessage)}a(v.container).append(v.a11y.liveRegion)},initPagination:function(){v.params.pagination&&v.params.paginationClickable&&v.bullets&&v.bullets.length&&v.bullets.each(function(){var e=a(this);v.a11y.makeFocusable(e),v.a11y.addRole(e,"button"),v.a11y.addLabel(e,v.params.paginationBulletMessage.replace(/{{index}}/,e.index()+1))})},destroy:function(){v.a11y.liveRegion&&v.a11y.liveRegion.length>0&&v.a11y.liveRegion.remove()}},v.init=function(){v.params.loop&&v.createLoop(),v.updateContainerSize(),v.updateSlidesSize(),v.updatePagination(),v.params.scrollbar&&v.scrollbar&&v.scrollbar.set(),"slide"!==v.params.effect&&v.effects[v.params.effect]&&(v.params.loop||v.updateProgress(),v.effects[v.params.effect].setTranslate()),v.params.loop?v.slideTo(v.params.initialSlide+v.loopedSlides,0,v.params.runCallbacksOnInit):(v.slideTo(v.params.initialSlide,0,v.params.runCallbacksOnInit),0===v.params.initialSlide&&(v.parallax&&v.params.parallax&&v.parallax.setTranslate(),v.lazy&&v.params.lazyLoading&&(v.lazy.load(),v.lazy.initialImageLoaded=!0))),v.attachEvents(),v.params.observer&&v.support.observer&&v.initObservers(),v.params.preloadImages&&!v.params.lazyLoading&&v.preloadImages(),v.params.autoplay&&v.startAutoplay(),v.params.keyboardControl&&v.enableKeyboardControl&&v.enableKeyboardControl(),v.params.mousewheelControl&&v.enableMousewheelControl&&v.enableMousewheelControl(),v.params.hashnav&&v.hashnav&&v.hashnav.init(),v.params.a11y&&v.a11y&&v.a11y.init(),v.emit("onInit",v)},v.cleanupStyles=function(){v.container.removeClass(v.classNames.join(" ")).removeAttr("style"),v.wrapper.removeAttr("style"),v.slides&&v.slides.length&&v.slides.removeClass([v.params.slideVisibleClass,v.params.slideActiveClass,v.params.slideNextClass,v.params.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-column").removeAttr("data-swiper-row"),v.paginationContainer&&v.paginationContainer.length&&v.paginationContainer.removeClass(v.params.paginationHiddenClass),v.bullets&&v.bullets.length&&v.bullets.removeClass(v.params.bulletActiveClass),v.params.prevButton&&a(v.params.prevButton).removeClass(v.params.buttonDisabledClass),v.params.nextButton&&a(v.params.nextButton).removeClass(v.params.buttonDisabledClass),v.params.scrollbar&&v.scrollbar&&(v.scrollbar.track&&v.scrollbar.track.length&&v.scrollbar.track.removeAttr("style"),v.scrollbar.drag&&v.scrollbar.drag.length&&v.scrollbar.drag.removeAttr("style"))},v.destroy=function(e,a){v.detachEvents(),v.stopAutoplay(),v.params.loop&&v.destroyLoop(),a&&v.cleanupStyles(),v.disconnectObservers(),v.params.keyboardControl&&v.disableKeyboardControl&&v.disableKeyboardControl(),v.params.mousewheelControl&&v.disableMousewheelControl&&v.disableMousewheelControl(),v.params.a11y&&v.a11y&&v.a11y.destroy(),v.emit("onDestroy"),e!==!1&&(v=null)},v.init(),v}};t.prototype={isSafari:function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}(),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},browser:{ie:window.navigator.pointerEnabled||window.navigator.msPointerEnabled,ieTouch:window.navigator.msPointerEnabled&&window.navigator.msMaxTouchPoints>1||window.navigator.pointerEnabled&&window.navigator.maxTouchPoints>1},device:function(){var e=navigator.userAgent,a=e.match(/(Android);?[\s\/]+([\d.]+)?/),t=e.match(/(iPad).*OS\s([\d_]+)/),s=e.match(/(iPod)(.*OS\s([\d_]+))?/),r=!t&&e.match(/(iPhone\sOS)\s([\d_]+)/);return{ios:t||r||s,android:a}}(),support:{touch:window.Modernizr&&Modernizr.touch===!0||function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}(),transforms3d:window.Modernizr&&Modernizr.csstransforms3d===!0||function(){var e=document.createElement("div").style;return"webkitPerspective"in e||"MozPerspective"in e||"OPerspective"in e||"MsPerspective"in e||"perspective"in e}(),flexbox:function(){for(var e=document.createElement("div").style,a="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" "),t=0;t<a.length;t++)if(a[t]in e)return!0}(),observer:function(){return"MutationObserver"in window||"WebkitMutationObserver"in window}()},plugins:{}};for(var s=["jQuery","Zepto","Dom7"],r=0;r<s.length;r++)window[s[r]]&&e(window[s[r]]);var i;i="undefined"==typeof Dom7?window.Dom7||window.Zepto||window.jQuery:Dom7,i&&("transitionEnd"in i.fn||(i.fn.transitionEnd=function(e){function a(i){if(i.target===this)for(e.call(this,i),t=0;t<s.length;t++)r