Broken Link Checker - Version 0.4.1

Version Description

Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Broken Link Checker
Version 0.4.1
Comparing to
See all releases

Code changes from version 0.4-i8n to 0.4.1

broken-link-checker-ru_RU.mo DELETED
Binary file
broken-link-checker-ru_RU.po DELETED
@@ -1,233 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Broken Link Checker 0.3.9 in Russian\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2008-06-28 12:23+0300\n"
6
- "PO-Revision-Date: \n"
7
- "Last-Translator: Anna Ozeritskaya <ozeritskaya@ftad.ru>\n"
8
- "Language-Team: Anna Ozeritskaya <feedback@hweia.ru>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-Language: Russian\n"
13
- "X-Poedit-Country: RUSSIAN FEDERATION\n"
14
- "X-Poedit-KeywordsList: __;_e\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-SearchPath-0: D:\\Projects\\wp-projects\\broken-link-checker\n"
17
-
18
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:343
19
- msgid "Link Checker Settings"
20
- msgstr "Настройка проверки ссылок"
21
-
22
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:343
23
- msgid "Link Checker"
24
- msgstr "Проверка ссылок"
25
-
26
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:345
27
- msgid "View Broken Links"
28
- msgstr "Просмотреть неправильные ссылки"
29
-
30
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:345
31
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:502
32
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:61
33
- msgid "Broken Links"
34
- msgstr "Неправильные ссылки"
35
-
36
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:391
37
- msgid "Broken Link Checker Options"
38
- msgstr "Настройка проверки ссылок"
39
-
40
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:393
41
- msgid ""
42
- "Error: <a href=\"http://curl.haxx.se/libcurl/php/\">CURL library</a>\n"
43
- "\t\t is not installed. This plugin won&rsquo;t work."
44
- msgstr "Ошибка: <a href='http://curl.haxx.se/libcurl/php/'>библиотека CURL</a> не установлена. Модуль не будет работать."
45
-
46
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:401
47
- msgid "Status:"
48
- msgstr "Состояние:"
49
-
50
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:418
51
- msgid "Re-check all pages"
52
- msgstr "Перепроверить все страницы"
53
-
54
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:423
55
- msgid "Check Every Post:"
56
- msgstr "Проверять записи:"
57
-
58
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:426
59
- msgid "Every"
60
- msgstr "Каждые"
61
-
62
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:428
63
- msgid "hours"
64
- msgstr "ч."
65
-
66
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:430
67
- msgid "Links in old posts will be re-checked this often. New posts will be usually checked ASAP."
68
- msgstr "Ссылки в старых записях будут перепроверяться с заданным интервалом. Новые записи будут проверяться по мере появления."
69
-
70
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:436
71
- msgid "Broken Link CSS:"
72
- msgstr "Стиль неправильных ссылок:"
73
-
74
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:440
75
- msgid "Apply <em>class=\"broken_link\"</em> to broken links"
76
- msgstr "Применить <em>class=\"broken_link\"</em> к неправильным ссылкам"
77
-
78
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:450
79
- msgid "Exclusion list:"
80
- msgstr "Исключения:"
81
-
82
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:451
83
- msgid "Don&rsquo;t check links where the URL contains any of these words (one per line):"
84
- msgstr "Не проверять ссылки, которые содержат одно из этих слов (по одному на строку):"
85
-
86
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:461
87
- msgid "Work Session Length:"
88
- msgstr "Длительность сессии:"
89
-
90
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:466
91
- msgid "seconds"
92
- msgstr "сек."
93
-
94
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:468
95
- msgid "The link checker does its work in short \"sessions\" while any page of the WP admin panel is open. Typically you won&rsquo;t need to change this value."
96
- msgstr "Проверка ссылок работает короткими сессиями, пока открыта любая из страниц панели администрирования WordPress. Как правило, менять этот параметр нет необходимости."
97
-
98
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:474
99
- msgid "\"Delete Post\" option:"
100
- msgstr "Ссылка \"Удалить запись\":"
101
-
102
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:480
103
- msgid "Display a \"Delete Post\" link in every row at the broken link list"
104
- msgstr "Отображать ссылку \"Удалить запись\" в каждом ряду списка неправильных ссылок"
105
-
106
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:481
107
- msgid "\"Delete Post\" link will be displayed at <em>Manage -&gt; Broken Links</em>. Not recommended."
108
- msgstr " Ссылка \"Удалить запись\" появится в меню <em>Управление -&gt; Неправильные ссылки</em>. Не рекомендуется."
109
-
110
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:488
111
- msgid "Update Options &raquo;"
112
- msgstr "Обновить настройки &raquo;"
113
-
114
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:503
115
- msgid "No broken links found"
116
- msgstr "Неправильных ссылок нет"
117
-
118
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:516
119
- msgid "#"
120
- msgstr "№"
121
-
122
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:518
123
- msgid "Post"
124
- msgstr "Запись"
125
-
126
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:519
127
- msgid "Link Text"
128
- msgstr "Текст ссылки"
129
-
130
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:520
131
- msgid "URL"
132
- msgstr "URL"
133
-
134
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:522
135
- msgid "Action"
136
- msgstr "Действие"
137
-
138
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:540
139
- msgid "Edit"
140
- msgstr "Редактировать"
141
-
142
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:545
143
- msgid "View"
144
- msgstr "Просмотр"
145
-
146
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:547
147
- msgid "Edit Post"
148
- msgstr "Редактировать запись"
149
-
150
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:553
151
- msgid "Delete Post"
152
- msgstr "Удалить запись"
153
-
154
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:557
155
- msgid "Discard This Message"
156
- msgstr "Сбросить это сообщение"
157
-
158
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:557
159
- msgid "Discard"
160
- msgstr "Сбросить"
161
-
162
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:560
163
- msgid "Remove the link from the post"
164
- msgstr "Удалить ссылку из записи"
165
-
166
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:560
167
- msgid "Unlink"
168
- msgstr "Удалить ссылку"
169
-
170
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:18
171
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:146
172
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:159
173
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:189
174
- msgid "Error: You can't do that. Access denied."
175
- msgstr "Ошибка: У вас нет прав на это действие. Доступ запрещен."
176
-
177
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:22
178
- msgid "Fatal error : undefined object; plugin may not be active."
179
- msgstr "Критическая ошибка: неопределенный объект. Модуль может быть отключен."
180
-
181
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:46
182
- msgid " hours"
183
- msgstr " ч."
184
-
185
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:47
186
- msgid "-20 minutes"
187
- msgstr "- 20 минут"
188
-
189
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:63
190
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:80
191
- msgid "View broken links"
192
- msgstr "Показать неправильные ссылки"
193
-
194
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:82
195
- msgid "No broken links found."
196
- msgstr "Неправильных ссылок нет."
197
-
198
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:90
199
- msgid "The work queue is empty."
200
- msgstr "Очередь обработки пуста."
201
-
202
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:151
203
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:181
204
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:219
205
- msgid "Error: Couldn't remove the link record (DB error)."
206
- msgstr "Ошибка: Невозможно удалить запись о ссылке (Ошибка базы данных)."
207
-
208
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:153
209
- msgid "OK: Link discarded"
210
- msgstr "ОК: Ссылка сброшена"
211
-
212
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:166
213
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:198
214
- msgid "Error: Link not found"
215
- msgstr "Ошибка: ссылка не найдена"
216
-
217
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:170
218
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:202
219
- msgid "Error: Post not found"
220
- msgstr "Ошибка: Запись не найдена"
221
-
222
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:177
223
- msgid "Error: Couldn't update the post"
224
- msgstr "Ошибка: Невозможно обновить запись"
225
-
226
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:184
227
- msgid "OK: Link deleted"
228
- msgstr "ОК: Ссылка удалена"
229
-
230
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:222
231
- msgid "OK: Link changed and deleted from the list of broken links."
232
- msgstr "ОК: Ссылка изменена и удалена из списка неправильных ссылок"
233
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
broken-link-checker.php CHANGED
@@ -3,7 +3,7 @@
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 posts for broken links and missing images and notifies you on the dashboard if any are found.
6
- Version: 0.4
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
@@ -13,13 +13,6 @@ Created by Janis Elsts (email : whiteshadow@w-shadow.com)
13
  MySQL 4.0 compatibility by Jeroen (www.yukka.eu)
