Link Library - Version 7.3.13

Version Description

  • Added new tool under Global Options > Import/Export to export list of categories with IDs
Download this release

Release Info

Developer jackdewey
Plugin Icon 128x128 Link Library
Version 7.3.13
Comparing to
See all releases

Code changes from version 7.3.12 to 7.3.13

Files changed (3) hide show
  1. link-library-admin.php +104 -10
  2. link-library.php +7 -7
  3. readme.txt +4 -1
link-library-admin.php CHANGED
@@ -1215,7 +1215,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
1215
 
1216
  if ( isset( $_GET['message'] ) && $_GET['message'] == '1' ) {
1217
  echo "<div id='message' class='updated fade'><p><strong>" . __( 'Settings updated', 'link-library' ) . ".</strong></p></div>";
1218
- } elseif ( isset( $_GET['message'] ) && ( $_GET['message'] == '2' || $_GET['message'] == '3' || $_GET['message'] == 6 ) ) { ?>
1219
  <div id='message' class='updated fade'><p>
1220
  <strong>
1221
  <?php
@@ -1229,9 +1229,14 @@ wp_editor( $post->post_content, 'content', $editor_config );
1229
  } elseif ( intval( $_GET['message'] ) == 6 ) {
1230
  _e( 'RSS Link Checker Report', 'link-library' );
1231
  $mode = 'rss';
 
 
 
 
 
 
1232
  }
1233
  ?></strong><br />
1234
- <span class="loadingicon"><img src="<?php echo plugins_url( 'icons/Ajax-loader.gif', __FILE__ ); ?> " /></span><span class="processinglinks">Processing Link <span class="currentlinknumber">0</span> / <span class="totallinknumber">
1235
  <?php
1236
  $args = array(
1237
  'post_type' => 'link_library_links',
@@ -1265,14 +1270,33 @@ wp_editor( $post->post_content, 'content', $editor_config );
1265
  if ( !empty( $link_rss ) ) {
1266
  $total_post_count++;
1267
  }
1268
- }
 
 
 
 
 
 
 
 
 
 
 
 
1269
  }
1270
- }
 
 
 
 
 
 
 
 
1271
 
1272
- echo $total_post_count;
1273
- ?>
1274
  </span></span>
1275
  <br />
 
1276
  <div class="nextcheckitem"></div>
1277
  <script type="text/javascript">
1278
  var currentlinkindex = 1;
@@ -1319,6 +1343,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
1319
  }
1320
  }
1321
  </script>
 
1322
  </p></div>
