Gallery by BestWebSoft - Version 4.5.6

Version Description

  • 27.08.2018
Download this release

Release Info

Developer bestwebsoft
Plugin Icon 128x128 Gallery by BestWebSoft
Version 4.5.6
Comparing to
See all releases

Code changes from version 4.5.5 to 4.5.6

gallery-plugin.php CHANGED
@@ -6,12 +6,12 @@ Description: Add beautiful galleries, albums & images to your Wordpress website
6
  Author: BestWebSoft
7
  Text Domain: gallery-plugin
8
  Domain Path: /languages
9
- Version: 4.5.5
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv2 or later
12
  */
13
 
14
- /* © Copyright 2017 BestWebSoft ( https://support.bestwebsoft.com )
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License, version 2, as
@@ -38,11 +38,12 @@ if ( ! function_exists( 'add_gllr_admin_menu' ) ) {
38
 
39
  add_submenu_page( 'edit.php?post_type=' . $gllr_options['post_type_name'], 'BWS Panel', 'BWS Panel', 'manage_options', 'gllr-bws-panel', 'bws_add_menu_render' );
40
 
41
- if ( isset( $submenu['edit.php?post_type=' . $gllr_options['post_type_name'] ] ) )
42
  $submenu['edit.php?post_type=' . $gllr_options['post_type_name'] ][] = array(
43
  '<span style="color:#d86463"> ' . __( 'Upgrade to Pro', 'gallery-plugin' ) . '</span>',
44
  'manage_options',
45
  'https://bestwebsoft.com/products/wordpress/plugins/gallery/?k=63a36f6bf5de0726ad6a43a165f38fe5&pn=79&v=' . $gllr_plugin_info["Version"] . '&wp_v=' . $wp_version );
 
46
 
47
  add_action( 'load-' . $settings, 'gllr_add_tabs' );
48
  add_action( 'load-post-new.php', 'gllr_add_tabs' );
@@ -84,8 +85,9 @@ if ( ! function_exists( 'gllr_init' ) ) {
84
  bws_include_init( plugin_basename( __FILE__ ) );
85
 
86
  if ( ! $gllr_plugin_info ) {
87
- if ( ! function_exists( 'get_plugin_data' ) )
88
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
 
89
  $gllr_plugin_info = get_plugin_data( __FILE__ );
90
  }
91
 
@@ -122,12 +124,13 @@ if ( ! function_exists( 'gllr_admin_init' ) ) {
122
  function gllr_admin_init() {
123
  global $bws_plugin_info, $gllr_plugin_info, $bws_shortcode_list, $gllr_options;
124
  /* Add variable for bws_menu */
125
- if ( empty( $bws_plugin_info ) )
126
  $bws_plugin_info = array( 'id' => '79', 'version' => $gllr_plugin_info["Version"] );
 
127
 
128
  /* add gallery to global $bws_shortcode_list */
129
  $bws_shortcode_list['gllr'] = array( 'name' => 'Gallery', 'js_function' => 'gllr_shortcode_init' );
130
-
131
  add_filter( 'manage_' . $gllr_options['post_type_name'] . '_posts_columns', 'gllr_change_columns' );
132
  add_action( 'manage_' . $gllr_options['post_type_name'] . '_posts_custom_column', 'gllr_custom_columns', 10, 2 );
133
  }
@@ -274,7 +277,6 @@ if ( ! function_exists( 'gllr_include_demo_data' ) ) {
274
  add_filter( 'wp_update_attachment_metadata',array( $gllr_BWS_demo_data, 'bws_wp_update_attachment_metadata' ), 10, 2 );
275
  }
276
  }
277
-
278
  /**
279
  * Function for update all gallery images to new version ( Stable tag: 4.3.6 )
280
  */
@@ -308,8 +310,9 @@ if ( ! function_exists( 'gllr_plugin_upgrade' ) ) {
308
  update_post_meta( $key, '_gallery_images', implode( ',', $value ) );
309
  }
310
  /* set gallery category for demo data */
311
- if ( function_exists( 'gllrctgrs_add_default_term_all_gallery' ) )
312
  gllrctgrs_add_default_term_all_gallery();
 
313
  }
314
  }
315
  }
@@ -364,7 +367,7 @@ if ( ! function_exists( 'gllr_post_type_images' ) ) {
364
  'not_found_in_trash' => __( 'No Gallery Categories found in Trash', 'gallery-plugin' ),
365
  'parent' => __( 'Parent Gallery Category', 'gallery-plugin' ),
366
  'items_list_navigation' => __( 'Gallery Categories list navigation', 'gallery-plugin' ),
367
- 'items_list' => __( 'Gallery Categories list', 'gallery-plugin' )
368
  ),
369
  'rewrite' => true,
370
  'show_ui' => true,
@@ -374,22 +377,13 @@ if ( ! function_exists( 'gllr_post_type_images' ) ) {
374
  )
375
  );
376
 