14
  */
15
 
16
- ### Create text domain for translations
17
- add_action('init', 'linkchecker_textdomain');
18
- function linkchecker_textdomain() {
19
- load_plugin_textdomain('broken-link-checker', 'wp-content/plugins/broken-link-checker');
20
- }
21
-
22
-
23
  if (!class_exists('ws_broken_link_checker')) {
24
 
25
  class ws_broken_link_checker {
@@ -27,7 +20,7 @@ class ws_broken_link_checker {
27
  var $options_name='wsblc_options';
28
  var $postdata_name;
29
  var $linkdata_name;
30
- var $version='0.4';
31
  var $myfile='';
32
  var $myfolder='';
33
  var $mybasename='';
@@ -340,9 +333,9 @@ class ws_broken_link_checker {
340
  }
341
 
342
  function options_menu(){
343
- add_options_page(__('Link Checker Settings', 'broken-link-checker'), __('Link Checker', 'broken-link-checker'), 'manage_options',
344
  __FILE__,array(&$this, 'options_page'));
345
- add_management_page(__('View Broken Links', 'broken-link-checker'), __('Broken Links', 'broken-link-checker'), 'manage_options',
346
  __FILE__,array(&$this, 'broken_links_page'));
347
  }
348
 
@@ -388,17 +381,18 @@ class ws_broken_link_checker {
388
  }
389
  echo $reminder;
390
  ?>
391
- <div class="wrap"><h2><?php _e('Broken Link Checker Options', 'broken-link-checker'); ?></h2>
392
  <?php if(!function_exists('curl_init')){ ?>
393
- <strong><?php _e('Error: <a href="http://curl.haxx.se/libcurl/php/">CURL library</a>
394
- is not installed. This plugin won&rsquo;t work.', 'broken-link-checker'); ?></strong><br/>
395
  <?php }; ?>
396
  <form name="link_checker_options" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>&amp;updated=true">
397
- <br/>
398
- <table class="optiontable" cellpadding="10">
 
399
 
400
  <tr valign="top">
401
- <th scope="row" align="right"><?php _e('Status:', 'broken-link-checker'); ?></th>
402
  <td>
403
 
404
 
@@ -415,29 +409,29 @@ class ws_broken_link_checker {
415
  });
416
  </script>
417
  <?php //JHS: Recheck all posts link: ?>
418
- <p><input class="button" type="button" name="recheckbutton" value="<?php _e('Re-check all pages', 'broken-link-checker'); ?>" onclick="location.replace('<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>&amp;recheck=true')" /></p>
419
  </td>
420
  </tr>
421
 
422
  <tr valign="top">
423
- <th scope="row" align="right"><?php _e('Check Every Post:', 'broken-link-checker'); ?></th>
424
  <td>
425
 
426
- <?php _e('Every', 'broken-link-checker'); ?> <input type="text" name="check_treshold" id="check_treshold"
427
  value="<?php echo $this->options['check_treshold']; ?>" size='5' maxlength='3'/>
428
- <?php _e('hours', 'broken-link-checker'); ?>
429
  <br/>
430
- <small><?php _e('Links in old posts will be re-checked this often. New posts will be usually checked ASAP.', 'broken-link-checker'); ?></small>
431
 
432
  </td>
433
  </tr>
434
 
435
  <tr valign="top">
436
- <th scope="row" align="right"><?php _e('Broken Link CSS:', 'broken-link-checker'); ?></th>
437
  <td>
438
  <input type="checkbox" name="mark_broken_links" id="mark_broken_links"
439
  <?php if ($this->options['mark_broken_links']) echo ' checked="checked"'; ?>/>
440
- <label for='mark_broken_links'><?php _e('Apply <em>class="broken_link"</em> to broken links', 'broken-link-checker'); ?></label><br/>
441
  <textarea type="text" name="broken_link_css" id="broken_link_css" cols='40' rows='4'/><?php
442
  if( isset($this->options['broken_link_css']) )
443
  echo $this->options['broken_link_css'];
@@ -447,8 +441,8 @@ class ws_broken_link_checker {
447
  </tr>
448
 
449
  <tr valign="top">
450
- <th scope="row" align="right"><?php _e('Exclusion list:', 'broken-link-checker'); ?></th>
451
- <td><?php _e('Don&rsquo;t check links where the URL contains any of these words (one per line):', 'broken-link-checker'); ?><br/>
452
  <textarea type="text" name="exclusion_list" id="exclusion_list" cols='40' rows='4'/><?php
453
  if( isset($this->options['exclusion_list']) )
454
  echo implode("\n", $this->options['exclusion_list']);
@@ -458,34 +452,35 @@ class ws_broken_link_checker {
458
  </tr>
459
 
460
  <tr valign="top">
461
- <th scope="row" align="right"><?php _e('Work Session Length:', 'broken-link-checker'); ?></th>
462
  <td>
463
 
464
  <input type="text" name="max_work_session" id="max_work_session"
465
  value="<?php echo $this->options['max_work_session']; ?>" size='5' maxlength='3'/>
466
- <?php _e('seconds', 'broken-link-checker'); ?>
467
  <br/>
468
- <small><?php _e('The link checker does its work in short "sessions" while any page of the WP admin panel is open. Typically you won&rsquo;t need to change this value.', 'broken-link-checker'); ?></small>
 
469
 
470
  </td>
471
  </tr>
472
 
473
- <tr valign="top">
474
- <th scope="row" align="right"><?php _e('"Delete Post" option:', 'broken-link-checker'); ?></th>
475
  <td>
476
 
477
  <input type="checkbox" name="delete_post_button" id="delete_post_button"
478
  <?php if ($this->options['delete_post_button']) echo " checked='checked'"; ?>/>
479
  <label for='delete_post_button'>
480
- <?php _e('Display a "Delete Post" link in every row at the broken link list', 'broken-link-checker'); ?><br/>
481
- <small><?php _e('"Delete Post" link will be displayed at <em>Manage -&gt; Broken Links</em>. Not recommended.', 'broken-link-checker'); ?></small></label>
482
 
483
  </td>
484
  </tr>
485
 
486
  </table>
487
 
488
- <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;', 'broken-link-checker'); ?>" /></p>
489
  </form>
490
  </div>
491
  <?php
@@ -499,8 +494,8 @@ class ws_broken_link_checker {
499
  ?>
500
  <div class="wrap">
501
  <h2><?php
502
- echo ($broken_links>0)?"<span id='broken_link_count'>$broken_links</span> ".__("Broken Links", "broken-link-checker"):
503
- __("No broken links found", "broken-link-checker");
504
  ?></h2>
505
  <br style="clear:both;" />
506
  <?php
@@ -513,13 +508,13 @@ class ws_broken_link_checker {
513
  <thead>
514
  <tr>
515
 
516
- <th scope="col"><div style="text-align: center"><?php _e('#', 'broken-link-checker'); ?></div></th>
517
 
518
- <th scope="col"><?php _e('Post', 'broken-link-checker'); ?></th>
519
- <th scope="col"><?php _e('Link Text', 'broken-link-checker'); ?></th>
520
- <th scope="col"><?php _e('URL', 'broken-link-checker'); ?></th>
521
 
522
- <th scope="col" colspan='<?php echo ($this->options['delete_post_button'])?'5':'4';x ?>'><?php _e('Action', 'broken-link-checker'); ?></th>
523
 
524
  </tr>
525
  </thead>
@@ -537,27 +532,27 @@ class ws_broken_link_checker {
537
  <td>
538
  <a href='$link->url'>".$this->mytruncate($link->url)."</a>
539
  | <a href='javascript:editBrokenLink($link->id, \"$link->url\")'
540
- id='link-editor-button-$link->id'>".__("Edit", "broken-link-checker")."</a>
541
  <br />
542
  <input type='text' size='50' id='link-editor-$link->id' value='$link->url'
543
  class='link-editor' style='display:none' />
544
  </td>
545
- <td><a href='".(get_permalink($link->post_id))."' class='edit'>".__("View", "broken-link-checker")."</a></td>
546
 
547
- <td><a href='post.php?action=edit&amp;post=$link->post_id' class='edit'>".__("Edit Post", "broken-link-checker")."</a></td>";
548
 
549
  //the ""Delete Post"" button - optional
550
  if ($this->options['delete_post_button']){
551
  $deletion_url = "post.php?action=delete&post=$link->post_id";
552
  $deletion_url = wp_nonce_url($deletion_url, "delete-post_$link->post_id");
553
- echo "<td><a href='$deletion_url'>".__("Delete Post", "broken-link-checker")."</a></td>";
554
  }
555
 
556
  echo "<td><a href='javascript:void(0);' class='delete' id='discard_button-$link->id'
557
- onclick='discardLinkMessage($link->id);return false;' );' title='".__("Discard This Message", "broken-link-checker")."'>".__("Discard", "broken-link-checker")."</a></td>
558
 
559
  <td><a href='javascript:void(0);' class='delete' id='unlink_button-$link->id'
560
- onclick='removeLinkFromPost($link->id);return false;' );' title='".__("Remove the link from the post", "broken-link-checker")."'>".__("Unlink", "broken-link-checker")."</a></td>
561
  </tr>";
562
 
563
  }
@@ -616,7 +611,7 @@ class ws_broken_link_checker {
616
  $('link-'+link_id).hide();
617
  alterLinkCounter(-1);
618
  } else {
619
- $('unlink_button-'+link_id).innerHTML = __('Unlink', 'broken-link-checker');
620
  alert(response);
621
  }
622
  }
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 posts for broken links and missing images and notifies you on the dashboard if any are found.
6
+ Version: 0.4.1
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
13
  MySQL 4.0 compatibility by Jeroen (www.yukka.eu)
14
  */
15
 
 
 
 
 
 
 
 
16
  if (!class_exists('ws_broken_link_checker')) {
17
 
18
  class ws_broken_link_checker {
20
  var $options_name='wsblc_options';
21
  var $postdata_name;
22
  var $linkdata_name;
23
+ var $version='0.4.1';
24
  var $myfile='';
25
  var $myfolder='';
26
  var $mybasename='';
333
  }
334
 
335
  function options_menu(){
336
+ add_options_page('Link Checker Settings', 'Link Checker', 'manage_options',
337
  __FILE__,array(&$this, 'options_page'));
338
+ add_management_page('View Broken Links', 'Broken Links', 'manage_options',
339
  __FILE__,array(&$this, 'broken_links_page'));
340
  }
341
 
381
  }
382
  echo $reminder;
383
  ?>
384
+ <div class="wrap"><h2>Broken Link Checker Options</h2>
385
  <?php if(!function_exists('curl_init')){ ?>
386
+ <strong>Error: <a href='http://curl.haxx.se/libcurl/php/'>CURL library</a>
387
+ is not installed. This plugin won't work.</strong><br/>
388
  <?php }; ?>
389
  <form name="link_checker_options" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>&amp;updated=true">
390
+ <p class="submit"><input type="submit" name="Submit" value="Update Options &raquo;" /></p>
391
+
392
+ <table class="optiontable">
393
 
394
  <tr valign="top">
395
+ <th scope="row">Status:</th>
396
  <td>
397
 
398
 
409
  });
410
  </script>
411
  <?php //JHS: Recheck all posts link: ?>
412
+ <p><input class="button" type="button" name="recheckbutton" value="Re-check all pages" onclick="location.replace('<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>&amp;recheck=true')" /></p>
413
  </td>
414
  </tr>
415
 
416
  <tr valign="top">
417
+ <th scope="row">Check Every Post:</th>
418
  <td>
419
 
420
+ Every <input type="text" name="check_treshold" id="check_treshold"
421
  value="<?php echo $this->options['check_treshold']; ?>" size='5' maxlength='3'/>
422
+ hours
423
  <br/>
424
+ Links in old posts will be re-checked this often. New posts will be usually checked ASAP.
425
 
426
  </td>
427
  </tr>
428
 
429
  <tr valign="top">
430
+ <th scope="row">Broken Link CSS:</th>
431
  <td>
432
  <input type="checkbox" name="mark_broken_links" id="mark_broken_links"
433
  <?php if ($this->options['mark_broken_links']) echo ' checked="checked"'; ?>/>
434
+ <label for='mark_broken_links'>Apply <em>class="broken_link"</em> to broken links</label><br/>
435
  <textarea type="text" name="broken_link_css" id="broken_link_css" cols='40' rows='4'/><?php
436
  if( isset($this->options['broken_link_css']) )
437
  echo $this->options['broken_link_css'];
441
  </tr>
442
 
443
  <tr valign="top">
444
+ <th scope="row">Exclusion list:</th>
445
+ <td>Don't check links where the URL contains any of these words (one per line):<br/>
446
  <textarea type="text" name="exclusion_list" id="exclusion_list" cols='40' rows='4'/><?php
447
  if( isset($this->options['exclusion_list']) )
448
  echo implode("\n", $this->options['exclusion_list']);
452
  </tr>
453
 
454
  <tr valign="top">
455
+ <th scope="row">Work Session Length:</th>
456
  <td>
457
 
458
  <input type="text" name="max_work_session" id="max_work_session"
459
  value="<?php echo $this->options['max_work_session']; ?>" size='5' maxlength='3'/>
460
+ seconds
461
  <br/>
462
+ The link checker does its work in short "sessions" while any page of the WP admin panel is open.
463
+ Typically you won't need to change this value.
464
 
465
  </td>
466
  </tr>
467
 
468
+ <tr valign="top">
469
+ <th scope="row">"Delete Post" option:</th>
470
  <td>
471
 
472
  <input type="checkbox" name="delete_post_button" id="delete_post_button"
473
  <?php if ($this->options['delete_post_button']) echo " checked='checked'"; ?>/>
474
  <label for='delete_post_button'>
475
+ Display a "Delete Post" link in every row at the broken link list
476
+ (<em>Manage -&gt; Broken Links</em>). Not recommended.</label>
477
 
478
  </td>
479
  </tr>
480
 
481
  </table>
482
 
483
+ <p class="submit"><input type="submit" name="Submit" value="Update Options &raquo;" /></p>
484
  </form>
485
  </div>
486
  <?php
494
  ?>
495
  <div class="wrap">
496
  <h2><?php
497
+ echo ($broken_links>0)?"<span id='broken_link_count'>$broken_links</span> Broken Links":
498
+ "No broken links found";
499
  ?></h2>
500
  <br style="clear:both;" />
501
  <?php
508
  <thead>
509
  <tr>
510
 
511
+ <th scope="col"><div style="text-align: center">#</div></th>
512
 
513
+ <th scope="col">Post</th>
514
+ <th scope="col">Link Text</th>
515
+ <th scope="col">URL</th>
516
 
517
+ <th scope="col" colspan='<?php echo ($this->options['delete_post_button'])?'5':'4';x ?>'>Action</th>
518
 
519
  </tr>
520
  </thead>
532
  <td>
533
  <a href='$link->url'>".$this->mytruncate($link->url)."</a>
534
  | <a href='javascript:editBrokenLink($link->id, \"$link->url\")'
535
+ id='link-editor-button-$link->id'>Edit</a>
536
  <br />
537
  <input type='text' size='50' id='link-editor-$link->id' value='$link->url'
538
  class='link-editor' style='display:none' />
539
  </td>
540
+ <td><a href='".(get_permalink($link->post_id))."' class='edit'>View</a></td>
541
 
542
+ <td><a href='post.php?action=edit&amp;post=$link->post_id' class='edit'>Edit Post</a></td>";
543
 
544
  //the ""Delete Post"" button - optional
545
  if ($this->options['delete_post_button']){
546
  $deletion_url = "post.php?action=delete&post=$link->post_id";
547
  $deletion_url = wp_nonce_url($deletion_url, "delete-post_$link->post_id");
548
+ echo "<td><a href='$deletion_url'>Delete Post</a></td>";
549
  }
550
 
551
  echo "<td><a href='javascript:void(0);' class='delete' id='discard_button-$link->id'
552
+ onclick='discardLinkMessage($link->id);return false;' );' title='Discard This Message'>Discard</a></td>
553
 
554
  <td><a href='javascript:void(0);' class='delete' id='unlink_button-$link->id'
555
+ onclick='removeLinkFromPost($link->id);return false;' );' title='Remove the link from the post'>Unlink</a></td>
556
  </tr>";
