Plugin Directory

Changeset 2219304


Ignore:
Timestamp:
12/29/2019 04:29:52 PM (6 years ago)
Author:
playes
Message:

4.8.5

  • 优化目录上传等功能支持重复执行
  • 修复图片服务参数没编码引起的异常
  • 修复物理缩略图模式只有大图的问题
Location:
oss-upload/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • oss-upload/trunk/lang/oss-upload-zh_CN.po

    r2207953 r2219304  
    22msgstr ""
    33"Project-Id-Version: OSS Upload\n"
    4 "POT-Creation-Date: 2019-12-08 12:13+0800\n"
    5 "PO-Revision-Date: 2019-12-08 12:50+0800\n"
     4"POT-Creation-Date: 2019-12-30 00:13+0800\n"
     5"PO-Revision-Date: 2019-12-30 00:13+0800\n"
    66"Last-Translator: Link <playes@qq.com>\n"
    77"Language-Team: Link <playes@qq.com>\n"
     
    2222
    2323#. Plugin Name of the plugin/theme
    24 #: oss-upload.php:186 oss-upload.php:192 oss-upload.php:669
     24#: oss-upload.php:185 oss-upload.php:191 oss-upload.php:582 oss-upload.php:676
    2525msgid "OSS Upload"
    2626msgstr ""
    2727
    28 #: oss-upload.php:200
     28#: oss-upload.php:199
    2929msgid "Settings"
    3030msgstr "设置"
    3131
    32 #: oss-upload.php:228
     32#: oss-upload.php:227
    3333msgid "For Less"
    3434msgstr "更少"
    3535
    36 #: oss-upload.php:229
     36#: oss-upload.php:228
    3737msgid "Descriptions"
    3838msgstr "描述"
    3939
    40 #: oss-upload.php:230
     40#: oss-upload.php:229
    4141msgid "Examples"
    4242msgstr "示范"
    4343
    44 #: oss-upload.php:249
     44#: oss-upload.php:248
    4545msgid "Autosave remote images to OSS"
    4646msgstr "自动保存远程图片到 OSS"
    4747
    48 #: oss-upload.php:531
     48#: oss-upload.php:527
    4949msgid "Aliyun Coupon <span>NEW</span>"
    5050msgstr "阿里云代金券 <span>新</span>"
    5151
    52 #: oss-upload.php:532
     52#: oss-upload.php:528
    5353msgid "OSS Discount <span>HOT</span>"
    5454msgstr "OSS钜惠折扣 <span>热</span>"
    5555
    56 #: oss-upload.php:533
     56#: oss-upload.php:529
    5757msgid "Rating Stars"
    5858msgstr "点赞插件"
    5959
    60 #: oss-upload.php:534
     60#: oss-upload.php:530
    6161msgid "Support and Help"
    6262msgstr "技术支持"
    6363
    64 #: oss-upload.php:535
     64#: oss-upload.php:531
    6565msgid "About Developer"
    6666msgstr "关于作者"
    6767
    68 #: oss-upload.php:536
     68#: oss-upload.php:532
    6969msgid "See More Plugins"
    7070msgstr "更多插件"
    7171
    72 #: oss-upload.php:537
     72#: oss-upload.php:533
    7373msgid "About"
    7474msgstr "关于"
    7575
    76 #: oss-upload.php:538
     76#: oss-upload.php:534
    7777msgid "Aliyun OSS"
    7878msgstr "OSS 官网"
    7979
    80 #: oss-upload.php:539
     80#: oss-upload.php:535
    8181msgid "OSS PHP SDK"
    8282msgstr "OSS 开发文档"
    8383
    84 #: oss-upload.php:540
     84#: oss-upload.php:536
    8585msgid "For More"
    8686msgstr "更多"
    8787
    88 #: oss-upload.php:554 oss-upload.php:593 oss-upload.php:604 oss-upload.php:621
     88#: oss-upload.php:550
     89msgid "Write OK, "
     90msgstr "写入正常, "
     91
     92#: oss-upload.php:553
     93msgid "Read OK, "
     94msgstr "读取正常, "
     95
     96#: oss-upload.php:556
     97msgid "Delete OK"
     98msgstr "删除正常"
     99
     100#: oss-upload.php:559
     101msgid "Delete Error: "
     102msgstr "删除出错: "
     103
     104#: oss-upload.php:562
     105msgid "Read Error: "
     106msgstr "读取出错: "
     107
     108#: oss-upload.php:565
     109msgid "Write Error: "
     110msgstr "写入出错: "
     111
     112#: oss-upload.php:583
    89113msgid "Starting..."
    90114msgstr "开始处理……"
    91115
    92 #: oss-upload.php:581
     116#: oss-upload.php:590
     117msgid "deleted"
     118msgstr "已删除"
     119
     120#: oss-upload.php:618
    93121msgid "No thumbnail found"
    94122msgstr "没有发现缩略图"
    95123
    96 #: oss-upload.php:583
     124#: oss-upload.php:621
    97125msgid "Clean thumbnails done"
    98126msgstr "清理错略图完成"
    99127
    100 #: oss-upload.php:596
     128#: oss-upload.php:632
    101129msgid "Upload local storage to OSS done"
    102130msgstr "上传本地存储完成"
    103131
    104 #: oss-upload.php:613
     132#: oss-upload.php:638
     133msgid "synced"
     134msgstr "已同步"
     135
     136#: oss-upload.php:648
    105137msgid "No attachments need to be synced"
    106138msgstr "没有附件需同步"
    107139
    108 #: oss-upload.php:615
     140#: oss-upload.php:651
    109141msgid "Sync missing attachments to OSS done"
    110142msgstr "同步缺失的附件到 OSS 完成"
    111143
    112 #: oss-upload.php:629
     144#: oss-upload.php:656
     145msgid "reset"
     146msgstr "已重置"
     147
     148#: oss-upload.php:666
    113149msgid "Reset attachments metadata done"
    114150msgstr "重置附件元数据完成"
    115151
    116 #: oss-upload.php:637
    117 msgid "Write OK, "
    118 msgstr "写入正常, "
    119 
    120 #: oss-upload.php:640
    121 msgid "Read OK, "
    122 msgstr "读取正常, "
    123 
    124 #: oss-upload.php:643
    125 msgid "Delete OK"
    126 msgstr "删除正常"
    127 
    128 #: oss-upload.php:646
    129 msgid "Delete Error: "
    130 msgstr "删除出错: "
    131 
    132 #: oss-upload.php:649
    133 msgid "Read Error: "
    134 msgstr "读取出错: "
    135 
    136 #: oss-upload.php:652
    137 msgid "Write Error: "
    138 msgstr "写入出错: "
    139 
    140 #: oss-upload.php:676
     152#: oss-upload.php:683
    141153msgid "Enable"
    142154msgstr "启用"
    143155
    144 #: oss-upload.php:679
     156#: oss-upload.php:686
    145157msgid "Use OSS as media library storage"
    146158msgstr "使用 OSS 作为媒体库存储"
    147159
    148 #: oss-upload.php:682
     160#: oss-upload.php:689
    149161msgid "Access Key"
    150162msgstr "Access Key"
    151163
    152 #: oss-upload.php:688
     164#: oss-upload.php:695
    153165msgid "Secret Key"
    154166msgstr "Secret Key"
    155167
    156 #: oss-upload.php:694
     168#: oss-upload.php:701
    157169msgid "Upload Path"
    158170msgstr "上传路径"
    159171
    160 #: oss-upload.php:698
     172#: oss-upload.php:705
    161173msgid ""
    162174"<code>{BUCKET}</code> is Bucket name, <code>{PATH}</code> can be empty, with "
     
    166178"后不带斜杠"
    167179
    168 #: oss-upload.php:705
     180#: oss-upload.php:712
    169181msgid "Visit URL"
    170182msgstr "访问链接"
    171183
    172 #: oss-upload.php:709
     184#: oss-upload.php:716
    173185msgid ""
    174186"<code>{BUCKET}</code> can be directory or domain, <code>{PATH}</code> can be "
     
    176188msgstr "<code>{BUCKET}</code> 可为目录或域名,<code>{PATH}</code> 可为空"
    177189
    178 #: oss-upload.php:719
     190#: oss-upload.php:726
    179191msgid "Upload EndPoint"
    180192msgstr "地域节点"
    181193
    182 #: oss-upload.php:723
     194#: oss-upload.php:730
    183195msgid ""
    184196"Endpoint of your Bucket, can be internal address if WEB SERVER is in the "
     
    186198msgstr "存储空间的 Endpoint,如服务器跟 OSS 处于同个区域允许设置为内部地址"
    187199
    188 #: oss-upload.php:737
     200#: oss-upload.php:744
    189201msgid "Run a test"
    190202msgstr "测试一下"
    191203
    192 #: oss-upload.php:741
     204#: oss-upload.php:748
    193205msgid "Image Thumbnails"
    194206msgstr "缩略图"
    195207
    196 #: oss-upload.php:743
     208#: oss-upload.php:750
    197209msgid "Use Image Service via Parameter, default and simple"
    198210msgstr "使用参数图片服务,默认且简单"
    199211
    200 #: oss-upload.php:746
     212#: oss-upload.php:753
    201213msgid "Use Image Service via Style, powerful but require styles setting on OSS"
    202214msgstr "使用样式图片服务,定制功能强大但需额外设置样式"
    203215
    204 #: oss-upload.php:751
     216#: oss-upload.php:758
    205217msgid "Use physical thumbnails, check this when having problem with theme"
    206218msgstr "使用物理缩略图,如主题有缩略图错误请尝试勾选"
    207219
    208 #: oss-upload.php:753
     220#: oss-upload.php:760
    209221msgid "Disable image thumbnails"
    210222msgstr "禁用缩略图"
    211223
    212 #: oss-upload.php:756
     224#: oss-upload.php:763
    213225msgid "Media Sizes Options"
    214226msgstr "媒体尺寸选项"
    215227
    216 #: oss-upload.php:757
     228#: oss-upload.php:764
    217229msgid "Clean Thumbnails"
    218230msgstr "清理缩略图"
    219231
    220 #: oss-upload.php:758
     232#: oss-upload.php:765
    221233msgid "Regenerate Thumbnails"
    222234msgstr "重新生成缩略图"
    223235
    224 #: oss-upload.php:762
     236#: oss-upload.php:769
    225237msgid "Thumbnail Quality"
    226238msgstr "缩略图质量"
    227239
    228 #: oss-upload.php:765
     240#: oss-upload.php:772
    229241msgid ""
    230242"Set the quality of thumbnail for OSS Image Servie to speed up image loading, "
     
    232244msgstr "设置图片服务的缩略图质量以提升加载速度,越小约模糊,加载越快"
    233245
    234 #: oss-upload.php:768
     246#: oss-upload.php:775
    235247msgid "Featured Image"
    236248msgstr "特色图片"
    237249
    238 #: oss-upload.php:774
     250#: oss-upload.php:781
    239251msgid ""
    240252"Set the featured image dimensions when thumbnails enabled (width x height)"
    241253msgstr "当启用缩略图后设置特色图片的尺寸大小(宽X高)"
    242254
    243 #: oss-upload.php:777
     255#: oss-upload.php:784
    244256msgid "Style Separator"
    245257msgstr "样式分隔符"
    246258
    247 #: oss-upload.php:780
     259#: oss-upload.php:787
    248260msgid "Custom style separator for OSS Image Service style"
    249261msgstr "自定义 OSS 图片服务的样式名分隔符"
    250262
    251 #: oss-upload.php:783
     263#: oss-upload.php:790
    252264msgid "Fullsize Style"
    253265msgstr "原图样式"
    254266
    255 #: oss-upload.php:787
     267#: oss-upload.php:794
    256268msgid "Default full size image style for OSS Image Service"
    257269msgstr "全尺寸图片的默认样式"
    258270
    259 #: oss-upload.php:790
     271#: oss-upload.php:797
    260272msgid "GIF Style"
    261273msgstr "动画样式"
    262274
    263 #: oss-upload.php:793
     275#: oss-upload.php:800
    264276msgid "Using special OSS Image Service style for <code>GIF</code> format"
    265277msgstr "为 <code>GIF</code> 格式启用特别的 OSS 图像服务样式"
    266278
    267 #: oss-upload.php:794
    268 msgid "If gif have no animation effect, check this and set extra style on OSS"
    269 msgstr "如果 GIF 没有动画效果,勾选此项并在 OSS 上设置额外样式"
    270 
    271279#: oss-upload.php:801
     280msgid "Check this to skip style for GIF image if having no animation effect"
     281msgstr "如GIF无动画效果可勾选此项忽略其图片服务"
     282
     283#: oss-upload.php:805
    272284msgid "Auto Compress"
    273285msgstr "自动压缩"
    274286
    275 #: oss-upload.php:804
     287#: oss-upload.php:808
    276288msgid "Compress as <code>WebP</code> format automatically if browser support"
    277289msgstr "自动压缩为 <code>WebP</code> 格式如浏览器支持"
    278290
    279 #: oss-upload.php:805
    280 msgid ""
    281 "Require extra style to be set on OSS when using styles for Image Service"
    282 msgstr "如图片服务使用样式则需要在 OSS 上设置额外样式"
    283 
    284 #: oss-upload.php:808
     291#: oss-upload.php:809
     292msgid "Choose webp format on OSS if using styles for Image Service"
     293msgstr "如图片服务使用样式则在设置样式时选 webp 格式"
     294
     295#: oss-upload.php:812
    285296msgid "Lazyload"
    286297msgstr "延时加载"
    287298
    288 #: oss-upload.php:811
     299#: oss-upload.php:815
    289300msgid "Delay loading of images in long web pages"
    290301msgstr "延迟加载长网页中的图片"
    291302
    292 #: oss-upload.php:813
     303#: oss-upload.php:817
    293304msgid "Images outside of viewport wont be loaded before user scrolls to them"
    294305msgstr "图片滚动到视区内才加载原图"
    295306
    296 #: oss-upload.php:816
     307#: oss-upload.php:820
    297308msgid "Lazyload URL"
    298309msgstr "延时链接"
    299310
    300 #: oss-upload.php:819
     311#: oss-upload.php:823
    301312msgid ""
    302313"Default image url for lazyload, could be with Image Service suffix, or "
     
    306317"<code>{IMG}</code> 表示原图地址"
    307318
    308 #: oss-upload.php:828
     319#: oss-upload.php:832
    309320msgid "Upload Mimes"
    310321msgstr "上传类型"
    311322
    312 #: oss-upload.php:832
     323#: oss-upload.php:836
    313324msgid "Add file extensions and mime types to the allowed upload list"
    314325msgstr "添加文件扩展名和MIME类型到允许上传列表中"
    315326
    316 #: oss-upload.php:835
     327#: oss-upload.php:839
    317328msgid "Auto Rename"
    318329msgstr "自动重命名"
    319330
    320 #: oss-upload.php:838
     331#: oss-upload.php:842
    321332msgid "Auto rename uploaded file if having like Non-ASCII problem"
    322333msgstr "上传时文件自动重命名,如有中文乱码之类的问题请勾选"
    323334
    324 #: oss-upload.php:841
     335#: oss-upload.php:845
    325336msgid "URL Fixer"
    326337msgstr "连接修正"
    327338
    328 #: oss-upload.php:844
     339#: oss-upload.php:848
    329340msgid "Auto relocate attachments in past posts when OSS disabled"
    330341msgstr "当停用 OSS 时自动替换旧文章中的附件地址"
    331342
    332 #: oss-upload.php:847
     343#: oss-upload.php:851
    333344msgid "Find and replace whatever strings you want to fix the attachment url"
    334345msgstr "查找并替换附件连接中的指定字符串"
    335346
    336 #: oss-upload.php:850
     347#: oss-upload.php:854
    337348msgid "Remote Image"
    338349msgstr "远程图片"
    339350
    340 #: oss-upload.php:853
     351#: oss-upload.php:857
    341352msgid "Enable remote images autosave when edit post/page"
    342353msgstr "当编辑文章时自动保存远程图片"
    343354
    344 #: oss-upload.php:855
     355#: oss-upload.php:859
    345356msgid "Enable remote images autosave when import post/page"
    346357msgstr "当导入文章时自动保存远程图片"
    347358
    348 #: oss-upload.php:858
     359#: oss-upload.php:862
    349360msgid "Whitelist / Blacklist rules for remote images autosave"
    350361msgstr "远程图像自动保存的白名单/黑名单规则"
    351362
    352 #: oss-upload.php:861
     363#: oss-upload.php:865
    353364msgid "Local Backup"
    354365msgstr "本地备份"
    355366
    356 #: oss-upload.php:864
     367#: oss-upload.php:868
    357368msgid "Backup original image to local storage"
    358369msgstr "备份原图到本地存储"
    359370
    360 #: oss-upload.php:870
     371#: oss-upload.php:874
    361372msgid "Upload Missing Attachment"
    362373msgstr "上传 OSS 缺失附件"
    363374
    364 #: oss-upload.php:871
     375#: oss-upload.php:875
    365376msgid "Upload Whole Local Storage"
    366377msgstr "上传整个本地存储目录"
    367378
    368 #: oss-upload.php:885
     379#: oss-upload.php:889
    369380msgid ""
    370381"This action would clean all thumbnails including local and OSS that filename "
     
    374385"消,是否继续?"
    375386
    376 #: oss-upload.php:888
     387#: oss-upload.php:892
    377388msgid ""
    378389"This action would upload local storage directory to OSS, override if file "
     
    382393"否继续?"
    383394
    384 #: oss-upload.php:891
     395#: oss-upload.php:895
    385396msgid ""
    386397"This action would upload attachment from local storage that missing in OSS, "
     
    388399msgstr "此操作将从本地存储同步丢失的附件到 OSS,可能需要几十分钟,是否继续?"
    389400
    390 #: oss-upload.php:894
     401#: oss-upload.php:898
    391402msgid ""
    392403"This action would regenerate metadata of all attachment in OSS, might take "
     
    413424msgid "https://www.xiaomac.com"
    414425msgstr ""
     426
     427#~ msgid ""
     428#~ "If gif have no animation effect, check this and set extra style on OSS"
     429#~ msgstr "如果 GIF 没有动画效果,勾选此项并在 OSS 上设置额外样式"
    415430
    416431#~ msgid "Plugin Rating"
  • oss-upload/trunk/lang/oss-upload.po

    r2207948 r2219304  
    22msgstr ""
    33"Project-Id-Version: OSS Upload\n"
    4 "POT-Creation-Date: 2019-12-08 12:13+0800\n"
    5 "PO-Revision-Date: 2019-12-08 12:13+0800\n"
     4"POT-Creation-Date: 2019-12-30 00:13+0800\n"
     5"PO-Revision-Date: 2019-12-30 00:13+0800\n"
    66"Last-Translator: Link <playes@qq.com>\n"
    77"Language-Team: Link <playes@qq.com>\n"
     
    2222
    2323#. Plugin Name of the plugin/theme
    24 #: oss-upload.php:186 oss-upload.php:192 oss-upload.php:669
     24#: oss-upload.php:185 oss-upload.php:191 oss-upload.php:582 oss-upload.php:676
    2525msgid "OSS Upload"
    2626msgstr ""
    2727
    28 #: oss-upload.php:200
     28#: oss-upload.php:199
    2929msgid "Settings"
    3030msgstr ""
    3131
     32#: oss-upload.php:227
     33msgid "For Less"
     34msgstr ""
     35
    3236#: oss-upload.php:228
    33 msgid "For Less"
     37msgid "Descriptions"
    3438msgstr ""
    3539
    3640#: oss-upload.php:229
    37 msgid "Descriptions"
    38 msgstr ""
    39 
    40 #: oss-upload.php:230
    4141msgid "Examples"
    4242msgstr ""
    4343
    44 #: oss-upload.php:249
     44#: oss-upload.php:248
    4545msgid "Autosave remote images to OSS"
    4646msgstr ""
    4747
     48#: oss-upload.php:527
     49msgid "Aliyun Coupon <span>NEW</span>"
     50msgstr ""
     51
     52#: oss-upload.php:528
     53msgid "OSS Discount <span>HOT</span>"
     54msgstr ""
     55
     56#: oss-upload.php:529
     57msgid "Rating Stars"
     58msgstr ""
     59
     60#: oss-upload.php:530
     61msgid "Support and Help"
     62msgstr ""
     63
    4864#: oss-upload.php:531
    49 msgid "Aliyun Coupon <span>NEW</span>"
     65msgid "About Developer"
    5066msgstr ""
    5167
    5268#: oss-upload.php:532
    53 msgid "OSS Discount <span>HOT</span>"
     69msgid "See More Plugins"
    5470msgstr ""
    5571
    5672#: oss-upload.php:533
    57 msgid "Rating Stars"
     73msgid "About"
    5874msgstr ""
    5975
    6076#: oss-upload.php:534
    61 msgid "Support and Help"
     77msgid "Aliyun OSS"
    6278msgstr ""
    6379
    6480#: oss-upload.php:535
    65 msgid "About Developer"
     81msgid "OSS PHP SDK"
    6682msgstr ""
    6783
    6884#: oss-upload.php:536
    69 msgid "See More Plugins"
    70 msgstr ""
    71 
    72 #: oss-upload.php:537
    73 msgid "About"
    74 msgstr ""
    75 
    76 #: oss-upload.php:538
    77 msgid "Aliyun OSS"
    78 msgstr ""
    79 
    80 #: oss-upload.php:539
    81 msgid "OSS PHP SDK"
    82 msgstr ""
    83 
    84 #: oss-upload.php:540
    8585msgid "For More"
    8686msgstr ""
    8787
    88 #: oss-upload.php:554 oss-upload.php:593 oss-upload.php:604 oss-upload.php:621
     88#: oss-upload.php:550
     89msgid "Write OK, "
     90msgstr ""
     91
     92#: oss-upload.php:553
     93msgid "Read OK, "
     94msgstr ""
     95
     96#: oss-upload.php:556
     97msgid "Delete OK"
     98msgstr ""
     99
     100#: oss-upload.php:559
     101msgid "Delete Error: "
     102msgstr ""
     103
     104#: oss-upload.php:562
     105msgid "Read Error: "
     106msgstr ""
     107
     108#: oss-upload.php:565
     109msgid "Write Error: "
     110msgstr ""
     111
     112#: oss-upload.php:583
    89113msgid "Starting..."
    90114msgstr ""
    91115
    92 #: oss-upload.php:581
     116#: oss-upload.php:590
     117msgid "deleted"
     118msgstr ""
     119
     120#: oss-upload.php:618
    93121msgid "No thumbnail found"
    94122msgstr ""
    95123
    96 #: oss-upload.php:583
     124#: oss-upload.php:621
    97125msgid "Clean thumbnails done"
    98126msgstr ""
    99127
    100 #: oss-upload.php:596
     128#: oss-upload.php:632
    101129msgid "Upload local storage to OSS done"
    102130msgstr ""
    103131
    104 #: oss-upload.php:613
     132#: oss-upload.php:638
     133msgid "synced"
     134msgstr ""
     135
     136#: oss-upload.php:648
    105137msgid "No attachments need to be synced"
    106138msgstr ""
    107139
    108 #: oss-upload.php:615
     140#: oss-upload.php:651
    109141msgid "Sync missing attachments to OSS done"
    110142msgstr ""
    111143
    112 #: oss-upload.php:629
     144#: oss-upload.php:656
     145msgid "reset"
     146msgstr ""
     147
     148#: oss-upload.php:666
    113149msgid "Reset attachments metadata done"
    114150msgstr ""
    115151
    116 #: oss-upload.php:637
    117 msgid "Write OK, "
    118 msgstr ""
    119 
    120 #: oss-upload.php:640
    121 msgid "Read OK, "
    122 msgstr ""
    123 
    124 #: oss-upload.php:643
    125 msgid "Delete OK"
    126 msgstr ""
    127 
    128 #: oss-upload.php:646
    129 msgid "Delete Error: "
    130 msgstr ""
    131 
    132 #: oss-upload.php:649
    133 msgid "Read Error: "
    134 msgstr ""
    135 
    136 #: oss-upload.php:652
    137 msgid "Write Error: "
    138 msgstr ""
    139 
    140 #: oss-upload.php:676
     152#: oss-upload.php:683
    141153msgid "Enable"
    142154msgstr ""
    143155
    144 #: oss-upload.php:679
     156#: oss-upload.php:686
    145157msgid "Use OSS as media library storage"
    146158msgstr ""
    147159
    148 #: oss-upload.php:682
     160#: oss-upload.php:689
    149161msgid "Access Key"
    150162msgstr ""
    151163
    152 #: oss-upload.php:688
     164#: oss-upload.php:695
    153165msgid "Secret Key"
    154166msgstr ""
    155167
    156 #: oss-upload.php:694
     168#: oss-upload.php:701
    157169msgid "Upload Path"
    158170msgstr ""
    159171
    160 #: oss-upload.php:698
     172#: oss-upload.php:705
    161173msgid ""
    162174"<code>{BUCKET}</code> is Bucket name, <code>{PATH}</code> can be empty, with "
     
    164176msgstr ""
    165177
    166 #: oss-upload.php:705
     178#: oss-upload.php:712
    167179msgid "Visit URL"
    168180msgstr ""
    169181
    170 #: oss-upload.php:709
     182#: oss-upload.php:716
    171183msgid ""
    172184"<code>{BUCKET}</code> can be directory or domain, <code>{PATH}</code> can be "
     
    174186msgstr ""
    175187
    176 #: oss-upload.php:719
     188#: oss-upload.php:726
    177189msgid "Upload EndPoint"
    178190msgstr ""
    179191
    180 #: oss-upload.php:723
     192#: oss-upload.php:730
    181193msgid ""
    182194"Endpoint of your Bucket, can be internal address if WEB SERVER is in the "
     
    184196msgstr ""
    185197
    186 #: oss-upload.php:737
     198#: oss-upload.php:744
    187199msgid "Run a test"
    188200msgstr ""
    189201
    190 #: oss-upload.php:741
     202#: oss-upload.php:748
    191203msgid "Image Thumbnails"
    192204msgstr ""
    193205
    194 #: oss-upload.php:743
     206#: oss-upload.php:750
    195207msgid "Use Image Service via Parameter, default and simple"
    196208msgstr ""
    197209
    198 #: oss-upload.php:746
     210#: oss-upload.php:753
    199211msgid "Use Image Service via Style, powerful but require styles setting on OSS"
    200212msgstr ""
    201213
    202 #: oss-upload.php:751
     214#: oss-upload.php:758
    203215msgid "Use physical thumbnails, check this when having problem with theme"
    204216msgstr ""
    205217
    206 #: oss-upload.php:753
     218#: oss-upload.php:760
    207219msgid "Disable image thumbnails"
    208220msgstr ""
    209221
    210 #: oss-upload.php:756
     222#: oss-upload.php:763
    211223msgid "Media Sizes Options"
    212224msgstr ""
    213225
    214 #: oss-upload.php:757
     226#: oss-upload.php:764
    215227msgid "Clean Thumbnails"
    216228msgstr ""
    217229
    218 #: oss-upload.php:758
     230#: oss-upload.php:765
    219231msgid "Regenerate Thumbnails"
    220232msgstr ""
    221233
    222 #: oss-upload.php:762
     234#: oss-upload.php:769
    223235msgid "Thumbnail Quality"
    224236msgstr ""
    225237
    226 #: oss-upload.php:765
     238#: oss-upload.php:772
    227239msgid ""
    228240"Set the quality of thumbnail for OSS Image Servie to speed up image loading, "
     
    230242msgstr ""
    231243
    232 #: oss-upload.php:768
     244#: oss-upload.php:775
    233245msgid "Featured Image"
    234246msgstr ""
    235247
    236 #: oss-upload.php:774
     248#: oss-upload.php:781
    237249msgid ""
    238250"Set the featured image dimensions when thumbnails enabled (width x height)"
    239251msgstr ""
    240252
    241 #: oss-upload.php:777
     253#: oss-upload.php:784
    242254msgid "Style Separator"
    243255msgstr ""
    244256
    245 #: oss-upload.php:780
     257#: oss-upload.php:787
    246258msgid "Custom style separator for OSS Image Service style"
    247259msgstr ""
    248260
    249 #: oss-upload.php:783
     261#: oss-upload.php:790
    250262msgid "Fullsize Style"
    251263msgstr ""
    252264
    253 #: oss-upload.php:787
     265#: oss-upload.php:794
    254266msgid "Default full size image style for OSS Image Service"
    255267msgstr ""
    256268
    257 #: oss-upload.php:790
     269#: oss-upload.php:797
    258270msgid "GIF Style"
    259271msgstr ""
    260272
    261 #: oss-upload.php:793
     273#: oss-upload.php:800
    262274msgid "Using special OSS Image Service style for <code>GIF</code> format"
    263275msgstr ""
    264276
    265 #: oss-upload.php:794
    266 msgid "If gif have no animation effect, check this and set extra style on OSS"
    267 msgstr ""
    268 
    269277#: oss-upload.php:801
     278msgid "Check this to skip style for GIF image if having no animation effect"
     279msgstr ""
     280
     281#: oss-upload.php:805
    270282msgid "Auto Compress"
    271283msgstr ""
    272284
    273 #: oss-upload.php:804
     285#: oss-upload.php:808
    274286msgid "Compress as <code>WebP</code> format automatically if browser support"
    275287msgstr ""
    276288
    277 #: oss-upload.php:805
    278 msgid ""
    279 "Require extra style to be set on OSS when using styles for Image Service"
    280 msgstr ""
    281 
    282 #: oss-upload.php:808
     289#: oss-upload.php:809
     290msgid "Choose webp format on OSS if using styles for Image Service"
     291msgstr ""
     292
     293#: oss-upload.php:812
    283294msgid "Lazyload"
    284295msgstr ""
    285296
    286 #: oss-upload.php:811
     297#: oss-upload.php:815
    287298msgid "Delay loading of images in long web pages"
    288299msgstr ""
    289300
    290 #: oss-upload.php:813
     301#: oss-upload.php:817
    291302msgid "Images outside of viewport wont be loaded before user scrolls to them"
    292303msgstr ""
    293304
    294 #: oss-upload.php:816
     305#: oss-upload.php:820
    295306msgid "Lazyload URL"
    296307msgstr ""
    297308
    298 #: oss-upload.php:819
     309#: oss-upload.php:823
    299310msgid ""
    300311"Default image url for lazyload, could be with Image Service suffix, or "
     
    302313msgstr ""
    303314
    304 #: oss-upload.php:828
     315#: oss-upload.php:832
    305316msgid "Upload Mimes"
    306317msgstr ""
    307318
    308 #: oss-upload.php:832
     319#: oss-upload.php:836
    309320msgid "Add file extensions and mime types to the allowed upload list"
    310321msgstr ""
    311322
    312 #: oss-upload.php:835
     323#: oss-upload.php:839
    313324msgid "Auto Rename"
    314325msgstr ""
    315326
    316 #: oss-upload.php:838
     327#: oss-upload.php:842
    317328msgid "Auto rename uploaded file if having like Non-ASCII problem"
    318329msgstr ""
    319330
    320 #: oss-upload.php:841
     331#: oss-upload.php:845
    321332msgid "URL Fixer"
    322333msgstr ""
    323334
    324 #: oss-upload.php:844
     335#: oss-upload.php:848
    325336msgid "Auto relocate attachments in past posts when OSS disabled"
    326337msgstr ""
    327338
    328 #: oss-upload.php:847
     339#: oss-upload.php:851
    329340msgid "Find and replace whatever strings you want to fix the attachment url"
    330341msgstr ""
    331342
    332 #: oss-upload.php:850
     343#: oss-upload.php:854
    333344msgid "Remote Image"
    334345msgstr ""
    335346
    336 #: oss-upload.php:853
     347#: oss-upload.php:857
    337348msgid "Enable remote images autosave when edit post/page"
    338349msgstr ""
    339350
    340 #: oss-upload.php:855
     351#: oss-upload.php:859
    341352msgid "Enable remote images autosave when import post/page"
    342353msgstr ""
    343354
    344 #: oss-upload.php:858
     355#: oss-upload.php:862
    345356msgid "Whitelist / Blacklist rules for remote images autosave"
    346357msgstr ""
    347358
    348 #: oss-upload.php:861
     359#: oss-upload.php:865
    349360msgid "Local Backup"
    350361msgstr ""
    351362
    352 #: oss-upload.php:864
     363#: oss-upload.php:868
    353364msgid "Backup original image to local storage"
    354365msgstr ""
    355366
    356 #: oss-upload.php:870
     367#: oss-upload.php:874
    357368msgid "Upload Missing Attachment"
    358369msgstr ""
    359370
    360 #: oss-upload.php:871
     371#: oss-upload.php:875
    361372msgid "Upload Whole Local Storage"
    362373msgstr ""
    363374
    364 #: oss-upload.php:885
     375#: oss-upload.php:889
    365376msgid ""
    366377"This action would clean all thumbnails including local and OSS that filename "
     
    368379msgstr ""
    369380
    370 #: oss-upload.php:888
     381#: oss-upload.php:892
    371382msgid ""
    372383"This action would upload local storage directory to OSS, override if file "
     
    374385msgstr ""
    375386
    376 #: oss-upload.php:891
     387#: oss-upload.php:895
    377388msgid ""
    378389"This action would upload attachment from local storage that missing in OSS, "
     
    380391msgstr ""
    381392
    382 #: oss-upload.php:894
     393#: oss-upload.php:898
    383394msgid ""
    384395"This action would regenerate metadata of all attachment in OSS, might take "
  • oss-upload/trunk/lib/OSS.php

    r2177517 r2219304  
    11611161        //Windows系统下进行转码
    11621162        $dir = OSSUtil::encoding_path($dir);
    1163         //判断是否目录
    1164         if(!is_dir($dir)){
    1165             throw new OSS_Exception($dir.' is not a directory, please check it');
    1166         }
    1167 
     1163        if(!is_dir($dir)) throw new OSS_Exception($dir.' 并非目录,请确认。');
    11681164        $file_list_array = $this->read_dir($dir, $exclude, $recursive);
    1169 
    1170 
    1171         if(empty($file_list_array)){
    1172             throw new OSS_Exception($dir.' is empty.');
    1173         }
    1174 
    1175         $is_upload_ok = '';
     1165        if(empty($file_list_array)) throw new OSS_Exception($dir.' 目录为空。');
     1166
    11761167        $index = 1;
    1177 
    11781168        $upload = oss_upload_dir(wp_get_upload_dir());
    11791169        $basedir = explode('/', substr($upload['basedir'].'/', 6), 2);
    11801170
    11811171        foreach ($file_list_array as $k=>$item){
    1182             $is_upload_ok .= $index++.". ";
    1183             $is_upload_ok .= "Syncing file ".$item['path']." ";
     1172            echo $index++.". ".$item['path']." - ";
    11841173            if (is_dir($item['path'])) {
    1185                 $is_upload_ok .= " skipped as directory.<br/>\n";
    1186             }
    1187             else {
     1174                echo "忽略目录。<br/>\n";
     1175                flush();
     1176            }else{
    11881177                $options = array(
    11891178                    self::OSS_FILE_UPLOAD => $item['path'],
    11901179                    self::OSS_PART_SIZE => self::OSS_MIN_PART_SIZE,
    1191                 );         
    1192 
     1180                );
     1181                $ossFile = "oss://{$bucket}/{$basedir[1]}".rawurlencode($item['file']);
     1182                if(file_exists($ossFile)){//检查文件是否相同,是则跳过,这样可以多次重复执行该功能
     1183                    $info_ = self::get_object_meta($bucket, $basedir[1].$item['file']);
     1184                    $ossMd5 = isset($info_->header['content-md5']) ? $info_->header['content-md5'] : false;
     1185                    $ossLen = isset($info_->header['content-length']) ? $info_->header['content-length'] : false;
     1186                    if(($ossLen && $ossLen==filesize($item['path'])) || ($ossMd5 && $ossMd5==base64_encode(md5_file($item['path'], true)))){
     1187                        echo "<font color=gray>已存在。</font><br/>\n";
     1188                        flush();
     1189                        continue;
     1190                    }
     1191                }
    11931192                $response = $this->create_mpu_object($bucket, $basedir[1].$item['file'], $options);
    11941193                if($response->isOK()){
    1195                     $is_upload_ok .= " successful.<br/>\n";
    1196                 }
    1197                 else {
    1198                     $is_upload_ok .= " failed.<br/>\n";
    1199                     continue;
     1194                    echo "<font color=green>上传成功。</font><br/>\n";
     1195                    flush();
     1196                }else {
     1197                    echo "<font color=red>上传失败。</font><br/>\n";
     1198                    flush();
    12001199                }
    12011200            }
    12021201        }
    1203         return $is_upload_ok;
     1202        return true;
    12041203    }
    12051204
  • oss-upload/trunk/lib/OSSWrapper.php

    r2177517 r2219304  
    3434            }
    3535        }
     36        clearstatcache();
    3637        return $return;
    3738    }
  • oss-upload/trunk/oss-upload.php

    r2208019 r2219304  
    22/*
    33 * Plugin Name: OSS Upload
    4  * Version: 4.8.4
     4 * Version: 4.8.5
    55 * Description: Upload with Aliyun OSS, with modified OSS Wrapper and fully native image edit function support.
    66 * Plugin URI: https://www.xiaomac.com/oss-upload.html
     
    9595    $newname = wp_unique_filename($upload['default']['path'], $newname);
    9696    $file['name'] = wp_unique_filename($upload['path'], $newname);
    97     if(isset($file['size']) && $file['size'] >= 1024*1024){//upload via file
    98         remove_filter('upload_dir', 'oss_upload_dir');
    99     }else if(ouops('oss_backup')){//upload via stream
    100         @copy($file['tmp_name'], $upload['default']['path'].'/'.$file['name']);
     97    if(isset($file['size']) && $file['size'] >= 1024*1024*2 && (stripos($file['type'],'image')!==0 || !ouops('oss_service',10))){
     98        remove_filter('upload_dir', 'oss_upload_dir');//upload via file
     99    }else if(ouops('oss_backup')){
     100        @copy($file['tmp_name'], $upload['default']['path'].'/'.$file['name']);//upload via stream
    101101    }
    102102    return $file;
     
    173173    register_setting('oss_upload_admin_options_group', 'ouop');
    174174    if(!ouops('oss')) return;
     175    if(isset($_GET['page'], $_GET['action']) && $_GET['page'] == 'oss-upload'){
     176        oss_upload_admin_action();
     177    }
    175178    add_filter('big_image_size_threshold', '__return_false');//kiss my ass...
    176179    add_filter('wp_privacy_exports_dir', 'oss_upload_privacy_exports_dir');
     
    358361    if($service == 10) return $data;
    359362    if($service == 2 || (ouops('oss_lazyload') && !is_admin())) $data['sizes'] = array();
    360     $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style/';
     363    $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style%2F';
    361364    $ext = wp_check_filetype(oss_upload_basename($data['file']));
    362365    $gif = $ext && $ext['ext'] == 'gif' ? 1 : 0;
    363366    $quality = ouops('oss_quality') ? intval(ouops('oss_quality')) : '50';
    364     $quality = $gif ? '' : '/quality,q_'.$quality;
     367    $quality = $gif ? '' : '%2Fquality,q_'.$quality;
    365368    foreach ($data['sizes'] as $k => $v){
    366369        if(!isset($v['file'])) continue;
    367         $postfix = $service ? "{$ouss}{$k}" : "?x-oss-process=image{$quality}/resize,m_fill,w_{$v['width']},h_{$v['height']}";
    368         if($gif && $service && ouops('oss_gif')) $postfix = "{$ouss}gif";
     370        if($gif && $service && ouops('oss_gif')) continue;
     371        $postfix = $service ? "{$ouss}{$k}" : "?x-oss-process=image{$quality}%2Fresize,m_fill,w_{$v['width']},h_{$v['height']}";
    369372        $data['sizes'][$k]['file'] = oss_upload_basename($data['file']).$postfix;
    370     }
    371     return $data;
    372 }
    373 
    374 add_filter('wp_prepare_attachment_for_js', 'oss_upload_prepare_attachment');
    375 function oss_upload_prepare_attachment($data){
    376     if(!ouops('oss_service',1)) return $data;
    377     $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style/';
    378     foreach ($data['sizes'] as $k => $v){
    379         $data['sizes'][$k]['url'] = str_replace($data['filename'].$ouss.$data['filename'], $data['filename'], $data['sizes'][$k]['url']);
    380373    }
    381374    return $data;
     
    394387        if(oss_upload_basename($meta['file']) == wp_basename($url)){//original
    395388            if(ouops('oss_service',1) || ouops('oss_fullsize_style')){//style
    396                 $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style/';
     389                $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style%2F';
    397390                $full = ouops('oss_fullsize_style') ? trim(ouops('oss_fullsize_style')) : 'full';
    398391                $url .= $ouss.$full;
     
    414407    $ext = wp_check_filetype(oss_upload_basename($url));
    415408    if(!$ext || !in_array($ext['ext'], array('bmp','gif','png','jpg','jpe','jpeg'))) return $url;
     409    if($ext && $ext['ext'] == 'gif' && ouops('oss_gif')) return $url;
    416410    if(ouops('oss_service',1) || ouops('oss_fullsize_style')){//style
    417         $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style/';
     411        $ouss = ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style%2F';
    418412        $full = ouops('oss_fullsize_style') ? trim(ouops('oss_fullsize_style')) : 'full';
    419413        $url .= $ouss.$full;
    420         if($ext && $ext['ext'] == 'gif' && ouops('oss_gif')) return $url.'_gif';
    421414    }
    422415    if(!is_admin()) $url = oss_upload_auto_webp($url);
     
    436429
    437430function oss_upload_auto_webp($img, $lazyload=false){
    438     if(!ouops('oss') || ouops('oss_service',10)) return $img;
     431    if(!ouops('oss') || ouops('oss_service',1) || ouops('oss_service',10)) return $img;
    439432    if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/spider|bot/i', $_SERVER['HTTP_USER_AGENT'])) return $img;
    440433    $upload = wp_get_upload_dir();
     
    445438    $ouis = $lazy = $pos = '';
    446439    if(stripos($img, '#')) $img = substr($img, 0, strripos($img, '#'));
    447     if((ouops('oss_default_style') && ($pos = stripos($img, trim(ouops('oss_default_style')))))
    448         || (ouops('oss_style_separator') && ($pos = stripos($img, trim(ouops('oss_style_separator')))))
    449         || ($pos = stripos($img, '?x-oss-process=style/'))){
    450         $ouis = '_webp';
    451     }else if($pos = stripos($img, '?x-oss-process=image/')){
    452         $ouis = '/format,webp';
     440    if($pos = stripos($img, '?x-oss-process=image')){
     441        $ouis = '%2Fformat,webp';
    453442    }else if(!stripos($img, '?')){
    454         $ouis = '?x-oss-process=image/format,webp';
     443        $ouis = '?x-oss-process=image%2Fformat,webp';
    455444    }
    456445    if($lazyload && !is_feed() && !wp_doing_ajax()){
     
    459448            $lazy = str_replace('{IMG}', $lazy, $lazyurl);
    460449        }else{
    461             $lazy .= '?x-oss-process=image/quality,q_10/resize,m_lfit,w_20';
    462             if(oss_upload_webp()) $lazy .= '/format,webp';
     450            $lazy .= '?x-oss-process=image%2Fquality,q_10%2Fresize,m_lfit,w_20';
     451            if(oss_upload_webp()) $lazy .= '%2Fformat,webp';
    463452        }
    464453    }
     
    553542    $screen = get_current_screen();
    554543    if($screen->id != 'settings_page_oss-upload' || !ouops('oss') || !is_super_admin()) return;
    555     if(isset($_GET['settings-updated'])){
    556         @set_time_limit(0);
    557         $ok = false;
    558         $index = 1;
    559         if($_GET['settings-updated'] == 'clean'){
    560             $upload = wp_get_upload_dir();
    561             try{
    562                 $out = __('Starting...', 'oss-upload')."<br/>\n";
    563                 $files = get_posts(array('post_type'=>'attachment', 'posts_per_page'=>-1));
    564                 $paths = array();
    565                 foreach ($files as $file){
    566                     $path = pathinfo(get_attached_file($file->ID), 1);
     544    if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'test'){
     545        try{
     546            $rnd = md5(time());
     547            $file = ouops('oss_path').'/oss_upload_'.$rnd.'.txt';
     548            $try = file_put_contents($file, $rnd);
     549            if($try == strlen($rnd)){
     550                $out = __('Write OK, ','oss-upload');
     551                $try = file_get_contents($file);
     552                if($try == $rnd){
     553                    $out .= __('Read OK, ', 'oss-upload');
     554                    $try = unlink($file);
     555                    if($try === true){
     556                        $out .= __('Delete OK', 'oss-upload');
     557                        $ok = true;
     558                    }else{
     559                        throw new RequestCore_Exception($out . __('Delete Error: ', 'oss-upload') . $try);
     560                    }
     561                }else{
     562                    throw new RequestCore_Exception($out . __('Read Error: ', 'oss-upload') . $try);
     563                }
     564            }else{
     565                throw new RequestCore_Exception($out . __('Write Error: ', 'oss-upload') . $try);
     566            }
     567        }catch(Exception $ex){
     568            $out = esc_html($ex->message);
     569        }
     570        if(isset($out)) echo '<div class="'. ($ok ? 'updated fade' : 'error') . '"><p>'.$out.'</p></div>';
     571    }
     572    if(isset($_SESSION['oss_upload_error'])){
     573        echo '<div class="error"><p>'.$_SESSION['oss_upload_error'].'</p></div>';
     574    }
     575}
     576
     577function oss_upload_admin_action(){
     578    if(!$action = $_GET['action'] || !is_super_admin()) return;
     579    @set_time_limit(0);
     580    ob_end_clean();
     581    echo str_pad('',1024);
     582    echo '<title>'.__('OSS Upload','oss-upload').'</title>';
     583    echo "<h1>".__('Starting...', 'oss-upload')."</h1>\n";
     584    flush();
     585    $index = 1;
     586    $upload = wp_get_upload_dir();
     587    if($action == 'clean'){
     588        try{
     589            $files = get_posts(array('post_type'=>'attachment', 'posts_per_page'=>-1));
     590            $postfix = __('deleted', 'oss-upload');
     591            $paths = array();
     592            foreach ($files as $file){
     593                $path = pathinfo(get_attached_file($file->ID), 1);
     594                if(!in_array($path, $paths)) $paths[] = $path;
     595                if(isset($_GET['force'])){
     596                    $path = pathinfo(get_attached_file($file->ID, 1), 1);
    567597                    if(!in_array($path, $paths)) $paths[] = $path;
    568                     if(isset($_GET['force'])){
    569                         $path = pathinfo(get_attached_file($file->ID, 1), 1);
    570                         if(!in_array($path, $paths)) $paths[] = $path;
     598                }
     599                if($arr = oss_upload_delete_thumbnail($file->ID)){
     600                    foreach ($arr as $v){
     601                        echo $index++.". {$v} {$postfix}<br/>\n";
     602                        flush();
    571603                    }
    572                     if($arr = oss_upload_delete_thumbnail($file->ID)){
    573                         foreach ($arr as $v){
    574                             $out .= $index++.". {$v} deleted<br/>\n";
     604                }
     605            }
     606            foreach ($paths as $path){
     607                $imgs = oss_upload_readdir($path);
     608                foreach ($imgs as $img) {
     609                    if(preg_match('/\-[0-9]+x[0-9]+\./', $img) && file_is_valid_image($img)){
     610                        if(@file_exists($img) && @unlink($img)){
     611                            echo $index++.". {$img} {$postfix}<br/>\n";
     612                            flush();
    575613                        }
    576614                    }
    577615                }
    578                 foreach ($paths as $path){
    579                     $imgs = oss_upload_readdir($path);
    580                     foreach ($imgs as $img) {
    581                         if(preg_match('/\-[0-9]+x[0-9]+\./', $img) && file_is_valid_image($img)){
    582                             if(@file_exists($img) && @unlink($img)){
    583                                 $out .= $index++.". {$img} deleted<br/>\n";
    584                             }
    585                         }
    586                     }
    587                 }
    588                 if($index == 1){
    589                     $out = __('No thumbnail found','oss-upload');
    590                 }else{
    591                     $out .= __('Clean thumbnails done','oss-upload');
    592                     $ok = true;
    593                 }
    594             }catch(Exception $ex){
    595                 $out = $ex->getMessage();
    596             }
    597         }else if($_GET['settings-updated'] == 'upload'){
    598             $upload = wp_get_upload_dir();
    599             $basedir = explode('/', substr($upload['basedir'].'/', 6), 2);
    600             try{
    601                 $out = __('Starting...', 'oss-upload')."<br/>\n";
    602                 $ossw = new OU_ALIOSS;
    603                 $out .= $ossw->create_mtu_object_by_dir($basedir[0], $upload['default']['basedir'], true);
    604                 $out .= __('Upload local storage to OSS done', 'oss-upload');
    605                 $ok = true;
    606             }catch(Exception $ex){
    607                 $out = $ex->getMessage();
    608             }
    609         }else if($_GET['settings-updated'] == 'sync'){
    610             $files = get_posts(array('post_type'=>'attachment', 'posts_per_page'=>-1));
    611             $upload = wp_get_upload_dir();
    612             $out = __('Starting...', 'oss-upload')."<br/>\n";
    613             foreach ($files as $file){
    614                 $oss = get_attached_file($file->ID);
    615                 $local = str_replace($upload['basedir'], $upload['default']['basedir'], $oss);
    616                 if(@file_exists($local) && !@file_exists($oss) && ($done = oss_upload_handler($local))){
    617                     $out .= $index++.". {$done} synced<br/>\n";
    618                 }
    619616            }
    620617            if($index == 1){
    621                 $out = __('No attachments need to be synced','oss-upload');
     618                echo __('No thumbnail found','oss-upload');
    622619            }else{
    623                 $out .= __('Sync missing attachments to OSS done','oss-upload');
    624                 $ok = true;
    625             }
    626         }else if($_GET['settings-updated'] == 'reset'){
    627             @ini_set('memory_limit','2048M');
    628             $files = get_posts(array('post_type'=>'attachment', 'posts_per_page'=>-1));
    629             $out = __('Starting...', 'oss-upload')."<br/>\n";
    630             foreach ($files as $file){
    631                 if(!wp_attachment_is_image($file->ID)) continue;
    632                 $img = get_attached_file($file->ID);
    633                 $metadata = wp_generate_attachment_metadata($file->ID, $img);
    634                 wp_update_attachment_metadata($file->ID, $metadata);
    635                 $out .= $index++.". {$file->ID} {$img} reset<br/>\n";
    636             }
    637             $out .= __('Reset attachments metadata done','oss-upload');
    638             $ok = true;
    639         }else if($_GET['settings-updated'] == 'test'){
    640             try{
    641                 $rnd = md5(time());
    642                 $file = ouops('oss_path').'/oss_upload_'.$rnd.'.txt';
    643                 $try = file_put_contents($file, $rnd);
    644                 if($try == strlen($rnd)){
    645                     $out = __('Write OK, ','oss-upload');
    646                     $try = file_get_contents($file);
    647                     if($try == $rnd){
    648                         $out .= __('Read OK, ', 'oss-upload');
    649                         $try = unlink($file);
    650                         if($try === true){
    651                             $out .= __('Delete OK', 'oss-upload');
    652                             $ok = true;
    653                         }else{
    654                             throw new RequestCore_Exception($out . __('Delete Error: ', 'oss-upload') . $try);
    655                         }
    656                     }else{
    657                         throw new RequestCore_Exception($out . __('Read Error: ', 'oss-upload') . $try);
    658                     }
    659                 }else{
    660                     throw new RequestCore_Exception($out . __('Write Error: ', 'oss-upload') . $try);
    661                 }
    662             }catch(Exception $ex){
    663                 $out = esc_html($ex->message);
    664             }
    665         }
    666         if(isset($out)) echo '<div class="'. ($ok ? 'updated fade' : 'error') . '"><p>'.$out.'</p></div>';
    667     }
    668     if(isset($_SESSION['oss_upload_error'])){
    669         echo '<div class="error"><p>'.$_SESSION['oss_upload_error'].'</p></div>';
    670     }
     620                echo '<br/><hr/>';
     621                echo __('Clean thumbnails done','oss-upload');
     622            }
     623        }catch(Exception $ex){
     624            echo $ex->getMessage();
     625        }
     626    }else if($action == 'upload'){
     627        $basedir = explode('/', substr($upload['basedir'].'/', 6), 2);
     628        try{
     629            $ossw = new OU_ALIOSS;
     630            $ossw->create_mtu_object_by_dir($basedir[0], $upload['default']['basedir'], true);
     631            echo '<br/><hr/>';
     632            echo __('Upload local storage to OSS done', 'oss-upload');
     633        }catch(Exception $ex){
     634            echo $ex->getMessage();
     635        }
     636    }else if($action == 'sync'){
     637        $files = get_posts(array('post_type'=>'attachment', 'posts_per_page'=>-1));
     638        $postfix = __('synced', 'oss-upload');
     639        foreach ($files as $file){
     640            $oss = get_attached_file($file->ID);
     641            $local = str_replace($upload['basedir'], $upload['default']['basedir'], $oss);
     642            if(@file_exists($local) && !@file_exists($oss) && ($done = oss_upload_handler($local))){
     643                echo $index++.". {$done} {$postfix}<br/>\n";
     644                flush();
     645            }
     646        }
     647        if($index == 1){
     648            echo __('No attachments need to be synced','oss-upload');
     649        }else{
     650            echo '<br/><hr/>';
     651            echo __('Sync missing attachments to OSS done','oss-upload');
     652        }
     653    }else if($action == 'reset'){
     654        @ini_set('memory_limit','2048M');
     655        $files = get_posts(array('post_type'=>'attachment', 'posts_per_page'=>-1));
     656        $postfix = __('reset', 'oss-upload');
     657        foreach ($files as $file){
     658            if(!wp_attachment_is_image($file->ID)) continue;
     659            $img = get_attached_file($file->ID);
     660            $metadata = wp_generate_attachment_metadata($file->ID, $img);
     661            wp_update_attachment_metadata($file->ID, $metadata);
     662            echo $index++.". {$file->ID} {$img} {$postfix}<br/>\n";
     663            flush();
     664            echo '<br/><hr/>';
     665        }
     666        echo __('Reset attachments metadata done','oss-upload');
     667    }
     668    flush();
     669    exit();
    671670}
    672671
     
    751750            <p><label><input name="ouop[oss_service]" type="radio" value="0" <?php checked(ouops('oss_service'),0);?> /> <?php _e('Use Image Service via Parameter, default and simple','oss-upload')?></label>
    752751            <?php echo oss_upload_link('//help.aliyun.com/document_detail/44688.html', '?', 'blank'); ?></p>
    753             <p <?php oss_upload_show_more('oss_upload_example'); ?>><small><code>photo.jpg?x-oss-process=image/quality,q_<?php echo ouops('oss_quality') ? intval(ouops('oss_quality')) : '50'; ?>/resize,m_fill,w_{width},h_{height}</code></small></p><br/>
     752            <p <?php oss_upload_show_more('oss_upload_example'); ?>><small><code>photo.jpg?x-oss-process=image%2Fquality,q_<?php echo ouops('oss_quality') ? intval(ouops('oss_quality')) : '50'; ?>%2Fresize,m_fill,w_{width},h_{height}</code></small></p><br/>
    754753            <p><label><input name="ouop[oss_service]" type="radio" value="1" <?php checked(ouops('oss_service'),1);?> /> <?php _e('Use Image Service via Style, powerful but require styles setting on OSS','oss-upload')?></label>
    755754            <?php echo oss_upload_link('//help.aliyun.com/document_detail/44687.html', '?', 'blank'); ?></p>
    756             <p <?php oss_upload_show_more('oss_upload_example'); ?>><small><code>photo.jpg<?php echo ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style/'; ?>{style}</code>:
     755            <p <?php oss_upload_show_more('oss_upload_example'); ?>><small><code>photo.jpg<?php echo ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style%2F'; ?>{style}</code>:
    757756            <?php foreach (get_intermediate_image_sizes() as $v){ echo '<code>'.$v.'</code> '; } ?>
    758757            </small></p><br/>
     
    763762            <p><?php
    764763                echo oss_upload_link('options-media.php', __('Media Sizes Options', 'oss-upload'), 'button');
    765                 echo oss_upload_link('?page=oss-upload&settings-updated=clean', __('Clean Thumbnails', 'oss-upload'), 'button');
    766                 if(!ouops('oss_service',2)) echo oss_upload_link('?page=oss-upload&settings-updated=reset', __('Regenerate Thumbnails', 'oss-upload'), 'button');
     764                echo oss_upload_link('?page=oss-upload&action=clean', __('Clean Thumbnails', 'oss-upload'), 'button,blank');
     765                if(!ouops('oss_service',2)) echo oss_upload_link('?page=oss-upload&action=reset', __('Regenerate Thumbnails', 'oss-upload'), 'button,blank');
    767766            ?></p>
    768767        </td></tr>
     
    786785        <td>
    787786            <p><label><input type="text" name="ouop[oss_style_separator]" size="60" value="<?php echo ouops('oss_style_separator')?>" /> <?php echo oss_upload_link('//help.aliyun.com/document_detail/48884.html', '?', 'blank'); ?></label></p>
    788             <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Custom style separator for OSS Image Service style','oss-upload')?>: <code>?x-oss-process=style/</code> <code>-</code> <code>_</code> <code>/</code> <code>!</code></small></p>
     787            <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Custom style separator for OSS Image Service style','oss-upload')?>: <code>?x-oss-process=style%2F</code> <code>-</code> <code>_</code> <code>!</code></small></p>
    789788        </td></tr>
    790789        <tr valign="top">
     
    793792            <p><label><input type="text" name="ouop[oss_fullsize_style]" size="60" value="<?php echo ouops('oss_fullsize_style')?>" />
    794793            <?php echo oss_upload_link('//help.aliyun.com/document_detail/44686.html', '?', 'blank'); ?></label></p>
    795             <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Default full size image style for OSS Image Service','oss-upload')?>: <code>{default}</code></small></p>
     794            <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Default full size image style for OSS Image Service','oss-upload')?>: <code>full</code></small></p>
    796795        </td></tr>
    797796        <tr valign="top">
     
    800799            <p><label><input name="ouop[oss_gif]" type="checkbox" value="1" <?php checked(ouops('oss_gif'),1);?> />
    801800            <?php _e('Using special OSS Image Service style for <code>GIF</code> format','oss-upload')?> <?php echo oss_upload_link('//help.aliyun.com/document_detail/44957.html', '?', 'blank'); ?></label></p>
    802             <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('If gif have no animation effect, check this and set extra style on OSS','oss-upload')?>: <code>{gif}</code>
    803                 <?php if(ouops('oss_fullsize_style')):?>
    804                     <code>{default_gif}</code>
    805                 <?php endif;?>
     801            <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Check this to skip style for GIF image if having no animation effect','oss-upload')?>
    806802            </small></p>
    807803        </td></tr>
     
    811807            <p><label><input name="ouop[oss_webp]" type="checkbox" value="1" <?php checked(ouops('oss_webp'),1);?> />
    812808            <?php _e('Compress as <code>WebP</code> format automatically if browser support','oss-upload')?> <?php echo oss_upload_link('//help.aliyun.com/document_detail/44703.html', '?', 'blank'); ?></label></p>
    813             <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Require extra style to be set on OSS when using styles for Image Service','oss-upload')?>: <code>{style}_webp</code></small></p>
     809            <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Choose webp format on OSS if using styles for Image Service','oss-upload')?></small></p>
    814810        </td></tr>
    815811        <tr valign="top">
     
    827823            <p <?php oss_upload_show_more('oss_upload_desc'); ?>><small><?php _e('Default image url for lazyload, could be with Image Service suffix, or base64 data, or normal url. <code>{IMG}</code> means original','oss-upload')?></small></p>
    828824            <div <?php oss_upload_show_more('oss_upload_example'); ?>>
    829             <p><small><code>{IMG}?x-oss-process=image/quality,q_10/resize,m_lfit,w_20</code></small></p>
    830             <p><small><code>{IMG}<?php echo ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style/'; ?>lazyload-style</code></small></p>
     825            <p><small><code>{IMG}?x-oss-process=image%2Fquality,q_10%2Fresize,m_lfit,w_20</code></small></p>
     826            <p><small><code>{IMG}<?php echo ouops('oss_style_separator') ? trim(ouops('oss_style_separator')) : '?x-oss-process=style%2F'; ?>lazyload-style</code></small></p>
    831827            <p><small><code>data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=</code></small></p>
    832828            <p><small><code>//img.domain.com/xxx/lazyload.png</code></small></p>
     
    876872            </code></small></label></p><br />
    877873            <?php
    878                 echo oss_upload_link('?page=oss-upload&settings-updated=sync', __('Upload Missing Attachment', 'oss-upload'), 'button');
    879                 echo oss_upload_link('?page=oss-upload&settings-updated=upload', __('Upload Whole Local Storage', 'oss-upload'), 'button');
     874                echo oss_upload_link('?page=oss-upload&action=sync', __('Upload Missing Attachment', 'oss-upload'), 'button,blank');
     875                echo oss_upload_link('?page=oss-upload&action=upload', __('Upload Whole Local Storage', 'oss-upload'), 'button,blank');
    880876            ?>
    881877        </td></tr>
     
    890886                if(jQuery(this).val().indexOf(jQuery(this).attr('placeholder').substr(0,4))!=0) jQuery(this).val('');
    891887            });
    892             jQuery('a[href*="settings-updated=clean"]').click(function(){
     888            jQuery('a[href*="action=clean"]').click(function(){
    893889                return confirm("<?php _e('This action would clean all thumbnails including local and OSS that filename like photo-800x600.png, cannot be undone, comfirm to process?','oss-upload');?>");
    894890            });
    895             jQuery('a[href*="settings-updated=upload"]').click(function(){
     891            jQuery('a[href*="action=upload"]').click(function(){
    896892                return confirm("<?php _e('This action would upload local storage directory to OSS, override if file exists, might take several minutes, comfirm to process?','oss-upload');?>");
    897893            });
    898             jQuery('a[href*="settings-updated=sync"]').click(function(){
     894            jQuery('a[href*="action=sync"]').click(function(){
    899895                return confirm("<?php _e('This action would upload attachment from local storage that missing in OSS, might take several minutes, comfirm to process?','oss-upload');?>");
    900896            });
    901             jQuery('a[href*="settings-updated=reset"]').click(function(){
     897            jQuery('a[href*="action=reset"]').click(function(){
    902898                return confirm("<?php _e('This action would regenerate metadata of all attachment in OSS, might take several minutes, comfirm to process?','oss-upload');?>");
    903899            });
  • oss-upload/trunk/readme.txt

    r2207984 r2219304  
    44Donate link: https://www.xiaomac.com/about
    55Tags: aliyun, oss, upload, media, files, storage, cloud, 阿里云, 媒体库, 图片, 上传, 云存储
    6 Tested up to: 5.3
    7 Stable tag: 4.8.4
     6Tested up to: 5.3.2
     7Stable tag: 4.8.5
    88
    99== Description ==
    1010
    1111使用阿里云 OSS 作为媒体库附件存储空间,支持原创增强的 OSS 协议包装和全原生图像编辑及衍生功能。
     12
     13todo: 批量上传慢的问题、还是有报样式重复的问题
     14
    1215
    1316### 功能 ###
     
    4346== Changelog ==
    4447
     48= 4.8.5 =
     49* 优化目录上传等功能支持重复执行
     50* 修复图片服务参数没编码引起的异常
     51* 修复物理缩略图模式只有大图的问题
     52
    4553= 4.8.4 =
    4654* 修复图格模式会双重样式的问题
Note: See TracChangeset for help on using the changeset viewer.