377
- if ( empty( $gllr_options['default_gallery_category'] ) ) {
378
- /**
379
- * @deprecated since 4.5.1
380
- * @todo UPDATE after 18.01.2018 - leave only Default term creation.
381
- */
382
- $gllrctgrs_options = get_option( 'gllrctgrs_options' );
383
- if ( ! empty( $gllrctgrs_options ) ) {
384
- $gllr_options['default_gallery_category'] = $gllrctgrs_options['default_gallery_category'];
385
- delete_option( 'gllrctgrs_options' );
386
- }
387
 
 
388
  $terms = get_terms(
389
  'gallery_categories',
390
  array(
391
  'hide_empty' => false,
392
- 'fields' => 'ids'
393
  )
394
  );
395
 
@@ -401,39 +395,20 @@ if ( ! function_exists( 'gllr_post_type_images' ) ) {
401
  $def_term_info = wp_insert_term( $def_term, 'gallery_categories',
402
  array(
403
  'description' => '',
404
- 'slug' => 'default'
405
  )
406
  );
407
  }
408
  if ( is_array( $def_term_info ) )
409
  $def_term_id = ( array_shift( $def_term_info ) );
410
- }
411
-
412
- if ( empty( $gllr_options['default_gallery_category'] ) )
413
- $gllr_options['default_gallery_category'] = intval( $def_term_id );
414
-
415
- /* assignment of default term for all gallery */
416
- $posts = get_posts( array(
417
- 'posts_per_page'=> -1,
418
- 'post_type' => $gllr_options['post_type_name']
419
- ) );
420
- if ( ! empty( $posts ) ) {
421
- foreach ( $posts as $post ) {
422
- if ( ! has_term( '', 'gallery_categories', $post ) ) { /* Checked and updated if necessary term */
423
- wp_set_object_terms( $post->ID, $gllr_options['default_gallery_category'], 'gallery_categories' );
424
- }
425
- }
426
- }
427
- /**
428
- * @end todo
429
- */
430
  }
431
 
432
- if ( $force_flush_rules || ( isset( $gllr_options["flush_rewrite_rules"] ) && $gllr_options["flush_rewrite_rules"] == 1 ) ) {
433
  flush_rewrite_rules();
434
- $gllr_options["flush_rewrite_rules"] = 0;
435
  update_option( 'gllr_options', $gllr_options );
436
- }
437
  }
438
  }
439
 
@@ -548,7 +523,7 @@ if ( ! class_exists( 'Gllr_CategoryDropdown' ) ) {
548
  $output .= '>';
549
  $output .= str_repeat( '&nbsp;', $depth * 3 ) . $term_name;
550
  if ( $args['show_count'] )
551
- $output .= '&nbsp;(' . $term->count .')';
552
  $output .= '</option>';
553
  }
554
  }
@@ -566,7 +541,7 @@ if ( ! function_exists( 'gllr_add_notice_below_table' ) ) {
566
  if ( ! empty( $def_term ) ) {
567
  $def_term_name = $def_term->name;
568
  if ( ! empty( $def_term_name ) ) {
569
- echo '<div class="form-wrap"><p><i><strong>' . __( 'Note', 'gallery-plugin') . ':</strong> ' . sprintf( __( 'When deleting a category, the galleries that belong to this category will not be deleted. These galleries will be moved to the category %s.', 'gallery-plugin' ), '<strong>' . $def_term_name . '</strong>' ) . '</i></p></div>';
570
  }
571
  }
572
  }