1323
  <?php } elseif ( isset( $_GET['message'] ) && $_GET['message'] == '4' ) {
1324
  echo "<div id='message' class='updated fade'><p>";
@@ -2367,6 +2392,45 @@ wp_editor( $post->post_content, 'content', $editor_config );
2367
  } else {
2368
  $message = '3';
2369
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2370
  } elseif ( isset( $_POST['ll60catmapping'] ) ) {
2371
  $upload_dir = wp_upload_dir();
2372
 
@@ -3146,7 +3210,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
3146
 
3147
  update_option( 'LinkLibraryGeneral', $genoptions );
3148
 
3149
- if ( !isset( $_POST['recipcheck'] ) && !isset( $_POST['brokencheck'] ) && !isset( $_POST['duplicatecheck'] ) && !isset( $_POST['emptycatcheck'] ) && !isset( $_POST['rsscheck'] ) ) {
3150
  $message = 1;
3151
  } elseif ( isset( $_POST['recipcheck'] ) ) {
3152
  $message = 2;
@@ -3158,7 +3222,11 @@ wp_editor( $post->post_content, 'content', $editor_config );
3158
  $message = 5;
3159
  } elseif ( isset( $_POST['rsscheck'] ) ) {
3160
  $message = 6;
3161
- }
 
 
 
 
3162
 
3163
  //lets redirect the post request into get request (you may add additional params at the url, if you need to show save results
3164
  $redirect_url = remove_query_arg( array( 'message' ), $_POST['_wp_http_referer'] );
@@ -4048,6 +4116,12 @@ function general_custom_fields_meta_box( $data ) {
4048
  <input class="button" type="submit" id="exportalllinks" name="exportalllinks" value="<?php _e( 'Export All Links', 'link-library' ); ?>" />
4049
  </td>
4050
  </tr>
 
 
 
 
 
 
4051
  </table>
4052
  <hr />
4053
  <table>
@@ -7377,6 +7451,16 @@ function general_custom_fields_meta_box( $data ) {
7377
  <input class="button" type='submit' id="duplicatecheck" name="duplicatecheck" value="<?php _e( 'Check Duplicate Links', 'link-library' ); ?>" />
7378
  </td>
7379
  </tr>
 
 
 
 
 
 
 
 
 
 
7380
  <tr>
7381
  <td>
7382
  <input class="button" type='submit' id="emptycatcheck" name="emptycatcheck" value="<?php _e( 'Check Links Missing Categories', 'link-library' ); ?>" />
@@ -8480,6 +8564,10 @@ function link_library_reciprocal_link_checker() {
8480
  $args['meta_key'] = 'link_url';
8481
  } elseif( 'rss' == $check_type ) {
8482
  $args['meta_key'] = 'link_rss';
 
 
 
 
8483
  }
8484
 
8485
  $the_link_query = new WP_Query( $args );
@@ -8491,6 +8579,8 @@ function link_library_reciprocal_link_checker() {
8491
  global $my_link_library_plugin;
8492
  $link_url = get_post_meta( get_the_ID(), 'link_url', true );
8493
  $link_rss = get_post_meta( get_the_ID(), 'link_rss', true );
 
 
8494
 
8495
  if ( 'reciprocal' == $check_type ) {
8496
  $link_reciprocal = get_post_meta( get_the_ID(), 'link_reciprocal', true );
@@ -8499,7 +8589,11 @@ function link_library_reciprocal_link_checker() {
8499
  $reciprocal_result = $my_link_library_plugin->CheckReciprocalLink( $RecipCheckAddress, $link_url, 'broken' );
8500
  } elseif ( 'rss' == $check_type ) {
8501
  $reciprocal_result = $my_link_library_plugin->CheckReciprocalLink( $RecipCheckAddress, $link_rss, 'rss' );
8502
- }
 
 
 
 
8503
 
8504
  $broken_responses = array( 'exists_redirected', 'exists_protocol_redirect', 'exists_subdomain_redirect', 'exists_redirected_subfolder', 'exists_redirected_fileurl' );
8505
 
@@ -8521,7 +8615,7 @@ function link_library_reciprocal_link_checker() {
8521
  }
8522
  }
8523
 
8524
- if ( ( 'reciprocal' == $check_type && $reciprocal_result == 'exists_found' ) || 'broken' == $check_type && !in_array( $reciprocal_result, $broken_responses ) && strpos( $reciprocal_result, 'exists' ) !== false ) {
8525
  echo '<div class="nextcheckitem"></div>';
8526
  wp_reset_postdata();
8527
  die();
1215
 
1216
  if ( isset( $_GET['message'] ) && $_GET['message'] == '1' ) {
1217
  echo "<div id='message' class='updated fade'><p><strong>" . __( 'Settings updated', 'link-library' ) . ".</strong></p></div>";
1218
+ } elseif ( isset( $_GET['message'] ) && ( $_GET['message'] == '2' || $_GET['message'] == '3' || $_GET['message'] == 6 || $_GET['message'] == 7 || $_GET['message'] == 8 ) ) { ?>
1219
  <div id='message' class='updated fade'><p>
1220
  <strong>
1221
  <?php
1229
  } elseif ( intval( $_GET['message'] ) == 6 ) {
1230
  _e( 'RSS Link Checker Report', 'link-library' );
1231
  $mode = 'rss';
1232
+ } elseif ( intval( $_GET['message'] ) == 7 ) {
1233
+ _e( 'Secondary URLs Link Checker Report', 'link-library' );
1234
+ $mode = 'secondary';
1235
+ } elseif ( intval( $_GET['message'] ) == 8 ) {
1236
+ _e( 'Image Link Checker Report', 'link-library' );
1237
+ $mode = 'image';
1238
  }
1239
  ?></strong><br />
 
1240
  <?php
1241
  $args = array(
1242
  'post_type' => 'link_library_links',
1270
  if ( !empty( $link_rss ) ) {
1271
  $total_post_count++;
1272
  }
1273
+ } elseif( 'secondary' == $mode ) {
1274
+ $link_secondary = get_post_meta( get_the_ID(), 'link_second_url', true );
1275
+
1276
+ if ( !empty( $link_secondary ) ) {
1277
+ $total_post_count++;
1278
+ }
1279
+ } elseif( 'image' == $mode ) {
1280
+ $link_image = get_post_meta( get_the_ID(), 'link_image', true );
1281
+
1282
+ if ( !empty( $link_image ) ) {
1283
+ $total_post_count++;
1284
+ }
1285
+ }
1286
  }
1287
+ }
1288
+
1289
+ if ( $total_post_count > 0 ) { ?>
1290
+
1291
+ <span class="loadingicon"><img src="<?php echo plugins_url( 'icons/Ajax-loader.gif', __FILE__ ); ?> " /></span><span class="processinglinks">Processing Link <span class="currentlinknumber">0</span> / <span class="totallinknumber">
1292
+
1293
+ <?php echo $total_post_count; } else { ?>
1294
+ No links to check
1295
+ <?php } ?>
1296
 
 
 
1297
  </span></span>
1298
  <br />
1299
+ <?php if ( $total_post_count > 0 ) { ?>
1300
  <div class="nextcheckitem"></div>
1301
  <script type="text/javascript">
1302
  var currentlinkindex = 1;
1343
  }
1344
  }
1345
  </script>
1346
+ <?php } ?>
1347
  </p></div>
1348
  <?php } elseif ( isset( $_GET['message'] ) && $_GET['message'] == '4' ) {
1349
  echo "<div id='message' class='updated fade'><p>";
2392
  } else {
2393
  $message = '3';
2394
  }
