Link Library - Version 7.2.1

Version Description

  • Add support for WordPress mshots thumbnail generator
Download this release

Release Info

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

Code changes from version 7.2.0 to 7.2.1

link-library-admin.php CHANGED
@@ -448,6 +448,7 @@ class link_library_plugin_admin {
448
  }
449
 
450
  function ll_get_link_image( $url, $name, $mode, $linkid, $cid, $filepath, $filepathtype, $thumbnailsize, $thumbnailgenerator ) {
 
451
  if ( $url != "" && $name != "" ) {
452
  $protocol = is_ssl() ? 'https://' : 'http://';
453
 
@@ -466,11 +467,16 @@ class link_library_plugin_admin {
466
  if ( !empty ( $cid ) ) {
467
  $genthumburl = $protocol . "images.thumbshots.com/image.aspx?cid=" . rawurlencode( $cid ) . "&v1=w=120&url=" . esc_html( $url );
468
  }
 
 
 
469
  }
470
  } elseif ( $mode == 'favicon' || $mode == 'favicononly' ) {
471
  $genthumburl = $protocol . "www.google.com/s2/favicons?domain=" . $url;
472
  }
473
 
 
 
474
  $uploads = wp_upload_dir();
475
 
476
  if ( !file_exists( $uploads['basedir'] ) ) {
@@ -485,7 +491,12 @@ class link_library_plugin_admin {
485
 
486
  $img = $uploads['basedir'] . "/" . $filepath . "/" . $linkid . '.png';
487
  if ( $thumbnailgenerator != 'google' || $mode == 'favicon' || $mode == 'favicononly' ) {
488
- $status = file_put_contents( $img, @file_get_contents( $genthumburl ) );
 
 
 
 
 
489
  } elseif ( $thumbnailgenerator == 'google' && ( $mode == 'thumb' || $mode == 'thumbonly' ) ) {
490
  $screenshot = file_get_contents('https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?url=' . esc_html( $url ));
491
  $data_whole = json_decode($screenshot);
@@ -571,7 +582,7 @@ class link_library_plugin_admin {
571
  }
572
  }
573
 
574
- return "Parameters are missing";
575
  }
576
 
577
 
@@ -989,7 +1000,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
989
  $link_image = get_post_meta( get_the_ID(), 'link_image', true );
990
 
991
  if ( !$options['uselocalimagesoverthumbshots'] || ( $options['uselocalimagesoverthumbshots'] && empty( $link_image ) ) ) {
992
- if ( 'robothumb' == $genoptions['thumbnailgenerator'] || 'thumbshots' == $genoptions['thumbnailgenerator'] ) {
993
  $this->ll_get_link_image( $link_url, get_the_title(), $genmode, get_the_ID(), $genoptions['thumbshotscid'], $filepath, $genoptions['imagefilepath'], $genoptions['thumbnailsize'], $genoptions['thumbnailgenerator'] );
994
  } elseif ( 'pagepeeker' == $genoptions['thumbnailgenerator'] ) {
995
  $this->ll_get_link_image( $link_url, get_the_title(), $genmode, get_the_ID(), $genoptions['pagepeekerid'], $filepath, $genoptions['imagefilepath'], $genoptions['pagepeekersize'], $genoptions['thumbnailgenerator'] );
@@ -3299,6 +3310,7 @@ wp_editor( $post->post_content, 'content', $editor_config );
3299
  <option value="robothumb" <?php selected( $genoptions['thumbnailgenerator'], 'robothumb' ); ?>>Robothumb.com
3300
  <option value="shrinktheweb" <?php selected( $genoptions['thumbnailgenerator'], 'shrinktheweb' ); ?>>Shrink The Web
3301
  <option value="pagepeeker" <?php selected( $genoptions['thumbnailgenerator'], 'pagepeeker' ); ?>>PagePeeker
 
3302
  <option value="thumbshots" <?php selected( $genoptions['thumbnailgenerator'], 'thumbshots' ); ?>>Thumbshots.org
3303
  <option value="google" <?php selected( $genoptions['thumbnailgenerator'], 'google' ); ?>>Google PageSpeed
3304
  </select>
@@ -3375,6 +3387,27 @@ wp_editor( $post->post_content, 'content', $editor_config );
3375
  </select>
3376
  </td>
3377
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3378
  <tr>
3379
  <td colspan="2"><hr /></td>
3380
  </tr>
@@ -3492,6 +3525,8 @@ wp_editor( $post->post_content, 'content', $editor_config );
3492
  jQuery(".robothumbsize").hide();
3493
  jQuery(".pagepeekerid").hide();
3494
  jQuery(".pagepeekersizes").hide();
 
 
3495
  jQuery(".shrinkthewebsizes").hide();
3496
  jQuery(".shrinkthewebaccesskey").hide();
3497
 
@@ -3505,6 +3540,9 @@ wp_editor( $post->post_content, 'content', $editor_config );
3505
  } else if ( jQuery( '#thumbnailgenerator').val() == 'shrinktheweb' ) {
3506
  jQuery(".shrinkthewebsizes").show();
3507
  jQuery(".shrinkthewebaccesskey").show();
 
 
 
3508
  }
3509
  });
3510
  });
