WP External Links (nofollow new tab seo) - Version 2.40

Version Description

  • 2019-11-20
    • no longer loads CSS and FontAwesome globally on admin pages
    • added support for "ugc" (User Generated Content) and "sponsored" values in rel
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WP External Links (nofollow new tab seo)
Version 2.40
Comparing to
See all releases

Code changes from version 2.35 to 2.40

includes/admin/class-wpel-network-page.php CHANGED
@@ -125,9 +125,15 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
125
  */
126
  protected function action_admin_enqueue_scripts()
127
  {
128
- wp_enqueue_style( 'font-awesome' );
129
- wp_enqueue_style( 'wpel-admin-style' );
130
- wp_enqueue_script( 'wpel-admin-script' );
 
 
 
 
 
 
131
  }
132
 
133
  /**
125
  */
126
  protected function action_admin_enqueue_scripts()
127
  {
128
+ $current_screen = get_current_screen();
129
+
130
+ if($current_screen->id == 'toplevel_page_wpel-network-settings-page-network' || $current_screen->id == 'settings_page_wpel-network-settings-page-network'){
131
+ wp_enqueue_style( 'font-awesome' );
132
+ wp_enqueue_style( 'wpel-admin-style' );
133
+ wp_enqueue_script( 'wpel-admin-script' );
134
+ }
135
+
136
+ wp_enqueue_style( 'wpel-admin-global-style' );
137
  }
138
 
139
  /**
includes/admin/class-wpel-settings-page.php CHANGED
@@ -83,8 +83,77 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
83
  reset( $this->tabs );
84
  $this->current_tab = key( $this->tabs );
85
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
  * Get option value
90
  * @param string $key
@@ -173,9 +242,14 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
173
  */
174
  protected function action_admin_enqueue_scripts()
175
  {
176
- wp_enqueue_style( 'font-awesome' );
177
- wp_enqueue_style( 'wpel-admin-style' );
178
- wp_enqueue_script( 'wpel-admin-script' );
 
 
 
 
 
179
  }
180
 
181
  /**
83
  reset( $this->tabs );
84
  $this->current_tab = key( $this->tabs );
85
  }
86
+
87
+ add_filter('install_plugins_table_api_args_featured', array($this, 'featured_plugins_tab'));
88
+ }
89
+
90
+ /**
91
+ * Helper function for adding plugins to featured list
92
+ *
93
+ * @return array
94
+ */
95
+ public function featured_plugins_tab($args)
96
+ {
97
+ add_filter('plugins_api_result', array($this, 'plugins_api_result'), 10, 3);
98
+ return $args;
99
  }
100
 