2395
+ } elseif ( isset( $_POST['exportallcategories'] ) ) {
2396
+ $upload_dir = wp_upload_dir();
2397
+
2398
+ if ( is_writable( $upload_dir['path'] ) ) {
2399
+ $myFile = $upload_dir['path'] . "/CategoriesExport.csv";
2400
+ $fh = fopen( $myFile, 'w' ) or die( "can't open file" );
2401
+
2402
+ $link_library_categories = get_terms( 'link_library_category', array( 'hide_empty' => false, ) );
2403
+
2404
+ if ( !empty( $link_library_categories ) ) {
2405
+ $headerrow = array( 'Category Name', 'Category ID' );
2406
+
2407
+ $headerdata = join( ',', $headerrow ) . "\n";
2408
+ fwrite( $fh, $headerdata );
2409
+
2410
+ foreach( $link_library_categories as $link_library_cat ) {
2411
+ $datarow = array();
2412
+ $datarow[] = $link_library_cat->name;
2413
+ $datarow[] = $link_library_cat->term_id;
2414
+ fputcsv( $fh, $datarow, ',', '"' );
2415
+ }
2416
+ }
2417
+
2418
+ fclose( $fh );
2419
+
2420
+ if ( file_exists( $myFile ) ) {
2421
+ header( 'Content-Description: File Transfer' );
2422
+ header( 'Content-Type: application/octet-stream' );
2423
+ header( 'Content-Disposition: attachment; filename=' . basename( $myFile ) );
2424
+ header( 'Expires: 0' );
2425
+ header( 'Cache-Control: must-revalidate' );
2426
+ header( 'Pragma: public' );
2427
+ header( 'Content-Length: ' . filesize( $myFile ) );
2428
+ readfile( $myFile );
2429
+ exit;
2430
+ }
2431
+ } else {
2432
+ $message = '3';
2433
+ }
2434
  } elseif ( isset( $_POST['ll60catmapping'] ) ) {
2435
  $upload_dir = wp_upload_dir();
2436
 
3210
 
3211
  update_option( 'LinkLibraryGeneral', $genoptions );
3212
 
3213
+ if ( !isset( $_POST['recipcheck'] ) && !isset( $_POST['brokencheck'] ) && !isset( $_POST['duplicatecheck'] ) && !isset( $_POST['emptycatcheck'] ) && !isset( $_POST['rsscheck'] ) && !isset( $_POST['secondaryurlcheck'] ) && !isset( $_POST['imagelinkcheck'] ) ) {
3214
  $message = 1;
3215
  } elseif ( isset( $_POST['recipcheck'] ) ) {
3216
  $message = 2;
3222
  $message = 5;
3223
  } elseif ( isset( $_POST['rsscheck'] ) ) {
3224
  $message = 6;
3225
+ } elseif ( isset( $_POST['secondaryurlcheck'] ) ) {
3226
+ $message = 7;
3227
+ } elseif ( isset( $_POST['imagelinkcheck'] ) ) {
3228
+ $message = 8;
3229
+ }
3230
 
3231
  //lets redirect the post request into get request (you may add additional params at the url, if you need to show save results
3232
  $redirect_url = remove_query_arg( array( 'message' ), $_POST['_wp_http_referer'] );
4116
  <input class="button" type="submit" id="exportalllinks" name="exportalllinks" value="<?php _e( 'Export All Links', 'link-library' ); ?>" />
4117
  </td>
4118
  </tr>
4119
+ <tr>
4120
+ <td><?php _e( 'Export all categories to a CSV file', 'link-library' ); ?></td>
4121
+ <td>
4122
+ <input class="button" type="submit" id="exportallcategories" name="exportallcategories" value="<?php _e( 'Export All Categories', 'link-library' ); ?>" />
4123
+ </td>
4124
+ </tr>
4125
  </table>
4126
  <hr />
4127
  <table>
7451
  <input class="button" type='submit' id="duplicatecheck" name="duplicatecheck" value="<?php _e( 'Check Duplicate Links', 'link-library' ); ?>" />
7452
  </td>
7453
  </tr>
7454
+ <!-- <tr>
7455
+ <td>
7456
+ <input class="button" type='submit' id="secondaryurlcheck" name="secondaryurlcheck" value="<?php _e( 'Check Secondary URL Links', 'link-library' ); ?>" />
7457
+ </td>
7458
+ </tr>
7459
+ <tr>
7460
+ <td>
7461
+ <input class="button" type='submit' id="imagelinkcheck" name="imagelinkcheck" value="<?php _e( 'Check Image Links', 'link-library' ); ?>" />
7462
+ </td>
7463
+ </tr> -->
7464
  <tr>
7465
  <td>
7466
  <input class="button" type='submit' id="emptycatcheck" name="emptycatcheck" value="<?php _e( 'Check Links Missing Categories', 'link-library' ); ?>" />
8564
  $args['meta_key'] = 'link_url';
8565
  } elseif( 'rss' == $check_type ) {
8566
  $args['meta_key'] = 'link_rss';
8567
+ } elseif ( 'secondary' == $check_type ) {
8568
+ $args['meta_key'] = 'link_second_url';
8569
+ } elseif ( 'image' == $check_type ) {
8570
+ $args['meta_key'] = 'link_image';
8571
  }