@@ -6247,10 +6285,10 @@ function general_custom_fields_meta_box( $data ) {
6247
  <div style='padding-top:15px' id="ll-thumbnails" class="content-section">
6248
  <table>
6249
  <tr>
6250
- <td style='width: 400px' class='lltooltip' title='<?php _e( 'Checking this option will get images from the Robothumb web site every time', 'link-library' ); ?>.'>
6251
  <?php _e( 'Use thumbnail service for dynamic link images', 'link-library' ); ?>
6252
  </td>
6253
- <td class='lltooltip' title='<?php _e( 'Checking this option will get images from the thumbshots web site every time', 'link-library' ); ?>.' style='width:75px;padding-right:20px'>
6254
  <input type="checkbox" id="usethumbshotsforimages" name="usethumbshotsforimages" <?php checked( $options['usethumbshotsforimages'] ); ?>/>
6255
  </td>
6256
  </tr>
448
  }
449
 
450
  function ll_get_link_image( $url, $name, $mode, $linkid, $cid, $filepath, $filepathtype, $thumbnailsize, $thumbnailgenerator ) {
451
+ $status = false;
452
  if ( $url != "" && $name != "" ) {
453
  $protocol = is_ssl() ? 'https://' : 'http://';
454
 
467
  if ( !empty ( $cid ) ) {
468
  $genthumburl = $protocol . "images.thumbshots.com/image.aspx?cid=" . rawurlencode( $cid ) . "&v1=w=120&url=" . esc_html( $url );
469
  }
470
+ } elseif ( $thumbnailgenerator == 'wordpressmshots' ) {
471
+ $dimension_array = explode( 'x', $thumbnailsize );
472
+ $genthumburl = $protocol . "s0.wp.com/mshots/v1/" . rtrim( esc_html( $url ), '/' ) . '?w=' . $dimension_array[0]. '&h=' . $dimension_array[1];
473
  }
474
  } elseif ( $mode == 'favicon' || $mode == 'favicononly' ) {
475
  $genthumburl = $protocol . "www.google.com/s2/favicons?domain=" . $url;
476
  }
477
 
478
+ linklibrary_write_log( $genthumburl );
479
+
480
  $uploads = wp_upload_dir();
481
 
482
  if ( !file_exists( $uploads['basedir'] ) ) {
491
 
492
  $img = $uploads['basedir'] . "/" . $filepath . "/" . $linkid . '.png';
493
  if ( $thumbnailgenerator != 'google' || $mode == 'favicon' || $mode == 'favicononly' ) {
494
+ $tempfile = download_url( $genthumburl );
495
+ if ( !is_wp_error( $tempfile ) ) {
496
+ copy( $tempfile, $img );
497
+ unlink( $tempfile );
498
+ $status = true;
499
+ }
500
  } elseif ( $thumbnailgenerator == 'google' && ( $mode == 'thumb' || $mode == 'thumbonly' ) ) {
501
  $screenshot = file_get_contents('https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?url=' . esc_html( $url ));
502
  $data_whole = json_decode($screenshot);
582
  }
583
  }
584
 
585
+ return 'Parameters are missing';
586
  }
587
 
588
 
1000
  $link_image = get_post_meta( get_the_ID(), 'link_image', true );
1001
 