@@ -673,8 +648,9 @@ if ( ! function_exists( 'gllr_taxonomy_filter' ) ) {
673
  if ( ! function_exists( 'gllr_hide_delete_link' ) ) {
674
  function gllr_hide_delete_link( $actions, $tag ) {
675
  global $gllr_options;
676
- if ( $tag->term_id == $gllr_options['default_gallery_category'] )
677
  unset( $actions['delete'] );
 
678
  return $actions;
679
  }
680
  }
@@ -791,8 +767,9 @@ if ( ! function_exists( 'gllr_template_include' ) ) {
791
  function gllr_template_include( $template ) {
792
  global $gllr_options, $wp_query;
793
 
794
- if ( function_exists( 'is_embed' ) && is_embed() )
795
  return $template;
 
796
 
797
  $post_type = get_post_type();
798
  if ( is_single() && $gllr_options['post_type_name'] == $post_type ) {
@@ -807,8 +784,9 @@ if ( ! function_exists( 'gllr_template_include' ) ) {
807
  $find = array( $file, 'bws-templates/' . $file );
808
  $template = locate_template( $find );
809
 
810
- if ( ! $template )
811
  $template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' . $file;
 
812
  }
813
 
814
  return $template;
@@ -959,8 +937,9 @@ if ( ! function_exists( 'gllr_template_content' ) ) {
959
  wp_reset_query();
960
  $request = $wp_query->request;
961
  $pages = intval( $count_all_albums / $per_page );
962
- if ( $count_all_albums % $per_page > 0 )
963
  $pages += 1;
 
964
  $range = 100;
965
  if ( ! $pages ) {
966
  $pages = 1;
@@ -1152,10 +1131,11 @@ if ( ! function_exists( 'gllr_add_pdf_print_content' ) ) {
1152
  }
1153
  </style>\n";
1154
 
1155
- if ( 1 == $gllr_options['border_images'] )
1156
  $image_style = "border: {$gllr_options['border_images_width']}px solid {$gllr_options['border_images_color']};";
1157
- else
1158
  $image_style = "border: none;";
 
1159
  $image_style .= "margin: 0;";
1160
 
1161
  $args = array(
@@ -1645,10 +1625,11 @@ if ( ! function_exists( 'gllr_custom_columns' ) ) {
1645
  break;
1646
  case "images":
1647
  $images_id = get_post_meta( $post->ID, '_gallery_images', true );
1648
- if ( empty( $images_id ) )
1649
  echo 0;
1650
- else
1651
  echo $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE ID IN( " . $images_id . " )" );
 
1652
  break;
1653
  case 'gallery_categories':
1654
  $terms = get_the_terms( $post->ID, 'gallery_categories' );
@@ -1783,7 +1764,7 @@ if ( ! function_exists ( 'gllr_admin_head' ) ) {
1783
  'img_success' => __( 'All images were updated.', 'gallery-plugin' ),
1784
  'img_error' => __( 'Error.', 'gallery-plugin' )
1785
  ) );
1786
- } else if (
1787
  ( 'post.php' == $pagenow && isset( $_GET['action'] ) && 'edit' == $_GET['action'] && get_post_type( get_the_ID() ) == $gllr_options['post_type_name'] ) ||
1788
  ( 'post-new.php' == $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] == $gllr_options['post_type_name'] ) ) {
1789
  wp_enqueue_script( 'jquery-ui-sortable' );
@@ -2223,7 +2204,7 @@ if ( ! function_exists ( 'gllr_update_image' ) ) {
2223
 
2224
  $string_parent_id = implode( ",", $array_parent_id );
2225
 
2226
- $metas = $wpdb->get_results( "SELECT `meta_value` FROM $wpdb->postmeta WHERE `meta_key` = '_gallery_images' AND `post_id` IN (" . $string_parent_id . ")", ARRAY_A );
2227
 
2228
  $result_attachment_id = '';
2229
  foreach ( $metas as $value ) {
@@ -2331,34 +2312,42 @@ if ( ! function_exists ( 'gllr_image_make_intermediate_size' ) ) {
2331
  if ( ! function_exists ( 'gllr_image_resize' ) ) {
2332
  function gllr_image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
2333
  $size = @getimagesize( $file );
2334
- if ( ! $size )
2335
  return new WP_Error( 'invalid_image', __( 'Image size not defined', 'gallery-plugin' ), $file );
 
2336
 
2337
  $type = $size[2];
2338
 
2339
- if ( 3 == $type )
2340
  $image = imagecreatefrompng( $file );
2341
- else if ( 2 == $type )
 
2342
  $image = imagecreatefromjpeg( $file );
2343
- else if ( 1 == $type )
 
2344
  $image = imagecreatefromgif( $file );
2345
- else if ( 15 == $type )
 
2346
  $image = imagecreatefromwbmp( $file );
2347
- else if ( 16 == $type )
 
2348
  $image = imagecreatefromxbm( $file );
2349
- else
2350
  return new WP_Error( 'invalid_image', __( 'Plugin updates only PNG, JPEG, GIF, WPMP or XBM filetype. For other, please reload images manually.', 'gallery-plugin' ), $file );
 
2351
 
2352
- if ( ! is_resource( $image ) )
2353
  return new WP_Error( 'error_loading_image', $image, $file );
 
2354
 
2355
  /*$size = @getimagesize( $file );*/
2356
  list( $orig_w, $orig_h, $orig_type ) = $size;
2357
 
2358
  $dims = gllr_image_resize_dimensions( $orig_w, $orig_h, $max_w, $max_h, $crop );
2359
 
2360
- if ( ! $dims )
2361
  return new WP_Error( 'error_getting_dimensions', __( 'Image size not defined', 'gallery-plugin' ) );
 
2362
  list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
2363
 
2364
  $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
@@ -2366,36 +2355,42 @@ if ( ! function_exists ( 'gllr_image_resize' ) ) {
2366
  imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
2367
 
2368
  /* Convert from full colors to index colors, like original PNG. */
2369
- if ( IMAGETYPE_PNG == $orig_type && function_exists( 'imageistruecolor' ) && !imageistruecolor( $image ) )
2370
  imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
 
2371
 
2372
  /* We don't need the original in memory anymore */
2373
  imagedestroy( $image );
2374
 
2375
  /* $suffix will be appended to the destination filename, just before the extension */
2376
- if ( ! $suffix )
2377
  $suffix = "{$dst_w}x{$dst_h}";
 
2378
 
2379
  $info = pathinfo( $file );
2380
  $dir = $info['dirname'];
2381
  $ext = $info['extension'];
2382
  $name = wp_basename( $file, ".$ext" );
2383
 
2384
- if ( ! is_null( $dest_path ) and $_dest_path = realpath( $dest_path ) )
2385
  $dir = $_dest_path;
 
2386
  $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
2387
 
2388
  if ( IMAGETYPE_GIF == $orig_type ) {
2389
- if ( !imagegif( $newimage, $destfilename ) )
2390
  return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'gallery-plugin' ) );
 
2391
  } elseif ( IMAGETYPE_PNG == $orig_type ) {
2392
- if ( !imagepng( $newimage, $destfilename ) )
2393
  return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'gallery-plugin' ) );
 
2394
  } else {
2395
  /* All other formats are converted to jpg */
2396
  $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
2397
- if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
2398
  return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'gallery-plugin' ) );
 
2399
  }
2400
  imagedestroy( $newimage );
2401
 
@@ -2409,11 +2404,13 @@ if ( ! function_exists ( 'gllr_image_resize' ) ) {
2409
 
2410
  if ( ! function_exists ( 'gllr_image_resize_dimensions' ) ) {
2411
  function gllr_image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
2412
- if ( 0 >= $orig_w || 0 >= $orig_h )
2413
  return false;
 
2414
  /* At least one of dest_w or dest_h must be specific */
2415
- if ( 0 >= $dest_w && 0 >= $dest_h )
2416
  return false;
 
2417
 
2418
  if ( $crop ) {
2419
  /* Crop the largest possible portion of the original image that we can size to $dest_w x $dest_h */
@@ -2421,11 +2418,13 @@ if ( ! function_exists ( 'gllr_image_resize_dimensions' ) ) {
2421
  $new_w = min( $dest_w, $orig_w );
2422
  $new_h = min( $dest_h, $orig_h );
2423
 
2424
- if ( ! $new_w )
2425
  $new_w = intval( $new_h * $aspect_ratio );
 
2426
 
2427
- if ( ! $new_h )
2428
  $new_h = intval( $new_w / $aspect_ratio );
 
2429
 
2430
  $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
2431
 
@@ -2443,8 +2442,9 @@ if ( ! function_exists ( 'gllr_image_resize_dimensions' ) ) {
2443
  list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
2444
  }
2445
  /* If the resulting image would be the same size or larger we don't want to resize it */
2446
- if ( $new_w >= $orig_w && $new_h >= $orig_h )
2447
  return false;
 
2448
  /* The return array matches the parameters to imagecopyresampled() */
2449
  /* Int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h */
2450
  return array( 0, 0, ( int ) $s_x, ( int ) $s_y, ( int ) $new_w, ( int ) $new_h, ( int ) $crop_w, ( int ) $crop_h );
@@ -2474,10 +2474,12 @@ if ( ! function_exists( 'gllr_media_custom_box' ) ) {
2474
  }
2475
 
2476
  if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2477
- if ( ! class_exists( 'WP_List_Table' ) )
2478
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
2479
- if ( ! class_exists( 'WP_Media_List_Table' ) )
 
2480
  require_once( ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php' );
 
2481
 
2482
  class Gllr_Media_Table extends WP_Media_List_Table {
2483
  public function __construct( $args = array() ) {
@@ -2502,10 +2504,11 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2502
  $current_page = $this->get_pagenum();
2503
  $this->_column_headers = array( $columns, $hidden, $sortable );
2504
  $images_id = get_post_meta( $original_post->ID, '_gallery_images', true );
2505
- if ( empty( $images_id ) )
2506
  $total_items = 0;
2507
- else
2508
  $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE ID IN( " . $images_id . " )" );
 
2509
 
2510
  $per_page = -1;
2511
 
@@ -2523,8 +2526,9 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2523
  'per_page' => $per_page
2524
  ) );
2525
 
2526
- if ( $wp_version < '4.2' )
2527
  $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' == $_REQUEST['attachment-filter'];
 
2528
  }
2529
 
2530
  function extra_tablenav( $which ) {
@@ -2552,15 +2556,17 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2552
  global $wpdb, $post, $original_post;
2553
 
2554
  $images_id = get_post_meta( $original_post->ID, '_gallery_images', true );
2555
- if ( empty( $images_id ) )
2556
  $total_items = 0;
2557
- else
2558
  $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE ID IN( " . $images_id . " )" );
 
2559
 
2560
- if ( $total_items > 0 )
2561
  return true;
2562
- else
2563
  return false;
 
2564
  }
2565
 
2566
  function no_items() {
@@ -2589,7 +2595,7 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2589
  * @access protected
2590
  *
2591
  * @param string $which The location of the bulk actions: 'top' or 'bottom'.
2592
- * This is designated as optional for backwards-compatibility.
2593
  */
2594
  function bulk_actions( $which = '' ) {
2595
  if ( is_null( $this->_actions ) ) {
@@ -2613,8 +2619,9 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2613
  $two = '2';
2614
  }
2615
 
2616
- if ( empty( $this->_actions ) )
2617
  return;
 
2618
 
2619
  echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action', 'gallery-plugin' ) . "</label>";
2620
  echo "<select name='action-" . esc_attr( $which ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
@@ -2656,7 +2663,7 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2656
 
2657
  function get_columns() {
2658
  $lists_columns = array(
2659
- 'cb' => '<input type="checkbox" />',
2660
  'title' => __( 'File', 'gallery-plugin' ),
2661
  'dimensions' => __( 'Dimensions', 'gallery-plugin' ),
2662
  'gllr_image_text' => __( 'Title', 'gallery-plugin' ) . bws_add_help_box( '<img src="' . plugins_url( 'images/image-title-example.png', __FILE__ ) . '" />' ),
@@ -2722,8 +2729,9 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2722
  function single_row( $gllr_mode ) {
2723
  global $post, $original_post, $gllr_options, $gllr_plugin_info, $wp_version;
2724
 
2725
- if ( empty( $gllr_options ) )
2726
  gllr_settings();
 
2727
 
2728
  $attachment_metadata = wp_get_attachment_metadata( $post->ID );
2729
  if ( 'grid' == $gllr_mode ) {
@@ -2830,11 +2838,13 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2830
  foreach ( $columns as $column_name => $column_display_name ) {
2831
 
2832
  $classes = "$column_name column-$column_name";
2833
- if ( in_array( $column_name, $hidden ) )
2834
  $classes .= ' hidden';
 
2835
 
2836
- if ( 'title' == $column_name )
2837
  $classes .= ' column-primary has-row-actions';
 
2838
 
2839
  $attributes = "class='$classes'";
2840
  switch ( $column_name ) {
@@ -2903,26 +2913,31 @@ if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2903
  $actions = array();
2904
 
2905
  if ( $this->detached ) {
2906
- if ( current_user_can( 'edit_post', $post->ID ) )
2907
  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit', 'gallery-plugin' ) . '</a>';
2908
- if ( current_user_can( 'delete_post', $post->ID ) )
 
2909
  if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
2910
  $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash', 'gallery-plugin' ) . "</a>";
2911
  } else {
2912
  $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
2913
  $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently', 'gallery-plugin' ) . "</a>";
2914
  }
 
2915
  $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'gallery-plugin' ), $att_title ) ) . '" rel="permalink">' . __( 'View', 'gallery-plugin' ) . '</a>';
2916
- if ( current_user_can( 'edit_post', $post->ID ) )
2917
  $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">' . __( 'Attach', 'gallery-plugin' ) . '</a>';
 
2918
  } else {
2919
- if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
2920
  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit', 'gallery-plugin' ) . '</a>';
 
2921
  if ( current_user_can( 'delete_post', $post->ID ) ) {
2922
- if ( $this->is_trash )
2923
  $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore', 'gallery-plugin' ) . "</a>";
2924
- elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
2925
  $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash', 'gallery-plugin' ) . "</a>";
 
2926
  if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
2927
  $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
2928
  $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently', 'gallery-plugin' ) . "</a>";
@@ -3230,8 +3245,8 @@ if ( ! function_exists( 'gllr_shortcode_button_content' ) ) {
3230
  if ( ! isset( $gllr_first ) ) $gllr_first = get_the_ID();
3231
  $title = get_the_title( $post->ID );
3232
  if ( empty( $title ) )
3233
- $title = '(' . __( 'no title', 'gallery-plugin' ) . ')'; ?>
3234
- <option value="<?php the_ID(); ?>"><?php echo $title; ?> (<?php echo get_the_date( 'Y-m-d' ); ?>)</option>
3235
  <?php }
3236
  wp_reset_postdata();
3237
  $post = $old_post; ?>
6
  Author: BestWebSoft
7
  Text Domain: gallery-plugin
8
  Domain Path: /languages
9
+ Version: 4.5.6
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv2 or later
12
  */
13
 
14
+ /* © Copyright 2018 BestWebSoft ( https://support.bestwebsoft.com )
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License, version 2, as
38
 
39
  add_submenu_page( 'edit.php?post_type=' . $gllr_options['post_type_name'], 'BWS Panel', 'BWS Panel', 'manage_options', 'gllr-bws-panel', 'bws_add_menu_render' );
40
 
41
+ if ( isset( $submenu['edit.php?post_type=' . $gllr_options['post_type_name'] ] ) ) {
42
  $submenu['edit.php?post_type=' . $gllr_options['post_type_name'] ][] = array(
43
  '<span style="color:#d86463"> ' . __( 'Upgrade to Pro', 'gallery-plugin' ) . '</span>',
44
  'manage_options',
45
  'https://bestwebsoft.com/products/wordpress/plugins/gallery/?k=63a36f6bf5de0726ad6a43a165f38fe5&pn=79&v=' . $gllr_plugin_info["Version"] . '&wp_v=' . $wp_version );
46
+ }
47
 
48
  add_action( 'load-' . $settings, 'gllr_add_tabs' );
49
  add_action( 'load-post-new.php', 'gllr_add_tabs' );
85
  bws_include_init( plugin_basename( __FILE__ ) );
86
 
87
  if ( ! $gllr_plugin_info ) {
88
+ if ( ! function_exists( 'get_plugin_data' ) ) {
89
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
90
+ }
91
  $gllr_plugin_info = get_plugin_data( __FILE__ );
92
  }
93
 
124
  function gllr_admin_init() {
125
  global $bws_plugin_info, $gllr_plugin_info, $bws_shortcode_list, $gllr_options;
126
  /* Add variable for bws_menu */
127
+ if ( empty( $bws_plugin_info ) ) {
128
  $bws_plugin_info = array( 'id' => '79', 'version' => $gllr_plugin_info["Version"] );
129
+ }
130
 
131
  /* add gallery to global $bws_shortcode_list */
132
  $bws_shortcode_list['gllr'] = array( 'name' => 'Gallery', 'js_function' => 'gllr_shortcode_init' );
133
+
134
  add_filter( 'manage_' . $gllr_options['post_type_name'] . '_posts_columns', 'gllr_change_columns' );
135
  add_action( 'manage_' . $gllr_options['post_type_name'] . '_posts_custom_column', 'gllr_custom_columns', 10, 2 );
136
  }
277
  add_filter( 'wp_update_attachment_metadata',array( $gllr_BWS_demo_data, 'bws_wp_update_attachment_metadata' ), 10, 2 );
278
  }
279
  }
 
280
  /**
281
  * Function for update all gallery images to new version ( Stable tag: 4.3.6 )
282
  */
310
  update_post_meta( $key, '_gallery_images', implode( ',', $value ) );
311
  }
312
  /* set gallery category for demo data */
313
+ if ( function_exists( 'gllrctgrs_add_default_term_all_gallery' ) ) {
314
  gllrctgrs_add_default_term_all_gallery();
315
+ }
316
  }
317
  }
318
  }
367
  'not_found_in_trash' => __( 'No Gallery Categories found in Trash', 'gallery-plugin' ),
368
  'parent' => __( 'Parent Gallery Category', 'gallery-plugin' ),
369
  'items_list_navigation' => __( 'Gallery Categories list navigation', 'gallery-plugin' ),
370
+ 'items_list' => __( 'Gallery Categories list', 'gallery-plugin' )
371
  ),
372
  'rewrite' => true,
373
  'show_ui' => true,
377
  )
378
  );
379
 
 
 
 
 
 
 
 
 
 
 
380
 
381
+ if ( empty( $gllr_options['default_gallery_category'] ) ) {
382
  $terms = get_terms(
383
  'gallery_categories',
384
  array(
385
  'hide_empty' => false,
386
+ 'fields' => 'ids'
387
  )
388
  );
389
 
395
  $def_term_info = wp_insert_term( $def_term, 'gallery_categories',
396
  array(
397
  'description' => '',
398
+ 'slug' => 'default'
399
  )
400
  );
401
  }
402
  if ( is_array( $def_term_info ) )
403
  $def_term_id = ( array_shift( $def_term_info ) );
404
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  }
406
 
407
+ if ( ! in_array( 'bws-gallery', get_option( 'rewrite_rules' ) ) || $force_flush_rules || ( isset( $gllr_options["flush_rewrite_rules"] ) && 1 == $gllr_options["flush_rewrite_rules"] ) ) {
408
  flush_rewrite_rules();
409
+ $gllr_options["flush_rewrite_rules"] = 0;
410
  update_option( 'gllr_options', $gllr_options );
411
+ }
412
  }
413
  }
414
 
523
  $output .= '>';
524
  $output .= str_repeat( '&nbsp;', $depth * 3 ) . $term_name;
525
  if ( $args['show_count'] )
526
+ $output .= '&nbsp;( ' . $term->count .' )';
527
  $output .= '</option>';
528
  }
529
  }
541
  if ( ! empty( $def_term ) ) {
542
  $def_term_name = $def_term->name;
543
  if ( ! empty( $def_term_name ) ) {
544
+ echo '<div class="form-wrap"><p><i><strong>' . __( 'Note', 'gallery-plugin' ) . ':</strong> ' . sprintf( __( 'When deleting a category, the galleries that belong to this category will not be deleted. These galleries will be moved to the category %s.', 'gallery-plugin' ), '<strong>' . $def_term_name . '</strong>' ) . '</i></p></div>';
545
  }
546
  }
547
  }
