diff --git a/.gitignore b/.gitignore index cd0f9ed8..73f184b8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ .*.swo ._* .DS_Store -/Debug/ /ImgCache/ /Backup_rar/ /Debug/ diff --git a/admin/css/style.css b/admin/css/style.css index 7e84092d..15a27499 100644 --- a/admin/css/style.css +++ b/admin/css/style.css @@ -209,6 +209,11 @@ button { background-color: #c1605e; cursor: default; } +.btn-text { + background: transparent; } + .btn-text:hover, .btn-text:active, .btn-text.active { + background: #F3F3F0; } + /* 下拉菜单 */ .btn-drop { position: relative; } @@ -1022,6 +1027,8 @@ a.operate-reply { list-style: none; border: 1px solid #D9D9D6; padding: 6px 12px; + max-height: 240px; + overflow: auto; background-color: #FFF; border-radius: 2px; } @@ -1103,7 +1110,8 @@ a.operate-reply { #file-list { list-style: none; margin: 0 10px; - padding: 0; } + padding: 0; + word-break: break-all; } #file-list li { padding: 8px 0; border-top: 1px dashed #D9D9D6; } @@ -1118,6 +1126,9 @@ a.operate-reply { #file-list .info { text-transform: uppercase; } +#btn-fullscreen-upload { + visibility: hidden; } + /** * 附件管理 */ @@ -1148,24 +1159,25 @@ a.operate-reply { /** * icons */ -.icon-sprite-hack { - background: url('../img/icons-s2ebed63329.png'); } - -.i-edit, .i-delete, .i-exlink, .mime-office, .mime-text, .mime-image, .mime-html, .mime-archive, .mime-application, .mime-audio, .mime-script, .mime-video, .mime-unknow { +.i-edit, .i-delete, .i-upload, .i-exlink, .mime-office, .mime-text, .mime-image, .mime-html, .mime-archive, .mime-application, .mime-audio, .mime-script, .mime-video, .mime-unknow { width: 16px; height: 16px; display: inline-block; vertical-align: text-bottom; - background: url(../img/icons.png) no-repeat; } - .i-edit:hover, .i-delete:hover, .i-exlink:hover, .mime-office:hover, .mime-text:hover, .mime-image:hover, .mime-html:hover, .mime-archive:hover, .mime-application:hover, .mime-audio:hover, .mime-script:hover, .mime-video:hover, .mime-unknow:hover { + background: url('../img/icons-s93f9ba6074.png') no-repeat; + text-indent: -9999em; } + .i-edit:hover, .i-delete:hover, .i-upload:hover, .i-exlink:hover, .mime-office:hover, .mime-text:hover, .mime-image:hover, .mime-html:hover, .mime-archive:hover, .mime-application:hover, .mime-audio:hover, .mime-script:hover, .mime-video:hover, .mime-unknow:hover { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=75); opacity: 0.75; } .i-edit { - background-position: 0 -32px; } + background-position: 0 -48px; } .i-delete { - background-position: 0 -16px; } + background-position: 0 -32px; } + +.i-upload { + background-position: 0 0; } .i-caret-up, .i-caret-down, .i-caret-left, .i-caret-right { display: inline-block; @@ -1186,35 +1198,35 @@ a.operate-reply { border-width: 4px 3px 4px 5px; } .i-exlink { - background-position: 0 0; } + background-position: 0 -16px; } /* 文件类型图标 */ .mime-office { - background-position: 0 -80px; } + background-position: 0 -96px; } .mime-text { background-position: 0 -176px; } .mime-image { - background-position: 0 -48px; } + background-position: 0 -64px; } .mime-html { - background-position: 0 -96px; } + background-position: 0 -112px; } .mime-archive { background-position: 0 -192px; } .mime-application { - background-position: 0 -112px; } + background-position: 0 -128px; } .mime-audio { - background-position: 0 -224px; } + background-position: 0 -208px; } .mime-script { background-position: 0 -144px; } .mime-video { - background-position: 0 -64px; } + background-position: 0 -80px; } .mime-unknow { background-position: 0 -160px; } @@ -1350,7 +1362,7 @@ a.operate-reply { background: #F3F3F0; font-size: .92857em; } #wmd-preview code { - color: #B94A48; } + color: #C13; } #wmd-preview pre { padding: 1em; } #wmd-preview pre code { @@ -1417,18 +1429,24 @@ a.operate-reply { margin: 0; padding: 10px 20px; border-bottom: 1px solid #F3F3F0; } +.fullscreen #tab-files { + position: absolute; + top: 52px; + right: 20px; + width: 280px; + z-index: 1001; } .fullscreen .wmd-edittab, .fullscreen .typecho-post-option, .fullscreen .title, .fullscreen .url-slug, .fullscreen .typecho-page-title, .fullscreen .typecho-head-nav, -.fullscreen .message, -.fullscreen #upload-panel { +.fullscreen .message { display: none; } .fullscreen .wmd-hidetab { display: block; } -.fullscreen .wmd-visualhide { +.fullscreen .wmd-visualhide, +.fullscreen #btn-fullscreen-upload { visibility: visible; } /** diff --git a/admin/img/icons-2x/icon-arrow-down-2x.png b/admin/img/icons-2x/icon-arrow-down-2x.png deleted file mode 100644 index 1fefa5a0..00000000 Binary files a/admin/img/icons-2x/icon-arrow-down-2x.png and /dev/null differ diff --git a/admin/img/icons-2x/icon-arrow-up-2x.png b/admin/img/icons-2x/icon-arrow-up-2x.png deleted file mode 100644 index b7a7e475..00000000 Binary files a/admin/img/icons-2x/icon-arrow-up-2x.png and /dev/null differ diff --git a/admin/img/icons-2x/icon-upload-2x.png b/admin/img/icons-2x/icon-upload-2x.png new file mode 100644 index 00000000..fe50c19a Binary files /dev/null and b/admin/img/icons-2x/icon-upload-2x.png differ diff --git a/admin/img/icons-s2ebed63329.png b/admin/img/icons-s2ebed63329.png deleted file mode 100644 index 1a21b00d..00000000 Binary files a/admin/img/icons-s2ebed63329.png and /dev/null differ diff --git a/admin/img/icons-s93f9ba6074.png b/admin/img/icons-s93f9ba6074.png new file mode 100644 index 00000000..91cae2f0 Binary files /dev/null and b/admin/img/icons-s93f9ba6074.png differ diff --git a/admin/img/icons/icon-caret-down.png b/admin/img/icons/icon-caret-down.png deleted file mode 100644 index 01459bb8..00000000 Binary files a/admin/img/icons/icon-caret-down.png and /dev/null differ diff --git a/admin/img/icons/icon-caret-up.png b/admin/img/icons/icon-caret-up.png deleted file mode 100644 index 69d8bb87..00000000 Binary files a/admin/img/icons/icon-caret-up.png and /dev/null differ diff --git a/admin/img/icons/icon-upload.png b/admin/img/icons/icon-upload.png new file mode 100644 index 00000000..d39fc572 Binary files /dev/null and b/admin/img/icons/icon-upload.png differ diff --git a/admin/scss/_buttons.scss b/admin/scss/_buttons.scss index 64dd2eb8..b547754b 100644 --- a/admin/scss/_buttons.scss +++ b/admin/scss/_buttons.scss @@ -65,6 +65,13 @@ button { color: #FFF; } +.btn-text { + background: transparent; + &:hover, &:active, &.active { + background: #F3F3F0; + } +} + /* 下拉菜单 */ .btn-drop { position: relative; diff --git a/admin/scss/_icons.scss b/admin/scss/_icons.scss index 1d146fe5..a04557ca 100644 --- a/admin/scss/_icons.scss +++ b/admin/scss/_icons.scss @@ -5,19 +5,13 @@ $icons: sprite-map("icons/*.png"); $icons-2x: sprite-map("icons-2x/*.png"); -.icon-sprite-hack { - background: $icons; -} -// .icon-2x-sprite-hack { -// background: $icons-2x; -// } - %i-16 { width: 16px; height: 16px; display: inline-block; vertical-align: text-bottom; - background: url(../img/icons.png) no-repeat; + background: $icons no-repeat; + text-indent: -9999em; &:hover { @include opacity(0.75); } @@ -31,6 +25,10 @@ $icons-2x: sprite-map("icons-2x/*.png"); @extend %i-16; background-position: sprite-position($icons, icon-delete); } +.i-upload { + @extend %i-16; + background-position: sprite-position($icons, icon-upload); +} // 小箭头 .i-caret-up, .i-caret-down, .i-caret-left, .i-caret-right { diff --git a/admin/scss/_mixin.scss b/admin/scss/_mixin.scss deleted file mode 100644 index 52924c9a..00000000 --- a/admin/scss/_mixin.scss +++ /dev/null @@ -1,5 +0,0 @@ -@mixin calc($property, $expression) { - #{$property}: -moz-calc(#{$expression}); - #{$property}: -webkit-calc(#{$expression}); - #{$property}: calc(#{$expression}); -} \ No newline at end of file diff --git a/admin/scss/components/_editor.scss b/admin/scss/components/_editor.scss index d3947337..01f775b4 100644 --- a/admin/scss/components/_editor.scss +++ b/admin/scss/components/_editor.scss @@ -108,7 +108,7 @@ background: #F3F3F0; font-size: .92857em; } - code { color: #B94A48; } + code { color: #C13; } pre { padding: 1em; code { @@ -183,16 +183,26 @@ padding: 10px 20px; border-bottom: 1px solid #F3F3F0; } + + // 全屏附件上传 + #tab-files { + position: absolute; + top: 52px; + right: 20px; + width: 280px; + z-index: 1001; + } + .wmd-edittab, .typecho-post-option, .title, .url-slug, .typecho-page-title, .typecho-head-nav, - .message, - #upload-panel { display: none; } + .message { display: none; } .wmd-hidetab { display: block; } - .wmd-visualhide { + .wmd-visualhide, + #btn-fullscreen-upload { visibility: visible; } } \ No newline at end of file diff --git a/admin/scss/style.scss b/admin/scss/style.scss index a843cca2..71b6d44f 100644 --- a/admin/scss/style.scss +++ b/admin/scss/style.scss @@ -10,7 +10,6 @@ */ @import "compass"; -@import "mixin"; /** * Typecho 全局样式 @@ -794,6 +793,8 @@ background: #FFF1A8; list-style: none; border: 1px solid #D9D9D6; padding: 6px 12px; + max-height: 240px; + overflow: auto; background-color: #FFF; border-radius: 2px; } @@ -878,6 +879,7 @@ background: #FFF1A8; list-style: none; margin: 0 10px; padding: 0; + word-break: break-all; li { padding: 8px 0; border-top: 1px dashed #D9D9D6; @@ -897,6 +899,10 @@ background: #FFF1A8; } } +#btn-fullscreen-upload { + visibility: hidden; +} + /** * 附件管理 diff --git a/admin/write-js.php b/admin/write-js.php index f7586856..5c5c6246 100644 --- a/admin/write-js.php +++ b/admin/write-js.php @@ -256,6 +256,13 @@ $(document).ready(function() { return false; }); + + // 全屏上传按钮控制 + // $('#btn-fullscreen-upload').click(function() { + // $(this).toggleClass('active'); + // $('#tab-files').toggle(); + // return false; + // }); }); diff --git a/admin/write-post.php b/admin/write-post.php index 50e2b4a6..700524aa 100644 --- a/admin/write-post.php +++ b/admin/write-post.php @@ -46,6 +46,7 @@ Typecho_Widget::widget('Widget_Contents_Post_Edit')->to($post);

+ diff --git a/usr/themes/default/grid.css b/usr/themes/default/grid.css new file mode 100644 index 00000000..c7a31053 --- /dev/null +++ b/usr/themes/default/grid.css @@ -0,0 +1,563 @@ +/* + * Bento Grid System + * Source: https://github.com/fenbox/bento + * Version: 1.2.7 + * Update: 2013.11.15 + */ +.colgroup [class*="col-"] { + float: left; + min-height: 1px; + padding-right: 10px; + padding-left: 10px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +.colgroup [class*="push-"], +.colgroup [class*="pull-"] { + position: relative; } + +/* + * Mobile and up + */ +.col-mb-1 { + width: 8.33333%; } + +.col-mb-2 { + width: 16.66667%; } + +.col-mb-3 { + width: 25%; } + +.col-mb-4 { + width: 33.33333%; } + +.col-mb-5 { + width: 41.66667%; } + +.col-mb-6 { + width: 50%; } + +.col-mb-7 { + width: 58.33333%; } + +.col-mb-8 { + width: 66.66667%; } + +.col-mb-9 { + width: 75%; } + +.col-mb-10 { + width: 83.33333%; } + +.col-mb-11 { + width: 91.66667%; } + +.col-mb-12 { + width: 100%; } + +/* + * Tablet and up + */ +@media (min-width: 768px) { + .container { + margin-left: auto; + margin-right: auto; + max-width: 728px; } + + .col-tb-1 { + width: 8.33333%; } + + .col-tb-2 { + width: 16.66667%; } + + .col-tb-3 { + width: 25%; } + + .col-tb-4 { + width: 33.33333%; } + + .col-tb-5 { + width: 41.66667%; } + + .col-tb-6 { + width: 50%; } + + .col-tb-7 { + width: 58.33333%; } + + .col-tb-8 { + width: 66.66667%; } + + .col-tb-9 { + width: 75%; } + + .col-tb-10 { + width: 83.33333%; } + + .col-tb-11 { + width: 91.66667%; } + + .col-tb-12 { + width: 100%; } + + .col-tb-offset-0 { + margin-left: 0%; } + + .col-tb-offset-1 { + margin-left: 8.33333%; } + + .col-tb-offset-2 { + margin-left: 16.66667%; } + + .col-tb-offset-3 { + margin-left: 25%; } + + .col-tb-offset-4 { + margin-left: 33.33333%; } + + .col-tb-offset-5 { + margin-left: 41.66667%; } + + .col-tb-offset-6 { + margin-left: 50%; } + + .col-tb-offset-7 { + margin-left: 58.33333%; } + + .col-tb-offset-8 { + margin-left: 66.66667%; } + + .col-tb-offset-9 { + margin-left: 75%; } + + .col-tb-offset-10 { + margin-left: 83.33333%; } + + .col-tb-offset-11 { + margin-left: 91.66667%; } + + .col-tb-offset-12 { + margin-left: 100%; } + + .col-tb-pull-0 { + right: 0%; } + + .col-tb-pull-1 { + right: 8.33333%; } + + .col-tb-pull-2 { + right: 16.66667%; } + + .col-tb-pull-3 { + right: 25%; } + + .col-tb-pull-4 { + right: 33.33333%; } + + .col-tb-pull-5 { + right: 41.66667%; } + + .col-tb-pull-6 { + right: 50%; } + + .col-tb-pull-7 { + right: 58.33333%; } + + .col-tb-pull-8 { + right: 66.66667%; } + + .col-tb-pull-9 { + right: 75%; } + + .col-tb-pull-10 { + right: 83.33333%; } + + .col-tb-pull-11 { + right: 91.66667%; } + + .col-tb-pull-12 { + right: 100%; } + + .col-tb-push-0 { + left: 0%; } + + .col-tb-push-1 { + left: 8.33333%; } + + .col-tb-push-2 { + left: 16.66667%; } + + .col-tb-push-3 { + left: 25%; } + + .col-tb-push-4 { + left: 33.33333%; } + + .col-tb-push-5 { + left: 41.66667%; } + + .col-tb-push-6 { + left: 50%; } + + .col-tb-push-7 { + left: 58.33333%; } + + .col-tb-push-8 { + left: 66.66667%; } + + .col-tb-push-9 { + left: 75%; } + + .col-tb-push-10 { + left: 83.33333%; } + + .col-tb-push-11 { + left: 91.66667%; } + + .col-tb-push-12 { + left: 100%; } + + .colgroup { + margin-right: -10px; + margin-left: -10px; } } +/* + * Desktop and up + */ +@media (min-width: 992px) { + .container { + max-width: 952px; } + + .col-1 { + width: 8.33333%; } + + .col-2 { + width: 16.66667%; } + + .col-3 { + width: 25%; } + + .col-4 { + width: 33.33333%; } + + .col-5 { + width: 41.66667%; } + + .col-6 { + width: 50%; } + + .col-7 { + width: 58.33333%; } + + .col-8 { + width: 66.66667%; } + + .col-9 { + width: 75%; } + + .col-10 { + width: 83.33333%; } + + .col-11 { + width: 91.66667%; } + + .col-12 { + width: 100%; } + + .col-offset-0 { + margin-left: 0%; } + + .col-offset-1 { + margin-left: 8.33333%; } + + .col-offset-2 { + margin-left: 16.66667%; } + + .col-offset-3 { + margin-left: 25%; } + + .col-offset-4 { + margin-left: 33.33333%; } + + .col-offset-5 { + margin-left: 41.66667%; } + + .col-offset-6 { + margin-left: 50%; } + + .col-offset-7 { + margin-left: 58.33333%; } + + .col-offset-8 { + margin-left: 66.66667%; } + + .col-offset-9 { + margin-left: 75%; } + + .col-offset-10 { + margin-left: 83.33333%; } + + .col-offset-11 { + margin-left: 91.66667%; } + + .col-offset-12 { + margin-left: 100%; } + + .col-pull-0 { + right: 0%; } + + .col-pull-1 { + right: 8.33333%; } + + .col-pull-2 { + right: 16.66667%; } + + .col-pull-3 { + right: 25%; } + + .col-pull-4 { + right: 33.33333%; } + + .col-pull-5 { + right: 41.66667%; } + + .col-pull-6 { + right: 50%; } + + .col-pull-7 { + right: 58.33333%; } + + .col-pull-8 { + right: 66.66667%; } + + .col-pull-9 { + right: 75%; } + + .col-pull-10 { + right: 83.33333%; } + + .col-pull-11 { + right: 91.66667%; } + + .col-pull-12 { + right: 100%; } + + .col-push-0 { + left: 0%; } + + .col-push-1 { + left: 8.33333%; } + + .col-push-2 { + left: 16.66667%; } + + .col-push-3 { + left: 25%; } + + .col-push-4 { + left: 33.33333%; } + + .col-push-5 { + left: 41.66667%; } + + .col-push-6 { + left: 50%; } + + .col-push-7 { + left: 58.33333%; } + + .col-push-8 { + left: 66.66667%; } + + .col-push-9 { + left: 75%; } + + .col-push-10 { + left: 83.33333%; } + + .col-push-11 { + left: 91.66667%; } + + .col-push-12 { + left: 100%; } } +/* + * Widescreen and up + */ +@media (min-width: 1200px) { + .container { + max-width: 1160px; } + + .col-wd-1 { + width: 8.33333%; } + + .col-wd-2 { + width: 16.66667%; } + + .col-wd-3 { + width: 25%; } + + .col-wd-4 { + width: 33.33333%; } + + .col-wd-5 { + width: 41.66667%; } + + .col-wd-6 { + width: 50%; } + + .col-wd-7 { + width: 58.33333%; } + + .col-wd-8 { + width: 66.66667%; } + + .col-wd-9 { + width: 75%; } + + .col-wd-10 { + width: 83.33333%; } + + .col-wd-11 { + width: 91.66667%; } + + .col-wd-12 { + width: 100%; } + + .col-wd-offset-0 { + margin-left: 0%; } + + .col-wd-offset-1 { + margin-left: 8.33333%; } + + .col-wd-offset-2 { + margin-left: 16.66667%; } + + .col-wd-offset-3 { + margin-left: 25%; } + + .col-wd-offset-4 { + margin-left: 33.33333%; } + + .col-wd-offset-5 { + margin-left: 41.66667%; } + + .col-wd-offset-6 { + margin-left: 50%; } + + .col-wd-offset-7 { + margin-left: 58.33333%; } + + .col-wd-offset-8 { + margin-left: 66.66667%; } + + .col-wd-offset-9 { + margin-left: 75%; } + + .col-wd-offset-10 { + margin-left: 83.33333%; } + + .col-wd-offset-11 { + margin-left: 91.66667%; } + + .col-wd-offset-12 { + margin-left: 100%; } + + .col-wd-pull-0 { + right: 0%; } + + .col-wd-pull-1 { + right: 8.33333%; } + + .col-wd-pull-2 { + right: 16.66667%; } + + .col-wd-pull-3 { + right: 25%; } + + .col-wd-pull-4 { + right: 33.33333%; } + + .col-wd-pull-5 { + right: 41.66667%; } + + .col-wd-pull-6 { + right: 50%; } + + .col-wd-pull-7 { + right: 58.33333%; } + + .col-wd-pull-8 { + right: 66.66667%; } + + .col-wd-pull-9 { + right: 75%; } + + .col-wd-pull-10 { + right: 83.33333%; } + + .col-wd-pull-11 { + right: 91.66667%; } + + .col-wd-pull-12 { + right: 100%; } + + .col-wd-push-0 { + left: 0%; } + + .col-wd-push-1 { + left: 8.33333%; } + + .col-wd-push-2 { + left: 16.66667%; } + + .col-wd-push-3 { + left: 25%; } + + .col-wd-push-4 { + left: 33.33333%; } + + .col-wd-push-5 { + left: 41.66667%; } + + .col-wd-push-6 { + left: 50%; } + + .col-wd-push-7 { + left: 58.33333%; } + + .col-wd-push-8 { + left: 66.66667%; } + + .col-wd-push-9 { + left: 75%; } + + .col-wd-push-10 { + left: 83.33333%; } + + .col-wd-push-11 { + left: 91.66667%; } + + .col-wd-push-12 { + left: 100%; } } +/* + * Responsive kit + */ +@media (max-width: 767px) { + .kit-hidden-mb { + display: none; } } +@media (max-width: 991px) { + .kit-hidden-tb { + display: none; } } +@media (max-width: 1199px) { + .kit-hidden { + display: none; } } +/* + * Clearfix + */ +.clearfix, .colgroup { + zoom: 1; } + .clearfix:before, .colgroup:before, .clearfix:after, .colgroup:after { + content: " "; + display: table; } + .clearfix:after, .colgroup:after { + clear: both; } diff --git a/usr/themes/default/header.php b/usr/themes/default/header.php index eef16326..a0c67cf7 100644 --- a/usr/themes/default/header.php +++ b/usr/themes/default/header.php @@ -13,13 +13,13 @@ ), '', ' - '); ?>options->title(); ?> - - + + diff --git a/var/Typecho/I18n.php b/var/Typecho/I18n.php index dbbdd11a..e50e7b92 100644 --- a/var/Typecho/I18n.php +++ b/var/Typecho/I18n.php @@ -153,7 +153,7 @@ class Typecho_I18n /** 如果是一个星期 */ if ($between > 0 && $between < 604800) { $day = floor($between / 86400); - return str_replace('%d', $day, _n('一天前', '%天前', $day)); + return str_replace('%d', $day, _n('一天前', '%d天前', $day)); } /** 如果是 */ diff --git a/var/Typecho/Validate.php b/var/Typecho/Validate.php index f186c0d9..f5e8fab0 100644 --- a/var/Typecho/Validate.php +++ b/var/Typecho/Validate.php @@ -110,7 +110,8 @@ class Typecho_Validate // Cycle through the rules and test for errors foreach ($rules as $key => $rules) { $this->_key = $key; - $data[$key] = (0 == strlen($data[$key])) ? NULL : $data[$key]; + $data[$key] = (is_array($data[$key]) ? 0 == count($data[$key]) + : 0 == strlen($data[$key])) ? NULL : $data[$key]; foreach ($rules as $params) { $method = $params[0]; diff --git a/var/Widget/Options.php b/var/Widget/Options.php index 9d6e258a..3264840b 100644 --- a/var/Widget/Options.php +++ b/var/Widget/Options.php @@ -319,7 +319,7 @@ class Widget_Options extends Typecho_Widget if (NULL != $this->attachmentTypes) { $attachmentTypes = str_replace( array('@image@', '@media@', '@doc@'), - array('gif,jpg,png,tiff,bmp', 'mp3,wmv,wma,rmvb,rm,avi,flv', + array('gif,jpg,jpeg,png,tiff,bmp', 'mp3,wmv,wma,rmvb,rm,avi,flv', 'txt,doc,docx,xls,xlsx,ppt,pptx,zip,rar,pdf'), $this->attachmentTypes); $attachmentTypesResult = array_unique(array_map('trim', explode(',', $attachmentTypes))); diff --git a/var/Widget/Options/General.php b/var/Widget/Options/General.php index 66c69705..13ebef36 100644 --- a/var/Widget/Options/General.php +++ b/var/Widget/Options/General.php @@ -116,7 +116,7 @@ class Widget_Options_General extends Widget_Abstract_Options implements Widget_I } $attachmentTypesOptions = array( - '@image@' => _t('图片文件') . ' (gif jpg png tiff bmp)', + '@image@' => _t('图片文件') . ' (gif jpg jpeg png tiff bmp)', '@media@' => _t('多媒体文件') . ' (mp3 wmv wma rmvb rm avi flv)', '@doc@' => _t('常用档案文件') . ' (txt doc docx xls xlsx ppt pptx zip rar pdf)', '@other@' => _t('其他格式 %s', ' '), @@ -148,7 +148,7 @@ class Widget_Options_General extends Widget_Abstract_Options implements Widget_I } $settings = $this->request->from('title', 'siteUrl', 'description', 'keywords', 'allowRegister', 'timezone', 'attachmentTypes'); - $settings['siteUrl'] = rtrim('/', $settings['siteUrl']); + $settings['siteUrl'] = rtrim($settings['siteUrl'], '/'); $attachmentTypes = array(); if ($this->isEnableByCheckbox($settings['attachmentTypes'], '@image@')) { diff --git a/var/Widget/Upload.php b/var/Widget/Upload.php index 629dfa8a..fbc06058 100644 --- a/var/Widget/Upload.php +++ b/var/Widget/Upload.php @@ -19,7 +19,7 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface_Do { //上传文件目录 - const UPLOAD_PATH = '/usr/uploads'; + const UPLOAD_DIR = '/usr/uploads'; /** * 创建上传路径 @@ -75,8 +75,8 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface $options = Typecho_Widget::widget('Widget_Options'); $date = new Typecho_Date($options->gmtTime); - $path = Typecho_Common::url(self::UPLOAD_PATH, __TYPECHO_ROOT_DIR__) - . '/' . $date->year . '/' . $date->month; + $path = Typecho_Common::url(defined('__TYPECHO_UPLOAD_DIR__') ? __TYPECHO_UPLOAD_DIR__ : self::UPLOAD_DIR, + __TYPECHO_ROOT_DIR__) . '/' . $date->year . '/' . $date->month; //创建上传目录 if (!is_dir($path)) { @@ -112,7 +112,8 @@ class Widget_Upload extends Widget_Abstract_Contents implements Widget_Interface //返回相对存储路径 return array( 'name' => $file['name'], - 'path' => self::UPLOAD_PATH . '/' . $date->year . '/' . $date->month . '/' . $fileName, + 'path' => (defined('__TYPECHO_UPLOAD_DIR__') ? __TYPECHO_UPLOAD_DIR__ : self::UPLOAD_DIR) + . '/' . $date->year . '/' . $date->month . '/' . $fileName, 'size' => $file['size'], 'type' => $ext, 'mime' => Typecho_Common::mimeContentType($path)