Gmedia Photo Gallery - Version 1.4.2

Version Description

  • Fixed music and video Custom Cover when image url is set instead of ID
  • Fixed View Original link on Gmedia Library page
  • Added option to add Gmedia button on custom posts
  • Added option to add image Exif data to image description via Batch Edit
  • If mp3 have ID3Tag image cover in it, this image shows automatically. (You need update metadata for music files)
  • Small changes on Gmedia Library page
  • Small CSS changes on admin pages
  • Music player module updated to new version
Download this release

Release Info

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

Code changes from version 1.3.7 to 1.4.2

access.php CHANGED
@@ -16,6 +16,25 @@ if ( ! $gmedia_app ) {
16
  global $gmCore;
17
  $out = array();
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  if ( isset( $_FILES['userfile']['name'] ) ) {
20
  $globaldata = isset( $_POST['account'] ) ? $_POST['account'] : false;
21
  if ( $globaldata ) {
@@ -246,7 +265,7 @@ function gmedia_ios_app_library_data( $data = array( 'site', 'authors', 'filter'
246
  $gmediaTerms[ $i ]->user = array( 'id' => $author_id, 'displayname' => $display_name, 'firstname' => $first_name, 'lastname' => $last_name );
247
 
248
  if ( $term->count ) {
249
- $args = array( 'no_found_rows' => true, 'per_page' => 1, 'album__in' => array( $term->term_id ) );
250
  $termItems = $gmDB->get_gmedias( $args );
251
  $gmediaTerms[ $i ]->thumbnail = $gmCore->gm_get_media_image( $termItems[0], 'thumb', false );
252
  }
@@ -584,7 +603,7 @@ function gmedia_ios_app_processor( $action, $data, $filter = true ) {
584
  $filter = $filter ? gmedia_ios_app_library_data( array( 'filter' ) ) : array();
585
 
586
  $args = array(
587
- 'mime_type' => null,
588
  'orderby' => 'ID',
589
  'order' => 'DESC',
590
  'per_page' => 100,
@@ -938,7 +957,3 @@ function gmedia_ios_app_counters( $data ) {
938
 
939
  header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
940
  echo json_encode( $out );
941
-
942
- /*if(isset($_GET['test'])){
943
- echo "\n\n".print_r($out, true);
944
- }*/
16
  global $gmCore;
17
  $out = array();
18
 
19
+ if(isset($_GET['service-link'])){
20
+ $transient_key = preg_replace('/[^A-Za-z0-9]/', '', $_GET['service-link']);
21
+ if(($result = get_transient($transient_key))){
22
+ //$result['mypgc_REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; //216.70.94.77
23
+ header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
24
+ echo json_encode($result);
25
+ }
26
+ die();
27
+ }
28
+
29
+ $gmedia_options = get_option('gmediaOptions');
30
+ if(empty($gmedia_options['mobile_app'])){
31
+ $out['error'] = array( 'code' => 'app_inactive', 'message' => 'Service not enabled/activated for this site' );
32
+ header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
33
+ echo json_encode( $out );
34
+ die();
35
+ }
36
+
37
+
38
  if ( isset( $_FILES['userfile']['name'] ) ) {
39
  $globaldata = isset( $_POST['account'] ) ? $_POST['account'] : false;
40
  if ( $globaldata ) {
265
  $gmediaTerms[ $i ]->user = array( 'id' => $author_id, 'displayname' => $display_name, 'firstname' => $first_name, 'lastname' => $last_name );
266
 
267
  if ( $term->count ) {
268
+ $args = array( 'no_found_rows' => true, 'mime_type' => 'image/*', 'per_page' => 1, 'album__in' => array( $term->term_id ) );
269
  $termItems = $gmDB->get_gmedias( $args );
270
  $gmediaTerms[ $i ]->thumbnail = $gmCore->gm_get_media_image( $termItems[0], 'thumb', false );
271
  }
603
  $filter = $filter ? gmedia_ios_app_library_data( array( 'filter' ) ) : array();
604
 
605
  $args = array(
606
+ 'mime_type' => 'image/*',
607
  'orderby' => 'ID',
608
  'order' => 'DESC',
609
  'per_page' => 100,
957
 
958
  header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
959
  echo json_encode( $out );
 
 
 
 
admin/addmedia.php CHANGED
@@ -118,7 +118,7 @@ function gmedia_upload_files() {
118
  }
119
  ?>
120
  <label><?php _e( 'Assign Category', 'gmLang' ); ?>
121
- <small><?php _e( '(for images only)' ) ?></small>
122
  </label>
123
  <select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
124
  <option value=""><?php _e( 'Uncategorized', 'gmLang' ); ?></option>
@@ -339,7 +339,7 @@ function gmedia_import() {
339
  }
340
  ?>
341
  <label><?php _e( 'Assign Category', 'gmLang' ); ?>
342
- <small><?php _e( '(for images only)' ) ?></small>
343
  </label>
344
  <select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
345
  <option value=""><?php _e( 'Uncategorized', 'gmLang' ); ?></option>
@@ -436,12 +436,12 @@ function gmedia_import() {
436
  <input type="hidden" id="folderpath" name="path" value="/"/>
437
 
438
  <div class="tab-inside">
439
- <h5><?php _e( 'Sever folders' ) ?>:</h5>
440
 
441
  <div id="file_browser"></div>
442
  </div>
443
  <div class="tab-footer">
444
- <div class="checkbox pull-left"><label><input type="checkbox" name="delete_source" value="1"/> <?php _e( 'delete source files after importing' ) ?>
445
  </label></div>
446
  <button class="pull-right btn btn-info gmedia-import" type="button" name="import-folder"><?php _e( 'Import folder', 'gmLang' ); ?></button>
447
  </div>
@@ -463,12 +463,12 @@ function gmedia_import() {
463
  <?php if ( ! empty( $import['flagallery'] ) ) { ?>
464
  <fieldset id="import_flagallery" class="tab-pane">
465
  <?php
466
- $import['flagallery'] = $wpdb->get_results( "SELECT gid, title, galdesc FROM `{$wpdb->prefix}flag_gallery`" );
467
  if ( ! empty( $import['flagallery'] ) ) {
468
  ?>
469
  <div class="tab-inside">
470
- <p><?php _e( 'If Album is not specified, then gallery name will be used as Album' ) ?></p>
471
- <h5><?php _e( 'Flagallery Galleries' ) ?>:
472
  <small>(<a href="#toggle-flaggalery" class="gm-toggle-cb"><?php _e( 'Toggle checkboxes', 'gmLang' ) ?></a>)</small>
473
  </h5>
474
  <div id="toggle-flaggalery">
@@ -495,12 +495,12 @@ function gmedia_import() {
495
  <?php if ( ! empty( $import['nextgen'] ) ) { ?>
496
  <fieldset id="import_nextgen" class="tab-pane">
497
  <?php
498
- $import['nextgen'] = $wpdb->get_results( "SELECT gid, title, galdesc FROM `{$wpdb->prefix}ngg_gallery`" );
499
  if ( ! empty( $import['nextgen'] ) ) {
500
  ?>
501
  <div class="tab-inside">
502
- <p><?php _e( 'If Album is not specified, then gallery name will be used as Album' ) ?></p>
503
- <h5><?php _e( 'Flagallery Galleries' ) ?>:
504
  <small>(<a href="#toggle-nextgen" class="gm-toggle-cb"><?php _e( 'Toggle checkboxes', 'gmLang' ) ?></a>)</small>
505
  </h5>
506
  <div id="toggle-nextgen">
@@ -533,7 +533,7 @@ function gmedia_import() {
533
  <div class="modal-content">
534
  <div class="modal-header">
535
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
536
- <h4 class="modal-title"><?php _e( 'Import' ); ?></h4>
537
  </div>
538
  <div class="modal-body">
539
  <script type="text/javascript">
118
  }
119
  ?>
120
  <label><?php _e( 'Assign Category', 'gmLang' ); ?>
121
+ <small><?php _e( '(for images only)', 'gmLang' ) ?></small>
122
  </label>
123
  <select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
124
  <option value=""><?php _e( 'Uncategorized', 'gmLang' ); ?></option>
339
  }
340
  ?>
341
  <label><?php _e( 'Assign Category', 'gmLang' ); ?>
342
+ <small><?php _e( '(for images only)', 'gmLang' ) ?></small>
343
  </label>
344
  <select id="gmedia_category" name="terms[gmedia_category]" class="form-control input-sm">
345
  <option value=""><?php _e( 'Uncategorized', 'gmLang' ); ?></option>
436
  <input type="hidden" id="folderpath" name="path" value="/"/>
437
 
438
  <div class="tab-inside">
439
+ <h5><?php _e( 'Sever folders', 'gmLang' ) ?>:</h5>
440
 
441
  <div id="file_browser"></div>
442
  </div>
443
  <div class="tab-footer">
444
+ <div class="checkbox pull-left"><label><input type="checkbox" name="delete_source" value="1"/> <?php _e( 'delete source files after importing', 'gmLang' ) ?>
445
  </label></div>
446
  <button class="pull-right btn btn-info gmedia-import" type="button" name="import-folder"><?php _e( 'Import folder', 'gmLang' ); ?></button>
447
  </div>
463
  <?php if ( ! empty( $import['flagallery'] ) ) { ?>
464
  <fieldset id="import_flagallery" class="tab-pane">
465
  <?php
466
+ $import['flagallery'] = $wpdb->get_results( "SELECT gid, title, galdesc FROM {$wpdb->prefix}flag_gallery" );
467
  if ( ! empty( $import['flagallery'] ) ) {
468
  ?>
469
  <div class="tab-inside">
470
+ <p><?php _e( 'If Album is not specified, then gallery name will be used as Album', 'gmLang' ) ?></p>
471
+ <h5><?php _e( 'Flagallery Galleries', 'gmLang' ) ?>:
472
  <small>(<a href="#toggle-flaggalery" class="gm-toggle-cb"><?php _e( 'Toggle checkboxes', 'gmLang' ) ?></a>)</small>
473
  </h5>
474
  <div id="toggle-flaggalery">
495
  <?php if ( ! empty( $import['nextgen'] ) ) { ?>
496
  <fieldset id="import_nextgen" class="tab-pane">
497
  <?php
498
+ $import['nextgen'] = $wpdb->get_results( "SELECT gid, title, galdesc FROM {$wpdb->prefix}ngg_gallery" );
499
  if ( ! empty( $import['nextgen'] ) ) {
500
  ?>
501
  <div class="tab-inside">
502
+ <p><?php _e( 'If Album is not specified, then gallery name will be used as Album', 'gmLang' ) ?></p>
503
+ <h5><?php _e( 'NextGen Galleries', 'gmLang' ) ?>:
504
  <small>(<a href="#toggle-nextgen" class="gm-toggle-cb"><?php _e( 'Toggle checkboxes', 'gmLang' ) ?></a>)</small>
505
  </h5>
506
  <div id="toggle-nextgen">
533
  <div class="modal-content">
534
  <div class="modal-header">
535
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
536
+ <h4 class="modal-title"><?php _e( 'Import', 'gmLang' ); ?></h4>
537
  </div>
538
  <div class="modal-body">
539
  <script type="text/javascript">
admin/admin.php CHANGED
@@ -79,7 +79,8 @@ class GmediaAdmin {
79
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Albums, Tags...', 'gmLang' ), __( 'Albums, Tags...', 'gmLang' ), 'gmedia_library', 'GrandMedia_Terms', array( &$this, 'shell' ) );
80
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Galleries', 'gmLang' ), __( 'Create/Manage Galleries...', 'gmLang' ), 'gmedia_gallery_manage', 'GrandMedia_Galleries', array( &$this, 'shell' ) );
81
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Modules', 'gmLang' ), __( 'Modules', 'gmLang' ), 'gmedia_gallery_manage', 'GrandMedia_Modules', array( &$this, 'shell' ) );
82
- $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Settings', 'gmLang' ), __( 'Settings', 'gmLang' ), 'gmedia_settings', 'GrandMedia_Settings', array( &$this, 'shell' ) );
 
83
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Wordpress Media Library', 'gmLang' ), __( 'WP Media Library', 'gmLang' ), 'gmedia_import', 'GrandMedia_WordpressLibrary', array( &$this, 'shell' ) );
84
  }
85
 
@@ -202,6 +203,10 @@ class GmediaAdmin {
202
  include_once( dirname( __FILE__ ) . '/settings.php' );
203
  gmSettings();
204
  break;
 
 
 
 
205
  case 'GrandMedia_WordpressLibrary':
206
  include_once( dirname( __FILE__ ) . '/wpmedia.php' );
207
  grandWPMedia();
@@ -313,7 +318,8 @@ class GmediaAdmin {
313
  }
314
  break;
315
  case "GrandMedia_Settings" :
316
- // enqueue jscolor
 
317
  break;
318
  case "GrandMedia_Galleries" :
319
  if ( $gmCore->caps['gmedia_gallery_manage'] && ( isset( $_GET['gallery_module'] ) || isset( $_GET['edit_gallery'] ) ) ) {
79
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Albums, Tags...', 'gmLang' ), __( 'Albums, Tags...', 'gmLang' ), 'gmedia_library', 'GrandMedia_Terms', array( &$this, 'shell' ) );
80
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Galleries', 'gmLang' ), __( 'Create/Manage Galleries...', 'gmLang' ), 'gmedia_gallery_manage', 'GrandMedia_Galleries', array( &$this, 'shell' ) );
81
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Modules', 'gmLang' ), __( 'Modules', 'gmLang' ), 'gmedia_gallery_manage', 'GrandMedia_Modules', array( &$this, 'shell' ) );
82
+ $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Gmedia Settings', 'gmLang' ), __( 'Settings', 'gmLang' ), 'manage_options', 'GrandMedia_Settings', array( &$this, 'shell' ) );
83
+ $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Mobile Application', 'gmLang' ), __( 'Mobile Application', 'gmLang' ), 'gmedia_settings', 'GrandMedia_App', array( &$this, 'shell' ) );
84
  $this->pages[] = add_submenu_page( 'GrandMedia', __( 'Wordpress Media Library', 'gmLang' ), __( 'WP Media Library', 'gmLang' ), 'gmedia_import', 'GrandMedia_WordpressLibrary', array( &$this, 'shell' ) );
85
  }
86
 
203
  include_once( dirname( __FILE__ ) . '/settings.php' );
204
  gmSettings();
205
  break;
206
+ case 'GrandMedia_App':
207
+ include_once( dirname( __FILE__ ) . '/app.php' );
208
+ gmediaApp();
209
+ break;
210
  case 'GrandMedia_WordpressLibrary':
211
  include_once( dirname( __FILE__ ) . '/wpmedia.php' );
212
  grandWPMedia();
318
  }
319
  break;
320
  case "GrandMedia_Settings" :
321
+ case "GrandMedia_App" :
322
+ // under construction
323
  break;
324
  case "GrandMedia_Galleries" :
325
  if ( $gmCore->caps['gmedia_gallery_manage'] && ( isset( $_GET['gallery_module'] ) || isset( $_GET['edit_gallery'] ) ) ) {
admin/ajax.php CHANGED
@@ -900,6 +900,7 @@ function gmedia_get_modal() {
900
  <label><?php _e( 'Description', 'gmLang' ); ?></label>
901
  <select class="form-control input-sm batch_set" name="batch_description">
902
  <option value=""><?php _e( 'Skip. Do not change', 'gmLang' ); ?></option>
 
903
  <option value="empty"><?php _e( 'Empty Description', 'gmLang' ); ?></option>
904
  <option value="custom"><?php _e( 'Custom', 'gmLang' ); ?></option>
905
  </select>
@@ -1486,3 +1487,28 @@ function gmedia_set_post_thumbnail() {
1486
  die( '0' );
1487
  }
1488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
900
  <label><?php _e( 'Description', 'gmLang' ); ?></label>
901
  <select class="form-control input-sm batch_set" name="batch_description">
902
  <option value=""><?php _e( 'Skip. Do not change', 'gmLang' ); ?></option>
903
+ <option value="metadata"><?php _e( 'Add MetaData to Description', 'gmLang' ); ?></option>
904
  <option value="empty"><?php _e( 'Empty Description', 'gmLang' ); ?></option>
905
  <option value="custom"><?php _e( 'Custom', 'gmLang' ); ?></option>
906
  </select>
1487
  die( '0' );
1488
  }
1489
 
1490
+ add_action( 'wp_ajax_gmedia_application', 'gmedia_application' );
1491
+ function gmedia_application() {
1492
+ global $gmCore, $gmProcessor;
1493
+
1494
+ // if nonce is not correct it returns -1
1495
+ check_ajax_referer( 'GmediaService' );
1496
+ if ( !current_user_can( 'manage_options') ) {
1497
+ die( '-1' );
1498
+ }
1499
+
1500
+ $service = $gmCore->_post('service');
1501
+ if(!$service){
1502
+ die('0');
1503
+ }
1504
+ $_data = $gmCore->_post('data');
1505
+ wp_parse_str($_data, $data);
1506
+
1507
+ $result = $gmCore->app_service($service, $data);
1508
+
1509
+ header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true );
1510
+ echo json_encode( $result );
1511
+
1512
+ die();
1513
+ }
1514
+
admin/app.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, $gmProcessor, $gmGallery;
13
+
14
+ $alert = '';
15
+ $btn_state = '';
16
+ if('127.0.0.1' == $_SERVER['SERVER_ADDR']){
17
+ $alert = $gmProcessor->alert('danger', __('Your server is not accessable by iOS application', 'gmLang'));
18
+ $btn_state = ' disabled';
19
+ }
20
+
21
+ $email = $gmGallery->options['site_email']? $gmGallery->options['site_email'] : get_option('admin_email');
22
+ $category = $gmGallery->options['site_category'];
23
+ $site_ID = $gmGallery->options['site_ID'];
24
+ $mobile_app = (int) $gmGallery->options['mobile_app'];
25
+
26
+ ?>
27
+ <form class="panel panel-default" method="post" id="gm_application">
28
+ <div class="panel-heading clearfix">
29
+ <div class="btn-toolbar pull-left gm_service_actions">
30
+ <div class="btn-group<?php if(!$mobile_app){ echo ' hidden'; } ?>">
31
+ <button type="button" name="gmedia_application_deactivate" id="app_deactivate" class="btn btn-danger<?php echo $btn_state; ?>" data-confirm="<?php _e('Disable access to your Gmedia Library via iOS application?') ?>"><?php _e('Disable Service', 'gmLang'); ?></button>
32
+ <button type="button" name="gmedia_application_updateinfo" id="app_updateinfo" class="btn btn-primary<?php echo $btn_state; ?>"><?php _e('Update Info', 'gmLang'); ?></button>
33
+ </div>
34
+ <button type="button" name="gmedia_application_activate" id="app_activate" class="btn btn-primary<?php echo $btn_state; if($mobile_app){ echo ' hidden'; } ?>"><?php _e('Enable Service', 'gmLang'); ?></button>
35
+ </div>
36
+ <?php
37
+ wp_nonce_field('GmediaService');
38
+ ?>
39
+ </div>
40
+ <div class="panel-body" id="gmedia-msg-panel"><?php echo $alert; ?></div>
41
+ <div class="panel-body" id="gm_application_data">
42
+ <?php if(current_user_can('manage_options')){ ?>
43
+ <div class="container-fluid">
44
+ <div class="row">
45
+ <div class="col-xs-7">
46
+ <!--<p><?php echo 'Server address: '.$_SERVER['SERVER_ADDR'];
47
+ echo '<br>Remote address: '.$_SERVER['REMOTE_ADDR'];
48
+ ?></p>-->
49
+ <p><?php _e('On the right side you can see information about your website that will be used by iOS application, so you\'ll be able to manage your Gmedia Library with your smartphone.', 'gmLang'); ?></p>
50
+ <p><?php _e('Download Gmedia iOS application from the App Store to manage your Gmedia Library from iPhone.', 'gmLang'); ?></p>
51
+ <div class="text-center"><img style="max-width:100%;" src="<?php echo $gmCore->gmedia_url; ?>/admin/images/mobile_app.png" />
52
+ <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/images/appstore_button.png" /></a></div>
53
+ </div>
54
+ <div class="col-xs-5">
55
+ <div class="form-group">
56
+ <label><?php _e('Email', 'gmLang') ?>:</label>
57
+ <input type="text" name="email" class="form-control input-sm" value="<?php echo $email; ?>"/>
58
+ </div>
59
+ <div class="form-group">
60
+ <?php
61
+ $term_type = 'gmedia_category';
62
+ $gm_terms = $gmGallery->options['taxonomies'][ $term_type ];
63
+
64
+ $terms_category = '';
65
+ if ( count( $gm_terms ) ) {
66
+ foreach ( $gm_terms as $term_name => $term_title ) {
67
+ $selected_option = ( $category === $term_name ) ? ' selected="selected"' : '';
68
+ $terms_category .= '<option' . $selected_option . ' value="' . $term_name . '">' . esc_html( $term_title ) . '</option>' . "\n";
69
+ }
70
+ }
71
+ ?>
72
+ <label><?php _e( 'Which category fit your site most?', 'gmLang' ); ?></label>
73
+ <select id="gmedia_category" name="category" class="form-control input-sm">
74
+ <option value=""<?php echo $category? '' : ' selected="selected"'; ?>><?php _e( 'Uncategorized', 'gmLang' ); ?></option>
75
+ <?php echo $terms_category; ?>
76
+ </select>
77
+ </div>
78
+ <div class="form-group">
79
+ <label><?php _e('Site URL', 'gmLang') ?>:</label>
80
+ <input type="text" readonly="readonly" name="url" class="form-control input-sm" value="<?php echo home_url(); ?>"/>
81
+ </div>
82
+ <div class="form-group">
83
+ <label><?php _e('Site Title', 'gmLang') ?>:</label>
84
+ <input type="text" readonly="readonly" name="title" class="form-control input-sm" value="<?php bloginfo('name'); ?>"/>
85
+ </div>
86
+ <div class="form-group">
87
+ <label><?php _e('Site Description', 'gmLang') ?>:</label>
88
+ <textarea readonly="readonly" rows="2" cols="10" name="description" class="form-control input-sm"><?php bloginfo('description'); ?></textarea>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+ <script type="text/javascript">
94
+ jQuery(function ($) {
95
+
96
+ function gmedia_application(service){
97
+ var post_data = {
98
+ action: 'gmedia_application',
99
+ service: service,
100
+ data: $('#gm_application_data :input').serialize(),
101
+ _wpnonce: $('#_wpnonce').val()
102
+ };
103
+ $.post(ajaxurl, post_data, function (data, textStatus, jqXHR) {
104
+ console.log(data);
105
+ if (data.error) {
106
+ $('#gmedia-msg-panel').append(data.error);
107
+ } else if(data.message) {
108
+ $('#gmedia-msg-panel').append(data.message);
109
+ }
110
+ if(parseInt(data.mobile_app)){
111
+ $('.gm_service_actions > .btn-group').removeClass('hidden');
112
+ $('#app_activate').addClass('hidden');
113
+ } else{
114
+ $('.gm_service_actions > .btn-group').addClass('hidden');
115
+ $('#app_activate').removeClass('hidden');
116
+ }
117
+ });
118
+ }
119
+
120
+ <?php if($mobile_app){ ?>
121
+ gmedia_application('app_checkstatus');
122
+ <?php } ?>
123
+
124
+ $('.gm_service_actions button').on('click', function(){
125
+ var service = $(this).attr('id');
126
+ gmedia_application(service);
127
+ });
128
+
129
+ });
130
+
131
+ </script>
132
+ <?php } ?>
133
+ </div>
134
+ </form>
135
+ <?php
136
+ }
admin/css/grand-media.css CHANGED
@@ -1,228 +1,730 @@
1
- html { background:#708090; }
2
- #adminmenu #toplevel_page_GrandMedia ul.wp-submenu { display:none; }
3
- #wpfooter { color:#ffffff; }
4
- #wpfooter a { color:lightblue; }
5
- #TB_caption { height:auto; }
6
- a { color:#0074a2; }
7
- input[type="checkbox"] { margin-top:2px; margin-right:2px }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  input::-moz-focus-inner {
9
  border: 0;
10
  padding: 0;
11
- margin-top:-2px;
12
  margin-bottom: -2px;
13
  }
14
- form {margin:0;}
15
- body.gmedia-busy { cursor:wait !important; }
16
- iframe, iframe html { background-color:#ffffff; }
17
- body.gmedia-blank { background-color:#ffffff; height:auto; min-height:100%; padding:0 0 1px; box-sizing: border-box; }
18
- body.gmedia-blank pre { margin:0;padding:0; border:none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  .gmedia-body div#gm-message {
20
- position:absolute;
21
- right:5px; top:5px;
22
- overflow:visible;
23
- z-index:200;
 
24
  }
 
25
  .gmedia-body div#gm-message .gm-message {
26
- text-align:right;
27
  }
28
 
29
-
30
  div#gmedia-container {
31
- font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
32
- margin:30px 5px 10px 0;
33
- position:relative;
34
- z-index:1;
35
- direction:ltr;
36
  }
 
37
  div#gmedia-header {
38
- position:relative;
39
- padding:1px 1px 10px 1px;
40
  }
 
41
  /*noinspection CssInvalidElement*/
42
  div#gmedia-logo {
43
- position:relative;
44
- margin:0 30px 0 15px;
45
- font-size:48px;
46
- text-shadow:1px 1px 4px #000000;
47
- font-family:Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
48
- color:#ffffff;
49
- float:left;
50
- -webkit-text-stroke-width:0.7px;
51
- -webkit-text-stroke-color:#ffffff;
52
- -webkit-font-smoothing:antialiased;
53
- -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none;
54
- cursor:default;
 
 
 
55
  }
 
56
  div#gmedia-logo small {
57
- display:block;
58
- font-size:10px;
59
- margin-top:7px;
60
- text-align:right;
61
- -webkit-text-stroke-width:0;
62
  }
 
63
  div#gmedia-header h2 {
64
- margin:0;
65
- font:italic 24px/35px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
66
- color:#ffffff;
67
  }
68
 
69
- div#gmedia-navbar { font-size:14px; }
 
 
70
 
71
- div.library-author {position:absolute; right:15px; top:-35px; padding: 5px 10px; margin:0}
 
 
 
 
 
 
72
 
73
  form.gmedia-search-form {
74
- float:right;
75
- margin-left:10px;
76
- margin-bottom:4px;
77
- white-space:nowrap;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
- form.gmedia-search-form .form-group { margin:0; display:inline-block; }
80
 
81
- .gmedia-pager { margin-bottom:4px; }
82
- form#gmedia-pager { float:left; width:150px; }
83
  input.pager_current_page {
84
- padding-left:0;
85
- padding-right:0;
86
- text-align:center;
87
- }
88
-
89
- .txt-lg { font-size:120%; line-height:50%; }
90
- a.text-danger{ color:#a94442; }
91
- .btn > input[type="checkbox"] { margin-top:0; width:16px; height:16px; }
92
- .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { background-color: #e8e8e8; }
93
-
94
- .gm-checkgroup { margin-right:20px; }
95
-
96
- .gm-backfade { background-color:rgba(0, 0, 0, 0.1); }
97
-
98
- .dropdown-menu > .disabled{ cursor: not-allowed; }
99
- .dropdown-menu > .disabled > a{ pointer-events: none; }
100
-
101
- div#gm-list-table { font-size:13px; }
102
- .list-group-item.row { position:relative; margin-left:0; margin-right:0; padding-left:0; padding-right:0; }
103
- .list-group-item.d-row { position:relative; color: inherit; }
104
- .no-touch div.list-group-item.d-row:hover { background-color:#fafafa; }
105
- .no-touch form.list-group-item.d-row:hover { background-color:#fcfcfc; }
106
- .list-group-item.d-row.active { color:#444; border-color: #ddd; background-color:rgb(250, 255, 245); box-shadow:inset -1px 0 0 2px rgb(250, 255, 245), inset 7px 0 0 0 #1e8cbe; }
107
- .no-touch .list-group-item.d-row.active:hover { color:#444; border-color: #ddd; background-color:rgb(245, 255, 240); box-shadow:inset -1px 0 0 2px rgb(245, 255, 240), inset 7px 0 0 0 #1e8cbe; }
108
- div#gmedia-container .list-group-item-info { background-color: #d9edf7 !important; }
109
- div#gmedia-container .list-group-item-warning { background-color: #fcf8e3 !important; }
110
- .bg-status-private { background-color: #d9edf7; box-shadow:3px 0 0 5px #d9edf7, -2px 0 0 5px #6fbfff; }
111
- .bg-status-draft { background-color: #fcf8e3; box-shadow:3px 0 0 5px #fcf8e3, -2px 0 0 5px #ffd87c; }
112
-
113
- label.cb_media-object { margin-right:15px; float:left; width:310px; max-width: 100%; }
114
- div.li_media-object { margin-right:15px; padding-left:15px; float:left; width:310px; max-width: 100%; }
115
- .d-row .thumbnail { margin-bottom:0; }
116
- .active .thumbnail { border-color:#428bca; }
117
- .thumbnail { position:relative; display:inline-block; max-width:100%; }
118
- .thumbnail .gmedia-typethumb { position:absolute; right:5px; bottom:7px; height:75px; max-height:60%; width:auto; }
119
-
120
- .media-title { font-weight:bold; }
121
- .media-meta { width:100%; overflow:hidden; text-overflow:ellipsis; /*white-space:nowrap;*/ }
122
- .media-meta .label-default { background-color:#eeeeee; color:#444444; }
123
-
124
- .gmedia_id { position:absolute; right:10px; top:10px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  .no-touch .gmedia_id,
126
- .no-touch .term_id { display:none; }
127
- .term_id { position:absolute; right:0; top:0; padding: 10px 10px 0 0; background-color:#fff; display:none; height:100%; box-shadow: -10px 0 5px -2px #fff; z-index:100; }
128
- .term-list-item.active .term_id { background-color:#428bca; box-shadow: -10px 0 3px -2px #428bca; display: block;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  .no-touch #gm-list-table .list-group-item:hover .gmedia_id,
130
- .no-touch #gm-list-table .list-group-item:hover .term_id { display:block; }
131
-
132
- #gm-list-table .hidden { display:none !important; visibility:hidden !important; }
133
-
134
- form#adv-settings .form-inline .form-group { margin-right:20px; }
135
-
136
- form.changed { }
137
- form.changed.saved { }
138
- form.changed .gm-last-edited { text-decoration:line-through; }
139
- .selectize-input.full input { width: 4px !important; }
140
-
141
- .rel-selected-hide { display:none; }
142
-
143
- div#pluploadUploader { padding:0; }
144
- div#pluploadUploader * { box-sizing:border-box; }
145
- div#pluploadUploader > div > div * { box-sizing:content-box; }
146
- .plupload_container { padding:0; }
147
- div#pluploadUploader_container { min-height: 450px; border-bottom-right-radius: 4px; }
148
- div#pluploadUploader_container .plupload_filelist_footer { border-bottom-right-radius: 4px; }
149
- div.panel-body, div#gmedia-msg-panel { -webkit-transition:all .2s ease-in-out; transition:all .2s ease-in-out; }
150
- div.panel-body:empty, div#gmedia-msg-panel:empty { padding:0; }
151
- div#gmedia-msg-panel .alert { padding:2px 35px 2px 12px; margin-bottom:5px; }
152
- .plupload_content li { margin-bottom:0; }
153
- .progress { position:relative; white-space:nowrap; font-size:12px; line-height:20px; }
154
- .progress-bar { position:absolute; overflow:hidden; }
155
-
156
- .tab-inside { padding: 10px; position:relative; }
157
- .tab-footer { border-top: 1px solid #ddd; padding:20px 10px 0; }
158
-
159
- .selectize-control.input-sm .selectize-input { min-height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.9; border-radius: 3px; }
160
- .selectize-control.input-sm .selectize-input input { font-size: 12px; }
161
- .selectize-control.input-sm .selectize-input:after { right: 10px; }
162
-
163
- .term-list-item {padding-top:0; padding-bottom:0;}
164
- .term-list-item .term-label .checkbox {padding-left:35px; min-height: 40px;}
165
- .term-list-item .term-label .checkbox > input {margin-left:-35px;}
166
- .term-list-item .checkbox input {margin-top:0; margin-right:15px;}
167
- .term-list-item .term-description {padding:1px 0 4px; white-space:nowrap; overflow:hidden; color:#444444;}
168
- .term-list-item .term-description:empty {padding:0;}
169
- .term-list-item .term-images {padding-top:5px; padding-bottom:2px; overflow:hidden; white-space:nowrap;}
170
- .term-list-item .term-images img {position:relative; height:30px; width:auto; background-color:#ffffff;}
171
- .term-list-item .term_info_author {font-size:80%; margin-left:10px;}
172
- .no-touch .term-list-item .term-images img:hover {z-index:100 !important;}
173
-
174
- .edit_tag_form {display:inline-block; margin-left:-5px; margin-bottom:-1px; margin-top:-1px;}
175
- .edit_tag_form input.edit_tag_input {padding:0 5px;border-width:0 0 1px 0;margin:0;}
176
- a.edit_tag_save.btn {padding-top:0;padding-bottom:0;}
177
- .no-touch a.edit_tag_save.btn-link:hover {text-decoration:none;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
  .gm-img-thumbnail {
180
- display: inline-block;
181
- float:left;
182
- position:relative;
183
- margin-right:5px;
184
- margin-bottom:5px;
185
- max-width: 100%;
186
- height: auto;
187
- padding: 4px;
188
- line-height: 1.428571429;
189
- background-color: #fff;
190
- border: 1px solid #ddd;
191
- border-radius: 4px;
192
- }
193
- .gm-img-thumbnail input {display:block; line-height:120%; position:absolute; right:-1px; top:-1px; width:42px; padding:0 2px; text-align:center; border-radius: 4px; opacity:0.9;}
194
- .gm-img-thumbnail input:focus {opacity:1;}
195
- .gm-img-thumbnail .label {position:absolute;left:0;bottom:0;font-weight:normal;line-height:120%;pointer-events:none;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  .ui-highlight-placeholder {
197
- border: 1px solid #0074a2;
198
- }
199
- .termItems { position:relative; }
200
- .termItems .gm-img-thumbnail {width:160px;height:120px;text-align:center;line-height:107px;}
201
- .termItems .gm-img-thumbnail img {height:auto;width:auto;max-width:100%;max-height:100%;display:inline-block;vertical-align:middle;}
202
-
203
- .choose-module {padding:10px;cursor:pointer;overflow: hidden;margin: 0;}
204
- .no-touch .choose-module:hover {background-color:#d0e9c6;}
205
- .choose-module .thumbnail {margin-bottom:0;}
206
- .media { overflow: hidden; }
207
- .media > .thumbnail.pull-left {padding: 4px; margin-right: 10px}
208
-
209
- .presetlist a {position: relative;padding-right: 30px;}
210
- .delpreset { position: absolute; right: 0; top: 0; bottom: 0; padding: 0.8em 7px 0; line-height: 100%;}
211
- .delpreset span { line-height: 100%; font-size: 94%; padding: 0 5px 2px; cursor: pointer;}
212
-
213
- body#media-upload { height:100%; overflow:auto; margin:0; padding:0; background: #ffffff; }
214
- body#media-upload .panel {position:relative; height:100%; overflow:auto; margin:0; border-radius: 0; border-top:none;}
215
- body#media-upload .panel-heaading {position:relative; z-index:100;}
216
- body#media-upload .panel-body {position:absolute; top:55px; bottom:0; width:100%; overflow:hidden; z-index:50; padding-top:0; padding-bottom:0;}
217
- body#media-upload .panel-body > .row {height:100%;}
218
- body#media-upload .panel-body > .row > div {height:100%; overflow:auto; padding-top:15px; padding-bottom:15px;}
219
- body#media-upload .panel-body .list-group-item {border-width: 0; border-top-width: 1px; margin: 0;}
220
- body#media-upload .panel-body .list-group-item:first-child {border-width: 0;}
221
- body#media-upload .term-list-item .term-label .no-checkbox {display: inline-block; width: 100%;}
222
- body#media-upload .term-list-item .term-info {display: none;}
223
- .blank-aligner {display: inline-block; height: 40px; vertical-align: middle; width: 1px; overflow: hidden; margin-right: -2em;}
224
-
225
- body#media-upload .media-upload-sidebar {border-left:1px solid #cccccc; background-color:#eeeeee; padding:0 !important;position:relative;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  body#media-upload .media-upload-sidebar form {
227
  display: -webkit-box;
228
  display: -moz-box;
@@ -234,142 +736,272 @@ body#media-upload .media-upload-sidebar form {
234
  -ms-flex-direction: column;
235
  -webkit-flex-direction: column;
236
  flex-direction: column;
237
- height: 100%; width: 100%;}
 
 
 
238
  body#media-upload .media-upload-sidebar .media-upload-form-container {
239
  -webkit-box-flex: 1 auto;
240
  -moz-box-flex: 1 auto;
241
  -webkit-flex: 1 auto;
242
  -ms-flex: 1 auto;
243
  flex: 1 auto;
244
- overflow: auto; padding: 15px;}
245
- body#media-upload .media-upload-sidebar .panel-footer {min-height: 57px;}
246
- body#media-upload .thumbnail {margin:0 5px 5px 0; position:relative; display:inline-block;}
247
- body#media-upload .thumbnail.active {background-color:lightblue;border-color:cadetblue;}
248
- body#media-upload .thumbnail .glyphicon {display:none; position:absolute; right:-3px; top:-7px; font-size:30px;}
249
- body#media-upload .thumbnail.active .glyphicon {display:inline-block;}
250
- body#media-upload .plupload_wrapper {height: 100%; box-sizing: border-box;}
251
- body#media-upload div#pluploadUploader .plupload_container {height: 100%; min-height: inherit !important;}
252
- body#media-upload .ui-resizable-handle {display: none !important; bottom: -1px;}
253
- #gmedia-post-thumbnail {font-size: 12px;padding: 0;display: inline;white-space: normal;}
254
-
255
- body.gmedia-blank.image_editor { height:100%; overflow:auto; margin:0; padding:0 }
256
- body.gmedia-blank.image_editor .panel {position:relative; height:100%; overflow:auto; margin:0;}
257
- body.gmedia-blank .panel-heaading {position:relative; z-index:100;}
258
- body.gmedia-blank.image_editor .panel-body {position:absolute; top:55px; bottom:0; width:100%; overflow:hidden; z-index:50; padding-top:0; padding-bottom:0;}
259
- body.gmedia-blank.image_editor .panel-body .row {height:100%;}
260
- body.gmedia-blank.image_editor .panel-body .row > div {height:100%; overflow:auto; padding-top:15px; padding-bottom:15px;}
261
- body.gmedia-blank .media-edit-sidebar {border-left:1px solid #cccccc; background-color:#eeeeee; padding:0 0 55px 0 !important; position:relative;}
262
- body.gmedia-blank #media-edit-form-container { height:100%; overflow:auto; padding:15px;}
263
- body.gmedia-blank .media-edit-sidebar .panel-footer {position:absolute; left:0; bottom:0; right:0;}
264
-
265
- #gallery_preview_ {width:200%; height:800px; margin-bottom:-400px; overflow:auto;
266
- -moz-transform: scale(0.5, 0.5);
267
- -webkit-transform: scale(0.5, 0.5);
268
- -o-transform: scale(0.5, 0.5);
269
- -ms-transform: scale(0.5, 0.5);
270
- transform: scale(0.5, 0.5);
271
- -moz-transform-origin: top left;
272
- -webkit-transform-origin: top left;
273
- -o-transform-origin: top left;
274
- -ms-transform-origin: top left;
275
- transform-origin: top left;
276
- border: solid #ccc 2px;
277
- }
278
- #gallery_preview {width:100%; height:600px; border: solid #ccc 1px; overflow:auto;}
279
-
280
- #adv-settings { overflow:hidden; }
281
- #screen-meta .form-group { padding-bottom: 10px; }
282
-
283
- @media (min-width:782px) {
284
- div.modal { top:32px; }
285
-
286
- div#termsModal .modal-dialog {
287
- width:350px;
288
- }
289
- }
290
-
291
- @media screen and (max-width:782px) {
292
- div#wpwrap { background:#708090; }
293
- div#wpbody select.input-sm {height: 30px;font-size:12px;}
294
- #adminmenu #toplevel_page_GrandMedia ul.wp-submenu { display:block; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
 
298
  /* custom inclusion of right, left tabs */
299
 
300
  .tabs-right > .nav-tabs,
301
  .tabs-left > .nav-tabs {
302
- border-bottom: 0;
303
  }
304
 
305
  .tab-content > .tab-pane,
306
  .pill-content > .pill-pane {
307
- display: none;
308
  }
309
 
310
  .tab-content > .active,
311
  .pill-content > .active {
312
- display: block;
313
  }
314
 
315
  .tabs-left > .nav-tabs > li,
316
  .tabs-right > .nav-tabs > li {
317
- float: none;
318
  }
319
 
320
  .tabs-left > .nav-tabs > li > a,
321
  .tabs-right > .nav-tabs > li > a {
322
- min-width: 74px;
323
- margin-right: 0;
324
- margin-bottom: 3px;
325
  }
326
 
327
  .tabs-left > .nav-tabs {
328
- float: left;
329
- margin-right: 19px;
330
- border-right: 1px solid #ddd;
331
  }
332
 
333
  .tabs-left > .nav-tabs > li > a {
334
- margin-right: -1px;
335
- -webkit-border-radius: 4px 0 0 4px;
336
- -moz-border-radius: 4px 0 0 4px;
337
- border-radius: 4px 0 0 4px;
338
  }
339
 
340
  .no-touch .tabs-left > .nav-tabs > li > a:hover,
341
  .tabs-left > .nav-tabs > li > a:focus {
342
- border-color: #eeeeee #dddddd #eeeeee #eeeeee;
343
  }
344
 
345
  .tabs-left > .nav-tabs .active > a,
346
  .no-touch .tabs-left > .nav-tabs .active > a:hover,
347
  .tabs-left > .nav-tabs .active > a:focus {
348
- border-color: #ddd transparent #ddd #ddd;
349
- *border-right-color: #ffffff;
350
  }
351
 
352
  .tabs-right > .nav-tabs {
353
- float: right;
354
- margin-left: 19px;
355
- border-left: 1px solid #ddd;
356
  }
357
 
358
  .tabs-right > .nav-tabs > li > a {
359
- margin-left: -1px;
360
- -webkit-border-radius: 0 4px 4px 0;
361
- -moz-border-radius: 0 4px 4px 0;
362
- border-radius: 0 4px 4px 0;
363
  }
364
 
365
  .no-touch .tabs-right > .nav-tabs > li > a:hover,
366
  .tabs-right > .nav-tabs > li > a:focus {
367
- border-color: #eeeeee #eeeeee #eeeeee #dddddd;
368
  }
369
 
370
  .tabs-right > .nav-tabs .active > a,
371
  .no-touch .tabs-right > .nav-tabs .active > a:hover,
372
  .tabs-right > .nav-tabs .active > a:focus {
373
- border-color: #ddd #ddd #ddd transparent;
374
- *border-left-color: #ffffff;
375
  }
1
+ html {
2
+ background: #708090;
3
+ }
4
+
5
+ #adminmenu #toplevel_page_GrandMedia ul.wp-submenu {
6
+ display: none;
7
+ }
8
+
9
+ #wpfooter {
10
+ color: #ffffff;
11
+ }
12
+
13
+ #wpfooter a {
14
+ color: lightblue;
15
+ }
16
+
17
+ #TB_caption {
18
+ height: auto;
19
+ }
20
+
21
+ a {
22
+ color: #0074a2;
23
+ }
24
+
25
+ input[type="checkbox"] {
26
+ margin-top: 2px;
27
+ margin-right: 2px
28
+ }
29
+
30
  input::-moz-focus-inner {
31
  border: 0;
32
  padding: 0;
33
+ margin-top: -2px;
34
  margin-bottom: -2px;
35
  }
36
+
37
+ form {
38
+ margin: 0;
39
+ }
40
+
41
+ body.gmedia-busy {
42
+ cursor: wait !important;
43
+ }
44
+
45
+ iframe, iframe html {
46
+ background-color: #ffffff;
47
+ }
48
+
49
+ body.gmedia-blank {
50
+ background-color: #ffffff;
51
+ height: auto;
52
+ min-height: 100%;
53
+ padding: 0 0 1px;
54
+ box-sizing: border-box;
55
+ }
56
+
57
+ body.gmedia-blank pre {
58
+ margin: 0;
59
+ padding: 0;
60
+ border: none;
61
+ }
62
+
63
  .gmedia-body div#gm-message {
64
+ position: absolute;
65
+ right: 5px;
66
+ top: 5px;
67
+ overflow: visible;
68
+ z-index: 200;
69
  }
70
+
71
  .gmedia-body div#gm-message .gm-message {
72
+ text-align: right;
73
  }
74
 
 
75
  div#gmedia-container {
76
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
77
+ margin: 30px 5px 10px 0;
78
+ position: relative;
79
+ z-index: 1;
80
+ direction: ltr;
81
  }
82
+
83
  div#gmedia-header {
84
+ position: relative;
85
+ padding: 1px 1px 10px 1px;
86
  }
87
+
88
  /*noinspection CssInvalidElement*/
89
  div#gmedia-logo {
90
+ position: relative;
91
+ margin: 0 30px 0 15px;
92
+ font-size: 48px;
93
+ text-shadow: 1px 1px 4px #000000;
94
+ font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
95
+ color: #ffffff;
96
+ float: left;
97
+ -webkit-text-stroke-width: 0.7px;
98
+ -webkit-text-stroke-color: #ffffff;
99
+ -webkit-font-smoothing: antialiased;
100
+ -webkit-user-select: none;
101
+ -moz-user-select: none;
102
+ -ms-user-select: none;
103
+ user-select: none;
104
+ cursor: default;
105
  }
106
+
107
  div#gmedia-logo small {
108
+ display: block;
109
+ font-size: 10px;
110
+ margin-top: 7px;
111
+ text-align: right;
112
+ -webkit-text-stroke-width: 0;
113
  }
114
+
115
  div#gmedia-header h2 {
116
+ margin: 0;
117
+ font: italic 24px/35px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
118
+ color: #ffffff;
119
  }
120
 
121
+ div#gmedia-navbar {
122
+ font-size: 14px;
123
+ }
124
 
125
+ div.library-author {
126
+ position: absolute;
127
+ right: 15px;
128
+ top: -35px;
129
+ padding: 5px 10px;
130
+ margin: 0
131
+ }
132
 
133
  form.gmedia-search-form {
134
+ float: right;
135
+ margin-left: 10px;
136
+ margin-bottom: 4px;
137
+ white-space: nowrap;
138
+ }
139
+
140
+ form.gmedia-search-form .form-group {
141
+ margin: 0;
142
+ display: inline-block;
143
+ }
144
+
145
+ .gmedia-pager {
146
+ margin-bottom: 4px;
147
+ }
148
+
149
+ form#gmedia-pager {
150
+ float: left;
151
+ width: 150px;
152
  }
 
153
 
 
 
154
  input.pager_current_page {
155
+ padding-left: 0;
156
+ padding-right: 0;
157
+ text-align: center;
158
+ }
159
+
160
+ .txt-lg {
161
+ font-size: 120%;
162
+ line-height: 50%;
163
+ }
164
+
165
+ a.text-danger {
166
+ color: #a94442;
167
+ }
168
+
169
+ .btn > input[type="checkbox"] {
170
+ margin-top: 0;
171
+ width: 16px;
172
+ height: 16px;
173
+ }
174
+
175
+ .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
176
+ background-color: #e8e8e8;
177
+ }
178
+
179
+ .gm-checkgroup {
180
+ margin-right: 20px;
181
+ }
182
+
183
+ .gm-backfade {
184
+ background-color: rgba(0, 0, 0, 0.1);
185
+ }
186
+
187
+ .dropdown-menu > .disabled {
188
+ cursor: not-allowed;
189
+ }
190
+
191
+ .dropdown-menu > .disabled > a {
192
+ pointer-events: none;
193
+ }
194
+
195
+ div#gm-list-table {
196
+ font-size: 13px;
197
+ }
198
+
199
+ .list-group-item.row {
200
+ position: relative;
201
+ margin-left: 0;
202
+ margin-right: 0;
203
+ padding-left: 0;
204
+ padding-right: 0;
205
+ }
206
+
207
+ .list-group-item.d-row {
208
+ position: relative;
209
+ color: inherit;
210
+ }
211
+
212
+ .no-touch div.list-group-item.d-row:hover {
213
+ background-color: #fafafa;
214
+ }
215
+
216
+ .no-touch form.list-group-item.d-row:hover {
217
+ background-color: #fcfcfc;
218
+ }
219
+
220
+ .list-group-item.d-row.active {
221
+ color: #444;
222
+ border-color: #ddd;
223
+ background-color: rgb(250, 255, 245);
224
+ box-shadow: inset -1px 0 0 2px rgb(250, 255, 245), inset 7px 0 0 0 #1e8cbe;
225
+ }
226
+
227
+ .no-touch .list-group-item.d-row.active:hover {
228
+ color: #444;
229
+ border-color: #ddd;
230
+ background-color: rgb(245, 255, 240);
231
+ box-shadow: inset -1px 0 0 2px rgb(245, 255, 240), inset 7px 0 0 0 #1e8cbe;
232
+ }
233
+
234
+ div#gmedia-container .list-group-item-info,
235
+ div#gmedia-container .list-group-item-info:hover {
236
+ background-color: #d9edf7 !important;
237
+ }
238
+
239
+ div#gmedia-container .list-group-item-warning,
240
+ div#gmedia-container .list-group-item-warning:hover {
241
+ background-color: #fcf8e3 !important;
242
+ }
243
+
244
+ .bg-status-private {
245
+ background-color: #d9edf7;
246
+ box-shadow: 3px 0 0 5px #d9edf7, -2px 0 0 5px #6fbfff;
247
+ }
248
+
249
+ .bg-status-draft {
250
+ background-color: #fcf8e3;
251
+ box-shadow: 3px 0 0 5px #fcf8e3, -2px 0 0 5px #ffd87c;
252
+ }
253
+
254
+ label.cb_media-object {
255
+ margin-right: 15px;
256
+ float: left;
257
+ width: 310px;
258
+ max-width: 100%;
259
+ }
260
+
261
+ div.li_media-object {
262
+ margin-right: 15px;
263
+ padding-left: 15px;
264
+ float: left;
265
+ width: 310px;
266
+ max-width: 100%;
267
+ }
268
+
269
+ .d-row .thumbnail {
270
+ margin-bottom: 0;
271
+ }
272
+
273
+ .active .thumbnail {
274
+ border-color: #428bca;
275
+ }
276
+
277
+ .thumbnail {
278
+ position: relative;
279
+ display: inline-block;
280
+ max-width: 100%;
281
+ }
282
+
283
+ .thumbnail .gmedia-typethumb {
284
+ position: absolute;
285
+ right: 5px;
286
+ bottom: 7px;
287
+ height: 75px;
288
+ max-height: 60%;
289
+ width: auto;
290
+ }
291
+
292
+ .media-title {
293
+ font-weight: bold;
294
+ }
295
+
296
+ .media-caption:empty { display:none; }
297
+ .media-caption.in-library {
298
+ max-height:215px;
299
+ }
300
+ .media-caption {
301
+ background-color: #f5f5f5;
302
+ border: 1px solid #ccc;
303
+ border-radius: 4px;
304
+ padding:5px 7px;
305
+ margin:0 -6px 5px;
306
+ overflow:auto;
307
+ word-break: normal;
308
+ word-wrap: break-word;
309
+ }
310
+
311
+ .media-meta {
312
+ width: 100%;
313
+ overflow: hidden;
314
+ text-overflow: ellipsis; /*white-space:nowrap;*/
315
+ }
316
+
317
+ .media-meta .label-default {
318
+ background-color: #eeeeee;
319
+ color: #444444;
320
+ }
321
+
322
+ .gmedia_id {
323
+ position: absolute;
324
+ right: 10px;
325
+ top: 10px;
326
+ }
327
+
328
  .no-touch .gmedia_id,
329
+ .no-touch .term_id {
330
+ display: none;
331
+ }
332
+
333
+ .term_id {
334
+ position: absolute;
335
+ right: 0;
336
+ top: 0;
337
+ padding: 10px 10px 0 0;
338
+ background-color: #fff;
339
+ display: none;
340
+ height: 100%;
341
+ box-shadow: -10px 0 5px -2px #fff;
342
+ z-index: 100;
343
+ }
344
+
345
+ .term-list-item.active .term_id {
346
+ background-color: #337ab7;
347
+ box-shadow: -10px 0 3px -2px #337ab7;
348
+ display: block;
349
+ }
350
+
351
  .no-touch #gm-list-table .list-group-item:hover .gmedia_id,
352
+ .no-touch #gm-list-table .list-group-item:hover .term_id {
353
+ display: block;
354
+ }
355
+
356
+ #gm-list-table .hidden {
357
+ display: none !important;
358
+ visibility: hidden !important;
359
+ }
360
+
361
+ form#adv-settings .form-inline .form-group {
362
+ margin-right: 20px;
363
+ }
364
+
365
+ form.changed {
366
+ }
367
+
368
+ form.changed.saved {
369
+ }
370
+
371
+ form.changed .gm-last-edited {
372
+ text-decoration: line-through;
373
+ }
374
+
375
+ .selectize-input.full input {
376
+ width: 4px !important;
377
+ }
378
+
379
+ .rel-selected-hide {
380
+ display: none;
381
+ }
382
+
383
+ div#pluploadUploader {
384
+ padding: 0;
385
+ }
386
+
387
+ div#pluploadUploader * {
388
+ box-sizing: border-box;
389
+ }
390
+
391
+ div#pluploadUploader > div > div * {
392
+ box-sizing: content-box;
393
+ }
394
+
395
+ .plupload_container {
396
+ padding: 0;
397
+ }
398
+
399
+ div#pluploadUploader_container {
400
+ min-height: 450px;
401
+ border-bottom-right-radius: 4px;
402
+ }
403
+
404
+ div#pluploadUploader_container .plupload_filelist_footer {
405
+ border-bottom-right-radius: 4px;
406
+ }
407
+
408
+ div.panel-body, div#gmedia-msg-panel {
409
+ -webkit-transition: all .2s ease-in-out;
410
+ transition: all .2s ease-in-out;
411
+ }
412
+
413
+ div.panel-body:empty, div#gmedia-msg-panel:empty {
414
+ padding: 0;
415
+ }
416
+
417
+ div#gmedia-msg-panel .alert {
418
+ padding: 2px 35px 2px 12px;
419
+ margin-bottom: 5px;
420
+ }
421
+
422
+ .plupload_content li {
423
+ margin-bottom: 0;
424
+ }
425
+
426
+ .progress {
427
+ position: relative;
428
+ white-space: nowrap;
429
+ font-size: 12px;
430
+ line-height: 20px;
431
+ }
432
+
433
+ .progress-bar {
434
+ position: absolute;
435
+ overflow: hidden;
436
+ }
437
+
438
+ .tab-inside {
439
+ padding: 10px;
440
+ position: relative;
441
+ }
442
+
443
+ .tab-footer {
444
+ border-top: 1px solid #ddd;
445
+ padding: 20px 10px 0;
446
+ }
447
+
448
+ .selectize-control.input-sm .selectize-input {
449
+ min-height: 30px;
450
+ padding: 5px 10px;
451
+ font-size: 12px;
452
+ line-height: 1.9;
453
+ border-radius: 3px;
454
+ }
455
+
456
+ .selectize-control.input-sm .selectize-input input {
457
+ font-size: 12px;
458
+ }
459
+
460
+ .selectize-control.input-sm .selectize-input:after {
461
+ right: 10px;
462
+ }
463
+
464
+ .term-list-item {
465
+ padding-top: 0;
466
+ padding-bottom: 0;
467
+ }
468
+
469
+ .term-list-item .term-label .checkbox {
470
+ padding-left: 35px;
471
+ }
472
+
473
+ .term-list-item .term-label .checkbox > input {
474
+ margin-left: -35px;
475
+ }
476
+
477
+ .term-list-item .checkbox input {
478
+ margin-top: 0;
479
+ margin-right: 15px;
480
+ }
481
+
482
+ .term-list-item .term-description {
483
+ padding: 1px 0 4px;
484
+ white-space: nowrap;
485
+ overflow: hidden;
486
+ color: #444444;
487
+ }
488
+
489
+ .term-list-item .term-description:empty {
490
+ padding: 0;
491
+ }
492
+
493
+ .term-list-item .term-images {
494
+ padding-top: 5px;
495
+ padding-bottom: 2px;
496
+ overflow: hidden;
497
+ white-space: nowrap;
498
+ }
499
+
500
+ .term-list-item .term-images img {
501
+ position: relative;
502
+ height: 30px;
503
+ width: auto;
504
+ background-color: #ffffff;
505
+ }
506
+
507
+ .term-list-item .term_info_author {
508
+ font-size: 80%;
509
+ margin-left: 10px;
510
+ }
511
+
512
+ .no-touch .term-list-item .term-images img:hover {
513
+ z-index: 100 !important;
514
+ }
515
+
516
+ .edit_tag_form {
517
+ display: inline-block;
518
+ margin-left: -5px;
519
+ margin-bottom: -1px;
520
+ margin-top: -1px;
521
+ }
522
+
523
+ .edit_tag_form input.edit_tag_input {
524
+ padding: 0 5px;
525
+ border-width: 0 0 1px 0;
526
+ margin: 0;
527
+ }
528
+
529
+ a.edit_tag_save.btn {
530
+ padding-top: 0;
531
+ padding-bottom: 0;
532
+ }
533
+
534
+ .no-touch a.edit_tag_save.btn-link:hover {
535
+ text-decoration: none;
536
+ }
537
 
538
  .gm-img-thumbnail {
539
+ display: inline-block;
540
+ float: left;
541
+ position: relative;
542
+ margin-right: 5px;
543
+ margin-bottom: 5px;
544
+ max-width: 100%;
545
+ height: auto;
546
+ padding: 4px;
547
+ line-height: 1.428571429;
548
+ background-color: #fff;
549
+ border: 1px solid #ddd;
550
+ border-radius: 4px;
551
+ }
552
+
553
+ .gm-img-thumbnail input {
554
+ display: block;
555
+ line-height: 120%;
556
+ position: absolute;
557
+ right: -1px;
558
+ top: -1px;
559
+ width: 42px;
560
+ padding: 0 2px;
561
+ text-align: center;
562
+ border-radius: 4px;
563
+ opacity: 0.9;
564
+ }
565
+
566
+ .gm-img-thumbnail input:focus {
567
+ opacity: 1;
568
+ }
569
+
570
+ .gm-img-thumbnail .label {
571
+ position: absolute;
572
+ left: 0;
573
+ bottom: 0;
574
+ font-weight: normal;
575
+ line-height: 120%;
576
+ pointer-events: none;
577
+ }
578
+
579
  .ui-highlight-placeholder {
580
+ border: 1px solid #0074a2;
581
+ }
582
+
583
+ .termItems {
584
+ position: relative;
585
+ }
586
+
587
+ .termItems .gm-img-thumbnail {
588
+ width: 160px;
589
+ height: 120px;
590
+ text-align: center;
591
+ line-height: 107px;
592
+ }
593
+
594
+ .termItems .gm-img-thumbnail img {
595
+ height: auto;
596
+ width: auto;
597
+ max-width: 100%;
598
+ max-height: 100%;
599
+ display: inline-block;
600
+ vertical-align: middle;
601
+ }
602
+
603
+ .choose-module {
604
+ padding: 10px;
605
+ cursor: pointer;
606
+ overflow: hidden;
607
+ margin: 0;
608
+ }
609
+
610
+ .no-touch .choose-module:hover {
611
+ background-color: #d0e9c6;
612
+ }
613
+
614
+ .choose-module .thumbnail {
615
+ margin-bottom: 0;
616
+ }
617
+
618
+ .media {
619
+ overflow: hidden;
620
+ }
621
+
622
+ .media > .thumbnail.pull-left {
623
+ padding: 4px;
624
+ margin-right: 10px
625
+ }
626
+
627
+ .presetlist a {
628
+ position: relative;
629
+ padding-right: 30px;
630
+ }
631
+
632
+ .delpreset {
633
+ position: absolute;
634
+ right: 0;
635
+ top: 0;
636
+ bottom: 0;
637
+ padding: 0.8em 7px 0;
638
+ line-height: 100%;
639
+ }
640
+
641
+ .delpreset span {
642
+ line-height: 100%;
643
+ font-size: 94%;
644
+ padding: 0 5px 2px;
645
+ cursor: pointer;
646
+ }
647
+
648
+ body#media-upload {
649
+ height: 100%;
650
+ overflow: auto;
651
+ margin: 0;
652
+ padding: 0;
653
+ background: #ffffff;
654
+ }
655
+
656
+ body#media-upload .panel {
657
+ position: relative;
658
+ height: 100%;
659
+ overflow: auto;
660
+ margin: 0;
661
+ border-radius: 0;
662
+ border-top: none;
663
+ }
664
+
665
+ body#media-upload .panel-heaading {
666
+ position: relative;
667
+ z-index: 100;
668
+ }
669
+
670
+ body#media-upload .panel-body {
671
+ position: absolute;
672
+ top: 55px;
673
+ bottom: 0;
674
+ width: 100%;
675
+ overflow: hidden;
676
+ z-index: 50;
677
+ padding-top: 0;
678
+ padding-bottom: 0;
679
+ }
680
+
681
+ body#media-upload .panel-body > .row {
682
+ height: 100%;
683
+ }
684
+
685
+ body#media-upload .panel-body > .row > div {
686
+ height: 100%;
687
+ overflow: auto;
688
+ padding-top: 15px;
689
+ padding-bottom: 15px;
690
+ }
691
+
692
+ body#media-upload .panel-body .list-group-item {
693
+ border-width: 0;
694
+ border-top-width: 1px;
695
+ margin: 0;
696
+ }
697
+
698
+ body#media-upload .panel-body .list-group-item:first-child {
699
+ border-width: 0;
700
+ }
701
+
702
+ body#media-upload .term-list-item .term-label .no-checkbox {
703
+ display: inline-block;
704
+ width: 100%;
705
+ margin: 10px 0;
706
+ }
707
+
708
+ body#media-upload .term-list-item .term-info {
709
+ display: none;
710
+ }
711
+
712
+ .blank-aligner {
713
+ display: inline-block;
714
+ height: 40px;
715
+ vertical-align: middle;
716
+ width: 1px;
717
+ overflow: hidden;
718
+ margin-right: -2em;
719
+ }
720
+
721
+ body#media-upload .media-upload-sidebar {
722
+ border-left: 1px solid #cccccc;
723
+ background-color: #eeeeee;
724
+ padding: 0 !important;
725
+ position: relative;
726
+ }
727
+
728
  body#media-upload .media-upload-sidebar form {