557
 
558
  }
611
  $('link-'+link_id).hide();
612
  alterLinkCounter(-1);
613
  } else {
614
+ $('unlink_button-'+link_id).innerHTML = 'Unlink';
615
  alert(response);
616
  }
617
  }
broken-link-checker.pot DELETED
@@ -1,231 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Broken Link Checker 0.3.9\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2008-06-28 12:29+0300\n"
6
- "PO-Revision-Date: 2008-06-28 12:30+0300\n"
7
- "Last-Translator: Anna Ozeritskaya <ozeritskaya@ftad.ru>\n"
8
- "Language-Team: \n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-KeywordsList: __;_e\n"
13
- "X-Poedit-Basepath: .\n"
14
- "X-Poedit-SearchPath-0: D:\\Projects\\wp-projects\\broken-link-checker\n"
15
-
16
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:343
17
- msgid "Link Checker Settings"
18
- msgstr ""
19
-
20
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:343
21
- msgid "Link Checker"
22
- msgstr ""
23
-
24
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:345
25
- msgid "View Broken Links"
26
- msgstr ""
27
-
28
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:345
29
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:502
30
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:61
31
- msgid "Broken Links"
32
- msgstr ""
33
-
34
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:391
35
- msgid "Broken Link Checker Options"
36
- msgstr ""
37
-
38
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:393
39
- msgid ""
40
- "Error: <a href=\"http://curl.haxx.se/libcurl/php/\">CURL library</a>\n"
41
- "\t\t is not installed. This plugin won&rsquo;t work."
42
- msgstr ""
43
-
44
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:401
45
- msgid "Status:"
46
- msgstr ""
47
-
48
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:418
49
- msgid "Re-check all pages"
50
- msgstr ""
51
-
52
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:423
53
- msgid "Check Every Post:"
54
- msgstr ""
55
-
56
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:426
57
- msgid "Every"
58
- msgstr ""
59
-
60
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:428
61
- msgid "hours"
62
- msgstr ""
63
-
64
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:430
65
- msgid "Links in old posts will be re-checked this often. New posts will be usually checked ASAP."
66
- msgstr ""
67
-
68
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:436
69
- msgid "Broken Link CSS:"
70
- msgstr ""
71
-
72
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:440
73
- msgid "Apply <em>class=\"broken_link\"</em> to broken links"
74
- msgstr ""
75
-
76
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:450
77
- msgid "Exclusion list:"
78
- msgstr ""
79
-
80
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:451
81
- msgid "Don&rsquo;t check links where the URL contains any of these words (one per line):"
82
- msgstr ""
83
-
84
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:461
85
- msgid "Work Session Length:"
86
- msgstr ""
87
-
88
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:466
89
- msgid "seconds"
90
- msgstr ""
91
-
92
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:468
93
- msgid "The link checker does its work in short \"sessions\" while any page of the WP admin panel is open. Typically you won&rsquo;t need to change this value."
94
- msgstr ""
95
-
96
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:474
97
- msgid "\"Delete Post\" option:"
98
- msgstr ""
99
-
100
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:480
101
- msgid "Display a \"Delete Post\" link in every row at the broken link list"
102
- msgstr ""
103
-
104
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:481
105
- msgid "\"Delete Post\" link will be displayed at <em>Manage -&gt; Broken Links</em>. Not recommended."
106
- msgstr ""
107
-
108
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:488
109
- msgid "Update Options &raquo;"
110
- msgstr ""
111
-
112
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:503
113
- msgid "No broken links found"
114
- msgstr ""
115
-
116
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:516
117
- msgid "#"
118
- msgstr ""
119
-
120
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:518
121
- msgid "Post"
122
- msgstr ""
123
-
124
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:519
125
- msgid "Link Text"
126
- msgstr ""
127
-
128
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:520
129
- msgid "URL"
130
- msgstr ""
131
-
132
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:522
133
- msgid "Action"
134
- msgstr ""
135
-
136
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:540
137
- msgid "Edit"
138
- msgstr ""
139
-
140
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:545
141
- msgid "View"
142
- msgstr ""
143
-
144
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:547
145
- msgid "Edit Post"
146
- msgstr ""
147
-
148
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:553
149
- msgid "Delete Post"
150
- msgstr ""
151
-
152
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:557
153
- msgid "Discard This Message"
154
- msgstr ""
155
-
156
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:557
157
- msgid "Discard"
158
- msgstr ""
159
-
160
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:560
161
- msgid "Remove the link from the post"
162
- msgstr ""
163
-
164
- #: D:\Projects\wp-projects\broken-link-checker/broken-link-checker.php:560
165
- msgid "Unlink"
166
- msgstr ""
167
-
168
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:18
169
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:146
170
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:159
171
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:189
172
- msgid "Error: You can't do that. Access denied."
173
- msgstr ""
174
-
175
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:22
176
- msgid "Fatal error : undefined object; plugin may not be active."
177
- msgstr ""
178
-
179
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:46
180
- msgid " hours"
181
- msgstr ""
182
-
183
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:47
184
- msgid "-20 minutes"
185
- msgstr ""
186
-
187
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:63
188
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:80
189
- msgid "View broken links"
190
- msgstr ""
191
-
192
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:82
193
- msgid "No broken links found."
194
- msgstr ""
195
-
196
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:90
197
- msgid "The work queue is empty."
198
- msgstr ""
199
-
200
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:151
201
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:181
202
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:219
203
- msgid "Error: Couldn't remove the link record (DB error)."
204
- msgstr ""
205
-
206
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:153
207
- msgid "OK: Link discarded"
208
- msgstr ""
209
-
210
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:166
211
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:198
212
- msgid "Error: Link not found"
213
- msgstr ""
214
-
215
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:170
216
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:202
217
- msgid "Error: Post not found"
218
- msgstr ""
219
-
220
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:177
221
- msgid "Error: Couldn't update the post"
222
- msgstr ""
223
-
224
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:184
225
- msgid "OK: Link deleted"
226
- msgstr ""
227
-
228
- #: D:\Projects\wp-projects\broken-link-checker/wsblc_ajax.php:222
229
- msgid "OK: Link changed and deleted from the list of broken links."
230
- msgstr ""
231
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: whiteshadow
3
  Tags: links, broken, maintenance