648
  if ( ! function_exists( 'gllr_hide_delete_link' ) ) {
649
  function gllr_hide_delete_link( $actions, $tag ) {
650
  global $gllr_options;
651
+ if ( $tag->term_id == $gllr_options['default_gallery_category'] ) {
652
  unset( $actions['delete'] );
653
+ }
654
  return $actions;
655
  }
656
  }
767
  function gllr_template_include( $template ) {
768
  global $gllr_options, $wp_query;
769
 
770
+ if ( function_exists( 'is_embed' ) && is_embed() ) {
771
  return $template;
772
+ }
773
 
774
  $post_type = get_post_type();
775
  if ( is_single() && $gllr_options['post_type_name'] == $post_type ) {
784
  $find = array( $file, 'bws-templates/' . $file );
785
  $template = locate_template( $find );
786
 
787
+ if ( ! $template ) {
788
  $template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' . $file;
789
+ }
790
  }
791
 
792
  return $template;
937
  wp_reset_query();
938
  $request = $wp_query->request;
939
  $pages = intval( $count_all_albums / $per_page );
940
+ if ( $count_all_albums % $per_page > 0 ) {
941
  $pages += 1;
942
+ }
943
  $range = 100;
944
  if ( ! $pages ) {
945
  $pages = 1;
1131
  }
1132
  </style>\n";
1133
 
1134
+ if ( 1 == $gllr_options['border_images'] ) {
1135
  $image_style = "border: {$gllr_options['border_images_width']}px solid {$gllr_options['border_images_color']};";
1136
+ } else {
1137
  $image_style = "border: none;";
1138
+ }
1139
  $image_style .= "margin: 0;";
1140
 
1141
  $args = array(
1625
  break;
1626
  case "images":
1627
  $images_id = get_post_meta( $post->ID, '_gallery_images', true );
1628
+ if ( empty( $images_id ) ) {
1629
  echo 0;
1630
+ } else {
1631
  echo $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE ID IN( " . $images_id . " )" );
1632
+ }
1633
  break;
1634
  case 'gallery_categories':
1635
  $terms = get_the_terms( $post->ID, 'gallery_categories' );
1764
  'img_success' => __( 'All images were updated.', 'gallery-plugin' ),
1765
  'img_error' => __( 'Error.', 'gallery-plugin' )
1766
  ) );
