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

Version Description

  • Added tab with options for excluded links
  • Added wpel-no-icon class to set on links
  • Added action wpel_before_apply_link
  • Added option ignore mailto links
  • Fixed ignore links of admin bar
  • Fixed regexp for ignoring tags
  • Fixed text domain to text slug
  • Made filters wpel_before_filter and wpel_after_filter "private"
  • Removed DOMElement dependency
  • Removed rel="external" option for internal links
  • Removed filter wpel_regexp_link (this should not be changed)
Download this release

Release Info

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

Code changes from version 2.0.4 to 2.1.0

Files changed (40) hide show
  1. includes/admin/class-wpel-network-page.php +13 -13
  2. includes/admin/class-wpel-settings-page.php +27 -17
  3. includes/admin/network-fields/class-wpel-network-admin-fields.php +6 -6
  4. includes/admin/network-fields/class-wpel-network-fields.php +7 -7
  5. includes/admin/settings-fields/class-wpel-admin-fields.php +6 -6
  6. includes/admin/settings-fields/class-wpel-exceptions-fields.php +57 -32
  7. includes/admin/settings-fields/class-wpel-excluded-link-fields.php +40 -0
  8. includes/admin/settings-fields/class-wpel-external-link-fields.php +59 -5
  9. includes/admin/settings-fields/class-wpel-internal-link-fields.php +9 -9
  10. includes/admin/settings-fields/class-wpel-link-fields-base.php +37 -54
  11. includes/class-wpel-front-ignore.php +35 -43
  12. includes/class-wpel-front.php +72 -158
  13. includes/class-wpel-link.php +39 -16
  14. includes/class-wpel-plugin.php +2 -2
  15. includes/class-wpel-registerhooks.php +4 -1
  16. includes/class-wpel-template-tags.php +1 -1
  17. includes/class-wpel-textdomain.php +0 -26
  18. libs/fwp/class-fwp-dom-element.php +0 -250
  19. libs/fwp/class-fwp-html-element.php +280 -0
  20. libs/fwp/class-fwp-html-fields.php +1 -1
  21. public/css/wpel-admin.css +53 -15
  22. public/js/wpel-admin.js +14 -16
  23. readme.txt +65 -38
  24. templates/network-page/help-tabs/under-construction.php +3 -3
  25. templates/network-page/main.php +2 -2
  26. templates/network-page/tab-contents/network-admin-settings.php +21 -0
  27. templates/network-page/tab-contents/network-settings.php +21 -0
  28. templates/partials/nav-tabs.php +1 -1
  29. templates/partials/tab-contents/fields-default.php +1 -4
  30. templates/partials/tab-contents/support.php +23 -19
  31. templates/requirements-notice.php +2 -2
  32. templates/settings-page/help-tabs/data-attributes.php +7 -7
  33. templates/settings-page/help-tabs/under-construction.php +3 -3
  34. templates/settings-page/main.php +2 -2
  35. templates/settings-page/tab-contents/admin.php +21 -0
  36. templates/settings-page/tab-contents/exceptions.php +6 -8
  37. templates/settings-page/tab-contents/excluded-links.php +21 -0
  38. templates/settings-page/tab-contents/external-links.php +21 -0
  39. templates/settings-page/tab-contents/internal-links.php +21 -0
  40. wp-external-links.php +3 -3
