Broken Link Checker - Version 0.6

Version Description

  • Initial localization support.
Download this release

Release Info

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

Code changes from version 0.5.18 to 0.6

broken-link-checker.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Broken Link Checker
5
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
6
  Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
7
- Version: 0.5.18
8
  Author: Janis Elsts
9
  Author URI: http://w-shadow.com/blog/
10
  */
4
  Plugin Name: Broken Link Checker
5
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
6
  Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
7
+ Version: 0.6
8
  Author: Janis Elsts
9
  Author URI: http://w-shadow.com/blog/
10
  */
core.php CHANGED
@@ -45,6 +45,8 @@ class wsBrokenLinkChecker {
45
  add_action('activate_' . plugin_basename( $this->loader ), array(&$this,'activation'));
46
  $this->my_basename = plugin_basename( $this->loader );
47
 
 
 
48
  add_action('admin_menu', array(&$this,'admin_menu'));
49
 
50
  //These hooks update the plugin's internal records when posts are added, deleted or modified.
@@ -127,7 +129,7 @@ class wsBrokenLinkChecker {
127
 
128
  function dashboard_widget(){
129
  ?>
130
- <p id='wsblc_activity_box'>Loading...</p>
131
  <script type='text/javascript'>
132
  jQuery( function($){
133
  var blc_was_autoexpanded = false;
@@ -150,7 +152,7 @@ class wsBrokenLinkChecker {
150
  };
151
  <?php } ?>
152
  } else {
153
- $('#wsblc_activity_box').html('[ Network error ]');
154
  }
155
 
156
  setTimeout( blcDashboardStatus, 120*1000 ); //...update every two minutes
@@ -175,7 +177,7 @@ class wsBrokenLinkChecker {
175
  ?>
176
  <p><label for="blc-autoexpand">
177
  <input id="blc-autoexpand" name="blc-autoexpand" type="checkbox" value="1" <?php if ( $this->conf->options['autoexpand_widget'] ) echo 'checked="checked"'; ?> />
178
- Automatically expand the widget if broken links have been detected
179
  </label></p>
180
  <?php
181
  }
@@ -354,7 +356,7 @@ class wsBrokenLinkChecker {
354
  )";
355
  if ( $wpdb->query( $q ) === false ){
356
  if ( $die_on_error )
357
- die('Database error : ' . $wpdb->last_error);
358
  };
359
 
360
  //Fix URL fields so that they are collated as case-sensitive (this can't be done via dbDelta)
@@ -363,7 +365,7 @@ class wsBrokenLinkChecker {
363
  MODIFY final_url text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL";
364
  if ( $wpdb->query( $q ) === false ){
365
  if ( $die_on_error )
366
- die('Database error : ' . $wpdb->last_error);
367
  };
368
 
369
  //Create the instance table if it doesn't exist yet.
@@ -381,7 +383,7 @@ class wsBrokenLinkChecker {
381
  )";
382
  if ( $wpdb->query( $q ) === false ){
383
  if ( $die_on_error )
384
- die('Database error : ' . $wpdb->last_error);
385
  };
386
 
387
  //....
@@ -395,7 +397,7 @@ class wsBrokenLinkChecker {
395
  )";
396
  if ( $wpdb->query( $q ) === false ){
397
  if ( $die_on_error )
398
- die('Database error : ' . $wpdb->last_error);
399
  };
400
 
401
  $this->conf->options['current_db_version'] = $this->db_version;
@@ -417,16 +419,24 @@ class wsBrokenLinkChecker {
417
  }
418
 
419
  function admin_menu(){
420
- $options_page_hook = add_options_page('Link Checker Settings', 'Link Checker', 'manage_options',
421
- 'link-checker-settings',array(&$this, 'options_page'));
 
 
 
 
422
  //Add the hook that will add the plugin's CSS styles to it's settings page
423
  add_action( 'admin_print_styles-' . $options_page_hook, array(&$this, 'options_page_css') );
424
 
425
  if (current_user_can('manage_options'))
426
- add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2);
427
 
428
- add_management_page('View Broken Links', 'Broken Links', 'edit_others_posts',
429
- 'view-broken-links',array(&$this, 'links_page'));
 
 
 
 
430
  }
431
 
432
  /**
@@ -520,7 +530,7 @@ class wsBrokenLinkChecker {
520
 
521
  ?>
522
 
523
- <div class="wrap"><h2>Broken Link Checker Options</h2>
524
 
525
  <form name="link_checker_options" method="post" action="<?php
526
  echo admin_url('options-general.php?page=link-checker-settings&noheader=1');
@@ -533,9 +543,9 @@ class wsBrokenLinkChecker {
533
 
534
  <tr valign="top">
535
  <th scope="row">
536
- Status
537
  <br>
538
- <a href="javascript:void(0)" id="blc-debug-info-toggle">Show debug info</a>
539
  </th>
540
  <td>
541
 
@@ -556,7 +566,7 @@ class wsBrokenLinkChecker {
556
  if ( data && ( typeof(data['text']) != 'undefined' ) ){
557
  $('#wsblc_full_status').html(data.text);
558
  } else {
559
- $('#wsblc_full_status').html('[ Network error ]');
560
  }
561
 
562
  setTimeout(blcUpdateStatus, 10000); //...update every 10 seconds
@@ -568,7 +578,10 @@ class wsBrokenLinkChecker {
568
  })(jQuery);
569
  </script>
570
  <?php //JHS: Recheck all posts link: ?>
571
- <p><input class="button" type="button" name="recheckbutton" value="Re-check all pages" onclick="location.replace('<?php echo basename($_SERVER['PHP_SELF']); ?>?page=link-checker-settings&amp;recheck=true')" /></p>
 
 
 
572
 
573
  <table id="blc-debug-info">
574
  <?php
@@ -590,27 +603,33 @@ class wsBrokenLinkChecker {
590
  </tr>
591
 
592
  <tr valign="top">
593
- <th scope="row">Check each link</th>
594
  <td>
595
 
596
- Every <input type="text" name="check_threshold" id="check_threshold"
597
- value="<?php echo $this->conf->options['check_threshold']; ?>" size='5' maxlength='5'/>
598
- hours
 
 
 
 
 
 
599
  <br/>
600
  <span class="description">
601
- Existing links will be checked this often. New links will usually be checked ASAP.
602
  </span>
603
 
604
  </td>
605
  </tr>
606
 
607
  <tr valign="top">
608
- <th scope="row">Broken link CSS</th>
609
  <td>
610
  <label for='mark_broken_links'>
611
  <input type="checkbox" name="mark_broken_links" id="mark_broken_links"
612
  <?php if ($this->conf->options['mark_broken_links']) echo ' checked="checked"'; ?>/>
613
- Apply <em>class="broken_link"</em> to broken links
614
  </label>
615
  <br/>
616
  <textarea name="broken_link_css" id="broken_link_css" cols='45' rows='4'/><?php
@@ -622,8 +641,8 @@ class wsBrokenLinkChecker {
622
  </tr>
623
 
624
  <tr valign="top">
625
- <th scope="row">Exclusion list</th>
626
- <td>Don't check links where the URL contains any of these words (one per line) :<br/>
627
  <textarea name="exclusion_list" id="exclusion_list" cols='45' rows='4' wrap='off'/><?php
628
  if( isset($this->conf->options['exclusion_list']) )
629
  echo implode("\n", $this->conf->options['exclusion_list']);
@@ -633,8 +652,8 @@ class wsBrokenLinkChecker {
633
  </tr>
634
 
635
  <tr valign="top">
636
- <th scope="row">Custom fields</th>
637
- <td>Check URLs entered in these custom fields (one per line) : <br/>
638
  <textarea name="blc_custom_fields" id="blc_custom_fields" cols='45' rows='4' /><?php
639
  if( isset($this->conf->options['custom_fields']) )
640
  echo implode("\n", $this->conf->options['custom_fields']);
@@ -645,20 +664,20 @@ class wsBrokenLinkChecker {
645
 
646
  </table>
647
 
648
- <h3>Advanced</h3>
649
 
650
  <table class="form-table">
651
 
652
 
653
  <tr valign="top">
654
- <th scope="row">Timeout</th>
655
  <td>
656
 
657
  <input type="text" name="timeout" id="blc_timeout"
658
  value="<?php echo $this->conf->options['timeout']; ?>" size='5' maxlength='3'/>
659
  seconds
660
  <br/><span class="description">
661
- Links that take longer than this to load will be marked as broken.
662
  </span>
663
 
664
  </td>
@@ -667,7 +686,7 @@ class wsBrokenLinkChecker {
667
 
668
  <tr valign="top">
669
  <th scope="row">
670
- <a name='lockfile_directory'></a>Custom temporary directory</th>
671
  <td>
672
 
673
  <input type="text" name="custom_tmp_dir" id="custom_tmp_dir"
@@ -676,36 +695,51 @@ class wsBrokenLinkChecker {
676
  if ( !empty( $this->conf->options['custom_tmp_dir'] ) ) {
677
  if ( is_dir( $this->conf->options['custom_tmp_dir'] ) ){
678
  if ( is_writable( $this->conf->options['custom_tmp_dir'] ) ){
679
- echo "<strong>OK</strong>";
680
  } else {
681
- echo '<span class="error">Error : This directory isn\'t writable by PHP.</span>';
 
 
682
  }
683
  } else {
684
- echo '<span class="error">Error : This directory doesn\'t exist.</span>';
 
 
685
  }
686
  }
687
 
688
  ?>
689
  <br/>
690
  <span class="description">
691
- Set this field if you want the plugin to use a custom directory for its lockfiles.
692
- Otherwise, leave it blank.
693
  </span>
694
 
695
  </td>
696
  </tr>
697
 
698
  <tr valign="top">
699
- <th scope="row">Max. execution time</th>
700
  <td>
701
 
702
- <input type="text" name="max_execution_time" id="max_execution_time"
703
- value="<?php echo $this->conf->options['max_execution_time']; ?>" size='5' maxlength='5'/>
704
- seconds
 
 
 
 
 
 
 
 
705
  <br/><span class="description">
706
- The plugin works by periodically creating a background worker instance that parses your posts looking for links,
 
 
707
  checks the discovered URLs, and performs other time-consuming tasks. Here you can set for how long, at most,
708
- the background instance may run each time before stopping.
 
 
709
  </span>
710
 
711
  </td>
@@ -726,9 +760,9 @@ class wsBrokenLinkChecker {
726
  var box = $('#blc-debug-info');
727
  box.toggle();
728
  if( box.is(':visible') ){
729
- toggleButton.text('Hide debug info');
730
  } else {
731
- toggleButton.text('Show debug info');
732
  }
733
 
734
  });
@@ -789,22 +823,22 @@ class wsBrokenLinkChecker {
789
  $filters = array(
790
  'broken' => array(
791
  'where_expr' => '( http_code < 200 OR http_code >= 400 OR timeout = 1 ) AND ( check_count > 0 ) AND ( http_code <> ' . BLC_CHECKING . ')',
792
- 'name' => 'Broken',
793
- 'heading' => 'Broken Links',
794
- 'heading_zero' => 'No broken links found'
795
  ),
796
  'redirects' => array(
797
  'where_expr' => '( redirect_count > 0 )',
798
- 'name' => 'Redirects',
799
- 'heading' => 'Redirected Links',
800
- 'heading_zero' => 'No redirects found'
801
  ),
802
 
803
  'all' => array(
804
  'where_expr' => '1',
805
- 'name' => 'All',
806
- 'heading' => 'Detected Links',
807
- 'heading_zero' => 'No links found (yet)'
808
  ),
809
  );
810
 
@@ -864,7 +898,7 @@ class wsBrokenLinkChecker {
864
  echo '</pre>';
865
  //*/
866
  } else {
867
- echo $wpdb->last_error;
868
  }
869
  ?>
870
 
@@ -981,13 +1015,15 @@ class wsBrokenLinkChecker {
981
  <?php
982
  if ( ('post' == $link['source_type']) || ('custom_field' == $link['source_type']) ){
983
 
984
- echo "<a class='row-title' href='post.php?action=edit&amp;post=$link[source_id]' title='Edit this post'>{$link[post_title]}</a>";
 
 
985
 
986
  //Output inline action links (copied from edit-post-rows.php)
987
  $actions = array();
988
  if ( current_user_can('edit_post', $link['source_id']) ) {
989
  $actions['edit'] = '<span class="edit"><a href="' . get_edit_post_link($link['source_id'], true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>';
990
- $actions['delete'] = "<span class='delete'><a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=".$link['source_id'], 'delete-post_' . $link['source_id']) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete the post '%s'\n 'Cancel' to stop, 'OK' to delete."), $link['post_title'] )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
991
  }
992
  $actions['view'] = '<span class="view"><a href="' . get_permalink($link['source_id']) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $link['post_title'])) . '" rel="permalink">' . __('View') . '</a>';
993
  echo '<div class="row-actions">';
@@ -996,12 +1032,12 @@ class wsBrokenLinkChecker {
996
 
997
  } elseif ( 'blogroll' == $link['source_type'] ) {
998
 
999
- echo "<a class='row-title' href='link.php?action=edit&amp;link_id=$link[source_id]' title='Edit this bookmark'>{$link[link_text]}</a>";
1000
 
1001
  //Output inline action links
1002
  $actions = array();
1003
  if ( current_user_can('manage_links') ) {
1004
- $actions['edit'] = '<span class="edit"><a href="link.php?action=edit&amp;link_id=' . $link['source_id'] . '" title="' . attribute_escape(__('Edit this bookmark')) . '">' . __('Edit') . '</a>';
1005
  $actions['delete'] = "<span class='delete'><a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id={$link[source_id]}", 'delete-bookmark_' . $link['source_id']) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link['link_text'])) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
1006
  }
