WP Retina 2x - Version 5.1.0

Version Description

  • Added: wr2x_get_pathinfo_from_image_src is available as part of the API.
  • Add: wr2x_picture_rewrite in the API
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 WP Retina 2x
Version 5.1.0
Comparing to
See all releases

Code changes from version 5.0.5 to 5.1.0

Files changed (8) hide show
  1. ajax.php +1 -2
  2. api.php +18 -0
  3. common/admin.css +1 -1
  4. common/admin.php +9 -9
  5. core.php +13 -5
  6. readme.txt +6 -2
  7. wp-retina-2x.php +2 -2
  8. wr2x_admin.php +1 -1
ajax.php CHANGED
@@ -584,8 +584,7 @@ class Meow_WR2X_Ajax {
584
  ));
585
  die();
586
  }
587
- require('wr2x_vt_resize.php');
588
- wr2x_vt_resize( $tmpfname, $meta['width'] * 2, $meta['height'] * 2, null, $retinafile );
589
  chmod( $retinafile, 0644 );
590
  unlink( $tmpfname );
591
 
584
  ));
585
  die();
586
  }
587
+ $this->core->resize( $tmpfname, $meta['width'] * 2, $meta['height'] * 2, null, $retinafile );
 
588
  chmod( $retinafile, 0644 );
589
  unlink( $tmpfname );
590
 
api.php CHANGED
@@ -7,6 +7,13 @@
7
  *
8
  */
9
 
 
 
 
 
 
 
 
10
  // Return Retina URL from the Image URL
11
  function wr2x_get_retina_from_url( $url ) {
12
  global $wr2x_core;
@@ -19,4 +26,15 @@ function wr2x_get_retina( $file ) {
19
  return $wr2x_core->get_retina( $file );
20
  }
21
 
 
 
 
 
 
 
 
 
 
 
 
22
  ?>
7
  *
8
  */
9
 
10
+ // Rewrite the HTML to add Retina support (not recommended, that is
11
+ // done automatically by the plugin through the Method)
12
+ function wr2x_picture_rewrite( $buffer ) {
13
+ global $wr2x_core;
14
+ return $wr2x_core->picture_rewrite( $buffer );
15
+ }
16
+
17
  // Return Retina URL from the Image URL
18
  function wr2x_get_retina_from_url( $url ) {
19
  global $wr2x_core;
26
  return $wr2x_core->get_retina( $file );
27
  }
28
 
29
+ // Generate the retina images for the given meta of a media
30
+ function wr2x_generate_images( $meta ) {
31
+ global $wr2x_core;
32
+ return $wr2x_core->generate_images( $meta );
33
+ }
34
+
35
+ function wr2x_get_pathinfo_from_image_src( $image_src ) {
36
+ global $wr2x_core;
37
+ return $wr2x_core->get_pathinfo_from_image_src( $meta );
38
+ }
39
+
40
  ?>
common/admin.css CHANGED
@@ -16,7 +16,7 @@
16
  }
17
 
18
  .meow-box small {
19
- font-size: 11px !important;
20
  }
21
 
22
  .meow-box h3 {
16
  }
17
 
18
  .meow-box small {
19
+ font-size: 12px !important;
20
  }
21
 