729
  display: -webkit-box;
730
  display: -moz-box;
736
  -ms-flex-direction: column;
737
  -webkit-flex-direction: column;
738
  flex-direction: column;
739
+ height: 100%;
740
+ width: 100%;
741
+ }
742
+
743
  body#media-upload .media-upload-sidebar .media-upload-form-container {
744
  -webkit-box-flex: 1 auto;
745
  -moz-box-flex: 1 auto;
746
  -webkit-flex: 1 auto;
747
  -ms-flex: 1 auto;
748
  flex: 1 auto;
749
+ overflow: auto;
750
+ padding: 15px;
751
+ }
752
+
753
+ body#media-upload .media-upload-sidebar .panel-footer {
754
+ min-height: 57px;
755
+ }
756
+
757
+ body#media-upload .thumbnail {
758
+ margin: 0 5px 5px 0;
759
+ position: relative;
760
+ display: inline-block;
761
+ }
762
+
763
+ body#media-upload .thumbnail.active {
764
+ background-color: lightblue;
765
+ border-color: cadetblue;
766
+ }
767
+
768
+ body#media-upload .thumbnail .glyphicon {
769
+ display: none;
770
+ position: absolute;
771
+ right: -3px;
772
+ top: -7px;
773
+ font-size: 30px;
774
+ }
775
+
776
+ body#media-upload .thumbnail.active .glyphicon {
777
+ display: inline-block;
778
+ }
779
+
780
+ body#media-upload .plupload_wrapper {
781
+ height: 100%;
782
+ box-sizing: border-box;
783
+ }
784
+
785
+ body#media-upload div#pluploadUploader .plupload_container {
786
+ height: 100%;
787
+ min-height: inherit !important;
788
+ }
789
+
790
+ body#media-upload .ui-resizable-handle {
791
+ display: none !important;
792
+ bottom: -1px;
793
+ }
794
+
795
+ #gmedia-post-thumbnail {
796
+ font-size: 12px;
797
+ padding: 0;
798
+ display: inline;
799
+ white-space: normal;
800
+ }
801
+
802
+ body.gmedia-blank.image_editor {
803
+ height: 100%;
804
+ overflow: auto;
805
+ margin: 0;
806
+ padding: 0
807
+ }
808
+
809
+ body.gmedia-blank.image_editor .panel {
810
+ position: relative;
811
+ height: 100%;
812
+ overflow: auto;
813
+ margin: 0;
814
+ }
815
+
816
+ body.gmedia-blank .panel-heaading {
817
+ position: relative;
818
+ z-index: 100;
819
+ }
820
+
821
+ body.gmedia-blank.image_editor .panel-body {
822
+ position: absolute;
823
+ top: 55px;
824
+ bottom: 0;
825
+ width: 100%;
826
+ overflow: hidden;
827
+ z-index: 50;
828
+ padding-top: 0;
829
+ padding-bottom: 0;
830
+ }
831
+
832
+ body.gmedia-blank.image_editor .panel-body .row {
833
+ height: 100%;
834
+ }
835
+
836
+ body.gmedia-blank.image_editor .panel-body .row > div {
837
+ height: 100%;
838
+ overflow: auto;
839
+ padding-top: 15px;
840
+ padding-bottom: 15px;
841
+ }
842
+
843
+ body.gmedia-blank .media-edit-sidebar {
844
+ border-left: 1px solid #cccccc;
845
+ background-color: #eeeeee;
846
+ padding: 0 0 55px 0 !important;
847
+ position: relative;
848
+ }
849
+
850
+ body.gmedia-blank #media-edit-form-container {
851
+ height: 100%;
852
+ overflow: auto;
853
+ padding: 15px;
854
+ }
855
+
856
+ body.gmedia-blank .media-edit-sidebar .panel-footer {
857
+ position: absolute;
858
+ left: 0;
859
+ bottom: 0;
860
+ right: 0;
861
+ }
862
+
863
+ #gallery_preview_ {
864
+ width: 200%;
865
+ height: 800px;
866
+ margin-bottom: -400px;
867
+ overflow: auto;
868
+ -moz-transform: scale(0.5, 0.5);
869
+ -webkit-transform: scale(0.5, 0.5);
870
+ -o-transform: scale(0.5, 0.5);
871
+ -ms-transform: scale(0.5, 0.5);
872
+ transform: scale(0.5, 0.5);
873
+ -moz-transform-origin: top left;
874
+ -webkit-transform-origin: top left;
875
+ -o-transform-origin: top left;
876
+ -ms-transform-origin: top left;
877
+ transform-origin: top left;
878
+ border: solid #ccc 2px;
879
+ }
880
+
881
+ #gallery_preview {
882
+ width: 100%;
883
+ height: 600px;
884
+ border: solid #ccc 1px;
885
+ overflow: auto;
886
  }