101
+ /**
102
+ * Add plugins to featured plugins list
103
+ *
104
+ * @return object
105
+ */
106
+ function plugins_api_result($res, $action, $args)
107
+ {
108
+ remove_filter('plugins_api_result', array($this, 'plugins_api_result'), 10, 3);
109
+
110
+ $res = self::add_plugin_featured('wp-reset', $res);
111
+ $res = self::add_plugin_featured('wp-force-ssl', $res);
112
+ $res = self::add_plugin_featured('eps-301-redirects', $res);
113
+
114
+ return $res;
115
+ } // plugins_api_result
116
+
117
+ /**
118
+ * Add single plugin to featured list
119
+ *
120
+ * @return object
121
+ */
122
+ public function add_plugin_featured($plugin_slug, $res)
123
+ {
124
+ // check if plugin is already on the list
125
+ if (!empty($res->plugins) && is_array($res->plugins)) {
126
+ foreach ($res->plugins as $plugin) {
127
+ if (is_object($plugin) && !empty($plugin->slug) && $plugin->slug == $plugin_slug) {
128
+ return $res;
129
+ }
130
+ } // foreach
131
+ }
132
+
133
+ if ($plugin_info = get_transient('wf-plugin-info-' . $plugin_slug)) {
134
+ array_unshift($res->plugins, $plugin_info);
135
+ } else {
136
+ $plugin_info = plugins_api('plugin_information', array(
137
+ 'slug' => $plugin_slug,
138
+ 'is_ssl' => is_ssl(),
139
+ 'fields' => array(
140
+ 'banners' => true,
141
+ 'reviews' => true,
142
+ 'downloaded' => true,
143
+ 'active_installs' => true,
144
+ 'icons' => true,
145
+ 'short_description' => true,
146
+ )
147
+ ));
148
+ if (!is_wp_error($plugin_info)) {
149
+ $res->plugins = array_merge(array($plugin_info), $res->plugins);
150
+ set_transient('wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7);
151
+ }
152
+ }
153
+
154
+ return $res;
155
+ } // add_plugin_featured
156
+
157
  /**
158
  * Get option value
159
  * @param string $key
242
  */
243
  protected function action_admin_enqueue_scripts()
244
  {
245
+ $current_screen = get_current_screen();
246
+ if($current_screen->id == 'toplevel_page_wpel-settings-page' || $current_screen->id == 'settings_page_wpel-settings-page'){
247
+ wp_enqueue_style( 'font-awesome' );
248
+ wp_enqueue_style( 'wpel-admin-style' );
249
+ wp_enqueue_script( 'wpel-admin-script' );
250
+ }
251
+
252
+ wp_enqueue_style( 'wpel-admin-global-style' );
253
  }
254
 
255
  /**
includes/admin/settings-fields/class-wpel-external-link-fields.php CHANGED
@@ -34,6 +34,16 @@ final class WPEL_External_Link_Fields extends WPEL_Link_Fields_Base
34
  'class' => 'wpel-no-label wpel-hidden',
35
  'default_value' => '1',
36
  ),
 
 
 
 
 
 
 
 
 
 
37
  );
38
 
39
  $fields = array_merge(
34
  'class' => 'wpel-no-label wpel-hidden',
35
  'default_value' => '1',
36
  ),
37
+ 'rel_sponsored' => array(
38
+ 'label' => '',
39
+ 'class' => 'wpel-no-label wpel-hidden',
40
+ 'default_value' => '0',
41
+ ),
42
+ 'rel_ugc' => array(
43
+ 'label' => '',
44
+ 'class' => 'wpel-no-label wpel-hidden',
45
+ 'default_value' => '0',
46
+ )
47
  );
48
 
49
  $fields = array_merge(
includes/admin/settings-fields/class-wpel-link-fields-base.php CHANGED
@@ -171,6 +171,26 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Base_1x0x0
171
  );
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  protected function show_title( array $args )
175
  {
176
  $this->get_html_fields()->text( $args[ 'key' ], array(
171
  );
172
  }
173
 
174
+ protected function show_rel_sponsored( array $args )
175
+ {
176
+ $this->get_html_fields()->check_with_label(
177
+ $args[ 'key' ]
178
+ , __( 'Add <code>"sponsored"</code>', 'wp-external-links' )
179
+ , '1'
180
+ , ''
181
+ );
182
+ }
183
+
184
+ protected function show_rel_ugc( array $args )
185
+ {
186
+ $this->get_html_fields()->check_with_label(
187
+ $args[ 'key' ]
188
+ , __( 'Add <code>"ugc"</code>', 'wp-external-links' )
189
+ , '1'
190
+ , ''
191
+ );
192
+ }
193
+
194
  protected function show_title( array $args )
195
  {
196
  $this->get_html_fields()->text( $args[ 'key' ], array(
includes/class-wpel-front.php CHANGED
@@ -270,6 +270,16 @@ final class WPEL_Front extends WPRun_Base_1x0x0
270
  $link->add_to_attr( 'rel', 'noreferrer' );
271
  }
272
 
 
 
 
 
 
 
 
 
 
 
273
  // set title
274
  $title_format = $this->opt( 'title', $type );
275
 
270
  $link->add_to_attr( 'rel', 'noreferrer' );
271
  }
272
 
273
+ // add "sponsored"
274
+ if ( $this->opt( 'rel_sponsored', $type ) ) {
275
+ $link->add_to_attr( 'rel', 'sponsored' );
276
+ }
277
+
278
+ // add "ugc"
279
+ if ( $this->opt( 'rel_ugc', $type ) ) {
280
+ $link->add_to_attr( 'rel', 'ugc' );
281
+ }
282
+
283
  // set title
284
  $title_format = $this->opt( 'title', $type );
285
 
includes/class-wpel-register-scripts.php CHANGED
@@ -58,6 +58,14 @@ final class WPEL_Register_Scripts extends WPRun_Base_1x0x0
58
  , $plugin_version
59
  );
60
 
 
 
 
 
 
 
 
 
61
  // set wpel admin script
62
  wp_register_script(
63
  'wpel-admin-script'
58
  , $plugin_version
59
  );
60
 
61
+ // set admin global style
62
+ wp_register_style(
63
+ 'wpel-admin-global-style'
64
+ , plugins_url( '/public/css/wpel-admin-global.css', WPEL_Plugin::get_plugin_file() )
65
+ , array()
66
+ , $plugin_version
67
+ );
68
+
69
  // set wpel admin script
70
  wp_register_script(
71
  'wpel-admin-script'
public/css/font/external-links.eot ADDED
Binary file
public/css/font/external-links.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="external-links" horiz-adv-x="1000" >
7
+ <font-face font-family="external-links" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="link-ext-alt" unicode="&#xf14c;" d="M714 332v268q0 15-10 25t-25 11h-268q-24 0-33-22-10-23 8-39l80-80-298-298q-11-11-11-26t11-25l57-57q11-10 25-10t25 10l298 298 81-80q10-11 25-11 6 0 14 3 21 10 21 33z m143 286v-536q0-66-47-113t-114-48h-535q-67 0-114 48t-47 113v536q0 66 47 113t114 48h535q67 0 114-48t47-113z" horiz-adv-x="857.1" />
10
+ </font>
11
+ </defs>
12
+ </svg>
public/css/font/external-links.ttf ADDED
Binary file
public/css/font/external-links.woff ADDED
Binary file
public/css/font/external-links.woff2 ADDED
Binary file
public/css/wpel-admin-global.css ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'external-links';
3
+ src: url('font/external-links.eot?25257834');
4
+ src: url('font/external-links.eot?25257834#iefix') format('embedded-opentype'),
5
+ url('font/external-links.woff2?25257834') format('woff2'),
6
+ url('font/external-links.woff?25257834') format('woff'),
7
+ url('font/external-links.ttf?25257834') format('truetype'),
8
+ url('font/external-links.svg?25257834#external-links') format('svg');
9
+ font-weight: normal;
10
+ font-style: normal;
11
+ }
12
+
13
+
14
+ a.toplevel_page_wpel-settings-page .wp-menu-image:before,
15
+ a.toplevel_page_wpel-network-settings-page .wp-menu-image:before{
16
+ font-family: "external-links";
17
+ font-style: normal;
18
+ font-weight: normal;
19
+ speak: none;
20
+ display: inline-block;
21
+ text-decoration: inherit;
22
+ width: 1em;
23
+ margin-right: .2em;
24
+ text-align: center;
25
+ font-variant: normal;
26
+ text-transform: none;
27
+ line-height: 1em;
28
+ margin-left: .2em;
29
+ -webkit-font-smoothing: antialiased;
30
+ -moz-osx-font-smoothing: grayscale;
31
+ content: '\f14c';
32
+ }
public/css/wpel-admin.css CHANGED
@@ -16,20 +16,6 @@
16
  display: none;
17
  }
18
 
19
- /**
20
- * Menu Icon
21
- */
22
-
23
- a.toplevel_page_wpel-settings-page .wp-menu-image:before {
24
- font-family: FontAwesome;
25
- content: '\f14c';
26
- }
27
-
28
- a.toplevel_page_wpel-network-settings-page .wp-menu-image:before {
29
- font-family: FontAwesome;
30
- content: '\f14c';
31
- }
32
-
33
  /**
34
  * Tabs
35
  */
16
  display: none;
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  /**
20
  * Tabs
21
  */
readme.txt CHANGED
@@ -1,27 +1,27 @@
1
  === External Links - nofollow, noopener & new window ===
2
  Contributors: WebFactory, UnderConstructionPage, googlemapswidget, securityninja, wpreset
3
- Tags: new window, new tab, external links, nofollow, noopener, follow, dofollow, seo, noreferrer, internal links, target, links, link, internal link, external link
4
  Requires at least: 4.2
5
- Tested up to: 5.2
6
  Requires PHP: 5.3
7
- Stable tag: 2.35
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Manage internal & external links: open in new window or tab, control nofollow & noopener. SEO friendly.
12
 
13
  == Description ==
14
 
15
- **Manage all external & internal links on your site**. Control icons, nofollow, noopener and if links open in new window or new tab.
16
 
17
- = NEW: Version 2 =
18
- WP External Links plugin was completely rebuilt in v2 and has lots of new features, like "noopener", font icons, internal links options and full WPMU support.
19
 
20
  = Features =
21
  * Manage external and internal links
22
  * Open links in new window or tab
23
  * Add follow or nofollow (for SEO)
24
  * Add noopener and noreferrer (for security)
 
25
  * Add link icons (FontAwesome and Dashicons)
26
  * Set other attributes like title and CSS classes
27
  * Scan complete page (or just posts, comments, widgets)
@@ -243,6 +243,11 @@ See [FAQ](https://wordpress.org/plugins/wp-external-links/faq/) for more info.
243
 
244
  == Changelog ==
245
 
 
 
 
 
 
246
  = 2.35 =
247
  * 2019-09-12
248
  * FontAwesome updated to 4.7 with 41 new icons
1
  === External Links - nofollow, noopener & new window ===
2
  Contributors: WebFactory, UnderConstructionPage, googlemapswidget, securityninja, wpreset
3
+ Tags: new window, new tab, external links, nofollow, noopener, ugc, sponsored, follow, dofollow, seo, noreferrer, internal links, target, links, link, internal link, external link
4
  Requires at least: 4.2
5
+ Tested up to: 5.3
6
  Requires PHP: 5.3
7
+ Stable tag: 2.40
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Manage internal & external links: open in new window or tab, control nofollow, ugc, sponsored & noopener. SEO friendly.
12
 
13
  == Description ==
14
 
15
+ **Manage all external & internal links on your site**. Control icons, nofollow, noopener, ugc (User Generated Content), sponsored and if links open in new window or new tab.
16
 
17
+ WP External Links plugin was completely rebuilt in v2 and has lots of new features, like noopener, ugc and sponsored values for rel; font icons, internal links options and full WPMU support.
 
18
 
19
  = Features =
20
  * Manage external and internal links
21
  * Open links in new window or tab
22
  * Add follow or nofollow (for SEO)
23
  * Add noopener and noreferrer (for security)
24
+ * Add ugc (User Generated Content) and sponsored values to rel (<a href="https://webmasters.googleblog.com/2019/09/evolving-nofollow-new-ways-to-identify.html">Google announcement</a>)
25
  * Add link icons (FontAwesome and Dashicons)
26
  * Set other attributes like title and CSS classes
27
  * Scan complete page (or just posts, comments, widgets)
243
 
244
  == Changelog ==
245
 
246
+ = 2.40 =
247
+ * 2019-11-20
248
+ * no longer loads CSS and FontAwesome globally on admin pages
249
+ * added support for "ugc" (User Generated Content) and "sponsored" values in rel
250
+
251
  = 2.35 =
252
  * 2019-09-12
253
  * FontAwesome updated to 4.7 with 41 new icons
wp-external-links.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WP External Links
4
- * Version: 2.35
5
  * Plugin URI: https://wordpress.org/plugins/wp-external-links/
6
  * Description: Open external links in a new tab or window, control "nofollow" and "noopener", set font icon; SEO friendly.
7
  * Author: WebFactory Ltd
1
  <?php
2
  /**
3
  * Plugin Name: WP External Links
4
+ * Version: 2.40
5
  * Plugin URI: https://wordpress.org/plugins/wp-external-links/
6
  * Description: Open external links in a new tab or window, control "nofollow" and "noopener", set font icon; SEO friendly.
7
  * Author: WebFactory Ltd