Changeset 2765832
- Timestamp:
- 08/03/2022 01:54:06 PM (4 years ago)
- Location:
- shorthand-connect
- Files:
-
- 3 edited
- 5 copied
-
tags/1.3.17 (copied) (copied from shorthand-connect/trunk)
-
tags/1.3.17/README.txt (copied) (copied from shorthand-connect/trunk/README.txt) (2 diffs)
-
tags/1.3.17/includes/api-v2.php (copied) (copied from shorthand-connect/trunk/includes/api-v2.php) (4 diffs)
-
tags/1.3.17/includes/shorthand_options.php (copied) (copied from shorthand-connect/trunk/includes/shorthand_options.php)
-
tags/1.3.17/shorthand_connect.php (copied) (copied from shorthand-connect/trunk/shorthand_connect.php) (3 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/includes/api-v2.php (modified) (4 diffs)
-
trunk/shorthand_connect.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shorthand-connect/tags/1.3.17/README.txt
r2763288 r2765832 1 1 === Shorthand Connect === 2 2 Contributors: shorthandconnect 3 Donate link: 3 Donate link: 4 4 Tags: shorthand, api 5 5 Requires at least: 4.0 6 Tested up to: 6.0. 07 Stable tag: 1.3.1 66 Tested up to: 6.0.1 7 Stable tag: 1.3.17 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 59 59 60 60 == Changelog == 61 62 = 1.3.17 = 63 * Added alternate method of story ZIP extraction for WP VIP-hosted customers. 61 64 62 65 = 1.3.16 = -
shorthand-connect/tags/1.3.17/includes/api-v2.php
r2763288 r2765832 6 6 global $serverv2URL; 7 7 $token = get_option('sh_v2_token'); 8 9 8 if (!$token) { 10 9 return false; … … 16 15 'headers' => array( 17 16 'Authorization' => 'Token '.$token, 18 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2', 19 ) 17 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2' 18 ), 19 'http_api_args' => $options 20 20 ), 21 21 $options 22 22 ); 23 if(function_exists("vip_safe_wp_remote_get") ){24 return vip_safe_wp_remote_get($url, $request_options);23 if(function_exists("vip_safe_wp_remote_get") && !isset($options['timeout'])){ 24 return vip_safe_wp_remote_get($url,false,1,3,10, $request_options); 25 25 }else{ 26 26 return wp_remote_get($url, $request_options); … … 122 122 123 123 //Attempt to connect to the server 124 $zipfile = wp_tempnam( $tmpdir, 'sh_zip');125 $unzipdir = wp_tempnam( $tmpdir, 'sh_unzip').'_dir';124 $zipfile = wp_tempnam('sh_zip',$tmpdir); 125 $unzipdir = wp_tempnam('sh_unzip',$tmpdir).'_dir'; 126 126 $response = sh_v2_api_get('/v2/stories/'.$story_id, array( 127 127 'timeout' => '600', … … 140 140 ); 141 141 } else { 142 $unzipfile = unzip_file( $zipfile, $unzipdir); 143 if ( $unzipfile == 1 ) { 144 wp_mkdir_p($destination_path.'/'.$story_id); 145 $err = copy_dir($unzipdir, $destination_path.'/'.$story_id); 146 if (is_wp_error($err)) { 142 if(function_exists("vip_safe_wp_remote_get")){ 143 //WP VIP HOSTING 144 $zip = new ZipArchive; 145 if ( $zip->open($zipfile) == true ) { 146 wp_mkdir_p($destination_path.'/'.$story_id); 147 $zip->extractTo($destination_path.'/'.$story_id); 148 $zip->close(); 149 if (is_wp_error($zip)) { 150 $story['error'] = array( 151 'pretty' => 'Could not copy story into Wordpress', 152 'error' => $err->get_error_message(), 153 'unzip error'=> $unzipfile 154 ); 155 if(function_exists("wp_filesize")){ 156 $story['error']['downloaded zip size'] = wp_filesize($zipfile); 157 } 158 } else { 159 $story['path'] = $destination_path.'/'.$story_id; 160 } 161 } else { 147 162 $story['error'] = array( 148 'pretty' => 'Could not copy story into Wordpress', 149 'error' => $err->get_error_message() 163 'pretty' => 'Could not unzip file' 150 164 ); 165 } 166 }else{ 167 //Standard WP 168 $unzipfile = unzip_file( $zipfile, $unzipdir); 169 if ( $unzipfile == 1 ) { 170 wp_mkdir_p($destination_path.'/'.$story_id); 171 $err = copy_dir($unzipdir, $destination_path.'/'.$story_id); 172 if (is_wp_error($err)) { 173 $story['error'] = array( 174 'pretty' => 'Could not copy story into Wordpress', 175 'error' => $err->get_error_message(), 176 'unzip error'=> $unzipfile 177 ); 178 if(function_exists("wp_filesize")){ 179 $story['error']['downloaded zip size'] = wp_filesize($zipfile); 180 } 181 } else { 182 $story['path'] = $destination_path.'/'.$story_id; 183 } 151 184 } else { 152 $story['path'] = $destination_path.'/'.$story_id; 185 $story['error'] = array( 186 'pretty' => 'Could not unzip file' 187 ); 153 188 } 154 } else {155 $story['error'] = array(156 'pretty' => 'Could not unzip file'157 );158 189 } 159 190 } -
shorthand-connect/tags/1.3.17/shorthand_connect.php
r2763288 r2765832 3 3 /** 4 4 * @package Shorthand Connect 5 * @version 1.3.1 65 * @version 1.3.17 6 6 */ 7 7 /* … … 10 10 Description: Import your Shorthand stories into your Wordpress CMS as simply as possible - magic! 11 11 Author: Shorthand 12 Version: 1.3.1 612 Version: 1.3.17 13 13 Author URI: http://shorthand.com 14 14 */ … … 291 291 update_post_meta($post_id, 'story_path', $story_path); 292 292 293 //Log any story-specific errors to the metadata 294 if(isset($err['error'])){ 295 update_post_meta($post_id, 'ERROR', json_encode($err)); 296 } 297 293 298 // Get path to the assets 294 299 $assets_path = sh_get_story_url($post_id, $safe_story_id); -
shorthand-connect/trunk/README.txt
r2763288 r2765832 1 1 === Shorthand Connect === 2 2 Contributors: shorthandconnect 3 Donate link: 3 Donate link: 4 4 Tags: shorthand, api 5 5 Requires at least: 4.0 6 Tested up to: 6.0. 07 Stable tag: 1.3.1 66 Tested up to: 6.0.1 7 Stable tag: 1.3.17 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 59 59 60 60 == Changelog == 61 62 = 1.3.17 = 63 * Added alternate method of story ZIP extraction for WP VIP-hosted customers. 61 64 62 65 = 1.3.16 = -
shorthand-connect/trunk/includes/api-v2.php
r2763288 r2765832 6 6 global $serverv2URL; 7 7 $token = get_option('sh_v2_token'); 8 9 8 if (!$token) { 10 9 return false; … … 16 15 'headers' => array( 17 16 'Authorization' => 'Token '.$token, 18 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2', 19 ) 17 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2' 18 ), 19 'http_api_args' => $options 20 20 ), 21 21 $options 22 22 ); 23 if(function_exists("vip_safe_wp_remote_get") ){24 return vip_safe_wp_remote_get($url, $request_options);23 if(function_exists("vip_safe_wp_remote_get") && !isset($options['timeout'])){ 24 return vip_safe_wp_remote_get($url,false,1,3,10, $request_options); 25 25 }else{ 26 26 return wp_remote_get($url, $request_options); … … 122 122 123 123 //Attempt to connect to the server 124 $zipfile = wp_tempnam( $tmpdir, 'sh_zip');125 $unzipdir = wp_tempnam( $tmpdir, 'sh_unzip').'_dir';124 $zipfile = wp_tempnam('sh_zip',$tmpdir); 125 $unzipdir = wp_tempnam('sh_unzip',$tmpdir).'_dir'; 126 126 $response = sh_v2_api_get('/v2/stories/'.$story_id, array( 127 127 'timeout' => '600', … … 140 140 ); 141 141 } else { 142 $unzipfile = unzip_file( $zipfile, $unzipdir); 143 if ( $unzipfile == 1 ) { 144 wp_mkdir_p($destination_path.'/'.$story_id); 145 $err = copy_dir($unzipdir, $destination_path.'/'.$story_id); 146 if (is_wp_error($err)) { 142 if(function_exists("vip_safe_wp_remote_get")){ 143 //WP VIP HOSTING 144 $zip = new ZipArchive; 145 if ( $zip->open($zipfile) == true ) { 146 wp_mkdir_p($destination_path.'/'.$story_id); 147 $zip->extractTo($destination_path.'/'.$story_id); 148 $zip->close(); 149 if (is_wp_error($zip)) { 150 $story['error'] = array( 151 'pretty' => 'Could not copy story into Wordpress', 152 'error' => $err->get_error_message(), 153 'unzip error'=> $unzipfile 154 ); 155 if(function_exists("wp_filesize")){ 156 $story['error']['downloaded zip size'] = wp_filesize($zipfile); 157 } 158 } else { 159 $story['path'] = $destination_path.'/'.$story_id; 160 } 161 } else { 147 162 $story['error'] = array( 148 'pretty' => 'Could not copy story into Wordpress', 149 'error' => $err->get_error_message() 163 'pretty' => 'Could not unzip file' 150 164 ); 165 } 166 }else{ 167 //Standard WP 168 $unzipfile = unzip_file( $zipfile, $unzipdir); 169 if ( $unzipfile == 1 ) { 170 wp_mkdir_p($destination_path.'/'.$story_id); 171 $err = copy_dir($unzipdir, $destination_path.'/'.$story_id); 172 if (is_wp_error($err)) { 173 $story['error'] = array( 174 'pretty' => 'Could not copy story into Wordpress', 175 'error' => $err->get_error_message(), 176 'unzip error'=> $unzipfile 177 ); 178 if(function_exists("wp_filesize")){ 179 $story['error']['downloaded zip size'] = wp_filesize($zipfile); 180 } 181 } else { 182 $story['path'] = $destination_path.'/'.$story_id; 183 } 151 184 } else { 152 $story['path'] = $destination_path.'/'.$story_id; 185 $story['error'] = array( 186 'pretty' => 'Could not unzip file' 187 ); 153 188 } 154 } else {155 $story['error'] = array(156 'pretty' => 'Could not unzip file'157 );158 189 } 159 190 } -
shorthand-connect/trunk/shorthand_connect.php
r2763288 r2765832 3 3 /** 4 4 * @package Shorthand Connect 5 * @version 1.3.1 65 * @version 1.3.17 6 6 */ 7 7 /* … … 10 10 Description: Import your Shorthand stories into your Wordpress CMS as simply as possible - magic! 11 11 Author: Shorthand 12 Version: 1.3.1 612 Version: 1.3.17 13 13 Author URI: http://shorthand.com 14 14 */ … … 291 291 update_post_meta($post_id, 'story_path', $story_path); 292 292 293 //Log any story-specific errors to the metadata 294 if(isset($err['error'])){ 295 update_post_meta($post_id, 'ERROR', json_encode($err)); 296 } 297 293 298 // Get path to the assets 294 299 $assets_path = sh_get_story_url($post_id, $safe_story_id);
Note: See TracChangeset
for help on using the changeset viewer.