1767
+ } elseif (
1768
  ( 'post.php' == $pagenow && isset( $_GET['action'] ) && 'edit' == $_GET['action'] && get_post_type( get_the_ID() ) == $gllr_options['post_type_name'] ) ||
1769
  ( 'post-new.php' == $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] == $gllr_options['post_type_name'] ) ) {
1770
  wp_enqueue_script( 'jquery-ui-sortable' );
2204
 
2205
  $string_parent_id = implode( ",", $array_parent_id );
2206
 
2207
+ $metas = $wpdb->get_results( "SELECT `meta_value` FROM $wpdb->postmeta WHERE `meta_key` = '_gallery_images' AND `post_id` IN ( " . $string_parent_id . " )", ARRAY_A );
2208
 
2209
  $result_attachment_id = '';
2210
  foreach ( $metas as $value ) {
2312
  if ( ! function_exists ( 'gllr_image_resize' ) ) {
2313
  function gllr_image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
2314
  $size = @getimagesize( $file );
2315
+ if ( ! $size ) {
2316
  return new WP_Error( 'invalid_image', __( 'Image size not defined', 'gallery-plugin' ), $file );
2317
+ }
2318
 
2319
  $type = $size[2];
2320
 
2321
+ if ( 3 == $type ) {
2322
  $image = imagecreatefrompng( $file );
2323
+ }
2324
+ elseif ( 2 == $type ) {
2325
  $image = imagecreatefromjpeg( $file );
2326
+ }
2327
+ elseif ( 1 == $type ) {
2328
  $image = imagecreatefromgif( $file );
2329
+ }
2330
+ elseif ( 15 == $type ) {
2331
  $image = imagecreatefromwbmp( $file );
2332
+ }
2333
+ elseif ( 16 == $type ) {
2334
  $image = imagecreatefromxbm( $file );
2335
+ } else {
2336
  return new WP_Error( 'invalid_image', __( 'Plugin updates only PNG, JPEG, GIF, WPMP or XBM filetype. For other, please reload images manually.', 'gallery-plugin' ), $file );
2337
+ }
2338
 
2339
+ if ( ! is_resource( $image ) ) {
2340
  return new WP_Error( 'error_loading_image', $image, $file );
2341
+ }
2342
 
2343
  /*$size = @getimagesize( $file );*/
2344
  list( $orig_w, $orig_h, $orig_type ) = $size;
2345
 
2346
  $dims = gllr_image_resize_dimensions( $orig_w, $orig_h, $max_w, $max_h, $crop );
2347
 
2348
+ if ( ! $dims ) {
2349
  return new WP_Error( 'error_getting_dimensions', __( 'Image size not defined', 'gallery-plugin' ) );
2350
+ }
2351
  list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
2352
 
2353
  $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
2355
  imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
2356
 
2357
  /* Convert from full colors to index colors, like original PNG. */
2358
+ if ( IMAGETYPE_PNG == $orig_type && function_exists( 'imageistruecolor' ) && !imageistruecolor( $image ) ) {
2359
  imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
2360
+ }
2361
 
2362
  /* We don't need the original in memory anymore */
2363
  imagedestroy( $image );
2364
 
2365
  /* $suffix will be appended to the destination filename, just before the extension */
2366
+ if ( ! $suffix ) {
2367
  $suffix = "{$dst_w}x{$dst_h}";
2368
+ }
2369
 
2370
  $info = pathinfo( $file );
2371
  $dir = $info['dirname'];
2372
  $ext = $info['extension'];
2373
  $name = wp_basename( $file, ".$ext" );
2374
 
2375
+ if ( ! is_null( $dest_path ) and $_dest_path = realpath( $dest_path ) ) {
2376
  $dir = $_dest_path;
2377
+ }
2378
  $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
2379
 
2380
  if ( IMAGETYPE_GIF == $orig_type ) {
2381
+ if ( !imagegif( $newimage, $destfilename ) ) {
2382
  return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'gallery-plugin' ) );
2383
+ }
2384
  } elseif ( IMAGETYPE_PNG == $orig_type ) {
2385
+ if ( !imagepng( $newimage, $destfilename ) ) {
2386
  return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'gallery-plugin' ) );
2387
+ }
2388
  } else {
2389
  /* All other formats are converted to jpg */
2390
  $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
2391
+ if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) {
2392
  return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'gallery-plugin' ) );