includes/admin/class-wpel-network-page.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -35,18 +35,18 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
35
  {
36
  $this->tabs = array(
37
  'network-settings' => array(
38
- 'title' => __( 'Multi Site Settings', 'wpel' ),
39
  'icon' => '<i class="fa fa-sitemap" aria-hidden="true"></i>',
40
  'fields' => $fields_objects[ 'network-settings' ],
41
  ),
42
  'network-admin-settings' => array(
43
- 'title' => __( 'Admin Settings', 'wpel' ),
44
- 'icon' => '<i class="fa fa-cog" aria-hidden="true"></i>',
45
  'fields' => $fields_objects[ 'network-admin-settings' ],
46
  ),
47
  'support' => array(
48
- 'title' => __( 'Support', 'wpel' ),
49
- 'icon' => '<i class="fa fa-smile-o" aria-hidden="true"></i>',
50
  ),
51
  );
52
 
@@ -100,8 +100,8 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
100
 
101
  if ( '1' === $own_admin_menu ) {
102
  $this->page_hook = add_menu_page(
103
- __( 'WP External Links' , 'wpel' ) // page title
104
- , __( 'External Links' , 'wpel' ) // menu title
105
  , 'manage_network' // capability
106
  , $this->menu_slug // menu slug
107
  , $this->get_callback( 'show_network_page' ) // callback
@@ -111,8 +111,8 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
111
  } else {
112
  $this->page_hook = add_submenu_page(
113
  'settings.php' // parent slug
114
- , __( 'WP External Links' , 'wpel' ) // page title
115
- , __( 'External Links' , 'wpel' ) // menu title
116
  , 'manage_options' // capability
117
  , $this->menu_slug // menu slug
118
  , $this->get_callback( 'show_network_page' ) // callback
@@ -132,7 +132,7 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
132
  'wpel-admin-style'
133
  , plugins_url( '/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file() )
134
  , array()
135
- , null
136
  );
137
 
138
  // set wpel admin script
@@ -140,7 +140,7 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
140
  'wpel-admin-settings'
141
  , plugins_url( '/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file() )
142
  , array('jquery')
143
- , false
144
  , true
145
  );
146
 
@@ -182,7 +182,7 @@ final class WPEL_Network_Page extends WPRun_Base_1x0x0
182
 
183
  $screen->add_help_tab( array(
184
  'id' => 'under-construction',
185
- 'title' => __( 'Under Construction', 'wpel' ),
186
  'callback' => $this->get_callback( 'show_help_tab' ),
187
  ) );
188
  }
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
35
  {
36
  $this->tabs = array(
37
  'network-settings' => array(
38
+ 'title' => __( 'Multi Site Settings', 'wp-external-links' ),
39
  'icon' => '<i class="fa fa-sitemap" aria-hidden="true"></i>',
40
  'fields' => $fields_objects[ 'network-settings' ],
41
  ),
42
  'network-admin-settings' => array(
43
+ 'title' => __( 'Admin Settings', 'wp-external-links' ),
44
+ 'icon' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
45
  'fields' => $fields_objects[ 'network-admin-settings' ],
46
  ),
47
  'support' => array(
48
+ 'title' => __( 'Support', 'wp-external-links' ),
49
+ 'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
50
  ),
51
  );
52
 
100
 
101
  if ( '1' === $own_admin_menu ) {
102
  $this->page_hook = add_menu_page(
103
+ __( 'WP External Links' , 'wp-external-links' ) // page title
104
+ , __( 'External Links' , 'wp-external-links' ) // menu title
105
  , 'manage_network' // capability
106
  , $this->menu_slug // menu slug
107
  , $this->get_callback( 'show_network_page' ) // callback
111
  } else {
112
  $this->page_hook = add_submenu_page(
113
  'settings.php' // parent slug
114
+ , __( 'WP External Links' , 'wp-external-links' ) // page title
115
+ , __( 'External Links' , 'wp-external-links' ) // menu title
116
  , 'manage_options' // capability
117
  , $this->menu_slug // menu slug
118
  , $this->get_callback( 'show_network_page' ) // callback
132
  'wpel-admin-style'
133
  , plugins_url( '/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file() )
134
  , array()
135
+ , '2.1.0'
136
  );
137
 
138
  // set wpel admin script
140
  'wpel-admin-settings'
141
  , plugins_url( '/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file() )
142
  , array('jquery')
143
+ , '2.1.0'
144
  , true
145
  );
146
 
182
 
183
  $screen->add_help_tab( array(
184
  'id' => 'under-construction',
185
+ 'title' => __( 'Under Construction', 'wp-external-links' ),
186
  'callback' => $this->get_callback( 'show_help_tab' ),
187
  ) );
188
  }
includes/admin/class-wpel-settings-page.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -42,31 +42,41 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
42
 
43
  $this->tabs = array(
44
  'external-links' => array(
45
- 'title' => __( 'External Links', 'wpel' ),
46
  'icon' => '<i class="fa fa-external-link-square" aria-hidden="true"></i>',
47
  'fields' => $fields_objects[ 'external-links' ],
48
  ),
49
  'internal-links' => array(
50
- 'title' => __( 'Internal Links', 'wpel' ),
51
- 'icon' => '<i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>',
52
  'fields' => $fields_objects[ 'internal-links' ],
53
  ),
 
 
 
 
 
54
  'exceptions' => array(
55
- 'title' => __( 'Exceptions', 'wpel' ),
56
- 'icon' => '<i class="fa fa-times-circle" aria-hidden="true"></i>',
57
  'fields' => $fields_objects[ 'exceptions' ],
58
  ),
59
  'admin' => array(
60
- 'title' => __( 'Admin Settings', 'wpel' ),
61
- 'icon' => '<i class="fa fa-cog" aria-hidden="true"></i>',
62
  'fields' => $fields_objects[ 'admin' ],
63
  ),
64
  'support' => array(
65
- 'title' => __( 'Support', 'wpel' ),
66
  'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
67
  ),
68
  );
69
 
 
 
 
 
 
70
  // get current tab
71
  $this->current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
72
 
@@ -119,8 +129,8 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
119
 
120
  if ( '1' === $own_admin_menu ) {
121
  $this->page_hook = add_menu_page(
122
- __( 'WP External Links' , 'wpel' ) // page title
123
- , __( 'External Links' , 'wpel' ) // menu title
124
  , $capability // capability
125
  , $this->menu_slug // id
126
  , $this->get_callback( 'show_admin_page' ) // callback
@@ -129,8 +139,8 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
129
  );
130
  } else {
131
  $this->page_hook = add_options_page(
132
- __( 'WP External Links' , 'wpel' ) // page title
133
- , __( 'External Links' , 'wpel' ) // menu title
134
  , $capability // capability
135
  , $this->menu_slug // id
136
  , $this->get_callback( 'show_admin_page' ) // callback
@@ -170,7 +180,7 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
170
  'wpel-admin-style'
171
  , plugins_url( '/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file() )
172
  , array()
173
- , null
174
  );
175
 
176
  // set wpel admin script
@@ -178,7 +188,7 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
178
  'wpel-admin-settings'
179
  , plugins_url( '/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file() )
180
  , array('jquery')
181
- , false
182
  , true
183
  );
184
 
@@ -220,12 +230,12 @@ final class WPEL_Settings_Page extends WPRun_Base_1x0x0
220
 
221
  $screen->add_help_tab( array(
222
  'id' => 'under-construction',
223
- 'title' => __( 'Under Construction', 'wpel' ),
224
  'callback' => $this->get_callback( 'show_help_tab' ),
225
  ) );
226
  $screen->add_help_tab( array(
227
  'id' => 'data-attributes',
228
- 'title' => __( 'Data Attributes', 'wpel' ),
229
  'callback' => $this->get_callback( 'show_help_tab' ),
230
  ) );
231
  }
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
42
 
43
  $this->tabs = array(
44
  'external-links' => array(
45
+ 'title' => __( 'External Links', 'wp-external-links' ),
46
  'icon' => '<i class="fa fa-external-link-square" aria-hidden="true"></i>',
47
  'fields' => $fields_objects[ 'external-links' ],
48
  ),
49
  'internal-links' => array(
50
+ 'title' => __( 'Internal Links', 'wp-external-links' ),
51
+ 'icon' => '<i class="fa fa-square-o" aria-hidden="true"></i>',
52
  'fields' => $fields_objects[ 'internal-links' ],
53
  ),
54
+ 'excluded-links' => array(
55
+ 'title' => __( 'Excluded Links', 'wp-external-links' ),
56
+ 'icon' => '<i class="fa fa-share-square" aria-hidden="true"></i>',
57
+ 'fields' => $fields_objects[ 'excluded-links' ],
58
+ ),
59
  'exceptions' => array(
60
+ 'title' => __( 'Exceptions', 'wp-external-links' ),
61
+ 'icon' => '<i class="fa fa-th-large" aria-hidden="true"></i>',
62
  'fields' => $fields_objects[ 'exceptions' ],
63
  ),
64
  'admin' => array(
65
+ 'title' => __( 'Admin Settings', 'wp-external-links' ),
66
+ 'icon' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
67
  'fields' => $fields_objects[ 'admin' ],
68
  ),
69
  'support' => array(
70
+ 'title' => __( 'Support', 'wp-external-links' ),
71
  'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
72
  ),
73
  );
74
 
75
+ // check excluded links tab available
76
+ if ( $this->get_option_value( 'excludes_as_internal_links', 'exceptions' ) ) {
77
+ unset( $this->tabs[ 'excluded-links' ] );
78
+ }
79
+
80
  // get current tab
81
  $this->current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
82
 
129
 
130
  if ( '1' === $own_admin_menu ) {
131
  $this->page_hook = add_menu_page(
132
+ __( 'WP External Links' , 'wp-external-links' ) // page title
133
+ , __( 'External Links' , 'wp-external-links' ) // menu title
134
  , $capability // capability
135
  , $this->menu_slug // id
136
  , $this->get_callback( 'show_admin_page' ) // callback
139
  );
140
  } else {
141
  $this->page_hook = add_options_page(
142
+ __( 'WP External Links' , 'wp-external-links' ) // page title
143
+ , __( 'External Links' , 'wp-external-links' ) // menu title
144
  , $capability // capability
145
  , $this->menu_slug // id
146
  , $this->get_callback( 'show_admin_page' ) // callback
180
  'wpel-admin-style'
181
  , plugins_url( '/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file() )
182
  , array()
183
+ , '2.1.0'
184
  );
185
 
186
  // set wpel admin script
188
  'wpel-admin-settings'
189
  , plugins_url( '/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file() )
190
  , array('jquery')
191
+ , '2.1.0'
192
  , true
193
  );
194
 
230
 
231
  $screen->add_help_tab( array(
232
  'id' => 'under-construction',
233
+ 'title' => __( 'Under Construction', 'wp-external-links' ),
234
  'callback' => $this->get_callback( 'show_help_tab' ),
235
  ) );
236
  $screen->add_help_tab( array(
237
  'id' => 'data-attributes',
238
+ 'title' => __( 'Data Attributes', 'wp-external-links' ),
239
  'callback' => $this->get_callback( 'show_help_tab' ),
240
  ) );
241
  }
includes/admin/network-fields/class-wpel-network-admin-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -23,10 +23,10 @@ final class WPEL_Network_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
23
  'page_id' => 'wpel-network-admin-fields',
24
  'option_name' => 'wpel-network-admin-settings',
25
  'option_group' => 'wpel-network-admin-settings',
26
- 'title' => __( 'Network Admin Settings', 'wpel' ),
27
  'fields' => array(
28
  'own_admin_menu' => array(
29
- 'label' => __( 'Main Network Admin Menu:', 'wpel' ),
30
  'default_value' => '1',
31
  ),
32
  ),
@@ -77,13 +77,13 @@ final class WPEL_Network_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
77
  {
78
  $this->get_html_fields()->check_with_label(
79
  $args[ 'key' ]
80
- , __( 'Create own network admin menu for this plugin', 'wpel' )
81
  , '1'
82
  , ''
83
  );
84
 
85
  echo ' <p class="description">'
86
- . __( 'Or else it will be added to the "Settings" menu', 'wpel' )
87
  .'</p>';
88
  }
89
 
@@ -102,7 +102,7 @@ final class WPEL_Network_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
102
 
103
  if ( false === $is_valid ) {
104
  // error when user input is not valid conform the UI, probably tried to "hack"
105
- $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wpel' ) );
106
  return $old_values;
107
  }
108
 
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
23
  'page_id' => 'wpel-network-admin-fields',
24
  'option_name' => 'wpel-network-admin-settings',
25
  'option_group' => 'wpel-network-admin-settings',
26
+ 'title' => __( 'Network Admin Settings', 'wp-external-links' ),
27
  'fields' => array(
28
  'own_admin_menu' => array(
29
+ 'label' => __( 'Main Network Admin Menu:', 'wp-external-links' ),
30
  'default_value' => '1',
31
  ),
32
  ),
77
  {
78
  $this->get_html_fields()->check_with_label(
79
  $args[ 'key' ]
80
+ , __( 'Create own network admin menu for this plugin', 'wp-external-links' )
81
  , '1'
82
  , ''
83
  );
84
 
85
  echo ' <p class="description">'
86
+ . __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
87
  .'</p>';
88
  }
89
 
102
 
103
  if ( false === $is_valid ) {
104
  // error when user input is not valid conform the UI, probably tried to "hack"
105
+ $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
106
  return $old_values;
107
  }
108
 
includes/admin/network-fields/class-wpel-network-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -23,14 +23,14 @@ final class WPEL_Network_Fields extends FWP_Settings_Section_Fields_1x0x0
23
  'page_id' => 'wpel-network-fields',
24
  'option_name' => 'wpel-network-settings',
25
  'option_group' => 'wpel-network-settings',
26
- 'title' => __( 'Multi Site Settings', 'wpel' ),
27
  'fields' => array(
28
  'capability' => array(
29
- 'label' => __( 'Capability for individual sites:', 'wpel' ),
30
  'default_value' => 'manage_options',
31
  ),
32
  'default_settings_site' => array(
33
- 'label' => __( 'Use the settings of this site as default for new sites:', 'wpel' ),
34
  'default_value' => '',
35
  ),
36
  ),
@@ -86,8 +86,8 @@ final class WPEL_Network_Fields extends FWP_Settings_Section_Fields_1x0x0
86
  $this->get_html_fields()->select(
87
  $args[ 'key' ]
88
  , array(
89
- 'manage_options' => __( 'Site Admins and Super Admins', 'wpel' ),
90
- 'manage_network' => __( 'Only Super Admins', 'wpel' ),
91
  )
92
  );
93
  }
@@ -97,7 +97,7 @@ final class WPEL_Network_Fields extends FWP_Settings_Section_Fields_1x0x0
97
  $sites = wp_get_sites();
98
 
99
  $values = array();
100
- $values[ '' ] = __( '- none -', 'wpel' );
101
 
102
  foreach ( $sites as $site ) {
103
  $values[ $site[ 'blog_id' ] ] = 'blog_id: '. $site[ 'blog_id' ] .' - '. $site[ 'path' ];
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
23
  'page_id' => 'wpel-network-fields',
24
  'option_name' => 'wpel-network-settings',
25
  'option_group' => 'wpel-network-settings',
26
+ 'title' => __( 'Multi Site Settings', 'wp-external-links' ),
27
  'fields' => array(
28
  'capability' => array(
29
+ 'label' => __( 'Capability for individual sites:', 'wp-external-links' ),
30
  'default_value' => 'manage_options',
31
  ),
32
  'default_settings_site' => array(
33
+ 'label' => __( 'Use the settings of this site as default for new sites:', 'wp-external-links' ),
34
  'default_value' => '',
35
  ),
36
  ),
86
  $this->get_html_fields()->select(
87
  $args[ 'key' ]
88
  , array(
89
+ 'manage_options' => __( 'Site Admins and Super Admins', 'wp-external-links' ),
90
+ 'manage_network' => __( 'Only Super Admins', 'wp-external-links' ),
91
  )
92
  );
93
  }
97
  $sites = wp_get_sites();
98
 
99
  $values = array();
100
+ $values[ '' ] = __( '- none -', 'wp-external-links' );
101
 
102
  foreach ( $sites as $site ) {
103
  $values[ $site[ 'blog_id' ] ] = 'blog_id: '. $site[ 'blog_id' ] .' - '. $site[ 'path' ];
includes/admin/settings-fields/class-wpel-admin-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -23,10 +23,10 @@ final class WPEL_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
23
  'page_id' => 'wpel-admin-fields',
24
  'option_name' => 'wpel-admin-settings',
25
  'option_group' => 'wpel-admin-settings',
26
- 'title' => __( 'Admin Settings', 'wpel' ),
27
  'fields' => array(
28
  'own_admin_menu' => array(
29
- 'label' => __( 'Main Admin Menu:', 'wpel' ),
30
  'default_value' => '1',
31
  ),
32
  ),
@@ -41,13 +41,13 @@ final class WPEL_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
41
  {
42
  $this->get_html_fields()->check_with_label(
43
  $args[ 'key' ]
44
- , __( 'Create own admin menu for this plugin', 'wpel' )
45
  , '1'
46
  , ''
47
  );
48
 
49
  echo ' <p class="description">'
50
- . __( 'Or else it will be added to the "Settings" menu', 'wpel' )
51
  .'</p>';
52
  }
53
 
@@ -66,7 +66,7 @@ final class WPEL_Admin_Fields extends FWP_Settings_Section_Fields_1x0x0
66
 
67
  if ( false === $is_valid ) {
68
  // error when user input is not valid conform the UI, probably tried to "hack"
69
- $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wpel' ) );
70
  return $old_values;
71
  }
72
 
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
23
  'page_id' => 'wpel-admin-fields',
24
  'option_name' => 'wpel-admin-settings',
25
  'option_group' => 'wpel-admin-settings',
26
+ 'title' => __( 'Admin Settings', 'wp-external-links' ),
27
  'fields' => array(
28
  'own_admin_menu' => array(
29
+ 'label' => __( 'Main Admin Menu:', 'wp-external-links' ),
30
  'default_value' => '1',
31
  ),
32
  ),
41
  {
42
  $this->get_html_fields()->check_with_label(
43
  $args[ 'key' ]
44
+ , __( 'Create own admin menu for this plugin', 'wp-external-links' )
45
  , '1'
46
  , ''
47
  );
48
 
49
  echo ' <p class="description">'
50
+ . __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
51
  .'</p>';
52
  }
53
 
66
 
67
  if ( false === $is_valid ) {
68
  // error when user input is not valid conform the UI, probably tried to "hack"
69
+ $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
70
  return $old_values;
71
  }
72
 
includes/admin/settings-fields/class-wpel-exceptions-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -23,10 +23,10 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
23
  'page_id' => 'wpel-exceptions-fields',
24
  'option_name' => 'wpel-exceptions-settings',
25
  'option_group' => 'wpel-exceptions-settings',
26
- 'title' => __( 'Exceptions', 'wpel' ),
27
  'fields' => array(
28
  'apply_all' => array(
29
- 'label' => __( 'Apply settings on:', 'wpel' ),
30
  'class' => 'js-wpel-apply',
31
  'default_value' => '1',
32
  ),
@@ -42,22 +42,25 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
42
  'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label',
43
  'default_value' => '1',
44
  ),
45
- 'ignore_script_tags' => array(
46
- 'label' => __( 'Skip <code>&lt;script&gt;</code>:', 'wpel' ),
47
- 'default_value' => '1',
48
- ),
49
  'subdomains_as_internal_links' => array(
50
- 'label' => __( 'Make subdomains internal:', 'wpel' ),
51
  ),
52
  'include_urls' => array(
53
- 'label' => __( 'Include external links by URL:', 'wpel' ),
54
  ),
55
  'exclude_urls' => array(
56
- 'label' => __( 'Exclude external links by URL:', 'wpel' ),
57
  ),
58
  'excludes_as_internal_links' => array(
59
- 'label' => '',
60
- 'class' => 'wpel-no-label',
 
 
 
 
 
 
 
61
  ),
62
  ),
63
  ) );
@@ -71,7 +74,7 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
71
  {
72
  $this->get_html_fields()->check_with_label(
73
  $args[ 'key' ]
74
- , __( 'All contents (the whole page)', 'wpel' )
75
  , '1'
76
  , ''
77
  );
@@ -81,7 +84,7 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
81
  {
82
  $this->get_html_fields()->check_with_label(
83
  $args[ 'key' ]
84
- , __( 'Post content', 'wpel' )
85
  , '1'
86
  , ''
87
  );
@@ -91,7 +94,7 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
91
  {
92
  $this->get_html_fields()->check_with_label(
93
  $args[ 'key' ]
94
- , __( 'Comments', 'wpel' )
95
  , '1'
96
  , ''
97
  );
@@ -101,17 +104,7 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
101
  {
102
  $this->get_html_fields()->check_with_label(
103
  $args[ 'key' ]
104
- , __( 'All widgets', 'wpel' )
105
- , '1'
106
- , ''
107
- );
108
- }
109
-
110
- protected function show_ignore_script_tags( array $args )
111
- {
112
- $this->get_html_fields()->check_with_label(
113
- $args[ 'key' ]
114
- , __( 'Ignore all links in <code>&lt;script&gt;</code> blocks', 'wpel' )
115
  , '1'
116
  , ''
117
  );
@@ -121,7 +114,7 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
121
  {
122
  $this->get_html_fields()->check_with_label(
123
  $args[ 'key' ]
124
- , __( 'Threat all links to the site\'s domain and subdomains as internal links', 'wpel' )
125
  , '1'
126
  , ''
127
  );
@@ -144,20 +137,51 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
144
  'rows' => 4,
145
  'placeholder' => __( 'For example:'. "\n"
146
  .'somedomain.org, sub.domain.net/some-slug'. "\n"
147
- .'http://sub.moredomain.net, http://www.domain.com/other-slug', 'wpel' ),
148
  ) );
149
 
150
  echo '<p class="description">'
151
  . __( 'Separate url\'s by comma and/or a line break. '
152
- .'Write the url\'s as specific as you want them to match.', 'wpel' )
153
  .'</p>';
154
  }
155
 
156
  protected function show_excludes_as_internal_links( array $args )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  {
158
  $this->get_html_fields()->check_with_label(
159
  $args[ 'key' ]
160
- , __( 'Treat excluded links as internal links', 'wpel' )
 
 
 
 
 
 
 
 
 
 
161
  , '1'
162
  , ''
163
  );
@@ -178,13 +202,14 @@ final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Fields_1x0x0
178
  $is_valid = $is_valid && in_array( $new_values[ 'apply_comments' ], array( '', '1' ) );
179
  $is_valid = $is_valid && in_array( $new_values[ 'apply_widgets' ], array( '', '1' ) );
180
  $is_valid = $is_valid && in_array( $new_values[ 'apply_all' ], array( '', '1' ) );
181
- $is_valid = $is_valid && in_array( $new_values[ 'ignore_script_tags' ], array( '', '1' ) );
182
  $is_valid = $is_valid && in_array( $new_values[ 'subdomains_as_internal_links' ], array( '', '1' ) );
183
  $is_valid = $is_valid && in_array( $new_values[ 'excludes_as_internal_links' ], array( '', '1' ) );
 
 
184
 
185
  if ( false === $is_valid ) {
186
  // error when user input is not valid conform the UI, probably tried to "hack"
187
- $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wpel' ) );
188
  return $old_values;
189
  }
190
 
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
23
  'page_id' => 'wpel-exceptions-fields',
24
  'option_name' => 'wpel-exceptions-settings',
25
  'option_group' => 'wpel-exceptions-settings',
26
+ 'title' => __( 'Exceptions', 'wp-external-links' ),
27
  'fields' => array(
28
  'apply_all' => array(
29
+ 'label' => __( 'Apply settings on:', 'wp-external-links' ),
30
  'class' => 'js-wpel-apply',
31
  'default_value' => '1',
32
  ),
42
  'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label',
43
  'default_value' => '1',
44
  ),
 
 
 
 
45
  'subdomains_as_internal_links' => array(
46
+ 'label' => __( 'Make subdomains internal:', 'wp-external-links' ),
47
  ),
48
  'include_urls' => array(
49
+ 'label' => __( 'Include external links by URL:', 'wp-external-links' ),
50
  ),
51
  'exclude_urls' => array(
52
+ 'label' => __( 'Exclude external links by URL:', 'wp-external-links' ),
53
  ),
54
  'excludes_as_internal_links' => array(
55
+ 'label' => __( 'Own settings for excluded links:', 'wp-external-links' ),
56
+ ),
57
+ 'ignore_script_tags' => array(
58
+ 'label' => __( 'Skip <code>&lt;script&gt;</code>:', 'wp-external-links' ),
59
+ 'default_value' => '1',
60
+ ),
61
+ 'ignore_mailto_links' => array(
62
+ 'label' => __( 'Skip <code>mailto</code> links:', 'wp-external-links' ),
63
+ 'default_value' => '1',
64
  ),
65
  ),
66
  ) );
74
  {
75
  $this->get_html_fields()->check_with_label(
76
  $args[ 'key' ]
77
+ , __( 'All contents (the whole page)', 'wp-external-links' )
78
  , '1'
79
  , ''
80
  );
84
  {
85
  $this->get_html_fields()->check_with_label(
86
  $args[ 'key' ]
87
+ , __( 'Post content', 'wp-external-links' )
88
  , '1'
89
  , ''
90
  );
94
  {
95
  $this->get_html_fields()->check_with_label(
96
  $args[ 'key' ]
97
+ , __( 'Comments', 'wp-external-links' )
98
  , '1'
99
  , ''
100
  );
104
  {
105
  $this->get_html_fields()->check_with_label(
106
  $args[ 'key' ]
107
+ , __( 'All widgets', 'wp-external-links' )
 
 
 
 
 
 
 
 
 
 
108
  , '1'
109
  , ''
110
  );
114
  {
115
  $this->get_html_fields()->check_with_label(
116
  $args[ 'key' ]
117
+ , __( 'Threat all links to the site\'s domain and subdomains as internal links', 'wp-external-links' )
118
  , '1'
119
  , ''
120
  );
137
  'rows' => 4,
138
  'placeholder' => __( 'For example:'. "\n"
139
  .'somedomain.org, sub.domain.net/some-slug'. "\n"
140
+ .'http://sub.moredomain.net, http://www.domain.com/other-slug', 'wp-external-links' ),
141
  ) );
142
 
143
  echo '<p class="description">'
144
  . __( 'Separate url\'s by comma and/or a line break. '
145
+ .'Write the url\'s as specific as you want them to match.', 'wp-external-links' )
146
  .'</p>';
147
  }
148
 
149
  protected function show_excludes_as_internal_links( array $args )
150
+ {
151
+ echo '<fieldset>';
152
+
153
+ $this->get_html_fields()->radio_with_label(
154
+ $args[ 'key' ]
155
+ , __( 'Treat excluded links as internal links', 'wp-external-links' )
156
+ , '1'
157
+ );
158
+
159
+ echo '<br>';
160
+
161
+ $this->get_html_fields()->radio_with_label(
162
+ $args[ 'key' ]
163
+ , __( 'Own settings for excluded links <span class="description">(extra tab)</span>', 'wp-external-links' )
164
+ , ''
165
+ );
166
+
167
+ echo '</fieldset>';
168
+ }
169
+
170
+ protected function show_ignore_script_tags( array $args )
171
  {
172
  $this->get_html_fields()->check_with_label(
173
  $args[ 'key' ]
174
+ , __( 'Ignore all links in <code>&lt;script&gt;</code> blocks', 'wp-external-links' )
175
+ , '1'
176
+ , ''
177
+ );
178
+ }
179
+
180
+ protected function show_ignore_mailto_links( array $args )
181
+ {
182
+ $this->get_html_fields()->check_with_label(
183
+ $args[ 'key' ]
184
+ , __( 'Ignore all <code>mailto</code> links', 'wp-external-links' )
185
  , '1'
186
  , ''
187
  );
202
  $is_valid = $is_valid && in_array( $new_values[ 'apply_comments' ], array( '', '1' ) );
203
  $is_valid = $is_valid && in_array( $new_values[ 'apply_widgets' ], array( '', '1' ) );
204
  $is_valid = $is_valid && in_array( $new_values[ 'apply_all' ], array( '', '1' ) );
 
205
  $is_valid = $is_valid && in_array( $new_values[ 'subdomains_as_internal_links' ], array( '', '1' ) );
206
  $is_valid = $is_valid && in_array( $new_values[ 'excludes_as_internal_links' ], array( '', '1' ) );
207
+ $is_valid = $is_valid && in_array( $new_values[ 'ignore_script_tags' ], array( '', '1' ) );
208
+ $is_valid = $is_valid && in_array( $new_values[ 'ignore_mailto_links' ], array( '', '1' ) );
209
 
210
  if ( false === $is_valid ) {
211
  // error when user input is not valid conform the UI, probably tried to "hack"
212
+ $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
213
  return $old_values;
214
  }
215
 
includes/admin/settings-fields/class-wpel-excluded-link-fields.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WPEL_Excluded_Link_Fields
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ */
13
+ final class WPEL_Excluded_Link_Fields extends WPEL_Link_Fields_Base
14
+ {
15
+
16
+ /**
17
+ * Initialize
18
+ */
19
+ protected function init()
20
+ {
21
+ $option_name = 'wpel-excluded-link-settings';
22
+ $fields = $this->get_general_fields( $option_name );
23
+
24
+ // change some specific field labels
25
+ $fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for excluded links:', 'wp-external-links' );
26
+ $fields[ 'target' ][ 'label' ] = __( 'Open excluded links:', 'wp-external-links' );
27
+
28
+ $this->set_settings( array(
29
+ 'section_id' => 'wpel-excluded-link-fields',
30
+ 'page_id' => 'wpel-excluded-link-fields',
31
+ 'option_name' => $option_name,
32
+ 'option_group' => $option_name,
33
+ 'title' => __( 'Excluded Links', 'wp-external-links' ),
34
+ 'fields' => $fields,
35
+ ) );
36
+ }
37
+
38
+ }
39
+
40
+ /*?>*/
includes/admin/settings-fields/class-wpel-external-link-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -22,20 +22,74 @@ final class WPEL_External_Link_Fields extends WPEL_Link_Fields_Base
22
  $fields = $this->get_general_fields( $option_name );
23
 
24
  // specific field settings
25
- $fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for external links:', 'wpel' );
26
  $fields[ 'apply_settings' ][ 'default_value' ] = '1';
27
- $fields[ 'target' ][ 'label' ] = __( 'Open external links:', 'wpel' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  $this->set_settings( array(
30
  'section_id' => 'wpel-external-link-fields',
31
  'page_id' => 'wpel-external-link-fields',
32
  'option_name' => $option_name,
33
  'option_group' => $option_name,
34
- 'title' => __( 'External Links', 'wpel' ),
35
- 'fields' => $fields,
36
  ) );
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  /*?>*/
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
22
  $fields = $this->get_general_fields( $option_name );
23
 
24
  // specific field settings
25
+ $fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for external links:', 'wp-external-links' );
26
  $fields[ 'apply_settings' ][ 'default_value' ] = '1';
27
+ $fields[ 'target' ][ 'label' ] = __( 'Open external links:', 'wp-external-links' );
28
+
29
+ //
30
+ $index_prev = array_search( 'rel_noreferrer', array_keys( $fields ) );
31
+ $index_insert = $index_prev + 1;
32
+
33
+ $additional_fields = array(
34
+ 'rel_external' => array(
35
+ 'label' => '',
36
+ 'class' => 'wpel-no-label wpel-hidden',
37
+ 'default_value' => '1',
38
+ ),
39
+ );
40
+
41
+ $fields = array_merge(
42
+ array_slice( $fields, 0, $index_insert )
43
+ , $additional_fields
44
+ , array_slice( $fields, $index_insert )
45
+ );
46
 
47
  $this->set_settings( array(
48
  'section_id' => 'wpel-external-link-fields',
49
  'page_id' => 'wpel-external-link-fields',
50
  'option_name' => $option_name,
51
  'option_group' => $option_name,
52
+ 'title' => __( 'External Links', 'wp-external-links' ),
53
+ 'fields' => $fields,
54
  ) );
55
  }
56
 
57
+ /**
58
+ * Show field methods
59
+ */
60
+
61
+ protected function show_rel_external( array $args )
62
+ {
63
+ $this->get_html_fields()->check_with_label(
64
+ $args[ 'key' ]
65
+ , __( 'Add <code>"external"</code>', 'wp-external-links' )
66
+ , '1'
67
+ , ''
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Validate and sanitize user input before saving to databse
73
+ * @param array $new_values
74
+ * @param array $old_values
75
+ * @return array
76
+ */
77
+ protected function before_update( array $new_values, array $old_values )
78
+ {
79
+ $is_valid = true;
80
+
81
+ $is_valid = $is_valid && in_array( $new_values[ 'rel_external' ], array( '', '1' ) );
82
+
83
+ if ( false === $is_valid ) {
84
+ // error when user input is not valid conform the UI, probably tried to "hack"
85
+ $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
86
+ return $old_values;
87
+ }
88
+
89
+ $update_values = parent::before_update( $new_values, $old_values );
90
+ return $update_values;
91
+ }
92
+
93
  }
94
 
95
  /*?>*/
includes/admin/settings-fields/class-wpel-internal-link-fields.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -22,16 +22,16 @@ final class WPEL_Internal_Link_Fields extends WPEL_Link_Fields_Base
22
  $fields = $this->get_general_fields( $option_name );
23
 
24
  // change some specific field labels
25
- $fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for internal links:', 'wpel' );
26
- $fields[ 'target' ][ 'label' ] = __( 'Open internal links:', 'wpel' );
27
 
28
  $this->set_settings( array(
29
- 'section_id' => 'wpel-internal-link-fields',
30
- 'page_id' => 'wpel-internal-link-fields',
31
- 'option_name' => $option_name,
32
- 'option_group' => $option_name,
33
- 'title' => __( 'Internal Links', 'wpel' ),
34
- 'fields' => $fields,
35
  ) );
36
  }
37
 
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
22
  $fields = $this->get_general_fields( $option_name );
23
 
24
  // change some specific field labels
25
+ $fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for internal links:', 'wp-external-links' );
26
+ $fields[ 'target' ][ 'label' ] = __( 'Open internal links:', 'wp-external-links' );
27
 
28
  $this->set_settings( array(
29
+ 'section_id' => 'wpel-internal-link-fields',
30
+ 'page_id' => 'wpel-internal-link-fields',
31
+ 'option_name' => $option_name,
32
+ 'option_group' => $option_name,
33
+ 'title' => __( 'Internal Links', 'wp-external-links' ),
34
+ 'fields' => $fields,
35
  ) );
36
  }
37
 
includes/admin/settings-fields/class-wpel-link-fields-base.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -15,18 +15,17 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
15
 
16
  /**
17
  * Get general fields
18
- * @param string $option_name
19
  * @return array
20
  */
21
- final protected function get_general_fields( $option_name )
22
  {
23
  return array(
24
  'apply_settings' => array(
25
- 'label' => __( 'Settings for links:', 'wpel' ),
26
  'class' => 'js-apply-settings',
27
  ),
28
  'target' => array(
29
- 'label' => __( 'Open links:', 'wpel' ),
30
  'class' => 'wpel-hidden',
31
  'default_value' => '',
32
  ),
@@ -35,7 +34,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
35
  'class' => 'wpel-no-label wpel-hidden',
36
  ),
37
  'rel_follow' => array(
38
- 'label' => __( 'Set <code>follow</code> or <code>nofollow</code>:', 'wpel' ),
39
  'class' => 'wpel-hidden',
40
  'default_value' => '',
41
  ),
@@ -43,14 +42,9 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
43
  'label' => '',
44
  'class' => 'wpel-no-label wpel-hidden',
45
  ),
46
- 'rel_external' => array(
47
- 'label' => __( 'Also add to <code>rel</code> attribute:', 'wpel' ),
48
- 'class' => 'wpel-hidden',
49
- 'default_value' => '1',
50
- ),
51
  'rel_noopener' => array(
52
- 'label' => '',
53
- 'class' => 'wpel-no-label wpel-hidden',
54
  'default_value' => '1',
55
  ),
56
  'rel_noreferrer' => array(
@@ -59,38 +53,38 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
59
  'default_value' => '1',
60
  ),
61
  'title' => array(
62
- 'label' => __( 'Set <code>title</code>:', 'wpel' ),
63
  'class' => 'wpel-hidden',
64
  'default_value' => '{title}',
65
  ),
66
  'class' => array(
67
- 'label' => __( 'Add CSS class(es):', 'wpel' ),
68
  'class' => 'wpel-hidden',
69
  ),
70
  'icon_type' => array(
71
- 'label' => __( 'Choose icon type:', 'wpel' ),
72
  'class' => 'js-icon-type wpel-hidden',
73
  ),
74
  'icon_image' => array(
75
- 'label' => __( 'Choose icon image:', 'wpel' ),
76
  'class' => 'js-icon-type-child js-icon-type-image wpel-hidden',
77
  'default_value' => '1',
78
  ),
79
  'icon_dashicon' => array(
80
- 'label' => __( 'Choose dashicon:', 'wpel' ),
81
  'class' => 'js-icon-type-child js-icon-type-dashicon wpel-hidden',
82
  ),
83
  'icon_fontawesome' => array(
84
- 'label' => __( 'Choose FA icon:', 'wpel' ),
85
  'class' => 'js-icon-type-child js-icon-type-fontawesome wpel-hidden',
86
  ),
87
  'icon_position' => array(
88
- 'label' => __( 'Icon position:', 'wpel' ),
89
  'class' => 'js-icon-type-depend wpel-hidden',
90
  'default_value' => 'right',
91
  ),
92
  'no_icon_for_img' => array(
93
- 'label' => __( 'Skip icon with <code>&lt;img&gt;</code>:', 'wpel' ),
94
  'class' => 'js-icon-type-depend wpel-hidden',
95
  'default_value' => '1',
96
  ),
@@ -105,7 +99,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
105
  {
106
  $this->get_html_fields()->check_with_label(
107
  $args[ 'key' ]
108
- , __( 'Apply these settings', 'wpel' )
109
  , '1'
110
  , ''
111
  );
@@ -116,11 +110,11 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
116
  $this->get_html_fields()->select(
117
  $args[ 'key' ]
118
  , array(
119
- '' => __( '- keep as is -', 'wpel' ),
120
- '_self' => __( 'in the same window, tab or frame', 'wpel' ),
121
- '_blank' => __( 'each in a separate new window or tab', 'wpel' ),
122
- '_new' => __( 'all in the same new window or tab', 'wpel' ),
123
- '_top' => __( 'in the topmost frame', 'wpel' ),
124
  )
125
  );
126
  }
@@ -129,7 +123,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
129
  {
130
  $this->get_html_fields()->check_with_label(
131
  $args[ 'key' ]
132
- , __( 'Overwrite existing values.', 'wpel' )
133
  , '1'
134
  , ''
135
  );
@@ -140,9 +134,9 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
140
  $this->get_html_fields()->select(
141
  $args[ 'key' ]
142
  , array(
143
- '' => __( '- keep as is -', 'wpel' ),
144
- 'follow' => __( 'follow', 'wpel' ),
145
- 'nofollow' => __( 'nofollow', 'wpel' ),
146
  )
147
  );
148
  }
@@ -151,17 +145,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
151
  {
152
  $this->get_html_fields()->check_with_label(
153
  $args[ 'key' ]
154
- , __( 'Overwrite existing values.', 'wpel' )
155
- , '1'
156
- , ''
157
- );
158
- }
159
-
160
- protected function show_rel_external( array $args )
161
- {
162
- $this->get_html_fields()->check_with_label(
163
- $args[ 'key' ]
164
- , __( 'Add <code>"external"</code>', 'wpel' )
165
  , '1'
166
  , ''
167
  );
@@ -171,7 +155,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
171
  {
172
  $this->get_html_fields()->check_with_label(
173
  $args[ 'key' ]
174
- , __( 'Add <code>"noopener"</code>', 'wpel' )
175
  , '1'
176
  , ''
177
  );
@@ -181,7 +165,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
181
  {
182
  $this->get_html_fields()->check_with_label(
183
  $args[ 'key' ]
184
- , __( 'Add <code>"noreferrer"</code>', 'wpel' )
185
  , '1'
186
  , ''
187
  );
@@ -195,7 +179,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
195
 
196
  echo '<p class="description">'
197
  . __( 'Use this <code>{title}</code> for the original title value '
198
- .'and <code>{text}</code> for the link text as shown on the page', 'wpel' )
199
  .'</p>';
200
  }
201
 
@@ -211,10 +195,10 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
211
  $this->get_html_fields()->select(
212
  $args[ 'key' ]
213
  , array(
214
- '' => __( '- no icon -', 'wpel' ),
215
- 'image' => __( 'Image', 'wpel' ),
216
- 'dashicon' => __( 'Dashicon', 'wpel' ),
217
- 'fontawesome' => __( 'Font Awesome', 'wpel' ),
218
  )
219
  );
220
  }
@@ -278,8 +262,8 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
278
  $this->get_html_fields()->select(
279
  $args[ 'key' ]
280
  , array(
281
- 'left' => __( 'Left side of the link', 'wpel' ),
282
- 'right' => __( 'Right side of the link', 'wpel' ),
283
  )
284
  );
285
  }
@@ -288,7 +272,7 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
288
  {
289
  $this->get_html_fields()->check_with_label(
290
  $args[ 'key' ]
291
- , __( 'No icon for links already containing an <code>&lt;img&gt;</code>-tag.', 'wpel' )
292
  , '1'
293
  , ''
294
  );
@@ -308,14 +292,13 @@ abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Fields_1x0x0
308
  $is_valid = $is_valid && in_array( $new_values[ 'apply_settings' ], array( '', '1' ) );
309
  $is_valid = $is_valid && in_array( $new_values[ 'target_overwrite' ], array( '', '1' ) );
310
  $is_valid = $is_valid && in_array( $new_values[ 'rel_follow_overwrite' ], array( '', '1' ) );
311
- $is_valid = $is_valid && in_array( $new_values[ 'rel_external' ], array( '', '1' ) );
312
  $is_valid = $is_valid && in_array( $new_values[ 'rel_noopener' ], array( '', '1' ) );
313
  $is_valid = $is_valid && in_array( $new_values[ 'rel_noreferrer' ], array( '', '1' ) );
314
  $is_valid = $is_valid && in_array( $new_values[ 'no_icon_for_img' ], array( '', '1' ) );
315
 
316
  if ( false === $is_valid ) {
317
  // error when user input is not valid conform the UI, probably tried to "hack"
318
- $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wpel' ) );
319
  return $old_values;
320
  }
321
 
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
15
 
16
  /**
17
  * Get general fields
 
18
  * @return array
19
  */
20
+ final protected function get_general_fields()
21
  {
22
  return array(
23
  'apply_settings' => array(
24
+ 'label' => __( 'Settings for links:', 'wp-external-links' ),
25
  'class' => 'js-apply-settings',
26
  ),
27
  'target' => array(
28
+ 'label' => __( 'Open links:', 'wp-external-links' ),
29
  'class' => 'wpel-hidden',
30
  'default_value' => '',
31
  ),
34
  'class' => 'wpel-no-label wpel-hidden',
35
  ),
36
  'rel_follow' => array(
37
+ 'label' => __( 'Set <code>follow</code> or <code>nofollow</code>:', 'wp-external-links' ),
38
  'class' => 'wpel-hidden',
39
  'default_value' => '',
40
  ),
42
  'label' => '',
43
  'class' => 'wpel-no-label wpel-hidden',
44
  ),
 
 
 
 
 
45
  'rel_noopener' => array(
46
+ 'label' => __( 'Also add to <code>rel</code> attribute:', 'wp-external-links' ),
47
+ 'class' => 'wpel-hidden',
48
  'default_value' => '1',
49
  ),
50
  'rel_noreferrer' => array(
53
  'default_value' => '1',
54
  ),
55
  'title' => array(
56
+ 'label' => __( 'Set <code>title</code>:', 'wp-external-links' ),
57
  'class' => 'wpel-hidden',
58
  'default_value' => '{title}',
59
  ),
60
  'class' => array(
61
+ 'label' => __( 'Add CSS class(es):', 'wp-external-links' ),
62
  'class' => 'wpel-hidden',
63
  ),
64
  'icon_type' => array(
65
+ 'label' => __( 'Choose icon type:', 'wp-external-links' ),
66
  'class' => 'js-icon-type wpel-hidden',
67
  ),
68
  'icon_image' => array(
69
+ 'label' => __( 'Choose icon image:', 'wp-external-links' ),
70
  'class' => 'js-icon-type-child js-icon-type-image wpel-hidden',
71
  'default_value' => '1',
72
  ),
73
  'icon_dashicon' => array(
74
+ 'label' => __( 'Choose dashicon:', 'wp-external-links' ),
75
  'class' => 'js-icon-type-child js-icon-type-dashicon wpel-hidden',
76
  ),
77
  'icon_fontawesome' => array(
78
+ 'label' => __( 'Choose FA icon:', 'wp-external-links' ),
79
  'class' => 'js-icon-type-child js-icon-type-fontawesome wpel-hidden',
80
  ),
81
  'icon_position' => array(
82
+ 'label' => __( 'Icon position:', 'wp-external-links' ),
83
  'class' => 'js-icon-type-depend wpel-hidden',
84
  'default_value' => 'right',
85
  ),
86
  'no_icon_for_img' => array(
87
+ 'label' => __( 'Skip icon with <code>&lt;img&gt;</code>:', 'wp-external-links' ),
88
  'class' => 'js-icon-type-depend wpel-hidden',
89
  'default_value' => '1',
90
  ),
99
  {
100
  $this->get_html_fields()->check_with_label(
101
  $args[ 'key' ]
102
+ , __( 'Apply these settings', 'wp-external-links' )
103
  , '1'
104
  , ''
105
  );
110
  $this->get_html_fields()->select(
111
  $args[ 'key' ]
112
  , array(
113
+ '' => __( '- keep as is -', 'wp-external-links' ),
114
+ '_self' => __( 'in the same window, tab or frame', 'wp-external-links' ),
115
+ '_blank' => __( 'each in a separate new window or tab', 'wp-external-links' ),
116
+ '_new' => __( 'all in the same new window or tab', 'wp-external-links' ),
117
+ '_top' => __( 'in the topmost frame', 'wp-external-links' ),
118
  )
119
  );
120
  }
123
  {
124
  $this->get_html_fields()->check_with_label(
125
  $args[ 'key' ]
126
+ , __( 'Overwrite existing values.', 'wp-external-links' )
127
  , '1'
128
  , ''
129
  );
134
  $this->get_html_fields()->select(
135
  $args[ 'key' ]
136
  , array(
137
+ '' => __( '- keep as is -', 'wp-external-links' ),
138
+ 'follow' => __( 'follow', 'wp-external-links' ),
139
+ 'nofollow' => __( 'nofollow', 'wp-external-links' ),
140
  )
141
  );
142
  }
145
  {
146
  $this->get_html_fields()->check_with_label(
147
  $args[ 'key' ]
148
+ , __( 'Overwrite existing values.', 'wp-external-links' )
 
 
 
 
 
 
 
 
 
 
149
  , '1'
150
  , ''
151
  );
155
  {
156
  $this->get_html_fields()->check_with_label(
157
  $args[ 'key' ]
158
+ , __( 'Add <code>"noopener"</code>', 'wp-external-links' )
159
  , '1'
160
  , ''
161
  );
165
  {
166
  $this->get_html_fields()->check_with_label(
167
  $args[ 'key' ]
168
+ , __( 'Add <code>"noreferrer"</code>', 'wp-external-links' )
169
  , '1'
170
  , ''
171
  );
179
 
180
  echo '<p class="description">'
181
  . __( 'Use this <code>{title}</code> for the original title value '
182
+ .'and <code>{text}</code> for the link text as shown on the page', 'wp-external-links' )
183
  .'</p>';
184
  }
185
 
195
  $this->get_html_fields()->select(
196
  $args[ 'key' ]
197
  , array(
198
+ '' => __( '- no icon -', 'wp-external-links' ),
199
+ 'image' => __( 'Image', 'wp-external-links' ),
200
+ 'dashicon' => __( 'Dashicon', 'wp-external-links' ),
201
+ 'fontawesome' => __( 'Font Awesome', 'wp-external-links' ),
202
  )
203
  );
204
  }
262
  $this->get_html_fields()->select(
263
  $args[ 'key' ]
264
  , array(
265
+ 'left' => __( 'Left side of the link', 'wp-external-links' ),
266
+ 'right' => __( 'Right side of the link', 'wp-external-links' ),
267
  )
268
  );
269
  }
272
  {
273
  $this->get_html_fields()->check_with_label(
274
  $args[ 'key' ]
275
+ , __( 'No icon for links already containing an <code>&lt;img&gt;</code>-tag.', 'wp-external-links' )
276
  , '1'
277
  , ''
278
  );
292
  $is_valid = $is_valid && in_array( $new_values[ 'apply_settings' ], array( '', '1' ) );
293
  $is_valid = $is_valid && in_array( $new_values[ 'target_overwrite' ], array( '', '1' ) );
294
  $is_valid = $is_valid && in_array( $new_values[ 'rel_follow_overwrite' ], array( '', '1' ) );
 
295
  $is_valid = $is_valid && in_array( $new_values[ 'rel_noopener' ], array( '', '1' ) );
296
  $is_valid = $is_valid && in_array( $new_values[ 'rel_noreferrer' ], array( '', '1' ) );
297
  $is_valid = $is_valid && in_array( $new_values[ 'no_icon_for_img' ], array( '', '1' ) );
298
 
299
  if ( false === $is_valid ) {
300
  // error when user input is not valid conform the UI, probably tried to "hack"
301
+ $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
302
  return $old_values;
303
  }
304
 
includes/class-wpel-front-ignore.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -45,21 +45,38 @@ final class WPEL_Front_Ignore extends WPRun_Base_1x0x0
45
  }
46
 
47
  /**
48
- * Filter for "wpel_before_filter"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  * @param string $content
50
  * @return string
51
  */
52
- protected function filter_wpel_before_filter_10000000000( $content )
53
  {
54
- $content = preg_replace_callback(
55
- $this->get_tag_regexp( 'head' )
56
- , $this->get_callback( 'skip_tag' )
57
- , $content
58
- );
59
 
60
  if ( $this->opt( 'ignore_script_tags' ) ) {
 
 
 
 
61
  $content = preg_replace_callback(
62
- $this->get_tag_regexp( 'script' )
63
  , $this->get_callback( 'skip_tag' )
64
  , $content
65
  );
@@ -69,49 +86,24 @@ final class WPEL_Front_Ignore extends WPRun_Base_1x0x0
69
  }
70
 
71
  /**
72
- * @param type $tag_name
73
- * @return type
 
74
  */
75
- protected function get_tag_regexp( $tag_name )
76
  {
77
- return '/<'. $tag_name .'[^A-Za-z](.*?)>(.*?)<\/'. $tag_name .'[\s+]*>/is';
78
  }
79
 
80
  /**
81
- * Filter for "wpel_after_filter"
82
- * @param string $content
83
- * @return string
84
  */
85
- protected function filter_wpel_after_filter_10000000000( $content )
86
  {
87
- return $this->restore_content_placeholders( $content );
88
  }
89
 
90
- // protected function action_wp()
91
- // {
92
- // global $post;
93
- //// debug( gettype( $post->ID ) );
94
- //// add_filter( 'wpel_apply_settings', '__return_false' );
95
- // add_filter( 'wpel_apply_settings', function () use ( $post ) {
96
- // $excluded_posts = array( 1, 2, 4 );
97
- //
98
- // if ( in_array( $post->ID, $excluded_posts ) ) {
99
- // return false;
100
- // }
101
- //
102
- // return true;
103
- // } );
104
- // }
105
-
106
- // protected function action_wpel_link( $link_object )
107
- // {
108
- // if ( $link_object->isExternal() ) {
109
- // $url = $link_object->getAttribute( 'href' );
110
- // $redirect_url = '//somedom.com?url='. urlencode( $url );
111
- // $link_object->setAttribute( 'href', $redirect_url );
112
- // }
113
- // }
114
-
115
  /**
116
  * Pregmatch callback
117
  * @param array $matches
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
45
  }
46
 
47
  /**
48
+ * Action for "wpel_before_apply_link"
49
+ * @param WPEL_Link $link
50
+ */
51
+ protected function filter_wpel_before_apply_link_10000000000( WPEL_Link $link )
52
+ {
53
+ // ignore mailto links
54
+ if ( $this->opt( 'ignore_mailto_links' ) && $link->is_mailto() ) {
55
+ $link->set_ignore();
56
+ }
57
+
58
+ // ignore WP Admin Bar Links
59
+ if ( $link->has_attr_value( 'class', 'ab-item' ) ) {
60
+ $link->set_ignore();
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Filter for "_wpel_before_filter"
66
  * @param string $content
67
  * @return string
68
  */
69
+ protected function filter__wpel_before_filter_10000000000( $content )
70
  {
71
+ $ignore_tags = array( 'head' );
 
 
 
 
72
 
73
  if ( $this->opt( 'ignore_script_tags' ) ) {
74
+ $ignore_tags[] = 'script';
75
+ }
76
+
77
+ foreach ( $ignore_tags as $tag_name ) {
78
  $content = preg_replace_callback(
79
+ $this->get_tag_regexp( $tag_name )
80
  , $this->get_callback( 'skip_tag' )
81
  , $content
82
  );
86
  }
87
 
88
  /**
89
+ * Filter for "_wpel_after_filter"
90
+ * @param string $content
91
+ * @return string
92
  */
93
+ protected function filter__wpel_after_filter_10000000000( $content )
94
  {
95
+ return $this->restore_content_placeholders( $content );
96
  }
97
 
98
  /**
99
+ * @param type $tag_name
100
+ * @return type
 
101
  */
102
+ protected function get_tag_regexp( $tag_name )
103
  {
104
+ return '/<'. $tag_name .'[\s.*>|>](.*?)<\/'. $tag_name .'[\s+]*>/is';
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * Pregmatch callback
109
  * @param array $matches
includes/class-wpel-front.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -111,26 +111,20 @@ final class WPEL_Front extends WPRun_Base_1x0x0
111
  }
112
 
113
  /**
114
- * Filters before scanning content
115
  * @param string $content
116
  */
117
- $content = apply_filters( 'wpel_before_filter', $content );
118
 
119
  $regexp_link = '/<a[^A-Za-z](.*?)>(.*?)<\/a[\s+]*>/is';
120
 
121
- /**
122
- * Filters for changing regular expression for getting html links
123
- * @param string $regexp_link
124
- */
125
- $regexp_link = apply_filters( 'wpel_regexp_link', $regexp_link );
126
-
127
  $content = preg_replace_callback( $regexp_link, $this->get_callback( 'match_link' ), $content );
128
 
129
  /**
130
- * Filters after scanning content
131
  * @param string $content
132
  */
133
- $content = apply_filters( 'wpel_after_filter', $content );
134
 
135
  return $content;
136
  }
@@ -143,7 +137,7 @@ final class WPEL_Front extends WPRun_Base_1x0x0
143
  protected function match_link( $matches )
144
  {
145
  $original_link = $matches[ 0 ];
146
- $atts = $this->parse_atts( $matches[ 1 ] ) ?: array();
147
  $label = $matches[ 2 ];
148
 
149
  $created_link = $this->get_created_link( $label, $atts );
@@ -155,109 +149,42 @@ final class WPEL_Front extends WPRun_Base_1x0x0
155
  return $created_link;
156
  }
157
 
158
- /**
159
- * Parse an attributes string into an array. If the string starts with a tag,
160
- * then the attributes on the first tag are parsed. This parses via a manual
161
- * loop and is designed to be safer than using DOMDocument.
162
- *
163
- * @param string $atts
164
- * @return array
165
- *
166
- * @example parse_attrs( 'src="example.jpg" alt="example"' )
167
- * @example parse_attrs( '<img src="example.jpg" alt="example">' )
168
- * @example parse_attrs( '<a href="example"></a>' )
169
- *
170
- * @link http://dev.airve.com/demo/speed_tests/php/parse_attrs.php
171
- */
172
- protected function parse_atts( $atts ) {
173
- $atts = str_split( trim( $atts ) );
174
-
175
- if ( '<' === $atts[0] ) { // looks like a tag so strip the tagname
176
- while ( $atts && ! ctype_space( $atts[0] ) && $atts[0] !== '>' ) {
177
- array_shift($atts);
178
- }
179
- }
180
-
181
- $arr = array(); // output
182
- $name = ''; // for the current attr being parsed
183
- $value = ''; // for the current attr being parsed
184
- $mode = 0; // whether current char is part of the name (-), the value (+), or neither (0)
185
- $stop = false; // delimiter for the current $value being parsed
186
- $space = ' '; // a single space
187
-
188
- foreach ( $atts as $j => $curr ) {
189
- if ( $mode < 0 ) { // name
190
- if ( '=' === $curr ) {
191
- $mode = 1;
192
- $stop = false;
193
- } elseif ( '>' === $curr ) {
194
- '' === $name or $arr[ $name ] = $value;
195
- break;
196
- } elseif ( ! ctype_space( $curr ) ) {
197
- if ( ctype_space( $atts[ $j - 1 ] ) ) { // previous char
198
- '' === $name or $arr[ $name ] = ''; // previous name
199
- $name = $curr; // initiate new
200
- } else {
201
- $name .= $curr;
202
- }
203
- }
204
- } elseif ( $mode > 0 ) { // value
205
- if ( $stop === false ) {
206
- if ( ! ctype_space( $curr ) ) {
207
- if ( '"' === $curr || "'" === $curr ) {
208
- $value = '';
209
- $stop = $curr;
210
- } else {
211
- $value = $curr;
212
- $stop = $space;
213
- }
214
- }
215
- } elseif ( $stop === $space ? ctype_space( $curr ) : $curr === $stop ) {
216
- $arr[ $name ] = $value;
217
- $mode = 0;
218
- $name = $value = '';
219
- } else {
220
- $value .= $curr;
221
- }
222
- } else { // neither
223
- if ( '>' === $curr )
224
- break;
225
- if ( ! ctype_space( $curr ) ) {
226
- // initiate
227
- $name = $curr;
228
- $mode = -1;
229
- }
230
- }
231
- }
232
-
233
- // incl the final pair if it was quoteless
234
- '' === $name or $arr[ $name ] = $value;
235
-
236
- return $arr;
237
- }
238
-
239
  /**
240
  * Create html link
241
  * @param string $label
242
- * @param array $atts
243
  * @return string
244
  */
245
- protected function get_created_link( $label, array $atts )
246
  {
247
- $link = WPEL_Link::create( 'a', $label, $atts );
 
 
 
 
 
 
 
 
 
 
 
248
 
249
- if ( $link->isIgnore() ) {
250
- return false;
251
- }
 
 
 
252
 
253
- // ignore mailto links
254
- if ( $this->is_mailto( $link->getAttribute( 'href' ) ) ) {
255
  return false;
256
  }
257
 
258
  $this->set_link( $link );
259
 
260
- return $link->getHTML();
261
  }
262
 
263
  /**
@@ -266,23 +193,24 @@ final class WPEL_Front extends WPRun_Base_1x0x0
266
  */
267
  protected function set_link( WPEL_Link $link )
268
  {
269
- $url = $link->getAttribute( 'href' );
270
 
271
  $excludes_as_internal_links = $this->opt( 'excludes_as_internal_links' );
272
 
273
  // internal, external or excluded
274
- $is_excluded = $link->isExclude() || $this->is_excluded_url( $url );
275
- $is_internal = $link->isInternal() || ( $this->is_internal_url( $url ) && ! $this->is_included_url( $url ) ) || ( $is_excluded && $excludes_as_internal_links );
276
- $is_external = $link->isExternal() || ( ! $is_internal && ! $is_excluded );
277
 
278
  if ( $is_external ) {
279
- $link->setExternal();
280
  $this->apply_link_settings( $link, 'external-links' );
281
  } else if ( $is_internal ) {
282
- $link->setInternal();
283
  $this->apply_link_settings( $link, 'internal-links' );
284
- } else {
285
- $link->setExclude();
 
286
  }
287
 
288
  /**
@@ -306,51 +234,51 @@ final class WPEL_Front extends WPRun_Base_1x0x0
306
  // set target
307
  $target = $this->opt( 'target', $type );
308
  $target_overwrite = $this->opt( 'target_overwrite', $type );
309
- $has_target = $link->hasAttribute( 'target' );
310
 
311
  if ( $target && ( ! $has_target || $target_overwrite ) ) {
312
- $link->setAttribute( 'target', $target );
313
  }
314
 
315
  // add "follow" / "nofollow"
316
  $follow = $this->opt( 'rel_follow', $type );
317
  $follow_overwrite = $this->opt( 'rel_follow_overwrite', $type );
318
- $has_follow = $link->hasAttributeValue( 'rel', 'follow' ) || $link->hasAttributeValue( 'rel', 'nofollow' );
319
 
320
  if ( $follow && ( ! $has_follow || $follow_overwrite ) ) {
321
  if ( $has_follow ) {
322
- $link->removeFromAttribute( 'rel', 'follow' );
323
- $link->removeFromAttribute( 'rel', 'nofollow' );
324
  }
325
 
326
- $link->addToAttribute( 'rel', $follow );
327
  }
328
 
329
  // add "external"
330
- if ( $this->opt( 'rel_external', $type ) ) {
331
- $link->addToAttribute( 'rel', 'external' );
332
  }
333
 
334
  // add "noopener"
335
  if ( $this->opt( 'rel_noopener', $type ) ) {
336
- $link->addToAttribute( 'rel', 'noopener' );
337
  }
338
 
339
  // add "noreferrer"
340
  if ( $this->opt( 'rel_noreferrer', $type ) ) {
341
- $link->addToAttribute( 'rel', 'noreferrer' );
342
  }
343
 
344
  // set title
345
  $title_format = $this->opt( 'title', $type );
346
 
347
  if ( $title_format ) {
348
- $title = $link->getAttribute( 'title' );
349
- $text = esc_attr( $link->getContent() );
350
- $new_title = str_replace( array( '{title}', '{text}' ), array( $title, $text ), $title_format );
351
 
352
  if ( $new_title ) {
353
- $link->setAttribute( 'title', $new_title );
354
  }
355
  }
356
 
@@ -358,40 +286,32 @@ final class WPEL_Front extends WPRun_Base_1x0x0
358
  $class = $this->opt( 'class', $type );
359
 
360
  if ( $class ) {
361
- $link->addToAttribute( 'class', $class );
362
  }
363
 
364
  // add icon
365
  $icon_type = $this->opt( 'icon_type', $type );
366
  $no_icon_for_img = $this->opt( 'no_icon_for_img', $type );
367
- $has_img = preg_match( '/<img([^>]*)>/is', $link->getContent() );
368
 
369
- if ( $icon_type && ! ( $has_img && $no_icon_for_img ) ) {
370
  if ( 'dashicon' === $icon_type ) {
371
  $dashicon = $this->opt( 'icon_dashicon', $type );
372
- $icon = FWP_DOM_Element_1x0x0::create( 'i', '', array(
373
- 'class' => 'wpel-icon dashicons-before '. $dashicon,
374
- 'aria-hidden' => 'true',
375
- ) );
376
  } else if ( 'fontawesome' === $icon_type ) {
377
  $fa = $this->opt( 'icon_fontawesome', $type );
378
- $icon = FWP_DOM_Element_1x0x0::create( 'i', '', array(
379
- 'class' => 'wpel-icon fa '. $fa,
380
- 'aria-hidden' => 'true',
381
- ) );
382
  } else if ( 'image' === $icon_type ) {
383
  $image = $this->opt( 'icon_image', $type );
384
- $icon = FWP_DOM_Element_1x0x0::create( 'span', null, array(
385
- 'class' => 'wpel-icon wpel-image wpel-icon-'. $image,
386
- ) );
387
  }
388
 
389
  if ( 'left' === $this->opt( 'icon_position', $type ) ) {
390
- $link->addToAttribute( 'class', 'wpel-icon-left' );
391
- $link->prependChild( $icon );
392
  } else if ( 'right' === $this->opt( 'icon_position', $type ) ) {
393
- $link->addToAttribute( 'class', 'wpel-icon-right' );
394
- $link->appendChild( $icon );
395
  }
396
  }
397
  }
@@ -413,8 +333,12 @@ final class WPEL_Front extends WPRun_Base_1x0x0
413
  if ( '' === trim( $include_urls ) ) {
414
  $include_urls_arr = array();
415
  } else {
416
- $include_urls_arr = array_map( 'trim', explode( ',', $include_urls ) );
417
  }
 
 
 
 
418
  }
419
 
420
  foreach ( $include_urls_arr as $include_url ) {
@@ -443,8 +367,12 @@ final class WPEL_Front extends WPRun_Base_1x0x0
443
  if ( '' === trim( $exclude_urls ) ) {
444
  $exclude_urls_arr = array();
445
  } else {
446
- $exclude_urls_arr = array_map( 'trim', explode( ',', $exclude_urls ) );
447
  }
 
 
 
 
448
  }
449
 
450
  foreach ( $exclude_urls_arr as $exclude_url ) {
@@ -484,20 +412,6 @@ final class WPEL_Front extends WPRun_Base_1x0x0
484
  return false;
485
  }
486
 
487
- /**
488
- * Check url is mailto link
489
- * @param string $url
490
- * @return boolean
491
- */
492
- protected function is_mailto( $url )
493
- {
494
- if ( substr( trim( $url ), 0, 7 ) === 'mailto:' ) {
495
- return true;
496
- }
497
-
498
- return false;
499
- }
500
-
501
  /**
502
  * Get domain name
503
  * @return string
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
111
  }
112
 
113
  /**
114
+ * Filters before scanning content (for internal use)
115
  * @param string $content
116
  */
117
+ $content = apply_filters( '_wpel_before_filter', $content );
118
 
119
  $regexp_link = '/<a[^A-Za-z](.*?)>(.*?)<\/a[\s+]*>/is';
120
 
 
 
 
 
 
 
121
  $content = preg_replace_callback( $regexp_link, $this->get_callback( 'match_link' ), $content );
122
 
123
  /**
124
+ * Filters after scanning content (for internal use)
125
  * @param string $content
126
  */
127
+ $content = apply_filters( '_wpel_after_filter', $content );
128
 
129
  return $content;
130
  }
137
  protected function match_link( $matches )
138
  {
139
  $original_link = $matches[ 0 ];
140
+ $atts = $matches[ 1 ];
141
  $label = $matches[ 2 ];
142
 
143
  $created_link = $this->get_created_link( $label, $atts );
149
  return $created_link;
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  /**
153
  * Create html link
154
  * @param string $label
155
+ * @param string $atts
156
  * @return string
157
  */
158
+ protected function get_created_link( $label, $atts )
159
  {
160
+ $link = new WPEL_Link( 'a', $label );
161
+ $link->set_atts( $atts );
162
+
163
+ // /**
164
+ // * Filter whether settings will be applied on this links
165
+ // * @param WPEL_Link $link
166
+ // */
167
+ // $apply_link = apply_filters( 'wpel_apply_link', $link );
168
+ //
169
+ // if ( false === $apply_link ) {
170
+ // return false;
171
+ // }
172
 
173
+ /**
174
+ * Action triggered before link settings will be applied
175
+ * @param WPEL_Link $link
176
+ * @return void
177
+ */
178
+ do_action( 'wpel_before_apply_link', $link );
179
 
180
+ // has ignore flag
181
+ if ( $link->is_ignore() ) {
182
  return false;
183
  }
184
 
185
  $this->set_link( $link );
186
 
187
+ return $link->get_html( false );
188
  }
189
 
190
  /**
193
  */
194
  protected function set_link( WPEL_Link $link )
195
  {
196
+ $url = $link->get_attr( 'href' );
197
 
198
  $excludes_as_internal_links = $this->opt( 'excludes_as_internal_links' );
199
 
200
  // internal, external or excluded
201
+ $is_excluded = $link->is_exclude() || $this->is_excluded_url( $url );
202
+ $is_internal = $link->is_internal() || ( $this->is_internal_url( $url ) && ! $this->is_included_url( $url ) ) || ( $is_excluded && $excludes_as_internal_links );
203
+ $is_external = $link->is_external() || ( ! $is_internal && ! $is_excluded );
204
 
205
  if ( $is_external ) {
206
+ $link->set_external();
207
  $this->apply_link_settings( $link, 'external-links' );
208
  } else if ( $is_internal ) {
209
+ $link->set_internal();
210
  $this->apply_link_settings( $link, 'internal-links' );
211
+ } else if ( $is_excluded ) {
212
+ $link->set_exclude();
213
+ $this->apply_link_settings( $link, 'excluded-links' );
214
  }
215
 
216
  /**
234
  // set target
235
  $target = $this->opt( 'target', $type );
236
  $target_overwrite = $this->opt( 'target_overwrite', $type );
237
+ $has_target = $link->has_attr( 'target' );
238
 
239
  if ( $target && ( ! $has_target || $target_overwrite ) ) {
240
+ $link->set_attr( 'target', $target );
241
  }
242
 
243
  // add "follow" / "nofollow"
244
  $follow = $this->opt( 'rel_follow', $type );
245
  $follow_overwrite = $this->opt( 'rel_follow_overwrite', $type );
246
+ $has_follow = $link->has_attr_value( 'rel', 'follow' ) || $link->has_attr_value( 'rel', 'nofollow' );
247
 
248
  if ( $follow && ( ! $has_follow || $follow_overwrite ) ) {
249
  if ( $has_follow ) {
250
+ $link->remove_from_attr( 'rel', 'follow' );
251
+ $link->remove_from_attr( 'rel', 'nofollow' );
252
  }
253
 
254
+ $link->add_to_attr( 'rel', $follow );
255
  }
256
 
257
  // add "external"
258
+ if ( 'external-links' === $type && $this->opt( 'rel_external', $type ) ) {
259
+ $link->add_to_attr( 'rel', 'external' );
260
  }
261
 
262
  // add "noopener"
263
  if ( $this->opt( 'rel_noopener', $type ) ) {
264
+ $link->add_to_attr( 'rel', 'noopener' );
265
  }
266
 
267
  // add "noreferrer"
268
  if ( $this->opt( 'rel_noreferrer', $type ) ) {
269
+ $link->add_to_attr( 'rel', 'noreferrer' );
270
  }
271
 
272
  // set title
273
  $title_format = $this->opt( 'title', $type );
274
 
275
  if ( $title_format ) {
276
+ $title = $link->get_attr( 'title' );
277
+ $text = $link->get_content();
278
+ $new_title = str_replace( array( '{title}', '{text}' ), array( esc_attr( $title ), esc_attr( $text ) ), $title_format );
279
 
280
  if ( $new_title ) {
281
+ $link->set_attr( 'title', $new_title );
282
  }
283
  }
284
 
286
  $class = $this->opt( 'class', $type );
287
 
288
  if ( $class ) {
289
+ $link->add_to_attr( 'class', $class );
290
  }
291
 
292
  // add icon
293
  $icon_type = $this->opt( 'icon_type', $type );
294
  $no_icon_for_img = $this->opt( 'no_icon_for_img', $type );
295
+ $has_img = preg_match( '/<img([^>]*)>/is', $link->get_content() );
296
 
297
+ if ( $icon_type && ! ( $has_img && $no_icon_for_img ) && ! $link->has_attr_value( 'class', 'wpel-no-icon' ) ) {
298
  if ( 'dashicon' === $icon_type ) {
299
  $dashicon = $this->opt( 'icon_dashicon', $type );
300
+ $icon = '<i class="wpel-icon dashicons-before '. $dashicon .'" aria-hidden="true"></i>';
 
 
 
301
  } else if ( 'fontawesome' === $icon_type ) {
302
  $fa = $this->opt( 'icon_fontawesome', $type );
303
+ $icon = '<i class="wpel-icon fa '. $fa .'" aria-hidden="true"></i>';
 
 
 
304
  } else if ( 'image' === $icon_type ) {
305
  $image = $this->opt( 'icon_image', $type );
306
+ $icon = '<span class="wpel-icon wpel-image wpel-icon-'. $image .'"></span>';
 
 
307
  }
308
 
309
  if ( 'left' === $this->opt( 'icon_position', $type ) ) {
310
+ $link->add_to_attr( 'class', 'wpel-icon-left' );
311
+ $link->set_content( $icon . $link->get_content() );
312
  } else if ( 'right' === $this->opt( 'icon_position', $type ) ) {
313
+ $link->add_to_attr( 'class', 'wpel-icon-right' );
314
+ $link->set_content( $link->get_content() . $icon );
315
  }
316
  }
317
  }
333
  if ( '' === trim( $include_urls ) ) {
334
  $include_urls_arr = array();
335
  } else {
336
+ $include_urls_arr = explode( ',', $include_urls );
337
  }
338
+
339
+ $include_urls_arr = array_filter( $include_urls_arr, function ( $url ) {
340
+ return '' !== trim( $url );
341
+ } );
342
  }
343
 
344
  foreach ( $include_urls_arr as $include_url ) {
367
  if ( '' === trim( $exclude_urls ) ) {
368
  $exclude_urls_arr = array();
369
  } else {
370
+ $exclude_urls_arr = explode( ',', $exclude_urls );
371
  }
372
+
373
+ $exclude_urls_arr = array_filter( $exclude_urls_arr, function ( $url ) {
374
+ return '' !== trim( $url );
375
+ } );
376
  }
377
 
378
  foreach ( $exclude_urls_arr as $exclude_url ) {
412
  return false;
413
  }
414
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  /**
416
  * Get domain name
417
  * @return string
includes/class-wpel-link.php CHANGED
@@ -7,73 +7,96 @@
7
  *
8
  * @package WPEL
9
  * @category WordPress Plugin
10
- * @version 2.0.4
11
  * @author Victor Villaverde Laan
12
  * @link http://www.finewebdev.com
13
  * @link https://github.com/freelancephp/WP-External-Links
14
  * @license Dual licensed under the MIT and GPLv2+ licenses
15
  */
16
- class WPEL_Link extends FWP_DOM_Element_1x0x0
17
  {
18
 
19
  /**
20
  * Mark as external link (by setting data attribute)
21
  */
22
- public function setExternal()
23
  {
24
- $this->setAttribute( 'data-wpel-link', 'external' );
25
  }
26
 
27
  /**
28
  * Is marked as external link
29
  * @return boolean
30
  */
31
- public function isExternal()
32
  {
33
- return 'external' === $this->getAttribute( 'data-wpel-link' );
34
  }
35
 
36
  /**
37
  * Mark as internal link (by setting data attribute)
38
  */
39
- public function setInternal()
40
  {
41
- $this->setAttribute( 'data-wpel-link', 'internal' );
42
  }
43
 
44
  /**
45
  * Is marked as internal link
46
  * @return boolean
47
  */
48
- public function isInternal()
49
  {
50
- return 'internal' === $this->getAttribute( 'data-wpel-link' );
51
  }
52
 
53
  /**
54
  * Mark as excluded link (by setting data attribute)
55
  */
56
- public function setExclude()
57
  {
58
- $this->setAttribute( 'data-wpel-link', 'exclude' );
59
  }
60
 
61
  /**
62
  * Is marked as excluded link
63
  * @return boolean
64
  */
65
- public function isExclude()
66
  {
67
- return 'exclude' === $this->getAttribute( 'data-wpel-link' );
 
 
 
 
 
 
 
 
68
  }
69
 
70
  /**
71
  * Is marked as ignored link
72
  * @return boolean
73
  */
74
- public function isIgnore()
75
  {
76
- return 'ignore' === $this->getAttribute( 'data-wpel-link' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  }
7
  *
8
  * @package WPEL
9
  * @category WordPress Plugin
10
+ * @version 2.1.0
11
  * @author Victor Villaverde Laan
12
  * @link http://www.finewebdev.com
13
  * @link https://github.com/freelancephp/WP-External-Links
14
  * @license Dual licensed under the MIT and GPLv2+ licenses
15
  */
16
+ class WPEL_Link extends FWP_HTML_Element_1x0x0
17
  {
18
 
19
  /**
20
  * Mark as external link (by setting data attribute)
21
  */
22
+ public function set_external()
23
  {
24
+ $this->set_attr( 'data-wpel-link', 'external' );
25
  }
26
 
27
  /**
28
  * Is marked as external link
29
  * @return boolean
30
  */
31
+ public function is_external()
32
  {
33
+ return 'external' === $this->get_attr( 'data-wpel-link' );
34
  }
35
 
36
  /**
37
  * Mark as internal link (by setting data attribute)
38
  */
39
+ public function set_internal()
40
  {
41
+ $this->set_attr( 'data-wpel-link', 'internal' );
42
  }
43
 
44
  /**
45
  * Is marked as internal link
46
  * @return boolean
47
  */
48
+ public function is_internal()
49
  {
50
+ return 'internal' === $this->get_attr( 'data-wpel-link' );
51
  }
52
 
53
  /**
54
  * Mark as excluded link (by setting data attribute)
55
  */
56
+ public function set_exclude()
57
  {
58
+ $this->set_attr( 'data-wpel-link', 'exclude' );
59
  }
60
 
61
  /**
62
  * Is marked as excluded link
63
  * @return boolean
64
  */
65
+ public function is_exclude()
66
  {
67
+ return 'exclude' === $this->get_attr( 'data-wpel-link' );
68
+ }
69
+
70
+ /**
71
+ * Mark as ignored link (by setting data attribute)
72
+ */
73
+ public function set_ignore()
74
+ {
75
+ $this->set_attr( 'data-wpel-link', 'ignore' );
76
  }
77
 
78
  /**
79
  * Is marked as ignored link
80
  * @return boolean
81
  */
82
+ public function is_ignore()
83
  {
84
+ return 'ignore' === $this->get_attr( 'data-wpel-link' );
85
+ }
86
+
87
+ /**
88
+ * Check url is mailto link
89
+ * @return boolean
90
+ */
91
+ public function is_mailto()
92
+ {
93
+ $url = trim( $this->get_attr( 'href' ) );
94
+
95
+ if ( substr( $url, 0, 7 ) === 'mailto:' ) {
96
+ return true;
97
+ }
98
+
99
+ return false;
100
  }
101
 
102
  }
includes/class-wpel-plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -34,7 +34,6 @@ final class WPEL_Plugin extends WPRun_Base_1x0x0
34
  self::$plugin_dir = untrailingslashit( $plugin_dir );
35
 
36
  WPEL_Registerhooks::create();
37
- WPEL_Textdomain::create();
38
 
39
  // network admin page
40
  $network_page = WPEL_Network_Page::create( array(
@@ -46,6 +45,7 @@ final class WPEL_Plugin extends WPRun_Base_1x0x0
46
  $settings_page = WPEL_Settings_Page::create( $network_page, array(
47
  'external-links' => WPEL_External_Link_Fields::create(),
48
  'internal-links' => WPEL_Internal_Link_Fields::create(),
 
49
  'admin' => WPEL_Admin_Fields::create(),
50
  'exceptions' => WPEL_Exceptions_Fields::create(),
51
  ) );
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
34
  self::$plugin_dir = untrailingslashit( $plugin_dir );
35
 
36
  WPEL_Registerhooks::create();
 
37
 
38
  // network admin page
39
  $network_page = WPEL_Network_Page::create( array(
45
  $settings_page = WPEL_Settings_Page::create( $network_page, array(
46
  'external-links' => WPEL_External_Link_Fields::create(),
47
  'internal-links' => WPEL_Internal_Link_Fields::create(),
48
+ 'excluded-links' => WPEL_Excluded_Link_Fields::create(),
49
  'admin' => WPEL_Admin_Fields::create(),
50
  'exceptions' => WPEL_Exceptions_Fields::create(),
51
  ) );
includes/class-wpel-registerhooks.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -91,6 +91,7 @@ final class WPEL_Registerhooks extends WPRun_Base_1x0x0
91
  // get default values
92
  $external_link_values = WPEL_External_Link_Fields::get_instance()->get_default_values();
93
  $internal_link_values = WPEL_Internal_Link_Fields::get_instance()->get_default_values();
 
94
  $exceptions_link_values = WPEL_Exceptions_Fields::get_instance()->get_default_values();
95
  $admin_link_values = WPEL_Admin_Fields::get_instance()->get_default_values();
96
 
@@ -160,6 +161,7 @@ final class WPEL_Registerhooks extends WPRun_Base_1x0x0
160
  // update new values
161
  update_option( 'wpel-external-link-settings', $external_link_values );
162
  update_option( 'wpel-internal-link-settings', $internal_link_values );
 
163
  update_option( 'wpel-exceptions-settings', $exceptions_link_values );
164
  update_option( 'wpel-admin-settings', $admin_link_values );
165
 
@@ -205,6 +207,7 @@ final class WPEL_Registerhooks extends WPRun_Base_1x0x0
205
  // delete options
206
  delete_option( 'wpel-external-link-settings' );
207
  delete_option( 'wpel-internal-link-settings' );
 
208
  delete_option( 'wpel-exceptions-settings' );
209
  delete_option( 'wpel-admin-settings' );
210
 
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
91
  // get default values
92
  $external_link_values = WPEL_External_Link_Fields::get_instance()->get_default_values();
93
  $internal_link_values = WPEL_Internal_Link_Fields::get_instance()->get_default_values();
94
+ $excluded_link_values = WPEL_Excluded_Link_Fields::get_instance()->get_default_values();
95
  $exceptions_link_values = WPEL_Exceptions_Fields::get_instance()->get_default_values();
96
  $admin_link_values = WPEL_Admin_Fields::get_instance()->get_default_values();
97
 
161
  // update new values
162
  update_option( 'wpel-external-link-settings', $external_link_values );
163
  update_option( 'wpel-internal-link-settings', $internal_link_values );
164
+ update_option( 'wpel-excluded-link-settings', $excluded_link_values );
165
  update_option( 'wpel-exceptions-settings', $exceptions_link_values );
166
  update_option( 'wpel-admin-settings', $admin_link_values );
167
 
207
  // delete options
208
  delete_option( 'wpel-external-link-settings' );
209
  delete_option( 'wpel-internal-link-settings' );
210
+ delete_option( 'wpel-excluded-link-settings' );
211
  delete_option( 'wpel-exceptions-settings' );
212
  delete_option( 'wpel-admin-settings' );
213
 
includes/class-wpel-template-tags.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
includes/class-wpel-textdomain.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
- /**
3
- * Class WPEL_Textdomain
4
- *
5
- * @package WPEL
6
- * @category WordPress Plugin
7
- * @version 2.0.4
8
- * @author Victor Villaverde Laan
9
- * @link http://www.finewebdev.com
10
- * @link https://github.com/freelancephp/WP-External-Links
11
- * @license Dual licensed under the MIT and GPLv2+ licenses
12
- */
13
- class WPEL_Textdomain extends WPRun_Base_1x0x0
14
- {
15
-
16
- /**
17
- * Action for "plugins_loaded"
18
- */
19
- protected function action_plugins_loaded()
20
- {
21
- load_plugin_textdomain( 'wpel', false, WPEL_Plugin::get_plugin_dir( '/languages/' ) );
22
- }
23
-
24
- }
25
-
26
- /*?>*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/fwp/class-fwp-dom-element.php DELETED
@@ -1,250 +0,0 @@
1
- <?php
2
- /**
3
- * Class FWP_DOM_Element_1x0x0
4
- *
5
- * @package FWP
6
- * @category WordPress Library
7
- * @version 1.0.0
8
- * @author Victor Villaverde Laan
9
- * @link http://www.finewebdev.com
10
- * @link https://github.com/freelancephp/WPRun-WordPress-Development
11
- * @license Dual licensed under the MIT and GPLv2+ licenses
12
- */
13
- class FWP_DOM_Element_1x0x0 extends DOMElement
14
- {
15
-
16
- /**
17
- * @var DOMDocument
18
- */
19
- private static $doc = null;
20
-
21
- /**
22
- * Factory method
23
- * @param string $tagName
24
- * @param string $content
25
- * @param array $attributes
26
- * @return FWP_DOM_Element_1x0x0
27
- */
28
- public static function create( $tagName, $content = null, array $attributes = array() )
29
- {
30
- if ( null === self::$doc ) {
31
- self::$doc = self::createDocument();
32
- }
33
-
34
- $element = self::$doc->createElement( $tagName );
35
- $element->setContent( $content );
36
- $element->setAttributes( $attributes );
37
-
38
- return $element;
39
- }
40
-
41
- /**
42
- * Factory method
43
- * @param string $tagName
44
- * @param string $label
45
- * @return WPEL_Link
46
- */
47
- public static function createDocument()
48
- {
49
- $doc = new DOMDocument();
50
- $doc->registerNodeClass( 'DOMElement', get_called_class() );
51
- return $doc;
52
- }
53
-
54
- /**
55
- * Set element content
56
- * @param string $content
57
- */
58
- public function setContent( $content )
59
- {
60
- $clean_content = str_replace( '&', '&amp;', $content );
61
- $this->nodeValue = $clean_content;
62
- }
63
-
64
- /**
65
- * Get element content
66
- * @return string
67
- */
68
- public function getContent()
69
- {
70
- return $this->nodeValue;
71
- }
72
-
73
- /**
74
- * Get all attributes
75
- * @return array
76
- */
77
- public function getAttributes()
78
- {
79
- $attributes = array();
80
-
81
- foreach ( $this->attributes as $name => $node ) {
82
- $attributes[ $name ] = $node->nodeValue;
83
- }
84
-
85
- return $attributes;
86
- }
87
-
88
- /**
89
- * Set multiple attributes
90
- * @param array $attributes
91
- */
92
- public function setAttributes( array $attributes )
93
- {
94
- foreach ( $attributes as $name => $value ) {
95
- $this->setAttribute( $name, $value );
96
- }
97
- }
98
-
99
- /**
100
- * Has given attribute value
101
- * Used for attributes with multiple values like "class"
102
- * @param string $name
103
- * @param string $value
104
- * @return boolean
105
- */
106
- public function hasAttributeValue( $name, $value )
107
- {
108
- if ( ! $this->hasAttribute( $name ) ) {
109
- return false;
110
- }
111
-
112
- $attrValue = $this->getAttribute( $name );
113
- $attrValues = explode( ' ', $attrValue );
114
- return in_array( $value, $attrValues );
115
- }
116
-
117
- /**
118
- * Add value to attribute
119
- * Used for attributes with multiple values like "class"
120
- * @param string $name
121
- * @param string $value
122
- * @return boolean
123
- */
124
- public function addToAttribute( $name, $value )
125
- {
126
- $attrValue = $this->getAttribute( $name );
127
-
128
- if ( empty( $attrValue ) ) {
129
- $this->setAttribute( $name, $value );
130
- return;
131
- }
132
-
133
- if ( $this->hasAttributeValue( $name, $value ) ) {
134
- return;
135
- }
136
-
137
- $this->setAttribute( $name, $attrValue .' '. $value );
138
- }
139
-
140
- /**
141
- * Remove value from attribute
142
- * Used for attributes with multiple values like "class"
143
- * @param string $name
144
- * @param string $value
145
- * @return boolean
146
- */
147
- public function removeFromAttribute( $name, $value )
148
- {
149
- if ( ! $this->hasAttributeValue( $name, $value ) ) {
150
- return;
151
- }
152
-
153
- $attrValue = $this->getAttribute( $name );
154
- $attrValues = explode( ' ', $attrValue );
155
-
156
- $newAttrValues = array_diff( $attrValues , array( $value ) );
157
-
158
- $newAttrValue = implode( ' ', $newAttrValues );
159
- $this->setAttribute( $name, $newAttrValue );
160
- }
161
-
162
- /**
163
- * Remove all childs
164
- */
165
- public function removeAllChilds()
166
- {
167
- foreach ( $this->childNodes as $childNode ) {
168
- $this->removeChild( $childNode );
169
- }
170
- }
171
-
172
- /**
173
- * Prepend child element
174
- * @param FWP_DOM_Element_1x0x0 $element
175
- */
176
- public function prependChild( $element )
177
- {
178
- if ( count( $this->childNodes ) > 0 ) {
179
- $this->insertBefore( $element, $this->childNodes->item( 0 ) );
180
- } else {
181
- $this->appendChild( $element );
182
- }
183
- }
184
-
185
- /**
186
- * Append HTML content
187
- * @param string $html
188
- */
189
- public function appendHTML( $html )
190
- {
191
- $tmpDoc = self::createDocument();
192
- $tmpDoc->loadHTML( $html );
193
-
194
- foreach ( $tmpDoc->getElementsByTagName( 'body' )->item( 0 )->childNodes as $node ) {
195
- $node = $this->ownerDocument->importNode( $node );
196
- $this->appendChild( $node );
197
- }
198
-
199
- // method 2:
200
- //$fragment = self::$doc->createDocumentFragment();
201
- //$fragment->appendXML( $html );
202
- //$this->appendChild( $fragment );
203
- }
204
-
205
- /**
206
- * Return valid HTML5
207
- * Instead of:
208
- * <code>
209
- * self::$doc->saveXML( $this );
210
- * </code>
211
- *
212
- * @return string
213
- */
214
- public function getHTML()
215
- {
216
- $attributes = $this->getAttributes();
217
-
218
- $link = '<'. $this->tagName;
219
-
220
- foreach ( $attributes AS $name => $value ) {
221
- if ( null === $value ) {
222
- $link .= ' '. $name;
223
- } else {
224
- $link .= ' '. $name .'="'. esc_attr( $value ) .'"';
225
- }
226
- }
227
-
228
- if ( null === $this->nodeValue ) {
229
- $link .= '>';
230
- } else {
231
- $link .= '>';
232
-
233
- foreach ( $this->childNodes as $childNode ) {
234
- if ( $childNode instanceof DOMText ) {
235
- $link .= $childNode->wholeText;
236
- } elseif ( $childNode instanceof FWP_DOM_Element_1x0x0 ) {
237
- $link .= $childNode->getHTML();
238
- }
239
- }
240
-
241
- $link .= '</'. $this->tagName .'>';
242
- }
243
-
244
- return $link;
245
- }
246
-
247
- }
248
-
249
-
250
- /*?>*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libs/fwp/class-fwp-html-element.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class FWP_HTML_Element_1x0x0
4
+ *
5
+ * @package FWP
6
+ * @category WordPress Library
7
+ * @version 1.0.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WPRun-WordPress-Development
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ */
13
+ class FWP_HTML_Element_1x0x0
14
+ {
15
+
16
+ /**
17
+ * @var string
18
+ */
19
+ private $tag_name = null;
20
+
21
+ /**
22
+ * @var string
23
+ */
24
+ private $content = null;
25
+
26
+ /**
27
+ * @var array
28
+ */
29
+ private $atts = array();
30
+
31
+ /**
32
+ * @param string $tag_name
33
+ * @param string $content Optional
34
+ */
35
+ public function __construct( $tag_name, $content = null )
36
+ {
37
+ $this->tag_name = $tag_name;
38
+ $this->content = $content;
39
+ }
40
+
41
+ /**
42
+ * @param string $content
43
+ */
44
+ public function set_content( $content )
45
+ {
46
+ $this->content = $content;
47
+ }
48
+
49
+ /**
50
+ * @return string
51
+ */
52
+ public function get_content()
53
+ {
54
+ return $this->content;
55
+ }
56
+
57
+ /**
58
+ * Set attributes
59
+ * @param array|string $atts
60
+ */
61
+ public function set_atts( $atts ) {
62
+ if ( is_string( $atts ) ) {
63
+ $this->atts = $this->parse_atts( $atts );
64
+ } else if ( is_array( $atts ) ) {
65
+ $this->atts = $atts;
66
+ }
67
+ }
68
+
69
+ /**
70
+ * @return string
71
+ */
72
+ public function get_tag_name()
73
+ {
74
+ return $this->tag_name;
75
+ }
76
+
77
+ /**
78
+ * @param string $name
79
+ * @return string|null
80
+ */
81
+ public function get_attr( $name )
82
+ {
83
+ if ( ! isset( $this->atts[ $name ] ) ) {
84
+ return null;
85
+ }
86
+
87
+ return $this->atts[ $name ];
88
+ }
89
+
90
+ /**
91
+ * @param string $name
92
+ * @param string $value Optional
93
+ */
94
+ public function set_attr( $name, $value = null )
95
+ {
96
+ $this->atts[ $name ] = $value;
97
+ }
98
+
99
+ /**
100
+ * @param string $name
101
+ * @return boolean
102
+ */
103
+ public function has_attr( $name )
104
+ {
105
+ return isset( $this->atts[ $name ] );
106
+ }
107
+
108
+ /**
109
+ * @param string $name
110
+ */
111
+ public function remove_attr( $name )
112
+ {
113
+ unset( $this->atts[ $name ] );
114
+ }
115
+
116
+ /**
117
+ * @param string $name
118
+ * @param string $value
119
+ * @return boolean
120
+ */
121
+ public function has_attr_value( $name, $value )
122
+ {
123
+ if ( ! $this->has_attr( $name ) ) {
124
+ return false;
125
+ }
126
+
127
+ $attr_values = explode( ' ', $this->get_attr( $name ) );
128
+ return in_array( $value, $attr_values );
129
+ }
130
+
131
+ /**
132
+ * @param string $name
133
+ * @param string $value
134
+ * @return void
135
+ */
136
+ public function add_to_attr( $name, $value )
137
+ {
138
+ if ( empty( $this->atts[ $name ] ) ) {
139
+ $this->set_attr( $name, $value );
140
+ return;
141
+ }
142
+
143
+ if ( $this->has_attr_value( $name, $value ) ) {
144
+ return;
145
+ }
146
+
147
+ $this->atts[ $name ] .= ' '. $value;
148
+ }
149
+
150
+ /**
151
+ * @param string $name
152
+ * @param string $value
153
+ * @return void
154
+ */
155
+ public function remove_from_attr( $name, $value )
156
+ {
157
+ if ( ! $this->has_attr_value( $name, $value ) ) {
158
+ return;
159
+ }
160
+
161
+ $attr_values = explode( ' ', $this->atts[ $name ] );
162
+ $new_attr_values = array_diff( $attr_values , array( $value ) );
163
+
164
+ $this->atts[ $name ] = implode( ' ', $new_attr_values );
165
+ }
166
+
167
+ /**
168
+ * @return string
169
+ */
170
+ public function get_html( $escape_content = true )
171
+ {
172
+ $link = '<'. esc_attr( $this->tag_name );
173
+
174
+ foreach ( $this->atts AS $key => $value ) {
175
+ if ( null === $value ) {
176
+ $link .= ' '. $key;
177
+ } else {
178
+ $link .= ' '. esc_attr( $key ) .'="'. esc_attr( $value ) .'"';
179
+ }
180
+ }
181
+
182
+ $link .= '>';
183
+
184
+ if ( null !== $this->content ) {
185
+ if ( true === $escape_content ) {
186
+ $link .= esc_html( $this->content );
187
+ } else {
188
+ $link .= $this->content;
189
+ }
190
+
191
+ $link .= '</'. esc_attr( $this->tag_name ) .'>';
192
+ }
193
+
194
+ return $link;
195
+ }
196
+
197
+ /**
198
+ * Parse an attributes string into an array. If the string starts with a tag,
199
+ * then the attributes on the first tag are parsed. This parses via a manual
200
+ * loop and is designed to be safer than using DOMDocument.
201
+ *
202
+ * @param string $atts
203
+ * @return array
204
+ *
205
+ * @example parse_attrs( 'src="example.jpg" alt="example"' )
206
+ * @example parse_attrs( '<img src="example.jpg" alt="example">' )
207
+ * @example parse_attrs( '<a href="example"></a>' )
208
+ *
209
+ * @link http://dev.airve.com/demo/speed_tests/php/parse_attrs.php
210
+ */
211
+ final protected function parse_atts( $atts ) {
212
+ $atts = str_split( trim( $atts ) );
213
+
214
+ if ( '<' === $atts[0] ) { // looks like a tag so strip the tagname
215
+ while ( $atts && ! ctype_space( $atts[0] ) && $atts[0] !== '>' ) {
216
+ array_shift($atts);
217
+ }
218
+ }
219
+
220
+ $arr = array(); // output
221
+ $name = ''; // for the current attr being parsed
222
+ $value = ''; // for the current attr being parsed
223
+ $mode = 0; // whether current char is part of the name (-), the value (+), or neither (0)
224
+ $stop = false; // delimiter for the current $value being parsed
225
+ $space = ' '; // a single space
226
+
227
+ foreach ( $atts as $j => $curr ) {
228
+ if ( $mode < 0 ) { // name
229
+ if ( '=' === $curr ) {
230
+ $mode = 1;
231
+ $stop = false;
232
+ } elseif ( '>' === $curr ) {
233
+ '' === $name or $arr[ $name ] = $value;
234
+ break;
235
+ } elseif ( ! ctype_space( $curr ) ) {
236
+ if ( ctype_space( $atts[ $j - 1 ] ) ) { // previous char
237
+ '' === $name or $arr[ $name ] = ''; // previous name
238
+ $name = $curr; // initiate new
239
+ } else {
240
+ $name .= $curr;
241
+ }
242
+ }
243
+ } elseif ( $mode > 0 ) { // value
244
+ if ( $stop === false ) {
245
+ if ( ! ctype_space( $curr ) ) {
246
+ if ( '"' === $curr || "'" === $curr ) {
247
+ $value = '';
248
+ $stop = $curr;
249
+ } else {
250
+ $value = $curr;
251
+ $stop = $space;
252
+ }
253
+ }
254
+ } elseif ( $stop === $space ? ctype_space( $curr ) : $curr === $stop ) {
255
+ $arr[ $name ] = $value;
256
+ $mode = 0;
257
+ $name = $value = '';
258
+ } else {
259
+ $value .= $curr;
260
+ }
261
+ } else { // neither
262
+ if ( '>' === $curr )
263
+ break;
264
+ if ( ! ctype_space( $curr ) ) {
265
+ // initiate
266
+ $name = $curr;
267
+ $mode = -1;
268
+ }
269
+ }
270
+ }
271
+
272
+ // incl the final pair if it was quoteless
273
+ '' === $name or $arr[ $name ] = $value;
274
+
275
+ return $arr;
276
+ }
277
+
278
+ }
279
+
280
+ /*?>*/
libs/fwp/class-fwp-html-fields.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Class WP_Form_Fields_1x0x0
4
  *
5
  * @package FWP
6
  * @category WordPress Library
1
  <?php
2
  /**
3
+ * Class FWP_HTML_Fields_1x0x0
4
  *
5
  * @package FWP
6
  * @category WordPress Library
public/css/wpel-admin.css CHANGED
@@ -25,30 +25,21 @@ a.toplevel_page_wpel-network-settings-page .wp-menu-image:before {
25
  content: '\f14c';
26
  }
27
 
28
- .wpel-admin-settings .nav-tab i {
 
29
  margin-right: 5px;
30
  }
31
 
32
- .wpel-admin-settings .nav-tab-support {
 
33
  float: right;
34
  }
35
 
36
- .wpel-admin-settings form {
 
37
  position: relative;
38
  }
39
 
40
- .wpel-admin-settings form:before {
41
- content: "\f14c";
42
- font-family: FontAwesome;
43
- opacity: 0.2;
44
- color: #aaa;
45
- font-size: 200pt;
46
- position: absolute;
47
- top: 120px;
48
- right: 40px;
49
- z-index: -1;
50
- }
51
-
52
  .js-wpel-apply-child td {
53
  padding-left: 30px;
54
  }
@@ -77,3 +68,50 @@ a.toplevel_page_wpel-network-settings-page .wp-menu-image:before {
77
  color: #ccc;
78
  font-style: italic;
79
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  content: '\f14c';
26
  }
27
 
28
+ .wpel-settings-page .nav-tab i,
29
+ .wpel-network-page .nav-tab i {
30
  margin-right: 5px;
31
  }
32
 
33
+ .wpel-settings-page .nav-tab-support,
34
+ .wpel-network-page .nav-tab-support {
35
  float: right;
36
  }
37
 
38
+ .wpel-settings-page form,
39
+ .wpel-network-page form {
40
  position: relative;
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  .js-wpel-apply-child td {
44
  padding-left: 30px;
45
  }
68
  color: #ccc;
69
  font-style: italic;
70
  }
71
+
72
+ /**
73
+ * Background Icon
74
+ */
75
+
76
+ .wpel-settings-page form:before,
77
+ .wpel-network-page form:before {
78
+ font-family: FontAwesome;
79
+ opacity: 0.2;
80
+ color: #aaa;
81
+ font-size: 200pt;
82
+ position: absolute;
83
+ top: 140px;
84
+ right: 40px;
85
+ z-index: -1;
86
+ }
87
+
88
+ .wpel-settings-page-external-links form:before {
89
+ content: "\f14c";
90
+ }
91
+ .wpel-settings-page-internal-links form:before {
92
+ content: "\f096";
93
+ }
94
+ .wpel-settings-page-excluded-links form:before {
95
+ content: "\f14d";
96
+ }
97
+ .wpel-settings-page-exceptions form:before {
98
+ content: "\f009";
99
+ }
100
+ .wpel-settings-page-admin form:before {
101
+ content: "\f085";
102
+ }
103
+ .wpel-settings-page-support form:before {
104
+ content: "\f128";
105
+ }
106
+
107
+ .wpel-network-page-network-settings form:before {
108
+ content: "\f0e8";
109
+ }
110
+ .wpel-network-page-network-admin-settings form:before {
111
+ content: "\f085";
112
+ }
113
+ .wpel-network-page-support form:before {
114
+ content: "\f128";
115
+ }
116
+
117
+
public/js/wpel-admin.js CHANGED
@@ -6,7 +6,7 @@
6
  jQuery(function ($) {
7
  'use strict';
8
 
9
- var $wrapper = $('.wpel-admin-settings');
10
 
11
  /**
12
  * Apply Sections Settings
@@ -29,20 +29,6 @@ jQuery(function ($) {
29
  /**
30
  * Link Settings
31
  */
32
- $wrapper.on('change', '.js-apply-settings input', function () {
33
- var $items = $wrapper.find('.form-table tr').not('.js-apply-settings');
34
-
35
- if ($(this).prop('checked')) {
36
- $items.show();
37
- $wrapper.find('.js-icon-type select').change();
38
- } else {
39
- $items.hide();
40
- }
41
- });
42
-
43
- // trigger immediatly
44
- $wrapper.find('.js-apply-settings input').change();
45
-
46
  $wrapper.on('change', '.js-icon-type select', function () {
47
  var iconType = $(this).val();
48
  var $itemsChild = $wrapper.find('.js-icon-type-child');
@@ -64,8 +50,20 @@ jQuery(function ($) {
64
  }
65
  });
66
 
 
 
 
 
 
 
 
 
 
 
 
67
  // trigger immediatly
68
- $wrapper.find('.js-icon-type select').change();
 
69
 
70
  /**
71
  * Support
6
  jQuery(function ($) {
7
  'use strict';
8
 
9
+ var $wrapper = $('.wpel-settings-page');
10
 
11
  /**
12
  * Apply Sections Settings
29
  /**
30
  * Link Settings
31
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  $wrapper.on('change', '.js-icon-type select', function () {
33
  var iconType = $(this).val();
34
  var $itemsChild = $wrapper.find('.js-icon-type-child');
50
  }
51
  });
52
 
53
+ $wrapper.on('change', '.js-apply-settings input', function () {
54
+ var $items = $wrapper.find('.form-table tr').not('.js-apply-settings');
55
+
56
+ if ($(this).prop('checked')) {
57
+ $items.show();
58
+ $wrapper.find('.js-icon-type select').change();
59
+ } else {
60
+ $items.hide();
61
+ }
62
+ });
63
+
64
  // trigger immediatly
65
+ $wrapper.find('.js-apply-settings input').change();
66
+
67
 
68
  /**
69
  * Support
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: freelancephp
3
  Tags: links, new window, new tab, external links, nofollow, follow, seo, noopener, noreferrer, internal links, link icon, link target, _blank, wpmu
4
  Requires at least: 4.2.0
5
  Tested up to: 4.5.2
6
- Stable tag: 2.0.4
7
 
8
  Open external links in a new tab / window, add "nofollow", "noopener" and font icons, SEO and more. Also for internal links.
9
 
@@ -64,30 +64,46 @@ If you want support for older versions of PHP or WordPress then download and ins
64
 
65
  = I want certain posts or pages to be ignored by the plugin. How? =
66
 
 
 
67
  `add_action( 'wpel_apply_settings', function () {
68
  global $post;
69
- $excluded_post_ids = array( 1, 2, 4 );
70
 
71
- if ( in_array( $post->ID, $excluded_post_ids ) ) {
72
  return false;
73
  }
74
 
75
  return true;
76
  }, 10 );`
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  = How to create a redirect for external links? (f.e. affiliate links) =
79
 
80
  Create redirect by using the `wpel_link` action. Add some code to functions.php of your theme, like:
81
 
82
- `add_action( 'wpel_link', function ( $link_object ) {
83
  // check if link is an external links
84
- if ( $link_object->isExternal() ) {
85
  // get current url
86
- $url = $link_object->getAttribute( 'href' );
87
 
88
  // set redirect url
89
  $redirect_url = '//somedom.com?url='. urlencode( $url );
90
- $link_object->setAttribute( 'href', $redirect_url );
91
  }
92
  }, 10, 1 );`
93
 
@@ -126,6 +142,16 @@ Add this JavaScript code to your site:
126
 
127
  });`
128
 
 
 
 
 
 
 
 
 
 
 
129
  [Do you have a question? Please ask me](http://www.finewebdev.comcontact/)
130
 
131
 
@@ -155,7 +181,7 @@ by the plugin will contain this data attribute and the value on how they were tr
155
  Use this action to change the link object after all plugin settings have been applied.
156
 
157
  `add_action( 'wpel_link', ( $link_object ) {
158
- if ( $link_object->isExternal() ) {
159
  // get current url
160
  $url = $link_object->getAttribute( 'href' );
161
 
@@ -163,45 +189,33 @@ Use this action to change the link object after all plugin settings have been ap
163
  $redirect_url = '//somedom.com?url='. urlencode( $url );
164
  $link_object->setAttribute( 'href', $redirect_url );
165
  }
166
- }, 10, 1 )`
167
-
168
- The link object is an instance of WPEL_Link class (a subclass of [DOMElement](http://php.net/manual/en/class.domelement.php)).
169
-
170
-
171
- = Filter hook "wpel_apply_settings" =
172
-
173
- When filter returns false the plugin settings will not be applied. Can be used when f.e. certain posts or pages should be ignored by this plugin.
174
-
175
- `add_filter( 'wpel_apply_settings', '__return_false' );`
176
-
177
- = Filter hook "wpel_before_filter" =
178
-
179
- Filter the content before searching for links and apply setttings.
180
 
181
- `add_filter( 'wpel_before_filter', function ( $content ) {
182
- // some code..
183
 
184
- return $changed_content;
185
- }, 10 );`
186
 
187
- = Filter hook "wpel_after_filter" =
 
 
188
 
189
- Filter the content after applying link setttings.
190
-
191
- `add_filter( 'wpel_after_filter', function ( $content ) {
192
- // some code..
 
193
 
194
- return $changed_content;
 
 
 
195
  }, 10 );`
196
 
197
- = Filter hook "wpel_regexp_link" =
198
 
199
- A filter for changing the regular expression for links. Should only be used to solve bugs on your site.
200
 
201
- `add_filter( 'wpel_regexp_link', function ( $regexp_link ) {
202
- $custom_regexp_link = '/<a (.*?)>(.*?)<\/a>/is';
203
- return $custom_regexp_link;
204
- }, 10 );`
205
 
206
 
207
  See [FAQ](https://wordpress.org/plugins/wp-external-links/faq/) for more info.
@@ -209,6 +223,19 @@ See [FAQ](https://wordpress.org/plugins/wp-external-links/faq/) for more info.
209
 
210
  == Changelog ==
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  = 2.0.4 =
213
  * Fixed DOMElement breaks of text containing `&`
214
 
3
  Tags: links, new window, new tab, external links, nofollow, follow, seo, noopener, noreferrer, internal links, link icon, link target, _blank, wpmu
4
  Requires at least: 4.2.0
5
  Tested up to: 4.5.2
6
+ Stable tag: 2.1.0
7
 
8
  Open external links in a new tab / window, add "nofollow", "noopener" and font icons, SEO and more. Also for internal links.
9
 
64
 
65
  = I want certain posts or pages to be ignored by the plugin. How? =
66
 
67
+ By using the `wpel_apply_settings` filter you can stop the plugin from processing that page, f.e.:
68
+
69
  `add_action( 'wpel_apply_settings', function () {
70
  global $post;
71
+ $ignored_post_ids = array( 1, 2, 4 );
72
 
73
+ if ( in_array( $post->ID, $ignored_post_ids ) ) {
74
  return false;
75
  }
76
 
77
  return true;
78
  }, 10 );`
79
 
80
+ Using this filter you can ignore any request, like certain category, archive etcetera.
81
+
82
+ = I want specific links to be ignored by the plugin. How? =
83
+
84
+ By using the `wpel_before_apply_link` filter you can skip specific links from being processed by WPEL plugin, f.e.:
85
+
86
+ `add_action( 'wpel_before_apply_link', function ( $link ) {
87
+ // ignore links with class "some-cls"
88
+ if ( $link->has_attr_value( 'class', 'some-cls' ) ) {
89
+ $link->set_ignore();
90
+ }
91
+ }, 10 );`
92
+
93
+
94
  = How to create a redirect for external links? (f.e. affiliate links) =
95
 
96
  Create redirect by using the `wpel_link` action. Add some code to functions.php of your theme, like:
97
 
98
+ `add_action( 'wpel_link', function ( $link ) {
99
  // check if link is an external links
100
+ if ( $link->is_external() ) {
101
  // get current url
102
+ $url = $link->get_attr( 'href' );
103
 
104
  // set redirect url
105
  $redirect_url = '//somedom.com?url='. urlencode( $url );
106
+ $link->set_attr( 'href', $redirect_url );
107
  }
108
  }, 10, 1 );`
109
 
142
 
143
  });`
144
 
145
+ = I am a plugin developer and my plugin conflicts with WPEL. How can I solve the problem? =
146
+
147
+ If your plugin contains links it might be filtered by the WPEL plugin as well, causing a conflict.
148
+ Here are some suggestions on solving the problem:
149
+
150
+ 1. Add `data-wpel-link="ignore"` to links that need to be ignored by WPEL plugin
151
+ 1. Use `wpel_before_apply_link`-action to ignore your links (f.e. containing certain class or data-attribute)
152
+ 1. Use `wpel_apply_settings`-filter to ignore complete post, pages, categories etc
153
+
154
+
155
  [Do you have a question? Please ask me](http://www.finewebdev.comcontact/)
156
 
157
 
181
  Use this action to change the link object after all plugin settings have been applied.
182
 
183
  `add_action( 'wpel_link', ( $link_object ) {
184
+ if ( $link_object->is_external() ) {
185
  // get current url
186
  $url = $link_object->getAttribute( 'href' );
187
 
189
  $redirect_url = '//somedom.com?url='. urlencode( $url );
190
  $link_object->setAttribute( 'href', $redirect_url );
191
  }
192
+ }, 10, 1 );`
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
+ The link object is an instance of WPEL_Link class.
 
195
 
196
+ = Action hook "wpel_before_apply_link" =
 
197
 
198
+ Use this action to change the link object before the plugin settings have been applied on that link.
199
+ You can use this filter to ignore individual links from being processed. Or change how they will be treated
200
+ by the WPEL plugin, f.e. make an internal link external.
201
 
202
+ `add_action( 'wpel_before_apply_link', function ( $link ) {
203
+ // ignore links with class "some-cls"
204
+ if ( $link->has_attr_value( 'class', 'some-cls' ) ) {
205
+ $link->set_ignore();
206
+ }
207
 
208
+ // mark and treat links with class "ext-cls" as external link
209
+ if ( $link->has_attr_value( 'class', 'ext-cls' ) ) {
210
+ $link->set_external();
211
+ }
212
  }, 10 );`
213
 
214
+ = Filter hook "wpel_apply_settings" =
215
 
216
+ When filter returns false the plugin settings will not be applied. Can be used when f.e. certain posts or pages should be ignored by this plugin.
217
 
218
+ `add_filter( 'wpel_apply_settings', '__return_false' );`
 
 
 
219
 
220
 
221
  See [FAQ](https://wordpress.org/plugins/wp-external-links/faq/) for more info.
223
 
224
  == Changelog ==
225
 
226
+ = 2.1.0 =
227
+ * Added tab with options for excluded links
228
+ * Added `wpel-no-icon` class to set on links
229
+ * Added action `wpel_before_apply_link`
230
+ * Added option ignore mailto links
231
+ * Fixed ignore links of admin bar
232
+ * Fixed regexp for ignoring tags
233
+ * Fixed text domain to text slug
234
+ * Made filters `wpel_before_filter` and `wpel_after_filter` "private"
235
+ * Removed DOMElement dependency
236
+ * Removed rel="external" option for internal links
237
+ * Removed filter `wpel_regexp_link` (this should not be changed)
238
+
239
  = 2.0.4 =
240
  * Fixed DOMElement breaks of text containing `&`
241
 
templates/network-page/help-tabs/under-construction.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
11
  * @license Dual licensed under the MIT and GPLv2+ licenses
12
  */
13
  ?>
14
- <h3><?php _e( 'Under Construction', 'wpel' ) ?></h3>
15
  <p>
16
- <?php _e( 'Still working on the documentation...', 'wpel' ); ?>
17
  </p>
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
11
  * @license Dual licensed under the MIT and GPLv2+ licenses
12
  */
13
  ?>
14
+ <h3><?php _e( 'Under Construction', 'wp-external-links' ) ?></h3>
15
  <p>
16
+ <?php _e( 'Still working on the documentation...', 'wp-external-links' ); ?>
17
  </p>
templates/network-page/main.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -18,7 +18,7 @@
18
  * @option string "own_admin_menu"
19
  */
20
  ?>
21
- <div class="wrap wpel-admin-settings">
22
  <h1><?php echo get_admin_page_title(); ?></h1>
23
  <?php
24
  if ( $vars[ 'own_admin_menu' ] ):
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
18
  * @option string "own_admin_menu"
19
  */
20
  ?>
21
+ <div class="wrap wpel-network-page wpel-network-page-<?php echo $vars[ 'current_tab' ]; ?>">
22
  <h1><?php echo get_admin_page_title(); ?></h1>
23
  <?php
24
  if ( $vars[ 'own_admin_menu' ] ):
templates/network-page/tab-contents/network-admin-settings.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tab Network Admin Settings
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ *
13
+ * @var array $vars
14
+ * @option array "tabs"
15
+ * @option string "current_tab"
16
+ */
17
+
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
20
+
21
+ submit_button();
templates/network-page/tab-contents/network-settings.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tab Network Settings
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ *
13
+ * @var array $vars
14
+ * @option array "tabs"
15
+ * @option string "current_tab"
16
+ */
17
+
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
20
+
21
+ submit_button();
templates/partials/nav-tabs.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
templates/partials/tab-contents/fields-default.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -21,6 +21,3 @@ $fields = $tab_values[ 'fields' ];
21
 
22
  settings_fields( $fields->get_setting( 'option_group' ) );
23
  do_settings_sections( $fields->get_setting( 'page_id' ) );
24
-
25
- submit_button();
26
- ?>
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
21
 
22
  settings_fields( $fields->get_setting( 'option_group' ) );
23
  do_settings_sections( $fields->get_setting( 'page_id' ) );
 
 
 
templates/partials/tab-contents/support.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -14,43 +14,47 @@
14
  * @option array "tabs"
15
  */
16
  ?>
17
- <h2><?php _e( 'Support', 'wpel' ); ?></h2>
18
 
19
- <h3><?php _e( 'Documentation', 'wpel' ); ?></h3>
20
- <p><?php _e( 'Take a look at the <a href="#" data-wpel-help>help section</a> for documentation', 'wpel' ); ?></p>
21
 
22
- <h3><?php _e( 'FAQ', 'wpel' ); ?></h3>
23
- <p><?php _e( 'On the <a href="https://wordpress.org/plugins/wp-external-links/faq/" target="_blank">FAQ page</a> you can find some additional tips & trics.', 'wpel' ); ?></p>
24
 
25
- <h3><?php _e( 'Reported issues', 'wpel' ); ?></h3>
26
- <p><?php _e( 'When you experience problems using this plugin please look if your problem was <a href="https://wordpress.org/support/plugin/wp-external-links" target="_blank">already reported</a>.', 'wpel' ); ?></p>
27
 
28
- <h3><?php _e( 'Send your issue', 'wpel' ); ?></h3>
29
- <p><?php _e( 'If it wasn\'t yet reported then you can <a href="https://wordpress.org/support/plugin/wp-external-links#postform" target="_blank">send your problem</a>.', 'wpel' ); ?>
30
- <?php _e( 'Please after reporting send me the following technical information <a href="http://www.finewebdev.com/contact" target="_blank">by mail</a>. That will make it easier to solve the problem.', 'wpel' ); ?>
31
  </p>
32
  <p>
33
- <button class="button js-wpel-copy"><?php _e( 'Copy Technical Info', 'wpel' ); ?></button>
34
  </p>
35
  <p>
36
  <textarea id="plugin-settings" class="large-text js-wpel-copy-target" rows="8" readonly="readonly">
37
- <?php _e( 'WP url:', 'wpel' ); ?> <?php bloginfo( 'wpurl' ); ?>
38
 
39
- <?php _e( 'WP version:', 'wpel' ); ?> <?php bloginfo( 'version' ); ?>
40
 
41
- <?php _e( 'PHP version:', 'wpel' ); ?> <?php echo phpversion(); ?>
42
 
43
- <?php _e( 'Installed Plugins:', 'wpel' ); ?>
44
 
45
  <?php
46
  $plugins = get_plugins() ;
47
 
48
- foreach ( $plugins as $plugin ) {
49
- echo ' - '. $plugin[ 'Name' ] .', version: '. $plugin[ 'Version' ] ."\n";
 
 
 
 
50
  }
51
  ?>
52
 
53
- <?php _e( 'WPEL Settings:', 'wpel' ); ?>
54
 
55
  array(
56
  <?php
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
14
  * @option array "tabs"
15
  */
16
  ?>
17
+ <h2><?php _e( 'Support', 'wp-external-links' ); ?></h2>
18
 
19
+ <h3><?php _e( 'Documentation', 'wp-external-links' ); ?></h3>
20
+ <p><?php _e( 'Take a look at the <a href="#" data-wpel-help>help section</a> for documentation', 'wp-external-links' ); ?></p>
21
 
22
+ <h3><?php _e( 'FAQ', 'wp-external-links' ); ?></h3>
23
+ <p><?php _e( 'On the <a href="https://wordpress.org/plugins/wp-external-links/faq/" target="_blank">FAQ page</a> you can find some additional tips & trics.', 'wp-external-links' ); ?></p>
24
 
25
+ <h3><?php _e( 'Reported issues', 'wp-external-links' ); ?></h3>
26
+ <p><?php _e( 'When you experience problems using this plugin please look if your problem was <a href="https://wordpress.org/support/plugin/wp-external-links" target="_blank">already reported</a>.', 'wp-external-links' ); ?></p>
27
 
28
+ <h3><?php _e( 'Send your issue', 'wp-external-links' ); ?></h3>
29
+ <p><?php _e( 'If it wasn\'t yet reported then you can <a href="https://wordpress.org/support/plugin/wp-external-links#postform" target="_blank">send your problem</a>.', 'wp-external-links' ); ?>
30
+ <?php _e( 'Please after reporting send me the following technical information <a href="http://www.finewebdev.com/contact" target="_blank">by mail</a>. That will make it easier to solve the problem.', 'wp-external-links' ); ?>
31
  </p>
32
  <p>
33
+ <button class="button js-wpel-copy"><?php _e( 'Copy Technical Info', 'wp-external-links' ); ?></button>
34
  </p>
35
  <p>
36
  <textarea id="plugin-settings" class="large-text js-wpel-copy-target" rows="8" readonly="readonly">
37
+ <?php _e( 'WP url:', 'wp-external-links' ); ?> <?php bloginfo( 'wpurl' ); ?>
38
 
39
+ <?php _e( 'WP version:', 'wp-external-links' ); ?> <?php bloginfo( 'version' ); ?>
40
 
41
+ <?php _e( 'PHP version:', 'wp-external-links' ); ?> <?php echo phpversion(); ?>
42
 
43
+ <?php _e( 'Active Plugins:', 'wp-external-links' ); ?>
44
 
45
  <?php
46
  $plugins = get_plugins() ;
47
 
48
+ foreach ( $plugins as $plugin => $plugin_values ) {
49
+ if ( ! is_plugin_active( $plugin ) ) {
50
+ continue;
51
+ }
52
+
53
+ echo ' - '. $plugin_values[ 'Name' ] .', version: '. $plugin_values[ 'Version' ] . "\n";
54
  }
55
  ?>
56
 
57
+ <?php _e( 'WPEL Settings:', 'wp-external-links' ); ?>
58
 
59
  array(
60
  <?php
templates/requirements-notice.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -16,7 +16,7 @@
16
  <?php _e('The plugin <strong>WP External Links</strong> requires'
17
  .' PHP version 5.3 or up and WordPress version 3.6 or up.'
18
  .'<br>Please upgrade your PHP and/or WordPress.'
19
- .' Deactivate the plugin to remove this message.', 'wpel' );
20
  ?>
21
  </p>
22
  </div>
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
16
  <?php _e('The plugin <strong>WP External Links</strong> requires'
17
  .' PHP version 5.3 or up and WordPress version 3.6 or up.'
18
  .'<br>Please upgrade your PHP and/or WordPress.'
19
+ .' Deactivate the plugin to remove this message.', 'wp-external-links' );
20
  ?>
21
  </p>
22
  </div>
templates/settings-page/help-tabs/data-attributes.php CHANGED
@@ -4,20 +4,20 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
11
  * @license Dual licensed under the MIT and GPLv2+ licenses
12
  */
13
  ?>
14
- <h3><?php _e( 'Exclude or include by data-attribute', 'wpel' ) ?></h3>
15
  <p>
16
- <?php _e( 'The <code>data-wpel-link</code> attribute can be set on links and forces the plugin to treat those links that way.', 'wpel' ); ?>
17
  </p>
18
  <ul>
19
- <li><?php _e( 'Links with <code>data-wpel-link="internal"</code> will be treated as internal links.', 'wpel' ); ?></li>
20
- <li><?php _e( 'Links with <code>data-wpel-link="external"</code> will be treated as external links.', 'wpel' ); ?></li>
21
- <li><?php _e( 'Links with <code>data-wpel-link="exclude"</code> will be treated as excluded links (which optionally can be treated as internal links).', 'wpel' ); ?></li>
22
- <li><?php _e( 'Links with <code>data-wpel-link="ignore"</code> will be completely ignored by this plugin.', 'wpel' ); ?></li>
23
  </ul>
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
11
  * @license Dual licensed under the MIT and GPLv2+ licenses
12
  */
13
  ?>
14
+ <h3><?php _e( 'Exclude or include by data-attribute', 'wp-external-links' ) ?></h3>
15
  <p>
16
+ <?php _e( 'The <code>data-wpel-link</code> attribute can be set on links and forces the plugin to treat those links that way.', 'wp-external-links' ); ?>
17
  </p>
18
  <ul>
19
+ <li><?php _e( 'Links with <code>data-wpel-link="internal"</code> will be treated as internal links.', 'wp-external-links' ); ?></li>
20
+ <li><?php _e( 'Links with <code>data-wpel-link="external"</code> will be treated as external links.', 'wp-external-links' ); ?></li>
21
+ <li><?php _e( 'Links with <code>data-wpel-link="exclude"</code> will be treated as excluded links (which have their own settings or will be treated as internal links).', 'wp-external-links' ); ?></li>
22
+ <li><?php _e( 'Links with <code>data-wpel-link="ignore"</code> will be completely ignored by this plugin.', 'wp-external-links' ); ?></li>
23
  </ul>
templates/settings-page/help-tabs/under-construction.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
11
  * @license Dual licensed under the MIT and GPLv2+ licenses
12
  */
13
  ?>
14
- <h3><?php _e( 'Under Construction', 'wpel' ) ?></h3>
15
  <p>
16
- <?php _e( 'Still working on the documentation...', 'wpel' ); ?>
17
  </p>
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
11
  * @license Dual licensed under the MIT and GPLv2+ licenses
12
  */
13
  ?>
14
+ <h3><?php _e( 'Under Construction', 'wp-external-links' ) ?></h3>
15
  <p>
16
+ <?php _e( 'Still working on the documentation...', 'wp-external-links' ); ?>
17
  </p>
templates/settings-page/main.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -18,7 +18,7 @@
18
  * @option string "own_admin_menu"
19
  */
20
  ?>
21
- <div class="wrap wpel-admin-settings">
22
  <h1><?php echo get_admin_page_title(); ?></h1>
23
  <?php
24
  if ( $vars[ 'own_admin_menu' ] ):
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
18
  * @option string "own_admin_menu"
19
  */
20
  ?>
21
+ <div class="wrap wpel-settings-page wpel-settings-page-<?php echo $vars[ 'current_tab' ]; ?>">
22
  <h1><?php echo get_admin_page_title(); ?></h1>
23
  <?php
24
  if ( $vars[ 'own_admin_menu' ] ):
templates/settings-page/tab-contents/admin.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tab Admin
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ *
13
+ * @var array $vars
14
+ * @option array "tabs"
15
+ * @option string "current_tab"
16
+ */
17
+
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
20
+
21
+ submit_button();
templates/settings-page/tab-contents/exceptions.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -15,12 +15,10 @@
15
  * @option string "current_tab"
16
  */
17
 
18
- $current_tab = $vars [ 'current_tab' ];
19
- $tab_values = $vars[ 'tabs' ][ $current_tab ];
20
- $fields = $tab_values[ 'fields' ];
21
-
22
- settings_fields( $fields->get_setting( 'option_group' ) );
23
- do_settings_sections( $fields->get_setting( 'page_id' ) );
24
  ?>
25
- <p class="description"><?php _e( 'De data-attribute <a href="#" data-wpel-help="data-attributes"><code>data-wpel-link</code></a> can be set on individual links to treat them as internal, external or excluded.' ); ?></p>
 
 
26
  <?php submit_button(); ?>
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link http://www.finewebdev.com
10
  * @link https://github.com/freelancephp/WP-External-Links
15
  * @option string "current_tab"
16
  */
17
 
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
 
 
 
 
20
  ?>
21
+
22
+ <p class="description"><?php _e( 'The data-attribute <a href="#" data-wpel-help="data-attributes"><code>data-wpel-link</code></a> can be set on individual links to treat them as internal, external or excluded, or to completely ignore links form being processed by this plugin.' ); ?></p>
23
+
24
  <?php submit_button(); ?>
templates/settings-page/tab-contents/excluded-links.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tab Excluded Links
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ *
13
+ * @var array $vars
14
+ * @option array "tabs"
15
+ * @option string "current_tab"
16
+ */
17
+
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
20
+
21
+ submit_button();
templates/settings-page/tab-contents/external-links.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tab External Links
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ *
13
+ * @var array $vars
14
+ * @option array "tabs"
15
+ * @option string "current_tab"
16
+ */
17
+
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
20
+
21
+ submit_button();
templates/settings-page/tab-contents/internal-links.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tab Internal Links
4
+ *
5
+ * @package WPEL
6
+ * @category WordPress Plugin
7
+ * @version 2.1.0
8
+ * @author Victor Villaverde Laan
9
+ * @link http://www.finewebdev.com
10
+ * @link https://github.com/freelancephp/WP-External-Links
11
+ * @license Dual licensed under the MIT and GPLv2+ licenses
12
+ *
13
+ * @var array $vars
14
+ * @option array "tabs"
15
+ * @option string "current_tab"
16
+ */
17
+
18
+ $default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
19
+ WPEL_Plugin::show_template( $default_fields_file, $vars );
20
+
21
+ submit_button();
wp-external-links.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
- * @version 2.0.4
8
  * @author Victor Villaverde Laan
9
  * @link https://wordpress.org/plugins/wp-external-links/
10
  * @link https://github.com/freelancephp/WP-External-Links
@@ -12,13 +12,13 @@
12
  *
13
  * @wordpress-plugin
14
  * Plugin Name: WP External Links
15
- * Version: 2.0.4
16
  * Plugin URI: https://wordpress.org/plugins/wp-external-links/
17
  * Description: Open external links in a new tab or window, adding "nofollow" and "noopener", set font icon, SEO friendly options and more.
18
  * Author: Victor Villaverde Laan
19
  * Author URI: http://www.finewebdev.com
20
  * License: Dual licensed under the MIT and GPLv2+ licenses
21
- * Text Domain: wpel
22
  * Domain Path: /languages
23
  */
24
  if ( ! function_exists( 'wpel_init' ) ):
4
  *
5
  * @package WPEL
6
  * @category WordPress Plugin
7
+ * @version 2.1.0
8
  * @author Victor Villaverde Laan
9
  * @link https://wordpress.org/plugins/wp-external-links/
10
  * @link https://github.com/freelancephp/WP-External-Links
12
  *
13
  * @wordpress-plugin
14
  * Plugin Name: WP External Links
15
+ * Version: 2.1.0
16
  * Plugin URI: https://wordpress.org/plugins/wp-external-links/
17
  * Description: Open external links in a new tab or window, adding "nofollow" and "noopener", set font icon, SEO friendly options and more.
18
  * Author: Victor Villaverde Laan
19
  * Author URI: http://www.finewebdev.com
20
  * License: Dual licensed under the MIT and GPLv2+ licenses
21
+ * Text Domain: wp-external-links
22
  * Domain Path: /languages
23
  */
24
  if ( ! function_exists( 'wpel_init' ) ):