Gallery Custom Links - Version 2.0.8

Version Description

(2022/03/18) = * Fix: Compatibility with the latest version of Gutenberg Gallery. * Update: Latest versions of DiDom and HTML Dom Parser (might be better and faster). * Update: Latest version of Neko UI.

Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Gallery Custom Links
Version 2.0.8
Comparing to
See all releases

Code changes from version 2.0.7 to 2.0.8

classes/button/gutenberg.php CHANGED
@@ -11,19 +11,43 @@ class Meow_MGCL_Core_Button_Gutenberg {
11
  // Let's look for the closest link tag enclosing the image
12
 
13
  $elemBlocksGalleryItem = $parent->parent();
 
14
 
15
- if ( $handled || $elemBlocksGalleryItem->class !== 'blocks-gallery-item' ) {
 
16
  return $handled;
17
  }
18
 
19
  $potentialLinkNode = $parent;
20
- $css = 'position: absolute; height: auto; font-size: 15px; text-decoration: none;
21
- padding: 2px 10px; bottom: 5px; left: 5px; box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.5);
22
- border-radius: 10px; width: calc(100% - 10px); text-align: center; background: rgba(15, 115, 239, 0.80); color: white;';
23
- $css_hover = 'background: rgba(15, 115, 239, 0.9);';
24
-
25
  $id = uniqid();
26
- $style = "<style>#mgcl-${id} a { ${css} } #mgcl-${id} a:hover { ${css_hover} }</style>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  if ( $this->core->enableLogs ) {
29
  error_log( 'Linker: Will embed the IMG tag.' );
11
  // Let's look for the closest link tag enclosing the image
12
 
13
  $elemBlocksGalleryItem = $parent->parent();
14
+ $elemBlocksGalleryItem = $parent;
15
 
16
+ $classes = explode( ' ', $elemBlocksGalleryItem->class );
17
+ if ( $handled || !in_array( 'wp-block-image', $classes ) ) {
18
  return $handled;
19
  }
20
 
21
  $potentialLinkNode = $parent;
 
 
 
 
 
22
  $id = uniqid();
23
+
24
+ $style = "<style>
25
+ #mgcl-${id} {
26
+ width: 100%;
27
+ height: 100%;
28
+ position: absolute;
29
+ display: flex;
30
+ justify-content: end;
31
+ padding: 5px;
32
+ }
33
+ #mgcl-${id} a {
34
+ height: auto !important;
35
+ flex: none !important;
36
+ }
37
+ #mgcl-${id} a {
38
+ font-size: 15px;
39
+ text-decoration: none;
40
+ padding: 2px 10px;
41
+ box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.5);
42
+ border-radius: 10px;
43
+ text-align: center;
44
+ background: rgba(15, 115, 239, 0.80);
45
+ color: white;
46
+ }
47
+ #mgcl-${id} a:hover {
48
+ background: rgba(15, 115, 239, 0.9);
49
+ }
50
+ </style>";
51
 
52
  if ( $this->core->enableLogs ) {
53
  error_log( 'Linker: Will embed the IMG tag.' );
classes/button/meow_gallery.php CHANGED
@@ -23,7 +23,33 @@ class Meow_MGCL_Core_Button_Meow_Gallery {
23
  $css_hover = 'background: rgba(15, 115, 239, 0.9);';
24
 
25
  $id = uniqid();
26
- $style = "<style>#mgcl-${id} a { ${css} } #mgcl-${id} a:hover { ${css_hover} }</style>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  if ( $this->core->enableLogs ) {
29
  error_log( 'Linker: Will embed the IMG tag.' );
23
  $css_hover = 'background: rgba(15, 115, 239, 0.9);';
24
 
25
  $id = uniqid();
26
+
27
+ $style = "<style>
28
+ #mgcl-${id} {
29
+ }
30
+ #mgcl-${id} a {
31
+ position: absolute;
32
+ bottom: 8px; left: 8px;
33
+ height: auto !important;
34
+ width: calc(100% - 16px);
35
+ flex: none !important;
36
+ }
37
+ #mgcl-${id} a {
38
+ font-size: 15px;
39
+ text-decoration: none;
40
+ padding: 2px 10px;
41
+ box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.5);
42
+ border-radius: 10px;
43
+ text-align: center;
44
+ background: rgba(15, 115, 239, 0.80);
45
+ color: white;
46
+ }
47
+ #mgcl-${id} a:hover {
48
+ background: rgba(15, 115, 239, 0.9);
49
+ }
50
+ </style>";
51
+
52
+ //$style = "<style>#mgcl-${id} a { ${css} } #mgcl-${id} a:hover { ${css_hover} }</style>";
53
 