887
 
888
+ #adv-settings {
889
+ overflow: hidden;
890
+ }
891
+
892
+ #screen-meta .form-group {
893
+ padding-bottom: 10px;
894
+ }
895
+
896
+ #previewModal {
897
+ z-index:9999;
898
+ overflow-x:auto;
899
+ }
900
+
901
+ @media (min-width: 782px) {
902
+ div.modal {
903
+ top: 32px;
904
+ }
905
+
906
+ div#termsModal .modal-dialog {
907
+ width: 350px;
908
+ }
909
+
910
+ }
911
+
912
+ @media screen and (max-width: 782px) {
913
+ div#wpwrap {
914
+ background: #708090;
915
+ }
916
+
917
+ div#wpbody select.input-sm {
918
+ height: 30px;
919
+ font-size: 12px;
920
+ }
921
+
922
+ #adminmenu #toplevel_page_GrandMedia ul.wp-submenu {
923
+ display: block;
924
+ }
925
+
926
+ label.cb_media-object {float:none;}
927
+ .media-body {display:block;}
928
+ }
929
 
930
  /* custom inclusion of right, left tabs */
931
 
932
  .tabs-right > .nav-tabs,
933
  .tabs-left > .nav-tabs {
934
+ border-bottom: 0;
935
  }
936
 
937
  .tab-content > .tab-pane,
938
  .pill-content > .pill-pane {
939
+ display: none;
940
  }
941
 
942
  .tab-content > .active,
943
  .pill-content > .active {
944
+ display: block;
945
  }
946
 
947
  .tabs-left > .nav-tabs > li,
948
  .tabs-right > .nav-tabs > li {
949
+ float: none;
950
  }
951
 
952
  .tabs-left > .nav-tabs > li > a,
953
  .tabs-right > .nav-tabs > li > a {
954
+ min-width: 74px;
955
+ margin-right: 0;
956
+ margin-bottom: 3px;
957
  }
958
 
959
  .tabs-left > .nav-tabs {
960
+ float: left;
961
+ margin-right: 19px;
962
+ border-right: 1px solid #ddd;
963
  }
964
 
965
  .tabs-left > .nav-tabs > li > a {
966
+ margin-right: -1px;
967
+ -webkit-border-radius: 4px 0 0 4px;
968
+ -moz-border-radius: 4px 0 0 4px;
969
+ border-radius: 4px 0 0 4px;
970
  }
971
 
972
  .no-touch .tabs-left > .nav-tabs > li > a:hover,
973
  .tabs-left > .nav-tabs > li > a:focus {
974
+ border-color: #eeeeee #dddddd #eeeeee #eeeeee;
975
  }
976
 
977
  .tabs-left > .nav-tabs .active > a,
978
  .no-touch .tabs-left > .nav-tabs .active > a:hover,
979
  .tabs-left > .nav-tabs .active > a:focus {
980
+ border-color: #ddd transparent #ddd #ddd;
981
+ *border-right-color: #ffffff;
982
  }
983
 
984
  .tabs-right > .nav-tabs {
985
+ float: right;
986
+ margin-left: 19px;
987
+ border-left: 1px solid #ddd;
988
  }
989
 
990
  .tabs-right > .nav-tabs > li > a {
991
+ margin-left: -1px;
992
+ -webkit-border-radius: 0 4px 4px 0;
993
+ -moz-border-radius: 0 4px 4px 0;
994
+ border-radius: 0 4px 4px 0;
995
  }
996
 
997
  .no-touch .tabs-right > .nav-tabs > li > a:hover,
998
  .tabs-right > .nav-tabs > li > a:focus {
999
+ border-color: #eeeeee #eeeeee #eeeeee #dddddd;
1000
  }
1001
 
1002
  .tabs-right > .nav-tabs .active > a,
1003
  .no-touch .tabs-right > .nav-tabs .active > a:hover,
1004
  .tabs-right > .nav-tabs .active > a:focus {
1005
+ border-color: #ddd #ddd #ddd transparent;
1006
+ *border-left-color: #ffffff;
1007
  }
admin/galleries.php CHANGED
@@ -201,7 +201,7 @@ function gmediaGalleries(){
201
  :</span> <?php echo $term->global? get_the_author_meta('display_name', $term->global) : '&#8212;'; ?>
202
  </p>
203
 
204
- <p class="media-caption"><?php echo esc_html($term->description); ?></p>
205
 
206
  <p class="media-meta" title="<?php _e('Shortcode', 'gmLang'); ?>" style="font-weight:bold">
207
  <span class="label label-default"><?php _e('Shortcode', 'gmLang'); ?>:</span> [gmedia id=<?php echo $term->term_id; ?>]
@@ -310,7 +310,7 @@ function gmediaGalleries(){
310
 
311
  <p class="version"><?php echo __('Version', 'gmLang') . ': ' . $module_info['version']; ?></p>
312
 
313
- <div class="description"><?php echo str_replace("\n", '<br />', $module_info['description']); ?></div>
314
  </div>
315
  </div>
316
  <?php
@@ -975,7 +975,7 @@ function gmediaGalleryEdit(){
975
 
976
  <p class="version"><?php echo __('Version', 'gmLang') . ': ' . $module_info['version']; ?></p>
977
 
978
- <div class="description"><?php echo str_replace("\n", '<br />', $module_info['description']); ?></div>
979
  </div>
980
  </div>
981
  <?php
201
  :</span> <?php echo $term->global? get_the_author_meta('display_name', $term->global) : '&#8212;'; ?>
202
  </p>
203
 
204
+ <p class="media-caption"><?php echo nl2br(esc_html($term->description)); ?></p>
205
 
206
  <p class="media-meta" title="<?php _e('Shortcode', 'gmLang'); ?>" style="font-weight:bold">
207
  <span class="label label-default"><?php _e('Shortcode', 'gmLang'); ?>:</span> [gmedia id=<?php echo $term->term_id; ?>]
310
 
311
  <p class="version"><?php echo __('Version', 'gmLang') . ': ' . $module_info['version']; ?></p>
312
 
313
+ <div class="description"><?php echo nl2br($module_info['description']); ?></div>
314
  </div>
315
  </div>
316
  <?php
975
 
976
  <p class="version"><?php echo __('Version', 'gmLang') . ': ' . $module_info['version']; ?></p>
977
 
978
+ <div class="description"><?php echo nl2br($module_info['description']); ?></div>
979
  </div>
980
  </div>
981
  <?php
admin/gmedia.php CHANGED
@@ -67,7 +67,7 @@ function gmediaLib(){
67
 
68
  $gmDbCount = $gmDB->count_gmedia();
69
  foreach($gmDbCount as $key => $value){
70
- $gm_qty[$key] = '<span class="badge pull-right">' . (int)$value . '</span>';
71
  }
72
  ?>
73
  <?php if(!empty($author)){ ?>
@@ -316,6 +316,8 @@ function gmediaLib(){
316
  foreach ($gmediaQuery as $item) {
317
 
318
  $meta = $gmDB->get_metadata('gmedia', $item->ID);
 
 
319
  $type = explode('/', $item->mime_type);
320
  $item_url = $gmCore->upload['url'] . '/' . $gmGallery->options['folder'][$type[0]] . '/' . $item->gmuid;
321
  $item_path = $gmCore->upload['path'] . '/' . $gmGallery->options['folder'][$type[0]] . '/' . $item->gmuid;
@@ -329,21 +331,26 @@ function gmediaLib(){
329
  } else{
330
  $is_webimage = (('image' == $type[0]) && in_array($type[1], array('jpeg', 'png', 'gif')))? true : false;
331
  }
 
 
 
 
 
332
 
333
  $tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
334
  $albs = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
335
  $cats = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category');
336
 
337
- $list_row_class = '';
338
- if ('public' != $item->status) {
339
- if('private' == $item->status){
340
- $list_row_class = ' list-group-item-info';
341
- } elseif('draft' == $item->status){
342
- $list_row_class = ' list-group-item-warning';
343
- }
344
- }
345
 
346
- ?>
347
  <?php if (!$gmProcessor->mode){
348
  $is_selected = in_array($item->ID, $gmProcessor->selected_items)? true : false; ?>
349
  <div class="list-group-item d-row clearfix<?php echo ($is_selected? ' active' : '') . $list_row_class; ?>" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $type[0]; ?>">
@@ -351,13 +358,165 @@ function gmediaLib(){
351
  <label class="cb_media-object">
352
  <input name="doaction[]" type="checkbox"<?php echo $is_selected? ' checked="checked"' : ''; ?> data-type="<?php echo $type[0]; ?>" class="hidden" value="<?php echo $item->ID; ?>"/>
353
  <span data-target="<?php echo $item_url; ?>" class="thumbnail">
354
- <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
355
- <?php if(('image' != $type[0]) && isset($meta['cover'][0]) && !empty($meta['cover'][0])){ ?>
356
- <img class="gmedia-typethumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  <?php } ?>
358
  </span>
359
  </label>
360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  <div class="media-body">
362
  <div class="col-md-6">
363
  <p class="media-title"><?php echo esc_html($item->title); ?>&nbsp;</p>
@@ -369,11 +528,11 @@ function gmediaLib(){
369
  if($albs){
370
  $terms_album = array();
371
  foreach($albs as $c){
372
- $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $c->term_id), $url)), esc_html($c->name));
373
  }
374
  $terms_album = join(', ', $terms_album);
375
  } else{
376
- $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $url)), '&#8212;');
377
  }
378
  echo $terms_album;
379
 
@@ -384,11 +543,11 @@ function gmediaLib(){
384
  if($cats){
385
  $terms_category = array();
386
  foreach($cats as $c){
387
- $terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $url)), esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
388
  }
389
  $terms_category = join(', ', $terms_category);
390
  } else{
391
- $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $url)), __('Uncategorized', 'gmLang'));
392
  }
393
  echo $terms_category;
394
  } ?>
@@ -397,7 +556,7 @@ function gmediaLib(){
397
  if($tags){
398
  $terms_tag = array();
399
  foreach($tags as $c){
400
- $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $c->term_id), $url)), esc_html($c->name));
401
  }
402
  $terms_tag = join(', ', $terms_tag);