1007
 
@@ -1011,7 +1047,7 @@ class wsBrokenLinkChecker {
1011
 
1012
  } elseif ( empty($link['source_type']) ){
1013
 
1014
- echo "[An orphaned link! This is a bug.]";
1015
 
1016
  }
1017
  ?>
@@ -1022,19 +1058,30 @@ class wsBrokenLinkChecker {
1022
  if ( 'link' == $link['instance_type'] ) {
1023
  print strip_tags($link['link_text']);
1024
  } elseif ( 'image' == $link['instance_type'] ){
1025
- echo "<img src='" . WP_PLUGIN_URL . "/broken-link-checker/images/image.png' class='blc-small-image' alt='Image' title='Image'> Image";
 
 
 
 
1026
  } else {
1027
  echo '[ ??? ]';
1028
  }
1029
 
1030
  } elseif ( 'custom_field' == $link['source_type'] ){
1031
 
1032
- echo "<img src='" . WP_PLUGIN_URL . "/broken-link-checker/images/script_code.png' class='blc-small-image' title='Custom field' alt='Custom field'> ";
 
 
 
 
1033
  echo "<code>".$link['link_text']."</code>";
1034
 
1035
  } elseif ( 'blogroll' == $link['source_type'] ){
1036
- //echo $link['link_text'];
1037
- echo "<img src='" . WP_PLUGIN_URL . "/broken-link-checker/images/link.png' class='blc-small-image' title='Bookmark' alt='Bookmark'> Bookmark";
 
 
 
1038
  }
1039
  ?>
1040
  </td>