4
  Requires at least: 2.0.2
5
  Tested up to: 2.5.1
6
- Stable tag: 0.4
7
 
8
  This plugin will check your posts for broken links and missing images in background and notify you on the dashboard if any are found.
9
 
3
  Tags: links, broken, maintenance
4
  Requires at least: 2.0.2
5
  Tested up to: 2.5.1
6
+ Stable tag: 0.4.1
7
 
8
  This plugin will check your posts for broken links and missing images in background and notify you on the dashboard if any are found.
9
 
wsblc_ajax.php CHANGED
@@ -15,11 +15,11 @@
15
  }
16
 
17
  if (!current_user_can('read')) {
18
- die(__("Error: You can't do that. Access denied.", "broken-link-checker"));
19
  }
20
 
21
  if(!is_object($ws_link_checker)) {
22
- die(__('Fatal error : undefined object; plugin may not be active.', 'broken-link-checker'));
23
  };
24
 
25
  $url_pattern='/(<a[\s]+[^>]*href\s*=\s*[\"\']?)([^\'\" >]+)([\'\"]+[^<>]*>)((?sU).*)(<\/a>)/i';
@@ -58,9 +58,9 @@
58
  $broken_links=$wpdb->get_var($sql);
59
  if($broken_links>0){
60
  echo "<div>
61
- <h3>".__("Broken Links", "broken-link-checker")."</h3>
62
  <p><a href='".get_option('siteurl')."/wp-admin/edit.php?page=".
63
- $ws_link_checker->mybasename."' title='".__("View broken links", "broken-link-checker")."'>".__("Found $broken_links broken links", "broken-link-checker")."</a></p>
64
  </div>";
65
  };