2393
+ }
2394
  }
2395
  imagedestroy( $newimage );
2396
 
2404
 
2405
  if ( ! function_exists ( 'gllr_image_resize_dimensions' ) ) {
2406
  function gllr_image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
2407
+ if ( 0 >= $orig_w || 0 >= $orig_h ) {
2408
  return false;
2409
+ }
2410
  /* At least one of dest_w or dest_h must be specific */
2411
+ if ( 0 >= $dest_w && 0 >= $dest_h ) {
2412
  return false;
2413
+ }
2414
 
2415
  if ( $crop ) {
2416
  /* Crop the largest possible portion of the original image that we can size to $dest_w x $dest_h */
2418
  $new_w = min( $dest_w, $orig_w );
2419
  $new_h = min( $dest_h, $orig_h );
2420
 
2421
+ if ( ! $new_w ) {
2422
  $new_w = intval( $new_h * $aspect_ratio );
2423
+ }
2424
 
2425
+ if ( ! $new_h ) {
2426
  $new_h = intval( $new_w / $aspect_ratio );
2427
+ }
2428
 
2429
  $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
2430
 
2442
  list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
2443
  }
2444
  /* If the resulting image would be the same size or larger we don't want to resize it */
2445
+ if ( $new_w >= $orig_w && $new_h >= $orig_h ) {
2446
  return false;
2447
+ }
2448
  /* The return array matches the parameters to imagecopyresampled() */
2449
  /* Int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h */
2450
  return array( 0, 0, ( int ) $s_x, ( int ) $s_y, ( int ) $new_w, ( int ) $new_h, ( int ) $crop_w, ( int ) $crop_h );
2474
  }