22
  .meow-box h3 {
common/admin.php CHANGED
@@ -5,7 +5,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
5
  class MeowApps_Admin {
6
 
7
  public static $loaded = false;
8
- public static $admin_version = "1.2";
9
 
10
  public $prefix; // prefix used for actions, filters (mfrh)
11
  public $mainfile; // plugin main file (media-file-renamer.php)
@@ -161,6 +161,8 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
161
 
162
  $plugin_file = $plugin . '/' . $plugin . '.php';
163
  if ( is_plugin_active( $plugin_file ) ) {
 
 
164
  if ( $pro )
165
  return "<small><span style='float: right;'><span class='dashicons dashicons-heart' style='color: rgba(255, 63, 0, 1); font-size: 30px !important; margin-right: 10px;'></span></span></small>";
166
  else
@@ -237,26 +239,24 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
237
  <h3 class=""><span class="dashicons dashicons-camera"></span> UI Plugins </h3>
238
  <ul class="">
239
  <li><b>WP/LR Sync</b> <?php echo $this->check_install( 'wplr-sync' ) ?><br />
240
- Bring synchronization from Lightroom to WordPress.</li>
241
  <li><b>Meow Lightbox</b> <?php echo $this->check_install( 'meow-lightbox' ) ?><br />
242
- Lightbox with EXIF information nicely displayed.</li>
243
  <li><b>Meow Gallery</b> <?php echo $this->check_install( 'meow-gallery' ) ?><br />
244
- Simple gallery to make your photos look better (Masonry and others).</li>
245
- <li><b>Audio Story for Images</b> <?php echo $this->check_install( 'audio-story-images' ) ?><br />
246
- Add audio to your images.</li>
247
  </ul>
248
  </div>
249
  <div class="meow-box meow-col meow-span_1_of_2">
250
  <h3 class=""><span class="dashicons dashicons-admin-tools"></span> System Plugins</h3>
251
  <ul class="">
252
  <li><b>Media File Renamer</b> <?php echo $this->check_install( 'media-file-renamer' ) ?><br />
253
- Nicer filenames and better SEO, automatically.</li>
254
  <li><b>Media Cleaner</b> <?php echo $this->check_install( 'media-cleaner' ) ?><br />
255
  Detect the files which are not in use.</li>
256
  <li><b>WP Retina 2x</b> <?php echo $this->check_install( 'wp-retina-2x' ) ?><br />
257
  The famous plugin that adds Retina support.</li>
258
- <li><b>WP Category Permalink</b> <?php echo $this->check_install( 'wp-category-permalink' ) ?><br />
259
- Allows you to select a main category (or taxonomy) for nicer permalinks.</li>
260
  </ul>
261
  </div>
262
  </div>
5
  class MeowApps_Admin {
6
 
7
  public static $loaded = false;
8
+ public static $admin_version = "1.3";
9
 
10
  public $prefix; // prefix used for actions, filters (mfrh)
11
  public $mainfile; // plugin main file (media-file-renamer.php)
161
 
162
  $plugin_file = $plugin . '/' . $plugin . '.php';
163
  if ( is_plugin_active( $plugin_file ) ) {
164
+ if ( $plugin == 'wplr-sync' )
165
+ $pro = true;
166
  if ( $pro )
167
  return "<small><span style='float: right;'><span class='dashicons dashicons-heart' style='color: rgba(255, 63, 0, 1); font-size: 30px !important; margin-right: 10px;'></span></span></small>";
168
  else
239
  <h3 class=""><span class="dashicons dashicons-camera"></span> UI Plugins </h3>
240
  <ul class="">
241
  <li><b>WP/LR Sync</b> <?php echo $this->check_install( 'wplr-sync' ) ?><br />
242
+ Synchronize photos (folders, collections, keywords) from Lightroom to WordPress.</li>
243
  <li><b>Meow Lightbox</b> <?php echo $this->check_install( 'meow-lightbox' ) ?><br />
244
+ Light but powerful lightbox that can also display photo information (EXIF).</li>
245
  <li><b>Meow Gallery</b> <?php echo $this->check_install( 'meow-gallery' ) ?><br />
246
+ Gallery (using the built-in WP gallery) that makes your website look better.</li>
247
+ <!-- <li><b>Audio Story for Images</b> <?php echo $this->check_install( 'audio-story-images' ) ?><br />
248
+ Add audio (music, explanation, ambiance) to your images.</li> -->
249
  </ul>
250
  </div>
251
  <div class="meow-box meow-col meow-span_1_of_2">
252
  <h3 class=""><span class="dashicons dashicons-admin-tools"></span> System Plugins</h3>
253
  <ul class="">
254
  <li><b>Media File Renamer</b> <?php echo $this->check_install( 'media-file-renamer' ) ?><br />
255
+ For nicer filenames and better SEO.</li>
256
  <li><b>Media Cleaner</b> <?php echo $this->check_install( 'media-cleaner' ) ?><br />
257
  Detect the files which are not in use.</li>
258
  <li><b>WP Retina 2x</b> <?php echo $this->check_install( 'wp-retina-2x' ) ?><br />
259
  The famous plugin that adds Retina support.</li>
 
 
260
  </ul>
261
  </div>
262
  </div>
core.php CHANGED
@@ -276,12 +276,16 @@ class Meow_WR2X_Core {
276
 
277
  function get_max_filesize() {
278
  if ( defined ('HHVM_VERSION' ) ) {
279
- return ini_get( 'upload_max_filesize' ) ? (int)$this->parse_ini_size( ini_get( 'upload_max_filesize' ) ) :
 
280
  (int)ini_get( 'hhvm.server.upload.upload_max_file_size' );
281
  }
282
  else {
283
- return (int)$this->parse_ini_size( ini_get( 'upload_max_filesize' ) );
 
284
  }
 
 
285
  }
286
 
287
  /**
@@ -859,7 +863,7 @@ class Meow_WR2X_Core {
859
  function log( $data, $isExtra = false ) {
860
  if ( !$this->is_debug() )
861
  return;
862
- $fh = fopen( trailingslashit( WP_PLUGIN_DIR ) . 'wp-retina-2x/wp-retina-2x.log', 'a' );
863
  $date = date( "Y-m-d H:i:s" );
864
  fwrite( $fh, "$date: {$data}\n" );
865
  fclose( $fh );
@@ -1050,8 +1054,12 @@ class Meow_WR2X_Core {
1050
  $meta['sizes'][$name]['height'] * 2, $crop, $retina_file, $customCrop );
1051
  }
1052
  if ( !file_exists( $retina_file ) ) {
1053
- $this->log( "[ERROR] Retina for {$name} could not be created. Full-Size is " . $meta['width'] . "x" . $meta['height'] . " but Retina requires a file of at least " . $meta['sizes'][$name]['width'] * 2 . "x" . $meta['sizes'][$name]['height'] * 2 . "." );
1054
- $issue = true;
 
 
 
 
1055
  }
1056
  else {
1057
  do_action( 'wr2x_retina_file_added', $id, $retina_file, $name );
276
 
277
  function get_max_filesize() {
278
  if ( defined ('HHVM_VERSION' ) ) {
279
+ $post_max_size = ini_get( 'post_max_size' ) ? (int)$this->parse_ini_size( ini_get( 'post_max_size' ) ) : (int)ini_get( 'hhvm.server.max_post_size' );
280
+ $upload_max_filesize = ini_get( 'upload_max_filesize' ) ? (int)$this->parse_ini_size( ini_get( 'upload_max_filesize' ) ) :
281
  (int)ini_get( 'hhvm.server.upload.upload_max_file_size' );
282
  }
283
  else {
284
+ $post_max_size = (int)$this->parse_ini_size( ini_get( 'post_max_size' ) );
285
+ $upload_max_filesize = (int)$this->parse_ini_size( ini_get( 'upload_max_filesize' ) );
286
  }
287
+ $max = min( $post_max_size, $upload_max_filesize );
288
+ return $max > 0 ? $max : 66600000;
289
  }
290
 
291
  /**
863
  function log( $data, $isExtra = false ) {
864
  if ( !$this->is_debug() )
865
  return;
866
+ $fh = fopen( trailingslashit( dirname(__FILE__) ) . 'wp-retina-2x.log', 'a' );
867
  $date = date( "Y-m-d H:i:s" );
868
  fwrite( $fh, "$date: {$data}\n" );
869
  fclose( $fh );
1054
  $meta['sizes'][$name]['height'] * 2, $crop, $retina_file, $customCrop );
1055
  }
1056
  if ( !file_exists( $retina_file ) ) {
1057
+ $is_ok = apply_filters( "wr2x_last_chance_generate", false, $id, $retina_file,
1058
+ $meta['sizes'][$name]['width'] * 2, $meta['sizes'][$name]['height'] * 2 );
1059
+ if ( !$is_ok ) {
1060
+ $this->log( "[ERROR] Retina for {$name} could not be created. Full-Size is " . $meta['width'] . "x" . $meta['height'] . " but Retina requires a file of at least " . $meta['sizes'][$name]['width'] * 2 . "x" . $meta['sizes'][$name]['height'] * 2 . "." );
1061
+ $issue = true;
1062
+ }
1063
  }
1064
  else {
1065
  do_action( 'wr2x_retina_file_added', $id, $retina_file, $name );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: TigrouMeow
3
  Tags: retina, images, image, responsive, lazysizes, lazy, attachment, media, files, iphone, ipad, high-dpi
4
  Requires at least: 3.5
5
- Tested up to: 4.7
6
- Stable tag: 5.0.5
7
 
8
  Make your website look beautiful and crisp on modern displays by creating and displaying retina images. WP 4.4+ is also supported and enhanced.
9
 
@@ -33,6 +33,10 @@ More information and tutorial available one http://meowapps.com/wp-retina-2x/.
33
 
34
  == Changelog ==
35
 
 
 
 
 
36
  = 5.0.5 =
37
  * Fix: There was a issue with the .htaccess rewriting (Class ‘Meow_Admin’ not found).
38
  * Update: Core was totally re-organized and cleaned. Ready for nice updates.
2
  Contributors: TigrouMeow
3
  Tags: retina, images, image, responsive, lazysizes, lazy, attachment, media, files, iphone, ipad, high-dpi
4
  Requires at least: 3.5
5
+ Tested up to: 4.8
6
+ Stable tag: 5.1.0
7
 
8
  Make your website look beautiful and crisp on modern displays by creating and displaying retina images. WP 4.4+ is also supported and enhanced.
9
 
33
 
34
  == Changelog ==
35
 
36
+ = 5.1.0 =
37
+ * Added: wr2x_get_pathinfo_from_image_src is available as part of the API.
38
+ * Add: wr2x_picture_rewrite in the API
39
+
40
  = 5.0.5 =
41
  * Fix: There was a issue with the .htaccess rewriting (Class ‘Meow_Admin’ not found).
42
  * Update: Core was totally re-organized and cleaned. Ready for nice updates.
wp-retina-2x.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Retina 2x
4
  Plugin URI: http://meowapps.com
5
  Description: Make your website look beautiful and crisp on modern displays by creating + displaying retina images.
6
- Version: 5.0.5
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: wp-retina-2x
@@ -21,7 +21,7 @@ Originally developed for two of my websites:
21
  global $wr2x_picturefill, $wr2x_retinajs, $wr2x_lazysizes,
22
  $wr2x_retina_image, $wr2x_core;
23
 
24
- $wr2x_version = '5.0.5';
25
  $wr2x_retinajs = '2.0.0';
26
  $wr2x_picturefill = '3.0.2';
27
  $wr2x_lazysizes = '3.0.0';
3
  Plugin Name: WP Retina 2x
4
  Plugin URI: http://meowapps.com
5
  Description: Make your website look beautiful and crisp on modern displays by creating + displaying retina images.
6
+ Version: 5.1.0
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: wp-retina-2x
21
  global $wr2x_picturefill, $wr2x_retinajs, $wr2x_lazysizes,
22
  $wr2x_retina_image, $wr2x_core;
23
 
24
+ $wr2x_version = '5.1.0';
25
  $wr2x_retinajs = '2.0.0';
26
  $wr2x_picturefill = '3.0.2';
27
  $wr2x_lazysizes = '3.0.0';
wr2x_admin.php CHANGED
@@ -24,7 +24,7 @@ class Meow_WR2X_Admin extends MeowApps_Admin {
24
  }
25
  if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
26
  echo "<div class='error' style='margin-top: 20px;'><p>";
27
- _e( "JetPack's <b>Photon</b> module is not compatible with WP Retina 2x. A common alternative is to use <a href='http://tracking.maxcdn.com/c/97349/3982/378'>MaxCDN</a> (very popular) instead, or CloudFlare.", 'wp-retina-2x' );
28
  echo "</p></div>";
29
  }
30
  }
24
  }
25
  if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
26
  echo "<div class='error' style='margin-top: 20px;'><p>";
27
+ _e( "JetPack's <b>Photon</b> module breaks features built in WP Retina 2x, as the plugin sends. A common and better alternative to Photon is to use <a href='http://tracking.maxcdn.com/c/97349/3982/378'>MaxCDN</a> (very popular), CloudFlare or Fastly.", 'wp-retina-2x' );
28
  echo "</p></div>";
29
  }
30
  }