8572
 
8573
  $the_link_query = new WP_Query( $args );
8579
  global $my_link_library_plugin;
8580
  $link_url = get_post_meta( get_the_ID(), 'link_url', true );
8581
  $link_rss = get_post_meta( get_the_ID(), 'link_rss', true );
8582
+ $link_secondary_url = get_post_meta( get_the_ID(), 'link_second_url', true );
8583
+ $link_image = get_post_meta( get_the_ID(), 'link_image', true );
8584
 
8585
  if ( 'reciprocal' == $check_type ) {
8586
  $link_reciprocal = get_post_meta( get_the_ID(), 'link_reciprocal', true );
8589
  $reciprocal_result = $my_link_library_plugin->CheckReciprocalLink( $RecipCheckAddress, $link_url, 'broken' );
8590
  } elseif ( 'rss' == $check_type ) {
8591
  $reciprocal_result = $my_link_library_plugin->CheckReciprocalLink( $RecipCheckAddress, $link_rss, 'rss' );
8592
+ } elseif ( 'secondary' == $check_type ) {
8593
+ $reciprocal_result = $my_link_library_plugin->CheckReciprocalLink( $RecipCheckAddress, $link_secondary_url, 'secondary' );
8594
+ } elseif ( 'image' == $check_type ) {
8595
+ $reciprocal_result = $my_link_library_plugin->CheckReciprocalLink( $RecipCheckAddress, $link_image, 'image' );
8596
+ }
8597
 
