Changeset 2313195
- Timestamp:
- 05/27/2020 02:19:01 PM (6 years ago)
- Location:
- image4io
- Files:
-
- 5 edited
- 33 copied
-
tags/0.3.1 (copied) (copied from image4io/trunk)
-
tags/0.3.1/assets (copied) (copied from image4io/trunk/assets)
-
tags/0.3.1/assets/img/ajax-loader.gif (copied) (copied from image4io/trunk/assets/img/ajax-loader.gif)
-
tags/0.3.1/assets/img/edit-button.png (copied) (copied from image4io/trunk/assets/img/edit-button.png)
-
tags/0.3.1/assets/js/image4io-mce-button.js (copied) (copied from image4io/trunk/assets/js/image4io-mce-button.js)
-
tags/0.3.1/build (copied) (copied from image4io/trunk/build)
-
tags/0.3.1/composer.json (copied) (copied from image4io/trunk/composer.json)
-
tags/0.3.1/image4io.php (copied) (copied from image4io/trunk/image4io.php) (1 diff)
-
tags/0.3.1/inc (copied) (copied from image4io/trunk/inc)
-
tags/0.3.1/inc/Api/Callbacks/AdminCallbacks.php (copied) (copied from image4io/trunk/inc/Api/Callbacks/AdminCallbacks.php)
-
tags/0.3.1/inc/Api/Image4IOApi.php (copied) (copied from image4io/trunk/inc/Api/Image4IOApi.php)
-
tags/0.3.1/inc/Api/Image4IOManager.php (copied) (copied from image4io/trunk/inc/Api/Image4IOManager.php)
-
tags/0.3.1/inc/Base/BaseController.php (copied) (copied from image4io/trunk/inc/Base/BaseController.php)
-
tags/0.3.1/inc/Base/Enqueue.php (copied) (copied from image4io/trunk/inc/Base/Enqueue.php)
-
tags/0.3.1/inc/Manager/MediaManager.php (copied) (copied from image4io/trunk/inc/Manager/MediaManager.php) (7 diffs)
-
tags/0.3.1/inc/Pages/Admin.php (copied) (copied from image4io/trunk/inc/Pages/Admin.php)
-
tags/0.3.1/index.php (copied) (copied from image4io/trunk/index.php)
-
tags/0.3.1/npm-debug.log (copied) (copied from image4io/trunk/npm-debug.log)
-
tags/0.3.1/package-lock.json (copied) (copied from image4io/trunk/package-lock.json) (1 diff)
-
tags/0.3.1/package.json (copied) (copied from image4io/trunk/package.json) (1 diff)
-
tags/0.3.1/readme.txt (copied) (copied from image4io/trunk/readme.txt) (1 diff)
-
tags/0.3.1/screenshot-1.png (copied) (copied from image4io/trunk/screenshot-1.png)
-
tags/0.3.1/screenshot-2.png (copied) (copied from image4io/trunk/screenshot-2.png)
-
tags/0.3.1/screenshot-3.png (copied) (copied from image4io/trunk/screenshot-3.png)
-
tags/0.3.1/screenshot-4.png (copied) (copied from image4io/trunk/screenshot-4.png)
-
tags/0.3.1/screenshot-5.png (copied) (copied from image4io/trunk/screenshot-5.png)
-
tags/0.3.1/screenshot-6.png (copied) (copied from image4io/trunk/screenshot-6.png)
-
tags/0.3.1/src (copied) (copied from image4io/trunk/src)
-
tags/0.3.1/templates (copied) (copied from image4io/trunk/templates)
-
tags/0.3.1/templates/admin.php (copied) (copied from image4io/trunk/templates/admin.php)
-
tags/0.3.1/templates/loading.php (copied) (copied from image4io/trunk/templates/loading.php)
-
tags/0.3.1/templates/media.php (copied) (copied from image4io/trunk/templates/media.php)
-
tags/0.3.1/vendor (copied) (copied from image4io/trunk/vendor)
-
trunk/image4io.php (modified) (1 diff)
-
trunk/inc/Manager/MediaManager.php (modified) (7 diffs)
-
trunk/package-lock.json (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
image4io/tags/0.3.1/image4io.php
r2292451 r2313195 8 8 Description: Speeds up the images' load time: image optimization, image CDN and image storage, all-in-one platform. To get started: activate the image4io plugin and then go to your Image4io Settings page to set up your credentials. 9 9 Author: image4io 10 Version: 0.3. 010 Version: 0.3.1 11 11 Author URI: https://image4.io 12 12 */ -
image4io/tags/0.3.1/inc/Manager/MediaManager.php
r2292451 r2313195 37 37 add_action('admin_footer-upload.php', array($this, 'image4io_media_lib_upload_admin_footer')); 38 38 add_action('load-upload.php', array($this, 'image4io_media_lib_upload_action')); 39 //add_action('delete_attachment',array($this,'image4io_media_delete'),1,1); 39 40 add_filter('wp_generate_attachment_metadata',array($this,'image4io_upload_new_media_action'),1,3); 40 41 add_filter('wp_get_attachment_url', array($this, 'fix_local_url_to_image4io'), 1, 2); … … 373 374 return 'Unsupported attachment type!'; 374 375 } 376 $full_path = $this->update_urls_for_ssl($full_path); 375 377 376 378 $manager = new Image4IOManager; … … 635 637 } 636 638 637 public function image4io_generate_image_srcset($image_src, $image_meta, $attachment_id){638 /*if (!isset($image_meta['image4io']) || !$image_meta['image4io']){639 return $sources;640 }*/641 $sizes=$image_meta['image4io_sizes'];642 643 $results=array();644 foreach($sizes as $size){645 $result=array(646 'url'=>$size['file'],647 'descriptor'=>'w',648 'value'=>$size['width'],649 );650 $results[$size['width']]=$result;651 }652 //unset($size);653 654 if ( ! is_array( $results ) || count( $results ) < 1 ) {655 return false;656 }657 658 $srcset = '';659 660 foreach ( $results as $result ) {661 $srcset .= str_replace( ' ', '%20', $result['url'] ) . ' ' . $result['value'] . $result['descriptor'] . ', ';662 }663 $srcset = rtrim($srcset, ', ');664 $srcset_sizes= wp_calculate_image_sizes( array($image_meta["width"],$image_meta["height"]), $image_src, $image_meta, $attachment_id );665 666 preg_match('/(^.*?src=\"[^"]+")(.*)/i',$image_src,$res);667 668 return $res[1] . ' srcset="' . $srcset . '" sizes="' . $srcset_sizes . '"' . $res[2];669 }670 671 639 public function image4io_make_content_responsive($content){ 640 672 641 if ( ! preg_match_all( '/<img [^>]+>/', $content, $matches ) ) { 673 642 return $content; … … 691 660 } 692 661 } 662 693 663 if ( count( $attachment_ids ) > 1 ) { 694 664 /* … … 698 668 _prime_post_caches( array_keys( $attachment_ids ), false, true ); 699 669 } 700 701 670 foreach ( $selected_images as $image => $attachment_id ) { 702 671 $image_meta = wp_get_attachment_metadata( $attachment_id ); 703 $content = str_replace( $image, $this->image4io_generate_image_srcset( $image, $image_meta, $attachment_id ), $content ); 672 $updatedSrc=$this->image4io_generate_image_srcset( $image, $image_meta, $attachment_id ); 673 $content = str_replace( $image, $updatedSrc , $content ); 704 674 } 705 675 706 676 return $content; 677 } 678 679 public function image4io_generate_image_srcset($image_src, $image_meta, $attachment_id){ 680 $sizes=$image_meta['image4io_sizes']; 681 682 if(! is_array( $sizes ) || count( $sizes ) < 1){ 683 return $image_src; 684 } 685 $results=array(); 686 687 foreach($sizes as $size){ 688 $result=array( 689 'url'=>$size['file'], 690 'descriptor'=>'w', 691 'value'=>$size['width'], 692 ); 693 $results[$size['width']]=$result; 694 } 695 696 $srcset = ''; 697 698 foreach ( $results as $result ) { 699 $srcset .= str_replace( ' ', '%20', $result['url'] ) . ' ' . $result['value'] . $result['descriptor'] . ', '; 700 } 701 $srcset = rtrim($srcset, ', '); 702 $srcset_sizes= wp_calculate_image_sizes( array($image_meta["width"],$image_meta["height"]), $image_src, $image_meta, $attachment_id ); 703 704 preg_match('/(^.*?src=\"[^"]+")(.*)/i',$image_src,$res); 705 706 return $res[1] . ' srcset="' . $srcset . '" sizes="' . $srcset_sizes . '"' . $res[2]; 707 707 } 708 708 … … 746 746 } 747 747 748 $full_path = $this->update_urls_for_ssl($full_path); 749 748 750 $manager = new Image4IOManager; 749 751 $manager->setup(); … … 766 768 } 767 769 } 770 771 /*public function image4io_media_delete($postid){ 772 $md = wp_get_attachment_metadata($attachment_id); 773 if(isset($md['image4io'])&&$md['image4io']){ 774 $manager = new Image4IOManager; 775 $manager->setup(); 776 $result = $manager->uploadToImage4ioFromUrl($full_path,"/"); 777 var_dump($result); 778 die; 779 } 780 }*/ 781 782 public function update_urls_for_ssl($url) { 783 //Correct protocol for https connections 784 list($protocol, $uri) = explode('://', $url, 2); 785 if(is_ssl()) { 786 if('http' == $protocol) { 787 $protocol = 'https'; 788 } 789 } else { 790 if('https' == $protocol) { 791 $protocol = 'http'; 792 } 793 } 794 795 return $protocol.'://'.$uri; 796 } 768 797 } -
image4io/tags/0.3.1/package-lock.json
r2292451 r2313195 1 1 { 2 2 "name": "image4io", 3 "version": "0. 2.0",3 "version": "0.3.1", 4 4 "lockfileVersion": 1, 5 5 "requires": true, -
image4io/tags/0.3.1/package.json
r2292451 r2313195 1 1 { 2 2 "name": "image4io", 3 "version": "0. 2.0",3 "version": "0.3.1", 4 4 "description": "image4io Wordpress Plugin. Speeds up the images' load time: image optimization, image CDN and image storage, all-in-one platform.", 5 5 "main": "index.js", -
image4io/tags/0.3.1/readme.txt
r2292451 r2313195 118 118 * Fixed a bug when uploading images to image4io server. 119 119 120 = 0.3.1 = 121 * Fixed a bug when hosting server activated ssl. 122 120 123 == UPGRADE NOTICE == 121 124 -
image4io/trunk/image4io.php
r2292451 r2313195 8 8 Description: Speeds up the images' load time: image optimization, image CDN and image storage, all-in-one platform. To get started: activate the image4io plugin and then go to your Image4io Settings page to set up your credentials. 9 9 Author: image4io 10 Version: 0.3. 010 Version: 0.3.1 11 11 Author URI: https://image4.io 12 12 */ -
image4io/trunk/inc/Manager/MediaManager.php
r2292451 r2313195 37 37 add_action('admin_footer-upload.php', array($this, 'image4io_media_lib_upload_admin_footer')); 38 38 add_action('load-upload.php', array($this, 'image4io_media_lib_upload_action')); 39 //add_action('delete_attachment',array($this,'image4io_media_delete'),1,1); 39 40 add_filter('wp_generate_attachment_metadata',array($this,'image4io_upload_new_media_action'),1,3); 40 41 add_filter('wp_get_attachment_url', array($this, 'fix_local_url_to_image4io'), 1, 2); … … 373 374 return 'Unsupported attachment type!'; 374 375 } 376 $full_path = $this->update_urls_for_ssl($full_path); 375 377 376 378 $manager = new Image4IOManager; … … 635 637 } 636 638 637 public function image4io_generate_image_srcset($image_src, $image_meta, $attachment_id){638 /*if (!isset($image_meta['image4io']) || !$image_meta['image4io']){639 return $sources;640 }*/641 $sizes=$image_meta['image4io_sizes'];642 643 $results=array();644 foreach($sizes as $size){645 $result=array(646 'url'=>$size['file'],647 'descriptor'=>'w',648 'value'=>$size['width'],649 );650 $results[$size['width']]=$result;651 }652 //unset($size);653 654 if ( ! is_array( $results ) || count( $results ) < 1 ) {655 return false;656 }657 658 $srcset = '';659 660 foreach ( $results as $result ) {661 $srcset .= str_replace( ' ', '%20', $result['url'] ) . ' ' . $result['value'] . $result['descriptor'] . ', ';662 }663 $srcset = rtrim($srcset, ', ');664 $srcset_sizes= wp_calculate_image_sizes( array($image_meta["width"],$image_meta["height"]), $image_src, $image_meta, $attachment_id );665 666 preg_match('/(^.*?src=\"[^"]+")(.*)/i',$image_src,$res);667 668 return $res[1] . ' srcset="' . $srcset . '" sizes="' . $srcset_sizes . '"' . $res[2];669 }670 671 639 public function image4io_make_content_responsive($content){ 640 672 641 if ( ! preg_match_all( '/<img [^>]+>/', $content, $matches ) ) { 673 642 return $content; … … 691 660 } 692 661 } 662 693 663 if ( count( $attachment_ids ) > 1 ) { 694 664 /* … … 698 668 _prime_post_caches( array_keys( $attachment_ids ), false, true ); 699 669 } 700 701 670 foreach ( $selected_images as $image => $attachment_id ) { 702 671 $image_meta = wp_get_attachment_metadata( $attachment_id ); 703 $content = str_replace( $image, $this->image4io_generate_image_srcset( $image, $image_meta, $attachment_id ), $content ); 672 $updatedSrc=$this->image4io_generate_image_srcset( $image, $image_meta, $attachment_id ); 673 $content = str_replace( $image, $updatedSrc , $content ); 704 674 } 705 675 706 676 return $content; 677 } 678 679 public function image4io_generate_image_srcset($image_src, $image_meta, $attachment_id){ 680 $sizes=$image_meta['image4io_sizes']; 681 682 if(! is_array( $sizes ) || count( $sizes ) < 1){ 683 return $image_src; 684 } 685 $results=array(); 686 687 foreach($sizes as $size){ 688 $result=array( 689 'url'=>$size['file'], 690 'descriptor'=>'w', 691 'value'=>$size['width'], 692 ); 693 $results[$size['width']]=$result; 694 } 695 696 $srcset = ''; 697 698 foreach ( $results as $result ) { 699 $srcset .= str_replace( ' ', '%20', $result['url'] ) . ' ' . $result['value'] . $result['descriptor'] . ', '; 700 } 701 $srcset = rtrim($srcset, ', '); 702 $srcset_sizes= wp_calculate_image_sizes( array($image_meta["width"],$image_meta["height"]), $image_src, $image_meta, $attachment_id ); 703 704 preg_match('/(^.*?src=\"[^"]+")(.*)/i',$image_src,$res); 705 706 return $res[1] . ' srcset="' . $srcset . '" sizes="' . $srcset_sizes . '"' . $res[2]; 707 707 } 708 708 … … 746 746 } 747 747 748 $full_path = $this->update_urls_for_ssl($full_path); 749 748 750 $manager = new Image4IOManager; 749 751 $manager->setup(); … … 766 768 } 767 769 } 770 771 /*public function image4io_media_delete($postid){ 772 $md = wp_get_attachment_metadata($attachment_id); 773 if(isset($md['image4io'])&&$md['image4io']){ 774 $manager = new Image4IOManager; 775 $manager->setup(); 776 $result = $manager->uploadToImage4ioFromUrl($full_path,"/"); 777 var_dump($result); 778 die; 779 } 780 }*/ 781 782 public function update_urls_for_ssl($url) { 783 //Correct protocol for https connections 784 list($protocol, $uri) = explode('://', $url, 2); 785 if(is_ssl()) { 786 if('http' == $protocol) { 787 $protocol = 'https'; 788 } 789 } else { 790 if('https' == $protocol) { 791 $protocol = 'http'; 792 } 793 } 794 795 return $protocol.'://'.$uri; 796 } 768 797 } -
image4io/trunk/package-lock.json
r2292451 r2313195 1 1 { 2 2 "name": "image4io", 3 "version": "0. 2.0",3 "version": "0.3.1", 4 4 "lockfileVersion": 1, 5 5 "requires": true, -
image4io/trunk/package.json
r2292451 r2313195 1 1 { 2 2 "name": "image4io", 3 "version": "0. 2.0",3 "version": "0.3.1", 4 4 "description": "image4io Wordpress Plugin. Speeds up the images' load time: image optimization, image CDN and image storage, all-in-one platform.", 5 5 "main": "index.js", -
image4io/trunk/readme.txt
r2292451 r2313195 118 118 * Fixed a bug when uploading images to image4io server. 119 119 120 = 0.3.1 = 121 * Fixed a bug when hosting server activated ssl. 122 120 123 == UPGRADE NOTICE == 121 124
Note: See TracChangeset
for help on using the changeset viewer.