Instant Images – One Click Unsplash Uploads - Version 3.1.1

Version Description

  • June 15, 2018 = ** NEW - More stable image uploading . ** NEW - Added instant_images_user_role filter to allow for control over user capability. ** FIX - Fixing permission issues with uploads when using basic HTTP authentication on domain. ** UPDATE - Better error handling ** UPDATE - Added permission 755 to the uploads/instant-images directory created on activation.
Download this release

Release Info

Developer dcooney
Plugin Icon 128x128 Instant Images – One Click Unsplash Uploads
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1 to 3.1.1

README.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Instant Images - One Click Unsplash Uploads ===
2
  Contributors: dcooney, connekthq
3
  Donate link: https://connekthq.com/donate/
4
- Tags: stock photo, stock, unsplash, prototyping, photos, upload, media, media library, image upload, free stock photos
5
- Requires at least: 3.6
6
- Tested up to: 4.9.1
7
- Stable tag: 3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -114,6 +114,15 @@ How to install Instant Images.
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
 
 
 
117
  = 3.1 - January 2, 2018 =
118
  ** NEW - Adding support for searching individual photos by ID. Prefix a search term with `id:` to search by Unsplash ID. e.g. `id:ixddk_CepZY`.
119
  ** UPDATED - Updated to meet revised Unsplash API guidelines.
1
  === Instant Images - One Click Unsplash Uploads ===
2
  Contributors: dcooney, connekthq
3
  Donate link: https://connekthq.com/donate/
4
+ Tags: stock photo, unsplash, prototyping, photos, upload, media library, image upload, free stock photos
5
+ Requires at least: 4.0
6
+ Tested up to: 4.9.6
7
+ Stable tag: 3.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
114
 
115
  == Changelog ==
116
 
117
+
118
+ = 3.1.1 - June 15, 2018 =
119
+ ** NEW - More stable image uploading 🎉.
120
+ ** NEW - Added `instant_images_user_role` filter to allow for control over user capability.
121
+ ** FIX - Fixing permission issues with uploads when using basic HTTP authentication on domain.
122
+ ** UPDATE - Better error handling
123
+ ** UPDATE - Added permission 755 to the uploads/instant-images directory created on activation.
124
+
125
+
126
  = 3.1 - January 2, 2018 =
127
  ** NEW - Adding support for searching individual photos by ID. Prefix a search term with `id:` to search by Unsplash ID. e.g. `id:ixddk_CepZY`.
128
  ** UPDATED - Updated to meet revised Unsplash API guidelines.
admin/admin.php CHANGED
@@ -10,7 +10,14 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
10
  */
11
 
12
  function instant_img_admin_menu() {
13
- $usplash_settings_page = add_submenu_page( 'upload.php', INSTANT_IMG_TITLE, INSTANT_IMG_TITLE, 'edit_theme_options', INSTANT_IMG_NAME, 'instant_img_settings_page');
 
 
 
 
 
 
 
14
  add_action( 'load-' . $usplash_settings_page, 'instant_img_load_scripts' ); //Add our admin scripts
15
  }
16
  add_action( 'admin_menu', 'instant_img_admin_menu' );
10
  */
11
 
12
  function instant_img_admin_menu() {
13
+ $usplash_settings_page = add_submenu_page(
14
+ 'upload.php',
15
+ INSTANT_IMG_TITLE,
16
+ INSTANT_IMG_TITLE,
17
+ apply_filters('instant_images_user_role', 'edit_theme_options'),
18
+ INSTANT_IMG_NAME,
19
+ 'instant_img_settings_page'
20
+ );
21
  add_action( 'load-' . $usplash_settings_page, 'instant_img_load_scripts' ); //Add our admin scripts
22
  }
23
  add_action( 'admin_menu', 'instant_img_admin_menu' );
admin/includes/unsplash-settings.php CHANGED
@@ -24,9 +24,11 @@
24
  <p><?php _e('The latest updates in', 'instant-images'); ?> <?php echo INSTANT_IMG_VERSION; ?></p>
25
  <div class="cta-wrap">
26
  <ul class="whats-new">
 
 
 
27
  <li>Updated to meet revised <a href="https://medium.com/unsplash/unsplash-api-guidelines-28e0216e6daa" target="_blank">Unsplash API guidelines</a>.</li>
28
  <li>Adding support for searching individual photos by Unsplash ID - searching <pre>id:{photo_id}</pre> will return a single result.<br/>e.g. <pre>id:YiUi00uqKk8</pre></li>
29
- <li>Better Error messaging for upload/resize errors.</li>
30
  </ul>
31
  </div>
32
  </section>
24
  <p><?php _e('The latest updates in', 'instant-images'); ?> <?php echo INSTANT_IMG_VERSION; ?></p>
25
  <div class="cta-wrap">
26
  <ul class="whats-new">
27
+ <li>Better image uploading and error handling.</li>
28
+ <li>Added `instant_images_user_role` filter to allow for control over user capability.</li>
29
+ <li>Fixing permission issues with uploads when using basic HTTP authentication on domain.</li>
30
  <li>Updated to meet revised <a href="https://medium.com/unsplash/unsplash-api-guidelines-28e0216e6daa" target="_blank">Unsplash API guidelines</a>.</li>
31
  <li>Adding support for searching individual photos by Unsplash ID - searching <pre>id:{photo_id}</pre> will return a single result.<br/>e.g. <pre>id:YiUi00uqKk8</pre></li>
 
32
  </ul>
33
  </div>
34
  </section>