403
  } else{
@@ -415,18 +574,17 @@ function gmediaLib(){
415
  <span class="label label-default"><?php _e('Type', 'gmLang'); ?>:</span> <?php echo $item->mime_type; ?>
416
  </div>
417
  <?php if('image' == $type[0]){
418
- $_metadata = unserialize($meta['_metadata'][0]);
419
  ?>
420
  <div class="media-meta">
421
- <span class="label label-default"><?php _e('Size', 'gmLang'); ?>
422
- :</span> <?php echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height']; ?>
423
  </div>
424
  <?php } ?>
425
  <div class="media-meta"><span class="label label-default"><?php _e('Filename', 'gmLang'); ?>:</span>
426
  <a href="<?php echo $item_url; ?>"><?php echo $item->gmuid; ?></a></div>
427
  <div class="media-meta">
428
- <span class="label label-default"><?php _e('Author', 'gmLang'); ?>
429
- :</span> <?php printf('<a class="gmedia-author" href="%s">%s</a>', esc_url(add_query_arg(array('author' => $item->author), $url)), get_user_option('display_name', $item->author)); ?>
430
  </div>
431
  <div class="media-meta"><span class="label label-default"><?php _e('Date', 'gmLang'); ?>:</span> <?php echo $item->date;
432
  echo ' <small class="modified" title="' . __('Last Modified Date', 'gmLang') . '">' . (($item->modified != $item->date)? $item->modified : '') . '</small>';
@@ -438,151 +596,41 @@ function gmediaLib(){
438
  } else{
439
  echo '&#8212;';
440
  } ?></div>
441
- <p class="media-meta" style="margin:5px 4px;">
442
- <?php $media_action_links = array();
443
- if(($gmCore->caps['gmedia_edit_media'] && ((int)$item->author == get_current_user_id())) || $gmCore->caps['gmedia_edit_others_media']){
444
- $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&mode=edit&gmedia__in={$item->ID}") . '">' . __('Edit Data', 'gmLang') . '</a>';
445
- }
446
- if('image' == $type[0]){
447
- if(($gmCore->caps['gmedia_edit_media'] && ((int)$item->author == get_current_user_id())) || $gmCore->caps['gmedia_edit_others_media']){
448
- $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&gmediablank=image_editor&id={$item->ID}") . '" data-target="#gmeditModal" class="gmedit-modal">' . __('Edit Image', 'gmLang') . '</a>';
449
- }
450
- $media_action_links[] = '<a href="' . $gmCore->gm_get_media_image($item, 'original') . '" data-target="#previewModal" class="preview-modal">' . __('View Original', 'gmLang') . '</a>';
451
-
452
- }
453
- if(($gmCore->caps['gmedia_delete_media'] && ((int)$item->author == get_current_user_id())) || $gmCore->caps['gmedia_delete_others_media']){
454
- $media_action_links[] = '<a class="text-danger" href="' . wp_nonce_url($gmCore->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.", "gmLang"), $item->gmuid) . '">' . __('Delete', 'gmLang') . '</a>';
455
- $media_action_links[] = '<a class="text-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID, 'save_original_file' => 1)), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to delete record from DB for %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid) . '">' . __('Delete DB record (leave file on the server)', 'gmLang') . '</a>';
456
- }
457
- echo implode(' | ', $media_action_links);
458
- ?>
459
- </p>
460
  </div>
461
  </div>
462
  </div>
463
-
464
- <?php } elseif($gmCore->caps['gmedia_edit_media']){ ?>
465
- <?php if(((int)$item->author != $user_ID) && !$gmCore->caps['gmedia_edit_others_media']){ ?>
466
- <div class="list-group-item row d-row" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $type[0]; ?>">
467
- <div class="gmedia_id">#<?php echo $item->ID; ?></div>
468
- <div class="li_media-object">
469
- <span data-target="<?php echo $item_url; ?>" class="thumbnail">
470
- <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
471
- <?php if(('image' != $type[0]) && isset($meta['cover'][0]) && !empty($meta['cover'][0])){ ?>
472
- <img class="gmedia-typethumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
473
- <?php } ?>
474
- </span>
475
- </div>
476
-
477
- <div class="media-body">
478
- <div class="col-md-6">
479
- <p class="media-title"><?php echo esc_html($item->title); ?>&nbsp;</p>
480
-
481
- <p class="media-caption"><?php echo esc_html($item->description); ?></p>
482
-
483
- <p class="media-meta"><span class="label label-default"><?php _e('Album', 'gmLang'); ?>:</span>
484
- <?php
485
- if($albs){
486
- $terms_album = array();
487
- foreach($albs as $c){
488
- $terms_album[] = sprintf('<span class="album">%s</span>', esc_html($c->name));
489
- }
490
- $terms_album = join(', ', $terms_album);
491
- } else{
492
- $terms_album = '<span class="album">&#8212;</span>';
493
- }
494
- echo $terms_album;
495
-
496
- if($is_webimage){
497
- ?>
498
- <br/><span class="label label-default"><?php _e('Category', 'gmLang'); ?>:</span>
499
- <?php
500
- if($cats){
501
- $terms_category = array();
502
- foreach($cats as $c){
503
- $terms_category[] = sprintf('<span class="category">%s</span>', esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
504
- }
505
- $terms_category = join(', ', $terms_category);
506
- } else{
507
- $terms_category = sprintf('<span class="category">%s</span>', __('Uncategorized'));
508
- }
509
- echo $terms_category;
510
- } ?>
511
- <br/><span class="label label-default"><?php _e('Tags', 'gmLang'); ?>:</span>
512
- <?php
513
- if($tags){
514
- $terms_tag = array();
515
- foreach($tags as $c){
516
- $terms_tag[] = sprintf('<span class="tag">%s</span>', esc_html($c->name));
517
- }
518
- $terms_tag = join(', ', $terms_tag);
519
- } else{
520
- $terms_tag = '&#8212;';
521
- }
522
- echo $terms_tag;
523
- ?>
524
- </p>
525
- </div>
526
- <div class="col-md-6">
527
- <div class="media-meta">
528
- <span class="label label-default"><?php _e('Status', 'gmLang'); ?>:</span> <?php echo $item->status; ?>
529
- </div>
530
- <div class="media-meta">
531
- <span class="label label-default"><?php _e('Type', 'gmLang'); ?>:</span> <?php echo $item->mime_type; ?>
532
- </div>
533
- <?php if('image' == $type[0]){
534
- $_metadata = unserialize($meta['_metadata'][0]);
535
- ?>
536
- <div class="media-meta">
537
- <span class="label label-default"><?php _e('Size', 'gmLang'); ?>
538
- :</span> <?php echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height']; ?>
539
- </div>
540
- <?php } ?>
541
- <div class="media-meta"><span class="label label-default"><?php _e('Filename', 'gmLang'); ?>:</span>
542
- <a href="<?php echo $item_url; ?>"><?php echo $item->gmuid; ?></a></div>
543
- <div class="media-meta">
544
- <span class="label label-default"><?php _e('Author', 'gmLang'); ?>
545
- :</span> <?php printf('<span class="gmedia-author">%s</a>', get_user_option('display_name', $item->author)); ?>
546
- </div>
547
- <div class="media-meta"><span class="label label-default"><?php _e('Date', 'gmLang'); ?>:</span> <?php echo $item->date;
548
- echo ' <small class="modified" title="' . __('Last Modified Date', 'gmLang') . '">' . (($item->modified != $item->date)? $item->modified : '') . '</small>';
549
- ?></div>
550
- <div class="media-meta"><span class="label label-default"><?php _e('Link', 'gmLang'); ?>:</span>
551
- <?php if(!empty($item->link)){ ?>
552
- <a href="<?php echo $item->link; ?>"><?php echo $item->link; ?></a>
553
- <?php
554
- } else{
555
- echo '&#8212;';
556
- } ?></div>
557
- <?php if('image' == $type[0]){ ?>
558
- <p class="media-meta" style="margin:5px 4px;">
559
- <a href="<?php echo $gmCore->gm_get_media_image($item, 'original'); ?>" data-target="#previewModal" class="preview-modal" title="<?php echo esc_attr($item->title); ?>">
560
- <?php _e('View Original', 'gmLang'); ?>
561
- </a>
562
- </p>
563
- <?php } ?>
564
- </div>
565
- </div>
566
- </div>
567
  <?php
568
- continue;
569
- }
570
  ?>
571
  <form class="list-group-item row d-row edit-gmedia" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $type[0]; ?>" role="form">
572
  <div class="col-sm-4" style="max-width:350px;">
573
  <input name="ID" type="hidden" value="<?php echo $item->ID; ?>"/>
574
  <?php if(('image' == $type[0])){ ?>
575
- <a href="<?php echo $item_url; ?>" data-target="#previewModal" class="thumbnail preview-modal" title="<?php echo esc_attr($item->title); ?>">
576
  <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
577
  </a>
578
  <p>
579
  <a href="<?php echo admin_url("admin.php?page=GrandMedia&gmediablank=image_editor&id={$item->ID}"); ?>" data-target="#gmeditModal" class="btn btn-link btn-sm gmedit-modal">
580
  <?php _e('Edit Image', 'gmLang'); ?>
581
  </a> |
582
- <a href="<?php echo $gmCore->gm_get_media_image($item, 'original'); ?>" data-target="#previewModal" class="btn btn-link btn-sm preview-modal">
583
  <?php _e('View Original', 'gmLang'); ?>
584
  </a>
585
- <?php if(($gmCore->caps['gmedia_delete_media'] && ((int)$item->author == get_current_user_id())) || $gmCore->caps['gmedia_delete_others_media']){ ?>
586
  |
587
  <a class="btn btn-link btn-sm text-danger" href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID)), 'gmedia_delete') ?>" data-confirm="<?php printf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid); ?>">
588
  <?php _e('Delete', 'gmLang'); ?>
@@ -590,12 +638,33 @@ function gmediaLib(){
590
  <?php } ?>
591
  </p>
592
  <?php } else{ ?>
593
- <a href="<?php echo $item_url; ?>" data-target="#previewModal" class="thumbnail preview-modal" title="<?php echo esc_attr($item->title); ?>">
594
- <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
595
- <?php if(isset($meta['cover'][0]) && !empty($meta['cover'][0])){ ?>
 
 
 
 
 
 
 
 
 
 
 
596
  <img class="gmedia-typethumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
597
  <?php } ?>
598
  </a>
 
 
 
 
 
 
 
 
 
 
599
  <?php } ?>
600
  </div>
601
  <div class="col-sm-8">
@@ -630,7 +699,7 @@ function gmediaLib(){
630
  <div class="col-lg-6">
631
  <?php if(('image' != $type[0])){ ?>
632
  <div class="form-group">
633
- <label><?php _e('Cover', 'gmLang'); ?></label>
634
  <input name="meta[cover]" type="text" class="form-control input-sm gmedia-cover" value="<?php if(isset($meta['cover'][0])){
635
  echo $meta['cover'][0];
636
  } ?>" placeholder="<?php _e('Gmedia ID or Image URL', 'gmLang'); ?>"/>
@@ -638,19 +707,19 @@ function gmediaLib(){
638
  <?php } ?>
639
  <?php if($gmCore->caps['gmedia_terms']){ ?>
640
  <?php if($is_webimage){ ?>
641
- <?php
642
- $cat_name = empty($cats)? 0 : reset($cats)->name;
643
- $term_type = 'gmedia_category';
644
- $gm_terms = $gmGallery->options['taxonomies'][$term_type];
645
-
646
- $terms_category = '';
647
- if(count($gm_terms)){
648
- foreach($gm_terms as $term_name => $term_title){
649
- $selected_option = ($cat_name === $term_name)? ' selected="selected"' : '';
650
- $terms_category .= '<option' . $selected_option . ' value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
651
- }
652
- }
653
- ?>
654
  <div class="form-group">
655
  <label><?php _e('Category', 'gmLang'); ?> </label>
656
  <select name="terms[gmedia_category]" class="gmedia_category form-control input-sm">
@@ -661,57 +730,57 @@ function gmediaLib(){
661
  <?php } ?>
662
 
663
  <?php
664
- $alb_id = empty($albs)? 0 : reset($albs)->term_id;
665
- $term_type = 'gmedia_album';
666
- $args = array();
667
- if(!$gmCore->caps['gmedia_edit_others_media']){
668
- $args = array('global' => array(0, $user_ID), 'orderby' => 'global_desc_name');
669
- }
670
- $gm_terms = $gmDB->get_terms($term_type, $args);
671
-
672
- $terms_album = '';
673
- $album_status = 'none';
674
- if(count($gm_terms)){
675
- foreach($gm_terms as $term){
676
- $author_name = '';
677
- if($term->global){
678
- if($gmCore->caps['gmedia_edit_others_media']){
679
- $author_name .= ' &nbsp; ' . sprintf(__('by %s', 'gmLang'), get_the_author_meta('display_name', $term->global));
680
- }
681
- } else{
682
- $author_name .= ' &nbsp; (' . __('shared', 'gmLang') . ')';
683
- }
684
- if ('public' != $term->status) {
685
- $author_name .= ' [' . $term->status . ']';
686
- }
687
-
688
- $selected_option = '';
689
- if($alb_id == $term->term_id) {
690
- $selected_option = ' selected="selected"';
691
- $album_status = $term->status;
692
- }
693
- $terms_album .= '<option' . $selected_option . ' value="' . $term->term_id . '">' . esc_html($term->name) . $author_name . '</option>' . "\n";
694
- }
695
- }
696
- ?>
697
- <div class="form-group status-album bg-status-<?php echo $album_status; ?>">
698
  <label><?php _e('Album ', 'gmLang'); ?></label>
699
  <select name="terms[gmedia_album]" class="combobox_gmedia_album form-control input-sm" placeholder="<?php _e('Album Name...', 'gmLang'); ?>">
700
  <option<?php echo $alb_id? '' : ' selected="selected"'; ?> value=""></option>
701
  <?php echo $terms_album; ?>
702
  </select>
703
  </div>
704
- <?php
705
- if(!empty($tags)){
706
- $terms_tag = array();
707
- foreach($tags as $c){
708
- $terms_tag[] = esc_html($c->name);
709
- }
710
- $terms_tag = join(', ', $terms_tag);
711
- } else{
712
- $terms_tag = '';
713
- }
714
- ?>
715
  <div class="form-group">
716
  <label><?php _e('Tags ', 'gmLang'); ?></label>
717
  <textarea name="terms[gmedia_tag]" class="gmedia_tags_input form-control input-sm" rows="1" cols="50"><?php echo $terms_tag; ?></textarea>
@@ -723,7 +792,7 @@ function gmediaLib(){
723
  <div class="col-lg-6">
724
  <div class="form-group">
725
  <label><?php _e('Filename', 'gmLang'); ?></label>
726
- <input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php if((int)$item->author !== $user_ID){
727
  echo 'readonly';
728
  } ?> value="<?php echo pathinfo($item->gmuid, PATHINFO_FILENAME); ?>"/>
729
  </div>
@@ -738,11 +807,11 @@ function gmediaLib(){
738
  </div>
739
  <div class="form-group status-item bg-status-<?php echo $item->status; ?>">
740
  <label><?php _e('Status', 'gmLang'); ?></label>
741
- <select name="status" class="form-control input-sm">
742
- <option <?php selected($item->status, 'public'); ?> value="public"><?php _e('Public', 'gmLang'); ?></option>
743
- <option <?php selected($item->status, 'private'); ?> value="private"><?php _e('Private', 'gmLang'); ?></option>
744
- <option <?php selected($item->status, 'draft'); ?> value="draft"><?php _e('Draft', 'gmLang'); ?></option>
745
- </select>
746
  </div>
747
  </div>
748
  <div class="col-lg-6">
@@ -750,9 +819,9 @@ function gmediaLib(){
750
  <label><?php _e('Author', 'gmLang'); ?></label>
751
  <?php $user_ids = $gmCore->caps['gmedia_delete_others_media']? $gmCore->get_editable_user_ids() : false;
752
  if($user_ids){
753
- if(!in_array($user_ID, $user_ids)){
754
- array_push($user_ids, $user_ID);
755
- }
756
  wp_dropdown_users(array(
757
  'include' => $user_ids,
758
  'include_selected' => true,
@@ -775,7 +844,9 @@ function gmediaLib(){
775
  <?php if('image' == $type[0]){
776
  $_metadata = unserialize($meta['_metadata'][0]); ?>
777
  <div class="media-meta"><span class="label label-default"><?php _e('Dimensions', 'gmLang') ?>
778
- :</span> <span title="<?php echo $_metadata['web']['width'] . ' × ' . $_metadata['web']['height'] . ', ' . $_metadata['thumb']['width'] . ' × ' . $_metadata['thumb']['height']; ?>"><?php echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height']; ?></span></div>
 
 
779
  <?php } ?>
780
  <div class="media-meta"><span class="label label-default"><?php _e('Uploaded', 'gmLang') ?>:</span><?php echo $item->date; ?></div>
781
  <div class="media-meta"><span class="label label-default"><?php _e('Last Edited', 'gmLang') ?>:</span>
@@ -790,7 +861,7 @@ function gmediaLib(){
790
  <script type="text/javascript">
791
  jQuery(function($){
792
  <?php if(!$gmProcessor->mode){ ?>
793
- $('#gm-selected').on('change',function(){
794
  var val = $(this).val();
795
  $('.edit-mode-link').each(function(){
796
  if(val){
@@ -810,7 +881,7 @@ function gmediaLib(){
810
  <?php } ?>
811
 
812
  var gmedia_date_temp;
813
- $('.input-group.date').datetimepicker({useSeconds: true}).on('dp.show',function(){
814
  gmedia_date_temp = $('input', this).val();
815
  }).on('dp.hide', function(){
816
  if(gmedia_date_temp != $('input', this).val()){
67
 
68
  $gmDbCount = $gmDB->count_gmedia();
69
  foreach($gmDbCount as $key => $value){
70
+ $gm_qty[$key] = '<span class="badge pull-right">' . (int) $value . '</span>';
71
  }
72
  ?>
73
  <?php if(!empty($author)){ ?>
316
  foreach ($gmediaQuery as $item) {
317
 
318
  $meta = $gmDB->get_metadata('gmedia', $item->ID);
319
+ $_metadata = $gmDB->get_metadata('gmedia', $item->ID, '_metadata', true);
320
+
321
  $type = explode('/', $item->mime_type);
322
  $item_url = $gmCore->upload['url'] . '/' . $gmGallery->options['folder'][$type[0]] . '/' . $item->gmuid;
323
  $item_path = $gmCore->upload['path'] . '/' . $gmGallery->options['folder'][$type[0]] . '/' . $item->gmuid;
331
  } else{
332
  $is_webimage = (('image' == $type[0]) && in_array($type[1], array('jpeg', 'png', 'gif')))? true : false;
333
  }
334
+ $modal_width = isset($_metadata['original']['width'])? $_metadata['original']['width'] : (isset($_metadata['width'])? $_metadata['width'] : '900');
335
+ $modal_height = isset($_metadata['original']['height'])? $_metadata['original']['height'] : (isset($_metadata['height'])? $_metadata['height'] : '300');
336
+ $modal_web_width = isset($_metadata['web']['width'])? $_metadata['web']['width'] : (isset($_metadata['width'])? $_metadata['width'] : '640');
337
+ $modal_web_height = isset($_metadata['web']['height'])? $_metadata['web']['height'] : (isset($_metadata['height'])? $_metadata['height'] : '200');
338
+
339
 
340
  $tags = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_tag');
341
  $albs = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_album');
342
  $cats = $gmDB->get_the_gmedia_terms($item->ID, 'gmedia_category');
343
 
344
+ $list_row_class = '';
345
+ if('public' != $item->status){
346
+ if('private' == $item->status){
347
+ $list_row_class = ' list-group-item-info';
348
+ } elseif('draft' == $item->status){
349
+ $list_row_class = ' list-group-item-warning';
350
+ }
351
+ }
352
 
353
+ ?>
354
  <?php if (!$gmProcessor->mode){
355
  $is_selected = in_array($item->ID, $gmProcessor->selected_items)? true : false; ?>
356
  <div class="list-group-item d-row clearfix<?php echo ($is_selected? ' active' : '') . $list_row_class; ?>" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $type[0]; ?>">
358
  <label class="cb_media-object">
359
  <input name="doaction[]" type="checkbox"<?php echo $is_selected? ' checked="checked"' : ''; ?> data-type="<?php echo $type[0]; ?>" class="hidden" value="<?php echo $item->ID; ?>"/>
360
  <span data-target="<?php echo $item_url; ?>" class="thumbnail">
361
+ <?php if(('image' == $type[0])){ ?>
362
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
363
+ <?php } else{
364
+ $typethumb = false;
365
+ ?>
366
+ <?php if(isset($meta['cover'][0]) && !empty($meta['cover'][0])){
367
+ $typethumb = true;
368
+ ?>
369
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
370
+ <?php } elseif(isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])){
371
+ $typethumb = true;
372
+ ?>
373
+ <img class="gmedia-thumb" src="<?php echo $_metadata['image']['data']; ?>" alt=""/>
374
+ <?php } else{ ?>
375
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
376
+ <?php } ?>
377
+ <?php if($typethumb){ ?>
378
+ <img class="gmedia-typethumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
379
+ <?php } ?>
380
  <?php } ?>
381
  </span>
382
  </label>
383
 
384
+ <div class="media-body">
385
+ <div class="row" style="margin:0;">
386
+ <div class="col-lg-6">
387
+ <p class="media-title"><?php echo esc_html($item->title); ?>&nbsp;</p>
388
+
389
+ <div class="in-library media-caption"><?php echo nl2br(esc_html($item->description)); ?></div>
390
+
391
+ <p class="media-meta"><span class="label label-default"><?php _e('Album', 'gmLang'); ?>:</span>
392
+ <?php
393
+ if($albs){
394
+ $terms_album = array();
395
+ foreach($albs as $c){
396
+ $terms_album[] = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => $c->term_id), $url)), esc_html($c->name));
397
+ }
398
+ $terms_album = join(', ', $terms_album);
399
+ } else{
400
+ $terms_album = sprintf('<a class="album" href="%s">%s</a>', esc_url(add_query_arg(array('alb' => 0), $url)), '&#8212;');
401
+ }
402
+ echo $terms_album;
403
+
404
+ if($is_webimage){
405
+ ?>
406
+ <br/><span class="label label-default"><?php _e('Category', 'gmLang'); ?>:</span>
407
+ <?php
408
+ if($cats){
409
+ $terms_category = array();
410
+ foreach($cats as $c){
411
+ $terms_category[] = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => $c->term_id), $url)), esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
412
+ }
413
+ $terms_category = join(', ', $terms_category);
414
+ } else{
415
+ $terms_category = sprintf('<a class="category" href="%s">%s</a>', esc_url(add_query_arg(array('cat' => 0), $url)), __('Uncategorized', 'gmLang'));
416
+ }
417
+ echo $terms_category;
418
+ } ?>
419
+ <br/><span class="label label-default"><?php _e('Tags', 'gmLang'); ?>:</span>
420
+ <?php
421
+ if($tags){
422
+ $terms_tag = array();
423
+ foreach($tags as $c){
424
+ $terms_tag[] = sprintf('<a class="tag" href="%s">%s</a>', esc_url(add_query_arg(array('tag_id' => $c->term_id), $url)), esc_html($c->name));
425
+ }
426
+ $terms_tag = join(', ', $terms_tag);
427
+ } else{
428
+ $terms_tag = '&#8212;';
429
+ }
430
+ echo $terms_tag;
431
+ ?>
432
+ </p>
433
+ </div>
434
+ <div class="col-lg-6">
435
+ <div class="media-meta">
436
+ <span class="label label-default"><?php _e('Status', 'gmLang'); ?>:</span> <?php echo $item->status; ?>
437
+ </div>
438
+ <div class="media-meta">
439
+ <span class="label label-default"><?php _e('Type', 'gmLang'); ?>:</span> <?php echo $item->mime_type; ?>
440
+ </div>
441
+ <?php if('image' == $type[0]){
442
+ ?>
443
+ <div class="media-meta">
444
+ <span class="label label-default"><?php _e('Size', 'gmLang'); ?>:</span> <?php echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height']; ?>
445
+ </div>
446
+ <?php } ?>
447
+ <div class="media-meta"><span class="label label-default"><?php _e('Filename', 'gmLang'); ?>:</span>
448
+ <a href="<?php echo $item_url; ?>"><?php echo $item->gmuid; ?></a></div>
449
+ <div class="media-meta">
450
+ <span class="label label-default"><?php _e('Author', 'gmLang'); ?>:</span> <?php printf('<a class="gmedia-author" href="%s">%s</a>', esc_url(add_query_arg(array('author' => $item->author), $url)), get_user_option('display_name', $item->author)); ?>
451
+ </div>
452
+ <div class="media-meta"><span class="label label-default"><?php _e('Date', 'gmLang'); ?>:</span> <?php echo $item->date;
453
+ echo ' <small class="modified" title="' . __('Last Modified Date', 'gmLang') . '">' . (($item->modified != $item->date)? $item->modified : '') . '</small>';
454
+ ?></div>
455
+ <div class="media-meta"><span class="label label-default"><?php _e('Link', 'gmLang'); ?>:</span>
456
+ <?php if(!empty($item->link)){ ?>
457
+ <a href="<?php echo $item->link; ?>"><?php echo $item->link; ?></a>
458
+ <?php
459
+ } else{
460
+ echo '&#8212;';
461
+ } ?></div>
462
+ <p class="media-meta" style="margin:5px 4px;">
463
+ <?php $media_action_links = array();
464
+ if(($gmCore->caps['gmedia_edit_media'] && ((int) $item->author == get_current_user_id())) || $gmCore->caps['gmedia_edit_others_media']){
465
+ $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&mode=edit&gmedia__in={$item->ID}") . '">' . __('Edit Data', 'gmLang') . '</a>';
466
+ }
467
+ if('image' == $type[0]){
468
+ if(($gmCore->caps['gmedia_edit_media'] && ((int) $item->author == get_current_user_id())) || $gmCore->caps['gmedia_edit_others_media']){
469
+ $media_action_links[] = '<a href="' . admin_url("admin.php?page=GrandMedia&gmediablank=image_editor&id={$item->ID}") . '" data-target="#gmeditModal" class="gmedit-modal">' . __('Edit Image', 'gmLang') . '</a>';
470
+ }
471
+ $media_action_links[] = '<a href="' . $gmCore->gm_get_media_image($item, 'original') . '" data-target="#previewModal" data-width="'.$modal_width.'" data-height="'.$modal_height.'" class="preview-modal" title="'.esc_attr($item->title).'">' . __('View Original', 'gmLang') . '</a>';
472
+
473
+ } elseif(in_array($type[1], array('mp4', 'mp3', 'mpeg', 'webm', 'ogg', 'wave', 'wav'))){
474
+ $media_action_links[] = '<a href="' . $item_url . '" data-target="#previewModal" data-width="'.$modal_web_width.'" data-height="'.$modal_web_height.'" class="preview-modal" title="'.esc_attr($item->title).'">' . __('Play', 'gmLang') . '</a>';
475
+ }
476
+ if(($gmCore->caps['gmedia_delete_media'] && ((int) $item->author == get_current_user_id())) || $gmCore->caps['gmedia_delete_others_media']){
477
+ $media_action_links[] = '<a class="text-danger" href="' . wp_nonce_url($gmCore->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.", "gmLang"), $item->gmuid) . '">' . __('Delete', 'gmLang') . '</a>';
478
+ $media_action_links[] = '<a class="text-danger" href="' . wp_nonce_url($gmCore->get_admin_url(array(
479
+ 'delete' => $item->ID,
480
+ 'save_original_file' => 1
481
+ )), 'gmedia_delete') . '" data-confirm="' . sprintf(__("You are about to delete record from DB for %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid) . '">' . __('Delete DB record (leave file on the server)', 'gmLang') . '</a>';
482
+ }
483
+ echo implode(' | ', $media_action_links);
484
+ ?>
485
+ </p>
486
+ </div>
487
+ </div>
488
+ </div>
489
+ </div>
490
+
491
+ <?php } elseif($gmCore->caps['gmedia_edit_media']){ ?>
492
+ <?php if(((int) $item->author != $user_ID) && !$gmCore->caps['gmedia_edit_others_media']){ ?>
493
+ <div class="list-group-item row d-row" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $type[0]; ?>">
494
+ <div class="gmedia_id">#<?php echo $item->ID; ?></div>
495
+ <div class="li_media-object">
496
+ <span data-target="<?php echo $item_url; ?>" class="thumbnail">
497
+ <?php if(('image' == $type[0])){ ?>
498
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
499
+ <?php } else{
500
+ $typethumb = false;
501
+ ?>
502
+ <?php if(isset($meta['cover'][0]) && !empty($meta['cover'][0])){
503
+ $typethumb = true;
504
+ ?>
505
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
506
+ <?php } elseif(isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])){
507
+ $typethumb = true;
508
+ ?>
509
+ <img class="gmedia-thumb" src="<?php echo $_metadata['image']['data']; ?>" alt=""/>
510
+ <?php } else{ ?>
511
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
512
+ <?php } ?>
513
+ <?php if($typethumb){ ?>
514
+ <img class="gmedia-typethumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
515
+ <?php } ?>
516
+ <?php } ?>
517
+ </span>
518
+ </div>
519
+
520
  <div class="media-body">
521
  <div class="col-md-6">
522
  <p class="media-title"><?php echo esc_html($item->title); ?>&nbsp;</p>
528
  if($albs){
529
  $terms_album = array();
530
  foreach($albs as $c){
531
+ $terms_album[] = sprintf('<span class="album">%s</span>', esc_html($c->name));
532
  }
533
  $terms_album = join(', ', $terms_album);
534
  } else{
535
+ $terms_album = '<span class="album">&#8212;</span>';
536
  }
537
  echo $terms_album;
538
 
543
  if($cats){
544
  $terms_category = array();
545
  foreach($cats as $c){
546
+ $terms_category[] = sprintf('<span class="category">%s</span>', esc_html($gmGallery->options['taxonomies']['gmedia_category'][$c->name]));
547
  }
548
  $terms_category = join(', ', $terms_category);
549
  } else{
550
+ $terms_category = sprintf('<span class="category">%s</span>', __('Uncategorized'));
551
  }
552
  echo $terms_category;
553
  } ?>
556
  if($tags){
557
  $terms_tag = array();
558
  foreach($tags as $c){
559
+ $terms_tag[] = sprintf('<span class="tag">%s</span>', esc_html($c->name));
560
  }
561
  $terms_tag = join(', ', $terms_tag);
562
  } else{
574
  <span class="label label-default"><?php _e('Type', 'gmLang'); ?>:</span> <?php echo $item->mime_type; ?>
575
  </div>
576
  <?php if('image' == $type[0]){
 
577
  ?>
578
  <div class="media-meta">
579
+ <span class="label label-default"><?php _e('Size', 'gmLang'); ?>
580
+ :</span> <?php echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height']; ?>
581
  </div>
582
  <?php } ?>
583
  <div class="media-meta"><span class="label label-default"><?php _e('Filename', 'gmLang'); ?>:</span>
584
  <a href="<?php echo $item_url; ?>"><?php echo $item->gmuid; ?></a></div>
585
  <div class="media-meta">
586
+ <span class="label label-default"><?php _e('Author', 'gmLang'); ?>
587
+ :</span> <?php printf('<span class="gmedia-author">%s</a>', get_user_option('display_name', $item->author)); ?>
588
  </div>
589
  <div class="media-meta"><span class="label label-default"><?php _e('Date', 'gmLang'); ?>:</span> <?php echo $item->date;
590
  echo ' <small class="modified" title="' . __('Last Modified Date', 'gmLang') . '">' . (($item->modified != $item->date)? $item->modified : '') . '</small>';
596
  } else{
597
  echo '&#8212;';
598
  } ?></div>
599
+ <?php if('image' == $type[0]){ ?>
600
+ <p class="media-meta" style="margin:5px 4px;">
601
+ <a href="<?php echo $gmCore->gm_get_media_image($item, 'original'); ?>" data-target="#previewModal" data-width="<?php echo $modal_width; ?>" data-height="<?php echo $modal_height; ?>" class="preview-modal" title="<?php echo esc_attr($item->title); ?>">
602
+ <?php _e('View Original', 'gmLang'); ?>
603
+ </a>
604
+ </p>
605
+ <?php } elseif(in_array($type[1], array('mp4', 'mp3', 'mpeg', 'webm', 'ogg', 'wave', 'wav'))){ ?>
606
+ <p class="media-meta" style="margin:5px 4px;">
607
+ <a href="<?php echo $item_url; ?>" data-target="#previewModal" data-width="<?php echo $modal_web_width; ?>" data-height="<?php echo $modal_web_height; ?>" class="preview-modal" title="<?php echo esc_attr($item->title); ?>">
608
+ <?php _e('Play', 'gmLang'); ?>
609
+ </a>
610
+ </p>
611
+ <?php } ?>
 
 
 
 
 
 
612
  </div>
613
  </div>
614
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  <?php
616
+ continue;
617
+ }
618
  ?>
619
  <form class="list-group-item row d-row edit-gmedia" id="list-item-<?php echo $item->ID; ?>" data-id="<?php echo $item->ID; ?>" data-type="<?php echo $type[0]; ?>" role="form">
620
  <div class="col-sm-4" style="max-width:350px;">
621
  <input name="ID" type="hidden" value="<?php echo $item->ID; ?>"/>
622
  <?php if(('image' == $type[0])){ ?>
623
+ <a href="<?php echo $item_url; ?>" data-target="#previewModal" data-width="<?php echo $modal_web_width; ?>" data-height="<?php echo $modal_web_height; ?>" class="thumbnail preview-modal" title="<?php echo esc_attr($item->title); ?>">
624
  <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
625
  </a>
626
  <p>
627
  <a href="<?php echo admin_url("admin.php?page=GrandMedia&gmediablank=image_editor&id={$item->ID}"); ?>" data-target="#gmeditModal" class="btn btn-link btn-sm gmedit-modal">
628
  <?php _e('Edit Image', 'gmLang'); ?>
629
  </a> |
630
+ <a href="<?php echo $gmCore->gm_get_media_image($item, 'original'); ?>" data-target="#previewModal" data-width="<?php echo $modal_width; ?>" data-height="<?php echo $modal_height; ?>" class="btn btn-link btn-sm preview-modal" title="<?php echo esc_attr($item->title); ?>">
631
  <?php _e('View Original', 'gmLang'); ?>
632
  </a>
633
+ <?php if(($gmCore->caps['gmedia_delete_media'] && ((int) $item->author == get_current_user_id())) || $gmCore->caps['gmedia_delete_others_media']){ ?>
634
  |
635
  <a class="btn btn-link btn-sm text-danger" href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID)), 'gmedia_delete') ?>" data-confirm="<?php printf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid); ?>">
636
  <?php _e('Delete', 'gmLang'); ?>
638
  <?php } ?>
639
  </p>
640
  <?php } else{ ?>
641
+ <a href="<?php echo $item_url; ?>" data-target="#previewModal" data-width="<?php echo $modal_web_width; ?>" data-height="<?php echo $modal_web_height; ?>" class="thumbnail preview-modal" title="<?php echo esc_attr($item->title); ?>">
642
+ <?php $typethumb = false;
643
+ if(isset($meta['cover'][0]) && !empty($meta['cover'][0])){
644
+ $typethumb = true;
645
+ ?>
646
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb'); ?>" alt=""/>
647
+ <?php } elseif(isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])){
648
+ $typethumb = true;
649
+ ?>
650
+ <img class="gmedia-thumb" src="<?php echo $_metadata['image']['data']; ?>" alt=""/>
651
+ <?php } else{ ?>
652
+ <img class="gmedia-thumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
653
+ <?php } ?>
654
+ <?php if($typethumb){ ?>
655
  <img class="gmedia-typethumb" src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>" alt=""/>
656
  <?php } ?>
657
  </a>
658
+ <p>
659
+ <?php if(in_array($type[1], array('mp4', 'mp3', 'mpeg', 'webm', 'ogg', 'wave', 'wav'))){
660
+ echo '<a href="' . $item_url . '" data-target="#previewModal" data-width="' . $modal_width . '" data-height="' . $modal_height . '" class="btn btn-link btn-sm preview-modal" title="' . esc_attr($item->title) . '">' . __('Play', 'gmLang') . '</a> | ';
661
+ }
662
+ if(($gmCore->caps['gmedia_delete_media'] && ((int) $item->author == get_current_user_id())) || $gmCore->caps['gmedia_delete_others_media']){ ?>
663
+ <a class="btn btn-link btn-sm text-danger" href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('delete' => $item->ID)), 'gmedia_delete') ?>" data-confirm="<?php printf(__("You are about to permanently delete %s file.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"), $item->gmuid); ?>">
664
+ <?php _e('Delete', 'gmLang'); ?>
665
+ </a>
666
+ <?php } ?>
667
+ </p>
668
  <?php } ?>
669
  </div>
670
  <div class="col-sm-8">
699
  <div class="col-lg-6">
700
  <?php if(('image' != $type[0])){ ?>
701
  <div class="form-group">
702
+ <label><?php _e('Custom Cover', 'gmLang'); ?></label>
703
  <input name="meta[cover]" type="text" class="form-control input-sm gmedia-cover" value="<?php if(isset($meta['cover'][0])){
704
  echo $meta['cover'][0];
705
  } ?>" placeholder="<?php _e('Gmedia ID or Image URL', 'gmLang'); ?>"/>
707
  <?php } ?>
708
  <?php if($gmCore->caps['gmedia_terms']){ ?>
709
  <?php if($is_webimage){ ?>
710
+ <?php
711
+ $cat_name = empty($cats)? 0 : reset($cats)->name;
712
+ $term_type = 'gmedia_category';
713
+ $gm_terms = $gmGallery->options['taxonomies'][$term_type];
714
+
715
+ $terms_category = '';
716
+ if(count($gm_terms)){
717
+ foreach($gm_terms as $term_name => $term_title){
718
+ $selected_option = ($cat_name === $term_name)? ' selected="selected"' : '';
719
+ $terms_category .= '<option' . $selected_option . ' value="' . $term_name . '">' . esc_html($term_title) . '</option>' . "\n";
720
+ }
721
+ }
722
+ ?>
723
  <div class="form-group">
724
  <label><?php _e('Category', 'gmLang'); ?> </label>
725
  <select name="terms[gmedia_category]" class="gmedia_category form-control input-sm">
730
  <?php } ?>
731
 
732
  <?php
733
+ $alb_id = empty($albs)? 0 : reset($albs)->term_id;
734
+ $term_type = 'gmedia_album';
735
+ $args = array();
736
+ if(!$gmCore->caps['gmedia_edit_others_media']){
737
+ $args = array('global' => array(0, $user_ID), 'orderby' => 'global_desc_name');
738
+ }
739
+ $gm_terms = $gmDB->get_terms($term_type, $args);
740
+
741
+ $terms_album = '';
742
+ $album_status = 'none';
743
+ if(count($gm_terms)){
744
+ foreach($gm_terms as $term){
745
+ $author_name = '';
746
+ if($term->global){
747
+ if($gmCore->caps['gmedia_edit_others_media']){
748
+ $author_name .= ' &nbsp; ' . sprintf(__('by %s', 'gmLang'), get_the_author_meta('display_name', $term->global));
749
+ }
750
+ } else{
751
+ $author_name .= ' &nbsp; (' . __('shared', 'gmLang') . ')';
752
+ }
753
+ if('public' != $term->status){
754
+ $author_name .= ' [' . $term->status . ']';
755
+ }
756
+
757
+ $selected_option = '';
758
+ if($alb_id == $term->term_id){
759
+ $selected_option = ' selected="selected"';
760
+ $album_status = $term->status;
761
+ }
762
+ $terms_album .= '<option' . $selected_option . ' value="' . $term->term_id . '">' . esc_html($term->name) . $author_name . '</option>' . "\n";
763
+ }
764
+ }
765
+ ?>
766
+ <div class="form-group status-album bg-status-<?php echo $album_status; ?>">
767
  <label><?php _e('Album ', 'gmLang'); ?></label>
768
  <select name="terms[gmedia_album]" class="combobox_gmedia_album form-control input-sm" placeholder="<?php _e('Album Name...', 'gmLang'); ?>">
769
  <option<?php echo $alb_id? '' : ' selected="selected"'; ?> value=""></option>
770
  <?php echo $terms_album; ?>
771
  </select>
772
  </div>
773
+ <?php
774
+ if(!empty($tags)){
775
+ $terms_tag = array();
776
+ foreach($tags as $c){
777
+ $terms_tag[] = esc_html($c->name);
778
+ }
779
+ $terms_tag = join(', ', $terms_tag);
780
+ } else{
781
+ $terms_tag = '';
782
+ }
783
+ ?>
784
  <div class="form-group">
785
  <label><?php _e('Tags ', 'gmLang'); ?></label>
786
  <textarea name="terms[gmedia_tag]" class="gmedia_tags_input form-control input-sm" rows="1" cols="50"><?php echo $terms_tag; ?></textarea>
792
  <div class="col-lg-6">
793
  <div class="form-group">
794
  <label><?php _e('Filename', 'gmLang'); ?></label>
795
+ <input name="filename" type="text" class="form-control input-sm gmedia-filename" <?php if((int) $item->author !== $user_ID){
796
  echo 'readonly';
797
  } ?> value="<?php echo pathinfo($item->gmuid, PATHINFO_FILENAME); ?>"/>
798
  </div>
807
  </div>
808
  <div class="form-group status-item bg-status-<?php echo $item->status; ?>">
809
  <label><?php _e('Status', 'gmLang'); ?></label>
810
+ <select name="status" class="form-control input-sm">
811
+ <option <?php selected($item->status, 'public'); ?> value="public"><?php _e('Public', 'gmLang'); ?></option>
812
+ <option <?php selected($item->status, 'private'); ?> value="private"><?php _e('Private', 'gmLang'); ?></option>
813
+ <option <?php selected($item->status, 'draft'); ?> value="draft"><?php _e('Draft', 'gmLang'); ?></option>
814
+ </select>
815
  </div>
816
  </div>
817
  <div class="col-lg-6">
819
  <label><?php _e('Author', 'gmLang'); ?></label>
820
  <?php $user_ids = $gmCore->caps['gmedia_delete_others_media']? $gmCore->get_editable_user_ids() : false;
821
  if($user_ids){
822
+ if(!in_array($user_ID, $user_ids)){
823
+ array_push($user_ids, $user_ID);
824
+ }
825
  wp_dropdown_users(array(
826
  'include' => $user_ids,
827
  'include_selected' => true,
844
  <?php if('image' == $type[0]){
845
  $_metadata = unserialize($meta['_metadata'][0]); ?>
846
  <div class="media-meta"><span class="label label-default"><?php _e('Dimensions', 'gmLang') ?>
847
+ :</span>
848
+ <span title="<?php echo $_metadata['web']['width'] . ' × ' . $_metadata['web']['height'] . ', ' . $_metadata['thumb']['width'] . ' × ' . $_metadata['thumb']['height']; ?>"><?php echo $_metadata['original']['width'] . ' × ' . $_metadata['original']['height']; ?></span>
849
+ </div>
850
  <?php } ?>
851
  <div class="media-meta"><span class="label label-default"><?php _e('Uploaded', 'gmLang') ?>:</span><?php echo $item->date; ?></div>
852
  <div class="media-meta"><span class="label label-default"><?php _e('Last Edited', 'gmLang') ?>:</span>
861
  <script type="text/javascript">
862
  jQuery(function($){
863
  <?php if(!$gmProcessor->mode){ ?>
864
+ $('#gm-selected').on('change', function(){
865
  var val = $(this).val();
866
  $('.edit-mode-link').each(function(){
867
  if(val){
881
  <?php } ?>
882
 
883
  var gmedia_date_temp;
884
+ $('.input-group.date').datetimepicker({useSeconds: true}).on('dp.show', function(){
885
  gmedia_date_temp = $('input', this).val();
886
  }).on('dp.hide', function(){
887
  if(gmedia_date_temp != $('input', this).val()){
admin/images/appstore_button.png ADDED
Binary file
admin/images/mobile_app.png ADDED
Binary file
admin/js/grand-media.js CHANGED
@@ -239,16 +239,20 @@ jQuery(function($){
239
 
240
  $('a.preview-modal').click(function(e){
241
  e.preventDefault();
242
- var modal_div = $($(this).data('target'));
 
243
  $('.modal-title', modal_div).text($(this).attr('title'));
 
244
  $('.modal-body', modal_div).html(
245
  $('<iframe />', {
246
  name: 'previewFrame',
247
  id: 'previewFrame',
248
  width: '100%',
 
249
  src: $(this).attr('href'),
250
  load: function(){
251
- $(this).height(this.contentWindow.document.body.offsetHeight + 30);
 
252
  }
253
  }).css({display: 'block', margin: '4px 0'})
254
  );
239
 
240
  $('a.preview-modal').click(function(e){
241
  e.preventDefault();
242
+ var data = $(this).data(),
243
+ modal_div = $(data['target']);
244
  $('.modal-title', modal_div).text($(this).attr('title'));
245
+ $('.modal-dialog', modal_div).css('width', (data['width'] + 32));
246
  $('.modal-body', modal_div).html(
247
  $('<iframe />', {
248
  name: 'previewFrame',
249
  id: 'previewFrame',
250
  width: '100%',
251
+ height: (data['height'] + 7),
252
  src: $(this).attr('href'),
253
  load: function(){
254
+ $(this.contentWindow.document.body).css('margin', 0);
255
+ $('.modal-backdrop', modal_div).css({'width': (data['width'] + 32), 'min-width': '100%'});
256
  }
257
  }).css({display: 'block', margin: '4px 0'})
258
  );
admin/js/meta-box.js CHANGED
@@ -88,31 +88,16 @@ var gmActiveEditor = false;
88
 
89
  */
90
 
91
- $(document).on( 'click', '#gmedia-modal', function( event ) {
92
- event.stopPropagation();
93
- event.preventDefault();
94
-
95
- var modal = $('#__gm-uploader');
96
-
97
- if(modal.length) {
98
- modal.css('display','block');
99
- } else{
100
- var title = $(this).attr('title');
101
- modal = $($('#tpl__gm-uploader').html());
102
- modal.find('.media-modal-close, .media-modal-backdrop').on('click', function(){
103
- modal.css('display', 'none');
104
- });
105
- modal.find('.media-menu-item').on('click', function(){
106
- $('iframe', modal).attr('src', '');
107
- $(this).addClass('active').siblings('a').removeClass('active');
108
- $('.media-frame-title h1', modal).text($(this).text());
109
- });
110
- $("body").append(modal);
111
- }
112
  });
113
 
114
- $('#postimagediv').on('click', '#set-gmedia-post-thumbnail', function(){
115
- $('#wp-content-media-buttons').find('#gmedia-modal').trigger('click');
 
 
116
  var modal = $('#__gm-uploader');
117
  var library = modal.find('#gmedia-modal-library');
118
  if(!library.hasClass('active')){
@@ -125,6 +110,26 @@ var gmActiveEditor = false;
125
 
126
  })(jQuery, window, document, undefined);
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  function gm_check_scode(id){
129
  if(!id && ("undefined" != typeof(tinymce)) && tinymce.activeEditor){
130
  id = tinymce.activeEditor.id;
88
 
89
  */
90
 
91
+ $(document).on( 'click', '#gmedia-modal', function(e) {
92
+ e.stopPropagation();
93
+ e.preventDefault();
94
+ gmedia_post_modal();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  });
96
 
97
+ $('#postimagediv').on('click', '#set-gmedia-post-thumbnail', function(e){
98
+ e.stopPropagation();
99
+ e.preventDefault();
100
+ gmedia_post_modal();
101
  var modal = $('#__gm-uploader');
102
  var library = modal.find('#gmedia-modal-library');
103
  if(!library.hasClass('active')){
110
 
111
  })(jQuery, window, document, undefined);
112
 
113
+ function gmedia_post_modal(){
114
+ var modal = jQuery('#__gm-uploader');
115
+
116
+ if(modal.length) {
117
+ modal.css('display','block');
118
+ } else{
119
+ var title = jQuery(this).attr('title');
120
+ modal = jQuery(jQuery('#tpl__gm-uploader').html());
121
+ modal.find('.media-modal-close, .media-modal-backdrop').on('click', function(){
122
+ modal.css('display', 'none');
123
+ });
124
+ modal.find('.media-menu-item').on('click', function(){
125
+ jQuery('iframe', modal).attr('src', '');
126
+ jQuery(this).addClass('active').siblings('a').removeClass('active');
127
+ jQuery('.media-frame-title h1', modal).text(jQuery(this).text());
128
+ });
129
+ jQuery("body").append(modal);
130
+ }
131
+ }
132
+
133
  function gm_check_scode(id){
134
  if(!id && ("undefined" != typeof(tinymce)) && tinymce.activeEditor){
135
  id = tinymce.activeEditor.id;
admin/modules.php CHANGED
@@ -38,7 +38,7 @@ function gmediaModules(){
38
  }
39
  // not installed modules
40
  $xml = array();
41
- $get_xml = wp_remote_get($gmGallery->options['modules_xml']);
42
  if(!is_wp_error($get_xml) && (200 == $get_xml['response']['code'])){
43
  $xml = @simplexml_load_string($get_xml['body']);
44
  } else{
38
  }
39
  // not installed modules
40
  $xml = array();
41
+ $get_xml = wp_remote_get($gmGallery->options['modules_xml'], array('sslverify' => false));
42
  if(!is_wp_error($get_xml) && (200 == $get_xml['response']['code'])){
43
  $xml = @simplexml_load_string($get_xml['body']);
44
  } else{
admin/processor.php CHANGED
@@ -360,6 +360,13 @@ class GmediaProcessor{
360
  case 'empty':
361
  $batch_data['description'] = '';
362
  break;
 
 
 
 
 
 
 
363
  case 'custom':
364
  $description_custom = $gmCore->_post('batch_description_custom');
365
  if(false !== $description_custom){
360
  case 'empty':
361
  $batch_data['description'] = '';
362
  break;
363
+ case 'metadata':
364
+ $metatext = $gmCore->metadata_text($id);
365
+ if($gmedia['description']){
366
+ $gmedia['description'] .= "\n\n";
367
+ }
368
+ $batch_data['description'] = $gmedia['description'] . $metatext;
369
+ break;
370
  case 'custom':
371
  $description_custom = $gmCore->_post('batch_description_custom');
372
  if(false !== $description_custom){
admin/settings.php CHANGED
@@ -11,7 +11,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
11
  function gmSettings(){
12
  global $gmDB, $gmCore, $gmGallery;
13
 
14
- ?>
15
 
16
  <form class="panel panel-default" method="post">
17
  <div class="panel-heading clearfix">
@@ -30,9 +30,10 @@ function gmSettings(){
30
  <div class="tabable tabs-left">
31
  <ul class="nav nav-tabs" style="padding:10px 0;">
32
  <li class="active"><a href="#gmedia_premium" data-toggle="tab"><?php _e('Premium Settings', 'gmLang'); ?></a></li>
33
- <?php if(current_user_can('manage_options')){ ?><li>
34
- <a href="#gmedia_settings1" data-toggle="tab"><?php _e('Roles/Capabilities Manager', 'gmLang'); ?></a></li><?php } ?>
35
  <li><a href="#gmedia_settings2" data-toggle="tab"><?php _e('Other Settings', 'gmLang'); ?></a></li>
 
36
  </ul>
37
  <div class="tab-content" style="padding-top:21px;">
38
  <fieldset id="gmedia_premium" class="tab-pane active">
@@ -67,55 +68,55 @@ function gmSettings(){
67
  </div>
68
  <hr/>
69
 
70
- <div class="form-group">
71
- <label><?php _e('Upload Media Files', 'gmLang') ?>:</label>
72
- <select name="capability[gmedia_upload]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_upload')); ?></select>
73
 
74
- <p class="help-block"><?php _e('Who can upload files to Gmedia Library', 'gmLang'); ?></p>
75
- </div>
76
- <div class="col-xs-offset-1">
77
- <div class="form-group">
78
- <label><?php _e('Import Media Files', 'gmLang') ?>:</label>
79
- <select name="capability[gmedia_import]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_import')); ?></select>
80
 
81
- <p class="help-block"><?php _e('Who can import files to Gmedia Library', 'gmLang'); ?></p>
82
- </div>
83
- </div>
84
 
85
- <div class="form-group">
86
- <label><?php _e('Show Others Media in Library', 'gmLang') ?>:</label>
87
- <select name="capability[gmedia_show_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_show_others_media')); ?></select>
88
 
89
- <p class="help-block"><?php _e('Who can see files uploaded by other users', 'gmLang'); ?></p>
90
- </div>
91
  <div class="form-group">
92
  <label><?php _e('Edit Media', 'gmLang') ?>:</label>
93
  <select name="capability[gmedia_edit_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_edit_media')); ?></select>
94
 
95
  <p class="help-block"><?php _e('Who can edit media title, description and other properties of uploaded files', 'gmLang'); ?></p>
96
  </div>
97
- <div class="col-xs-offset-1">
98
- <div class="form-group">
99
- <label><?php _e('Edit Others Media', 'gmLang') ?>:</label>
100
- <select name="capability[gmedia_edit_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_edit_others_media')); ?></select>
101
 
102
- <p class="help-block"><?php _e('Who can edit files, albums/tags and galleries of other users', 'gmLang'); ?></p>
103
- </div>
104
- </div>
105
  <div class="form-group">
106
  <label><?php _e('Delete Media', 'gmLang') ?>:</label>
107
  <select name="capability[gmedia_delete_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_delete_media')); ?></select>
108
 
109
  <p class="help-block"><?php _e('Who can delete uploaded files from Gmedia Library', 'gmLang'); ?></p>
110
  </div>
111
- <div class="col-xs-offset-1">
112
- <div class="form-group">
113
- <label><?php _e('Delete Others Media', 'gmLang') ?>:</label>
114
- <select name="capability[gmedia_delete_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_delete_others_media')); ?></select>
115
 
116
- <p class="help-block"><?php _e('Who can delete files, albums/tags and galleries of other users', 'gmLang'); ?></p>
117
- </div>
118
- </div>
119
 
120
  <div class="form-group">
121
  <label><?php _e('Albums, Tags...', 'gmLang') ?>:</label>
@@ -178,32 +179,57 @@ function gmSettings(){
178
  </div>
179
  <div class="form-group">
180
  <label><?php _e('Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'gmLang') ?>:</label>
 
181
  <div class="checkbox" style="margin:0;">
182
  <input type="hidden" name="set[isolation_mode]" value="0"/>
183
- <label><input type="checkbox" name="set[isolation_mode]" value="1" <?php checked($gmGallery->options['isolation_mode'], '1'); ?> /> <?php _e('Enable Gmedia admin panel Isolation Mode', 'gmLang'); ?>
184
- </label>
185
 
186
  <p class="help-block"><?php _e('This option could help to avoid JS and CSS conflicts with other plugins in admin panel.', 'gmLang'); ?></p>
187
  </div>
188
  </div>
189
  <div class="form-group">
190
  <label><?php _e('Forbid theme to format Gmedia shortcode\'s content', 'gmLang') ?>:</label>
 
191
  <div class="checkbox" style="margin:0;">
192
  <input type="hidden" name="set[shortcode_raw]" value="0"/>
193
- <label><input type="checkbox" name="set[shortcode_raw]" value="1" <?php checked($gmGallery->options['shortcode_raw'], '1'); ?> /> <?php _e('Raw output for Gmedia Shortcode', 'gmLang'); ?>
194
- </label>
195
 
196
  <p class="help-block"><?php _e('Some themes reformat shortcodes and break it functionality (mostly when you add description to images). Turning this on should solve this problem.', 'gmLang'); ?></p>
197
  </div>
198
  </div>
199
- <?php
200
- if ( (function_exists('memory_get_usage')) && (ini_get('memory_limit')) ) {
201
- $memory_limit = ini_get('memory_limit');
202
- $memory_usage = memory_get_usage();
203
- echo '<p>' . __('Memory Limit: ', 'gmLang') . $memory_limit . '</p>';
204
- echo '<p>' . __('Memory Used: ', 'gmLang') . $memory_usage . '</p>';
205
- }
206
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  <p><?php _e('Under constraction...') ?></p>
208
 
209
  <?php
11
  function gmSettings(){
12
  global $gmDB, $gmCore, $gmGallery;
13
 
14
+ ?>
15
 
16
  <form class="panel panel-default" method="post">
17
  <div class="panel-heading clearfix">
30
  <div class="tabable tabs-left">
31
  <ul class="nav nav-tabs" style="padding:10px 0;">
32
  <li class="active"><a href="#gmedia_premium" data-toggle="tab"><?php _e('Premium Settings', 'gmLang'); ?></a></li>
33
+ <?php if(current_user_can('manage_options')){ ?>
34
+ <li><a href="#gmedia_settings1" data-toggle="tab"><?php _e('Roles/Capabilities Manager', 'gmLang'); ?></a></li><?php } ?>
35
  <li><a href="#gmedia_settings2" data-toggle="tab"><?php _e('Other Settings', 'gmLang'); ?></a></li>
36
+ <li><a href="#gmedia_settings3" data-toggle="tab"><?php _e('System Info', 'gmLang'); ?></a></li>
37
  </ul>
38
  <div class="tab-content" style="padding-top:21px;">
39
  <fieldset id="gmedia_premium" class="tab-pane active">
68
  </div>
69
  <hr/>
70
 
71
+ <div class="form-group">
72
+ <label><?php _e('Upload Media Files', 'gmLang') ?>:</label>
73
+ <select name="capability[gmedia_upload]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_upload')); ?></select>
74
 
75
+ <p class="help-block"><?php _e('Who can upload files to Gmedia Library', 'gmLang'); ?></p>
76
+ </div>
77
+ <div class="col-xs-offset-1">
78
+ <div class="form-group">
79
+ <label><?php _e('Import Media Files', 'gmLang') ?>:</label>
80
+ <select name="capability[gmedia_import]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_import')); ?></select>
81
 
82
+ <p class="help-block"><?php _e('Who can import files to Gmedia Library', 'gmLang'); ?></p>
83
+ </div>
84
+ </div>
85
 
86
+ <div class="form-group">
87
+ <label><?php _e('Show Others Media in Library', 'gmLang') ?>:</label>
88
+ <select name="capability[gmedia_show_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_show_others_media')); ?></select>
89
 
90
+ <p class="help-block"><?php _e('Who can see files uploaded by other users', 'gmLang'); ?></p>
91
+ </div>
92
  <div class="form-group">
93
  <label><?php _e('Edit Media', 'gmLang') ?>:</label>
94
  <select name="capability[gmedia_edit_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_edit_media')); ?></select>
95
 
96
  <p class="help-block"><?php _e('Who can edit media title, description and other properties of uploaded files', 'gmLang'); ?></p>
97
  </div>
98
+ <div class="col-xs-offset-1">
99
+ <div class="form-group">
100
+ <label><?php _e('Edit Others Media', 'gmLang') ?>:</label>
101
+ <select name="capability[gmedia_edit_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_edit_others_media')); ?></select>
102
 
103
+ <p class="help-block"><?php _e('Who can edit files, albums/tags and galleries of other users', 'gmLang'); ?></p>
104
+ </div>
105
+ </div>
106
  <div class="form-group">
107
  <label><?php _e('Delete Media', 'gmLang') ?>:</label>
108
  <select name="capability[gmedia_delete_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_delete_media')); ?></select>
109
 
110
  <p class="help-block"><?php _e('Who can delete uploaded files from Gmedia Library', 'gmLang'); ?></p>
111
  </div>
112
+ <div class="col-xs-offset-1">
113
+ <div class="form-group">
114
+ <label><?php _e('Delete Others Media', 'gmLang') ?>:</label>
115
+ <select name="capability[gmedia_delete_others_media]" class="form-control input-sm"><?php wp_dropdown_roles($gmDB->get_role('gmedia_delete_others_media')); ?></select>
116
 
117
+ <p class="help-block"><?php _e('Who can delete files, albums/tags and galleries of other users', 'gmLang'); ?></p>
118
+ </div>
119
+ </div>
120
 
121
  <div class="form-group">
122
  <label><?php _e('Albums, Tags...', 'gmLang') ?>:</label>
179
  </div>
180
  <div class="form-group">
181
  <label><?php _e('Forbid other plugins to load their JS and CSS on Gmedia admin pages', 'gmLang') ?>:</label>
182
+
183
  <div class="checkbox" style="margin:0;">
184
  <input type="hidden" name="set[isolation_mode]" value="0"/>
185
+ <label><input type="checkbox" name="set[isolation_mode]" value="1" <?php checked($gmGallery->options['isolation_mode'], '1'); ?> /> <?php _e('Enable Gmedia admin panel Isolation Mode', 'gmLang'); ?></label>
 
186
 
187
  <p class="help-block"><?php _e('This option could help to avoid JS and CSS conflicts with other plugins in admin panel.', 'gmLang'); ?></p>
188
  </div>
189
  </div>
190
  <div class="form-group">
191
  <label><?php _e('Forbid theme to format Gmedia shortcode\'s content', 'gmLang') ?>:</label>
192
+
193
  <div class="checkbox" style="margin:0;">
194
  <input type="hidden" name="set[shortcode_raw]" value="0"/>
195
+ <label><input type="checkbox" name="set[shortcode_raw]" value="1" <?php checked($gmGallery->options['shortcode_raw'], '1'); ?> /> <?php _e('Raw output for Gmedia Shortcode', 'gmLang'); ?></label>
 
196
 
197
  <p class="help-block"><?php _e('Some themes reformat shortcodes and break it functionality (mostly when you add description to images). Turning this on should solve this problem.', 'gmLang'); ?></p>
198
  </div>
199
  </div>
200
+ <?php
201
+ $allowed_post_types = (array) $gmGallery->options['gmedia_post_types_support'];
202
+ $args = array(
203
+ 'public' => true,
204
+ '_builtin' => false
205
+ );
206
+ $output = 'objects'; // names or objects, note names is the default
207
+ $operator = 'and'; // 'and' or 'or'
208
+ $post_types = get_post_types($args, $output, $operator);
209
+ if(!empty($post_types)){ ?>
210
+ <div class="form-group">
211
+ <label style="margin-bottom:-5px;"><?php _e('Enable Gmedia Library button on custom post types', 'gmLang') ?>:</label>
212
+ <input type="hidden" name="set[gmedia_post_types_support]" value=""/>
213
+ <?php
214
+ foreach($post_types as $post_type){ ?>
215
+ <div class="checkbox">
216
+ <label><input type="checkbox" name="set[gmedia_post_types_support][]" value="<?php echo $post_type->name; ?>" <?php if(in_array($post_type->name, $allowed_post_types)){
217
+ echo 'checked="checked"';
218
+ }; ?> /> <?php echo $post_type->label . ' (' . $post_type->name . ')'; ?></label>
219
+ </div>
220
+ <?php } ?>
221
+ </div>
222
+ <?php } ?>
223
+ </fieldset>
224
+ <fieldset id="gmedia_settings3" class="tab-pane">
225
+ <?php
226
+ if((function_exists('memory_get_usage')) && (ini_get('memory_limit'))){
227
+ $memory_limit = ini_get('memory_limit');
228
+ $memory_usage = memory_get_usage();
229
+ echo '<p>' . __('Memory Limit: ', 'gmLang') . $memory_limit . '</p>';
230
+ echo '<p>' . __('Memory Used: ', 'gmLang') . $memory_usage . '</p>';
231
+ }
232
+ ?>
233
  <p><?php _e('Under constraction...') ?></p>
234
 
235
  <?php
admin/terms.php CHANGED
@@ -1,6 +1,6 @@
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
  /**
@@ -8,593 +8,592 @@ if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
8
  *
9
  * @return mixed content
10
  */
11
- function gmediaTerms()
12
- {
13
- global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
14
-
15
- $url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
16
-
17
- /* todo: per_page options for gmedia_terms
18
- $gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
19
- if(!is_array($gm_screen_options)){
20
- $gm_screen_options = array();
21
- }
22
- $gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
23
- */
24
-
25
- $author = $gmCore->caps['gmedia_show_others_media'] ? 0 : $user_ID;
26
-
27
- $filter = ('selected' == $gmCore->_req('filter')) ? $gmProcessor->selected_items : null;
28
- $args = array(
29
- 'orderby' => $gmCore->_get('orderby', 'name'),
30
- 'order' => $gmCore->_get('order', 'ASC'),
31
- 'search' => $gmCore->_get('s', ''),
32
- 'number' => $gmCore->_get('number', 30),
33
- 'hide_empty' => $gmCore->_get('hide_empty', 0),
34
- 'page' => $gmCore->_get('pager', 1),
35
- 'include' => $filter
36
- );
37
- $args['offset'] = ($args['page'] - 1) * $args['number'];
38
-
39
- $taxonomy = $gmCore->_get('term', 'gmedia_album');
40
-
41
- $allow_edit = 0;
42
- switch ($taxonomy) {
43
- case 'gmedia_album':
44
- $allow_edit = $gmCore->caps['gmedia_album_manage'];
45
- $args['global'] = $gmCore->_get('author', $gmCore->caps['gmedia_edit_others_media'] ? '' : array(0, $user_ID));
46
- if (!$gmCore->caps['gmedia_show_others_media']) {
47
- $args['global'] = wp_parse_id_list($args['global']);
48
- $args['global'] = array_intersect(array(0, $user_ID), $args['global']);
49
- if (empty($args['global'])) {
50
- $args['global'] = array(0, $user_ID);
51
- }
52
- }
53
- if (!$gmCore->caps['gmedia_edit_others_media']) {
54
- $args['orderby'] = $gmCore->_get('orderby', 'global_desc_name');
55
- }
56
- break;
57
- case 'gmedia_tag':
58
- $allow_edit = $gmCore->caps['gmedia_tag_manage'];
59
- break;
60
- case 'gmedia_category':
61
- $args['number'] = '';
62
- $args['offset'] = '';
63
- $args['search'] = '';
64
- $args['include'] = null;
65
- break;
66
- }
67
-
68
- $gmediaTerms = $gmDB->get_terms($taxonomy, $args);
69
-
70
- ?>
71
- <div class="panel panel-default" id="gmedia-panel">
72
- <div class="panel-heading clearfix">
73
-
74
- <?php if ('gmedia_category' != $taxonomy) { ?>
75
- <form class="form-inline gmedia-search-form" role="search" method="get">
76
- <div class="form-group">
77
- <input type="hidden" name="page" value="<?php echo $gmProcessor->page; ?>"/>
78
- <input type="hidden" name="term" value="<?php echo $taxonomy; ?>"/>
79
- <input id="gmedia-search" class="form-control input-sm" type="text" name="s"
80
- placeholder="<?php _e('Search...', 'gmLang'); ?>"
81
- value="<?php echo $gmCore->_get('s', ''); ?>"/>
82
- </div>
83
- <button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span>
84
- </button>
85
- </form>
86
- <?php echo $gmDB->query_pager(); ?>
87
- <?php } ?>
88
-
89
- <div class="btn-toolbar pull-left">
90
- <?php if ('gmedia_category' != $taxonomy) { ?>
91
- <div class="btn-group gm-checkgroup" id="cb_global-btn">
92
  <span class="btn btn-default active"><input class="doaction" id="cb_global"
93
  data-group="cb_term-object" type="checkbox"/></span>
94
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
95
- <span class="caret"></span>
96
- <span class="sr-only"><?php _e('Toggle Dropdown', 'gmLang'); ?></span>
97
- </button>
98
- <ul class="dropdown-menu" role="menu">
99
- <li><a data-select="total" href="#"><?php _e('All', 'gmLang'); ?></a></li>
100
- <li><a data-select="none" href="#"><?php _e('None', 'gmLang'); ?></a></li>
101
- <li class="divider"></li>
102
- <li><a data-select="reverse" href="#"
103
- title="<?php _e('Reverse only visible items', 'gmLang'); ?>"><?php _e('Reverse', 'gmLang'); ?></a>
104
- </li>
105
- </ul>
106
- </div>
107
- <?php } ?>
108
-
109
- <div class="btn-group" style="margin-right:20px;">
110
- <a class="btn btn<?php echo ('gmedia_album' == $taxonomy) ? "-primary active" : '-default'; ?>"
111
- href="<?php echo add_query_arg(array('term' => 'gmedia_album'), $url); ?>"><?php _e('Albums', 'gmLang'); ?></a>
112
- <a class="btn btn<?php echo ('gmedia_tag' == $taxonomy) ? "-primary active" : '-default'; ?>"
113
- href="<?php echo add_query_arg(array('term' => 'gmedia_tag'), $url); ?>"><?php _e('Tags', 'gmLang'); ?></a>
114
- <a class="btn btn<?php echo ('gmedia_category' == $taxonomy) ? "-primary active" : '-default'; ?>"
115
- href="<?php echo add_query_arg(array('term' => 'gmedia_category'), $url); ?>"><?php _e('Categories', 'gmLang'); ?></a>
116
- </div>
117
-
118
- <?php if (('gmedia_category' != $taxonomy)) { ?>
119
- <div class="btn-group">
120
- <a class="btn btn-default" href="#"><?php _e('Action', 'gmLang'); ?></a>
121
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
122
- <span class="caret"></span>
123
- <span class="sr-only"><?php _e('Toggle Dropdown', 'gmLang'); ?></span>
124
- </button>
125
- <?php
126
- $rel_selected_show = 'rel-selected-show';
127
- $rel_selected_hide = 'rel-selected-hide';
128
- ?>
129
- <ul class="dropdown-menu" role="menu">
130
- <li class="dropdown-header <?php echo $rel_selected_hide; ?>">
131
- <span><?php _e("Select items to see more actions", "gmLang"); ?></span></li>
132
- <li class="<?php echo $rel_selected_show;
133
- if (!$gmCore->caps['gmedia_terms_delete']) {
134
- echo ' disabled';
135
- } ?>">
136
- <a href="<?php echo wp_nonce_url($gmCore->get_admin_url(array('delete' => 'selected'), array('filter')), 'gmedia_delete') ?>"
137
- class="gmedia-delete"
138
- data-confirm="<?php _e("You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang"); ?>"><?php _e('Delete Selected Items', 'gmLang'); ?></a>
139
- </li>
140
- <?php do_action('gmedia_term_action_list'); ?>
141
- </ul>
142
- </div>
143
-
144
- <form class="btn-group" id="gm-selected-btn" name="gm-selected-form"
145
- action="<?php echo add_query_arg(array(
146
- 'term' => $taxonomy,
147
- 'filter' => 'selected'
148
- ), $url); ?>" method="post">
149
- <button type="submit"
150
- class="btn btn<?php echo ('selected' == $gmCore->_req('filter')) ? '-success' : '-info' ?>"><?php printf(__('%s selected', 'gmLang'), '<span id="gm-selected-qty">' . count($gmProcessor->selected_items) . '</span>'); ?></button>
151
- <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span
152
- class="caret"></span>
153
- <span class="sr-only"><?php _e('Toggle Dropdown', 'gmLang'); ?></span></button>
154
- <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>"
155
- data-key="<?php echo $taxonomy; ?>" name="selected_items"
156
- value="<?php echo implode(',', $gmProcessor->selected_items); ?>"/>
157
- <ul class="dropdown-menu" role="menu">
158
- <li><a id="gm-selected-show" href="#show"><?php _e('Show only selected items', 'gmLang'); ?></a>
159
- </li>
160
- <li><a id="gm-selected-clear" href="#clear"><?php _e('Clear selected items', 'gmLang'); ?></a>
161
- </li>
162
- </ul>
163
- </form>
164
- <?php } ?>
165
-
166
- </div>
167
- </div>
168
-
169
-
170
- <?php if ('gmedia_album' == $taxonomy) { ?>
171
- <?php if ($allow_edit) { ?>
172
- <form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body"
173
- style="padding-bottom:0; border-bottom:1px solid #ddd;">
174
- <div class="row">
175
- <div class="col-xs-6">
176
- <div class="form-group">
177
- <label><?php _e('Name', 'gmLang'); ?></label>
178
- <input type="text" class="form-control input-sm" name="term[name]"
179
- placeholder="<?php _e('Album Name', 'gmLang'); ?>" required/>
180
- </div>
181
- <div class="form-group">
182
- <label><?php _e('Description', 'gmLang'); ?></label>
183
  <textarea class="form-control input-sm" style="height:75px;" rows="2"
184
  name="term[description]"></textarea>
185
- </div>
186
- </div>
187
- <div class="col-xs-6">
188
- <div class="form-group row">
189
- <div class="col-xs-6">
190
- <label><?php _e('Order gmedia', 'gmLang'); ?></label>
191
- <select name="term[orderby]" class="form-control input-sm">
192
- <option value="custom"><?php _e('user defined', 'gmLang'); ?></option>
193
- <option selected="selected" value="ID"><?php _e('by ID', 'gmLang'); ?></option>
194
- <option value="title"><?php _e('by title', 'gmLang'); ?></option>
195
- <option value="date"><?php _e('by date', 'gmLang'); ?></option>
196
- <option value="modified"><?php _e('by last modified date', 'gmLang'); ?></option>
197
- <option value="rand"><?php _e('Random', 'gmLang'); ?></option>
198
- </select>
199
- </div>
200
- <div class="col-xs-6">
201
- <label><?php _e('Sort order', 'gmLang'); ?></label>
202
- <select name="term[order]" class="form-control input-sm">
203
- <option value="ASC"><?php _e('ASC', 'gmLang'); ?></option>
204
- <option selected="selected" value="DESC"><?php _e('DESC', 'gmLang'); ?></option>
205
- </select>
206
- </div>
207
- </div>
208
- <div class="row">
209
- <div class="form-group col-xs-6">
210
- <label><?php _e('Status', 'gmLang'); ?></label>
211
- <select name="term[status]" class="form-control input-sm">
212
- <option selected="selected" value="public"><?php _e('Public', 'gmLang'); ?></option>
213
- <option value="private"><?php _e('Private', 'gmLang'); ?></option>
214
- <option value="draft"><?php _e('Draft', 'gmLang'); ?></option>
215
- </select>
216
- </div>
217
- <div class="col-xs-6">
218
- <div class="form-group">
219
- <label><?php _e('Author', 'gmLang'); ?></label>
220
- <?php $user_ids = $gmCore->caps['gmedia_delete_others_media']? $gmCore->get_editable_user_ids() : array($user_ID);
221
- if ($user_ids && $gmCore->caps['gmedia_edit_others_media']) {
222
- if(!in_array($user_ID, $user_ids)){
223
- array_push($user_ids, $user_ID);
224
- }
225
- wp_dropdown_users(array(
226
- 'include' => $user_ids,
227
- 'include_selected' => true,
228
- 'name' => 'term[global]',
229
- 'selected' => $user_ID,
230
- 'class' => 'form-control input-sm',
231
- 'multi' => true,
232
- 'show_option_all' => __('Shared', 'gmLang')
233
- ));
234
- } else {
235
- echo '<input type="hidden" name="term[global]" value="' . $user_ID . '"/>';
236
- echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
237
- }
238
- ?>
239
- </div>
240
- <div class="form-group">
241
- <?php
242
- wp_original_referer_field(true, 'previous');
243
- wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
244
- ?>
245
- <input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
246
- <button style="display:block" type="submit" class="btn btn-primary btn-sm"
247
- name="gmedia_album_save"><?php _e('Add New Album', 'gmLang'); ?></button>
248
- </div>
249
- </div>
250
- </div>
251
- </div>
252
- </div>
253
- </form>
254
- <?php } else { ?>
255
- <div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
256
- <button type="button" class="close" data-dismiss="alert">
257
- <span aria-hidden="true">&times;</span><span class="sr-only"><?php _e('Close', 'gmLang'); ?></span>
258
- </button>
259
- <strong><?php _e('Info:', 'gmLang'); ?></strong> <?php _e('You are not allowed to add new terms', 'gmLang'); ?>
260
- </div>
261
- <?php } ?>
262
- <form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
263
- <?php
264
- if (count($gmediaTerms)) {
265
- foreach ($gmediaTerms as $item) {
266
- $termItems = array();
267
- $per_page = 10;
268
- if ($item->count) {
269
- $args = array('no_found_rows' => true, 'per_page' => $per_page, 'album__in' => array($item->term_id), 'author' => $author);
270
- $termItems = $gmDB->get_gmedias($args);
271
- }
272
- $is_selected = in_array($item->term_id, $gmProcessor->selected_items) ? true : false;
273
- $author_name = '';
274
- $list_row_class = $row_class = '';
275
- if ($item->global) {
276
- $author_name .= sprintf(__('by %s', 'gmLang'), get_the_author_meta('display_name', $item->global));
277
- if ($item->global == $user_ID) {
278
- $row_class .= ' current_user';
279
- $allow_edit = $gmCore->caps['gmedia_album_manage'];
280
- } else {
281
- $row_class .= ' other_user';
282
- $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
283
- }
284
- } else {
285
- $author_name .= '(' . __('shared', 'gmLang') . ')';
286
- $row_class .= ' shared';
287
- $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
288
- }
289
- if ('public' != $item->status) {
290
- $author_name .= ' [' . $item->status . ']';
291
- if('private' == $item->status){
292
- $list_row_class = ' list-group-item-info';
293
- } elseif('draft' == $item->status){
294
- $list_row_class = ' list-group-item-warning';
295
- }
296
- }
297
- ?>
298
- <div class="list-group-item term-list-item<?php echo $list_row_class; ?>">
299
- <div class="row cb_term-object<?php echo $row_class; ?>">
300
- <div class="term_id">#<?php echo $item->term_id; ?></div>
301
- <div class="col-xs-5 term-label">
302
- <div class="checkbox">
303
- <input name="doaction[]"
304
- type="checkbox"<?php echo $is_selected ? ' checked="checked"' : ''; ?>
305
- value="<?php echo $item->term_id; ?>"/>
306
- <?php if ($allow_edit) { ?>
307
- <a href="<?php echo add_query_arg(array('edit_album' => $item->term_id), $url); ?>"><?php echo esc_html($item->name); ?></a>
308
- <?php } else { ?>
309
- <span><?php echo esc_html($item->name); ?></span>
310
- <?php } ?>
311
- <span class="term_info_author"><?php echo $author_name; ?></span>
312
- <?php if ($item->count) { ?>
313
- <a href="<?php echo $gmCore->get_admin_url(array(
314
- 'page' => 'GrandMedia',
315
- 'alb' => $item->term_id
316
- ), array(), true); ?>" class="badge pull-right"><?php echo $item->count; ?></a>
317
- <?php } else { ?>
318
- <span class="badge pull-right"><?php echo $item->count; ?></span>
319
- <?php } ?>
320
- </div>
321
- </div>
322
- <div class="col-xs-7">
323
- <div class="term-images">
324
- <?php if (!empty($termItems)) {
325
- foreach ($termItems as $i) {
326
- ?>
327
- <img style="z-index:<?php echo $per_page--; ?>;"
328
- src="<?php echo $gmCore->gm_get_media_image($i, 'thumb', false); ?>"
329
- alt="<?php echo $i->ID; ?>"
330
- title="<?php echo esc_attr($i->title); ?>"/>
331
- <?php
332
- }
333
- }
334
- if (count($termItems) < $item->count) {
335
- echo '...';
336
- }
337
- ?>
338
- </div>
339
- </div>
340
- </div>
341
- <?php if (!empty($item->description)) { ?>
342
- <div class="term-description"><?php echo esc_html($item->description); ?></div>
343
- <?php } ?>
344
- </div>
345
- <?php
346
- }
347
- } else {
348
- ?>
349
- <div class="list-group-item">
350
- <div class="well well-lg text-center">
351
- <h4><?php _e('No items to show.', 'gmLang'); ?></h4>
352
- </div>
353
- </div>
354
- <?php } ?>
355
- <?php
356
- wp_original_referer_field(true, 'previous');
357
- wp_nonce_field('GmediaTerms');
358
- ?>
359
- </form>
360
-
361
-
362
- <?php } elseif ('gmedia_tag' == $taxonomy) { ?>
363
- <?php if ($allow_edit) { ?>
364
- <form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body"
365
- style="padding-bottom:0; border-bottom:1px solid #ddd;">
366
- <div class="row">
367
- <div class="form-group col-xs-9">
368
- <label><?php _e('Tags', 'gmLang'); ?>
369
- <small class="text-muted">(<?php _e('you can type multiple tags separated by comma') ?>)
370
- </small>
371
- </label>
372
- <input type="text" class="form-control input-sm" name="term[name]"
373
- placeholder="<?php _e('Tag Names', 'gmLang'); ?>" required/>
374
- </div>
375
- <div class="col-xs-3" style="padding-top:24px;">
376
- <?php
377
- wp_original_referer_field(true, 'previous');
378
- wp_nonce_field('GmediaTerms', 'term_save_wpnonce');
379
- ?>
380
- <input type="hidden" name="term[taxonomy]" value="gmedia_tag"/>
381
- <button type="submit" class="btn btn-primary btn-sm"
382
- name="gmedia_tag_add"><?php _e('Add New Tags', 'gmLang'); ?></button>
383
- </div>
384
- </div>
385
- </form>
386
- <?php } else { ?>
387
- <div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
388
- <button type="button" class="close" data-dismiss="alert">
389
- <span aria-hidden="true">&times;</span><span class="sr-only"><?php _e('Close', 'gmLang'); ?></span>
390
- </button>
391
- <strong><?php _e('Info:', 'gmLang'); ?></strong> <?php _e('You are not allowed to add new terms', 'gmLang'); ?>
392
- </div>
393
- <?php } ?>
394
- <form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
395
- <?php
396
- if (count($gmediaTerms)) {
397
- if ($gmCore->caps['gmedia_edit_others_media']) {
398
- $allow_edit = true;
399
- } else {
400
- $allow_edit = false;
401
- }
402
- foreach ($gmediaTerms as $item){
403
- $termItems = array();
404
- $per_page = 5;
405
- if ($item->count) {
406
- $args = array('no_found_rows' => true, 'per_page' => $per_page, 'tag_id' => $item->term_id, 'author' => $author);
407
- $termItems = $gmDB->get_gmedias($args);
408
- }
409
- $is_selected = in_array($item->term_id, $gmProcessor->selected_items) ? true : false;
410
- ?>
411
- <div class="list-group-item term-list-item">
412
- <div class="row cb_term-object" id="tag_<?php echo $item->term_id; ?>">
413
- <div class="term_id">#<?php echo $item->term_id; ?></div>
414
- <div class="col-xs-5 term-label">
415
- <div class="checkbox">
416
- <input name="doaction[]"
417
- type="checkbox"<?php echo $is_selected ? ' checked="checked"' : ''; ?>
418
- value="<?php echo $item->term_id; ?>"/>
419
- <?php if ($allow_edit) { ?>
420
- <a class="edit_tag_link"
421
- href="#tag_<?php echo $item->term_id; ?>"><?php echo esc_html($item->name); ?></a>
422
- <span class="edit_tag_form" style="display:none;"><input class="edit_tag_input"
423
- type="text"
424
- data-tag_id="<?php echo $item->term_id; ?>"
425
- name="gmedia_tag_name[<?php echo $item->term_id; ?>]"
426
- value="<?php echo esc_attr($item->name); ?>"
427
- placeholder="<?php echo esc_attr($item->name); ?>"/><a
428
- href="#tag_<?php echo $item->term_id; ?>"
429
- class="edit_tag_save btn btn-link glyphicon glyphicon-pencil"></a></span>
430
- <?php } else { ?>
431
- <span><?php echo esc_html($item->name); ?></span>
432
- <?php } ?>
433
- <?php if ($item->count) { ?>
434
- <a href="<?php echo $gmCore->get_admin_url(array(
435
- 'page' => 'GrandMedia',
436
- 'tag_id' => $item->term_id
437
- ), array(), true); ?>" class="badge pull-right"><?php echo $item->count; ?></a>
438
- <?php } else { ?>
439
- <span class="badge pull-right"><?php echo $item->count; ?></span>
440
- <?php } ?>
441
- </div>
442
- </div>
443
- <div class="col-xs-7 term-images">
444
- <?php if (!empty($termItems)) {
445
- foreach ($termItems as $i) {
446
- ?>
447
- <img style="z-index:<?php echo $per_page--; ?>;"
448
- src="<?php echo $gmCore->gm_get_media_image($i, 'thumb', false); ?>"
449
- alt="<?php echo $i->ID; ?>" title="<?php echo esc_attr($i->title); ?>"/>
450
- <?php
451
- }
452
- }
453
- if (count($termItems) < $item->count) {
454
- echo '...';
455
- }
456
- ?>
457
- </div>
458
- </div>
459
- </div>
460
- <?php } ?>
461
- <?php if ($allow_edit){ ?>
462
- <script type="text/javascript">
463
- jQuery(function ($) {
464
- $('#gm-list-table').data('edit', false);
465
- $('input.edit_tag_input').keypress(function (e) {
466
- var tagdiv = $('#tag_' + $(this).data('tag_id'));
467
- var charCode = e.charCode || e.keyCode || e.which;
468
- if (charCode == 13) {
469
- e.preventDefault();
470
- edit_tag(tagdiv);
471
- }
472
- }).blur(function (e) {
473
- var tagdiv = $('#tag_' + $(this).data('tag_id'));
474
- edit_tag(tagdiv);
475
- });
476
-
477
- $('.edit_tag_link').click(function (e) {
478
- e.preventDefault();
479
- var id = $(this).attr('href');
480
- $(this).hide();
481
- $(id).find('.edit_tag_form').show().find('input').focus();
482
- $('#gm-list-table').data('edit', true);
483
- });
484
- $('.edit_tag_save').click(function (e) {
485
- e.preventDefault();
486
- });
487
-
488
- function edit_tag(tagdiv) {
489
- var inp = tagdiv.find('.edit_tag_form input');
490
- var new_tag_name = $.trim(inp.val());
491
- var old_tag_name = inp.attr('placeholder');
492
- if ((old_tag_name == new_tag_name) || ('' === new_tag_name) || $.isNumeric()) {
493
- inp.val(old_tag_name);
494
- tagdiv.find('.edit_tag_form').hide();
495
- tagdiv.find('.edit_tag_link').show();
496
- return;
497
- }
498
- var post_data = {
499
- action: 'gmedia_tag_edit',
500
- tag_id: inp.data('tag_id'),
501
- tag_name: new_tag_name,
502
- _wpnonce: $('#_wpnonce').val()
503
- };
504
- $.post(ajaxurl, post_data, function (data, textStatus, jqXHR) {
505
- console.log(data);
506
- if (data.error) {
507
- //inp.val(inp.attr('placeholder'));
508
- $('#gmedia-panel').before(data.error);
509
- } else {
510
- //new_tag_name = new_tag_name.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
511
- inp.attr('placeholder', new_tag_name);
512
- tagdiv.find('.edit_tag_link').text(new_tag_name).show();
513
- $('#gmedia-panel').before(data.msg);
514
- tagdiv.find('.edit_tag_form').hide();
515
- }
516
- });
517
- }
518
- });
519
- </script>
520
- <?php } ?>
521
- <?php
522
- } else {
523
- ?>
524
- <div class="list-group-item">
525
- <div class="well well-lg text-center">
526
- <h4><?php _e('No items to show.', 'gmLang'); ?></h4>
527
- </div>
528
- </div>
529
- <?php } ?>
530
- <?php
531
- wp_original_referer_field(true, 'previous');
532
- wp_nonce_field('GmediaTerms');
533
- ?>
534
- </form>
535
-
536
-
537
- <?php } elseif ('gmedia_category' == $taxonomy) { ?>
538
- <div class="panel-body"></div>
539
- <div class="list-group" id="gm-list-table" style="margin-bottom:4px;">
540
- <?php
541
- $gmediaCategories = $gmGallery->options['taxonomies']['gmedia_category'];
542
- foreach ($gmediaTerms as $item) {
543
- $cat[$item->name] = $item;
544
- }
545
- unset($gmediaTerms);
546
-
547
- foreach ($gmediaCategories as $name => $title) {
548
- $termItems = array();
549
- $per_page = 10;
550
- if (isset($cat[$name])) {
551
- $count = $cat[$name]->count;
552
- $term_id = $cat[$name]->term_id;
553
- if ($count) {
554
- $args = array('no_found_rows' => true, 'per_page' => $per_page, 'category__in' => array($term_id), 'author' => $author);
555
- $termItems = $gmDB->get_gmedias($args);
556
- }
557
- } else {
558
- $count = 0;
559
- $term_id = '##';
560
- }
561
- ?>
562
- <div class="list-group-item term-list-item">
563
- <div class="row cb_term-object">
564
- <div class="term_id">#<?php echo $term_id; ?></div>
565
- <div class="col-xs-5" style="padding-top:10px; padding-bottom:10px;">
566
- <?php echo esc_html($title); ?>
567
- <?php if ($count) { ?>
568
- <a href="<?php echo $gmCore->get_admin_url(array(
569
- 'page' => 'GrandMedia',
570
- 'cat' => $term_id
571
- ), array(), true); ?>" class="badge pull-right"><?php echo $count; ?></a>
572
- <?php } else { ?>
573
- <span class="badge pull-right"><?php echo $count; ?></span>
574
- <?php } ?>
575
- </div>
576
- <div class="col-xs-7 term-images">
577
- <?php if (!empty($termItems)) {
578
- foreach ($termItems as $i) {
579
- ?>
580
- <img style="z-index:<?php echo $per_page--; ?>;"
581
- src="<?php echo $gmCore->gm_get_media_image($i, 'thumb', false); ?>"
582
- alt="<?php echo $i->ID; ?>" title="<?php echo esc_attr($i->title); ?>"/>
583
- <?php
584
- }
585
- }
586
- if (count($termItems) < $count) {
587
- echo '...';
588
- }
589
- ?>
590
- </div>
591
- </div>
592
- </div>
593
- <?php } ?>
594
- </div>
595
- <?php } ?>
596
-
597
- </div>
598
 
599
  <?php
600
  }
@@ -605,282 +604,281 @@ function gmediaTerms()
605
  *
606
  * @return mixed content
607
  */
608
- function gmediaAlbumEdit()
609
- {
610
- global $gmDB, $gmCore, $gmProcessor, $user_ID;
611
-
612
- if (!$gmCore->caps['gmedia_album_manage']) {
613
- die('-1');
614
- }
615
-
616
- $url = add_query_arg(array('page' => $gmProcessor->page), admin_url('admin.php'));
617
-
618
- $taxonomy = 'gmedia_album';
619
- $term_id = $gmCore->_get('edit_album');
620
-
621
- $term = $gmDB->get_term($term_id, $taxonomy);
622
-
623
- if (!empty($term) && !is_wp_error($term)) {
624
-
625
- $term_meta = $gmDB->get_metadata('gmedia_term', $term->term_id);
626
- $term_meta = array_map('reset', $term_meta);
627
- $term_meta = array_merge(array('orderby' => 'ID', 'order' => 'DESC'), $term_meta);
628
- $per_page = 30;
629
- $pager = '';
630
- $mousesort = ('drag-n-drop' === $gmCore->_get('sort')) ? true : false;
631
-
632
- $termItems = array();
633
- if ($term->count) {
634
- $args = array('album__in' => $term->term_id, 'orderby' => $term_meta['orderby'], 'order' => $term_meta['order']);
635
- if ($mousesort) {
636
- $args = array_merge($args, array('nopaging' => 1));
637
- } else {
638
- $args = array_merge($args, array('per_page' => $per_page, 'page' => $gmCore->_get('pager', 1)));
639
- }
640
- $termItems = $gmDB->get_gmedias($args);
641
-
642
- if (!$mousesort) {
643
- $pager = $gmDB->query_pager();
644
- }
645
- }
646
-
647
- ?>
648
- <div class="panel panel-default">
649
- <div class="panel-heading clearfix">
650
- <div class="btn-toolbar pull-left">
651
- <div class="btn-group" style="margin-right:20px;">
652
- <a class="btn btn-primary active" href="<?php echo add_query_arg(array('term' => 'gmedia_album'), $url); ?>"><?php _e('Albums', 'gmLang'); ?></a>
653
- <a class="btn btn-default" href="<?php echo add_query_arg(array('term' => 'gmedia_tag'), $url); ?>"><?php _e('Tags', 'gmLang'); ?></a>
654
- <a class="btn btn-default" href="<?php echo add_query_arg(array('term' => 'gmedia_category'), $url); ?>"><?php _e('Categories', 'gmLang'); ?></a>
655
- </div>
656
-
657
- <div class="btn-group">
658
- <a class="btn btn-default" href="#"><?php _e('Action', 'gmLang'); ?></a>
659
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
660
- <span class="caret"></span>
661
- <span class="sr-only"><?php _e('Toggle Dropdown', 'gmLang'); ?></span>
662
- </button>
663
- <ul class="dropdown-menu" role="menu">
664
- <?php if ($mousesort) { ?>
665
- <li>
666
- <a href="<?php echo $gmCore->get_admin_url(array(), array('sort')); ?>"><?php _e('Disable Drag and Drop Sorting', 'gmLang'); ?></a>
667
- </li>
668
- <?php } else { ?>
669
- <li>
670
- <a href="<?php echo $gmCore->get_admin_url(array('sort' => 'drag-n-drop'), array('pager')); ?>"><?php _e('Enable Drag and Drop Sorting', 'gmLang'); ?></a>
671
- </li>
672
- <?php } ?>
673
- <li><a href="<?php echo add_query_arg(array(
674
- 'page' => 'GrandMedia',
675
- 'alb' => $term->term_id
676
- ), admin_url('admin.php')); ?>"><?php _e('Show Album in Gmedia Library', 'gmLang'); ?></a>
677
- </li>
678
- </ul>
679
- </div>
680
- </div>
681
-
682
- <?php echo $pager; ?>
683
-
684
- </div>
685
-
686
- <form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body">
687
- <h4 style="margin-top:0;">
688
- <span class="pull-right"><?php echo __('ID', 'gmLang') . ": {$term->term_id}"; ?></span>
689
- <?php _e('Edit Album'); ?>: <em><?php echo esc_html($term->name); ?></em>
690
- </h4>
691
-
692
- <div class="row" style="border-bottom:1px solid #ddd; margin-bottom:15px;">
693
- <div class="col-xs-6">
694
- <div class="form-group">
695
- <label><?php _e('Name', 'gmLang'); ?></label>
696
- <input type="text" class="form-control input-sm" name="term[name]"
697
- value="<?php echo esc_attr($term->name); ?>"
698
- placeholder="<?php _e('Album Name', 'gmLang'); ?>" required/>
699
- </div>
700
- <div class="form-group">
701
- <label><?php _e('Description', 'gmLang'); ?></label>
702
  <textarea class="form-control input-sm" style="height:53px;" rows="2"
703
  name="term[description]"><?php echo $term->description; ?></textarea>
704
- </div>
705
- </div>
706
- <div class="col-xs-6">
707
- <div class="form-group row">
708
- <div class="col-xs-6">
709
- <label><?php _e('Order gmedia', 'gmLang'); ?></label>
710
- <select name="term[orderby]" class="form-control input-sm">
711
- <option
712
- value="custom"<?php selected($term_meta['orderby'], 'custom'); ?>><?php _e('user defined', 'gmLang'); ?></option>
713
- <option
714
- value="ID"<?php selected($term_meta['orderby'], 'ID'); ?>><?php _e('by ID', 'gmLang'); ?></option>
715
- <option
716
- value="title"<?php selected($term_meta['orderby'], 'title'); ?>><?php _e('by title', 'gmLang'); ?></option>
717
- <option
718
- value="date"<?php selected($term_meta['orderby'], 'date'); ?>><?php _e('by date', 'gmLang'); ?></option>
719
- <option
720
- value="modified"<?php selected($term_meta['orderby'], 'modified'); ?>><?php _e('by last modified date', 'gmLang'); ?></option>
721
- <option
722
- value="rand"<?php selected($term_meta['orderby'], 'rand'); ?>><?php _e('Random', 'gmLang'); ?></option>
723
- </select>
724
- </div>
725
- <div class="col-xs-6">
726
- <label><?php _e('Sort order', 'gmLang'); ?></label>
727
- <select name="term[order]" class="form-control input-sm">
728
- <option
729
- value="ASC"<?php selected($term_meta['order'], 'ASC'); ?>><?php _e('ASC', 'gmLang'); ?></option>
730
- <option
731
- value="DESC"<?php selected($term_meta['order'], 'DESC'); ?>><?php _e('DESC', 'gmLang'); ?></option>
732
- </select>
733
- </div>
734
- </div>
735
- <div class="row">
736
- <div class="col-xs-6">
737
- <div class="form-group">
738
- <label><?php _e('Status', 'gmLang'); ?></label>
739
- <select name="term[status]" class="form-control input-sm">
740
- <option
741
- value="public"<?php selected($term->status, 'public'); ?>><?php _e('Public', 'gmLang'); ?></option>
742
- <option
743
- value="private"<?php selected($term->status, 'private'); ?>><?php _e('Private', 'gmLang'); ?></option>
744
- <option
745
- value="draft"<?php selected($term->status, 'draft'); ?>><?php _e('Draft', 'gmLang'); ?></option>
746
- </select>
747
- </div>
748
- <div class="form-group">
749
- <div class="checkbox"><label><input type="checkbox" name="term[status_global]" value="1"> <?php _e('Apply Status for all items in album', 'gmLang'); ?></label></div>
750
- </div>
751
- </div>
752
- <div class="col-xs-6">
753
- <div class="form-group">
754
- <label><?php _e('Author', 'gmLang'); ?></label>
755
- <?php $user_ids = $gmCore->caps['gmedia_delete_others_media'] ? $gmCore->get_editable_user_ids() : array($user_ID);
756
- if ($user_ids && $gmCore->caps['gmedia_edit_others_media']) {
757
- if(!in_array($user_ID, $user_ids)){
758
- array_push($user_ids, $user_ID);
759
- }
760
- wp_dropdown_users(array(
761
- 'include' => $user_ids,
762
- 'include_selected' => true,
763
- 'name' => 'term[global]',
764
- 'selected' => $term->global,
765
- 'class' => 'form-control input-sm',
766
- 'multi' => true,
767
- 'show_option_all' => __('Shared', 'gmLang')
768
- ));
769
- } else {
770
- echo '<input type="hidden" name="term[global]" value="' . $user_ID . '"/>';
771
- echo '<div>' . get_the_author_meta('display_name', $user_ID) . '</div>';
772
- }
773
- ?>
774
- </div>
775
- <div class="form-group">
776
- <?php wp_nonce_field('GmediaTerms', 'term_save_wpnonce'); ?>
777
- <input type="hidden" name="term[term_id]" value="<?php echo $term->term_id; ?>"/>
778
- <input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
779
- <button style="display:block" type="submit" class="btn btn-primary btn-sm"
780
- name="gmedia_album_save"><?php _e('Update', 'gmLang'); ?></button>
781
- </div>
782
- </div>
783
- </div>
784
- </div>
785
- </div>
786
-
787
- <div class="termItems clearfix" id="termItems">
788
- <?php if (!empty($termItems)) {
789
- foreach ($termItems as $item) {
790
- ?>
791
- <div class="gm-img-thumbnail" data-gmid="<?php echo $item->ID; ?>"><?php
792
- ?>
793
- <img src="<?php echo $gmCore->gm_get_media_image($item, 'thumb', false); ?>"
794
- alt="<?php echo $item->ID; ?>" title="<?php echo esc_attr($item->title); ?>"/><?php
795
- ?>
796
- <input type="text" name="term[gmedia_ids][<?php echo $item->ID; ?>]"
797
- value="<?php echo isset($item->gmedia_order) ? $item->gmedia_order : '0'; ?>"/><?php
798
- ?><span class="label label-default">ID: <?php echo $item->ID; ?></span></div>
799
- <?php
800
- }
801
- } ?>
802
-
803
- </div>
804
- <script type="text/javascript">
805
- jQuery(function ($) {
806
- var inputs = $('#gmedia-edit-term').find('input, select').keypress(function (e) {
807
- var charCode = e.charCode || e.keyCode || e.which;
808
- if (13 == charCode) {
809
- e.preventDefault();
810
- var nextInput = inputs.get(inputs.index(this) + 1);
811
- if (nextInput) {
812
- nextInput.focus();
813
- } else {
814
- $(this).blur();
815
- }
816
- }
817
- });
818
-
819
- var img_order_asc = <?php echo ('ASC' == $term_meta['order'])? 'true' : 'false'; ?>;
820
- var sortdiv = $('#termItems');
821
- var items = $('.gm-img-thumbnail', sortdiv);
822
-
823
- <?php if($mousesort){ ?>
824
- sortdiv.sortable({
825
- items: '.gm-img-thumbnail',
826
- handle: 'img',
827
- placeholder: 'gm-img-thumbnail ui-highlight-placeholder',
828
- forcePlaceholderSize: true,
829
- //revert: true,
830
- stop: function (event, ui) {
831
- items = $('.gm-img-thumbnail', this);
832
- var qty = items.length - 1;
833
- items.each(function (i) {
834
- var order = img_order_asc ? i : (qty - i);
835
- $(this).find('input').val(order);
836
- });
837
- }
838
- });
839
-
840
- <?php } ?>
841
-
842
- $('input', items).on('change', function () {
843
- sortdiv.css({height: sortdiv.height()});
844
- var items = $('.gm-img-thumbnail', sortdiv);
845
-
846
- var new_order = $.isNumeric($(this).val()) ? parseInt($(this).val()) : -1;
847
- $(this).val(new_order).closest('.gm-img-thumbnail').css({zIndex: 1000});
848
-
849
- var ipos = [];
850
- items.each(function (i, el) {
851
- var pos = $(el).position();
852
- $.data(el, 'pos', pos);
853
- ipos[i] = pos;
854
- });
855
-
856
- var order = img_order_asc ? 'asc' : 'desc';
857
- items.tsort('input', {
858
- useVal: true,
859
- order: order
860
- }, 'span.label', {order: order}).each(function (i, el) {
861
- var from = $.data(el, 'pos');
862
- var to = ipos[i];
863
- $(el).css({position: 'absolute', top: from.top, left: from.left}).animate({
864
- top: to.top,
865
- left: to.left
866
- }, 500);
867
- }).promise().done(function () {
868
- items.removeAttr('style');
869
- sortdiv.removeAttr('style');
870
- });
871
-
872
- $(this).val(((0 > new_order) ? 0 : new_order)).focus();
873
- });
874
- });
875
- </script>
876
- </form>
877
- <div class="panel-body"><?php echo $pager; ?>
878
- <div class="well well-sm pull-left"
879
- style="margin:0;"><?php printf(__('Total items: %d'), $term->count); ?></div>
880
- </div>
881
- </div>
882
- <?php
883
- } else {
884
-
885
- }
886
  }
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
  /**
8
  *
9
  * @return mixed content
10
  */
11
+ function gmediaTerms() {
12
+ global $user_ID, $gmDB, $gmCore, $gmGallery, $gmProcessor;
13
+
14
+ $url = add_query_arg( array( 'page' => $gmProcessor->page ), admin_url( 'admin.php' ) );
15
+
16
+ /* todo: per_page options for gmedia_terms
17
+ $gm_screen_options = get_user_meta($user_ID, 'gm_screen_options', true);
18
+ if(!is_array($gm_screen_options)){
19
+ $gm_screen_options = array();
20
+ }
21
+ $gm_screen_options = array_merge($gmGallery->options['gm_screen_options'], $gm_screen_options);
22
+ */
23
+
24
+ $author = $gmCore->caps['gmedia_show_others_media'] ? 0 : $user_ID;
25
+
26
+ $filter = ( 'selected' == $gmCore->_req( 'filter' ) ) ? $gmProcessor->selected_items : null;
27
+ $args = array(
28
+ 'orderby' => $gmCore->_get( 'orderby', 'name' ),
29
+ 'order' => $gmCore->_get( 'order', 'ASC' ),
30
+ 'search' => $gmCore->_get( 's', '' ),
31
+ 'number' => $gmCore->_get( 'number', 30 ),
32
+ 'hide_empty' => $gmCore->_get( 'hide_empty', 0 ),
33
+ 'page' => $gmCore->_get( 'pager', 1 ),
34
+ 'include' => $filter
35
+ );
36
+ $args['offset'] = ( $args['page'] - 1 ) * $args['number'];
37
+
38
+ $taxonomy = $gmCore->_get( 'term', 'gmedia_album' );
39
+
40
+ $allow_edit = 0;
41
+ switch ( $taxonomy ) {
42
+ case 'gmedia_album':
43
+ $allow_edit = $gmCore->caps['gmedia_album_manage'];
44
+ $args['global'] = $gmCore->_get( 'author', $gmCore->caps['gmedia_edit_others_media'] ? '' : array( 0, $user_ID ) );
45
+ if ( ! $gmCore->caps['gmedia_show_others_media'] ) {
46
+ $args['global'] = wp_parse_id_list( $args['global'] );
47
+ $args['global'] = array_intersect( array( 0, $user_ID ), $args['global'] );
48
+ if ( empty( $args['global'] ) ) {
49
+ $args['global'] = array( 0, $user_ID );
50
+ }
51
+ }
52
+ if ( ! $gmCore->caps['gmedia_edit_others_media'] ) {
53
+ $args['orderby'] = $gmCore->_get( 'orderby', 'global_desc_name' );
54
+ }
55
+ break;
56
+ case 'gmedia_tag':
57
+ $allow_edit = $gmCore->caps['gmedia_tag_manage'];
58
+ break;
59
+ case 'gmedia_category':
60
+ $args['number'] = '';
61
+ $args['offset'] = '';
62
+ $args['search'] = '';
63
+ $args['include'] = null;
64
+ break;
65
+ }
66
+
67
+ $gmediaTerms = $gmDB->get_terms( $taxonomy, $args );
68
+
69
+ ?>
70
+ <div class="panel panel-default" id="gmedia-panel">
71
+ <div class="panel-heading clearfix">
72
+
73
+ <?php if ( 'gmedia_category' != $taxonomy ) { ?>
74
+ <form class="form-inline gmedia-search-form" role="search" method="get">
75
+ <div class="form-group">
76
+ <input type="hidden" name="page" value="<?php echo $gmProcessor->page; ?>"/>
77
+ <input type="hidden" name="term" value="<?php echo $taxonomy; ?>"/>
78
+ <input id="gmedia-search" class="form-control input-sm" type="text" name="s"
79
+ placeholder="<?php _e( 'Search...', 'gmLang' ); ?>"
80
+ value="<?php echo $gmCore->_get( 's', '' ); ?>"/>
81
+ </div>
82
+ <button type="submit" class="btn btn-default input-sm"><span class="glyphicon glyphicon-search"></span>
83
+ </button>
84
+ </form>
85
+ <?php echo $gmDB->query_pager(); ?>
86
+ <?php } ?>
87
+
88
+ <div class="btn-toolbar pull-left">
89
+ <?php if ( 'gmedia_category' != $taxonomy ) { ?>
90
+ <div class="btn-group gm-checkgroup" id="cb_global-btn">
 
91
  <span class="btn btn-default active"><input class="doaction" id="cb_global"
92
  data-group="cb_term-object" type="checkbox"/></span>
93
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
94
+ <span class="caret"></span>
95
+ <span class="sr-only"><?php _e( 'Toggle Dropdown', 'gmLang' ); ?></span>
96
+ </button>
97
+ <ul class="dropdown-menu" role="menu">
98
+ <li><a data-select="total" href="#"><?php _e( 'All', 'gmLang' ); ?></a></li>
99
+ <li><a data-select="none" href="#"><?php _e( 'None', 'gmLang' ); ?></a></li>
100
+ <li class="divider"></li>
101
+ <li><a data-select="reverse" href="#"
102
+ title="<?php _e( 'Reverse only visible items', 'gmLang' ); ?>"><?php _e( 'Reverse', 'gmLang' ); ?></a>
103
+ </li>
104
+ </ul>
105
+ </div>
106
+ <?php } ?>
107
+
108
+ <div class="btn-group" style="margin-right:20px;">
109
+ <a class="btn btn<?php echo ( 'gmedia_album' == $taxonomy ) ? "-primary active" : '-default'; ?>"
110
+ href="<?php echo add_query_arg( array( 'term' => 'gmedia_album' ), $url ); ?>"><?php _e( 'Albums', 'gmLang' ); ?></a>
111
+ <a class="btn btn<?php echo ( 'gmedia_tag' == $taxonomy ) ? "-primary active" : '-default'; ?>"
112
+ href="<?php echo add_query_arg( array( 'term' => 'gmedia_tag' ), $url ); ?>"><?php _e( 'Tags', 'gmLang' ); ?></a>
113
+ <a class="btn btn<?php echo ( 'gmedia_category' == $taxonomy ) ? "-primary active" : '-default'; ?>"
114
+ href="<?php echo add_query_arg( array( 'term' => 'gmedia_category' ), $url ); ?>"><?php _e( 'Categories', 'gmLang' ); ?></a>
115
+ </div>
116
+
117
+ <?php if ( ( 'gmedia_category' != $taxonomy ) ) { ?>
118
+ <div class="btn-group">
119
+ <a class="btn btn-default" href="#"><?php _e( 'Action', 'gmLang' ); ?></a>
120
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
121
+ <span class="caret"></span>
122
+ <span class="sr-only"><?php _e( 'Toggle Dropdown', 'gmLang' ); ?></span>
123
+ </button>
124
+ <?php
125
+ $rel_selected_show = 'rel-selected-show';
126
+ $rel_selected_hide = 'rel-selected-hide';
127
+ ?>
128
+ <ul class="dropdown-menu" role="menu">
129
+ <li class="dropdown-header <?php echo $rel_selected_hide; ?>">
130
+ <span><?php _e( "Select items to see more actions", "gmLang" ); ?></span></li>
131
+ <li class="<?php echo $rel_selected_show;
132
+ if ( ! $gmCore->caps['gmedia_terms_delete'] ) {
133
+ echo ' disabled';
134
+ } ?>">
135
+ <a href="<?php echo wp_nonce_url( $gmCore->get_admin_url( array( 'delete' => 'selected' ), array( 'filter' ) ), 'gmedia_delete' ) ?>"
136
+ class="gmedia-delete"
137
+ data-confirm="<?php _e( "You are about to permanently delete the selected items.\n\r'Cancel' to stop, 'OK' to delete.", "gmLang" ); ?>"><?php _e( 'Delete Selected Items', 'gmLang' ); ?></a>
138
+ </li>
139
+ <?php do_action( 'gmedia_term_action_list' ); ?>
140
+ </ul>
141
+ </div>
142
+
143
+ <form class="btn-group" id="gm-selected-btn" name="gm-selected-form"
144
+ action="<?php echo add_query_arg( array(
145
+ 'term' => $taxonomy,
146
+ 'filter' => 'selected'
147
+ ), $url ); ?>" method="post">
148
+ <button type="submit"
149
+ class="btn btn<?php echo ( 'selected' == $gmCore->_req( 'filter' ) ) ? '-success' : '-info' ?>"><?php printf( __( '%s selected', 'gmLang' ), '<span id="gm-selected-qty">' . count( $gmProcessor->selected_items ) . '</span>' ); ?></button>
150
+ <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"><span
151
+ class="caret"></span>
152
+ <span class="sr-only"><?php _e( 'Toggle Dropdown', 'gmLang' ); ?></span></button>
153
+ <input type="hidden" id="gm-selected" data-userid="<?php echo $user_ID; ?>"
154
+ data-key="<?php echo $taxonomy; ?>" name="selected_items"
155
+ value="<?php echo implode( ',', $gmProcessor->selected_items ); ?>"/>
156
+ <ul class="dropdown-menu" role="menu">
157
+ <li><a id="gm-selected-show" href="#show"><?php _e( 'Show only selected items', 'gmLang' ); ?></a>
158
+ </li>
159
+ <li><a id="gm-selected-clear" href="#clear"><?php _e( 'Clear selected items', 'gmLang' ); ?></a>
160
+ </li>
161
+ </ul>
162
+ </form>
163
+ <?php } ?>
164
+
165
+ </div>
166
+ </div>
167
+
168
+
169
+ <?php if ( 'gmedia_album' == $taxonomy ) { ?>
170
+ <?php if ( $allow_edit ) { ?>
171
+ <form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body"
172
+ style="padding-bottom:0; border-bottom:1px solid #ddd;">
173
+ <div class="row">
174
+ <div class="col-xs-6">
175
+ <div class="form-group">
176
+ <label><?php _e( 'Name', 'gmLang' ); ?></label>
177
+ <input type="text" class="form-control input-sm" name="term[name]"
178
+ placeholder="<?php _e( 'Album Name', 'gmLang' ); ?>" required/>
179
+ </div>
180
+ <div class="form-group">
181
+ <label><?php _e( 'Description', 'gmLang' ); ?></label>
182
  <textarea class="form-control input-sm" style="height:75px;" rows="2"
183
  name="term[description]"></textarea>
184
+ </div>
185
+ </div>
186
+ <div class="col-xs-6">
187
+ <div class="form-group row">
188
+ <div class="col-xs-6">
189
+ <label><?php _e( 'Order gmedia', 'gmLang' ); ?></label>
190
+ <select name="term[orderby]" class="form-control input-sm">
191
+ <option value="custom"><?php _e( 'user defined', 'gmLang' ); ?></option>
192
+ <option selected="selected" value="ID"><?php _e( 'by ID', 'gmLang' ); ?></option>
193
+ <option value="title"><?php _e( 'by title', 'gmLang' ); ?></option>
194
+ <option value="date"><?php _e( 'by date', 'gmLang' ); ?></option>
195
+ <option value="modified"><?php _e( 'by last modified date', 'gmLang' ); ?></option>
196
+ <option value="rand"><?php _e( 'Random', 'gmLang' ); ?></option>
197
+ </select>
198
+ </div>
199
+ <div class="col-xs-6">
200
+ <label><?php _e( 'Sort order', 'gmLang' ); ?></label>
201
+ <select name="term[order]" class="form-control input-sm">
202
+ <option value="ASC"><?php _e( 'ASC', 'gmLang' ); ?></option>
203
+ <option selected="selected" value="DESC"><?php _e( 'DESC', 'gmLang' ); ?></option>
204
+ </select>
205
+ </div>
206
+ </div>
207
+ <div class="row">
208
+ <div class="form-group col-xs-6">
209
+ <label><?php _e( 'Status', 'gmLang' ); ?></label>
210
+ <select name="term[status]" class="form-control input-sm">
211
+ <option selected="selected" value="public"><?php _e( 'Public', 'gmLang' ); ?></option>
212
+ <option value="private"><?php _e( 'Private', 'gmLang' ); ?></option>
213
+ <option value="draft"><?php _e( 'Draft', 'gmLang' ); ?></option>
214
+ </select>
215
+ </div>
216
+ <div class="col-xs-6">
217
+ <div class="form-group">
218
+ <label><?php _e( 'Author', 'gmLang' ); ?></label>
219
+ <?php $user_ids = $gmCore->caps['gmedia_delete_others_media'] ? $gmCore->get_editable_user_ids() : array( $user_ID );
220
+ if ( $user_ids && $gmCore->caps['gmedia_edit_others_media'] ) {
221
+ if ( ! in_array( $user_ID, $user_ids ) ) {
222
+ array_push( $user_ids, $user_ID );
223
+ }
224
+ wp_dropdown_users( array(
225
+ 'include' => $user_ids,
226
+ 'include_selected' => true,
227
+ 'name' => 'term[global]',
228
+ 'selected' => $user_ID,
229
+ 'class' => 'form-control input-sm',
230
+ 'multi' => true,
231
+ 'show_option_all' => __( 'Shared', 'gmLang' )
232
+ ) );
233
+ } else {
234
+ echo '<input type="hidden" name="term[global]" value="' . $user_ID . '"/>';
235
+ echo '<div>' . get_the_author_meta( 'display_name', $user_ID ) . '</div>';
236
+ }
237
+ ?>
238
+ </div>
239
+ <div class="form-group">
240
+ <?php
241
+ wp_original_referer_field( true, 'previous' );
242
+ wp_nonce_field( 'GmediaTerms', 'term_save_wpnonce' );
243
+ ?>
244
+ <input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
245
+ <button style="display:block" type="submit" class="btn btn-primary btn-sm"
246
+ name="gmedia_album_save"><?php _e( 'Add New Album', 'gmLang' ); ?></button>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </div>
252
+ </form>
253
+ <?php } else { ?>
254
+ <div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
255
+ <button type="button" class="close" data-dismiss="alert">
256
+ <span aria-hidden="true">&times;</span><span class="sr-only"><?php _e( 'Close', 'gmLang' ); ?></span>
257
+ </button>
258
+ <strong><?php _e( 'Info:', 'gmLang' ); ?></strong> <?php _e( 'You are not allowed to add new terms', 'gmLang' ); ?>
259
+ </div>
260
+ <?php } ?>
261
+ <form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
262
+ <?php
263
+ if ( count( $gmediaTerms ) ) {
264
+ foreach ( $gmediaTerms as $item ) {
265
+ $termItems = array();
266
+ $per_page = 10;
267
+ if ( $item->count ) {
268
+ $args = array( 'no_found_rows' => true, 'per_page' => $per_page, 'album__in' => array( $item->term_id ), 'author' => $author );
269
+ $termItems = $gmDB->get_gmedias( $args );
270
+ }
271
+ $is_selected = in_array( $item->term_id, $gmProcessor->selected_items ) ? true : false;
272
+ $author_name = '';
273
+ $list_row_class = $row_class = '';
274
+ if ( $item->global ) {
275
+ $author_name .= sprintf( __( 'by %s', 'gmLang' ), get_the_author_meta( 'display_name', $item->global ) );
276
+ if ( $item->global == $user_ID ) {
277
+ $row_class .= ' current_user';
278
+ $allow_edit = $gmCore->caps['gmedia_album_manage'];
279
+ } else {
280
+ $row_class .= ' other_user';
281
+ $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
282
+ }
283
+ } else {
284
+ $author_name .= '(' . __( 'shared', 'gmLang' ) . ')';
285
+ $row_class .= ' shared';
286
+ $allow_edit = $gmCore->caps['gmedia_edit_others_media'];
287
+ }
288
+ if ( 'public' != $item->status ) {
289
+ $author_name .= ' [' . $item->status . ']';
290
+ if ( 'private' == $item->status ) {
291
+ $list_row_class = ' list-group-item-info';
292
+ } elseif ( 'draft' == $item->status ) {
293
+ $list_row_class = ' list-group-item-warning';
294
+ }
295
+ }
296
+ ?>
297
+ <div class="list-group-item term-list-item<?php echo $list_row_class; ?>">
298
+ <div class="row cb_term-object<?php echo $row_class; ?>">
299
+ <div class="term_id">#<?php echo $item->term_id; ?></div>
300
+ <div class="col-xs-5 term-label">
301
+ <div class="checkbox">
302
+ <input name="doaction[]"
303
+ type="checkbox"<?php echo $is_selected ? ' checked="checked"' : ''; ?>
304
+ value="<?php echo $item->term_id; ?>"/>
305
+ <?php if ( $allow_edit ) { ?>
306
+ <a href="<?php echo add_query_arg( array( 'edit_album' => $item->term_id ), $url ); ?>"><?php echo esc_html( $item->name ); ?></a>
307
+ <?php } else { ?>
308
+ <span><?php echo esc_html( $item->name ); ?></span>
309
+ <?php } ?>
310
+ <span class="term_info_author"><?php echo $author_name; ?></span>
311
+ <?php if ( $item->count ) { ?>
312
+ <a href="<?php echo $gmCore->get_admin_url( array(
313
+ 'page' => 'GrandMedia',
314
+ 'alb' => $item->term_id
315
+ ), array(), true ); ?>" class="badge pull-right"><?php echo $item->count; ?></a>
316
+ <?php } else { ?>
317
+ <span class="badge pull-right"><?php echo $item->count; ?></span>
318
+ <?php } ?>
319
+ </div>
320
+ </div>
321
+ <div class="col-xs-7">
322
+ <div class="term-images">
323
+ <?php if ( ! empty( $termItems ) ) {
324
+ foreach ( $termItems as $i ) {
325
+ ?>
326
+ <img style="z-index:<?php echo $per_page --; ?>;"
327
+ src="<?php echo $gmCore->gm_get_media_image( $i, 'thumb', false ); ?>"
328
+ alt="<?php echo $i->ID; ?>"
329
+ title="<?php echo esc_attr( $i->title ); ?>"/>
330
+ <?php
331
+ }
332
+ }
333
+ if ( count( $termItems ) < $item->count ) {
334
+ echo '...';
335
+ }
336
+ ?>
337
+ </div>
338
+ </div>
339
+ </div>
340
+ <?php if ( ! empty( $item->description ) ) { ?>
341
+ <div class="term-description"><?php echo nl2br(esc_html( $item->description )); ?></div>
342
+ <?php } ?>
343
+ </div>
344
+ <?php
345
+ }
346
+ } else {
347
+ ?>
348
+ <div class="list-group-item">
349
+ <div class="well well-lg text-center">
350
+ <h4><?php _e( 'No items to show.', 'gmLang' ); ?></h4>
351
+ </div>
352
+ </div>
353
+ <?php } ?>
354
+ <?php
355
+ wp_original_referer_field( true, 'previous' );
356
+ wp_nonce_field( 'GmediaTerms' );
357
+ ?>
358
+ </form>
359
+
360
+
361
+ <?php } elseif ( 'gmedia_tag' == $taxonomy ) { ?>
362
+ <?php if ( $allow_edit ) { ?>
363
+ <form method="post" id="gmedia-edit-term" name="gmAddTerms" class="panel-body"
364
+ style="padding-bottom:0; border-bottom:1px solid #ddd;">
365
+ <div class="row">
366
+ <div class="form-group col-xs-9">
367
+ <label><?php _e( 'Tags', 'gmLang' ); ?>
368
+ <small class="text-muted">(<?php _e( 'you can type multiple tags separated by comma' ) ?>)
369
+ </small>
370
+ </label>
371
+ <input type="text" class="form-control input-sm" name="term[name]"
372
+ placeholder="<?php _e( 'Tag Names', 'gmLang' ); ?>" required/>
373
+ </div>
374
+ <div class="col-xs-3" style="padding-top:24px;">
375
+ <?php
376
+ wp_original_referer_field( true, 'previous' );
377
+ wp_nonce_field( 'GmediaTerms', 'term_save_wpnonce' );
378
+ ?>
379
+ <input type="hidden" name="term[taxonomy]" value="gmedia_tag"/>
380
+ <button type="submit" class="btn btn-primary btn-sm"
381
+ name="gmedia_tag_add"><?php _e( 'Add New Tags', 'gmLang' ); ?></button>
382
+ </div>
383
+ </div>
384
+ </form>
385
+ <?php } else { ?>
386
+ <div class="alert alert-warning alert-dismissible" role="alert" style="margin-bottom:0">
387
+ <button type="button" class="close" data-dismiss="alert">
388
+ <span aria-hidden="true">&times;</span><span class="sr-only"><?php _e( 'Close', 'gmLang' ); ?></span>
389
+ </button>
390
+ <strong><?php _e( 'Info:', 'gmLang' ); ?></strong> <?php _e( 'You are not allowed to add new terms', 'gmLang' ); ?>
391
+ </div>
392
+ <?php } ?>
393
+ <form class="list-group" id="gm-list-table" style="margin-bottom:4px;">
394
+ <?php
395
+ if ( count( $gmediaTerms ) ) {
396
+ if ( $gmCore->caps['gmedia_edit_others_media'] ) {
397
+ $allow_edit = true;
398
+ } else {
399
+ $allow_edit = false;
400
+ }
401
+ foreach ( $gmediaTerms as $item ){
402
+ $termItems = array();
403
+ $per_page = 5;
404
+ if ( $item->count ) {
405
+ $args = array( 'no_found_rows' => true, 'per_page' => $per_page, 'tag_id' => $item->term_id, 'author' => $author );
406
+ $termItems = $gmDB->get_gmedias( $args );
407
+ }
408
+ $is_selected = in_array( $item->term_id, $gmProcessor->selected_items ) ? true : false;
409
+ ?>
410
+ <div class="list-group-item term-list-item">
411
+ <div class="row cb_term-object" id="tag_<?php echo $item->term_id; ?>">
412
+ <div class="term_id">#<?php echo $item->term_id; ?></div>
413
+ <div class="col-xs-5 term-label">
414
+ <div class="checkbox">
415
+ <input name="doaction[]"
416
+ type="checkbox"<?php echo $is_selected ? ' checked="checked"' : ''; ?>
417
+ value="<?php echo $item->term_id; ?>"/>
418
+ <?php if ( $allow_edit ) { ?>
419
+ <a class="edit_tag_link"
420
+ href="#tag_<?php echo $item->term_id; ?>"><?php echo esc_html( $item->name ); ?></a>
421
+ <span class="edit_tag_form" style="display:none;"><input class="edit_tag_input"
422
+ type="text"
423
+ data-tag_id="<?php echo $item->term_id; ?>"
424
+ name="gmedia_tag_name[<?php echo $item->term_id; ?>]"
425
+ value="<?php echo esc_attr( $item->name ); ?>"
426
+ placeholder="<?php echo esc_attr( $item->name ); ?>"/><a
427
+ href="#tag_<?php echo $item->term_id; ?>"
428
+ class="edit_tag_save btn btn-link glyphicon glyphicon-pencil"></a></span>
429
+ <?php } else { ?>
430
+ <span><?php echo esc_html( $item->name ); ?></span>
431
+ <?php } ?>
432
+ <?php if ( $item->count ) { ?>
433
+ <a href="<?php echo $gmCore->get_admin_url( array(
434
+ 'page' => 'GrandMedia',
435
+ 'tag_id' => $item->term_id
436
+ ), array(), true ); ?>" class="badge pull-right"><?php echo $item->count; ?></a>
437
+ <?php } else { ?>
438
+ <span class="badge pull-right"><?php echo $item->count; ?></span>
439
+ <?php } ?>
440
+ </div>
441
+ </div>
442
+ <div class="col-xs-7 term-images">
443
+ <?php if ( ! empty( $termItems ) ) {
444
+ foreach ( $termItems as $i ) {
445
+ ?>
446
+ <img style="z-index:<?php echo $per_page --; ?>;"
447
+ src="<?php echo $gmCore->gm_get_media_image( $i, 'thumb', false ); ?>"
448
+ alt="<?php echo $i->ID; ?>" title="<?php echo esc_attr( $i->title ); ?>"/>
449
+ <?php
450
+ }
451
+ }
452
+ if ( count( $termItems ) < $item->count ) {
453
+ echo '...';
454
+ }
455
+ ?>
456
+ </div>
457
+ </div>
458
+ </div>
459
+ <?php } ?>
460
+ <?php if ($allow_edit){ ?>
461
+ <script type="text/javascript">
462
+ jQuery(function ($) {
463
+ $('#gm-list-table').data('edit', false);
464
+ $('input.edit_tag_input').keypress(function (e) {
465
+ var tagdiv = $('#tag_' + $(this).data('tag_id'));
466
+ var charCode = e.charCode || e.keyCode || e.which;
467
+ if (charCode == 13) {
468
+ e.preventDefault();
469
+ edit_tag(tagdiv);
470
+ }
471
+ }).blur(function (e) {
472
+ var tagdiv = $('#tag_' + $(this).data('tag_id'));
473
+ edit_tag(tagdiv);
474
+ });
475
+
476
+ $('.edit_tag_link').click(function (e) {
477
+ e.preventDefault();
478
+ var id = $(this).attr('href');
479
+ $(this).hide();
480
+ $(id).find('.edit_tag_form').show().find('input').focus();
481
+ $('#gm-list-table').data('edit', true);
482
+ });
483
+ $('.edit_tag_save').click(function (e) {
484
+ e.preventDefault();
485
+ });
486
+
487
+ function edit_tag(tagdiv) {
488
+ var inp = tagdiv.find('.edit_tag_form input');
489
+ var new_tag_name = $.trim(inp.val());
490
+ var old_tag_name = inp.attr('placeholder');
491
+ if ((old_tag_name == new_tag_name) || ('' === new_tag_name) || $.isNumeric()) {
492
+ inp.val(old_tag_name);
493
+ tagdiv.find('.edit_tag_form').hide();
494
+ tagdiv.find('.edit_tag_link').show();
495
+ return;
496
+ }
497
+ var post_data = {
498
+ action: 'gmedia_tag_edit',
499
+ tag_id: inp.data('tag_id'),
500
+ tag_name: new_tag_name,
501
+ _wpnonce: $('#_wpnonce').val()
502
+ };
503
+ $.post(ajaxurl, post_data, function (data, textStatus, jqXHR) {
504
+ console.log(data);
505
+ if (data.error) {
506
+ //inp.val(inp.attr('placeholder'));
507
+ $('#gmedia-panel').before(data.error);
508
+ } else {
509
+ //new_tag_name = new_tag_name.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
510
+ inp.attr('placeholder', new_tag_name);
511
+ tagdiv.find('.edit_tag_link').text(new_tag_name).show();
512
+ $('#gmedia-panel').before(data.msg);
513
+ tagdiv.find('.edit_tag_form').hide();
514
+ }
515
+ });
516
+ }
517
+ });
518
+ </script>
519
+ <?php } ?>
520
+ <?php
521
+ } else {
522
+ ?>
523
+ <div class="list-group-item">
524
+ <div class="well well-lg text-center">
525
+ <h4><?php _e( 'No items to show.', 'gmLang' ); ?></h4>
526
+ </div>
527
+ </div>
528
+ <?php } ?>
529
+ <?php
530
+ wp_original_referer_field( true, 'previous' );
531
+ wp_nonce_field( 'GmediaTerms' );
532
+ ?>
533
+ </form>
534
+
535
+
536
+ <?php } elseif ( 'gmedia_category' == $taxonomy ) { ?>
537
+ <div class="panel-body"></div>
538
+ <div class="list-group" id="gm-list-table" style="margin-bottom:4px;">
539
+ <?php
540
+ $gmediaCategories = $gmGallery->options['taxonomies']['gmedia_category'];
541
+ foreach ( $gmediaTerms as $item ) {
542
+ $cat[ $item->name ] = $item;
543
+ }
544
+ unset( $gmediaTerms );
545
+
546
+ foreach ( $gmediaCategories as $name => $title ) {
547
+ $termItems = array();
548
+ $per_page = 10;
549
+ if ( isset( $cat[ $name ] ) ) {
550
+ $count = $cat[ $name ]->count;
551
+ $term_id = $cat[ $name ]->term_id;
552
+ if ( $count ) {
553
+ $args = array( 'no_found_rows' => true, 'per_page' => $per_page, 'category__in' => array( $term_id ), 'author' => $author );
554
+ $termItems = $gmDB->get_gmedias( $args );
555
+ }
556
+ } else {
557
+ $count = 0;
558
+ $term_id = '##';
559
+ }
560
+ ?>
561
+ <div class="list-group-item term-list-item">
562
+ <div class="row cb_term-object">
563
+ <div class="term_id">#<?php echo $term_id; ?></div>
564
+ <div class="col-xs-5" style="padding-top:10px; padding-bottom:10px;">
565
+ <?php echo esc_html( $title ); ?>
566
+ <?php if ( $count ) { ?>
567
+ <a href="<?php echo $gmCore->get_admin_url( array(
568
+ 'page' => 'GrandMedia',
569
+ 'cat' => $term_id
570
+ ), array(), true ); ?>" class="badge pull-right"><?php echo $count; ?></a>
571
+ <?php } else { ?>
572
+ <span class="badge pull-right"><?php echo $count; ?></span>
573
+ <?php } ?>
574
+ </div>
575
+ <div class="col-xs-7 term-images">
576
+ <?php if ( ! empty( $termItems ) ) {
577
+ foreach ( $termItems as $i ) {
578
+ ?>
579
+ <img style="z-index:<?php echo $per_page --; ?>;"
580
+ src="<?php echo $gmCore->gm_get_media_image( $i, 'thumb', false ); ?>"
581
+ alt="<?php echo $i->ID; ?>" title="<?php echo esc_attr( $i->title ); ?>"/>
582
+ <?php
583
+ }
584
+ }
585
+ if ( count( $termItems ) < $count ) {
586
+ echo '...';
587
+ }
588
+ ?>
589
+ </div>
590
+ </div>
591
+ </div>
592
+ <?php } ?>
593
+ </div>
594
+ <?php } ?>
595
+
596
+ </div>
597
 
598
  <?php
599
  }
604
  *
605
  * @return mixed content
606
  */
607
+ function gmediaAlbumEdit() {
608
+ global $gmDB, $gmCore, $gmProcessor, $user_ID;
609
+
610
+ if ( ! $gmCore->caps['gmedia_album_manage'] ) {
611
+ die( '-1' );
612
+ }
613
+
614
+ $url = add_query_arg( array( 'page' => $gmProcessor->page ), admin_url( 'admin.php' ) );
615
+
616
+ $taxonomy = 'gmedia_album';
617
+ $term_id = $gmCore->_get( 'edit_album' );
618
+
619
+ $term = $gmDB->get_term( $term_id, $taxonomy );
620
+
621
+ if ( ! empty( $term ) && ! is_wp_error( $term ) ) {
622
+
623
+ $term_meta = $gmDB->get_metadata( 'gmedia_term', $term->term_id );
624
+ $term_meta = array_map( 'reset', $term_meta );
625
+ $term_meta = array_merge( array( 'orderby' => 'ID', 'order' => 'DESC' ), $term_meta );
626
+ $per_page = 30;
627
+ $pager = '';
628
+ $mousesort = ( 'drag-n-drop' === $gmCore->_get( 'sort' ) ) ? true : false;
629
+
630
+ $termItems = array();
631
+ if ( $term->count ) {
632
+ $args = array( 'album__in' => $term->term_id, 'orderby' => $term_meta['orderby'], 'order' => $term_meta['order'] );
633
+ if ( $mousesort ) {
634
+ $args = array_merge( $args, array( 'nopaging' => 1 ) );
635
+ } else {
636
+ $args = array_merge( $args, array( 'per_page' => $per_page, 'page' => $gmCore->_get( 'pager', 1 ) ) );
637
+ }
638
+ $termItems = $gmDB->get_gmedias( $args );
639
+
640
+ if ( ! $mousesort ) {
641
+ $pager = $gmDB->query_pager();
642
+ }
643
+ }
644
+
645
+ ?>
646
+ <div class="panel panel-default">
647
+ <div class="panel-heading clearfix">
648
+ <div class="btn-toolbar pull-left">
649
+ <div class="btn-group" style="margin-right:20px;">
650
+ <a class="btn btn-primary active" href="<?php echo add_query_arg( array( 'term' => 'gmedia_album' ), $url ); ?>"><?php _e( 'Albums', 'gmLang' ); ?></a>
651
+ <a class="btn btn-default" href="<?php echo add_query_arg( array( 'term' => 'gmedia_tag' ), $url ); ?>"><?php _e( 'Tags', 'gmLang' ); ?></a>
652
+ <a class="btn btn-default" href="<?php echo add_query_arg( array( 'term' => 'gmedia_category' ), $url ); ?>"><?php _e( 'Categories', 'gmLang' ); ?></a>
653
+ </div>
654
+
655
+ <div class="btn-group">
656
+ <a class="btn btn-default" href="#"><?php _e( 'Action', 'gmLang' ); ?></a>
657
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
658
+ <span class="caret"></span>
659
+ <span class="sr-only"><?php _e( 'Toggle Dropdown', 'gmLang' ); ?></span>
660
+ </button>
661
+ <ul class="dropdown-menu" role="menu">
662
+ <?php if ( $mousesort ) { ?>
663
+ <li>
664
+ <a href="<?php echo $gmCore->get_admin_url( array(), array( 'sort' ) ); ?>"><?php _e( 'Disable Drag and Drop Sorting', 'gmLang' ); ?></a>
665
+ </li>
666
+ <?php } else { ?>
667
+ <li>
668
+ <a href="<?php echo $gmCore->get_admin_url( array( 'sort' => 'drag-n-drop' ), array( 'pager' ) ); ?>"><?php _e( 'Enable Drag and Drop Sorting', 'gmLang' ); ?></a>
669
+ </li>
670
+ <?php } ?>
671
+ <li><a href="<?php echo add_query_arg( array(
672
+ 'page' => 'GrandMedia',
673
+ 'alb' => $term->term_id
674
+ ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Show Album in Gmedia Library', 'gmLang' ); ?></a>
675
+ </li>
676
+ </ul>
677
+ </div>
678
+ </div>
679
+
680
+ <?php echo $pager; ?>
681
+
682
+ </div>
683
+
684
+ <form method="post" id="gmedia-edit-term" name="gmEditTerm" class="panel-body">
685
+ <h4 style="margin-top:0;">
686
+ <span class="pull-right"><?php echo __( 'ID', 'gmLang' ) . ": {$term->term_id}"; ?></span>
687
+ <?php _e( 'Edit Album' ); ?>: <em><?php echo esc_html( $term->name ); ?></em>
688
+ </h4>
689
+
690
+ <div class="row" style="border-bottom:1px solid #ddd; margin-bottom:15px;">
691
+ <div class="col-xs-6">
692
+ <div class="form-group">
693
+ <label><?php _e( 'Name', 'gmLang' ); ?></label>
694
+ <input type="text" class="form-control input-sm" name="term[name]"
695
+ value="<?php echo esc_attr( $term->name ); ?>"
696
+ placeholder="<?php _e( 'Album Name', 'gmLang' ); ?>" required/>
697
+ </div>
698
+ <div class="form-group">
699
+ <label><?php _e( 'Description', 'gmLang' ); ?></label>
 
700
  <textarea class="form-control input-sm" style="height:53px;" rows="2"
701
  name="term[description]"><?php echo $term->description; ?></textarea>
702
+ </div>
703
+ </div>
704
+ <div class="col-xs-6">
705
+ <div class="form-group row">
706
+ <div class="col-xs-6">
707
+ <label><?php _e( 'Order gmedia', 'gmLang' ); ?></label>
708
+ <select name="term[orderby]" class="form-control input-sm">
709
+ <option
710
+ value="custom"<?php selected( $term_meta['orderby'], 'custom' ); ?>><?php _e( 'user defined', 'gmLang' ); ?></option>
711
+ <option
712
+ value="ID"<?php selected( $term_meta['orderby'], 'ID' ); ?>><?php _e( 'by ID', 'gmLang' ); ?></option>
713
+ <option
714
+ value="title"<?php selected( $term_meta['orderby'], 'title' ); ?>><?php _e( 'by title', 'gmLang' ); ?></option>
715
+ <option
716
+ value="date"<?php selected( $term_meta['orderby'], 'date' ); ?>><?php _e( 'by date', 'gmLang' ); ?></option>
717
+ <option
718
+ value="modified"<?php selected( $term_meta['orderby'], 'modified' ); ?>><?php _e( 'by last modified date', 'gmLang' ); ?></option>
719
+ <option
720
+ value="rand"<?php selected( $term_meta['orderby'], 'rand' ); ?>><?php _e( 'Random', 'gmLang' ); ?></option>
721
+ </select>
722
+ </div>
723
+ <div class="col-xs-6">
724
+ <label><?php _e( 'Sort order', 'gmLang' ); ?></label>
725
+ <select name="term[order]" class="form-control input-sm">
726
+ <option
727
+ value="ASC"<?php selected( $term_meta['order'], 'ASC' ); ?>><?php _e( 'ASC', 'gmLang' ); ?></option>
728
+ <option
729
+ value="DESC"<?php selected( $term_meta['order'], 'DESC' ); ?>><?php _e( 'DESC', 'gmLang' ); ?></option>
730
+ </select>
731
+ </div>
732
+ </div>
733
+ <div class="row">
734
+ <div class="col-xs-6">
735
+ <div class="form-group">
736
+ <label><?php _e( 'Status', 'gmLang' ); ?></label>
737
+ <select name="term[status]" class="form-control input-sm">
738
+ <option
739
+ value="public"<?php selected( $term->status, 'public' ); ?>><?php _e( 'Public', 'gmLang' ); ?></option>
740
+ <option
741
+ value="private"<?php selected( $term->status, 'private' ); ?>><?php _e( 'Private', 'gmLang' ); ?></option>
742
+ <option
743
+ value="draft"<?php selected( $term->status, 'draft' ); ?>><?php _e( 'Draft', 'gmLang' ); ?></option>
744
+ </select>
745
+ </div>
746
+ <div class="form-group">
747
+ <div class="checkbox"><label><input type="checkbox" name="term[status_global]" value="1"> <?php _e( 'Apply Status for all items in album', 'gmLang' ); ?></label></div>
748
+ </div>
749
+ </div>
750
+ <div class="col-xs-6">
751
+ <div class="form-group">
752
+ <label><?php _e( 'Author', 'gmLang' ); ?></label>
753
+ <?php $user_ids = $gmCore->caps['gmedia_delete_others_media'] ? $gmCore->get_editable_user_ids() : array( $user_ID );
754
+ if ( $user_ids && $gmCore->caps['gmedia_edit_others_media'] ) {
755
+ if ( ! in_array( $user_ID, $user_ids ) ) {
756
+ array_push( $user_ids, $user_ID );
757
+ }
758
+ wp_dropdown_users( array(
759
+ 'include' => $user_ids,
760
+ 'include_selected' => true,
761
+ 'name' => 'term[global]',
762
+ 'selected' => $term->global,
763
+ 'class' => 'form-control input-sm',
764
+ 'multi' => true,
765
+ 'show_option_all' => __( 'Shared', 'gmLang' )
766
+ ) );
767
+ } else {
768
+ echo '<input type="hidden" name="term[global]" value="' . $user_ID . '"/>';
769
+ echo '<div>' . get_the_author_meta( 'display_name', $user_ID ) . '</div>';
770
+ }
771
+ ?>
772
+ </div>
773
+ <div class="form-group">
774
+ <?php wp_nonce_field( 'GmediaTerms', 'term_save_wpnonce' ); ?>
775
+ <input type="hidden" name="term[term_id]" value="<?php echo $term->term_id; ?>"/>
776
+ <input type="hidden" name="term[taxonomy]" value="gmedia_album"/>
777
+ <button style="display:block" type="submit" class="btn btn-primary btn-sm"
778
+ name="gmedia_album_save"><?php _e( 'Update', 'gmLang' ); ?></button>
779
+ </div>
780
+ </div>
781
+ </div>
782
+ </div>
783
+ </div>
784
+
785
+ <div class="termItems clearfix" id="termItems">
786
+ <?php if ( ! empty( $termItems ) ) {
787
+ foreach ( $termItems as $item ) {
788
+ ?>
789
+ <div class="gm-img-thumbnail" data-gmid="<?php echo $item->ID; ?>"><?php
790
+ ?>
791
+ <img src="<?php echo $gmCore->gm_get_media_image( $item, 'thumb', false ); ?>"
792
+ alt="<?php echo $item->ID; ?>" title="<?php echo esc_attr( $item->title ); ?>"/><?php
793
+ ?>
794
+ <input type="text" name="term[gmedia_ids][<?php echo $item->ID; ?>]"
795
+ value="<?php echo isset( $item->gmedia_order ) ? $item->gmedia_order : '0'; ?>"/><?php
796
+ ?><span class="label label-default">ID: <?php echo $item->ID; ?></span></div>
797
+ <?php
798
+ }
799
+ } ?>
800
+
801
+ </div>
802
+ <script type="text/javascript">
803
+ jQuery(function ($) {
804
+ var inputs = $('#gmedia-edit-term').find('input, select').keypress(function (e) {
805
+ var charCode = e.charCode || e.keyCode || e.which;
806
+ if (13 == charCode) {
807
+ e.preventDefault();
808
+ var nextInput = inputs.get(inputs.index(this) + 1);
809
+ if (nextInput) {
810
+ nextInput.focus();
811
+ } else {
812
+ $(this).blur();
813
+ }
814
+ }
815
+ });
816
+
817
+ var img_order_asc = <?php echo ('ASC' == $term_meta['order'])? 'true' : 'false'; ?>;
818
+ var sortdiv = $('#termItems');
819
+ var items = $('.gm-img-thumbnail', sortdiv);
820
+
821
+ <?php if($mousesort){ ?>
822
+ sortdiv.sortable({
823
+ items: '.gm-img-thumbnail',
824
+ handle: 'img',
825
+ placeholder: 'gm-img-thumbnail ui-highlight-placeholder',
826
+ forcePlaceholderSize: true,
827
+ //revert: true,
828
+ stop: function (event, ui) {
829
+ items = $('.gm-img-thumbnail', this);
830
+ var qty = items.length - 1;
831
+ items.each(function (i) {
832
+ var order = img_order_asc ? i : (qty - i);
833
+ $(this).find('input').val(order);
834
+ });
835
+ }
836
+ });
837
+
838
+ <?php } ?>
839
+
840
+ $('input', items).on('change', function () {
841
+ sortdiv.css({height: sortdiv.height()});
842
+ var items = $('.gm-img-thumbnail', sortdiv);
843
+
844
+ var new_order = $.isNumeric($(this).val()) ? parseInt($(this).val()) : -1;
845
+ $(this).val(new_order).closest('.gm-img-thumbnail').css({zIndex: 1000});
846
+
847
+ var ipos = [];
848
+ items.each(function (i, el) {
849
+ var pos = $(el).position();
850
+ $.data(el, 'pos', pos);
851
+ ipos[i] = pos;
852
+ });
853
+
854
+ var order = img_order_asc ? 'asc' : 'desc';
855
+ items.tsort('input', {
856
+ useVal: true,
857
+ order: order
858
+ }, 'span.label', {order: order}).each(function (i, el) {
859
+ var from = $.data(el, 'pos');
860
+ var to = ipos[i];
861
+ $(el).css({position: 'absolute', top: from.top, left: from.left}).animate({
862
+ top: to.top,
863
+ left: to.left
864
+ }, 500);
865
+ }).promise().done(function () {
866
+ items.removeAttr('style');
867
+ sortdiv.removeAttr('style');
868
+ });
869
+
870
+ $(this).val(((0 > new_order) ? 0 : new_order)).focus();
871
+ });
872
+ });
873
+ </script>
874
+ </form>
875
+ <div class="panel-body"><?php echo $pager; ?>
876
+ <div class="well well-sm pull-left"
877
+ style="margin:0;"><?php printf( __( 'Total items: %d' ), $term->count ); ?></div>
878
+ </div>
879
+ </div>
880
+ <?php
881
+ } else {
882
+
883
+ }
884
  }
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 - powerfull media library plugin for creating beautiful galleries and managing files.
6
- Version: 1.3.7
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
@@ -39,7 +39,7 @@ if(!class_exists('Gmedia')){
39
  */
40
  class Gmedia{
41
 
42
- var $version = '1.3.7';
43
  var $dbversion = '0.9.6';
44
  var $minium_WP = '3.5';
45
  var $options = '';
@@ -252,8 +252,8 @@ if(!class_exists('Gmedia')){
252
  'pluginPath' => $gmCore->gmedia_url
253
  ));
254
 
255
- wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/css/grand-media.css', array(), '1.3.7', 'all');
256
- wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/js/grand-media.js', array('jquery', 'gmedia-global-backend'), '1.3.4');
257
  wp_localize_script('grand-media', 'grandMedia', array(
258
  'error3' => __('Disable your Popup Blocker and try again.', 'gmLang'),
259
  'download' => __('downloading...', 'gmLang'),
3
  Plugin Name: Gmedia Gallery
4
  Plugin URI: http://wordpress.org/extend/plugins/grand-media/
5
  Description: Gmedia Gallery - powerfull media library plugin for creating beautiful galleries and managing files.
6
+ Version: 1.4.2
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
39
  */
40
  class Gmedia{
41
 
42
+ var $version = '1.4.2';
43
  var $dbversion = '0.9.6';
44
  var $minium_WP = '3.5';
45
  var $options = '';
252
  'pluginPath' => $gmCore->gmedia_url
253
  ));
254
 
255
+ wp_register_style('grand-media', $gmCore->gmedia_url . '/admin/css/grand-media.css', array(), '1.4.2', 'all');
256
+ wp_register_script('grand-media', $gmCore->gmedia_url . '/admin/js/grand-media.js', array('jquery', 'gmedia-global-backend'), '1.4.2');
257
  wp_localize_script('grand-media', 'grandMedia', array(
258
  'error3' => __('Disable your Popup Blocker and try again.', 'gmLang'),
259
  'download' => __('downloading...', 'gmLang'),
inc/core.php CHANGED
@@ -119,7 +119,7 @@ class GmediaCore {
119
  if ( true === $uri ) {
120
  $uri = admin_url( 'admin.php' );
121
  }
122
- $remove_args = array_unique( array_merge( array( 'doing_wp_cron', '_wpnonce', 'delete' ), $remove_args, array_keys( $add_args ) ) );
123
  $new_uri = remove_query_arg( $remove_args, $uri );
124
  if ( ! empty( $add_args ) ) {
125
  $new_uri = add_query_arg( $add_args, $new_uri );
@@ -266,7 +266,7 @@ class GmediaCore {
266
  if ( ! empty( $cover ) ) {
267
  if ( $this->is_digit( $cover ) ) {
268
  $image = $this->gm_get_media_image( (int) $cover, $size, false );
269
- } elseif ( ( 'thumb' != $size ) && ( false !== filter_var( $cover, FILTER_VALIDATE_URL ) ) ) {
270
  return $cover;
271
  }
272
  } elseif ( false !== $default ) {
@@ -1155,6 +1155,11 @@ class GmediaCore {
1155
 
1156
  $this->wp_add_id3_tag_data( $metadata, $data );
1157
 
 
 
 
 
 
1158
  return $metadata;
1159
  }
1160
 
@@ -1532,6 +1537,205 @@ class GmediaCore {
1532
  }
1533
  }
1534
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1535
  }
1536
 
1537
  global $gmCore;
119
  if ( true === $uri ) {
120
  $uri = admin_url( 'admin.php' );
121
  }
122
+ $remove_args = array_unique( array_merge( array( 'doing_wp_cron', '_wpnonce', 'delete', 'update_meta' ), $remove_args, array_keys( $add_args ) ) );
123
  $new_uri = remove_query_arg( $remove_args, $uri );
124
  if ( ! empty( $add_args ) ) {
125
  $new_uri = add_query_arg( $add_args, $new_uri );
266
  if ( ! empty( $cover ) ) {
267
  if ( $this->is_digit( $cover ) ) {
268
  $image = $this->gm_get_media_image( (int) $cover, $size, false );
269
+ } elseif ( false !== filter_var( $cover, FILTER_VALIDATE_URL ) ) {
270
  return $cover;
271
  }
272
  } elseif ( false !== $default ) {
1155
 
1156
  $this->wp_add_id3_tag_data( $metadata, $data );
1157
 
1158
+ if(isset($metadata['image']['data']) && !empty($metadata['image']['data'])){
1159
+ $image = 'data:'.$metadata['image']['mime'].';charset=utf-8;base64,'.base64_encode($metadata['image']['data']);
1160
+ $metadata['image']['data'] = $image;
1161
+ }
1162
+
1163
  return $metadata;
1164
  }
1165
 
1537
  }
1538
  }
1539
 
1540
+ /**
1541
+ * @param string $service
1542
+ * @param array $data
1543
+ *
1544
+ * @return array json
1545
+ */
1546
+ function app_service($service, $data = array()){
1547
+ global $gmProcessor;
1548
+
1549
+ if ( !current_user_can( 'manage_options') ) {
1550
+ die('-1');
1551
+ }
1552
+ if(!$service || !is_array($data)){
1553
+ die('0');
1554
+ }
1555
+
1556
+ $result = array();
1557
+ $defaults = array('email' => '', 'category' => '');
1558
+ $data = array_merge($defaults, $data);
1559
+
1560
+ $gm_options = get_option('gmediaOptions');
1561
+
1562
+ $gm_options['site_email'] = $data['email'];
1563
+ $gm_options['site_category'] = $data['category'];
1564
+
1565
+ if($service == 'app_deactivate'){
1566
+ $gm_options['mobile_app'] = 0;
1567
+ }
1568
+
1569
+ if(in_array($service, array('app_activate','app_updateinfo')) && !is_email($data['email'])){
1570
+ $result['error'] = $gmProcessor->alert('danger', __('Enter valid email, please', 'gmLang'));
1571
+ } else {
1572
+
1573
+ $hash = wp_generate_password('6', false);
1574
+
1575
+ $data['service'] = $service;
1576
+ $data['title'] = get_bloginfo('name');
1577
+ $data['description'] = get_bloginfo('description');
1578
+ $data['url'] = home_url();
1579
+ $data['license'] = $gm_options['license_key'];
1580
+ $data['site_ID'] = $gm_options['site_ID'];
1581
+ $data['site_hash'] = $hash;
1582
+
1583
+ set_transient($hash, $data, 45);
1584
+
1585
+ $pgcpost = wp_remote_post( 'http://mypgc.co/?gmservice=' . $service, array(
1586
+ 'method' => 'POST',
1587
+ 'timeout' => 45,
1588
+ 'body' => array( 'hash' => $hash, 'url' => $data['url'] ),
1589
+ ) );
1590
+
1591
+ if ( is_wp_error( $pgcpost ) ) {
1592
+ $result['error'] = $gmProcessor->alert( 'danger', $pgcpost->get_error_message() );
1593
+ }
1594
+ $pgcpost_body = wp_remote_retrieve_body($pgcpost);
1595
+ $result = (array) json_decode($pgcpost_body);
1596
+ if(isset($result['error'])){
1597
+ $result['error'] = $gmProcessor->alert( 'danger', $result['error'] );
1598
+ } else {
1599
+ if(isset($result['message'])){
1600
+ $result['message'] = $gmProcessor->alert( 'info', $result['message'] );
1601
+ }
1602
+
1603
+ $gm_options['site_ID'] = $result['site_ID'];
1604
+ $gm_options['mobile_app'] = $result['mobile_app'];
1605
+ $gm_options['site_category'] = $result['site_category'];
1606
+ }
1607
+ }
1608
+ update_option('gmediaOptions', $gm_options);
1609
+
1610
+ return $result;
1611
+ }
1612
+
1613
+ function i18n_exif_name($key) {
1614
+ $_key = strtolower($key);
1615
+ $tagnames = array(
1616
+ 'aperture' => __('Aperture','gmLang'),
1617
+ 'credit' => __('Credit','gmLang'),
1618
+ 'camera' => __('Camera','gmLang'),
1619
+ 'caption' => __('Caption','gmLang'),
1620
+ 'created_timestamp' => __('Date/Time','gmLang'),
1621
+ 'copyright' => __('Copyright','gmLang'),
1622
+ 'focal_length' => __('Focal length','gmLang'),
1623
+ 'iso' => __('ISO','gmLang'),
1624
+ 'shutter_speed' => __('Shutter speed','gmLang'),
1625
+ 'title' => __('Title','gmLang'),
1626
+ 'author' => __('Author','gmLang'),
1627
+ 'tags' => __('Tags','gmLang'),
1628
+ 'subject' => __('Subject','gmLang'),
1629
+ 'make' => __('Make','gmLang'),
1630
+ 'status' => __('Edit Status','gmLang'),
1631
+ 'category' => __('Category','gmLang'),
1632
+ 'keywords' => __('Keywords','gmLang'),
1633
+ 'created_date' => __('Date Created','gmLang'),
1634
+ 'created_time' => __('Time Created','gmLang'),
1635
+ 'position' => __('Author Position','gmLang'),
1636
+ 'city' => __('City','gmLang'),
1637
+ 'location' => __('Location','gmLang'),
1638
+ 'state' => __('Province/State','gmLang'),
1639
+ 'country_code' => __('Country code','gmLang'),
1640
+ 'country' => __('Country','gmLang'),
1641
+ 'headline' => __('Headline','gmLang'),
1642
+ 'source' => __('Source','gmLang'),
1643
+ 'contact' => __('Contact','gmLang'),
1644
+ 'last_modfied' => __('Last modified','gmLang'),
1645
+ 'tool' => __('Program tool','gmLang'),
1646
+ 'format' => __('Format','gmLang'),
1647
+ 'width' => __('Width','gmLang'),
1648
+ 'height' => __('Height','gmLang'),
1649
+ 'flash' => __('Flash','gmLang')
1650
+ );
1651
+
1652
+ if (isset($tagnames[$_key])){
1653
+ $key = $tagnames[$_key];
1654
+ }
1655
+
1656
+ return($key);
1657
+ }
1658
+
1659
+ /** Get item Meta
1660
+ *
1661
+ * @param int|object $item
1662
+ *
1663
+ * @return array metadata[key] = array(name, value);
1664
+ */
1665
+ function metadata_info($item){
1666
+ global $gmDB;
1667
+
1668
+ if(is_object($item)){
1669
+ $item_id = $item->ID;
1670
+ } elseif($this->is_digit($item)){
1671
+ $item_id = (int) $item;
1672
+ } else{
1673
+ return null;
1674
+ }
1675
+
1676
+ $metadata = array();
1677
+
1678
+ $meta = $gmDB->get_metadata( 'gmedia', $item_id, '_metadata', true );
1679
+ if(isset($meta['image_meta'])){
1680
+ $metainfo = $meta['image_meta'];
1681
+ } else{
1682
+ $metainfo = $meta;
1683
+ }
1684
+
1685
+ if(!empty($metainfo)){
1686
+ foreach($metainfo as $key => $value){
1687
+ if(empty($value)){
1688
+ continue;
1689
+ }
1690
+ if($key == 'aperture'){
1691
+ $value = 'F ' . $value;
1692
+ }
1693
+ if($key == 'focal_length'){
1694
+ $value = $value . ' mm';
1695
+ }
1696
+ if($key == 'shutter_speed'){
1697
+ $value = $value . ' sec';
1698
+ }
1699
+ if($key == 'created_timestamp'){
1700
+ $value = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $value);
1701
+ }
1702
+
1703
+ $key_name = $this->i18n_exif_name($key);
1704
+ $key_name = ucwords(str_replace('_', ' ', $key_name));
1705
+
1706
+ $metadata[$key] = array('name' => $key_name, 'value' => $value);
1707
+ }
1708
+ }
1709
+
1710
+ return $metadata;
1711
+ }
1712
+
1713
+ /** Get item Meta Text
1714
+ *
1715
+ * @param int $id
1716
+ *
1717
+ * @return string Meta text;
1718
+ */
1719
+ function metadata_text($id){
1720
+ $metatext = '';
1721
+ if(($metadata = $this->metadata_info($id))){
1722
+ $metatext .= '<h4>' . __('Meta Data', 'gmLang') . '</h4>';
1723
+ foreach($metadata as $meta){
1724
+ if(!is_array($meta['value'])){
1725
+ $metatext .= "\n<b>{$meta['name']}:</b> {$meta['value']}";
1726
+ } else{
1727
+ $metatext .= "\n<b>{$meta['name']}:</b>";
1728
+ foreach($meta['value'] as $key => $value){
1729
+ $key_name = ucwords(str_replace('_', ' ', $key));
1730
+ $metatext .= "\n - <b>{$key_name}:</b> {$value}";
1731
+ }
1732
+ }
1733
+ }
1734
+ }
1735
+
1736
+ return $metatext;
1737
+ }
1738
+
1739
  }
1740
 
1741
  global $gmCore;
inc/image-editor.php CHANGED
@@ -154,8 +154,8 @@ function gmedia_image_editor(){
154
  <div class="form-group pull-right">
155
  <label class="control-label"><?php _e('Apply to', 'gmLang'); ?>: &nbsp;</label>
156
  <select name="applyto" id="applyto" class="form-control input-sm">
157
- <option value="original" selected="selected"><?php _e('Original, Web-image, Thumbnail') ?></option>
158
- <option value="web"><?php _e('Web-image, Thumbnail') ?></option>
159
  <option value="thumb"><?php _e('Thumbnail') ?></option>
160
  </select>
161
  </div>
154
  <div class="form-group pull-right">
155
  <label class="control-label"><?php _e('Apply to', 'gmLang'); ?>: &nbsp;</label>
156
  <select name="applyto" id="applyto" class="form-control input-sm">
157
+ <option value="original"><?php _e('Original, Web-image, Thumbnail') ?></option>
158
+ <option value="web" selected="selected"><?php _e('Web-image, Thumbnail') ?></option>
159
  <option value="thumb"><?php _e('Thumbnail') ?></option>
160
  </select>
161
  </div>
inc/media-upload.php CHANGED
@@ -22,30 +22,9 @@ if ( current_user_can( 'gmedia_library' ) ) {
22
  * @return string
23
  */
24
  function gmedia_media_buttons_context( $context ) {
25
- global $post;
26
  $button = '
27
  <div style="display:inline-block;">
28
  <a id="gmedia-modal" title="Gmedia Galleries" class="gmedia_button button" href="#gmedia"><span class="wp-media-buttons-icon" style="background: url(' . plugins_url( GMEDIA_FOLDER . '/admin/images/gm-icon.png' ) . ') no-repeat top left;"></span> ' . __( 'Gmedia', 'gmLang' ) . '</a>
29
- <script type="text/html" id="tpl__gm-uploader">
30
- <div id="__gm-uploader" tabindex="0">
31
- <div class="media-modal wp-core-ui"><a class="media-modal-close" href="#"><span class="media-modal-icon"></span></a>
32
- <div class="media-modal-content"><div class="media-frame wp-core-ui hide-router hide-toolbar">
33
- <div class="media-frame-title"><h1>' . __( 'Gmedia Galleries', 'gmLang' ) . '</h1></div>
34
- <div class="media-frame-menu"><div class="media-menu">
35
- <a id="gmedia-modal-galleries" class="media-menu-item active" target="gmedia_frame" href="' . add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_galleries', 'chromeless' => true ), admin_url( 'media-upload.php' ) ) . '">' . __( 'Gmedia Galleries', 'gmLang' ) . '</a>
36
- <a id="gmedia-modal-terms" class="media-menu-item" target="gmedia_frame" href="' . add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_terms', 'chromeless' => true ), admin_url( 'media-upload.php' ) ) . '">' . __( 'Gmedia Collections', 'gmLang' ) . '</a>
37
- <a id="gmedia-modal-library" class="media-menu-item" target="gmedia_frame" href="' . add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_library', 'chromeless' => true ), admin_url( 'media-upload.php' ) ) . '">' . __( 'Gmedia Library', 'gmLang' ) . '</a>';
38
- if ( current_user_can( 'gmedia_upload' ) ) {
39
- $button .= '
40
- <a id="gmedia-modal-upload" class="media-menu-item" target="gmedia_frame" href="' . add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_library', 'action' => 'upload', 'chromeless' => true ), admin_url( 'media-upload.php' ) ) . '">' . __( 'Gmedia Upload', 'gmLang' ) . '</a>';
41
- }
42
- $button .= '
43
- </div></div>
44
- <div class="media-frame-content"><div class="media-iframe"><iframe name="gmedia_frame" src="' . add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_galleries', 'chromeless' => true ), admin_url( 'media-upload.php' ) ) . '"></iframe></div></div>
45
- </div></div>
46
- </div><div class="media-modal-backdrop"></div>
47
- </div>
48
- </script>
49
  </div>';
50
 
51
  return $context . $button;
@@ -261,7 +240,7 @@ function gmedia_add_media_galleries() {
261
 
262
  ?>
263
 
264
- <div class="panel panel-default">
265
  <div class="panel-heading clearfix">
266
  <form class="form-inline gmedia-search-form" role="search" method="get">
267
  <div class="form-group">
@@ -279,7 +258,7 @@ function gmedia_add_media_galleries() {
279
  <?php echo $gmDB->query_pager(); ?>
280
 
281
  <div class="btn-group" style="margin-right:20px;">
282
- <a class="btn btn-primary" target="_blank" href="<?php echo add_query_arg( array( 'page' => 'GrandMedia_Modules' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Create Gallery', 'gmLang' ); ?></a>
283
  </div>
284
 
285
  <div class="btn-group" style="margin-right:20px;">
@@ -316,7 +295,7 @@ function gmedia_add_media_galleries() {
316
  }
317
  ?>
318
  <div class="gmedia-insert-item list-group-item clearfix d-row<?php echo $list_row_class; ?>" id="list-item-<?php echo $term->term_id; ?>" data-id="<?php echo $term->term_id; ?>" data-type="<?php echo $term_meta['module']; ?>">
319
- <div class="media-object pull-left" style="width:130px;">
320
  <?php if ( ! $broken ) { ?>
321
  <span class="thumbnail"><img src="<?php echo $module['url'] . '/screenshot.png'; ?>" alt="<?php echo esc_attr( $term->name ); ?>"/></span>
322
  <?php } else { ?>
@@ -333,7 +312,7 @@ function gmedia_add_media_galleries() {
333
  <span class="label label-default"><?php _e( 'Author', 'gmLang' ); ?>:</span> <?php echo $term->global ? get_the_author_meta( 'display_name', $term->global ) : '&#8212;'; ?>
334
  </p>
335
 
336
- <p class="media-caption"><?php echo esc_html( $term->description ); ?></p>
337
  </div>
338
 
339
  <p class="media-meta hidden" style="font-weight:bold">
@@ -651,7 +630,6 @@ function gmedia_add_media_terms() {
651
  <span class="term_info_author"><?php echo $author_name; ?></span>
652
  <span class="badge pull-right"><?php echo $item->count; ?></span>
653
  </div>
654
- <span class="blank-aligner"></span>
655
  </div>
656
  <div class="col-xs-7">
657
  <div class="term-images">
@@ -715,7 +693,7 @@ function gmedia_add_media_terms() {
715
  </p>
716
  </div>
717
  <?php if ( ! empty( $item->description ) ) { ?>
718
- <div class="term-description"><?php echo esc_html( $item->description ); ?></div>
719
  <?php } ?>
720
  </div>
721
  <?php
@@ -828,7 +806,7 @@ function gmedia_add_media_library() {
828
 
829
  ?>
830
 
831
- <div class="panel panel-default">
832
  <div class="panel-heading clearfix">
833
  <form class="form-inline gmedia-search-form" role="search">
834
  <div class="form-group">
22
  * @return string
23
  */
24
  function gmedia_media_buttons_context( $context ) {
 
25
  $button = '
26
  <div style="display:inline-block;">
27
  <a id="gmedia-modal" title="Gmedia Galleries" class="gmedia_button button" href="#gmedia"><span class="wp-media-buttons-icon" style="background: url(' . plugins_url( GMEDIA_FOLDER . '/admin/images/gm-icon.png' ) . ') no-repeat top left;"></span> ' . __( 'Gmedia', 'gmLang' ) . '</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  </div>';
29
 
30
  return $context . $button;
240
 
241
  ?>
242
 
243
+ <div class="panel panel-default" id="gmedia-container">
244
  <div class="panel-heading clearfix">
245
  <form class="form-inline gmedia-search-form" role="search" method="get">
246
  <div class="form-group">
258
  <?php echo $gmDB->query_pager(); ?>
259
 
260
  <div class="btn-group" style="margin-right:20px;">
261
+ <a class="btn btn-primary" target="_blank" href="<?php echo add_query_arg( array( 'page' => 'GrandMedia_Modules' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Create New Gallery', 'gmLang' ); ?></a>
262
  </div>
263
 
264
  <div class="btn-group" style="margin-right:20px;">
295
  }
296
  ?>
297
  <div class="gmedia-insert-item list-group-item clearfix d-row<?php echo $list_row_class; ?>" id="list-item-<?php echo $term->term_id; ?>" data-id="<?php echo $term->term_id; ?>" data-type="<?php echo $term_meta['module']; ?>">
298
+ <div class="media-object pull-left" style="width:130px;margin-right:15px;">
299
  <?php if ( ! $broken ) { ?>
300
  <span class="thumbnail"><img src="<?php echo $module['url'] . '/screenshot.png'; ?>" alt="<?php echo esc_attr( $term->name ); ?>"/></span>
301
  <?php } else { ?>
312
  <span class="label label-default"><?php _e( 'Author', 'gmLang' ); ?>:</span> <?php echo $term->global ? get_the_author_meta( 'display_name', $term->global ) : '&#8212;'; ?>
313
  </p>
314
 
315
+ <p class="media-caption"><?php echo nl2br(esc_html( $term->description )); ?></p>
316
  </div>
317
 
318
  <p class="media-meta hidden" style="font-weight:bold">
630
  <span class="term_info_author"><?php echo $author_name; ?></span>
631
  <span class="badge pull-right"><?php echo $item->count; ?></span>
632
  </div>
 
633
  </div>
634
  <div class="col-xs-7">
635
  <div class="term-images">
693
  </p>
694
  </div>
695
  <?php if ( ! empty( $item->description ) ) { ?>
696
+ <div class="term-description"><?php echo nl2br(esc_html( $item->description )); ?></div>
697
  <?php } ?>
698
  </div>
699
  <?php
806
 
807
  ?>
808
 
809
+ <div class="panel panel-default" id="gmedia-container">
810
  <div class="panel-heading clearfix">
811
  <form class="form-inline gmedia-search-form" role="search">
812
  <div class="form-group">
inc/post-metabox.php CHANGED
@@ -13,12 +13,16 @@ function gmedia_add_meta_box( $page, $context ) {
13
  if ( ! current_user_can( 'gmedia_library' ) ) {
14
  return;
15
  }
 
 
16
  // Plugins that use custom post types can use this filter to show the Gmedia UI in their post type.
17
- $gm_post_types = apply_filters( 'gmedia-post-types', array( 'post', 'page' ) );
18
 
19
  if ( function_exists( 'add_meta_box' ) && ! empty( $gm_post_types ) && in_array( $page, $gm_post_types ) && 'side' === $context ) {
20
  add_action( 'admin_enqueue_scripts', 'gmedia_meta_box_load_scripts', 20 );
21
  //add_meta_box('gmedia-MetaBox', __('Gmedia Gallery MetaBox', 'gmLang'), 'gmedia_post_metabox', $page, 'side', 'low');
 
 
22
  }
23
 
24
  }
@@ -32,11 +36,35 @@ function gmedia_meta_box_load_scripts( $hook ) {
32
  if ( ( in_array( $hook, array( 'post.php', 'edit.php' ) ) && isset( $_GET['post'] ) && isset( $_GET['action'] ) && $_GET['action'] == 'edit' ) || $hook == 'post-new.php' ) {
33
  //wp_enqueue_style('wp-jquery-ui-dialog');
34
  //wp_enqueue_style('gmedia-meta-box', plugins_url(GMEDIA_FOLDER) . '/admin/css/meta-box.css', array('wp-jquery-ui-dialog'), '1.3.0');
35
- //wp_enqueue_script('gmedia-meta-box', plugins_url(GMEDIA_FOLDER) . '/admin/js/meta-box.js', array('jquery','jquery-ui-dialog','gmedia-global-backend'), '1.3.0', true);
36
- wp_enqueue_script( 'gmedia-meta-box', plugins_url( GMEDIA_FOLDER ) . '/admin/js/meta-box.js', array( 'jquery', 'gmedia-global-backend' ), '1.3.0', true );
37
  }
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /*
41
  * add_tinymce_plugin()
42
  * Load the TinyMCE plugin : tinymce_gmedia_plugin.js
@@ -135,9 +163,6 @@ function gmedia_post_metabox() {
135
  <?php
136
  }
137
 
138
- if ( current_user_can( 'gmedia_library' ) ) {
139
- add_filter( 'admin_post_thumbnail_html', 'gmedia_admin_post_thumbnail_html', 10, 2 );
140
- }
141
  /**
142
  * Filter for the post meta box. look for a NGG image if the ID is "ngg-<imageID>"
143
  *
13
  if ( ! current_user_can( 'gmedia_library' ) ) {
14
  return;
15
  }
16
+ $gm_options = get_option('gmediaOptions');
17
+ $gmedia_post_types = array_merge(array( 'post', 'page' ), (array) $gm_options['gmedia_post_types_support']);
18
  // Plugins that use custom post types can use this filter to show the Gmedia UI in their post type.
19
+ $gm_post_types = apply_filters( 'gmedia-post-types', $gmedia_post_types );
20
 
21
  if ( function_exists( 'add_meta_box' ) && ! empty( $gm_post_types ) && in_array( $page, $gm_post_types ) && 'side' === $context ) {
22
  add_action( 'admin_enqueue_scripts', 'gmedia_meta_box_load_scripts', 20 );
23
  //add_meta_box('gmedia-MetaBox', __('Gmedia Gallery MetaBox', 'gmLang'), 'gmedia_post_metabox', $page, 'side', 'low');
24
+ add_action( 'admin_footer', 'gmedia_post_modal_tpl' );
25
+ add_filter( 'admin_post_thumbnail_html', 'gmedia_admin_post_thumbnail_html', 10, 2 );
26
  }
27
 
28
  }
36
  if ( ( in_array( $hook, array( 'post.php', 'edit.php' ) ) && isset( $_GET['post'] ) && isset( $_GET['action'] ) && $_GET['action'] == 'edit' ) || $hook == 'post-new.php' ) {
37
  //wp_enqueue_style('wp-jquery-ui-dialog');
38
  //wp_enqueue_style('gmedia-meta-box', plugins_url(GMEDIA_FOLDER) . '/admin/css/meta-box.css', array('wp-jquery-ui-dialog'), '1.3.0');
39
+ //wp_enqueue_script('gmedia-meta-box', plugins_url(GMEDIA_FOLDER) . '/admin/js/meta-box.js', array('jquery','jquery-ui-dialog','gmedia-global-backend'), '1.4.2', true);
40
+ wp_enqueue_script( 'gmedia-meta-box', plugins_url( GMEDIA_FOLDER ) . '/admin/js/meta-box.js', array( 'jquery', 'gmedia-global-backend' ), '1.4.2', true );
41
  }
42
  }
43
 
44
+ function gmedia_post_modal_tpl() {
45
+ global $post;
46
+ ?>
47
+ <script type="text/html" id="tpl__gm-uploader">
48
+ <div id="__gm-uploader" tabindex="0">
49
+ <div class="media-modal wp-core-ui"><a class="media-modal-close" href="javascript:void(0)"><span class="media-modal-icon"></span></a>
50
+ <div class="media-modal-content"><div class="media-frame wp-core-ui hide-router hide-toolbar">
51
+ <div class="media-frame-title"><h1><?php _e( 'Gmedia Galleries', 'gmLang' ); ?></h1></div>
52
+ <div class="media-frame-menu"><div class="media-menu">
53
+ <a id="gmedia-modal-galleries" class="media-menu-item active" target="gmedia_frame" href="<?php echo add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_galleries', 'chromeless' => true ), admin_url( 'media-upload.php' ) ); ?>"><?php _e( 'Gmedia Galleries', 'gmLang' ); ?></a>
54
+ <a id="gmedia-modal-terms" class="media-menu-item" target="gmedia_frame" href="<?php echo add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_terms', 'chromeless' => true ), admin_url( 'media-upload.php' ) ); ?>"><?php _e( 'Gmedia Collections', 'gmLang' ); ?></a>
55
+ <a id="gmedia-modal-library" class="media-menu-item" target="gmedia_frame" href="<?php echo add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_library', 'chromeless' => true ), admin_url( 'media-upload.php' ) ); ?>"><?php _e( 'Gmedia Library', 'gmLang' ); ?></a>
56
+ <?php if ( current_user_can( 'gmedia_upload' ) ) { ?>
57
+ <a id="gmedia-modal-upload" class="media-menu-item" target="gmedia_frame" href="<?php echo add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_library', 'action' => 'upload', 'chromeless' => true ), admin_url( 'media-upload.php' ) ); ?>"><?php _e( 'Gmedia Upload', 'gmLang' ); ?></a>
58
+ <?php } ?>
59
+ </div></div>
60
+ <div class="media-frame-content"><div class="media-iframe"><iframe name="gmedia_frame" src="<?php echo add_query_arg( array( 'post_id' => $post->ID, 'tab' => 'gmedia_galleries', 'chromeless' => true ), admin_url( 'media-upload.php' ) ); ?>"></iframe></div></div>
61
+ </div></div>
62
+ </div><div class="media-modal-backdrop"></div>
63
+ </div>
64
+ </script>
65
+ <?php
66
+ }
67
+
68
  /*
69
  * add_tinymce_plugin()
70
  * Load the TinyMCE plugin : tinymce_gmedia_plugin.js
163
  <?php
164
  }
165
 
 
 
 
166
  /**
167
  * Filter for the post meta box. look for a NGG image if the ID is "ngg-<imageID>"
168
  *
module/jq-mplayer/index.php CHANGED
@@ -3,7 +3,7 @@ $module_info = array(
3
  'base' => 'jq-mplayer',
4
  'name' => 'jq-mplayer',
5
  'title' => 'Music Player',
6
- 'version' => '2.0',
7
  'author' => 'CodEasily.com',
8
  'description' => 'This beautiful audio player is totally written in JQuery and HTML5 + visitors can set rating for each track',
9
  'type' => 'music',
3
  'base' => 'jq-mplayer',
4
  'name' => 'jq-mplayer',
5
  'title' => 'Music Player',
6
+ 'version' => '2.1',
7
  'author' => 'CodEasily.com',
8
  'description' => 'This beautiful audio player is totally written in JQuery and HTML5 + visitors can set rating for each track',
9
  'type' => 'music',
module/jq-mplayer/init.php CHANGED
@@ -22,7 +22,13 @@ foreach($terms as $term){
22
  if($ext == 'ogg'){
23
  $ext = 'oga';
24
  }
25
- $cover = $gmCore->gm_get_media_image($item, 'thumb', true, '');
 
 
 
 
 
 
26
  $rating = $gmDB->get_metadata('gmedia', $item->ID, 'rating', true);
27
  $rating = array_merge(array('value' => 0, 'votes' => 0), (array) $rating);
28
  $content[] = array(
22
  if($ext == 'ogg'){
23
  $ext = 'oga';
24
  }
25
+ $default_cover = '';
26
+
27
+ $_metadata = $gmDB->get_metadata('gmedia', $item->ID, '_metadata', true);
28
+ if(isset($_metadata['image']['data']) && !empty($_metadata['image']['data'])){
29
+ $default_cover = $_metadata['image']['data'];
30
+ }
31
+ $cover = $gmCore->gm_get_media_image($item, 'thumb', true, $default_cover);
32
  $rating = $gmDB->get_metadata('gmedia', $item->ID, 'rating', true);
33
  $rating = array_merge(array('value' => 0, 'votes' => 0), (array) $rating);
34
  $content[] = array(
module/jq-mplayer/js/gm-music-player.js CHANGED
@@ -1,6 +1,6 @@
1
  /*
2
  * Title : Music Player Module for Gmedia Gallery plugin
3
- * Version : 2.0
4
  * Copyright : 2013 CodEasily.com
5
  * Website : http://www.codeasily.com
6
  */
1
  /*
2
  * Title : Music Player Module for Gmedia Gallery plugin
3
+ * Version : 2.1
4
  * Copyright : 2013 CodEasily.com
5
  * Website : http://www.codeasily.com
6
  */
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === Gmedia Gallery - Photo Gallery, Image Slider, Music Player, Video Player, Media Library ===
2
  Contributors: Rattus
3
  Donate link: http://codeasily.com/donate/
4
- Tags: gallery, image, images, library, music, video, slideshow, responsive, admin, Post, posts, easy gallery, iphone gallery, best gallery, portfolio, image gallery, photo gallery, photo, slider, header slider, admin, page, relative image, gallery slider
5
  Requires at least: 3.5
6
  Tested up to: 4.1.0
7
  Stable tag: trunk
@@ -14,6 +14,9 @@ Gmedia Gallery - powerfull media library plugin for creating beautiful galleries
14
 
15
  Manage files, show image galleries and photo slideshows, play music on your site Gmedia Gallery plugin. Gmedia Library provides a comprehensive interface for handling galleries, image and audio files.
16
 
 
 
 
17
  With Gmedia plugin you can upload an unlimited number of photo and audio files, create dozens of galleries and playlists, group pictures and other files in albums, and add tags for each file.
18
  Handle any file format and link any files with images in few clicks. You can import images with captions from Worpress Media Library, Flagallery plugin and from NextGen Gallery plugin right to Gmedia Library.
19
 
@@ -58,6 +61,7 @@ Help me make it best gallery plugin: test it and [write suggestions](http://code
58
 
59
  Features:
60
 
 
61
  * Mobile friendly, responsive galleries
62
  * Add tags, assign categories and group images in albums
63
  * Drag'n'drop sorting for files in Album
@@ -71,15 +75,15 @@ Features:
71
  * Uses WordPress' native Image Resizer
72
  * Import files from server folder or from others gallery plugins
73
  * Full Window Gallery Page permalinks (like GRAND Page in Flagallery) - you can copy gallery permalink and insert it in the website menu
74
- * (NEW) Role/Capability Manager intergrated
75
- * (NEW) Statuses: public, private (only for logged in users), etc. for files, albums
76
- * (NEW) Batch operations with selected Gmedia items
77
 
78
 
79
  TODO List:
80
 
81
- * iOS manage application (work in progress.. final stage)
82
  * Cover for Album. It will be also used for music without cover (work in progress..)
 
83
  * More Batch operations with selected Gmedia items (work in progress..)
84
  * Related Post images on Edit Post. Option to automatically create gallery in Post with related images (work in progress..)
85
  * Share albums to socials from admin panel (in queue)
@@ -120,6 +124,25 @@ Use [Gmedia Gallery support forum](http://codeasily.com/community/forum/gmedia-g
120
  = Photobox module =
121
  * Updated Photobox module. Added option to set thumbs size, fixed problems with portrait images.
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  = 1.3.7 =
124
  * Fixed css on Modules page
125
 
1
  === Gmedia Gallery - Photo Gallery, Image Slider, Music Player, Video Player, Media Library ===
2
  Contributors: Rattus
3
  Donate link: http://codeasily.com/donate/
4
+ Tags: gallery, image, images, library, music, video, slideshow, responsive, admin, Post, posts, easy gallery, iphone gallery, best gallery, portfolio, image gallery, photo gallery, photo, slider, header slider, admin, page, relative image, gallery slider, iOS app
5
  Requires at least: 3.5
6
  Tested up to: 4.1.0
7
  Stable tag: trunk
14
 
15
  Manage files, show image galleries and photo slideshows, play music on your site Gmedia Gallery plugin. Gmedia Library provides a comprehensive interface for handling galleries, image and audio files.
16
 
17
+ > **NEW:** Now You can upload and manage your Gmedia Library (images, tags, albums) anywhere!!!
18
+ > Download new **[Gmedia application for iPhone](https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8)**
19
+
20
  With Gmedia plugin you can upload an unlimited number of photo and audio files, create dozens of galleries and playlists, group pictures and other files in albums, and add tags for each file.
21
  Handle any file format and link any files with images in few clicks. You can import images with captions from Worpress Media Library, Flagallery plugin and from NextGen Gallery plugin right to Gmedia Library.
22
 
61
 
62
  Features:
63
 
64
+ * (NEW) Gmedia for iOS - [iOS manage application](https://itunes.apple.com/ua/app/gmedia/id947515626?mt=8) to manage your Library with your iPhone
65
  * Mobile friendly, responsive galleries
66
  * Add tags, assign categories and group images in albums
67
  * Drag'n'drop sorting for files in Album
75
  * Uses WordPress' native Image Resizer
76
  * Import files from server folder or from others gallery plugins
77
  * Full Window Gallery Page permalinks (like GRAND Page in Flagallery) - you can copy gallery permalink and insert it in the website menu
78
+ * Role/Capability Manager intergrated
79
+ * Statuses: public, private (only for logged in users), etc. for files, albums
80
+ * Batch operations with selected Gmedia items
81
 
82
 
83
  TODO List:
84
 
 
85
  * Cover for Album. It will be also used for music without cover (work in progress..)
86
+ * Templates for galleries (work in progress..)
87
  * More Batch operations with selected Gmedia items (work in progress..)
88
  * Related Post images on Edit Post. Option to automatically create gallery in Post with related images (work in progress..)
89
  * Share albums to socials from admin panel (in queue)
124
  = Photobox module =
125
  * Updated Photobox module. Added option to set thumbs size, fixed problems with portrait images.
126
 
127
+ = 1.4.2 =
128
+ * Fixed music and video Custom Cover when image url is set instead of ID
129
+ * Fixed View Original link on Gmedia Library page
130
+ * Added option to add Gmedia button on custom posts
131
+ * Added option to add image Exif data to image description via Batch Edit
132
+ * If mp3 have ID3Tag image cover in it, this image shows automatically. (You need update metadata for music files)
133
+ * Small changes on Gmedia Library page
134
+ * Small CSS changes on admin pages
135
+ * Music player module updated to new version
136
+
137
+ = 1.4.1 =
138
+ * New: Gmedia iOS application for managing Library with your iPhone
139
+ * Fixed Gmedia Mobile Application admin page.
140
+
141
+ = 1.4.0 =
142
+ * New: Gmedia iOS application for managing Library with your iPhone
143
+ * Fixed error getting xml on Modules page
144
+ * Small fixes and improvements
145
+
146
  = 1.3.7 =
147
  * Fixed css on Modules page
148
 
setup.php CHANGED
@@ -12,12 +12,19 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
12
  */
13
  function gmedia_default_options(){
14
 
 
 
 
 
 
15
  $gm['uninstall_dropdata'] = 'all'; // can be 'all', 'none', 'db'
16
 
17
  $gm['isolation_mode'] = '0';
18
  $gm['shortcode_raw'] = '0';
19
  $gm['endpoint'] = 'gmedia';
20
 
 
 
21
  $gm['folder']['image'] = 'image';
22
  $gm['folder']['image_thumb'] = 'image/thumb';
23
  $gm['folder']['image_original'] = 'image/original';
@@ -259,6 +266,11 @@ function gmedia_install(){
259
  * @return void
260
  */
261
  function gmedia_deactivate(){
 
 
 
 
 
262
  // remove & reset the init check option
263
  delete_option('gmediaInitCheck');
264
  }
12
  */
13
  function gmedia_default_options(){
14
 
15
+ $gm['site_email'] = get_bloginfo('admin_email');
16
+ $gm['site_category'] = '';
17
+ $gm['site_ID'] = '';
18
+ $gm['mobile_app'] = 0;
19
+
20
  $gm['uninstall_dropdata'] = 'all'; // can be 'all', 'none', 'db'
21
 
22
  $gm['isolation_mode'] = '0';
23
  $gm['shortcode_raw'] = '0';
24
  $gm['endpoint'] = 'gmedia';
25
 
26
+ $gm['gmedia_post_types_support'] = '';
27
+
28
  $gm['folder']['image'] = 'image';
29
  $gm['folder']['image_thumb'] = 'image/thumb';
30
  $gm['folder']['image_original'] = 'image/original';
266
  * @return void
267
  */
268
  function gmedia_deactivate(){
269
+ $gm_options = get_option('gmediaOptions');
270
+ if((int) $gm_options['mobile_app']){
271
+ global $gmCore;
272
+ $gmCore->app_service('app_deactivate');
273
+ }
274
  // remove & reset the init check option
275
  delete_option('gmediaInitCheck');
276
  }