Plugin Directory

Changeset 2765832


Ignore:
Timestamp:
08/03/2022 01:54:06 PM (4 years ago)
Author:
shorthandconnect
Message:

Created tag 1.3.17

Location:
shorthand-connect
Files:
3 edited
5 copied

Legend:

Unmodified
Added
Removed
  • shorthand-connect/tags/1.3.17/README.txt

    r2763288 r2765832  
    11=== Shorthand Connect ===
    22Contributors: shorthandconnect
    3 Donate link:
     3Donate link: 
    44Tags: shorthand, api
    55Requires at least: 4.0
    6 Tested up to: 6.0.0
    7 Stable tag: 1.3.16
     6Tested up to: 6.0.1
     7Stable tag: 1.3.17
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    5959
    6060== Changelog ==
     61
     62= 1.3.17 =
     63* Added alternate method of story ZIP extraction for WP VIP-hosted customers.
    6164
    6265= 1.3.16 =
  • shorthand-connect/tags/1.3.17/includes/api-v2.php

    r2763288 r2765832  
    66    global $serverv2URL;
    77    $token = get_option('sh_v2_token');
    8    
    98    if (!$token) {
    109        return false;
     
    1615            'headers' => array(
    1716                '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
    2020        ),
    2121        $options
    2222    );
    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);
    2525    }else{
    2626        return wp_remote_get($url, $request_options);
     
    122122
    123123    //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';
    126126    $response = sh_v2_api_get('/v2/stories/'.$story_id, array(
    127127        'timeout' => '600',
     
    140140        );
    141141    } 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 {
    147162                $story['error'] = array(
    148                     'pretty' => 'Could not copy story into Wordpress',
    149                     'error' => $err->get_error_message()
     163                    'pretty' => 'Could not unzip file'
    150164                );
     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                }
    151184            } else {
    152                 $story['path'] = $destination_path.'/'.$story_id;
     185                $story['error'] = array(
     186                    'pretty' => 'Could not unzip file'
     187                );
    153188            }
    154         } else {
    155             $story['error'] = array(
    156                 'pretty' => 'Could not unzip file'
    157             );
    158189        }
    159190    }
  • shorthand-connect/tags/1.3.17/shorthand_connect.php

    r2763288 r2765832  
    33/**
    44 * @package Shorthand Connect
    5  * @version 1.3.16
     5 * @version 1.3.17
    66 */
    77/*
     
    1010Description: Import your Shorthand stories into your Wordpress CMS as simply as possible - magic!
    1111Author: Shorthand
    12 Version: 1.3.16
     12Version: 1.3.17
    1313Author URI: http://shorthand.com
    1414*/
     
    291291            update_post_meta($post_id, 'story_path', $story_path);
    292292
     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
    293298            // Get path to the assets
    294299            $assets_path = sh_get_story_url($post_id, $safe_story_id);
  • shorthand-connect/trunk/README.txt

    r2763288 r2765832  
    11=== Shorthand Connect ===
    22Contributors: shorthandconnect
    3 Donate link:
     3Donate link: 
    44Tags: shorthand, api
    55Requires at least: 4.0
    6 Tested up to: 6.0.0
    7 Stable tag: 1.3.16
     6Tested up to: 6.0.1
     7Stable tag: 1.3.17
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    5959
    6060== Changelog ==
     61
     62= 1.3.17 =
     63* Added alternate method of story ZIP extraction for WP VIP-hosted customers.
    6164
    6265= 1.3.16 =
  • shorthand-connect/trunk/includes/api-v2.php

    r2763288 r2765832  
    66    global $serverv2URL;
    77    $token = get_option('sh_v2_token');
    8    
    98    if (!$token) {
    109        return false;
     
    1615            'headers' => array(
    1716                '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
    2020        ),
    2121        $options
    2222    );
    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);
    2525    }else{
    2626        return wp_remote_get($url, $request_options);
     
    122122
    123123    //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';
    126126    $response = sh_v2_api_get('/v2/stories/'.$story_id, array(
    127127        'timeout' => '600',
     
    140140        );
    141141    } 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 {
    147162                $story['error'] = array(
    148                     'pretty' => 'Could not copy story into Wordpress',
    149                     'error' => $err->get_error_message()
     163                    'pretty' => 'Could not unzip file'
    150164                );
     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                }
    151184            } else {
    152                 $story['path'] = $destination_path.'/'.$story_id;
     185                $story['error'] = array(
     186                    'pretty' => 'Could not unzip file'
     187                );
    153188            }
    154         } else {
    155             $story['error'] = array(
    156                 'pretty' => 'Could not unzip file'
    157             );
    158189        }
    159190    }
  • shorthand-connect/trunk/shorthand_connect.php

    r2763288 r2765832  
    33/**
    44 * @package Shorthand Connect
    5  * @version 1.3.16
     5 * @version 1.3.17
    66 */
    77/*
     
    1010Description: Import your Shorthand stories into your Wordpress CMS as simply as possible - magic!
    1111Author: Shorthand
    12 Version: 1.3.16
     12Version: 1.3.17
    1313Author URI: http://shorthand.com
    1414*/
     
    291291            update_post_meta($post_id, 'story_path', $story_path);
    292292
     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
    293298            // Get path to the assets
    294299            $assets_path = sh_get_story_url($post_id, $safe_story_id);
Note: See TracChangeset for help on using the changeset viewer.