2475
 
2476
  if ( ! class_exists( 'Gllr_Media_Table' ) ) {
2477
+ if ( ! class_exists( 'WP_List_Table' ) ) {
2478
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
2479
+ }
2480
+ if ( ! class_exists( 'WP_Media_List_Table' ) ) {
2481
  require_once( ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php' );
2482
+ }
2483
 
2484
  class Gllr_Media_Table extends WP_Media_List_Table {
2485
  public function __construct( $args = array() ) {
2504
  $current_page = $this->get_pagenum();
2505
  $this->_column_headers = array( $columns, $hidden, $sortable );
2506
  $images_id = get_post_meta( $original_post->ID, '_gallery_images', true );
2507
+ if ( empty( $images_id ) ) {
2508
  $total_items = 0;
2509
+ } else {
2510
  $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE ID IN( " . $images_id . " )" );
2511
+ }
2512
 
2513
  $per_page = -1;
2514
 
2526
  'per_page' => $per_page
2527
  ) );
2528
 
2529
+ if ( $wp_version < '4.2' ) {
2530
  $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' == $_REQUEST['attachment-filter'];
2531
+ }
2532
  }
2533
 
2534
  function extra_tablenav( $which ) {
2556
  global $wpdb, $post, $original_post;
2557
 
2558
  $images_id = get_post_meta( $original_post->ID, '_gallery_images', true );
2559
+ if ( empty( $images_id ) ) {
2560
  $total_items = 0;
2561
+ } else {
2562
  $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE ID IN( " . $images_id . " )" );
2563
+ }
2564
 
2565
+ if ( $total_items > 0 ) {
2566
  return true;
2567
+ } else {
2568
  return false;
2569
+ }
2570
  }
2571
 
2572
  function no_items() {
2595
  * @access protected
2596
  *
2597
  * @param string $which The location of the bulk actions: 'top' or 'bottom'.
2598
+ * This is designated as optional for backwards-compatibility.
2599
  */
2600
  function bulk_actions( $which = '' ) {
2601
  if ( is_null( $this->_actions ) ) {
2619
  $two = '2';
2620
  }
2621
 
2622
+ if ( empty( $this->_actions ) ) {
2623
  return;
2624
+ }
2625
 
2626
  echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action', 'gallery-plugin' ) . "</label>";
2627
  echo "<select name='action-" . esc_attr( $which ) . "' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
2663
 
2664
  function get_columns() {
2665
  $lists_columns = array(
2666
+ 'cb' => '<input type="checkbox" />',
2667
  'title' => __( 'File', 'gallery-plugin' ),
2668
  'dimensions' => __( 'Dimensions', 'gallery-plugin' ),
2669
  'gllr_image_text' => __( 'Title', 'gallery-plugin' ) . bws_add_help_box( '<img src="' . plugins_url( 'images/image-title-example.png', __FILE__ ) . '" />' ),
2729
  function single_row( $gllr_mode ) {
2730
  global $post, $original_post, $gllr_options, $gllr_plugin_info, $wp_version;
2731
 
2732
+ if ( empty( $gllr_options ) ) {
2733
  gllr_settings();
2734
+ }
2735
 
2736
  $attachment_metadata = wp_get_attachment_metadata( $post->ID );
2737
  if ( 'grid' == $gllr_mode ) {
2838
  foreach ( $columns as $column_name => $column_display_name ) {
2839
 
2840
  $classes = "$column_name column-$column_name";
2841
+ if ( in_array( $column_name, $hidden ) ) {
2842
  $classes .= ' hidden';
2843
+ }
2844
 
2845
+ if ( 'title' == $column_name ) {
2846
  $classes .= ' column-primary has-row-actions';
2847
+ }
2848
 
2849
  $attributes = "class='$classes'";
2850
  switch ( $column_name ) {
2913
  $actions = array();
2914
 
2915
  if ( $this->detached ) {
2916
+ if ( current_user_can( 'edit_post', $post->ID ) ) {
2917
  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit', 'gallery-plugin' ) . '</a>';
2918
+ }
2919
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
2920
  if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
2921
  $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash', 'gallery-plugin' ) . "</a>";
2922
  } else {
2923
  $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
2924
  $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently', 'gallery-plugin' ) . "</a>";
2925
  }
2926
+ }
2927
  $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'gallery-plugin' ), $att_title ) ) . '" rel="permalink">' . __( 'View', 'gallery-plugin' ) . '</a>';
2928
+ if ( current_user_can( 'edit_post', $post->ID ) ) {
2929
  $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">' . __( 'Attach', 'gallery-plugin' ) . '</a>';
2930
+ }
2931
  } else {
2932
+ if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) {
2933
  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit', 'gallery-plugin' ) . '</a>';
2934
+ }
2935
  if ( current_user_can( 'delete_post', $post->ID ) ) {
2936
+ if ( $this->is_trash ) {
2937
  $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore', 'gallery-plugin' ) . "</a>";
2938
+ } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
2939
  $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash', 'gallery-plugin' ) . "</a>";
2940
+ }
2941
  if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
2942
  $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
2943
  $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently', 'gallery-plugin' ) . "</a>";
3245
  if ( ! isset( $gllr_first ) ) $gllr_first = get_the_ID();
3246
  $title = get_the_title( $post->ID );
3247
  if ( empty( $title ) )
3248
+ $title = ' ( ' . __( 'no title', 'gallery-plugin' ) . ' ) '; ?>
3249
+ <option value="<?php the_ID(); ?>"><?php echo $title; ?> ( <?php echo get_the_date( 'Y-m-d' ); ?> )</option>
3250
  <?php }
3251
  wp_reset_postdata();
3252
  $post = $old_post; ?>
includes/class-gllr-settings.php CHANGED
@@ -81,7 +81,7 @@ if ( ! class_exists( 'Gllr_Settings_Tabs' ) ) {
81
  } else {
82
  $this->wp_image_sizes[] = array(
83
  'value' => $size,
84
- 'name' => ucwords( str_replace( array( '-', '_' ), ' ', $size ) ) . ' (' . $width . ' &#215; ' . $height . ')',
85
  'width' => $width,
86
  'height' => $height
87
  );
81
  } else {
82
  $this->wp_image_sizes[] = array(
83
  'value' => $size,
84
+ 'name' => ucwords( str_replace( array( '-', '_' ), ' ', $size ) ) . ' ( ' . $width . ' &#215; ' . $height . ' ) ',
85
  'width' => $width,
86
  'height' => $height
87
  );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: bestwebsoft
3
  Donate link: https://bestwebsoft.com/donate/
4
  Tags: add album, add galleries, add images, add pictures, add albums, gallery, gallery plugin, gallery slider, fancy gallery, slideshow, lightbox, fullscreen gallery
5
  Requires at least: 4.0
6
- Tested up to: 4.9.4
7
- Stable tag: 4.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -226,6 +226,9 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
226
 
227
  == Changelog ==
228
 
 
 
 
229
  = V4.5.5 - 08.03.2018 =
230
  * NEW : Ability to disable the opening of the image from the thumbnail in a single gallery.
231
  * NEW : Ability to sort galleries in a category has been added.
@@ -647,6 +650,9 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
647
 
648
  == Upgrade Notice ==
649
 
 
 
 
650
  = V4.5.5 =
651
  * Functionality expanded.
652
  * Bugs fixed.
3
  Donate link: https://bestwebsoft.com/donate/
4
  Tags: add album, add galleries, add images, add pictures, add albums, gallery, gallery plugin, gallery slider, fancy gallery, slideshow, lightbox, fullscreen gallery
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.8
7
+ Stable tag: 4.5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
226
 
227
  == Changelog ==
228
 
229
+ = V4.5.6 - 27.08.2018 =
230
+ * Bugfix: The bug with the rewrite rules has been fixed.
231
+
232
  = V4.5.5 - 08.03.2018 =
233
  * NEW : Ability to disable the opening of the image from the thumbnail in a single gallery.
234
  * NEW : Ability to sort galleries in a category has been added.
650
 
651
  == Upgrade Notice ==
652
 
653
+ = V4.5.6 =
654
+ * Bugs fixed.
655
+
656
  = V4.5.5 =
657
  * Functionality expanded.
658
  * Bugs fixed.
screenshot-7.png CHANGED
Binary file
screenshot-8.png CHANGED
Binary file
screenshot-9.png CHANGED
Binary file