WordPress.org

Plugin Directory

Changeset 1643485


Ignore:
Timestamp:
04/24/17 02:54:17 (8 months ago)
Author:
playes
Message:

1.9

  • 优化加载逻辑和兼容性
  • 修正库文件中一个错误
Location:
oss-upload/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • oss-upload/trunk/lib/OSS.php

    r1626365 r1643485  
    16091609            } 
    16101610        } 
    1611         else if($handle = opendir($dir)){  
     1611        else if($handle = @opendir($dir)){  
    16121612            while ( false !== ($file = readdir($handle))){                  
    16131613                if(!in_array(strtolower($file), $exclude_array)){  
  • oss-upload/trunk/oss-upload.php

    r1635786 r1643485  
    22/* 
    33 * Plugin Name: OSS Upload 
    4  * Version: 1.8 
     4 * Version: 1.9 
    55 * Description: Upload with Aliyun OSS, with modified OSS Wrapper and fully native image edit function support. 
    66 * Plugin URI: https://www.xiaomac.com/2016121895.html 
     
    1919add_action('init', 'oss_upload_init', 1); 
    2020function oss_upload_init(){ 
    21     if(!ouop('oss', 1) || !ouop('oss_akey') || !ouop('oss_skey') || !ouop('oss_endpoint') || is_admin()) return; 
     21    if(!ouop('oss', 1) || !ouop('oss_akey') || !ouop('oss_skey') || !ouop('oss_endpoint')) return; 
     22    define('OSS_ACCESS_ID', ouop('oss_akey')); 
     23    define('OSS_ACCESS_KEY', ouop('oss_skey')); 
     24    define('OSS_ENDPOINT', ouop('oss_endpoint')); 
     25    require_once('lib/OSSWrapper.php'); 
    2226    if(ouop('oss_mode')){ 
    2327        add_filter('the_title', 'oss_upload_title', 10, 2); 
     
    5862    return $param; 
    5963} 
    60 function oss_upload_upload_class(){ 
    61     define('OSS_ACCESS_ID', ouop('oss_akey')); 
    62     define('OSS_ACCESS_KEY', ouop('oss_skey')); 
    63     define('OSS_ENDPOINT', ouop('oss_endpoint')); 
    64     require_once('lib/OSSWrapper.php'); 
    65     if(!has_filter('upload_dir', 'oss_upload_upload_dir')) add_filter('upload_dir', 'oss_upload_upload_dir', 100, 1); 
    66 } 
    6764 
    6865add_action('admin_init', 'oss_upload_admin_init', 1); 
     
    7168    $GLOBALS['oss_upload_data'] = get_plugin_data( __FILE__ ); 
    7269    register_setting('oss_upload_admin_options_group', 'ouop'); 
    73     if(!ouop('oss_mode')){ 
    74         oss_upload_upload_class(); 
    75         return; 
    76     } 
     70    if(!ouop('oss', 1) || !ouop('oss_akey') || !ouop('oss_skey') || !ouop('oss_endpoint')) return; 
     71    if(has_filter('upload_dir', 'oss_upload_upload_dir')) return; 
    7772    global $pagenow; 
    7873    $action = isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''); 
     
    8681        || (!empty($action_hook) && !empty($action) && in_array($action, $action_hook)) 
    8782        || (!empty($page_hook) && !empty($_GET['page']) && in_array($_GET['page'], $page_hook)) ){ 
    88         oss_upload_upload_class(); 
     83        add_filter('upload_dir', 'oss_upload_upload_dir', 100, 1); 
    8984    } 
    9085} 
  • oss-upload/trunk/readme.txt

    r1641950 r1643485  
    55Tags: aliyun, oss, upload, storage 
    66Tested up to: 4.7.4 
    7 Stable tag: 1.8 
     7Stable tag: 1.9 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    4040== Changelog == 
    4141 
     42= 1.9 = 
     43* 优化加载逻辑和兼容性 
     44* 修正库文件中一个错误 
     45 
    4246= 1.8 = 
    4347* 新增兼容模式(默认为贪婪模式) 
Note: See TracChangeset for help on using the changeset viewer.