8598
  $broken_responses = array( 'exists_redirected', 'exists_protocol_redirect', 'exists_subdomain_redirect', 'exists_redirected_subfolder', 'exists_redirected_fileurl' );
8599
 
8615
  }
8616
  }
8617
 
8618
+ if ( ( 'reciprocal' == $check_type && $reciprocal_result == 'exists_found' ) || in_array( $check_type, array( 'broken', 'secondary', 'image' ) ) && !in_array( $reciprocal_result, $broken_responses ) && strpos( $reciprocal_result, 'exists' ) !== false ) {
8619
  echo '<div class="nextcheckitem"></div>';
8620
  wp_reset_postdata();
8621
  die();
link-library.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Link Library
4
  Plugin URI: http://wordpress.org/extend/plugins/link-library/
5
  Description: Display links on pages with a variety of options
6
- Version: 7.3.12
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
@@ -1152,7 +1152,7 @@ class link_library_plugin {
1152
  }
1153
 
1154
  function CheckReciprocalLink( $RecipCheckAddress = '', $external_link = '', $request_type = 'reciprocal' ) {
1155
- $response = wp_remote_get( $external_link, array( 'user-agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36', 'timeout' => 10 ) );
1156
 
1157
  if( is_wp_error( $response ) ) {
1158
  $response_code = $response->get_error_code();
@@ -1187,7 +1187,7 @@ class link_library_plugin {
1187
  $parse_original_url = parse_url( $external_link );
1188
  $parse_actual_url = parse_url( $response['http_response']->get_response_object()->url );
1189
 
1190
- if ( ( 'broken' == $request_type || 'rss' == $request_type ) && $parse_original_url['host'] != $parse_actual_url['host'] ) {
1191
  $original_host_segments = explode( '.', $parse_original_url['host'] );
1192
  $actual_host_segments = explode( '.', $parse_actual_url['host'] );
1193
 
@@ -1198,7 +1198,7 @@ class link_library_plugin {
1198
  }
1199
  }
1200
 
1201
- if ( ( 'broken' == $request_type || 'rss' == $request_type ) && $parse_original_url['host'] == $parse_actual_url['host'] && $link_url_without_protocol != $response_url_without_protocol ) {
1202
  $basename = basename( $parse_actual_url['path'] );
1203
  if ( false !== strpos( $basename, '.' ) ) {
1204
  return 'exists_redirected_fileurl';
@@ -1207,11 +1207,11 @@ class link_library_plugin {
1207
  }
1208
  }
1209
 
1210
- if ( ( 'broken' == $request_type || 'rss' == $request_type ) && $link_url_without_protocol != $response_url_without_protocol ) {
1211
  return 'exists_redirected';
1212
- } elseif ( ( 'broken' == $request_type || 'rss' == $request_type ) && !empty( $original_protocol ) && !empty( $actual_protocol ) && $original_protocol != $actual_protocol ) {
1213
  return 'exists_protocol_redirect';
1214
- } elseif ( ( 'broken' == $request_type || 'rss' == $request_type ) && empty( $RecipCheckAddress ) ) {
1215
  return 'exists_notfound';
1216
  } else {
1217
  return 'exists_found';
3
  Plugin Name: Link Library
4
  Plugin URI: http://wordpress.org/extend/plugins/link-library/
5
  Description: Display links on pages with a variety of options
6
+ Version: 7.3.13
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
1152
  }
1153
 
1154
  function CheckReciprocalLink( $RecipCheckAddress = '', $external_link = '', $request_type = 'reciprocal' ) {
1155
+ $response = wp_remote_get( $external_link, array( 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36', 'timeout' => 10 ) );
1156
 
1157
  if( is_wp_error( $response ) ) {
1158
  $response_code = $response->get_error_code();
1187
  $parse_original_url = parse_url( $external_link );
1188
  $parse_actual_url = parse_url( $response['http_response']->get_response_object()->url );
1189
 
1190
+ if ( ( 'broken' == $request_type || 'rss' == $request_type || 'secondary' == $request_type || 'image' == $request_type ) && $parse_original_url['host'] != $parse_actual_url['host'] ) {
1191
  $original_host_segments = explode( '.', $parse_original_url['host'] );
1192
  $actual_host_segments = explode( '.', $parse_actual_url['host'] );
1193
 
1198
  }
1199
  }
1200
 
1201
+ if ( ( 'broken' == $request_type || 'rss' == $request_type || 'secondary' == $request_type || 'image' == $request_type ) && $parse_original_url['host'] == $parse_actual_url['host'] && $link_url_without_protocol != $response_url_without_protocol ) {
1202
  $basename = basename( $parse_actual_url['path'] );
1203
  if ( false !== strpos( $basename, '.' ) ) {
1204
  return 'exists_redirected_fileurl';
1207
  }
1208
  }
1209
 
1210
+ if ( ( 'broken' == $request_type || 'rss' == $request_type || 'secondary' == $request_type || 'image' == $request_type ) && $link_url_without_protocol != $response_url_without_protocol ) {
1211
  return 'exists_redirected';
1212
+ } elseif ( ( 'broken' == $request_type || 'rss' == $request_type || 'secondary' == $request_type || 'image' == $request_type ) && !empty( $original_protocol ) && !empty( $actual_protocol ) && $original_protocol != $actual_protocol ) {
1213
  return 'exists_protocol_redirect';
1214
+ } elseif ( ( 'broken' == $request_type || 'rss' == $request_type || 'secondary' == $request_type || 'image' == $request_type ) && empty( $RecipCheckAddress ) ) {
1215
  return 'exists_notfound';
1216
  } else {
1217
  return 'exists_found';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://ylefebvre.github.io/wordpress-plugins/link-library/
4
  Tags: link, list, directory, page, library, AJAX, RSS, feeds, inline, search, paging, add, submit, import, batch, pop-up
5
  Requires at least: 4.4
6
  Tested up to: 6.0.1
7
- Stable tag: 7.3.12
8
 
9
  The purpose of this plugin is to add the ability to output a list of link categories and a complete list of links with notes and descriptions.
10
 
@@ -50,6 +50,9 @@ Further configuration is available under the Link Library Settings panel.
50
 
51
  == Changelog ==
52
 
 
 
 
53
  = 7.3.12 =
54
  * Add general option to show excerpt section in link editor
55
 
4
  Tags: link, list, directory, page, library, AJAX, RSS, feeds, inline, search, paging, add, submit, import, batch, pop-up
5
  Requires at least: 4.4
6
  Tested up to: 6.0.1
7
+ Stable tag: 7.3.13
8
 
9
  The purpose of this plugin is to add the ability to output a list of link categories and a complete list of links with notes and descriptions.
10
 
50
 
51
  == Changelog ==
52
 
53
+ = 7.3.13 =
54
+ * Added new tool under Global Options > Import/Export to export list of categories with IDs
55
+
56
  = 7.3.12 =
57
  * Add general option to show excerpt section in link editor
58