1002
  if ( !$options['uselocalimagesoverthumbshots'] || ( $options['uselocalimagesoverthumbshots'] && empty( $link_image ) ) ) {
1003
+ if ( in_array( $genoptions['thumbnailgenerator'], array( 'robothumb', 'thumbshots', 'wordpressmshots', 'google' ) ) ) {
1004
  $this->ll_get_link_image( $link_url, get_the_title(), $genmode, get_the_ID(), $genoptions['thumbshotscid'], $filepath, $genoptions['imagefilepath'], $genoptions['thumbnailsize'], $genoptions['thumbnailgenerator'] );
1005
  } elseif ( 'pagepeeker' == $genoptions['thumbnailgenerator'] ) {
1006
  $this->ll_get_link_image( $link_url, get_the_title(), $genmode, get_the_ID(), $genoptions['pagepeekerid'], $filepath, $genoptions['imagefilepath'], $genoptions['pagepeekersize'], $genoptions['thumbnailgenerator'] );
3310
  <option value="robothumb" <?php selected( $genoptions['thumbnailgenerator'], 'robothumb' ); ?>>Robothumb.com
3311
  <option value="shrinktheweb" <?php selected( $genoptions['thumbnailgenerator'], 'shrinktheweb' ); ?>>Shrink The Web
3312
  <option value="pagepeeker" <?php selected( $genoptions['thumbnailgenerator'], 'pagepeeker' ); ?>>PagePeeker
3313
+ <option value="wordpressmshots" <?php selected( $genoptions['thumbnailgenerator'], 'wordpressmshots' ); ?>>WordPress.com mshots
3314
  <option value="thumbshots" <?php selected( $genoptions['thumbnailgenerator'], 'thumbshots' ); ?>>Thumbshots.org
3315
  <option value="google" <?php selected( $genoptions['thumbnailgenerator'], 'google' ); ?>>Google PageSpeed
3316
  </select>
3387
  </select>
3388
  </td>
3389
  </tr>
3390
+ <tr class="wordpressmshotswarning" <?php if ( $genoptions['thumbnailgenerator'] != 'wordpressmshots' ) {
3391
+ echo 'style="display:none;"';
3392
+ } ?>>
3393
+ <td colspan="2"><?php _e( 'The WordPress mshots service is only free for non-commercial applications. If using it on a commercial site, contact <a href="https://automattic.com/contact/">Automattic</a> to get a license for use.' ); ?>
3394
+ </td>
3395
+ </tr>
3396
+ <tr class="wordpressmshotssize" <?php if ( $genoptions['thumbnailgenerator'] != 'wordpressmshots' ) {
3397
+ echo 'style="display:none;"';
3398
+ } ?>>
3399
+ <td><?php _e( 'WordPress.com mshots Thumbnail size' ); ?>
3400
+ </td>
3401
+ <td>
3402
+ <select id="thumbnailsize" name="thumbnailsize">
3403
+ <?php $sizes = array( '100x75', '120x90', '160x120', '180x135', '240x180', '320x240', '560x420', '640x480', '800x600', '1280x960' );
3404
+
3405
+ foreach ( $sizes as $size ) { ?>
3406
+ <option value="<?php echo $size; ?>" <?php selected( $genoptions['thumbnailsize'], $size ); ?>><?php echo $size; ?>
3407
+ <?php } ?>
3408
+ </select>
3409
+ </td>
3410
+ </tr>
3411
  <tr>
3412
  <td colspan="2"><hr /></td>
3413
  </tr>
3525
  jQuery(".robothumbsize").hide();
3526
  jQuery(".pagepeekerid").hide();
3527
  jQuery(".pagepeekersizes").hide();
3528
+ jQuery(".wordpressmshotswarning").hide();
3529
+ jQuery(".wordpressmshotssize").hide();
3530
  jQuery(".shrinkthewebsizes").hide();
3531
  jQuery(".shrinkthewebaccesskey").hide();
3532
 
3540
  } else if ( jQuery( '#thumbnailgenerator').val() == 'shrinktheweb' ) {
3541
  jQuery(".shrinkthewebsizes").show();
3542
  jQuery(".shrinkthewebaccesskey").show();
3543
+ } else if ( jQuery( '#thumbnailgenerator').val() == 'wordpressmshots' ) {
3544
+ jQuery(".wordpressmshotswarning").show();
3545
+ jQuery(".wordpressmshotssize").show();
3546
  }
3547
  });
3548
  });
6285
  <div style='padding-top:15px' id="ll-thumbnails" class="content-section">
6286
  <table>
6287
  <tr>
