Version Description
- Add: Rel can now be set to nofollow.
- Info: If you like the plugin, your reviews are welcome here :) Thank you!
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Gallery Custom Links |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- gallery_custom_links.php +2 -2
- mgcl_admin.php +17 -1
- mgcl_core.php +5 -3
- readme.txt +5 -2
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: 1.1.
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: gallery-custom-links
|
@@ -23,7 +23,7 @@ if ( class_exists( 'Meow_Gallery_Custom_Links' ) ) {
|
|
23 |
}
|
24 |
|
25 |
global $mgcl_version;
|
26 |
-
$mgcl_version = '1.1.
|
27 |
|
28 |
include "mgcl_admin.php";
|
29 |
$mgcl_admin = new Meow_Gallery_Custom_Links_Admin( 'mgcl', __FILE__, 'gallery-custom-links' );
|
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: 1.1.2
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: gallery-custom-links
|
23 |
}
|
24 |
|
25 |
global $mgcl_version;
|
26 |
+
$mgcl_version = '1.1.2';
|
27 |
|
28 |
include "mgcl_admin.php";
|
29 |
$mgcl_admin = new Meow_Gallery_Custom_Links_Admin( 'mgcl', __FILE__, 'gallery-custom-links' );
|
mgcl_admin.php
CHANGED
@@ -23,7 +23,7 @@ class Meow_Gallery_Custom_Links_Admin { // extends MeowApps_Admin
|
|
23 |
'label' => __( 'Link Target', 'gallery-custom-links' ),
|
24 |
'input' => 'html',
|
25 |
'html' => '
|
26 |
-
<select name="attachments[' . $post->ID . '][gallery_link_target]" id="attachments[' . $post->ID . '][gallery_link_target]">
|
27 |
<option value="_self"' . ( $target_value == '_self' ? ' selected="selected"' : '' ) . '>' .
|
28 |
__( 'Same page', 'gallery-custom-links' ) .
|
29 |
'</option>
|
@@ -32,6 +32,20 @@ class Meow_Gallery_Custom_Links_Admin { // extends MeowApps_Admin
|
|
32 |
'</option>
|
33 |
</select>'
|
34 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
return $fields;
|
36 |
}
|
37 |
|
@@ -40,6 +54,8 @@ class Meow_Gallery_Custom_Links_Admin { // extends MeowApps_Admin
|
|
40 |
update_post_meta( $post['ID'], '_gallery_link_url', $attachment['gallery_link_url'] );
|
41 |
if ( isset( $attachment['gallery_link_target'] ) )
|
42 |
update_post_meta( $post['ID'], '_gallery_link_target', $attachment['gallery_link_target'] );
|
|
|
|
|
43 |
return $post;
|
44 |
}
|
45 |
|
23 |
'label' => __( 'Link Target', 'gallery-custom-links' ),
|
24 |
'input' => 'html',
|
25 |
'html' => '
|
26 |
+
<select class="widefat" name="attachments[' . $post->ID . '][gallery_link_target]" id="attachments[' . $post->ID . '][gallery_link_target]">
|
27 |
<option value="_self"' . ( $target_value == '_self' ? ' selected="selected"' : '' ) . '>' .
|
28 |
__( 'Same page', 'gallery-custom-links' ) .
|
29 |
'</option>
|
32 |
'</option>
|
33 |
</select>'
|
34 |
);
|
35 |
+
$rel_value = get_post_meta( $post->ID, '_gallery_link_rel', true );
|
36 |
+
$fields['gallery_link_rel'] = array(
|
37 |
+
'label' => __( 'Link Rel', 'gallery-custom-links' ),
|
38 |
+
'input' => 'html',
|
39 |
+
'html' => '
|
40 |
+
<select class="widefat" name="attachments[' . $post->ID . '][gallery_link_rel]" id="attachments[' . $post->ID . '][gallery_link_rel]">
|
41 |
+
<option value=""' . ( $rel_value == '' ? ' selected="selected"' : '' ) . '>' .
|
42 |
+
__( 'None', 'gallery-custom-links' ) .
|
43 |
+
'</option>
|
44 |
+
<option value="nofollow"' . ( $rel_value == 'nofollow' ? ' selected="selected"' : '' ) . '>' .
|
45 |
+
__( 'No Follow', 'gallery-custom-links' ) .
|
46 |
+
'</option>
|
47 |
+
</select>'
|
48 |
+
);
|
49 |
return $fields;
|
50 |
}
|
51 |
|
54 |
update_post_meta( $post['ID'], '_gallery_link_url', $attachment['gallery_link_url'] );
|
55 |
if ( isset( $attachment['gallery_link_target'] ) )
|
56 |
update_post_meta( $post['ID'], '_gallery_link_target', $attachment['gallery_link_target'] );
|
57 |
+
if ( isset( $attachment['gallery_link_rel'] ) )
|
58 |
+
update_post_meta( $post['ID'], '_gallery_link_rel', $attachment['gallery_link_rel'] );
|
59 |
return $post;
|
60 |
}
|
61 |
|
mgcl_core.php
CHANGED
@@ -38,8 +38,6 @@ class Meow_Gallery_Custom_Links
|
|
38 |
strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0) {
|
39 |
return true;
|
40 |
}
|
41 |
-
|
42 |
-
// (#3)
|
43 |
$rest_url = wp_parse_url( site_url( $prefix ) );
|
44 |
$current_url = wp_parse_url( add_query_arg( array( ) ) );
|
45 |
return strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
|
@@ -110,6 +108,7 @@ class Meow_Gallery_Custom_Links
|
|
110 |
$url = get_post_meta( $mediaId, '_gallery_link_url', true );
|
111 |
if ( !empty( $url ) ) {
|
112 |
$target = get_post_meta( $mediaId, '_gallery_link_target', true );
|
|
|
113 |
if ( empty( $target ) )
|
114 |
$target = '_self';
|
115 |
$parent = $element->parent();
|
@@ -135,6 +134,7 @@ class Meow_Gallery_Custom_Links
|
|
135 |
$potentialLinkNode->{'class'} = $class;
|
136 |
$potentialLinkNode->{'onclick'} = 'event.stopPropagation()';
|
137 |
$potentialLinkNode->{'target'} = $target;
|
|
|
138 |
}
|
139 |
else {
|
140 |
$potentialLinkNode->attr( 'href', $url );
|
@@ -143,6 +143,7 @@ class Meow_Gallery_Custom_Links
|
|
143 |
$potentialLinkNode->attr( 'class', $class );
|
144 |
$potentialLinkNode->attr( 'onclick', 'event.stopPropagation()' );
|
145 |
$potentialLinkNode->attr( 'target', $target );
|
|
|
146 |
}
|
147 |
return true;
|
148 |
}
|
@@ -158,7 +159,7 @@ class Meow_Gallery_Custom_Links
|
|
158 |
error_log( 'Linker: Will embed the IMG tag.' );
|
159 |
}
|
160 |
if ( $this->parsingEngine === 'HtmlDomParser' ) {
|
161 |
-
$element->outertext = '<a href="' . $url . '" class="custom-link no-lightbox" onclick="event.stopPropagation()" target="' . $target . '">' . $element . '</a>';
|
162 |
}
|
163 |
else {
|
164 |
if ( $parent->tag === 'figure' )
|
@@ -168,6 +169,7 @@ class Meow_Gallery_Custom_Links
|
|
168 |
$a->attr( 'class', 'custom-link no-lightbox' );
|
169 |
$a->attr( 'onclick', 'event.stopPropagation()' );
|
170 |
$a->attr( 'target', $target );
|
|
|
171 |
$a->appendChild( $parent->children() );
|
172 |
foreach( $parent->children() as $img ) {
|
173 |
$img->remove();
|
38 |
strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0) {
|
39 |
return true;
|
40 |
}
|
|
|
|
|
41 |
$rest_url = wp_parse_url( site_url( $prefix ) );
|
42 |
$current_url = wp_parse_url( add_query_arg( array( ) ) );
|
43 |
return strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
|
108 |
$url = get_post_meta( $mediaId, '_gallery_link_url', true );
|
109 |
if ( !empty( $url ) ) {
|
110 |
$target = get_post_meta( $mediaId, '_gallery_link_target', true );
|
111 |
+
$rel = get_post_meta( $mediaId, '_gallery_link_rel', true );
|
112 |
if ( empty( $target ) )
|
113 |
$target = '_self';
|
114 |
$parent = $element->parent();
|
134 |
$potentialLinkNode->{'class'} = $class;
|
135 |
$potentialLinkNode->{'onclick'} = 'event.stopPropagation()';
|
136 |
$potentialLinkNode->{'target'} = $target;
|
137 |
+
$potentialLinkNode->{'rel'} = $rel;
|
138 |
}
|
139 |
else {
|
140 |
$potentialLinkNode->attr( 'href', $url );
|
143 |
$potentialLinkNode->attr( 'class', $class );
|
144 |
$potentialLinkNode->attr( 'onclick', 'event.stopPropagation()' );
|
145 |
$potentialLinkNode->attr( 'target', $target );
|
146 |
+
$potentialLinkNode->attr( 'rel', $rel );
|
147 |
}
|
148 |
return true;
|
149 |
}
|
159 |
error_log( 'Linker: Will embed the IMG tag.' );
|
160 |
}
|
161 |
if ( $this->parsingEngine === 'HtmlDomParser' ) {
|
162 |
+
$element->outertext = '<a href="' . $url . '" class="custom-link no-lightbox" onclick="event.stopPropagation()" target="' . $target . '" rel="' . $rel . '">' . $element . '</a>';
|
163 |
}
|
164 |
else {
|
165 |
if ( $parent->tag === 'figure' )
|
169 |
$a->attr( 'class', 'custom-link no-lightbox' );
|
170 |
$a->attr( 'onclick', 'event.stopPropagation()' );
|
171 |
$a->attr( 'target', $target );
|
172 |
+
$a->attr( 'rel', $rel );
|
173 |
$a->appendChild( $parent->children() );
|
174 |
foreach( $parent->children() as $img ) {
|
175 |
$img->remove();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: custom, links, gallery, gutenberg
|
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.1
|
6 |
Requires PHP: 7.0
|
7 |
-
Stable tag: 1.1.
|
8 |
|
9 |
Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.
|
10 |
|
@@ -41,9 +41,12 @@ Replace all the files. Nothing else to do.
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
44 |
= 1.1.1 =
|
45 |
* Update: Defaults set to Output Buffering + HtmlDomParser. Those settings work for most.
|
46 |
-
* Info: I need your support. Don't hesitate to try different versions of the plugin if it was working fine for you in the past ([old versions](https://wordpress.org/plugins/gallery-custom-links/advanced/)). You can also let me a good review to motivate me, that helps a lot.
|
47 |
|
48 |
= 1.1.0 =
|
49 |
* Update: Using HtmlDomParser fully (which should avoid broken HTML). It is possible to override the plugin hidden options to switch to different mode, but I am trying to find a mode that works for 99% of the users first.
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.1
|
6 |
Requires PHP: 7.0
|
7 |
+
Stable tag: 1.1.2
|
8 |
|
9 |
Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.
|
10 |
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 1.1.2 =
|
45 |
+
* Add: Rel can now be set to nofollow.
|
46 |
+
* Info: If you like the plugin, your reviews are welcome [here](https://wordpress.org/support/plugin/gallery-custom-links/reviews/?rate=5#new-post) :) Thank you!
|
47 |
+
|
48 |
= 1.1.1 =
|
49 |
* Update: Defaults set to Output Buffering + HtmlDomParser. Those settings work for most.
|
|
|
50 |
|
51 |
= 1.1.0 =
|
52 |
* Update: Using HtmlDomParser fully (which should avoid broken HTML). It is possible to override the plugin hidden options to switch to different mode, but I am trying to find a mode that works for 99% of the users first.
|