api/resize.php CHANGED
@@ -32,80 +32,100 @@ add_action( 'rest_api_init', function () {
32
 
33
  function resize_image( WP_REST_Request $request ) {
34
 
35
- if (is_user_logged_in() && current_user_can( 'edit_theme_options' )){
36
 
37
  error_reporting(E_ALL|E_STRICT);
38
 
39
- require_once( ABSPATH . 'wp-admin/includes/media.php' ); // media_sideload_image()
40
- require_once( ABSPATH . 'wp-admin/includes/file.php' ); // download_url()
41
- require_once( ABSPATH . 'wp-admin/includes/image.php' ); // wp_read_image_metadata()
42
-
43
 
44
 
45
  // WP Options
46
  $options = get_option( 'instant_img_settings' );
47
  $download_w = isset($options['unsplash_download_w']) ? $options['unsplash_download_w'] : 1600; // width
48
  $download_h = isset($options['unsplash_download_h']) ? $options['unsplash_download_h'] : 1200; // height
49
-
50
-
51
- // JSON Post Data
52
  $data = json_decode($request->get_body()); // Get contents of request
53
  $path = sanitize_text_field($data->path); // Path on server
54
- $filename = sanitize_text_field($data->filename); // filename
 
 
55
  $desc = sanitize_text_field($data->desc); // Image description
56
- $url = sanitize_text_field($data->url); // Image URL
57
-
58
- // Resize image
59
- $image = wp_get_image_editor( $path.''.$filename );
 
60
  if ( ! is_wp_error( $image ) ) {
61
  $image->resize( $download_w, $download_h, false );
62
- $image->save($path.''.$filename);
63
  }
 
64
 
65
- // Send to media library
66
- $file = media_sideload_image($url.''.$filename, 0, $desc);
 
67
 
 
 
 
68
 
69
- // WP_ERROR
70
- if ( is_wp_error( $file ) ) {
71
- $error_string = $file->get_error_message();
72
-
73
- // Build error response
74
- $response = array(
75
  'success' => false,
76
- 'msg' => $error_string .' - '. __('There was an error sending image to your media library. Are you using password protection on the domain? If so, please read the Instant Images FAQ for instructions on how to fix this issue.', 'instant-images')
77
  );
78
-
79
-
80
- } else {
81
 
82
-
83
- if(file_exists($path.''.$filename)){ // If image was uploaded temporary image
84
-
85
- // Build success response
86
- $response = array(
87
- 'success' => true,
88
- 'msg' => __('Image successfully uploaded to your media library!', 'instant-images')
89
- );
90
-
91
- }else{ // Build error response
92
-
93
- $response = array(
94
- 'success' => false,
95
- 'msg' => __('There was an error sending the image to your media library. Please check your server permissions and confirm the upload_max_filesize setting (php.ini) is large enough for the downloaded image.', 'instant-images')
96
- );
97
-
98
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
 
101
 
102
  // Delete temporary image
103
- if(file_exists($path.''.$filename)){
104
- unlink($path.''.$filename);
105
  }
106
 
107
 
108
- // Send JSON response
109
  wp_send_json($response);
110
 
111
  }
32
 
33
  function resize_image( WP_REST_Request $request ) {
34
 
35
+ if (is_user_logged_in() && current_user_can( apply_filters('instant_images_user_role', 'edit_theme_options') )){
36
 
37
  error_reporting(E_ALL|E_STRICT);
38
 
39
+ require_once( ABSPATH . 'wp-admin/includes/file.php' ); // download_url()
40
+ require_once( ABSPATH . 'wp-admin/includes/image.php' ); // wp_read_image_metadata()
 
 
41
 
42
 
43
  // WP Options
44
  $options = get_option( 'instant_img_settings' );
45
  $download_w = isset($options['unsplash_download_w']) ? $options['unsplash_download_w'] : 1600; // width
46
  $download_h = isset($options['unsplash_download_h']) ? $options['unsplash_download_h'] : 1200; // height
47
+
48
+
49
+ // Get JSON Data
50
  $data = json_decode($request->get_body()); // Get contents of request
51
  $path = sanitize_text_field($data->path); // Path on server
52
+ $name = sanitize_text_field($data->filename); // name
53
+ $filename = $path . $name; // full filename
54
+ $filetype = wp_check_filetype( basename( $filename ), null );
55
  $desc = sanitize_text_field($data->desc); // Image description
56
+ $url = sanitize_text_field($data->url); // Image URL
57
+
58
+
59
+ // Resize image to max size (set in Settings)
60
+ $image = wp_get_image_editor( $filename );
61
  if ( ! is_wp_error( $image ) ) {
62
  $image->resize( $download_w, $download_h, false );
63
+ $image->save( $filename );
64
  }
65
+
66
 
67
+ // Get upload directory
68
+ $wp_upload_dir = wp_upload_dir(); // ['path'] ['basedir']
69
+
70
 
71
+ // Copy file from uploads/instant-images to a media library directory.
72
+ $new_filename = $wp_upload_dir['path'] .'/'. $name;
73
+ $copy_file = copy($filename , $new_filename);
74
 
75
+ if(!$copy_file){
76
+
77
+ // Error
78
+ $response = array(
 
 
79
  'success' => false,
80
+ 'msg' => __('Unable to copy image to the media library. Please check your server permissions.', 'instant-images')
81
  );
82
+
83
+ } else {
 
84
 
85
+
86
+ // Build attachment array
87
+ $attachment = array(
88
+ 'guid'=> $wp_upload_dir['url'] . basename( $new_filename ),
89
+ 'post_mime_type' => $filetype['type'],
90
+ 'post_title' => $desc,
91
+ 'post_content' => '',
92
+ 'post_status' => 'inherit'
93
+ );
94
+
95
+
96
+ $image_id = wp_insert_attachment($attachment, $new_filename, 0); // Insert as attachment
97
+ $attach_data = wp_generate_attachment_metadata( $image_id, $new_filename ); // Generate metadata
98
+ wp_update_attachment_metadata( $image_id, $attach_data ); // Add metadata
99
+
100
+
101
+ // Response
102
+ if(file_exists($new_filename)){ // If image was uploaded temporary image
103
+
104
+ // Success
105
+ $response = array(
106
+ 'success' => true,
107
+ 'msg' => __('Image successfully uploaded to your media library!', 'instant-images')
108
+ );
109
+
110
+ }else{
111
+
112
+ // Error
113
+ $response = array(
114
+ 'success' => false,
115
+ 'msg' => __('There was an error sending the image to your media library. Please check your server permissions and confirm the upload_max_filesize setting (php.ini) is large enough for the downloaded image.', 'instant-images')
116
+ );
117
+
118
+ }
119
  }
120
 
121
 
122
  // Delete temporary image
123
+ if(file_exists($filename)){
124
+ unlink($filename);
125
  }
126
 
127
 
128
+ // Send response as JSON
129
  wp_send_json($response);
130
 
131
  }
api/upload.php CHANGED
@@ -32,7 +32,7 @@ add_action( 'rest_api_init', function () {
32
 
33
  function upload_image( WP_REST_Request $request ) {
34
 
35
- if (is_user_logged_in() && current_user_can( 'edit_theme_options' )){
36
  error_reporting(E_ALL|E_STRICT);
37
 
38
  // Create /instant-images directory inside /uploads to temporarily store images
32
 
33
  function upload_image( WP_REST_Request $request ) {
34
 
35
+ if (is_user_logged_in() && current_user_can( apply_filters('instant_images_user_role', 'edit_theme_options') )){
36
  error_reporting(E_ALL|E_STRICT);
37
 
38
  // Create /instant-images directory inside /uploads to temporarily store images
dist/js/instant-images.js CHANGED
@@ -22,7 +22,7 @@ function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;va
22
  * JavaScript is all like "You images are done yet or what?"
23
  * MIT License
24
  */
25
- !function(i,a){"use strict";r=[n(178)],void 0!==(o=function(e){return a(i,e)}.apply(t,r))&&(e.exports=o)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(e,t){for(var n in t)e[n]=t[n];return e}function r(e){var t=[];if(Array.isArray(e))t=e;else if("number"==typeof e.length)for(var n=0;n<e.length;n++)t.push(e[n]);else t.push(e);return t}function o(e,t,i){if(!(this instanceof o))return new o(e,t,i);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=r(e),this.options=n({},this.options),"function"==typeof t?i=t:n(this.options,t),i&&this.on("always",i),this.getImages(),s&&(this.jqDeferred=new s.Deferred),setTimeout(function(){this.check()}.bind(this))}function i(e){this.img=e}function a(e,t){this.url=e,this.element=t,this.img=new Image}var s=e.jQuery,u=e.console;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),!0===this.options.background&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&l[t]){for(var n=e.querySelectorAll("img"),r=0;r<n.length;r++){var o=n[r];this.addImage(o)}if("string"==typeof this.options.background){var i=e.querySelectorAll(this.options.background);for(r=0;r<i.length;r++){var a=i[r];this.addElementBackgroundImages(a)}}}};var l={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var n=/url\((['"])?(.*?)\1\)/gi,r=n.exec(t.backgroundImage);null!==r;){var o=r&&r[2];o&&this.addBackground(o,e),r=n.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new i(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var n=new a(e,t);this.images.push(n)},o.prototype.check=function(){function e(e,n,r){setTimeout(function(){t.progress(e,n,r)})}var t=this;if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();this.images.forEach(function(t){t.once("progress",e),t.check()})},o.prototype.progress=function(e,t,n){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&u&&u.log("progress: "+n,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},i.prototype=Object.create(t.prototype),i.prototype.check=function(){if(this.getIsImageComplete())return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.src},i.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},i.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},i.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},i.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},a.prototype=Object.create(i.prototype),a.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},a.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},a.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},o.makeJQueryPlugin=function(t){(t=t||e.jQuery)&&(s=t,s.fn.imagesLoaded=function(e,t){return new o(this,e,t).jqDeferred.promise(s(this))})},o.makeJQueryPlugin(),o})},function(e,t,n){var r,o;!function(i,a){r=a,void 0!==(o="function"==typeof r?r.call(t,n,t,e):r)&&(e.exports=o)}("undefined"!=typeof window&&window,function(){"use strict";function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var n=this._events=this._events||{},r=n[e]=n[e]||[];return-1==r.indexOf(t)&&r.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var n=this._onceEvents=this._onceEvents||{};return(n[e]=n[e]||{})[t]=!0,this}},t.off=function(e,t){var n=this._events&&this._events[e];if(n&&n.length){var r=n.indexOf(t);return-1!=r&&n.splice(r,1),this}},t.emitEvent=function(e,t){var n=this._events&&this._events[e];if(n&&n.length){n=n.slice(0),t=t||[];for(var r=this._onceEvents&&this._onceEvents[e],o=0;o<n.length;o++){var i=n[o];r&&r[i]&&(this.off(e,i),delete r[i]),i.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(23),l=r(u),c=n(48),p=r(c),d=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.id=n.props.result.id,n.img=n.props.result.urls.small,n.full_size=n.props.result.urls.raw,n.author=n.props.result.user.name,n.user=n.props.result.user.username,n.user_photo=n.props.result.user.profile_image.small,n.link=n.props.result.links.html,n.likes=n.props.result.likes,n.view_all=instant_img_localize.view_all,n.like_text=instant_img_localize.likes,n.inProgress=!1,n.container=document.querySelector(".instant-img-container"),n}return a(t,e),s(t,[{key:"uploadPhoto",value:function(e){e.preventDefault();var t=this,n=e.currentTarget,r=n.parentElement.parentElement,o=r.querySelector(".notice-msg");if(n.classList.contains("success")||this.inProgress)return!1;n.classList.add("uploading"),r.classList.add("in-progress"),o.innerHTML=instant_img_localize.saving,this.inProgress=!0;var i={id:n.getAttribute("data-id"),image:n.getAttribute("data-url"),desc:n.getAttribute("data-desc")},a=instant_img_localize.root+"instant-images/upload/",s="",u=new XMLHttpRequest;u.open("POST",a,!0),u.setRequestHeader("X-WP-Nonce",instant_img_localize.nonce),u.setRequestHeader("Content-Type","application/json"),u.send(JSON.stringify(i)),u.onload=function(){if(u.status>=200&&u.status<400){var e=JSON.parse(u.response);if(e){var a=e.error,l=e.path,c=e.filename,p=e.desc,d=e.url;s=e.msg,a?t.uploadError(n,r,instant_img_localize.error_upload):(t.resizeImage(l,c,p,d,n,r,o),t.triggerUnsplashDownload(i.id))}}else t.uploadError(n,r,instant_img_localize.error_upload)},u.onerror=function(){t.uploadError(n,r,instant_img_localize.error_upload)}}},{key:"resizeImage",value:function(e,t,n,r,o,i,a){var s=this;o.classList.remove("uploading"),o.classList.add("resizing"),a.innerHTML=instant_img_localize.resizing;var u={path:e,filename:t,desc:n,url:r},l=instant_img_localize.root+"instant-images/resize/",c="",p=new XMLHttpRequest;p.open("POST",l,!0),p.setRequestHeader("X-WP-Nonce",instant_img_localize.nonce),p.setRequestHeader("Content-Type","application/json"),p.send(JSON.stringify(u)),p.onload=function(){if(p.status>=200&&p.status<400){var e=JSON.parse(p.response),t=e.success;c=e.msg,t?s.uploadComplete(o,i,c):s.uploadError(o,i,c)}else s.uploadError(o,i,instant_img_localize.error_resize)},p.onerror=function(){s.uploadError(o,i,instant_img_localize.error_resize)}}},{key:"triggerUnsplashDownload",value:function(e){var t=p.default.photo_api+"/"+e+"/download/"+p.default.app_id;fetch(t).then(function(e){return e.json()}).then(function(e){}).catch(function(e){console.log(e)})}},{key:"uploadComplete",value:function(e,t,n){t.classList.remove("in-progress"),t.classList.add("uploaded"),e.classList.remove("uploading"),e.classList.remove("resizing"),e.classList.add("success"),this.setImageTitle(e,n),this.inProgress=!1,this.container.classList.contains("popup")&&void 0!==wp.media&&(null!==wp.media.frame.content.get()?(wp.media.frame.content.get().collection.props.set({ignore:+new Date}),wp.media.frame.content.get().options.selection.reset()):wp.media.frame.library.props.set({ignore:+new Date}))}},{key:"uploadError",value:function(e,t,n){e.classList.remove("uploading"),e.classList.remove("resizing"),e.classList.add("errors"),this.setImageTitle(e,n),this.inProgress=!1,console.warn(n)}},{key:"setImageTitle",value:function(e,t){e.setAttribute("title",t)}},{key:"render",value:function(){var e=this;return l.default.createElement("article",{className:"photo"},l.default.createElement("div",{className:"img-wrap"},l.default.createElement("a",{className:"upload loaded",href:this.full_size,"data-id":this.id,"data-url":this.full_size,"data-desc":instant_img_localize.photo_by+" "+this.author,title:instant_img_localize.upload,onClick:function(t){return e.uploadPhoto(t)}},l.default.createElement("img",{src:this.img}),l.default.createElement("div",{className:"status"})),l.default.createElement("div",{className:"notice-msg"}),l.default.createElement("a",{className:"download-photo fade",href:this.link,title:this.full_size,target:"_blank"},l.default.createElement("i",{className:"fa fa-download"})),l.default.createElement("a",{className:"user fade",href:"https://unsplash.com/@"+this.user+"?utm_source=wordpress-instant-images&utm_medium=referral",target:"_blank",title:this.view_all+" @"+this.user},l.default.createElement("div",{className:"user-wrap"},this.user_photo.length>0&&l.default.createElement("img",{src:this.user_photo}),this.user)),l.default.createElement("span",{className:"likes fade",title:this.likes+" "+this.like_text},l.default.createElement("i",{className:"fa fa-heart"})," ",this.likes)))}}]),t}(l.default.Component);t.default=d},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(23),u=function(e){return e&&e.__esModule?e:{default:e}}(s),l=function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),a(t,[{key:"resetSearch",value:function(){document.querySelector(".control-nav").querySelector("li a.latest").click()}},{key:"render",value:function(){var e=this;return u.default.createElement("div",{className:this.props.isSearch?"searchResults":"searchResults hide"},u.default.createElement("span",{title:this.props.title},this.props.total),u.default.createElement("a",{href:"javascript:void(0)",title:instant_img_localize.clear_search,onClick:function(t){return e.resetSearch()}},"x"))}}]),t}(u.default.Component);t.default=l},function(e,t,n){(function(t,r){/*!
26
  * @overview es6-promise - a tiny implementation of Promises/A+.
27
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
28
  * @license Licensed under MIT license
22
  * JavaScript is all like "You images are done yet or what?"
23
  * MIT License
24
  */
25
+ !function(i,a){"use strict";r=[n(178)],void 0!==(o=function(e){return a(i,e)}.apply(t,r))&&(e.exports=o)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(e,t){for(var n in t)e[n]=t[n];return e}function r(e){var t=[];if(Array.isArray(e))t=e;else if("number"==typeof e.length)for(var n=0;n<e.length;n++)t.push(e[n]);else t.push(e);return t}function o(e,t,i){if(!(this instanceof o))return new o(e,t,i);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=r(e),this.options=n({},this.options),"function"==typeof t?i=t:n(this.options,t),i&&this.on("always",i),this.getImages(),s&&(this.jqDeferred=new s.Deferred),setTimeout(function(){this.check()}.bind(this))}function i(e){this.img=e}function a(e,t){this.url=e,this.element=t,this.img=new Image}var s=e.jQuery,u=e.console;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),!0===this.options.background&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&l[t]){for(var n=e.querySelectorAll("img"),r=0;r<n.length;r++){var o=n[r];this.addImage(o)}if("string"==typeof this.options.background){var i=e.querySelectorAll(this.options.background);for(r=0;r<i.length;r++){var a=i[r];this.addElementBackgroundImages(a)}}}};var l={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var n=/url\((['"])?(.*?)\1\)/gi,r=n.exec(t.backgroundImage);null!==r;){var o=r&&r[2];o&&this.addBackground(o,e),r=n.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new i(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var n=new a(e,t);this.images.push(n)},o.prototype.check=function(){function e(e,n,r){setTimeout(function(){t.progress(e,n,r)})}var t=this;if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();this.images.forEach(function(t){t.once("progress",e),t.check()})},o.prototype.progress=function(e,t,n){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&u&&u.log("progress: "+n,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},i.prototype=Object.create(t.prototype),i.prototype.check=function(){if(this.getIsImageComplete())return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.src},i.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},i.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},i.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},i.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},a.prototype=Object.create(i.prototype),a.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},a.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},a.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},o.makeJQueryPlugin=function(t){(t=t||e.jQuery)&&(s=t,s.fn.imagesLoaded=function(e,t){return new o(this,e,t).jqDeferred.promise(s(this))})},o.makeJQueryPlugin(),o})},function(e,t,n){var r,o;!function(i,a){r=a,void 0!==(o="function"==typeof r?r.call(t,n,t,e):r)&&(e.exports=o)}("undefined"!=typeof window&&window,function(){"use strict";function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var n=this._events=this._events||{},r=n[e]=n[e]||[];return-1==r.indexOf(t)&&r.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var n=this._onceEvents=this._onceEvents||{};return(n[e]=n[e]||{})[t]=!0,this}},t.off=function(e,t){var n=this._events&&this._events[e];if(n&&n.length){var r=n.indexOf(t);return-1!=r&&n.splice(r,1),this}},t.emitEvent=function(e,t){var n=this._events&&this._events[e];if(n&&n.length){n=n.slice(0),t=t||[];for(var r=this._onceEvents&&this._onceEvents[e],o=0;o<n.length;o++){var i=n[o];r&&r[i]&&(this.off(e,i),delete r[i]),i.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(23),l=r(u),c=n(48),p=r(c),d=function(e){function t(e){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.id=n.props.result.id,n.img=n.props.result.urls.small,n.full_size=n.props.result.urls.raw,n.author=n.props.result.user.name,n.user=n.props.result.user.username,n.user_photo=n.props.result.user.profile_image.small,n.link=n.props.result.links.html,n.likes=n.props.result.likes,n.view_all=instant_img_localize.view_all,n.like_text=instant_img_localize.likes,n.inProgress=!1,n.container=document.querySelector(".instant-img-container"),n}return a(t,e),s(t,[{key:"uploadPhoto",value:function(e){e.preventDefault();var t=this,n=e.currentTarget,r=n.parentElement.parentElement,o=r.querySelector(".notice-msg");if(n.classList.contains("success")||this.inProgress)return!1;n.classList.add("uploading"),r.classList.add("in-progress"),o.innerHTML=instant_img_localize.saving,this.inProgress=!0;var i={id:n.getAttribute("data-id"),image:n.getAttribute("data-url"),desc:n.getAttribute("data-desc")},a=instant_img_localize.root+"instant-images/upload/",s="",u=new XMLHttpRequest;u.open("POST",a,!0),u.setRequestHeader("X-WP-Nonce",instant_img_localize.nonce),u.setRequestHeader("Content-Type","application/json"),u.send(JSON.stringify(i)),u.onload=function(){if(u.status>=200&&u.status<400){var e=JSON.parse(u.response);if(e){var a=e.error,l=e.path,c=e.filename,p=e.desc,d=e.url;s=e.msg,a?t.uploadError(n,r,instant_img_localize.error_upload):(t.resizeImage(l,c,p,d,n,r,o),t.triggerUnsplashDownload(i.id))}}else t.uploadError(n,r,instant_img_localize.error_upload)},u.onerror=function(){t.uploadError(n,r,instant_img_localize.error_upload)}}},{key:"resizeImage",value:function(e,t,n,r,o,i,a){var s=this;o.classList.remove("uploading"),o.classList.add("resizing"),a.innerHTML=instant_img_localize.resizing;var u={path:e,filename:t,desc:n,url:r},l=instant_img_localize.root+"instant-images/resize/",c="",p=new XMLHttpRequest;p.open("POST",l,!0),p.setRequestHeader("X-WP-Nonce",instant_img_localize.nonce),p.setRequestHeader("Content-Type","application/json"),p.send(JSON.stringify(u)),p.onload=function(){if(p.status>=200&&p.status<400){var e=JSON.parse(p.response),t=e.success;c=e.msg,t?s.uploadComplete(o,i,c):s.uploadError(o,i,c)}else s.uploadError(o,i,instant_img_localize.error_resize)},p.onerror=function(){s.uploadError(o,i,instant_img_localize.error_resize)}}},{key:"triggerUnsplashDownload",value:function(e){var t=p.default.photo_api+"/"+e+"/download/"+p.default.app_id;fetch(t).then(function(e){return e.json()}).then(function(e){}).catch(function(e){console.log(e)})}},{key:"uploadComplete",value:function(e,t,n){t.classList.remove("in-progress"),t.classList.add("uploaded"),e.classList.remove("uploading"),e.classList.remove("resizing"),e.classList.add("success"),this.setImageTitle(e,n),this.inProgress=!1,this.container.classList.contains("popup")&&void 0!==wp.media&&(null!==wp.media.frame.content.get()?(wp.media.frame.content.get().collection.props.set({ignore:+new Date}),wp.media.frame.content.get().options.selection.reset()):wp.media.frame.library.props.set({ignore:+new Date}))}},{key:"uploadError",value:function(e,t,n){e.classList.remove("uploading"),e.classList.remove("resizing"),e.classList.add("errors"),this.setImageTitle(e,n),this.inProgress=!1,console.warn(n)}},{key:"setImageTitle",value:function(e,t){e.setAttribute("title",t)}},{key:"render",value:function(){var e=this;return l.default.createElement("article",{className:"photo"},l.default.createElement("div",{className:"img-wrap"},l.default.createElement("a",{className:"upload loaded",href:this.full_size,"data-id":this.id,"data-url":this.full_size,"data-desc":instant_img_localize.photo_by+" "+this.author,title:instant_img_localize.upload,onClick:function(t){return e.uploadPhoto(t)}},l.default.createElement("img",{src:this.img}),l.default.createElement("div",{className:"status"})),l.default.createElement("div",{className:"notice-msg"}),l.default.createElement("a",{className:"download-photo fade",href:this.link,title:instant_img_localize.view_on_unsplash,target:"_blank"},l.default.createElement("i",{className:"fa fa-external-link"})),l.default.createElement("a",{className:"user fade",href:"https://unsplash.com/@"+this.user+"?utm_source=wordpress-instant-images&utm_medium=referral",target:"_blank",title:this.view_all+" @"+this.user},l.default.createElement("div",{className:"user-wrap"},this.user_photo.length>0&&l.default.createElement("img",{src:this.user_photo}),this.user)),l.default.createElement("span",{className:"likes fade",title:this.likes+" "+this.like_text},l.default.createElement("i",{className:"fa fa-heart"})," ",this.likes)))}}]),t}(l.default.Component);t.default=d},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(23),u=function(e){return e&&e.__esModule?e:{default:e}}(s),l=function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),a(t,[{key:"resetSearch",value:function(){document.querySelector(".control-nav").querySelector("li a.latest").click()}},{key:"render",value:function(){var e=this;return u.default.createElement("div",{className:this.props.isSearch?"searchResults":"searchResults hide"},u.default.createElement("span",{title:this.props.title},this.props.total),u.default.createElement("a",{href:"javascript:void(0)",title:instant_img_localize.clear_search,onClick:function(t){return e.resetSearch()}},"x"))}}]),t}(u.default.Component);t.default=l},function(e,t,n){(function(t,r){/*!
26
  * @overview es6-promise - a tiny implementation of Promises/A+.
27
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
28
  * @license Licensed under MIT license
instant-images.php CHANGED
@@ -7,7 +7,7 @@ Author: Darren Cooney
7
  Twitter: @connekthq
8
  Author URI: https://connekthq.com
9
  Text Domain: instant-images
10
- Version: 3.1
11
  License: GPL
12
  Copyright: Darren Cooney & Connekt Media
13
  */
@@ -26,7 +26,7 @@ function instant_images_activate() {
26
  $upload_dir = wp_upload_dir();
27
  $dir = $upload_dir['basedir'].'/instant-images';
28
  if(!is_dir($dir)){
29
- mkdir($dir);
30
  }
31
  }
32
  register_activation_hook( __FILE__, 'instant_images_activate' );
@@ -71,8 +71,8 @@ class InstantImages {
71
  */
72
 
73
  private function constants(){
74
- define('INSTANT_IMG_VERSION', '3.1');
75
- define('INSTANT_IMG_RELEASE', 'January 2, 2018');
76
  define('INSTANT_IMG_TITLE', 'Instant Images');
77
  $upload_dir = wp_upload_dir();
78
  define('INSTANT_IMG_UPLOAD_PATH', $upload_dir['basedir'].'/instant-images');
7
  Twitter: @connekthq
8
  Author URI: https://connekthq.com
9
  Text Domain: instant-images
10
+ Version: 3.1.1
11
  License: GPL
12
  Copyright: Darren Cooney & Connekt Media
13
  */
26
  $upload_dir = wp_upload_dir();
27
  $dir = $upload_dir['basedir'].'/instant-images';
28
  if(!is_dir($dir)){
29
+ mkdir($dir, 755);
30
  }
31
  }
32
  register_activation_hook( __FILE__, 'instant_images_activate' );
71
  */
72
 
73
  private function constants(){
74
+ define('INSTANT_IMG_VERSION', '3.1.1');
75
+ define('INSTANT_IMG_RELEASE', 'June 15, 2018');
76
  define('INSTANT_IMG_TITLE', 'Instant Images');
77
  $upload_dir = wp_upload_dir();
78
  define('INSTANT_IMG_UPLOAD_PATH', $upload_dir['basedir'].'/instant-images');
lang/instant-images.pot CHANGED
@@ -2,105 +2,105 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Instant Images\n"
5
- "POT-Creation-Date: 2018-01-02 21:26-0500\n"
6
  "PO-Revision-Date: 2017-09-21 10:40-0500\n"
7
- "Last-Translator: Darren Cooney <darren@connekthq.com>\n"
8
  "Language-Team: \n"
9
  "Language: en_CA\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 2.0.5\n"
14
  "X-Poedit-Basepath: .\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
  "X-Poedit-KeywordsList: __;_e\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
- #: ../admin/admin.php:78
20
  msgid "Error accessing Unsplash API"
21
  msgstr ""
22
 
23
- #: ../admin/admin.php:79
24
  msgid "Please check your Application ID."
25
  msgstr ""
26
 
27
- #: ../admin/admin.php:80 ../api/upload.php:113
28
  msgid ""
29
  "Unable to download image to server, please check your server permissions."
30
  msgstr ""
31
 
32
- #: ../admin/admin.php:81 ../api/resize.php:95
33
  msgid ""
34
  "There was an error sending the image to your media library. Please check "
35
  "your server permissions and confirm the upload_max_filesize setting (php."
36
  "ini) is large enough for the downloaded image."
37
  msgstr ""
38
 
39
- #: ../admin/admin.php:82
40
  msgid "Photo by"
41
  msgstr ""
42
 
43
- #: ../admin/admin.php:83
44
  msgid "View all photos by"
45
  msgstr ""
46
 
47
- #: ../admin/admin.php:84
48
  msgid "Click Image to Upload"
49
  msgstr ""
50
 
51
- #: ../admin/admin.php:85
52
  msgid "View Full Size"
53
  msgstr ""
54
 
55
- #: ../admin/admin.php:86
56
  msgid "Like(s)"
57
  msgstr ""
58
 
59
- #: ../admin/admin.php:87
60
  msgid "Downloading Image..."
61
  msgstr ""
62
 
63
- #: ../admin/admin.php:88
64
  msgid "Resizing Image..."
65
  msgstr ""
66
 
67
- #: ../admin/admin.php:89
68
  msgid "Sorry, nothing matched your query"
69
  msgstr ""
70
 
71
- #: ../admin/admin.php:90
72
  msgid "Please try adjusting your search criteria"
73
  msgstr ""
74
 
75
- #: ../admin/admin.php:91
76
  msgid "New"
77
  msgstr ""
78
 
79
- #: ../admin/admin.php:92
80
  msgid "Oldest"
81
  msgstr ""
82
 
83
- #: ../admin/admin.php:93
84
  msgid "Popular"
85
  msgstr ""
86
 
87
- #: ../admin/admin.php:94
88
  msgid "Load More Images"
89
  msgstr ""
90
 
91
- #: ../admin/admin.php:95
92
  msgid "Search for Toronto, Coffee + Breakfast etc..."
93
  msgstr ""
94
 
95
- #: ../admin/admin.php:96
96
  msgid "images found for"
97
  msgstr ""
98
 
99
- #: ../admin/admin.php:97
100
  msgid "Clear search results"
101
  msgstr ""
102
 
103
- #: ../admin/admin.php:142
104
  msgid "Initialize Instant Images"
105
  msgstr ""
106
 
@@ -152,7 +152,7 @@ msgstr ""
152
  msgid "The latest updates in"
153
  msgstr ""
154
 
155
- #: ../admin/includes/unsplash-settings.php:51
156
  msgid "Our Plugins"
157
  msgstr ""
158
 
@@ -165,14 +165,13 @@ msgstr ""
165
  msgid "Settings"
166
  msgstr ""
167
 
168
- #: ../api/resize.php:76
169
  msgid ""
170
- "There was an error sending image to your media library. Are you using "
171
- "password protection on the domain? If so, please read the Instant Images FAQ "
172
- "for instructions on how to fix this issue."
173
  msgstr ""
174
 
175
- #: ../api/resize.php:88
176
  msgid "Image successfully uploaded to your media library!"
177
  msgstr ""
178
 
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Instant Images\n"
5
+ "POT-Creation-Date: 2018-06-14 14:48-0400\n"
6
  "PO-Revision-Date: 2017-09-21 10:40-0500\n"
7
+ "Last-Translator: Darren Cooney <dcooney@ecentricarts.com>\n"
8
  "Language-Team: \n"
9
  "Language: en_CA\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.0.7\n"
14
  "X-Poedit-Basepath: .\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
  "X-Poedit-KeywordsList: __;_e\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../admin/admin.php:85
20
  msgid "Error accessing Unsplash API"
21
  msgstr ""
22
 
23
+ #: ../admin/admin.php:86
24
  msgid "Please check your Application ID."
25
  msgstr ""
26
 
27
+ #: ../admin/admin.php:87 ../api/upload.php:113
28
  msgid ""
29
  "Unable to download image to server, please check your server permissions."
30
  msgstr ""
31
 
32
+ #: ../admin/admin.php:88 ../api/resize.php:115
33
  msgid ""
34
  "There was an error sending the image to your media library. Please check "
35
  "your server permissions and confirm the upload_max_filesize setting (php."
36
  "ini) is large enough for the downloaded image."
37
  msgstr ""
38
 
39
+ #: ../admin/admin.php:89
40
  msgid "Photo by"
41
  msgstr ""
42
 
43
+ #: ../admin/admin.php:90
44
  msgid "View all photos by"
45
  msgstr ""
46
 
47
+ #: ../admin/admin.php:91
48
  msgid "Click Image to Upload"
49
  msgstr ""
50
 
51
+ #: ../admin/admin.php:92
52
  msgid "View Full Size"
53
  msgstr ""
54
 
55
+ #: ../admin/admin.php:93
56
  msgid "Like(s)"
57
  msgstr ""
58
 
59
+ #: ../admin/admin.php:94
60
  msgid "Downloading Image..."
61
  msgstr ""
62
 
63
+ #: ../admin/admin.php:95
64
  msgid "Resizing Image..."
65
  msgstr ""
66
 
67
+ #: ../admin/admin.php:96
68
  msgid "Sorry, nothing matched your query"
69
  msgstr ""
70
 
71
+ #: ../admin/admin.php:97
72
  msgid "Please try adjusting your search criteria"
73
  msgstr ""
74
 
75
+ #: ../admin/admin.php:98
76
  msgid "New"
77
  msgstr ""
78
 
79
+ #: ../admin/admin.php:99
80
  msgid "Oldest"
81
  msgstr ""
82
 
83
+ #: ../admin/admin.php:100
84
  msgid "Popular"
85
  msgstr ""
86
 
87
+ #: ../admin/admin.php:101
88
  msgid "Load More Images"
89
  msgstr ""
90
 
91
+ #: ../admin/admin.php:102
92
  msgid "Search for Toronto, Coffee + Breakfast etc..."
93
  msgstr ""
94
 
95
+ #: ../admin/admin.php:103
96
  msgid "images found for"
97
  msgstr ""
98
 
99
+ #: ../admin/admin.php:104
100
  msgid "Clear search results"
101
  msgstr ""
102
 
103
+ #: ../admin/admin.php:149
104
  msgid "Initialize Instant Images"
105
  msgstr ""
106
 
152
  msgid "The latest updates in"
153
  msgstr ""
154
 
155
+ #: ../admin/includes/unsplash-settings.php:53
156
  msgid "Our Plugins"
157
  msgstr ""
158
 
165
  msgid "Settings"
166
  msgstr ""
167
 
168
+ #: ../api/resize.php:80
169
  msgid ""
170
+ "Unable to copy image to the media library. Please check your server "
171
+ "permissions."
 
172
  msgstr ""
173
 
174
+ #: ../api/resize.php:107
175
  msgid "Image successfully uploaded to your media library!"
176
  msgstr ""
177
 
src/js/components/Photo.js CHANGED
@@ -264,40 +264,40 @@ class Photo extends React.Component {
264
  render(){
265
 
266
  return (
267
- <article className='photo'>
268
- <div className='img-wrap'>
269
-
270
- <a
271
- className='upload loaded'
272
- href={this.full_size}
273
- data-id={this.id}
274
- data-url={this.full_size}
275
- data-desc={instant_img_localize.photo_by +' '+ this.author}
276
- title={instant_img_localize.upload}
277
- onClick={(e) => this.uploadPhoto(e)}>
278
- <img src={this.img} />
279
- <div className="status" />
280
- </a>
281
-
282
- <div className="notice-msg"/>
283
-
284
- <a className="download-photo fade" href={this.link} title={this.full_size} target="_blank">
285
- <i className="fa fa-download"></i>
286
- </a>
287
-
288
- <a className="user fade" href={'https://unsplash.com/@'+this.user+'?utm_source=wordpress-instant-images&utm_medium=referral'} target="_blank" title={this.view_all +' @'+ this.user}>
289
- <div className="user-wrap">
290
- {this.user_photo.length > 0 &&
291
- <img src={this.user_photo} />
292
- }
293
- {this.user}
294
- </div>
295
- </a>
296
-
297
- <span className="likes fade" title={this.likes +' ' + this.like_text}><i className="fa fa-heart"></i> {this.likes}</span>
298
-
299
- </div>
300
- </article>
301
  )
302
  }
303
  }
264
  render(){
265
 
266
  return (
267
+ <article className='photo'>
268
+ <div className='img-wrap'>
269
+
270
+ <a
271
+ className='upload loaded'
272
+ href={this.full_size}
273
+ data-id={this.id}
274
+ data-url={this.full_size}
275
+ data-desc={instant_img_localize.photo_by +' '+ this.author}
276
+ title={instant_img_localize.upload}
277
+ onClick={(e) => this.uploadPhoto(e)}>
278
+ <img src={this.img} />
279
+ <div className="status" />
280
+ </a>
281
+
282
+ <div className="notice-msg"/>
283
+
284
+ <a className="download-photo fade" href={this.link} title={instant_img_localize.view_on_unsplash} target="_blank">
285
+ <i className="fa fa-external-link"></i>
286
+ </a>
287
+
288
+ <a className="user fade" href={'https://unsplash.com/@'+this.user+'?utm_source=wordpress-instant-images&utm_medium=referral'} target="_blank" title={this.view_all +' @'+ this.user}>
289
+ <div className="user-wrap">
290
+ {this.user_photo.length > 0 &&
291
+ <img src={this.user_photo} />
292
+ }
293
+ {this.user}
294
+ </div>
295
+ </a>
296
+
297
+ <span className="likes fade" title={this.likes +' ' + this.like_text}><i className="fa fa-heart"></i> {this.likes}</span>
298
+
299
+ </div>
300
+ </article>
301
  )
302
  }
303
  }