66
 
@@ -77,17 +77,17 @@
77
 
78
  if($broken_links>0){
79
  echo "<a href='".get_option('siteurl')."/wp-admin/edit.php?page=".
80
- $ws_link_checker->mybasename."' title='".__("View broken links", "broken-link-checker")."'><strong>".__("Found $broken_links broken links", "broken-link-checker")."</strong></a>";
81
  } else {
82
- echo __("No broken links found.", "broken-link-checker");
83
  }
84
 
85
  echo "<br/>";
86
 
87
  if($posts_unchecked || $links_unchecked) {
88
- echo __("$posts_unchecked posts and $links_unchecked links in the work queue.", "broken-link-checker");
89
  } else {
90
- echo __("The work queue is empty.", "broken-link-checker");
91
  }
92
 
93
 
@@ -143,50 +143,50 @@
143
 
144
  } else if ($action=='discard_link'){
145
  if (!current_user_can('edit_posts')) {
146
- die(__("Error: You can't do that. Access denied.", "broken-link-checker"));
147
  }
148
  $id=intval($_GET['id']);
149
  $wpdb->query("DELETE FROM $linkdata_name WHERE id=$id LIMIT 1");
150
  if($wpdb->rows_affected<1){
151
- die(__('Error: Couldn\'t remove the link record (DB error).', 'broken-link-checker'));
152
  }
153
- die(__('OK: Link discarded', 'broken-link-checker'));
154
 
155
  } else if ($action=='remove_link'){
156
 
157
  //actually deletes the link from the post
158
  if (!current_user_can('edit_posts')) {
159
- die(__("Error: You can't do that. Access denied.", 'broken-link-checker'));
160
  }
161
 
162
  $id=intval($_GET['id']);
163
  $sql="SELECT * FROM $linkdata_name WHERE id = $id LIMIT 1";
164
  $the_link=$wpdb->get_row($sql, OBJECT, 0);
165
  if (!$the_link){
166
- die(__('Error: Link not found', 'broken-link-checker'));
167
  }
168
  $the_post = get_post($the_link->post_id, ARRAY_A);
169
  if (!$the_post){
170
- die(__('Error: Post not found', 'broken-link-checker'));
171
  }
172
 
173
  $new_content = unlink_the_link($the_post['post_content'], $the_link->url);
174
  $new_content = $wpdb->escape($new_content);
175
  $wpdb->query("UPDATE $wpdb->posts SET post_content = '$new_content' WHERE id = $the_link->post_id");
176
  if($wpdb->rows_affected<1){
177
- die(__('Error: Couldn\'t update the post', 'broken-link-checker').' ('.mysql_error().').');
178
  }
179
  $wpdb->query("DELETE FROM $linkdata_name WHERE id=$id LIMIT 1");
180
  if($wpdb->rows_affected<1){
181
- die(__('Error: Couldn\'t remove the link record (DB error).', 'broken-link-checker'));
182
  }
183
 
184
- die(__('OK: Link deleted', 'broken-link-checker'));
185
 
186
  } else if ($action == 'edit_link'){
187
  //edits the link's URL inside the post
188
  if (!current_user_can('edit_posts')) {
189
- die(__("Error: You can't do that. Access denied.", "broken-link-checker"));
190
  }
191
 
192
  $id = intval($_GET['id']);
@@ -195,11 +195,11 @@
195
  $sql="SELECT * FROM $linkdata_name WHERE id = $id LIMIT 1";
196
  $the_link=$wpdb->get_row($sql, OBJECT, 0);
197
  if (!$the_link){
198
- die(__('Error: Link not found', 'broken-link-checker'));
199
  }
200
  $the_post = get_post($the_link->post_id, ARRAY_A);
201
  if (!$the_post){
202
- die(__('Error: Post not found', 'broken-link-checker'));
203
  }
204
 
205
  $new_content = edit_the_link($the_post['post_content'], $the_link->url, $new_url);
@@ -216,10 +216,10 @@
216
  }