54
  if ( $this->core->enableLogs ) {
55
  error_log( 'Linker: Will embed the IMG tag.' );
classes/core.php CHANGED
@@ -28,6 +28,11 @@ class Meow_MGCL_Core
28
 
29
  // For visitors (client-side)
30
  if ( $this->is_visitor ) {
 
 
 
 
 
31
  if ( $this->isObMode ) {
32
  add_action( 'template_redirect', array( $this, 'start' ) );
33
  add_action( 'shutdown', array( $this, 'shutdown' ) );
28
 
29
  // For visitors (client-side)
30
  if ( $this->is_visitor ) {
31
+
32
+ if ( $this->parsingEngine === 'None' ) {
33
+ return;
34
+ }
35
+
36
  if ( $this->isObMode ) {
37
  add_action( 'template_redirect', array( $this, 'start' ) );
38
  add_action( 'shutdown', array( $this, 'shutdown' ) );
classes/init.php CHANGED
@@ -74,10 +74,9 @@ if ( get_transient( 'mgcl_new_plugin_notice' ) ) {
74
  }
75
 
76
  add_action( 'upgrader_process_complete', function ( $upgrader_object, $options ) {
77
- $our_plugin = plugin_basename( __FILE__ );
78
  if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
79
  foreach( $options['plugins'] as $plugin ) {
80
- if ( $plugin == $our_plugin ) {
81
  set_transient( 'mgcl_new_plugin_notice', 'true', 12 * HOUR_IN_SECONDS );
82
  return;
83
  }
74
  }
75
 
76
  add_action( 'upgrader_process_complete', function ( $upgrader_object, $options ) {
 
77
  if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
78
  foreach( $options['plugins'] as $plugin ) {
79
+ if ( $plugin == MGCL_BASENAME ) {
80
  set_transient( 'mgcl_new_plugin_notice', 'true', 12 * HOUR_IN_SECONDS );
81
  return;
82
  }
classes/library.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- class Meow_MGCL_Library {
4
-
5
- public function __construct( $core ) {
6
- $this->core = $core;
7
- add_filter( 'admin_init', array( $this, 'admin_init' ), 10, 0 );
8
- add_filter( 'manage_media_columns', array( $this, 'manage_media_columns' ) );
9
- add_action( 'manage_media_custom_column', array( $this, 'manage_media_custom_column' ), 10, 2 );
10
- }
11
-
12
- function admin_init() {
13
- add_action( 'pre_get_posts', array( $this, 'my_custom_filter' ), 60, 2 );
14
- add_action( 'admin_print_footer_scripts', array( $this, 'admin_print_footer_scripts' ), 60 );
15
- }
16
-
17
- function my_custom_filter( $query ) {
18
- if ( $query->is_main_query() ) {
19
- if ( isset( $_GET['attachment-filter'] ) && $_GET['attachment-filter'] === 'mgcl_unlinked' ) {
20
- $query->set( 'meta_query', array(
21
- array(
22
- 'key' => '_gallery_link_url',
23
- 'compare' => 'NOT EXISTS'
24
- )
25
- ));
26
- }
27
- }
28
- return $query;
29
- }
30
-
31
- function manage_media_columns( $cols ) {
32
- $cols["GalleryCustomLinks"] = "Gallery Custom Links";
33
- return $cols;
34
- }
35
-
36
- function manage_media_custom_column( $column_name, $post_id ) {
37
- if ( $column_name != 'GalleryCustomLinks' )
38
- return;
39
- $url = get_post_meta( $post_id, '_gallery_link_url', true );
40
- $target = get_post_meta( $post_id, '_gallery_link_target', true );
41
- $rel = get_post_meta( $post_id, '_gallery_link_rel', true );
42
- $aria = get_post_meta( $post_id, '_gallery_link_aria', true );
43
- echo '<div class="mgcl-edit-link-field" data-post-id="' . $post_id . '" data-url="' . $url . '" data-target="' . $target . '" data-rel="' . $rel . '" data-aria="' . $aria . '"></div>';
44
- }
45
-
46
- function admin_print_footer_scripts() {
47
- ?>
48
- <script type="text/javascript">
49
- document.addEventListener("DOMContentLoaded", function() {
50
- let attachmentFilter = document.getElementById('attachment-filter');
51
- let newOption = document.createElement("option");
52
- newOption.text = "Unlinked";
53
- newOption.value = "mgcl_unlinked";
54
- attachmentFilter.appendChild(newOption);
55
- });
56
- </script>
57
- <?php }
58
- }
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
common/img/database-cleaner.png ADDED
Binary file
common/img/media-cleaner.jpg DELETED
Binary file
common/img/media-cleaner.png ADDED
Binary file
common/img/media-file-renamer.jpg DELETED
Binary file
common/img/media-file-renamer.png ADDED
Binary file
common/img/meow-gallery.jpg DELETED
Binary file
common/img/meow-gallery.png ADDED
Binary file
common/img/meow-lightbox.jpg DELETED
Binary file
common/img/meow-lightbox.png ADDED
Binary file
common/img/social-engine.png ADDED
Binary file
common/img/wp-retina-2x.jpg DELETED
Binary file
common/img/wp-retina-2x.png ADDED
Binary file
common/img/wplr-sync.jpg DELETED
Binary file
common/img/wplr-sync.png ADDED
Binary file
gallery-custom-links.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Gallery Custom Links
4
  Plugin URI: https://meowapps.com
5
  Description: Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.
6
- Version: 2.0.7
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: gallery-custom-links
@@ -15,12 +15,13 @@ http://www.gnu.org/licenses/gpl.html
15
  */
16
 
17
  if ( !defined( 'MGCL_VERSION' ) ) {
18
- define( 'MGCL_VERSION', '2.0.7' );
19
  define( 'MGCL_PREFIX', 'mgcl' );
20
  define( 'MGCL_DOMAIN', 'gallery-custom-links' );
21
  define( 'MGCL_ENTRY', __FILE__ );
22
  define( 'MGCL_PATH', dirname( __FILE__ ) );
23
  define( 'MGCL_URL', plugin_dir_url( __FILE__ ) );
 
24
  }
25
 
26
  require_once( 'classes/init.php' );
3
  Plugin Name: Gallery Custom Links
4
  Plugin URI: https://meowapps.com
5
  Description: Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.
6
+ Version: 2.0.8
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: gallery-custom-links
15
  */
16
 
17
  if ( !defined( 'MGCL_VERSION' ) ) {
18
+ define( 'MGCL_VERSION', '2.0.8' );
19
  define( 'MGCL_PREFIX', 'mgcl' );
20
  define( 'MGCL_DOMAIN', 'gallery-custom-links' );
21
  define( 'MGCL_ENTRY', __FILE__ );
22
  define( 'MGCL_PATH', dirname( __FILE__ ) );
23
  define( 'MGCL_URL', plugin_dir_url( __FILE__ ) );
24
+ define( 'MGCL_BASENAME', plugin_basename( __FILE__ ) );
25
  }
26
 
27
  require_once( 'classes/init.php' );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://meowapps.com/donation/
5
  Requires at least: 5.0
6
  Tested up to: 5.9.1
7
  Requires PHP: 7.0
8
- Stable tag: 2.0.7
9
 
10
  Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.
11
 
@@ -42,7 +42,8 @@ Replace all the files. Nothing else to do.
42
 
43
  == Changelog ==
44
 
45
- = 2.0.7 (2022/03/18) =
 
46
  * Update: Latest versions of DiDom and HTML Dom Parser (might be better and faster).
47
  * Update: Latest version of Neko UI.
48
 
5
  Requires at least: 5.0
6
  Tested up to: 5.9.1
7
  Requires PHP: 7.0
8
+ Stable tag: 2.0.8
9
 
10
  Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.
11
 
42
 
43
  == Changelog ==
44
 
45
+ = 2.0.8 (2022/03/18) =
46
+ * Fix: Compatibility with the latest version of Gutenberg Gallery.
47
  * Update: Latest versions of DiDom and HTML Dom Parser (might be better and faster).
48
  * Update: Latest version of Neko UI.
49