Broken Link Checker - Version 1.10.11

Version Description

  • Fixed the issue with HTTPS (Thanks to gmcinnes)
  • Broken Link Checker is now on GitHub. Pull Requests welcome.
Download this release

Release Info

Developer freediver
Plugin Icon 128x128 Broken Link Checker
Version 1.10.11
Comparing to
See all releases

Code changes from version 1.10.10 to 1.10.11

broken-link-checker.php CHANGED
@@ -3,8 +3,8 @@
3
  Plugin Name: Broken Link Checker
4
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
5
  Description: Checks your blog for broken links and missing images and notifies you on the dashboard if any are found.
6
- Version: 1.10.10
7
- Author: Janis Elsts
8
  Author URI: http://w-shadow.com/
9
  Text Domain: broken-link-checker
10
  */
3
  Plugin Name: Broken Link Checker
4
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
5
  Description: Checks your blog for broken links and missing images and notifies you on the dashboard if any are found.
6
+ Version: 1.10.11
7
+ Author: Janis Elsts, Vladimir Prelovac
8
  Author URI: http://w-shadow.com/
9
  Text Domain: broken-link-checker
10
  */
core/core.php CHANGED
@@ -37,7 +37,7 @@ class wsBrokenLinkChecker {
37
  * @param blcConfigurationManager $conf An instance of the configuration manager
38
  * @return void
39
  */
40
- function wsBrokenLinkChecker ( $loader, $conf ) {
41
  $this->db_version = BLC_DATABASE_VERSION;
42
 
43
  $this->conf = $conf;
37
  * @param blcConfigurationManager $conf An instance of the configuration manager
38
  * @return void
39
  */
40
+ function __construct ( $loader, $conf ) {
41
  $this->db_version = BLC_DATABASE_VERSION;
42
 
43
  $this->conf = $conf;
includes/config-manager.php CHANGED
@@ -7,121 +7,121 @@
7
 
8
  if ( !class_exists('blcConfigurationManager') ){
9
 
10
- class blcConfigurationManager {
11
-
12
- var $option_name;
13
-
14
- var $options;
15
- var $defaults;
16
- var $loaded_values;
17
-
18
- /**
19
- * @var bool Whether options have been successfully loaded from the database.
20
- */
21
- public $db_option_loaded = false;
22
-
23
- function blcConfigurationManager( $option_name = '', $default_settings = null ){
24
- $this->option_name = $option_name;
25
-
26
- if ( is_array($default_settings) ){
27
- $this->defaults = $default_settings;
28
- } else {
29
- $this->defaults = array();
30
- }
31
- $this->loaded_values = array();
32
-
33
- $this->options = $this->defaults;
34
-
35
- if ( !empty( $this->option_name ) ) {
36
- $this->load_options();
 
37
  }
38
- }
39
-
40
- function set_defaults( $default_settings = null ){
41
- if ( is_array($default_settings) ){
42
- $this->defaults = array();
43
- } else {
44
- $this->defaults = $default_settings;
 
45
  }
46
- $this->options = array_merge($this->defaults, $this->loaded_values);
47
- }
48
-
49
- /**
50
- * blcOptionManager::load_options()
51
- * Load plugin options from the database. The current $options values are not affected
52
- * if this function fails.
53
- *
54
- * @param string $option_name
55
- * @return bool True if options were loaded, false otherwise.
56
- */
57
- function load_options( $option_name = '' ){
58
- $this->db_option_loaded = false;
59
-
60
- if ( !empty($option_name) ){
61
- $this->option_name = $option_name;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
-
64
- if ( empty($this->option_name) ) return false;
65
-
66
- $new_options = get_option($this->option_name);
67
-
68
- //Decode JSON (if applicable).
69
- if ( is_string($new_options) && !empty($new_options) ) {
70
- $new_options = json_decode($new_options, true);
 
 
 
 
 
 
 
 
71
  }
72
 
73
- if( !is_array( $new_options ) ){
74
- return false;
75
- } else {
76
- $this->loaded_values = $new_options;
77
- $this->options = array_merge( $this->defaults, $this->loaded_values );
78
- $this->db_option_loaded = true;
79
- return true;
80
- }
81
- }
82
-
83
- /**
84
- * blcOptionManager::save_options()
85
- * Save plugin options to the database.
86
- *
87
- * @param string $option_name (Optional) Save the options under this name
88
- * @return bool True if settings were saved, false if settings haven't been changed or if there was an error.
89
- */
90
- function save_options( $option_name = '' ){
91
- if ( !empty($option_name) ){
92
- $this->option_name = $option_name;
93
  }
94
-
95
- if ( empty($this->option_name) ) return false;
96
 
97
- return update_option( $this->option_name, json_encode($this->options) );
98
- }
99
-
100
- /**
101
- * Retrieve a specific setting.
102
- *
103
- * @param string $key
104
- * @param mixed $default
105
- * @return mixed
106
- */
107
- function get($key, $default = null){
108
- if ( array_key_exists($key, $this->options) ){
109
- return $this->options[$key];
110
- } else {
111
- return $default;
112
  }
113
  }
114
-
115
- /**
116
- * Update or add a setting.
117
- *
118
- * @param string $key
119
- * @param mixed $value
120
- * @return void
121
- */
122
- function set($key, $value){
123
- $this->options[$key] = $value;
124
- }
125
- }
126
 
127
- }
7
 
8
  if ( !class_exists('blcConfigurationManager') ){
9
 
10
+ class blcConfigurationManager {
11
+
12
+ var $option_name;
13
+
14
+ var $options;
15
+ var $defaults;
16
+ var $loaded_values;
17
+
18
+ /**
19
+ * @var bool Whether options have been successfully loaded from the database.
20
+ */
21
+ public $db_option_loaded = false;
22
+
23
+ function __construct( $option_name = '', $default_settings = null ){
24
+ $this->option_name = $option_name;
25
+
26
+ if ( is_array($default_settings) ){
27
+ $this->defaults = $default_settings;
28
+ } else {
29
+ $this->defaults = array();
30
+ }
31
+ $this->loaded_values = array();
32
+
33
+ $this->options = $this->defaults;
34
+
35
+ if ( !empty( $this->option_name ) ) {
36
+ $this->load_options();
37
+ }
38
  }
39
+
40
+ function set_defaults( $default_settings = null ){
41
+ if ( is_array($default_settings) ){
42
+ $this->defaults = array();
43
+ } else {
44
+ $this->defaults = $default_settings;
45
+ }
46
+ $this->options = array_merge($this->defaults, $this->loaded_values);
47
  }
48
+
49
+ /**
50
+ * blcOptionManager::load_options()
51
+ * Load plugin options from the database. The current $options values are not affected
52
+ * if this function fails.
53
+ *
54
+ * @param string $option_name
55
+ * @return bool True if options were loaded, false otherwise.
56
+ */
57
+ function load_options( $option_name = '' ){
58
+ $this->db_option_loaded = false;
59
+
60
+ if ( !empty($option_name) ){
61
+ $this->option_name = $option_name;
62
+ }
63
+
64
+ if ( empty($this->option_name) ) return false;
65
+
66
+ $new_options = get_option($this->option_name);
67
+
68
+ //Decode JSON (if applicable).
69
+ if ( is_string($new_options) && !empty($new_options) ) {
70
+ $new_options = json_decode($new_options, true);
71
+ }
72
+
73
+ if( !is_array( $new_options ) ){
74
+ return false;
75
+ } else {
76
+ $this->loaded_values = $new_options;
77
+ $this->options = array_merge( $this->defaults, $this->loaded_values );
78
+ $this->db_option_loaded = true;
79
+ return true;
80
+ }
81
  }
82
+
83
+ /**
84
+ * blcOptionManager::save_options()
85
+ * Save plugin options to the database.
86
+ *
87
+ * @param string $option_name (Optional) Save the options under this name
88
+ * @return bool True if settings were saved, false if settings haven't been changed or if there was an error.
89
+ */
90
+ function save_options( $option_name = '' ){
91
+ if ( !empty($option_name) ){
92
+ $this->option_name = $option_name;
93
+ }
94
+
95
+ if ( empty($this->option_name) ) return false;
96
+
97
+ return update_option( $this->option_name, json_encode($this->options) );
98
  }
99
 
100
+ /**
101
+ * Retrieve a specific setting.
102
+ *
103
+ * @param string $key
104
+ * @param mixed $default
105
+ * @return mixed
106
+ */
107
+ function get($key, $default = null){
108
+ if ( array_key_exists($key, $this->options) ){
109
+ return $this->options[$key];
110
+ } else {
111
+ return $default;
112
+ }
 
 
 
 
 
 
 
113
  }
 
 
114
 
115
+ /**
116
+ * Update or add a setting.
117
+ *
118
+ * @param string $key
119
+ * @param mixed $value
120
+ * @return void
121
+ */
122
+ function set($key, $value){
123
+ $this->options[$key] = $value;
 
 
 
 
 
 
124
  }
125
  }
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
+ }
includes/module-base.php CHANGED
@@ -7,52 +7,52 @@
7
 
8
  /**
9
  * Base class for BLC modules.
10
- *
11
  * @package Broken Link Checker
12
  * @author Janis Elsts
13
  * @access public
14
  */
15
  class blcModule {
16
-
17
  var $module_id; //The ID of this module. Usually a lowercase string.
18
  var $cached_header; //An associative array containing the header data of the module file.
19
  /** @var blcConfigurationManager $plugin__conf */
20
  var $plugin_conf; //A reference to the plugin's global configuration object.
21
  var $module_manager; //A reference to the module manager.
22
-
23
  /**
24
  * Class constructor
25
- *
26
  * @param string $module_id
27
  * @param array $cached_header
28
  * @param blcConfigurationManager $plugin_conf
29
  * @param blcModuleManager $module_manager
30
  * @return void
31
  */
32
- function blcModule($module_id, $cached_header, &$plugin_conf, &$module_manager){
33
  $this->module_id = $module_id;
34
  $this->cached_header = $cached_header;
35
  $this->plugin_conf = &$plugin_conf;
36
  $this->module_manager = &$module_manager;
37
-
38
  $this->init();
39
- }
40
-
41
  /**
42
  * Module initializer. Called when the module is first instantiated.
43
  * The default implementation does nothing. Override it in a subclass to
44
- * specify some sort of start-up behaviour.
45
- *
46
  * @return void
47
  */
48
  function init(){
49
  //Should be overridden in a sub-class.
50
  }
51
-
52
  /**
53
  * Called when the module is activated.
54
  * Should be overridden in a sub-class.
55
- *
56
  * @return void
57
  */
58
  function activated(){
@@ -62,7 +62,7 @@ class blcModule {
62
  /**
63
  * Called when the module is deactivated.
64
  * Should be overridden in a sub-class.
65
- *
66
  * @return void
67
  */
68
  function deactivated(){
@@ -76,5 +76,4 @@ class blcModule {
76
  function plugin_activated() {
77
  $this->activated();
78
  }
79
- }
80
-
7
 
8
  /**
9
  * Base class for BLC modules.
10
+ *
11
  * @package Broken Link Checker
12
  * @author Janis Elsts
13
  * @access public
14
  */
15
  class blcModule {
16
+
17
  var $module_id; //The ID of this module. Usually a lowercase string.
18
  var $cached_header; //An associative array containing the header data of the module file.
19
  /** @var blcConfigurationManager $plugin__conf */
20
  var $plugin_conf; //A reference to the plugin's global configuration object.
21
  var $module_manager; //A reference to the module manager.
22
+
23
  /**
24
  * Class constructor
25
+ *
26
  * @param string $module_id
27
  * @param array $cached_header
28
  * @param blcConfigurationManager $plugin_conf
29
  * @param blcModuleManager $module_manager
30
  * @return void
31
  */
32
+ function __construct($module_id, $cached_header, &$plugin_conf, &$module_manager){
33
  $this->module_id = $module_id;
34
  $this->cached_header = $cached_header;
35
  $this->plugin_conf = &$plugin_conf;
36
  $this->module_manager = &$module_manager;
37
+
38
  $this->init();
39
+ }
40
+
41
  /**
42
  * Module initializer. Called when the module is first instantiated.
43
  * The default implementation does nothing. Override it in a subclass to
44
+ * specify some sort of start-up behaviour.
45
+ *
46
  * @return void
47
  */
48
  function init(){
49
  //Should be overridden in a sub-class.
50
  }
51
+
52
  /**
53
  * Called when the module is activated.
54
  * Should be overridden in a sub-class.
55
+ *
56
  * @return void
57
  */
58
  function activated(){
62
  /**
63
  * Called when the module is deactivated.
64
  * Should be overridden in a sub-class.
65
+ *
66
  * @return void
67
  */
68
  function deactivated(){
76
  function plugin_activated() {
77
  $this->activated();
78
  }
79
+ }
 
includes/screen-meta-links.php CHANGED
@@ -9,89 +9,89 @@
9
  if ( !class_exists('wsScreenMetaLinks11') ):
10
 
11
  //Load JSON functions for PHP < 5.2
12
- if ( !(function_exists('json_encode') && function_exists('json_decode')) && !(class_exists('Services_JSON') || class_exists('Moxiecode_JSON')) ){
13
- $class_json_path = ABSPATH.WPINC.'/class-json.php';
14
- $class_moxiecode_json_path = ABSPATH.WPINC.'/js/tinymce/plugins/spellchecker/classes/utils/JSON.php';
15
- if ( file_exists($class_json_path) ){
16
- require $class_json_path;
17
-
18
- } elseif ( file_exists($class_moxiecode_json_path) ) {
19
- require $class_moxiecode_json_path;
20
- }
21
- }
22
-
23
- class wsScreenMetaLinks11 {
24
- var $registered_links; //List of meta links registered for each page.
25
-
26
- /**
27
- * Class constructor.
28
- *
29
- * @return void
30
- */
31
- function wsScreenMetaLinks11(){
32
- $this->registered_links = array();
33
-
34
- add_action('admin_notices', array(&$this, 'append_meta_links'));
35
- add_action('admin_print_styles', array(&$this, 'add_link_styles'));
36
- }
37
-
38
- /**
39
- * Add a new link to the screen meta area.
40
- *
41
- * Do not call this method directly. Instead, use the global add_screen_meta_link() function.
42
- *
43
- * @param string $id Link ID. Should be unique and a valid value for a HTML ID attribute.
44
- * @param string $text Link text.
45
- * @param string $href Link URL.
46
- * @param string|array $page The page(s) where you want to add the link.
47
- * @param array $attributes Optional. Additional attributes for the link tag.
48
- * @return void
49
- */
50
- function add_screen_meta_link($id, $text, $href, $page, $attributes = null){
51
- if ( !is_array($page) ){
52
- $page = array($page);
53
- }
54
- if ( is_null($attributes) ){
55
- $attributes = array();
56
  }
57
-
58
- //Basically a list of props for a jQuery() call
59
- $link = compact('id', 'text', 'href');
60
- $link = array_merge($link, $attributes);
61
-
62
- //Add the CSS classes that will make the look like a proper meta link
63
- if ( empty($link['class']) ){
64
- $link['class'] = '';
 
 
 
 
 
 
 
65
  }
66
- $link['class'] = 'show-settings custom-screen-meta-link ' . $link['class'];
67
-
68
- //Save the link in each relevant page's list
69
- foreach($page as $page_id){
70
- if ( !isset($this->registered_links[$page_id]) ){
71
- $this->registered_links[$page_id] = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
- $this->registered_links[$page_id][] = $link;
74
- }
75
- }
76
-
77
- /**
78
- * Output the JS that appends the custom meta links to the page.
79
- * Callback for the 'admin_notices' action.
80
- *
81
- * @access private
82
- * @return void
83
- */
84
- function append_meta_links(){
85
- global $hook_suffix;
86
-
87
- //Find links registered for this page
88
- $links = $this->get_links_for_page($hook_suffix);
89
- if ( empty($links) ){
90
- return;
91
  }
92
-
93
- ?>
94
- <script type="text/javascript">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  (function($, links){
96
  var container = $('#screen-meta-links');
97
  if ( container.length == 0 ) {
@@ -109,185 +109,185 @@ class wsScreenMetaLinks11 {
109
  }
110
  })(jQuery, <?php echo $this->json_encode($links); ?>);
111
  </script>
112
- <?php
113
- }
114
-
115
- /**
116
- * Get a list of custom screen meta links registered for a specific page.
117
- *
118
- * @param string $page
119
- * @return array
120
- */
121
- function get_links_for_page($page){
122
- $links = array();
123
-
124
- if ( isset($this->registered_links[$page]) ){
125
- $links = array_merge($links, $this->registered_links[$page]);
126
  }
127
- $page_as_screen = $this->page_to_screen_id($page);
128
- if ( ($page_as_screen != $page) && isset($this->registered_links[$page_as_screen]) ){
129
- $links = array_merge($links, $this->registered_links[$page_as_screen]);
130
- }
131
-
132
- return $links;
133
- }
134
-
135
- /**
136
- * Output the CSS code for custom screen meta links. Required because WP only
137
- * has styles for specific meta links (by #id), not meta links in general.
138
- *
139
- * Callback for 'admin_print_styles'.
140
- *
141
- * @access private
142
- * @return void
143
- */
144
- function add_link_styles(){
145
- global $hook_suffix;
146
- //Don't output the CSS if there are no custom meta links for this page.
147
- $links = $this->get_links_for_page($hook_suffix);
148
- if ( empty($links) ){
149
- return;
150
- }
151
-
152
- if ( !isset($GLOBALS['wp_version']) || version_compare($GLOBALS['wp_version'], '3.8-RC1', '<') ) {
153
- $this->print_old_link_styles();
154
- } else {
155
- $this->print_link_styles();
156
- }
157
- }
158
 
159
- /**
160
- * Print screen meta button styles (WP 3.8+).
161
- */
162
- private function print_link_styles() {
163
- ?>
164
- <style type="text/css">
165
- .custom-screen-meta-link-wrap {
166
- float: right;
167
- height: 28px;
168
- margin: 0 0 0 6px;
169
-
170
- border: 1px solid #ddd;
171
- border-top: none;
172
- background: #fff;
173
- -webkit-box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
174
- box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
175
  }
176
 
177
- #screen-meta .custom-screen-meta-link-wrap a.custom-screen-meta-link,
178
- #screen-meta-links .custom-screen-meta-link-wrap a.custom-screen-meta-link
179
- {
180
- padding: 3px 16px 3px 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
182
 
183
- #screen-meta-links a.custom-screen-meta-link::after {
184
- display: none;
 
 
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  </style>
187
- <?php
188
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
- /**
191
- * Print old screen meta button styles (WP 3.7.x and older).
192
- */
193
- private function print_old_link_styles() {
194
- ?>
195
- <style type="text/css">
196
- .custom-screen-meta-link-wrap {
197
- float: right;
198
- height: 22px;
199
- padding: 0;
200
- margin: 0 0 0 6px;
201
- font-family: sans-serif;
202
- -moz-border-radius-bottomleft: 3px;
203
- -moz-border-radius-bottomright: 3px;
204
- -webkit-border-bottom-left-radius: 3px;
205
- -webkit-border-bottom-right-radius: 3px;
206
- border-bottom-left-radius: 3px;
207
- border-bottom-right-radius: 3px;
208
-
209
- background: #e3e3e3;
210
-
211
- border-right: 1px solid transparent;
212
- border-left: 1px solid transparent;
213
- border-bottom: 1px solid transparent;
214
- background-image: -ms-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* IE10 */
215
- background-image: -moz-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Firefox */
216
- background-image: -o-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Opera */
217
- background-image: -webkit-gradient(linear, left bottom, left top, from(#dfdfdf), to(#f1f1f1)); /* old Webkit */
218
- background-image: -webkit-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* new Webkit */
219
- background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */
220
  }
 
221
 
222
- #screen-meta .custom-screen-meta-link-wrap a.custom-screen-meta-link,
223
- #screen-meta-links .custom-screen-meta-link-wrap a.custom-screen-meta-link
224
- {
225
- background-image: none;
226
- padding-right: 6px;
227
- color: #777;
 
 
 
 
228
  }
229
- </style>
230
- <?php
231
- }
232
-
233
- /**
234
- * Convert a page hook name to a screen ID.
235
- *
236
- * @uses convert_to_screen()
237
- * @access private
238
- *
239
- * @param string $page
240
- * @return string
241
- */
242
- function page_to_screen_id($page){
243
- if ( function_exists('convert_to_screen') ){
244
- $screen = convert_to_screen($page);
245
- if ( isset($screen->id) ){
246
- return $screen->id;
247
  } else {
248
- return '';
 
249
  }
250
- } else {
251
- return str_replace( array('.php', '-new', '-add' ), '', $page);
252
  }
 
253
  }
254
-
255
- /**
256
- * Back-wards compatible json_encode(). Used to encode link data before
257
- * passing it to the JavaScript that actually creates the links.
258
- *
259
- * @param mixed $data
260
- * @return string
261
- */
262
- function json_encode($data){
263
- if ( function_exists('json_encode') ){
264
- return json_encode($data);
265
- }
266
- if ( class_exists('Services_JSON') ){
267
- $json = new Services_JSON();
268
- return( $json->encodeUnsafe($data) );
269
- } elseif ( class_exists('Moxiecode_JSON') ){
270
- $json = new Moxiecode_JSON();
271
- return $json->encode($data);
272
- } else {
273
- trigger_error('No JSON parser available', E_USER_ERROR);
274
- return null;
275
- }
276
- }
277
-
278
- }
279
 
280
- global $ws_screen_meta_links_versions;
281
- if ( !isset($ws_screen_meta_links_versions) ){
282
- $ws_screen_meta_links_versions = array();
283
- }
284
- $ws_screen_meta_links_versions['1.1'] = 'wsScreenMetaLinks11';
285
 
286
  endif;
287
 
288
  /**
289
  * Add a new link to the screen meta area.
290
- *
291
  * @param string $id Link ID. Should be unique and a valid value for a HTML ID attribute.
292
  * @param string $text Link text.
293
  * @param string $href Link URL.
@@ -297,7 +297,7 @@ endif;
297
  */
298
  function add_screen_meta_link($id, $text, $href, $page, $attributes = null){
299
  global $ws_screen_meta_links_versions;
300
-
301
  static $instance = null;
302
  if ( is_null($instance) ){
303
  //Instantiate the latest version of the wsScreenMetaLinks class
@@ -305,7 +305,7 @@ function add_screen_meta_link($id, $text, $href, $page, $attributes = null){
305
  $className = end($ws_screen_meta_links_versions);
306
  $instance = new $className;
307
  }
308
-
309
  $instance->add_screen_meta_link($id, $text, $href, $page, $attributes);
310
  }
311
 
9
  if ( !class_exists('wsScreenMetaLinks11') ):
10
 
11
  //Load JSON functions for PHP < 5.2
12
+ if ( !(function_exists('json_encode') && function_exists('json_decode')) && !(class_exists('Services_JSON') || class_exists('Moxiecode_JSON')) ){
13
+ $class_json_path = ABSPATH.WPINC.'/class-json.php';
14
+ $class_moxiecode_json_path = ABSPATH.WPINC.'/js/tinymce/plugins/spellchecker/classes/utils/JSON.php';
15
+ if ( file_exists($class_json_path) ){
16
+ require $class_json_path;
17
+
18
+ } elseif ( file_exists($class_moxiecode_json_path) ) {
19
+ require $class_moxiecode_json_path;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
+ }
22
+
23
+ class wsScreenMetaLinks11 {
24
+ var $registered_links; //List of meta links registered for each page.
25
+
26
+ /**
27
+ * Class constructor.
28
+ *
29
+ * @return void
30
+ */
31
+ function __construct(){
32
+ $this->registered_links = array();
33
+
34
+ add_action('admin_notices', array(&$this, 'append_meta_links'));
35
+ add_action('admin_print_styles', array(&$this, 'add_link_styles'));
36
  }
37
+
38
+ /**
39
+ * Add a new link to the screen meta area.
40
+ *
41
+ * Do not call this method directly. Instead, use the global add_screen_meta_link() function.
42
+ *
43
+ * @param string $id Link ID. Should be unique and a valid value for a HTML ID attribute.
44
+ * @param string $text Link text.
45
+ * @param string $href Link URL.
46
+ * @param string|array $page The page(s) where you want to add the link.
47
+ * @param array $attributes Optional. Additional attributes for the link tag.
48
+ * @return void
49
+ */
50
+ function add_screen_meta_link($id, $text, $href, $page, $attributes = null){
51
+ if ( !is_array($page) ){
52
+ $page = array($page);
53
+ }
54
+ if ( is_null($attributes) ){
55
+ $attributes = array();
56
+ }
57
+
58
+ //Basically a list of props for a jQuery() call
59
+ $link = compact('id', 'text', 'href');
60
+ $link = array_merge($link, $attributes);
61
+
62
+ //Add the CSS classes that will make the look like a proper meta link
63
+ if ( empty($link['class']) ){
64
+ $link['class'] = '';
65
+ }
66
+ $link['class'] = 'show-settings custom-screen-meta-link ' . $link['class'];
67
+
68
+ //Save the link in each relevant page's list
69
+ foreach($page as $page_id){
70
+ if ( !isset($this->registered_links[$page_id]) ){
71
+ $this->registered_links[$page_id] = array();
72
+ }
73
+ $this->registered_links[$page_id][] = $link;
74
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
+
77
+ /**
78
+ * Output the JS that appends the custom meta links to the page.
79
+ * Callback for the 'admin_notices' action.
80
+ *
81
+ * @access private
82
+ * @return void
83
+ */
84
+ function append_meta_links(){
85
+ global $hook_suffix;
86
+
87
+ //Find links registered for this page
88
+ $links = $this->get_links_for_page($hook_suffix);
89
+ if ( empty($links) ){
90
+ return;
91
+ }
92
+
93
+ ?>
94
+ <script type="text/javascript">
95
  (function($, links){
96
  var container = $('#screen-meta-links');
97
  if ( container.length == 0 ) {
109
  }
110
  })(jQuery, <?php echo $this->json_encode($links); ?>);
111
  </script>
112
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
+ /**
116
+ * Get a list of custom screen meta links registered for a specific page.
117
+ *
118
+ * @param string $page
119
+ * @return array
120
+ */
121
+ function get_links_for_page($page){
122
+ $links = array();
123
+
124
+ if ( isset($this->registered_links[$page]) ){
125
+ $links = array_merge($links, $this->registered_links[$page]);
126
+ }
127
+ $page_as_screen = $this->page_to_screen_id($page);
128
+ if ( ($page_as_screen != $page) && isset($this->registered_links[$page_as_screen]) ){
129
+ $links = array_merge($links, $this->registered_links[$page_as_screen]);
 
130
  }
131
 
132
+ return $links;
133
+ }
134
+
135
+ /**
136
+ * Output the CSS code for custom screen meta links. Required because WP only
137
+ * has styles for specific meta links (by #id), not meta links in general.
138
+ *
139
+ * Callback for 'admin_print_styles'.
140
+ *
141
+ * @access private
142
+ * @return void
143
+ */
144
+ function add_link_styles(){
145
+ global $hook_suffix;
146
+ //Don't output the CSS if there are no custom meta links for this page.
147
+ $links = $this->get_links_for_page($hook_suffix);
148
+ if ( empty($links) ){
149
+ return;
150
  }
151
 
152
+ if ( !isset($GLOBALS['wp_version']) || version_compare($GLOBALS['wp_version'], '3.8-RC1', '<') ) {
153
+ $this->print_old_link_styles();
154
+ } else {
155
+ $this->print_link_styles();
156
  }
157
+ }
158
+
159
+ /**
160
+ * Print screen meta button styles (WP 3.8+).
161
+ */
162
+ private function print_link_styles() {
163
+ ?>
164
+ <style type="text/css">
165
+ .custom-screen-meta-link-wrap {
166
+ float: right;
167
+ height: 28px;
168
+ margin: 0 0 0 6px;
169
+
170
+ border: 1px solid #ddd;
171
+ border-top: none;
172
+ background: #fff;
173
+ -webkit-box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
174
+ box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
175
+ }
176
+
177
+ #screen-meta .custom-screen-meta-link-wrap a.custom-screen-meta-link,
178
+ #screen-meta-links .custom-screen-meta-link-wrap a.custom-screen-meta-link
179
+ {
180
+ padding: 3px 16px 3px 16px;
181
+ }
182
+
183
+ #screen-meta-links a.custom-screen-meta-link::after {
184
+ display: none;
185
+ }
186
  </style>
187
+ <?php
188
+ }
189
+
190
+ /**
191
+ * Print old screen meta button styles (WP 3.7.x and older).
192
+ */
193
+ private function print_old_link_styles() {
194
+ ?>
195
+ <style type="text/css">
196
+ .custom-screen-meta-link-wrap {
197
+ float: right;
198
+ height: 22px;
199
+ padding: 0;
200
+ margin: 0 0 0 6px;
201
+ font-family: sans-serif;
202
+ -moz-border-radius-bottomleft: 3px;
203
+ -moz-border-radius-bottomright: 3px;
204
+ -webkit-border-bottom-left-radius: 3px;
205
+ -webkit-border-bottom-right-radius: 3px;
206
+ border-bottom-left-radius: 3px;
207
+ border-bottom-right-radius: 3px;
208
+
209
+ background: #e3e3e3;
210
+
211
+ border-right: 1px solid transparent;
212
+ border-left: 1px solid transparent;
213
+ border-bottom: 1px solid transparent;
214
+ background-image: -ms-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* IE10 */
215
+ background-image: -moz-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Firefox */
216
+ background-image: -o-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Opera */
217
+ background-image: -webkit-gradient(linear, left bottom, left top, from(#dfdfdf), to(#f1f1f1)); /* old Webkit */
218
+ background-image: -webkit-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* new Webkit */
219
+ background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */
220
+ }
221
 
222
+ #screen-meta .custom-screen-meta-link-wrap a.custom-screen-meta-link,
223
+ #screen-meta-links .custom-screen-meta-link-wrap a.custom-screen-meta-link
224
+ {
225
+ background-image: none;
226
+ padding-right: 6px;
227
+ color: #777;
228
+ }
229
+ </style>
230
+ <?php
231
+ }
232
+
233
+ /**
234
+ * Convert a page hook name to a screen ID.
235
+ *
236
+ * @uses convert_to_screen()
237
+ * @access private
238
+ *
239
+ * @param string $page
240
+ * @return string
241
+ */
242
+ function page_to_screen_id($page){
243
+ if ( function_exists('convert_to_screen') ){
244
+ $screen = convert_to_screen($page);
245
+ if ( isset($screen->id) ){
246
+ return $screen->id;
247
+ } else {
248
+ return '';
249
+ }
250
+ } else {
251
+ return str_replace( array('.php', '-new', '-add' ), '', $page);
252
  }
253
+ }
254
 
255
+ /**
256
+ * Back-wards compatible json_encode(). Used to encode link data before
257
+ * passing it to the JavaScript that actually creates the links.
258
+ *
259
+ * @param mixed $data
260
+ * @return string
261
+ */
262
+ function json_encode($data){
263
+ if ( function_exists('json_encode') ){
264
+ return json_encode($data);
265
  }
266
+ if ( class_exists('Services_JSON') ){
267
+ $json = new Services_JSON();
268
+ return( $json->encodeUnsafe($data) );
269
+ } elseif ( class_exists('Moxiecode_JSON') ){
270
+ $json = new Moxiecode_JSON();
271
+ return $json->encode($data);
 
 
 
 
 
 
 
 
 
 
 
 
272
  } else {
273
+ trigger_error('No JSON parser available', E_USER_ERROR);
274
+ return null;
275
  }
 
 
276
  }
277
+
278
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
+ global $ws_screen_meta_links_versions;
281
+ if ( !isset($ws_screen_meta_links_versions) ){
282
+ $ws_screen_meta_links_versions = array();
283
+ }
284
+ $ws_screen_meta_links_versions['1.1'] = 'wsScreenMetaLinks11';
285
 
286
  endif;
287
 
288
  /**
289
  * Add a new link to the screen meta area.
290
+ *
291
  * @param string $id Link ID. Should be unique and a valid value for a HTML ID attribute.
292
  * @param string $text Link text.
293
  * @param string $href Link URL.
297
  */
298
  function add_screen_meta_link($id, $text, $href, $page, $attributes = null){
299
  global $ws_screen_meta_links_versions;
300
+
301
  static $instance = null;
302
  if ( is_null($instance) ){
303
  //Instantiate the latest version of the wsScreenMetaLinks class
305
  $className = end($ws_screen_meta_links_versions);
306
  $instance = new $className;
307
  }
308
+
309
  $instance->add_screen_meta_link($id, $text, $href, $page, $attributes);
310
  }
311
 
modules/checkers/http.php CHANGED
@@ -229,7 +229,7 @@ class blcCurlHttp extends blcHttpCheckerBase {
229
  if( $parts['scheme'] == 'https' ){
230
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //Required to make HTTPS URLs work.
231
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
232
- $nobody = false; //Can't use HEAD with HTTPS.
233
  }
234
 
235
  if ( $nobody ){
229
  if( $parts['scheme'] == 'https' ){
230
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //Required to make HTTPS URLs work.
231
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
232
+ //$nobody = false; //Can't use HEAD with HTTPS.
233
  }
234
 
235
  if ( $nobody ){
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Broken Link Checker ===
2
- Contributors: managewp,freediver
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
  Tags: links, broken, maintenance, blogroll, custom fields, admin, comments, posts
5
  Requires at least: 3.2
6
- Tested up to: 4.3.1
7
- Stable tag: 1.10.10
8
 
9
  This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found.
10
 
@@ -22,8 +22,6 @@ This plugin will monitor your blog looking for broken links and let you know if
22
  * Links can be edited directly from the plugin's page, without manually updating each post.
23
  * Highly configurable.
24
 
25
- [Suggest new features and improvements here](http://feedback.w-shadow.com/forums/58400-broken-link-checker)
26
-
27
  **Basic Usage**
28
 
29
  Once installed, the plugin will begin parsing your posts, bookmarks (AKA blogroll) and other content and looking for links. Depending on the size of your site this can take from a few minutes up to an hour or more. When parsing is complete, the plugin will start checking each link to see if it works. Again, how long this takes depends on how big your site is and how many links there are. You can monitor the progress and tweak various link checking options in *Settings -> Link Checker*.
@@ -80,6 +78,10 @@ You can also click on the contents of the "Status" or "Link Text" columns to get
80
 
81
  This plugin uses some icons from the [Font Awesome icon font](http://fortawesome.github.io/Font-Awesome/). Font Awesome is licensed under SIL OFL 1.1.
82
 
 
 
 
 
83
  == Installation ==
84
 
85
  To do a new installation of the plugin, please follow these steps
@@ -99,6 +101,10 @@ To upgrade your installation
99
 
100
  == Changelog ==
101
 
 
 
 
 
102
  = 1.10.10 =
103
  * New plugin image that was long overdue.
104
 
1
  === Broken Link Checker ===
2
+ Contributors: freediver
3
+ Donate link:
4
  Tags: links, broken, maintenance, blogroll, custom fields, admin, comments, posts
5
  Requires at least: 3.2
6
+ Tested up to: 4.4.1
7
+ Stable tag: 1.10.11
8
 
9
  This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found.
10
 
22
  * Links can be edited directly from the plugin's page, without manually updating each post.
23
  * Highly configurable.
24
 
 
 
25
  **Basic Usage**
26
 
27
  Once installed, the plugin will begin parsing your posts, bookmarks (AKA blogroll) and other content and looking for links. Depending on the size of your site this can take from a few minutes up to an hour or more. When parsing is complete, the plugin will start checking each link to see if it works. Again, how long this takes depends on how big your site is and how many links there are. You can monitor the progress and tweak various link checking options in *Settings -> Link Checker*.
78
 
79
  This plugin uses some icons from the [Font Awesome icon font](http://fortawesome.github.io/Font-Awesome/). Font Awesome is licensed under SIL OFL 1.1.
80
 
81
+ **Contribute**
82
+
83
+ Broken Link Checker is now on [GitHub](https://github.com/ManageWP/broken-link-checker). Pull Requests welcome.
84
+
85
  == Installation ==
86
 
87
  To do a new installation of the plugin, please follow these steps
101
 
102
  == Changelog ==
103
 
104
+ = 1.10.11 =
105
+ * Fixed the issue with HTTPS (Thanks to [gmcinnes](https://wordpress.org/support/profile/gmcinnes))
106
+ * Broken Link Checker is now on [GitHub](https://github.com/ManageWP/broken-link-checker). Pull Requests welcome.
107
+
108
  = 1.10.10 =
109
  * New plugin image that was long overdue.
110