6288
+ <td style='width: 400px' class='lltooltip' title='<?php _e( 'Checking this option will get images from the selected thumbnail generation service every time', 'link-library' ); ?>.'>
6289
  <?php _e( 'Use thumbnail service for dynamic link images', 'link-library' ); ?>
6290
  </td>
6291
+ <td class='lltooltip' title='<?php _e( 'Checking this option will get images from the selected thumbnail generation service every time', 'link-library' ); ?>.' style='width:75px;padding-right:20px'>
6292
  <input type="checkbox" id="usethumbshotsforimages" name="usethumbshotsforimages" <?php checked( $options['usethumbshotsforimages'] ); ?>/>
6293
  </td>
6294
  </tr>
link-library-image-generator.php CHANGED
@@ -20,7 +20,7 @@ function link_library_ajax_image_generator ( $my_link_library_plugin_admin ) {
20
  $filepathtype = $_POST['filepathtype'];
21
  $linkid = intval($_POST['linkid']);
22
 
23
- if ( 'robothumb' == $generaloptions['thumbnailgenerator'] || 'thumbshots' == $generaloptions['thumbnailgenerator'] || 'google' == $generaloptions['thumbnailgenerator'] ) {
24
  echo $my_link_library_plugin_admin->ll_get_link_image($url, $name, $mode, $linkid, $cid, $filepath, $filepathtype, $generaloptions['thumbnailsize'], $generaloptions['thumbnailgenerator'] );
25
  } elseif ( 'pagepeeker' == $generaloptions['thumbnailgenerator'] ) {
26
  echo $my_link_library_plugin_admin->ll_get_link_image($url, $name, $mode, $linkid, $generaloptions['pagepeekerid'], $filepath, $filepathtype, $generaloptions['pagepeekersize'], $generaloptions['thumbnailgenerator'] );
20
  $filepathtype = $_POST['filepathtype'];
21
  $linkid = intval($_POST['linkid']);
22
 
23
+ if ( in_array( $generaloptions['thumbnailgenerator'], array( 'robothumb', 'thumbshots', 'google', 'wordpressmshots' ) ) ) {
24
  echo $my_link_library_plugin_admin->ll_get_link_image($url, $name, $mode, $linkid, $cid, $filepath, $filepathtype, $generaloptions['thumbnailsize'], $generaloptions['thumbnailgenerator'] );
25
  } elseif ( 'pagepeeker' == $generaloptions['thumbnailgenerator'] ) {
26
  echo $my_link_library_plugin_admin->ll_get_link_image($url, $name, $mode, $linkid, $generaloptions['pagepeekerid'], $filepath, $filepathtype, $generaloptions['pagepeekersize'], $generaloptions['thumbnailgenerator'] );
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.2.0
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
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.2.1
7
  Author: Yannick Lefebvre
8
  Author URI: http://ylefebvre.github.io/
9
  Text Domain: link-library
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: 5.7.2
7
- Stable tag: 7.2.0
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
 
@@ -21,7 +21,7 @@ For screenshots showing how to achieve these results, check out my [site](https:
21
  All pages are generated using different configurations all managed by Link Library. Link Library is compatible with the [My Link Order](http://wordpress.org/extend/plugins/my-link-order/) plugin to define category and link ordering.
22
 
23
  * [Changelog](http://wordpress.org/extend/plugins/link-library/other_notes/)
24
- * [Support Forum](http://wordpress.org/tags/link-library)
25
 
26
  == Installation ==
27
 
@@ -48,6 +48,9 @@ Further configuration is available under the Link Library Settings panel.
48
 
49
  == Changelog ==
50
 
 
 
 
51
  = 7.2.0 =
52
  * Links can now be sorted by number of hits in admin
53
 
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: 5.7.2
7
+ Stable tag: 7.2.1
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
 
21
  All pages are generated using different configurations all managed by Link Library. Link Library is compatible with the [My Link Order](http://wordpress.org/extend/plugins/my-link-order/) plugin to define category and link ordering.
22
 
23
  * [Changelog](http://wordpress.org/extend/plugins/link-library/other_notes/)
24
+ * [Support Forum](https://wordpress.org/support/plugin/link-library/)
25
 
26
  == Installation ==
27
 
48
 
49
  == Changelog ==
50
 
51
+ = 7.2.1 =
52
+ * Add support for WordPress mshots thumbnail generator
53
+
54
  = 7.2.0 =
55
  * Links can now be sorted by number of hits in admin
56