217
  $wpdb->query("DELETE FROM $linkdata_name WHERE id=$id LIMIT 1");
218
  if($wpdb->rows_affected<1){
219
- die(__('Error: Couldn\'t remove the link record (DB error).', 'broken-link-checker'));
220
  }
221
 
222
- die(__('OK: Link changed and deleted from the list of broken links.', 'broken-link-checker'));
223
  };
224
 
225
  function parse_link($matches, $post_id){
15
  }
16
 
17
  if (!current_user_can('read')) {
18
+ die("Error: You can't do that. Access denied.");
19
  }
20
 
21
  if(!is_object($ws_link_checker)) {
22
+ die('Fatal error : undefined object; plugin may not be active.');
23
  };
24
 
25
  $url_pattern='/(<a[\s]+[^>]*href\s*=\s*[\"\']?)([^\'\" >]+)([\'\"]+[^<>]*>)((?sU).*)(<\/a>)/i';
58
  $broken_links=$wpdb->get_var($sql);
59
  if($broken_links>0){
60
  echo "<div>
61
+ <h3>Broken Links</h3>
62
  <p><a href='".get_option('siteurl')."/wp-admin/edit.php?page=".
63
+ $ws_link_checker->mybasename."' title='View broken links'>Found $broken_links broken links</a></p>
64
  </div>";
65
  };