@@ -1048,25 +1095,25 @@ class wsBrokenLinkChecker {
1048
  //Output inline action links for the link/URL
1049
  $actions = array();
1050
 
1051
- $actions['details'] = "<span class='view'><a class='blc-details-button' href='javascript:void(0)' title='Show more info about this link'>Details</a>";
1052
 
1053
- $actions['delete'] = "<span class='delete'><a class='submitdelete blc-unlink-button' title='Remove this link from all posts' ".
1054
- "id='unlink-button-$rownum' href='javascript:void(0);'>Unlink</a>";
1055
 
1056
  if ( $excluded ){
1057
- $actions['exclude'] = "<span class='delete'>Excluded";
1058
  } else {
1059
- $actions['exclude'] = "<span class='delete'><a class='submitdelete blc-exclude-button' title='Add this URL to the exclusion list' ".
1060
- "id='exclude-button-$rownum' href='javascript:void(0);'>Exclude</a>";
1061
  }
1062
 
1063
- $actions['edit'] = "<span class='edit'><a href='javascript:void(0)' class='blc-edit-button' title='Edit link URL'>Edit URL</a>";
1064
 
1065
  echo '<div class="row-actions">';
1066
  echo implode(' | </span>', $actions);
1067
 
1068
  echo "<span style='display:none' class='blc-cancel-button-container'> ",
1069
- "| <a href='javascript:void(0)' class='blc-cancel-button' title='Cancel URL editing'>Cancel</a></span>";
1070
 
1071
  echo '</div>';
1072
  ?>
@@ -1075,7 +1122,11 @@ class wsBrokenLinkChecker {
1075
  <td><a href='javascript:void(0);'
1076
  id='discard_button-<?php print $rownum; ?>'
1077
  class='blc-discard-button'
1078
- title='Remove this message and mark the link as valid'>Discard</a>
 
 
 
 
1079
  </td>
1080
  <?php } ?>
1081
  </tr>
@@ -1120,7 +1171,7 @@ jQuery(function($){
1120
  //The discard button - manually mark the link as valid. The link will be checked again later.
1121
  $(".blc-discard-button").click(function () {
1122
  var me = this;
1123
- $(me).html('Wait...');
1124
 
1125
  var link_id = $(me).parents('.blc-row').find('.blc-link-id').html();
1126
 
@@ -1144,7 +1195,7 @@ jQuery(function($){
1144
 
1145
  alterLinkCounter(-1);
1146
  } else {
1147
- $(me).html('Discard');
1148
  alert(data);
1149
  }
1150
  }
@@ -1178,7 +1229,7 @@ jQuery(function($){
1178
  cancel_button_container.show();
1179
  editor.focus();
1180
  editor.select();
1181
- edit_button.html('Save URL');
1182
  } else {
1183
  editor.hide();
1184
  cancel_button_container.hide();
@@ -1188,7 +1239,7 @@ jQuery(function($){
1188
 
1189
  if (new_url != orig_url){
1190
  //Save the changed link
1191
- url_el.html('Saving changes...');
1192
 
1193
  $.getJSON(
1194
  "<?php echo admin_url('admin-ajax.php'); ?>",
@@ -1212,6 +1263,7 @@ jQuery(function($){
1212
  url_el.attr('href', new_url);
1213
 
1214
  if ( data.cnt_error > 0 ){
 
1215
  var msg = "The link was successfully modifed.";
1216
  msg = msg + "\nHowever, "+data.cnt_error+" instances couldn't be edited and still point to the old URL."
1217
  alert(msg);
@@ -1223,7 +1275,7 @@ jQuery(function($){
1223
  //Save the new ID
1224
  master.find('.blc-link-id').html(data.new_link_id);
1225
  //Load up the new link info (so sue me)
1226
- master.next('.blc-link-details').find('td').html('<center>Loading...</center>').load(
1227
  "<?php echo admin_url('admin-ajax.php'); ?>",
1228
  {
1229
  'action' : 'blc_link_details',
@@ -1232,6 +1284,7 @@ jQuery(function($){
1232
  );
1233
  }
1234
  } else {
 
1235
  alert("Something went wrong. The plugin failed to edit "+
1236
  data.cnt_error + ' instance(s) of this link.');
1237
 
@@ -1254,6 +1307,19 @@ jQuery(function($){
1254
  }
1255
  });
1256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1257
  $(".blc-cancel-button").click(function () {
1258
  var master = $(this).parents('.blc-row');
1259
  var url_el = $(master).find('.blc-link-url');
@@ -1265,14 +1331,14 @@ jQuery(function($){
1265
  //reset and hide the editor
1266
  master.find('.blc-link-editor').hide().val(url_el.attr('href'));
1267
  //Set the edit button to say "Edit URL"
1268
- master.find('.blc-edit-button').html('Edit URL');
1269
  });
1270
 
1271
  //The unlink button - remove the link/image from all posts, custom fields, etc.
1272
  $(".blc-unlink-button").click(function () {
1273
  var me = this;
1274
  var master = $(me).parents('.blc-row');
1275
- $(me).html('Wait...');
1276
 
1277
  var link_id = $(me).parents('.blc-row').find('.blc-link-id').html();
1278
 
@@ -1296,7 +1362,7 @@ jQuery(function($){
1296
 
1297
  alterLinkCounter(-1);
1298
  } else {
1299
- $(me).html('Unlink');
1300
  //Show the error message
1301
  alert(data.error);
1302
  }
@@ -1309,7 +1375,7 @@ jQuery(function($){
1309
  var me = this;
1310
  var master = $(me).parents('.blc-row');
1311
  var details = master.next('.blc-link-details');
1312
- $(me).html('Wait...');
1313
 
1314
  var link_id = $(me).parents('.blc-row').find('.blc-link-id').html();
1315
 
@@ -1326,7 +1392,7 @@ jQuery(function($){
1326
 
1327
  if ( 'broken' == blc_current_filter ){
1328
  //Flash the row green to indicate success, then hide it.
1329
- $(me).replaceWith('Excluded');
1330
  master.animate({ backgroundColor: "#E0FFB3" }, 200).animate({ backgroundColor: '#E2E2E2' }, 200, function(){
1331
  details.hide();
1332
  master.hide();
@@ -1337,10 +1403,10 @@ jQuery(function($){
1337
  //Flash the row green to indicate success and fade to the "excluded link" color
1338
  master.animate({ backgroundColor: "#E0FFB3" }, 200).animate({ backgroundColor: '#E2E2E2' }, 300);
1339
  master.addClass('blc-excluded-link');
1340
- $(me).replaceWith('Excluded');
1341
  }
1342
  } else {
1343
- $(me).html('Exclude');
1344
  alert(data.error);
1345
  }
1346
  }
@@ -1362,7 +1428,7 @@ jQuery(function($){
1362
  print $link['last_check'];
1363
  ?></span>
1364
  <ol style='list-style-type: none; width: 50%; float: right;'>
1365
- <li><strong>Log :</strong>
1366
  <span class='blc_log'><?php
1367
  print nl2br($link['log']);
1368
  ?></span></li>
@@ -1370,56 +1436,55 @@ jQuery(function($){
1370
 
1371
  <ol style='list-style-type: none; padding-left: 2px;'>
1372
  <?php if ( !empty($link['post_date']) ) { ?>
1373
- <li><strong>Post published on :</strong>
1374
  <span class='post_date'><?php
1375
  print strftime("%B %d, %Y",strtotime($link['post_date']));
1376
  ?></span></li>
1377
  <?php } ?>
1378
- <li><strong>Link last checked :</strong>
1379
  <span class='check_date'><?php
1380
  $last_check = strtotime($link['last_check']);
1381
  if ( $last_check < strtotime('-10 years') ){
1382
- echo 'Never';
1383
  } else {
1384
  echo strftime( "%B %d, %Y", $last_check );
1385
  }
1386
  ?></span></li>
1387
 
1388
- <li><strong>HTTP code :</strong>
1389
  <span class='http_code'><?php
1390
  print $link['http_code'];
1391
  ?></span></li>
1392
 
1393
- <li><strong>Response time :</strong>
1394
  <span class='request_duration'><?php
1395
- printf('%2.3f seconds', $link['request_duration']);
1396
  ?></span></li>
1397
 
1398
- <li><strong>Final URL :</strong>
1399
  <span class='final_url'><?php
1400
  print $link['final_url'];
1401
  ?></span></li>
1402
 
1403
- <li><strong>Redirect count :</strong>
1404
  <span class='redirect_count'><?php
1405
  print $link['redirect_count'];
1406
  ?></span></li>
1407
 
1408
- <li><strong>Instance count :</strong>
1409
  <span class='instance_count'><?php
1410
  print $link['instance_count'];
1411
  ?></span></li>
1412
 
1413
  <?php if ( intval( $link['check_count'] ) > 0 ){ ?>
1414
- <li><br/>This link has failed
1415
- <span class='check_count'><?php
1416
- echo $link['check_count'];
1417
- if ( intval($link['check_count'])==1 ){
1418
- echo ' time';
1419
- } else {
1420
- echo ' times';
1421
- }
1422
- ?></span>.</li>
1423
  <?php } ?>
1424
  </ol>
1425
  <?php
@@ -1805,7 +1870,7 @@ jQuery(function($){
1805
  $link_obj->http_code = 200; //Use a fake code so that the link doesn't show up in queries looking for broken links.
1806
  $link_obj->timeout = false;
1807
  $link_obj->request_duration = 0;
1808
- $link_obj->log = "This link wasn't checked because a matching keyword was found on your exclusion list.";
1809
  $link_obj->save();
1810
  }
1811
 
@@ -1846,36 +1911,45 @@ jQuery(function($){
1846
  $text = '';
1847
 
1848
  if( $status['broken_links'] > 0 ){
1849
- $text .= sprintf( "<a href='%s' title='View broken links'><strong>Found %d broken link%s</strong></a>",
1850
- admin_url('tools.php?page=view-broken-links'), $status['broken_links'], ( $status['broken_links'] == 1 )?'':'s' );
 
 
 
 
 
1851
  } else {
1852
- $text .= "No broken links found.";
1853
  }
1854
 
1855
  $text .= "<br/>";
1856
 
1857
  if( $status['unchecked_links'] > 0) {
1858
- $text .= sprintf( '%d URL%s in the work queue', $status['unchecked_links'], ($status['unchecked_links'] == 1)?'':'s' );
 
 
1859
  } else {
1860
- $text .= "No URLs in the work queue.";
1861
  }
1862
 
1863
  $text .= "<br/>";
1864
  if ( $status['known_links'] > 0 ){
1865
- $text .= sprintf( "Detected %d unique URL%s in %d link%s",
1866
- $status['known_links'], $status['known_links'] == 1 ? '' : 's',
1867
- $status['known_instances'], $status['known_instances'] == 1 ? '' : 's'
 
 
1868
  );
1869
  if ($this->conf->options['need_resynch']){
1870
- $text .= ' and still searching...';
1871
  } else {
1872
  $text .= '.';
1873
  }
1874
  } else {
1875
  if ($this->conf->options['need_resynch']){
1876
- $text .= 'Searching your blog for links...';
1877
  } else {
1878
- $text .= 'No links detected.';
1879
  }
1880
  }
1881
 
@@ -1944,7 +2018,7 @@ jQuery(function($){
1944
  function ajax_discard(){
1945
  //TODO:Rewrite to use JSON instead of plaintext
1946
  if (!current_user_can('edit_others_posts')){
1947
- die( "You're not allowed to do that!" );
1948
  }
1949
 
1950
  if ( isset($_POST['link_id']) ){
@@ -1952,30 +2026,31 @@ jQuery(function($){
1952
  $link = new blcLink( intval($_POST['link_id']) );
1953
 
1954
  if ( !$link->valid() ){
1955
- die("Oops, I can't find the link ".intval($_POST['link_id']) );
 
1956
  }
1957
  //Make it appear "not broken"
1958
  $link->last_check = date('Y-m-d H:i:s');
1959
  $link->http_code = 200;
1960
  $link->timeout = 0;
1961
  $link->check_count = 0;
1962
- $link->log = "This link was manually marked as working by the user.";
1963
 
1964
  //Save the changes
1965
  if ( $link->save() ){
1966
- die("OK");
1967
  } else {
1968
- die("Oops, couldn't modify the link!");
1969
  }
1970
  } else {
1971
- die("Error : link_id not specified");
1972
  }
1973
  }
1974
 
1975
  function ajax_edit(){
1976
  if (!current_user_can('edit_others_posts')){
1977
  die( json_encode( array(
1978
- 'error' => "You're not allowed to do that!"
1979
  )));
1980
  }
1981
 
@@ -1985,14 +2060,14 @@ jQuery(function($){
1985
 
1986
  if ( !$link->valid() ){
1987
  die( json_encode( array(
1988
- 'error' => "Oops, I can't find the link ".intval($_GET['link_id'])
1989
  )));
1990
  }
1991
 
1992
  $new_url = blcUtility::normalize_url($_GET['new_url']);
1993
  if ( !$new_url ){
1994
  die( json_encode( array(
1995
- 'error' => "Oops, the new URL is invalid!"
1996
  )));
1997
  }
1998
 
@@ -2001,16 +2076,16 @@ jQuery(function($){
2001
 
2002
  if ( $rez == false ){
2003
  die( json_encode( array(
2004
- 'error' => "An unexpected error occured!"
2005
  )));
2006
  } else {
2007
- $rez['ok'] = 'OK';
2008
  die( json_encode($rez) );
2009
  }
2010
 
2011
  } else {
2012
  die( json_encode( array(
2013
- 'error' => "Error : link_id or new_url not specified"
2014
  )));
2015
  }
2016
  }
@@ -2018,7 +2093,7 @@ jQuery(function($){
2018
  function ajax_unlink(){
2019
  if (!current_user_can('edit_others_posts')){
2020
  die( json_encode( array(
2021
- 'error' => "You're not allowed to do that!"
2022
  )));
2023
  }
2024
 
@@ -2028,24 +2103,24 @@ jQuery(function($){
2028
 
2029
  if ( !$link->valid() ){
2030
  die( json_encode( array(
2031
- 'error' => "Oops, I can't find the link ".intval($_POST['link_id'])
2032
  )));
2033
  }
2034
 
2035
  //Try and unlink it
2036
  if ( $link->unlink() ){
2037
  die( json_encode( array(
2038
- 'ok' => "URL {$link->url} was removed."
2039
  )));
2040
  } else {
2041
  die( json_encode( array(
2042
- 'error' => "The plugin failed to remove the link."
2043
  )));
2044
  }
2045
 
2046
  } else {
2047
  die( json_encode( array(
2048
- 'error' => "Error : link_id not specified"
2049
  )));
2050
  }
2051
  }
@@ -2054,7 +2129,7 @@ jQuery(function($){
2054
  global $wpdb;
2055
 
2056
  if (!current_user_can('edit_others_posts')){
2057
- die("You don't have sufficient privileges to access this information!");
2058
  }
2059
 
2060
  //FB::log("Loading link details via AJAX");
@@ -2067,7 +2142,7 @@ jQuery(function($){
2067
  $link_id = intval($_POST['link_id']);
2068
  } else {
2069
  //FB::error('Link ID not specified, you hacking bastard.');
2070
- die('Error : link ID not specified');
2071
  }
2072
 
2073
  //Load the link. link_details_row needs it as an array, so
@@ -2091,14 +2166,15 @@ jQuery(function($){
2091
  $this->link_details_row($link);
2092
  die();
2093
  } else {
2094
- die ("Failed to load link details (" . $wpdb->last_error . ")");
 
2095
  }
2096
  }
2097
 
2098
  function ajax_exclude_link(){
2099
  if ( !current_user_can('manage_options') ){
2100
  die( json_encode( array(
2101
- 'error' => "You're not allowed to do that!"
2102
  )));
2103
  }
2104
 
@@ -2108,7 +2184,7 @@ jQuery(function($){
2108
 
2109
  if ( !$link->valid() ){
2110
  die( json_encode( array(
2111
- 'error' => "Oops, I can't find the link ".intval($_POST['link_id'])
2112
  )));
2113
  }
2114
 
@@ -2121,18 +2197,18 @@ jQuery(function($){
2121
  $link->http_code = 200; //Use a fake code so that the link doesn't show up in queries looking for broken links.
2122
  $link->timeout = false;
2123
  $link->request_duration = 0;
2124
- $link->log = "This link wasn't checked because a matching keyword was found on your exclusion list.";
2125
  $link->save();
2126
  }
2127
 
2128
  $this->conf->save_options();
2129
 
2130
  die( json_encode( array(
2131
- 'ok' => "URL {$link->url} added to the exclusion list"
2132
  )));
2133
  } else {
2134
  die( json_encode( array(
2135
- 'error' => "Link ID not specified"
2136
  )));
2137
  }
2138
  }
@@ -2219,16 +2295,14 @@ jQuery(function($){
2219
  return dirname(__FILE__) . '/wp_blc_lock';
2220
  } else {
2221
 
2222
- //Try the upload directory. I know it's weird to try the upload dir. before
2223
- //trying the system-wide /tmp, but trying them in this order *may* fix
2224
- //open_basedir problems for some users.
2225
- $path = ini_get('upload_tmp_dir');
2226
  if ( $path && is_writable($path)){
2227
  return trailingslashit($path) . 'wp_blc_lock';
2228
  }
2229
 
2230
- //Try the system-wide temp directory
2231
- $path = sys_get_temp_dir();
2232
  if ( $path && is_writable($path)){
2233
  return trailingslashit($path) . 'wp_blc_lock';
2234
  }
@@ -2284,32 +2358,30 @@ jQuery(function($){
2284
  //Make the notice customized to the current settings
2285
  if ( !empty($this->conf->options['custom_tmp_dir']) ){
2286
  $action_notice = sprintf(
2287
- 'The current temporary directory is not accessible;
2288
- please <a href="%s">set a different one</a>.',
2289
  $settings_page
2290
  );
2291
  } else {
2292
  $action_notice = sprintf(
2293
- 'Please make the directory <code>%s</code> writable by plugins or
2294
- <a href="%s">set a custom temporary directory</a>.',
2295
  $my_dir, $settings_page
2296
  );
2297
  }
2298
 
2299
  echo sprintf('
2300
  <div id="blc-lockfile-warning" class="error"><p>
2301
- <strong>Broken Link Checker can\'t create a lockfile.</strong> %s
2302
- <a href="javascript:void(0)" onclick="jQuery(\'#blc-lockfile-details\').toggle()">Details</a>
2303
- </p>
2304
 
2305
- <div id="blc-lockfile-details" style="display:none;"><p>
2306
- The plugin uses a file-based locking mechanism to ensure that only one instance of the
2307
  resource-heavy link checking algorithm is running at any given time. Unfortunately,
2308
- BLC can\'t find a writable directory where it could store the lockfile - it failed to
2309
- detect the location of your server\'s temporary directory, and the plugin\'s own directory
2310
- isn\'t writable by PHP. To fix this problem, please make the plugin\'s directory writable
2311
- or enter a specify a custom temporary directory in the plugin\'s settings.
2312
- </p>
2313
  </div>
2314
  </div>',
2315
  $action_notice);
@@ -2328,13 +2400,13 @@ jQuery(function($){
2328
  $debug = array();
2329
 
2330
  //PHP version. Any one is fine as long as WP supports it.
2331
- $debug['PHP version'] = array(
2332
  'state' => 'ok',
2333
  'value' => phpversion(),
2334
  );
2335
 
2336
  //MySQL version
2337
- $debug['MySQL version'] = array(
2338
  'state' => 'ok',
2339
  'value' => @mysql_get_server_info( $wpdb->dbh ),
2340
  );
@@ -2347,7 +2419,7 @@ jQuery(function($){
2347
  $data = array(
2348
  'state' => 'warning',
2349
  'value' => $version['version'],
2350
- 'message' => 'You have an old version of CURL. Redirect detection may not work properly.',
2351
  );
2352
  } else {
2353
  $data = array(
@@ -2359,29 +2431,29 @@ jQuery(function($){
2359
  } else {
2360
  $data = array(
2361
  'state' => 'warning',
2362
- 'value' => 'Not installed',
2363
  );
2364
  }
2365
- $debug['CURL version'] = $data;
2366
 
2367
  //Snoopy presence
2368
  if ( class_exists('Snoopy') ){
2369
  $data = array(
2370
  'state' => 'ok',
2371
- 'value' => 'Installed',
2372
  );
2373
  } else {
2374
  //No Snoopy? This should never happen, but if it does we *must* have CURL.
2375
  if ( function_exists('curl_init') ){
2376
  $data = array(
2377
  'state' => 'ok',
2378
- 'value' => 'Not installed',
2379
  );
2380
  } else {
2381
  $data = array(
2382
  'state' => 'error',
2383
- 'value' => 'Not installed',
2384
- 'message' => 'You must have either CURL or Snoopy installed for the plugin to work!',
2385
  );
2386
  }
2387
 
@@ -2392,13 +2464,13 @@ jQuery(function($){
2392
  if ( blcUtility::is_safe_mode() ){
2393
  $debug['Safe mode'] = array(
2394
  'state' => 'warning',
2395
- 'value' => 'On',
2396
- 'message' => 'Redirects may be detected as broken links when safe_mode is on.',
2397
  );
2398
  } else {
2399
  $debug['Safe mode'] = array(
2400
  'state' => 'ok',
2401
- 'value' => 'Off',
2402
  );
2403
  }
2404
 
@@ -2406,13 +2478,13 @@ jQuery(function($){
2406
  if ( blcUtility::is_open_basedir() ){
2407
  $debug['open_basedir'] = array(
2408
  'state' => 'warning',
2409
- 'value' => 'On ( ' . ini_get('open_basedir') . ' )',
2410
- 'message' => 'Redirects may be detected as broken links when open_basedir is on.',
2411
  );
2412
  } else {
2413
  $debug['open_basedir'] = array(
2414
  'state' => 'ok',
2415
- 'value' => 'Off',
2416
  );
2417
  }
2418
 
@@ -2426,12 +2498,22 @@ jQuery(function($){
2426
  } else {
2427
  $debug['Lockfile'] = array(
2428
  'state' => 'error',
2429
- 'message' => 'Can\'t create a lockfile. Please specify a custom temporary directory.',
2430
  );
2431
  }
2432
 
2433
  return $debug;
2434
  }
 
 
 
 
 
 
 
 
 
 
2435
 
2436
  }//class ends here
2437
 
45
  add_action('activate_' . plugin_basename( $this->loader ), array(&$this,'activation'));
46
  $this->my_basename = plugin_basename( $this->loader );
47
 
48
+ add_action('init', array(&$this,'load_language'));
49
+
50
  add_action('admin_menu', array(&$this,'admin_menu'));
51
 
52
  //These hooks update the plugin's internal records when posts are added, deleted or modified.
129
 
130
  function dashboard_widget(){
131
  ?>
132
+ <p id='wsblc_activity_box'><?php _e('Loading...', 'broken-link-checker'); ?></p>
133
  <script type='text/javascript'>
134
  jQuery( function($){
135
  var blc_was_autoexpanded = false;
152
  };
153
  <?php } ?>
154
  } else {
155
+ $('#wsblc_activity_box').html('<?php _e('[ Network error ]', 'broken-link-checker'); ?>');
156
  }
157
 
158
  setTimeout( blcDashboardStatus, 120*1000 ); //...update every two minutes
177
  ?>
178
  <p><label for="blc-autoexpand">
179
  <input id="blc-autoexpand" name="blc-autoexpand" type="checkbox" value="1" <?php if ( $this->conf->options['autoexpand_widget'] ) echo 'checked="checked"'; ?> />
180
+ <?php _e('Automatically expand the widget if broken links have been detected', 'broken-link-checker'); ?>
181
  </label></p>
182
  <?php
183
  }
356
  )";
357
  if ( $wpdb->query( $q ) === false ){
358
  if ( $die_on_error )
359
+ die( sprintf( __('Database error : %s', 'broken-link-checker'), $wpdb->last_error) );
360
  };
361
 
362
  //Fix URL fields so that they are collated as case-sensitive (this can't be done via dbDelta)
365
  MODIFY final_url text CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL";
366
  if ( $wpdb->query( $q ) === false ){
367
  if ( $die_on_error )
368
+ die( sprintf( __('Database error : %s', 'broken-link-checker'), $wpdb->last_error) );
369
  };
370
 
371
  //Create the instance table if it doesn't exist yet.
383
  )";
384
  if ( $wpdb->query( $q ) === false ){
385
  if ( $die_on_error )
386
+ die( sprintf( __('Database error : %s', 'broken-link-checker'), $wpdb->last_error) );
387
  };
388
 
389
  //....
397
  )";
398
  if ( $wpdb->query( $q ) === false ){
399
  if ( $die_on_error )
400
+ die( sprintf( __('Database error : %s', 'broken-link-checker'), $wpdb->last_error) );
401
  };
402
 
403
  $this->conf->options['current_db_version'] = $this->db_version;
419
  }
420
 
421
  function admin_menu(){
422
+ $options_page_hook = add_options_page(
423
+ __('Link Checker Settings', 'broken-link-checker'),
424
+ __('Link Checker', 'broken-link-checker'),
425
+ 'manage_options',
426
+ 'link-checker-settings',array(&$this, 'options_page')
427
+ );
428
  //Add the hook that will add the plugin's CSS styles to it's settings page
429
  add_action( 'admin_print_styles-' . $options_page_hook, array(&$this, 'options_page_css') );
430
 
431
  if (current_user_can('manage_options'))
432
+ add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2);
433
 
434
+ add_management_page(
435
+ __('View Broken Links', 'broken-link-checker'),
436
+ __('Broken Links', 'broken-link-checker'),
437
+ 'edit_others_posts',
438
+ 'view-broken-links',array(&$this, 'links_page')
439
+ );
440
  }
441
 
442
  /**
530
 
531
  ?>
532
 
533
+ <div class="wrap"><h2><?php _e('Broken Link Checker Options', 'broken-link-checker'); ?></h2>
534
 
535
  <form name="link_checker_options" method="post" action="<?php
536
  echo admin_url('options-general.php?page=link-checker-settings&noheader=1');
543
 
544
  <tr valign="top">
545
  <th scope="row">
546
+ <?php _e('Status','broken-link-checker'); ?>
547
  <br>
548
+ <a href="javascript:void(0)" id="blc-debug-info-toggle"><?php _e('Show debug info', 'broken-link-checker'); ?></a>
549
  </th>
550
  <td>
551
 
566
  if ( data && ( typeof(data['text']) != 'undefined' ) ){
567
  $('#wsblc_full_status').html(data.text);
568
  } else {
569
+ $('#wsblc_full_status').html('<?php _e('[ Network error ]', 'broken-link-checker'); ?>');
570
  }
571
 
572
  setTimeout(blcUpdateStatus, 10000); //...update every 10 seconds
578
  })(jQuery);
579
  </script>
580
  <?php //JHS: Recheck all posts link: ?>
581
+ <p><input class="button" type="button" name="recheckbutton"
582
+ value="<?php _e('Re-check all pages', 'broken-link-checker'); ?>"
583
+ onclick="location.replace('<?php echo basename($_SERVER['PHP_SELF']); ?>?page=link-checker-settings&amp;recheck=true')" />
584
+ </p>
585
 
586
  <table id="blc-debug-info">
587
  <?php
603
  </tr>
604
 
605
  <tr valign="top">
606
+ <th scope="row"><?php _e('Check each link','broken-link-checker'); ?></th>
607
  <td>
608
 
609
+ <?php
610
+ printf(
611
+ __('Every %s hours','broken-link-checker'),
612
+ sprintf(
613
+ '<input type="text" name="check_threshold" id="check_threshold" value="%d" size="5" maxlength="5" />',
614
+ $this->conf->options['check_threshold']
615
+ )
616
+ );
617
+ ?>
618
  <br/>
619
  <span class="description">
620
+ <?php _e('Existing links will be checked this often. New links will usually be checked ASAP.', 'broken-link-checker'); ?>
621
  </span>
622
 
623
  </td>
624
  </tr>
625
 
626
  <tr valign="top">
627
+ <th scope="row"><?php _e('Broken link CSS','broken-link-checker'); ?></th>
628
  <td>
629
  <label for='mark_broken_links'>
630
  <input type="checkbox" name="mark_broken_links" id="mark_broken_links"
631
  <?php if ($this->conf->options['mark_broken_links']) echo ' checked="checked"'; ?>/>
632
+ <?php _e('Apply <em>class="broken_link"</em> to broken links', 'broken-link-checker'); ?>
633
  </label>
634
  <br/>
635
  <textarea name="broken_link_css" id="broken_link_css" cols='45' rows='4'/><?php
641
  </tr>
642
 
643
  <tr valign="top">
644
+ <th scope="row"><?php _e('Exclusion list', 'broken-link-checker'); ?></th>
645
+ <td><?php _e("Don't check links where the URL contains any of these words (one per line) :", 'broken-link-checker'); ?><br/>
646
  <textarea name="exclusion_list" id="exclusion_list" cols='45' rows='4' wrap='off'/><?php
647
  if( isset($this->conf->options['exclusion_list']) )
648
  echo implode("\n", $this->conf->options['exclusion_list']);
652
  </tr>
653
 
654
  <tr valign="top">
655
+ <th scope="row"><?php _e('Custom fields', 'broken-link-checker'); ?></th>
656
+ <td><?php _e('Check URLs entered in these custom fields (one per line) :', 'broken-link-checker'); ?><br/>
657
  <textarea name="blc_custom_fields" id="blc_custom_fields" cols='45' rows='4' /><?php
658
  if( isset($this->conf->options['custom_fields']) )
659
  echo implode("\n", $this->conf->options['custom_fields']);
664
 
665
  </table>
666
 
667
+ <h3><?php _e('Advanced','broken-link-checker'); ?></h3>
668
 
669
  <table class="form-table">
670
 
671
 
672
  <tr valign="top">
673
+ <th scope="row"><?php _e('Timeout', 'broken-link-checker'); ?></th>
674
  <td>
675
 
676
  <input type="text" name="timeout" id="blc_timeout"
677
  value="<?php echo $this->conf->options['timeout']; ?>" size='5' maxlength='3'/>
678
  seconds
679
  <br/><span class="description">
680
+ <?php _e('Links that take longer than this to load will be marked as broken.','broken-link-checker'); ?>
681
  </span>
682
 
683
  </td>
686
 
687
  <tr valign="top">
688
  <th scope="row">
689
+ <a name='lockfile_directory'></a><?php _e('Custom temporary directory', 'broken-link-checker'); ?></th>
690
  <td>
691
 
692
  <input type="text" name="custom_tmp_dir" id="custom_tmp_dir"
695
  if ( !empty( $this->conf->options['custom_tmp_dir'] ) ) {
696
  if ( is_dir( $this->conf->options['custom_tmp_dir'] ) ){
697
  if ( is_writable( $this->conf->options['custom_tmp_dir'] ) ){
698
+ echo "<strong>", __('OK', 'broken-link-checker'), "</strong>";
699
  } else {
700
+ echo '<span class="error">';
701
+ _e("Error : This directory isn't writable by PHP.", 'broken-link-checker');
702
+ echo '</span>';
703
  }
704
  } else {
705
+ echo '<span class="error">';
706
+ _e("Error : This directory doesn't exist.", 'broken-link-checker');
707
+ echo '</span>';
708
  }
709
  }
710
 
711
  ?>
712
  <br/>
713
  <span class="description">
714
+ <?php _e('Set this field if you want the plugin to use a custom directory for its lockfiles. Otherwise, leave it blank.','broken-link-checker'); ?>
 
715
  </span>
716
 
717
  </td>
718
  </tr>
719
 
720
  <tr valign="top">
721
+ <th scope="row"><?php _e('Max. execution time', 'broken-link-checker'); ?></th>
722
  <td>
723
 
724
+ <?php
725
+
726
+ printf(
727
+ __('%s seconds', 'broken-link-checker'),
728
+ sprintf(
729
+ '<input type="text" name="max_execution_time" id="max_execution_time" value="%d" size="5" maxlength="5" />',
730
+ $this->conf->options['max_execution_time']
731
+ )
732
+ );
733
+
734
+ ?>
735
  <br/><span class="description">
736
+ <?php
737
+
738
+ _e('The plugin works by periodically creating a background worker instance that parses your posts looking for links,
739
  checks the discovered URLs, and performs other time-consuming tasks. Here you can set for how long, at most,
740
+ the background instance may run each time before stopping.', 'broken-link-checker');
741
+
742
+ ?>
743
  </span>
744
 
745
  </td>
760
  var box = $('#blc-debug-info');
761
  box.toggle();
762
  if( box.is(':visible') ){
763
+ toggleButton.text('<?php _e('Hide debug info', 'broken-link-checker'); ?>');
764
  } else {
765
+ toggleButton.text('<?php _e('Show debug info', 'broken-link-checker'); ?>');
766
  }
767
 
768
  });
823
  $filters = array(
824
  'broken' => array(
825
  'where_expr' => '( http_code < 200 OR http_code >= 400 OR timeout = 1 ) AND ( check_count > 0 ) AND ( http_code <> ' . BLC_CHECKING . ')',
826
+ 'name' => __('Broken', 'broken-link-checker'),
827
+ 'heading' => __('Broken Links', 'broken-link-checker'),
828
+ 'heading_zero' => __('No broken links found', 'broken-link-checker')
829
  ),
830
  'redirects' => array(
831
  'where_expr' => '( redirect_count > 0 )',
832
+ 'name' => __('Redirects', 'broken-link-checker'),
833
+ 'heading' => __('Redirected Links', 'broken-link-checker'),
834
+ 'heading_zero' => __('No redirects found', 'broken-link-checker')
835
  ),
836
 
837
  'all' => array(
838
  'where_expr' => '1',
839
+ 'name' => __('All', 'broken-link-checker'),
840
+ 'heading' => __('Detected Links', 'broken-link-checker'),
841
+ 'heading_zero' => __('No links found (yet)', 'broken-link-checker')
842
  ),
843
  );
844
 
898
  echo '</pre>';
899
  //*/
900
  } else {
901
+ printf( __('Database error : %s', 'broken-link-checker'), $wpdb->last_error);
902
  }
903
  ?>
904
 
1015
  <?php
1016
  if ( ('post' == $link['source_type']) || ('custom_field' == $link['source_type']) ){
1017
 
1018
+ echo "<a class='row-title' href='post.php?action=edit&amp;post=$link[source_id]' title='",
1019
+ attribute_escape(__('Edit this post')),
1020
+ "'>{$link[post_title]}</a>";
1021
 
1022
  //Output inline action links (copied from edit-post-rows.php)
1023
  $actions = array();
1024
  if ( current_user_can('edit_post', $link['source_id']) ) {
1025
  $actions['edit'] = '<span class="edit"><a href="' . get_edit_post_link($link['source_id'], true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>';
1026
+ $actions['delete'] = "<span class='delete'><a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=".$link['source_id'], 'delete-post_' . $link['source_id']) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $link['post_title'] )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
1027
  }
1028
  $actions['view'] = '<span class="view"><a href="' . get_permalink($link['source_id']) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $link['post_title'])) . '" rel="permalink">' . __('View') . '</a>';
1029
  echo '<div class="row-actions">';
1032
 
1033
  } elseif ( 'blogroll' == $link['source_type'] ) {
1034
 
1035
+ echo "<a class='row-title' href='link.php?action=edit&amp;link_id=$link[source_id]' title='" . __('Edit this bookmark', 'broken-link-checker') . "'>{$link[link_text]}</a>";
1036
 
1037
  //Output inline action links
1038
  $actions = array();
1039
  if ( current_user_can('manage_links') ) {
1040
+ $actions['edit'] = '<span class="edit"><a href="link.php?action=edit&amp;link_id=' . $link['source_id'] . '" title="' . attribute_escape(__('Edit this bookmark', 'broken-link-checker')) . '">' . __('Edit') . '</a>';
1041
  $actions['delete'] = "<span class='delete'><a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id={$link[source_id]}", 'delete-bookmark_' . $link['source_id']) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link['link_text'])) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
1042
  }
1043
 
1047
 
1048
  } elseif ( empty($link['source_type']) ){
1049
 
1050
+ _e("[An orphaned link! This is a bug.]", 'broken-link-checker');
1051
 
1052
  }
1053
  ?>
1058
  if ( 'link' == $link['instance_type'] ) {
1059
  print strip_tags($link['link_text']);
1060
  } elseif ( 'image' == $link['instance_type'] ){
1061
+ printf(
1062
+ '<img src="%s/broken-link-checker/images/image.png" class="blc-small-image" alt="%2$s" title="%2$s"> %2$s',
1063
+ WP_PLUGIN_URL,
1064
+ __('Image', 'broken-link-checker')
1065
+ );
1066
  } else {
1067
  echo '[ ??? ]';
1068
  }
1069
 
1070
  } elseif ( 'custom_field' == $link['source_type'] ){
1071
 
1072
+ printf(
1073
+ '<img src="%s/broken-link-checker/images/script_code.png" class="blc-small-image" title="%2$s" alt="%2$s"> ',
1074
+ WP_PLUGIN_URL,
1075
+ __('Custom field', 'broken-link-checker')
1076
+ );
1077
  echo "<code>".$link['link_text']."</code>";
1078
 
1079
  } elseif ( 'blogroll' == $link['source_type'] ){
1080
+ printf(
1081
+ '<img src="%s/broken-link-checker/images/link.png" class="blc-small-image" title="%2$s" alt="%2$s"> %2$s',
1082
+ WP_PLUGIN_URL,
1083
+ __('Bookmark', 'broken-link-checker')
1084
+ );
1085
  }
1086
  ?>
1087
  </td>
1095
  //Output inline action links for the link/URL
1096
  $actions = array();
1097
 
1098
+ $actions['details'] = "<span class='view'><a class='blc-details-button' href='javascript:void(0)' title='". attribute_escape(__('Show more info about this link', 'broken-link-checker')) . "'>". __('Details', 'broken-link-checker') ."</a>";
1099
 
1100
+ $actions['delete'] = "<span class='delete'><a class='submitdelete blc-unlink-button' title='" . attribute_escape( __('Remove this link from all posts', 'broken-link-checker') ). "' ".
1101
+ "id='unlink-button-$rownum' href='javascript:void(0);'>" . __('Unlink', 'broken-link-checker') . "</a>";
1102
 
1103
  if ( $excluded ){
1104
+ $actions['exclude'] = "<span class='delete'>" . __('Excluded', 'broken-link-checker');
1105
  } else {
1106
+ $actions['exclude'] = "<span class='delete'><a class='submitdelete blc-exclude-button' title='" . attribute_escape( __('Add this URL to the exclusion list' , 'broken-link-checker') ) . "' ".
1107
+ "id='exclude-button-$rownum' href='javascript:void(0);'>" . __('Exclude' , 'broken-link-checker'). "</a>";
1108
  }
1109
 
1110
+ $actions['edit'] = "<span class='edit'><a href='javascript:void(0)' class='blc-edit-button' title='" . attribute_escape( __('Edit link URL' , 'broken-link-checker') ) . "'>". __('Edit URL' , 'broken-link-checker') ."</a>";
1111
 
1112
  echo '<div class="row-actions">';
1113
  echo implode(' | </span>', $actions);
1114
 
1115
  echo "<span style='display:none' class='blc-cancel-button-container'> ",
1116
+ "| <a href='javascript:void(0)' class='blc-cancel-button' title='". attribute_escape(__('Cancel URL editing' , 'broken-link-checker')) ."'>". __('Cancel' , 'broken-link-checker') ."</a></span>";
1117
 
1118
  echo '</div>';
1119
  ?>
1122
  <td><a href='javascript:void(0);'
1123
  id='discard_button-<?php print $rownum; ?>'
1124
  class='blc-discard-button'
1125
+ title='<?php
1126
+ echo attribute_escape(
1127
+ __('Remove this link from the list of broken links and mark it as valid', 'broken-link-checker')
1128
+ );
1129
+ ?>'><?php _e('Discard', 'broken-link-checker'); ?></a>
1130
  </td>
1131
  <?php } ?>
1132
  </tr>
1171
  //The discard button - manually mark the link as valid. The link will be checked again later.
1172
  $(".blc-discard-button").click(function () {
1173
  var me = this;
1174
+ $(me).html('<?php echo js_escape(__('Wait...', 'broken-link-checker')); ?>');
1175
 
1176
  var link_id = $(me).parents('.blc-row').find('.blc-link-id').html();
1177
 
1195
 
1196
  alterLinkCounter(-1);
1197
  } else {
1198
+ $(me).html('<?php echo js_escape(__('Discard' , 'broken-link-checker')); ?>');
1199
  alert(data);
1200
  }
1201
  }
1229
  cancel_button_container.show();
1230
  editor.focus();
1231
  editor.select();
1232
+ edit_button.html('<?php echo js_escape(__('Save URL' , 'broken-link-checker')); ?>');
1233
  } else {
1234
  editor.hide();
1235
  cancel_button_container.hide();
1239
 
1240
  if (new_url != orig_url){
1241
  //Save the changed link
1242
+ url_el.html('<?php echo js_escape(__('Saving changes...' , 'broken-link-checker')); ?>');
1243
 
1244
  $.getJSON(
1245
  "<?php echo admin_url('admin-ajax.php'); ?>",
1263
  url_el.attr('href', new_url);
1264
 
1265
  if ( data.cnt_error > 0 ){
1266
+ //TODO: Interationalize this error message
1267
  var msg = "The link was successfully modifed.";
1268
  msg = msg + "\nHowever, "+data.cnt_error+" instances couldn't be edited and still point to the old URL."
1269
  alert(msg);
1275
  //Save the new ID
1276
  master.find('.blc-link-id').html(data.new_link_id);
1277
  //Load up the new link info (so sue me)
1278
+ master.next('.blc-link-details').find('td').html('<center><?php echo js_escape(__('Loading...' , 'broken-link-checker')); ?></center>').load(
1279
  "<?php echo admin_url('admin-ajax.php'); ?>",
1280
  {
1281
  'action' : 'blc_link_details',
1284
  );
1285
  }
1286
  } else {
1287
+ //TODO: Internationalize this error message
1288
  alert("Something went wrong. The plugin failed to edit "+
1289
  data.cnt_error + ' instance(s) of this link.');
1290
 
1307
  }
1308
  });
1309
 
1310
+ //Let the user use Enter and Esc as shortcuts for "Save URL" and "Cancel"
1311
+ $('input.blc-link-editor').keypress(function (e) {
1312
+ if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
1313
+ $(this).parents('.blc-row').find('.blc-edit-button').click();
1314
+ return false;
1315
+ } else if ((e.which && e.which == 27) || (e.keyCode && e.keyCode == 27)) {
1316
+ $(this).parents('.blc-row').find('.blc-cancel-button').click();
1317
+ return false;
1318
+ } else {
1319
+ return true;
1320
+ }
1321
+ });
1322
+
1323
  $(".blc-cancel-button").click(function () {
1324
  var master = $(this).parents('.blc-row');
1325
  var url_el = $(master).find('.blc-link-url');
1331
  //reset and hide the editor
1332
  master.find('.blc-link-editor').hide().val(url_el.attr('href'));
1333
  //Set the edit button to say "Edit URL"
1334
+ master.find('.blc-edit-button').html('<?php echo js_escape(__('Edit URL' , 'broken-link-checker')); ?>');
1335
  });
1336
 
1337
  //The unlink button - remove the link/image from all posts, custom fields, etc.
1338
  $(".blc-unlink-button").click(function () {
1339
  var me = this;
1340
  var master = $(me).parents('.blc-row');
1341
+ $(me).html('<?php echo js_escape(__('Wait...' , 'broken-link-checker')); ?>');
1342
 
1343
  var link_id = $(me).parents('.blc-row').find('.blc-link-id').html();
1344
 
1362
 
1363
  alterLinkCounter(-1);
1364
  } else {
1365
+ $(me).html('<?php echo js_escape(__('Unlink' , 'broken-link-checker')); ?>');
1366
  //Show the error message
1367
  alert(data.error);
1368
  }
1375
  var me = this;
1376
  var master = $(me).parents('.blc-row');
1377
  var details = master.next('.blc-link-details');
1378
+ $(me).html('<?php echo js_escape(__('Wait...' , 'broken-link-checker')); ?>');
1379
 
1380
  var link_id = $(me).parents('.blc-row').find('.blc-link-id').html();
1381
 
1392
 
1393
  if ( 'broken' == blc_current_filter ){
1394
  //Flash the row green to indicate success, then hide it.
1395
+ $(me).replaceWith('<?php echo js_escape(__('Excluded' , 'broken-link-checker')); ?>');
1396
  master.animate({ backgroundColor: "#E0FFB3" }, 200).animate({ backgroundColor: '#E2E2E2' }, 200, function(){
1397
  details.hide();
1398
  master.hide();
1403
  //Flash the row green to indicate success and fade to the "excluded link" color
1404
  master.animate({ backgroundColor: "#E0FFB3" }, 200).animate({ backgroundColor: '#E2E2E2' }, 300);
1405
  master.addClass('blc-excluded-link');
1406
+ $(me).replaceWith('<?php echo js_escape(__('Excluded' , 'broken-link-checker')); ?>');
1407
  }
1408
  } else {
1409
+ $(me).html('<?php echo js_escape(__('Exclude' , 'broken-link-checker')); ?>');
1410
  alert(data.error);
1411
  }
1412
  }
1428
  print $link['last_check'];
1429
  ?></span>
1430
  <ol style='list-style-type: none; width: 50%; float: right;'>
1431
+ <li><strong><?php _e('Log', 'broken-link-checker'); ?> :</strong>
1432
  <span class='blc_log'><?php
1433
  print nl2br($link['log']);
1434
  ?></span></li>
1436
 
1437
  <ol style='list-style-type: none; padding-left: 2px;'>
1438
  <?php if ( !empty($link['post_date']) ) { ?>
1439
+ <li><strong><?php _e('Post published on', 'broken-link-checker'); ?> :</strong>
1440
  <span class='post_date'><?php
1441
  print strftime("%B %d, %Y",strtotime($link['post_date']));
1442
  ?></span></li>
1443
  <?php } ?>
1444
+ <li><strong><?php _e('Link last checked', 'broken-link-checker'); ?> :</strong>
1445
  <span class='check_date'><?php
1446
  $last_check = strtotime($link['last_check']);
1447
  if ( $last_check < strtotime('-10 years') ){
1448
+ _e('Never', 'broken-link-checker');
1449
  } else {
1450
  echo strftime( "%B %d, %Y", $last_check );
1451
  }
1452
  ?></span></li>
1453
 
1454
+ <li><strong><?php _e('HTTP code', 'broken-link-checker'); ?> :</strong>
1455
  <span class='http_code'><?php
1456
  print $link['http_code'];
1457
  ?></span></li>
1458
 
1459
+ <li><strong><?php _e('Response time', 'broken-link-checker'); ?> :</strong>
1460
  <span class='request_duration'><?php
1461
+ printf( __('%2.3f seconds', 'broken-link-checker'), $link['request_duration']);
1462
  ?></span></li>
1463
 
1464
+ <li><strong><?php _e('Final URL', 'broken-link-checker'); ?> :</strong>
1465
  <span class='final_url'><?php
1466
  print $link['final_url'];
1467
  ?></span></li>
1468
 
1469
+ <li><strong><?php _e('Redirect count', 'broken-link-checker'); ?> :</strong>
1470
  <span class='redirect_count'><?php
1471
  print $link['redirect_count'];
1472
  ?></span></li>
1473
 
1474
+ <li><strong><?php _e('Instance count', 'broken-link-checker'); ?> :</strong>
1475
  <span class='instance_count'><?php
1476
  print $link['instance_count'];
1477
  ?></span></li>
1478
 
1479
  <?php if ( intval( $link['check_count'] ) > 0 ){ ?>
1480
+ <li><br/>
1481
+ <?php
1482
+ printf(
1483
+ _n('This link has failed %d time.', 'This link has failed %d times.', $link['check_count'], 'broken-link-checker'),
1484
+ $link['check_count']
1485
+ );
1486
+ ?>
1487
+ </li>
 
1488
  <?php } ?>
1489
  </ol>
1490
  <?php
1870
  $link_obj->http_code = 200; //Use a fake code so that the link doesn't show up in queries looking for broken links.
1871
  $link_obj->timeout = false;
1872
  $link_obj->request_duration = 0;
1873
+ $link_obj->log = __("This link wasn't checked because a matching keyword was found on your exclusion list.", 'broken-link-checker');
1874
  $link_obj->save();
1875
  }
1876
 
1911
  $text = '';
1912
 
1913
  if( $status['broken_links'] > 0 ){
1914
+ $text .= sprintf(
1915
+ "<a href='%s' title='View broken links'><strong>".
1916
+ _n('Found %d broken link', 'Found %d broken links', $status['broken_links'], 'broken-link-checker') .
1917
+ "</strong></a>",
1918
+ admin_url('tools.php?page=view-broken-links'),
1919
+ $status['broken_links']
1920
+ );
1921
  } else {
1922
+ $text .= __("No broken links found.", 'broken-link-checker');
1923
  }
1924
 
1925
  $text .= "<br/>";
1926
 
1927
  if( $status['unchecked_links'] > 0) {
1928
+ $text .= sprintf(
1929
+ _n('%d URL in the work queue', '%d URLs in the work queue', $status['unchecked_links'], 'broken-link-checker'),
1930
+ $status['unchecked_links'] );
1931
  } else {
1932
+ $text .= __("No URLs in the work queue.", 'broken-link-checker');
1933
  }
1934
 
1935
  $text .= "<br/>";
1936
  if ( $status['known_links'] > 0 ){
1937
+ $text .= sprintf(
1938
+ _n('Detected %d unique URL', 'Detected %d unique URLs', $status['known_links'], 'broken-link-checker') .
1939
+ ' ' . _n('in %d link', 'in %d links', $status['known_instances'], 'broken-link-checker'),
1940
+ $status['known_links'],
1941
+ $status['known_instances']
1942
  );
1943
  if ($this->conf->options['need_resynch']){
1944
+ $text .= ' ' . __('and still searching...', 'broken-link-checker');
1945
  } else {
1946
  $text .= '.';
1947
  }
1948
  } else {
1949
  if ($this->conf->options['need_resynch']){
1950
+ $text .= __('Searching your blog for links...', 'broken-link-checker');
1951
  } else {
1952
+ $text .= __('No links detected.', 'broken-link-checker');
1953
  }
1954
  }
1955
 
2018
  function ajax_discard(){
2019
  //TODO:Rewrite to use JSON instead of plaintext
2020
  if (!current_user_can('edit_others_posts')){
2021
+ die( __("You're not allowed to do that!", 'broken-link-checker') );
2022
  }
2023
 
2024
  if ( isset($_POST['link_id']) ){
2026
  $link = new blcLink( intval($_POST['link_id']) );
2027
 
2028
  if ( !$link->valid() ){
2029
+ printf( __("Oops, I can't find the link %d", 'broken-link-checker'), intval($_POST['link_id']) );
2030
+ die();
2031
  }
2032
  //Make it appear "not broken"
2033
  $link->last_check = date('Y-m-d H:i:s');
2034
  $link->http_code = 200;
2035
  $link->timeout = 0;
2036
  $link->check_count = 0;
2037
+ $link->log = __("This link was manually marked as working by the user.", 'broken-link-checker');
2038
 
2039
  //Save the changes
2040
  if ( $link->save() ){
2041
+ die( __("OK", 'broken-link-checker') );
2042
  } else {
2043
+ die( __("Oops, couldn't modify the link!", 'broken-link-checker') ) ;
2044
  }
2045
  } else {
2046
+ die( __("Error : link_id not specified", 'broken-link-checker') );
2047
  }
2048
  }
2049
 
2050
  function ajax_edit(){
2051
  if (!current_user_can('edit_others_posts')){
2052
  die( json_encode( array(
2053
+ 'error' => __("You're not allowed to do that!", 'broken-link-checker')
2054
  )));
2055
  }
2056
 
2060
 
2061
  if ( !$link->valid() ){
2062
  die( json_encode( array(
2063
+ 'error' => sprintf( __("Oops, I can't find the link %d", 'broken-link-checker'), intval($_GET['link_id']) )
2064
  )));
2065
  }
2066
 
2067
  $new_url = blcUtility::normalize_url($_GET['new_url']);
2068
  if ( !$new_url ){
2069
  die( json_encode( array(
2070
+ 'error' => __("Oops, the new URL is invalid!", 'broken-link-checker')
2071
  )));
2072
  }
2073
 
2076
 
2077
  if ( $rez == false ){
2078
  die( json_encode( array(
2079
+ 'error' => __("An unexpected error occured!", 'broken-link-checker')
2080
  )));
2081
  } else {
2082
+ $rez['ok'] = __('OK', 'broken-link-checker');
2083
  die( json_encode($rez) );
2084
  }
2085
 
2086
  } else {
2087
  die( json_encode( array(
2088
+ 'error' => __("Error : link_id or new_url not specified", 'broken-link-checker')
2089
  )));
2090
  }
2091
  }
2093
  function ajax_unlink(){
2094
  if (!current_user_can('edit_others_posts')){
2095
  die( json_encode( array(
2096
+ 'error' => __("You're not allowed to do that!", 'broken-link-checker')
2097
  )));
2098
  }
2099
 
2103
 
2104
  if ( !$link->valid() ){
2105
  die( json_encode( array(
2106
+ 'error' => sprintf( __("Oops, I can't find the link %d", 'broken-link-checker'), intval($_POST['link_id']) )
2107
  )));
2108
  }
2109
 
2110
  //Try and unlink it
2111
  if ( $link->unlink() ){
2112
  die( json_encode( array(
2113
+ 'ok' => sprintf( __("URL %s was removed.", 'broken-link-checker'), $link->url )
2114
  )));
2115
  } else {
2116
  die( json_encode( array(
2117
+ 'error' => __("The plugin failed to remove the link.", 'broken-link-checker')
2118
  )));
2119
  }
2120
 
2121
  } else {
2122
  die( json_encode( array(
2123
+ 'error' => __("Error : link_id not specified", 'broken-link-checker')
2124
  )));
2125
  }
2126
  }
2129
  global $wpdb;
2130
 
2131
  if (!current_user_can('edit_others_posts')){
2132
+ die( __("You don't have sufficient privileges to access this information!", 'broken-link-checker') );
2133
  }
2134
 
2135
  //FB::log("Loading link details via AJAX");
2142
  $link_id = intval($_POST['link_id']);
2143
  } else {
2144
  //FB::error('Link ID not specified, you hacking bastard.');
2145
+ die( __('Error : link ID not specified', 'broken-link-checker') );
2146
  }
2147
 
2148
  //Load the link. link_details_row needs it as an array, so
2166
  $this->link_details_row($link);
2167
  die();
2168
  } else {
2169
+ printf( __('Failed to load link details (%s)', 'broken-link-checker'), $wpdb->last_error );
2170
+ die ();
2171
  }
2172
  }
2173
 
2174
  function ajax_exclude_link(){
2175
  if ( !current_user_can('manage_options') ){
2176
  die( json_encode( array(
2177
+ 'error' => __("You're not allowed to do that!", 'broken-link-checker')
2178
  )));
2179
  }
2180
 
2184
 
2185
  if ( !$link->valid() ){
2186
  die( json_encode( array(
2187
+ 'error' => sprintf( __("Oops, I can't find the link %d", 'broken-link-checker'), intval($_POST['link_id']) )
2188
  )));
2189
  }
2190
 
2197
  $link->http_code = 200; //Use a fake code so that the link doesn't show up in queries looking for broken links.
2198
  $link->timeout = false;
2199
  $link->request_duration = 0;
2200
+ $link->log = __("This link wasn't checked because a matching keyword was found on your exclusion list.", 'broken-link-checker');
2201
  $link->save();
2202
  }
2203
 
2204
  $this->conf->save_options();
2205
 
2206
  die( json_encode( array(
2207
+ 'ok' => sprintf( __('URL %s added to the exclusion list', 'broken-link-checker'), $link->url )
2208
  )));
2209
  } else {
2210
  die( json_encode( array(
2211
+ 'error' => __("Link ID not specified", 'broken-link-checker')
2212
  )));
2213
  }
2214
  }
2295
  return dirname(__FILE__) . '/wp_blc_lock';
2296
  } else {
2297
 
2298
+ //Try the system-wide temp directory
2299
+ $path = sys_get_temp_dir();
 
 
2300
  if ( $path && is_writable($path)){
2301
  return trailingslashit($path) . 'wp_blc_lock';
2302
  }
2303
 
2304
+ //Try the upload directory.
2305
+ $path = ini_get('upload_tmp_dir');
2306
  if ( $path && is_writable($path)){
2307
  return trailingslashit($path) . 'wp_blc_lock';
2308
  }
2358
  //Make the notice customized to the current settings
2359
  if ( !empty($this->conf->options['custom_tmp_dir']) ){
2360
  $action_notice = sprintf(
2361
+ __('The current temporary directory is not accessible; please <a href="%s">set a different one</a>.', 'broken-link-checker'),
 
2362
  $settings_page
2363
  );
2364
  } else {
2365
  $action_notice = sprintf(
2366
+ __('Please make the directory <code>%1$s</code> writable by plugins or <a href="%2$s">set a custom temporary directory</a>.', 'broken-link-checker'),
 
2367
  $my_dir, $settings_page
2368
  );
2369
  }
2370
 
2371
  echo sprintf('
2372
  <div id="blc-lockfile-warning" class="error"><p>
2373
+ <strong>' . __("Broken Link Checker can't create a lockfile.", 'broken-link-checker') .
2374
+ '</strong> %s <a href="javascript:void(0)" onclick="jQuery(\'#blc-lockfile-details\').toggle()">' .
2375
+ __('Details', 'broken-link-checker') . '</a> </p>
2376
 
2377
+ <div id="blc-lockfile-details" style="display:none;"><p>' .
2378
+ __("The plugin uses a file-based locking mechanism to ensure that only one instance of the
2379
  resource-heavy link checking algorithm is running at any given time. Unfortunately,
2380
+ BLC can't find a writable directory where it could store the lockfile - it failed to
2381
+ detect the location of your server's temporary directory, and the plugin's own directory
2382
+ isn't writable by PHP. To fix this problem, please make the plugin's directory writable
2383
+ or enter a specify a custom temporary directory in the plugin's settings.", 'broken-link-checker') .
2384
+ '</p>
2385
  </div>
2386
  </div>',
2387
  $action_notice);
2400
  $debug = array();
2401
 
2402
  //PHP version. Any one is fine as long as WP supports it.
2403
+ $debug[ __('PHP version', 'broken-link-checker') ] = array(
2404
  'state' => 'ok',
2405
  'value' => phpversion(),
2406
  );
2407
 
2408
  //MySQL version
2409
+ $debug[ __('MySQL version', 'broken-link-checker') ] = array(
2410
  'state' => 'ok',
2411
  'value' => @mysql_get_server_info( $wpdb->dbh ),
2412
  );
2419
  $data = array(
2420
  'state' => 'warning',
2421
  'value' => $version['version'],
2422
+ 'message' => __('You have an old version of CURL. Redirect detection may not work properly.', 'broken-link-checker'),
2423
  );
2424
  } else {
2425
  $data = array(
2431
  } else {
2432
  $data = array(
2433
  'state' => 'warning',
2434
+ 'value' => __('Not installed', 'broken-link-checker'),
2435
  );
2436
  }
2437
+ $debug[ __('CURL version', 'broken-link-checker') ] = $data;
2438
 
2439
  //Snoopy presence
2440
  if ( class_exists('Snoopy') ){
2441
  $data = array(
2442
  'state' => 'ok',
2443
+ 'value' => __('Installed', 'broken-link-checker'),
2444
  );
2445
  } else {
2446
  //No Snoopy? This should never happen, but if it does we *must* have CURL.
2447
  if ( function_exists('curl_init') ){
2448
  $data = array(
2449
  'state' => 'ok',
2450
+ 'value' => __('Not installed', 'broken-link-checker'),
2451
  );
2452
  } else {
2453
  $data = array(
2454
  'state' => 'error',
2455
+ 'value' => __('Not installed', 'broken-link-checker'),
2456
+ 'message' => __('You must have either CURL or Snoopy installed for the plugin to work!', 'broken-link-checker'),
2457
  );
2458
  }
2459
 
2464
  if ( blcUtility::is_safe_mode() ){
2465
  $debug['Safe mode'] = array(
2466
  'state' => 'warning',
2467
+ 'value' => __('On', 'broken-link-checker'),
2468
+ 'message' => __('Redirects may be detected as broken links when safe_mode is on.', 'broken-link-checker'),
2469
  );
2470
  } else {
2471
  $debug['Safe mode'] = array(
2472
  'state' => 'ok',
2473
+ 'value' => __('Off', 'broken-link-checker'),
2474
  );
2475
  }
2476
 
2478
  if ( blcUtility::is_open_basedir() ){
2479
  $debug['open_basedir'] = array(
2480
  'state' => 'warning',
2481
+ 'value' => sprintf( __('On ( %s )', 'broken-link-checker'), ini_get('open_basedir') ),
2482
+ 'message' => __('Redirects may be detected as broken links when open_basedir is on.', 'broken-link-checker'),
2483
  );
2484
  } else {
2485
  $debug['open_basedir'] = array(
2486
  'state' => 'ok',
2487
+ 'value' => __('Off', 'broken-link-checker'),
2488
  );
2489
  }
2490
 
2498
  } else {
2499
  $debug['Lockfile'] = array(
2500
  'state' => 'error',
2501
+ 'message' => __("Can't create a lockfile. Please specify a custom temporary directory.", 'broken-link-checker'),
2502
  );
2503
  }
2504
 
2505
  return $debug;
2506
  }
2507
+
2508
+ /**
2509
+ * wsBrokenLinkChecker::load_language()
2510
+ * Load the plugin's textdomain
2511
+ *
2512
+ * @return void
2513
+ */
2514
+ function load_language(){
2515
+ load_plugin_textdomain( 'broken-link-checker', false, basename(dirname($this->loader)) . '/languages' );
2516
+ }
2517
 
2518
  }//class ends here
2519
 
highlighter-class.php CHANGED
@@ -55,14 +55,18 @@ class blcLinkHighlighter {
55
  }
56
  $content = preg_replace_callback( blcUtility::link_pattern(), array(&$this,'mark_broken_links'), $content );
57
 
 
58
  if ( BLC_DEBUG ){
59
  $content .= '<p><strong>Broken links in this post : </strong></p><ul>';
60
  $content .= '<li>' . implode('</li><li>', array_keys($this->links_to_remove)) . '</li></ul>';
61
  }
 
62
  } else {
 
63
  if ( BLC_DEBUG ){
64
  $content .= '<p><strong>This post contains no broken links.</strong></p>';
65
  }
 
66
  };
67
 
68
  return $content;
55
  }
56
  $content = preg_replace_callback( blcUtility::link_pattern(), array(&$this,'mark_broken_links'), $content );
57
 
58
+ /*
59
  if ( BLC_DEBUG ){
60
  $content .= '<p><strong>Broken links in this post : </strong></p><ul>';
61
  $content .= '<li>' . implode('</li><li>', array_keys($this->links_to_remove)) . '</li></ul>';
62
  }
63
+ //*/
64
  } else {
65
+ /*
66
  if ( BLC_DEBUG ){
67
  $content .= '<p><strong>This post contains no broken links.</strong></p>';
68
  }
69
+ //*/
70
  };
71
 
72
  return $content;
languages/broken-link-checker.pot ADDED
@@ -0,0 +1,667 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Broken Link Checker POT file
2
+ # Copyright (C) YEAR Janis Elsts
3
+ # This file is distributed under the same license as the BLC package.
4
+ # Janis Elsts <whiteshadow@w-shadow.com>, 2009.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: broken-link-checker\n"
10
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/broken-link-checker\n"
11
+ "POT-Creation-Date: 2009-10-28 16:55+0000\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19
+
20
+ #: core.php:132 core.php:1278
21
+ msgid "Loading..."
22
+ msgstr ""
23
+
24
+ #: core.php:155 core.php:569
25
+ msgid "[ Network error ]"
26
+ msgstr ""
27
+
28
+ #: core.php:180
29
+ msgid "Automatically expand the widget if broken links have been detected"
30
+ msgstr ""
31
+
32
+ #: core.php:359 core.php:368 core.php:386 core.php:400 core.php:901
33
+ #, php-format
34
+ msgid "Database error : %s"
35
+ msgstr ""
36
+
37
+ #: core.php:423
38
+ msgid "Link Checker Settings"
39
+ msgstr ""
40
+
41
+ #: core.php:424
42
+ msgid "Link Checker"
43
+ msgstr ""
44
+
45
+ #: core.php:435
46
+ msgid "View Broken Links"
47
+ msgstr ""
48
+
49
+ #: core.php:436 core.php:827
50
+ msgid "Broken Links"
51
+ msgstr ""
52
+
53
+ #: core.php:453
54
+ msgid "Settings"
55
+ msgstr ""
56
+
57
+ #: core.php:533
58
+ msgid "Broken Link Checker Options"
59
+ msgstr ""
60
+
61
+ #: core.php:546
62
+ msgid "Status"
63
+ msgstr ""
64
+
65
+ #: core.php:548 core.php:765
66
+ msgid "Show debug info"
67
+ msgstr ""
68
+
69
+ #: core.php:582
70
+ msgid "Re-check all pages"
71
+ msgstr ""
72
+
73
+ #: core.php:606
74
+ msgid "Check each link"
75
+ msgstr ""
76
+
77
+ #: core.php:611
78
+ #, php-format
79
+ msgid "Every %s hours"
80
+ msgstr ""
81
+
82
+ #: core.php:620
83
+ msgid ""
84
+ "Existing links will be checked this often. New links will usually be checked "
85
+ "ASAP."
86
+ msgstr ""
87
+
88
+ #: core.php:627
89
+ msgid "Broken link CSS"
90
+ msgstr ""
91
+
92
+ #: core.php:632
93
+ msgid "Apply <em>class=\"broken_link\"</em> to broken links"
94
+ msgstr ""
95
+
96
+ #: core.php:644
97
+ msgid "Exclusion list"
98
+ msgstr ""
99
+
100
+ #: core.php:645
101
+ msgid ""
102
+ "Don't check links where the URL contains any of these words (one per line) :"
103
+ msgstr ""
104
+
105
+ #: core.php:655
106
+ msgid "Custom fields"
107
+ msgstr ""
108
+
109
+ #: core.php:656
110
+ msgid "Check URLs entered in these custom fields (one per line) :"
111
+ msgstr ""
112
+
113
+ #: core.php:667
114
+ msgid "Advanced"
115
+ msgstr ""
116
+
117
+ #: core.php:673
118
+ msgid "Timeout"
119
+ msgstr ""
120
+
121
+ #: core.php:680
122
+ msgid "Links that take longer than this to load will be marked as broken."
123
+ msgstr ""
124
+
125
+ #: core.php:689
126
+ msgid "Custom temporary directory"
127
+ msgstr ""
128
+
129
+ #: core.php:698 core.php:2041 core.php:2082
130
+ msgid "OK"
131
+ msgstr ""
132
+
133
+ #: core.php:701
134
+ msgid "Error : This directory isn't writable by PHP."
135
+ msgstr ""
136
+
137
+ #: core.php:706
138
+ msgid "Error : This directory doesn't exist."
139
+ msgstr ""
140
+
141
+ #: core.php:714
142
+ msgid ""
143
+ "Set this field if you want the plugin to use a custom directory for its "
144
+ "lockfiles. Otherwise, leave it blank."
145
+ msgstr ""
146
+
147
+ #: core.php:721
148
+ msgid "Max. execution time"
149
+ msgstr ""
150
+
151
+ #: core.php:727
152
+ #, php-format
153
+ msgid "%s seconds"
154
+ msgstr ""
155
+
156
+ #: core.php:738
157
+ msgid ""
158
+ "The plugin works by periodically creating a background worker instance that "
159
+ "parses your posts looking for links,\r\n"
160
+ "\t\tchecks the discovered URLs, and performs other time-consuming tasks. "
161
+ "Here you can set for how long, at most, \r\n"
162
+ "\t\tthe background instance may run each time before stopping."
163
+ msgstr ""
164
+
165
+ #: core.php:750
166
+ msgid "Save Changes"
167
+ msgstr ""
168
+
169
+ #: core.php:763
170
+ msgid "Hide debug info"
171
+ msgstr ""
172
+
173
+ #: core.php:826
174
+ msgid "Broken"
175
+ msgstr ""
176
+
177
+ #: core.php:828
178
+ msgid "No broken links found"
179
+ msgstr ""
180
+
181
+ #: core.php:832
182
+ msgid "Redirects"
183
+ msgstr ""
184
+
185
+ #: core.php:833
186
+ msgid "Redirected Links"
187
+ msgstr ""
188
+
189
+ #: core.php:834
190
+ msgid "No redirects found"
191
+ msgstr ""
192
+
193
+ #: core.php:839
194
+ msgid "All"
195
+ msgstr ""
196
+
197
+ #: core.php:840
198
+ msgid "Detected Links"
199
+ msgstr ""
200
+
201
+ #: core.php:841
202
+ msgid "No links found (yet)"
203
+ msgstr ""
204
+
205
+ #: core.php:960
206
+ msgid "&laquo;"
207
+ msgstr ""
208
+
209
+ #: core.php:961
210
+ msgid "&raquo;"
211
+ msgstr ""
212
+
213
+ #: core.php:968 core.php:1143
214
+ #, php-format
215
+ msgid "Displaying %s&#8211;%s of <span class=\"current-link-count\">%s</span>"
216
+ msgstr ""
217
+
218
+ #: core.php:1019 core.php:1025
219
+ msgid "Edit this post"
220
+ msgstr ""
221
+
222
+ #: core.php:1025 core.php:1040
223
+ msgid "Edit"
224
+ msgstr ""
225
+
226
+ #: core.php:1026
227
+ msgid "Delete this post"
228
+ msgstr ""
229
+
230
+ #: core.php:1026
231
+ #, php-format
232
+ msgid ""
233
+ "You are about to delete this post '%s'\n"
234
+ " 'Cancel' to stop, 'OK' to delete."
235
+ msgstr ""
236
+
237
+ #: core.php:1026 core.php:1041
238
+ msgid "Delete"
239
+ msgstr ""
240
+
241
+ #: core.php:1028
242
+ #, php-format
243
+ msgid "View \"%s\""
244
+ msgstr ""
245
+
246
+ #: core.php:1028
247
+ msgid "View"
248
+ msgstr ""
249
+
250
+ #: core.php:1035 core.php:1040
251
+ msgid "Edit this bookmark"
252
+ msgstr ""
253
+
254
+ #: core.php:1041
255
+ #, php-format
256
+ msgid ""
257
+ "You are about to delete this link '%s'\n"
258
+ " 'Cancel' to stop, 'OK' to delete."
259
+ msgstr ""
260
+
261
+ #: core.php:1050
262
+ msgid "[An orphaned link! This is a bug.]"
263
+ msgstr ""
264
+
265
+ #: core.php:1064
266
+ msgid "Image"
267
+ msgstr ""
268
+
269
+ #: core.php:1075
270
+ msgid "Custom field"
271
+ msgstr ""
272
+
273
+ #: core.php:1083
274
+ msgid "Bookmark"
275
+ msgstr ""
276
+
277
+ #: core.php:1098
278
+ msgid "Show more info about this link"
279
+ msgstr ""
280
+
281
+ #: core.php:1098 core.php:2377
282
+ msgid "Details"
283
+ msgstr ""
284
+
285
+ #: core.php:1100
286
+ msgid "Remove this link from all posts"
287
+ msgstr ""
288
+
289
+ #: core.php:1101 core.php:1365
290
+ msgid "Unlink"
291
+ msgstr ""
292
+
293
+ #: core.php:1104 core.php:1395 core.php:1406
294
+ msgid "Excluded"
295
+ msgstr ""
296
+
297
+ #: core.php:1106
298
+ msgid "Add this URL to the exclusion list"
299
+ msgstr ""
300
+
301
+ #: core.php:1107 core.php:1409
302
+ msgid "Exclude"
303
+ msgstr ""
304
+
305
+ #: core.php:1110
306
+ msgid "Edit link URL"
307
+ msgstr ""
308
+
309
+ #: core.php:1110 core.php:1334
310
+ msgid "Edit URL"
311
+ msgstr ""
312
+
313
+ #: core.php:1116
314
+ msgid "Cancel URL editing"
315
+ msgstr ""
316
+
317
+ #: core.php:1116
318
+ msgid "Cancel"
319
+ msgstr ""
320
+
321
+ #: core.php:1127
322
+ msgid "Remove this link from the list of broken links and mark it as valid"
323
+ msgstr ""
324
+
325
+ #: core.php:1129 core.php:1198
326
+ msgid "Discard"
327
+ msgstr ""
328
+
329
+ #: core.php:1174 core.php:1341 core.php:1378
330
+ msgid "Wait..."
331
+ msgstr ""
332
+
333
+ #: core.php:1232
334
+ msgid "Save URL"
335
+ msgstr ""
336
+
337
+ #: core.php:1242
338
+ msgid "Saving changes..."
339
+ msgstr ""
340
+
341
+ #: core.php:1431
342
+ msgid "Log"
343
+ msgstr ""
344
+
345
+ #: core.php:1439
346
+ msgid "Post published on"
347
+ msgstr ""
348
+
349
+ #: core.php:1444
350
+ msgid "Link last checked"
351
+ msgstr ""
352
+
353
+ #: core.php:1448
354
+ msgid "Never"
355
+ msgstr ""
356
+
357
+ #: core.php:1454
358
+ msgid "HTTP code"
359
+ msgstr ""
360
+
361
+ #: core.php:1459
362
+ msgid "Response time"
363
+ msgstr ""
364
+
365
+ #: core.php:1461
366
+ #, php-format
367
+ msgid "%2.3f seconds"
368
+ msgstr ""
369
+
370
+ #: core.php:1464
371
+ msgid "Final URL"
372
+ msgstr ""
373
+
374
+ #: core.php:1469
375
+ msgid "Redirect count"
376
+ msgstr ""
377
+
378
+ #: core.php:1474
379
+ msgid "Instance count"
380
+ msgstr ""
381
+
382
+ #: core.php:1483
383
+ #, php-format
384
+ msgid "This link has failed %d time."
385
+ msgid_plural "This link has failed %d times."
386
+ msgstr[0] ""
387
+ msgstr[1] ""
388
+
389
+ #: core.php:1873 core.php:2200
390
+ msgid ""
391
+ "This link wasn't checked because a matching keyword was found on your "
392
+ "exclusion list."
393
+ msgstr ""
394
+
395
+ #: core.php:1916
396
+ #, php-format
397
+ msgid "Found %d broken link"
398
+ msgid_plural "Found %d broken links"
399
+ msgstr[0] ""
400
+ msgstr[1] ""
401
+
402
+ #: core.php:1922
403
+ msgid "No broken links found."
404
+ msgstr ""
405
+
406
+ #: core.php:1929
407
+ #, php-format
408
+ msgid "%d URL in the work queue"
409
+ msgid_plural "%d URLs in the work queue"
410
+ msgstr[0] ""
411
+ msgstr[1] ""
412
+
413
+ #: core.php:1932
414
+ msgid "No URLs in the work queue."
415
+ msgstr ""
416
+
417
+ #: core.php:1938
418
+ #, php-format
419
+ msgid "Detected %d unique URL"
420
+ msgid_plural "Detected %d unique URLs"
421
+ msgstr[0] ""
422
+ msgstr[1] ""
423
+
424
+ #: core.php:1939
425
+ #, php-format
426
+ msgid "in %d link"
427
+ msgid_plural "in %d links"
428
+ msgstr[0] ""
429
+ msgstr[1] ""
430
+
431
+ #: core.php:1944
432
+ msgid "and still searching..."
433
+ msgstr ""
434
+
435
+ #: core.php:1950
436
+ msgid "Searching your blog for links..."
437
+ msgstr ""
438
+
439
+ #: core.php:1952
440
+ msgid "No links detected."
441
+ msgstr ""
442
+
443
+ #: core.php:2021 core.php:2053 core.php:2096 core.php:2177
444
+ msgid "You're not allowed to do that!"
445
+ msgstr ""
446
+
447
+ #: core.php:2029 core.php:2063 core.php:2106 core.php:2187
448
+ #, php-format
449
+ msgid "Oops, I can't find the link %d"
450
+ msgstr ""
451
+
452
+ #: core.php:2037
453
+ msgid "This link was manually marked as working by the user."
454
+ msgstr ""
455
+
456
+ #: core.php:2043
457
+ msgid "Oops, couldn't modify the link!"
458
+ msgstr ""
459
+
460
+ #: core.php:2046 core.php:2123
461
+ msgid "Error : link_id not specified"
462
+ msgstr ""
463
+
464
+ #: core.php:2070
465
+ msgid "Oops, the new URL is invalid!"
466
+ msgstr ""
467
+
468
+ #: core.php:2079
469
+ msgid "An unexpected error occured!"
470
+ msgstr ""
471
+
472
+ #: core.php:2088
473
+ msgid "Error : link_id or new_url not specified"
474
+ msgstr ""
475
+
476
+ #: core.php:2113
477
+ #, php-format
478
+ msgid "URL %s was removed."
479
+ msgstr ""
480
+
481
+ #: core.php:2117
482
+ msgid "The plugin failed to remove the link."
483
+ msgstr ""
484
+
485
+ #: core.php:2132
486
+ msgid "You don't have sufficient privileges to access this information!"
487
+ msgstr ""
488
+
489
+ #: core.php:2145
490
+ msgid "Error : link ID not specified"
491
+ msgstr ""
492
+
493
+ #: core.php:2169
494
+ #, php-format
495
+ msgid "Failed to load link details (%s)"
496
+ msgstr ""
497
+
498
+ #: core.php:2207
499
+ #, php-format
500
+ msgid "URL %s added to the exclusion list"
501
+ msgstr ""
502
+
503
+ #: core.php:2211
504
+ msgid "Link ID not specified"
505
+ msgstr ""
506
+
507
+ #: core.php:2363
508
+ #, php-format
509
+ msgid ""
510
+ "The current temporary directory is not accessible; please <a href=\"%s\">set "
511
+ "a different one</a>."
512
+ msgstr ""
513
+
514
+ #: core.php:2368
515
+ #, php-format
516
+ msgid ""
517
+ "Please make the directory <code>%1$s</code> writable by plugins or <a href="
518
+ "\"%2$s\">set a custom temporary directory</a>."
519
+ msgstr ""
520
+
521
+ #: core.php:2375
522
+ msgid "Broken Link Checker can't create a lockfile."
523
+ msgstr ""
524
+
525
+ #: core.php:2380
526
+ msgid ""
527
+ "The plugin uses a file-based locking mechanism to ensure that only one "
528
+ "instance of the\r\n"
529
+ "\t\t\t\tresource-heavy link checking algorithm is running at any given time. "
530
+ "Unfortunately, \r\n"
531
+ "\t\t\t\tBLC can't find a writable directory where it could store the "
532
+ "lockfile - it failed to \r\n"
533
+ "\t\t\t\tdetect the location of your server's temporary directory, and the "
534
+ "plugin's own directory\r\n"
535
+ "\t\t\t\tisn't writable by PHP. To fix this problem, please make the plugin's "
536
+ "directory writable\r\n"
537
+ "\t\t\t\tor enter a specify a custom temporary directory in the plugin's "
538
+ "settings."
539
+ msgstr ""
540
+
541
+ #: core.php:2405
542
+ msgid "PHP version"
543
+ msgstr ""
544
+
545
+ #: core.php:2411
546
+ msgid "MySQL version"
547
+ msgstr ""
548
+
549
+ #: core.php:2424
550
+ msgid ""
551
+ "You have an old version of CURL. Redirect detection may not work properly."
552
+ msgstr ""
553
+
554
+ #: core.php:2436 core.php:2452 core.php:2457
555
+ msgid "Not installed"
556
+ msgstr ""
557
+
558
+ #: core.php:2439
559
+ msgid "CURL version"
560
+ msgstr ""
561
+
562
+ #: core.php:2445
563
+ msgid "Installed"
564
+ msgstr ""
565
+
566
+ #: core.php:2458
567
+ msgid "You must have either CURL or Snoopy installed for the plugin to work!"
568
+ msgstr ""
569
+
570
+ #: core.php:2469
571
+ msgid "On"
572
+ msgstr ""
573
+
574
+ #: core.php:2470
575
+ msgid "Redirects may be detected as broken links when safe_mode is on."
576
+ msgstr ""
577
+
578
+ #: core.php:2475 core.php:2489
579
+ msgid "Off"
580
+ msgstr ""
581
+
582
+ #: core.php:2483
583
+ #, php-format
584
+ msgid "On ( %s )"
585
+ msgstr ""
586
+
587
+ #: core.php:2484
588
+ msgid "Redirects may be detected as broken links when open_basedir is on."
589
+ msgstr ""
590
+
591
+ #: core.php:2503
592
+ msgid "Can't create a lockfile. Please specify a custom temporary directory."
593
+ msgstr ""
594
+
595
+ #: link-classes.php:212
596
+ msgid "First try : 0 (No response)"
597
+ msgstr ""
598
+
599
+ #: link-classes.php:214
600
+ #, php-format
601
+ msgid "First try : %d"
602
+ msgstr ""
603
+
604
+ #: link-classes.php:222
605
+ msgid "Trying a second time with different settings..."
606
+ msgstr ""
607
+
608
+ #: link-classes.php:237
609
+ msgid "Second try : 0 (No response)"
610
+ msgstr ""
611
+
612
+ #: link-classes.php:239
613
+ #, php-format
614
+ msgid "Second try : %d"
615
+ msgstr ""
616
+
617
+ #: link-classes.php:265
618
+ msgid "Using Snoopy"
619
+ msgstr ""
620
+
621
+ #: link-classes.php:285
622
+ msgid "Request timed out."
623
+ msgstr ""
624
+
625
+ #: link-classes.php:304
626
+ msgid "Link is valid."
627
+ msgstr ""
628
+
629
+ #: link-classes.php:309
630
+ msgid "Link is broken."
631
+ msgstr ""
632
+
633
+ #: link-classes.php:313
634
+ msgid "Most likely the connection timed out or the domain doesn't exist."
635
+ msgstr ""
636
+
637
+ #: link-classes.php:354
638
+ #, php-format
639
+ msgid "Error adding link %s : %s"
640
+ msgstr ""
641
+
642
+ #: link-classes.php:374
643
+ #, php-format
644
+ msgid "Error updating link %d : %s"
645
+ msgstr ""
646
+
647
+ #. Plugin Name of an extension
648
+ msgid "Broken Link Checker"
649
+ msgstr ""
650
+
651
+ #. Plugin URI of an extension
652
+ msgid "http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/"
653
+ msgstr ""
654
+
655
+ #. Description of an extension
656
+ msgid ""
657
+ "Checks your posts for broken links and missing images and notifies you on "
658
+ "the dashboard if any are found."
659
+ msgstr ""
660
+
661
+ #. Author of an extension
662
+ msgid "Janis Elsts"
663
+ msgstr ""
664
+
665
+ #. Author URI of an extension
666
+ msgid "http://w-shadow.com/blog/"
667
+ msgstr ""
link-classes.php CHANGED
@@ -205,12 +205,21 @@ class blcLink {
205
 
206
  $info = curl_getinfo($ch);
207
  $code = intval( $info['http_code'] );
 
 
 
 
 
 
 
 
 
 
208
 
209
- $this->log .= "=== First try : $code ".(!$code?'(No response) ':'')."===\n\n";
210
  $this->log .= $this->last_headers."\n";
211
 
212
  if ( (($code<200) || ($code>=400)) && $nobody) {
213
- $this->log .= "Trying a second time with different settings...\n";
214
  $this->last_headers = '';
215
 
216
  curl_setopt($ch, CURLOPT_NOBODY, false); //Don't send a HEAD request this time
@@ -222,8 +231,15 @@ class blcLink {
222
 
223
  $info = curl_getinfo($ch);
224
  $code = intval( $info['http_code'] );
 
 
 
 
 
 
 
 
225
 
226
- $this->log .= "=== Second try : $code ".(!$code?'(No response) ':'')."===\n\n";
227
  $this->log .= $this->last_headers."\n";
228
  }
229
 
@@ -246,7 +262,7 @@ class blcLink {
246
  } elseif ( class_exists('Snoopy') ) {
247
  //******** Use Snoopy if CURL is not available *********
248
  //Note : Snoopy doesn't work too well with HTTPS URLs.
249
- $this->log .= "<em>(Using Snoopy)</em>\n";
250
 
251
  $start_time = microtime_float(true);
252
 
@@ -266,7 +282,7 @@ class blcLink {
266
  if ($snoopy->error)
267
  $this->log .= $snoopy->error."\n";
268
  if ($snoopy->timed_out)
269
- $this->log .= "Request timed out.\n";
270
 
271
  if ( is_array($snoopy->headers) )
272
  $this->log .= implode("", $snoopy->headers)."\n"; //those headers already contain newlines
@@ -285,16 +301,16 @@ class blcLink {
285
  are treated as "page doesn't exist'". */
286
  //TODO: Treat circular redirects as broken links.
287
  if ( (($this->http_code>=200) && ($this->http_code<400)) || ($this->http_code == 401) ) {
288
- $this->log .= "Link is valid.";
289
  //Reset the check count for valid links.
290
  $this->check_count = 0;
291
  return true;
292
  } else {
293
- $this->log .= "Link is broken.";
294
  if ( $this->http_code == BLC_TIMEOUT ){
295
  //This is probably a timeout
296
  $this->timeout = true;
297
- $this->log .= "\r\n(Most likely the connection timed out or the domain doesn't exist)";
298
  }
299
  return false;
300
  }
@@ -335,7 +351,8 @@ class blcLink {
335
  //If the link was successfully saved then it's no longer "new"
336
  $this->is_new = !$rez;
337
  } else {
338
- echo "Error adding link $url : {$wpdb->last_error}\r\n<br>";
 
339
  }
340
 
341
  return $rez;
@@ -354,7 +371,8 @@ class blcLink {
354
  if ( $rez !== false ){
355
  //echo "Link updated, ID : {$this->link_id}\r\n<br>";
356
  } else {
357
- echo "Error updating link {$this->link_id} : {$wpdb->last_error}\r\n<br>";
 
358
  }
359
  return $rez !== false;
360
  }
205
 
206
  $info = curl_getinfo($ch);
207
  $code = intval( $info['http_code'] );
208
+
209
+ $this->log .= '=== ';
210
+
211
+ if ( $code ){
212
+ $this->log .= __('First try : 0 (No response)', 'broken-link-checker');
213
+ } else {
214
+ $this->log .= sprintf( __('First try : %d', 'broken-link-checker'), $code);
215
+ }
216
+
217
+ $this->log .= " ===\n\n";
218
 
 
219
  $this->log .= $this->last_headers."\n";
220
 
221
  if ( (($code<200) || ($code>=400)) && $nobody) {
222
+ $this->log .= __("Trying a second time with different settings...", 'broken-link-checker') . "\n";
223
  $this->last_headers = '';
224
 
225
  curl_setopt($ch, CURLOPT_NOBODY, false); //Don't send a HEAD request this time
231
 
232
  $info = curl_getinfo($ch);
233
  $code = intval( $info['http_code'] );
234
+
235
+ $this->log .= '=== ';
236
+ if ( $code ){
237
+ $this->log .= __('Second try : 0 (No response)', 'broken-link-checker');
238
+ } else {
239
+ $this->log .= sprintf( __('Second try : %d', 'broken-link-checker'), $code);
240
+ }
241
+ $this->log .= " ===\n\n";
242
 
 
243
  $this->log .= $this->last_headers."\n";
244
  }
245
 
262
  } elseif ( class_exists('Snoopy') ) {
263
  //******** Use Snoopy if CURL is not available *********
264
  //Note : Snoopy doesn't work too well with HTTPS URLs.
265
+ $this->log .= "<em>(" . __('Using Snoopy', 'broken-link-checker') . ")</em>\n";
266
 
267
  $start_time = microtime_float(true);
268
 
282
  if ($snoopy->error)
283
  $this->log .= $snoopy->error."\n";
284
  if ($snoopy->timed_out)
285
+ $this->log .= __("Request timed out.", 'broken-link-checker') . "\n";
286
 
287
  if ( is_array($snoopy->headers) )
288
  $this->log .= implode("", $snoopy->headers)."\n"; //those headers already contain newlines
301
  are treated as "page doesn't exist'". */
302
  //TODO: Treat circular redirects as broken links.
303
  if ( (($this->http_code>=200) && ($this->http_code<400)) || ($this->http_code == 401) ) {
304
+ $this->log .= __("Link is valid.", 'broken-link-checker');
305
  //Reset the check count for valid links.
306
  $this->check_count = 0;
307
  return true;
308
  } else {
309
+ $this->log .= __("Link is broken.", 'broken-link-checker');
310
  if ( $this->http_code == BLC_TIMEOUT ){
311
  //This is probably a timeout
312
  $this->timeout = true;
313
+ $this->log .= "\r\n(" . __("Most likely the connection timed out or the domain doesn't exist.", 'broken-link-checker');
314
  }
315
  return false;
316
  }
351
  //If the link was successfully saved then it's no longer "new"
352
  $this->is_new = !$rez;
353
  } else {
354
+ printf( __('Error adding link %s : %s', 'broken-link-checker'), $url, $wpdb->last_error );
355
+ echo "\r\n<br>";
356
  }
357
 
358
  return $rez;
371
  if ( $rez !== false ){
372
  //echo "Link updated, ID : {$this->link_id}\r\n<br>";
373
  } else {
374
+ printf( __('Error updating link %d : %s', 'broken-link-checker'), $this->link_id, $wpdb->last_error );
375
+ echo "\r\n<br>";
376
  }
377
  return $rez !== false;
378
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: whiteshadow
3
  Tags: links, broken, maintenance, blogroll, custom fields, admin
4
  Requires at least: 2.7.0
5
  Tested up to: 2.9
6
- Stable tag: 0.5.18
7
 
8
  This plugin will check your posts, custom fields and the blogroll for broken links and missing images and notify you if any are found.
9
 
@@ -23,6 +23,7 @@ This plugin will monitor your blog looking for broken links and let you know if
23
  * Each link can be edited or unlinked directly via the plugin's page, without manually editing each post.
24
 
25
  **Basic Usage**
 
26
  Once installed, the plugin will begin parsing your posts, bookmarks (AKA blogroll), etc and looking for links. Depending on the size of your site this can take a few minutes or even several hours. 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 set various link checking options in *Settings -> Link Checker*.
27
 
28
  Note : Currently the plugin only runs when you have at least one tab of the Dashboard open. Cron support will likely be added in a later version.
@@ -60,8 +61,12 @@ To upgrade your installation
60
 
61
  *This is an automatically generated changelog*
62
 
 
 
 
63
  = 0.5.18 =
64
  * Added a workaround for auto-enclosures. The plugin should now parse the "enclosure" custom field correctly.
 
65
 
66
  = 0.5.17 =
67
  * Added a redirect detection workaround for users that have safe\_mode or open\_basedir enabled.
3
  Tags: links, broken, maintenance, blogroll, custom fields, admin
4
  Requires at least: 2.7.0
5
  Tested up to: 2.9
6
+ Stable tag: 0.6
7
 
8
  This plugin will check your posts, custom fields and the blogroll for broken links and missing images and notify you if any are found.
9
 
23
  * Each link can be edited or unlinked directly via the plugin's page, without manually editing each post.
24
 
25
  **Basic Usage**
26
+
27
  Once installed, the plugin will begin parsing your posts, bookmarks (AKA blogroll), etc and looking for links. Depending on the size of your site this can take a few minutes or even several hours. 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 set various link checking options in *Settings -> Link Checker*.
28
 
29
  Note : Currently the plugin only runs when you have at least one tab of the Dashboard open. Cron support will likely be added in a later version.
61
 
62
  *This is an automatically generated changelog*
63
 
64
+ = 0.6 =
65
+ * Initial localization support.
66
+
67
  = 0.5.18 =
68
  * Added a workaround for auto-enclosures. The plugin should now parse the "enclosure" custom field correctly.
69
+ * Let people use Enter and Esc as shortcuts for "Save URL" and "Cancel" (respectively) when editing a link.
70
 
71
  = 0.5.17 =
72
  * Added a redirect detection workaround for users that have safe\_mode or open\_basedir enabled.