66
 
77
 
78
  if($broken_links>0){
79
  echo "<a href='".get_option('siteurl')."/wp-admin/edit.php?page=".
80
+ $ws_link_checker->mybasename."' title='View broken links'><strong>Found $broken_links broken links</strong></a>";
81
  } else {
82
+ echo "No broken links found.";
83
  }
84
 
85
  echo "<br/>";
86
 
87
  if($posts_unchecked || $links_unchecked) {
88
+ echo "$posts_unchecked posts and $links_unchecked links in the work queue.";
89
  } else {
90
+ echo "The work queue is empty.";
91
  }
92
 
93
 
143
 
144
  } else if ($action=='discard_link'){
145
  if (!current_user_can('edit_posts')) {
146
+ die("Error: You can't do that. Access denied.");
147
  }
148
  $id=intval($_GET['id']);
149
  $wpdb->query("DELETE FROM $linkdata_name WHERE id=$id LIMIT 1");
150
  if($wpdb->rows_affected<1){
151
+ die('Error: Couldn\'t remove the link record (DB error).');
152
  }
153
+ die('OK: Link discarded');
154
 
155
  } else if ($action=='remove_link'){
156
 
157
  //actually deletes the link from the post
158
  if (!current_user_can('edit_posts')) {
159
+ die("Error: You can't do that. Access denied.");
160
  }
161
 
162
  $id=intval($_GET['id']);
163
  $sql="SELECT * FROM $linkdata_name WHERE id = $id LIMIT 1";
164
  $the_link=$wpdb->get_row($sql, OBJECT, 0);
165
  if (!$the_link){
166
+ die('Error: Link not found');
167
  }
168
  $the_post = get_post($the_link->post_id, ARRAY_A);
169
  if (!$the_post){
170
+ die('Error: Post not found');
171
  }
172
 
173
  $new_content = unlink_the_link($the_post['post_content'], $the_link->url);
174
  $new_content = $wpdb->escape($new_content);
175
  $wpdb->query("UPDATE $wpdb->posts SET post_content = '$new_content' WHERE id = $the_link->post_id");
176
  if($wpdb->rows_affected<1){
177
+ die('Error: Couldn\'t update the post ('.mysql_error().').');
178
  }
179
  $wpdb->query("DELETE FROM $linkdata_name WHERE id=$id LIMIT 1");
180
  if($wpdb->rows_affected<1){
181
+ die('Error: Couldn\'t remove the link record (DB error).');
182
  }
183
 
184
+ die('OK: Link deleted');
185
 
186
  } else if ($action == 'edit_link'){
187
  //edits the link's URL inside the post
188
  if (!current_user_can('edit_posts')) {
189
+ die("Error: You can't do that. Access denied.");
190
  }
191
 
192
  $id = intval($_GET['id']);
195
  $sql="SELECT * FROM $linkdata_name WHERE id = $id LIMIT 1";
196
  $the_link=$wpdb->get_row($sql, OBJECT, 0);
197
  if (!$the_link){
198
+ die('Error: Link not found');
199
  }
200
  $the_post = get_post($the_link->post_id, ARRAY_A);
201
  if (!$the_post){
202
+ die('Error: Post not found');
203
  }
204
 
205
  $new_content = edit_the_link($the_post['post_content'], $the_link->url, $new_url);
216
  }
217
  $wpdb->query("DELETE FROM $linkdata_name WHERE id=$id LIMIT 1");
218
  if($wpdb->rows_affected<1){
219
+ die('Error: Couldn\'t remove the link record (DB error).');
220
  }
221
 
222
+ die('OK: Link changed and deleted from the list of broken links.');
223
  };
224
 
225
  function parse_link($matches, $post_id){