Adds some plugins
No files matched your search
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* jQuery UI Progressbar 1.7.2
|
||||
*
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
* http://docs.jquery.com/UI/Progressbar
|
||||
*
|
||||
* Depends:
|
||||
* ui.core.js
|
||||
*/
|
||||
(function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){if(b===undefined){return this._value()}this._setData("value",b);return this},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(b<this._valueMin()){b=this._valueMin()}if(b>this._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(jQuery);;
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* jQuery UI Progressbar 1.8.6
|
||||
*
|
||||
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Progressbar
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
*/
|
||||
(function(b,c){b.widget("ui.progressbar",{options:{value:0},min:0,max:100,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
|
||||
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===c)return this._value();this._setOption("value",a);return this},_setOption:function(a,d){if(a==="value"){this.options.value=d;this._refreshValue();this._trigger("change");this._value()===this.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.max,Math.max(this.min,a))},_refreshValue:function(){var a=
|
||||
this.value();this.valueDiv.toggleClass("ui-corner-right",a===this.max).width(a+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.6"})})(jQuery);
|
||||
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 213 B |
|
After Width: | Height: | Size: 124 B |
|
After Width: | Height: | Size: 123 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 112 B |
@@ -0,0 +1,406 @@
|
||||
/*
|
||||
* jQuery UI CSS Framework
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
||||
*/
|
||||
|
||||
/* Layout helpers
|
||||
----------------------------------*/
|
||||
.ui-helper-hidden { display: none; }
|
||||
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
|
||||
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
||||
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||
.ui-helper-clearfix { display: inline-block; }
|
||||
/* required comment for clearfix to work in Opera \*/
|
||||
* html .ui-helper-clearfix { height:1%; }
|
||||
.ui-helper-clearfix { display:block; }
|
||||
/* end clearfix */
|
||||
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
||||
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-disabled { cursor: default !important; }
|
||||
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* jQuery UI CSS Framework
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
||||
*/
|
||||
|
||||
|
||||
/* Component containers
|
||||
----------------------------------*/
|
||||
.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
|
||||
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
|
||||
.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
|
||||
.ui-widget-content a { color: #222222; }
|
||||
.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
|
||||
.ui-widget-header a { color: #ffffff; }
|
||||
|
||||
/* Interaction states
|
||||
----------------------------------*/
|
||||
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; outline: none; }
|
||||
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; outline: none; }
|
||||
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; outline: none; }
|
||||
.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; outline: none; }
|
||||
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; outline: none; }
|
||||
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; outline: none; text-decoration: none; }
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
|
||||
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
|
||||
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
||||
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; }
|
||||
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; }
|
||||
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
||||
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
|
||||
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
|
||||
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
|
||||
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
|
||||
.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
|
||||
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
|
||||
.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
|
||||
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
|
||||
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
|
||||
|
||||
/* positioning */
|
||||
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
||||
.ui-icon-carat-1-e { background-position: -32px 0; }
|
||||
.ui-icon-carat-1-se { background-position: -48px 0; }
|
||||
.ui-icon-carat-1-s { background-position: -64px 0; }
|
||||
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
||||
.ui-icon-carat-1-w { background-position: -96px 0; }
|
||||
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
||||
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
||||
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
||||
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
||||
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
||||
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
||||
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
||||
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
||||
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
||||
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
||||
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
||||
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
||||
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
||||
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
||||
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
||||
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
||||
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
||||
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
||||
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
||||
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
||||
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
||||
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
||||
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
||||
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
||||
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
||||
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
||||
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
||||
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
||||
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
||||
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
||||
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
||||
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
||||
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
||||
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
||||
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
||||
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
||||
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
||||
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
||||
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
||||
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
||||
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
||||
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
||||
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
||||
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
||||
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
||||
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
||||
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
||||
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
||||
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
||||
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
||||
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
||||
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
||||
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
||||
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
||||
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
||||
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
||||
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
||||
.ui-icon-extlink { background-position: -32px -80px; }
|
||||
.ui-icon-newwin { background-position: -48px -80px; }
|
||||
.ui-icon-refresh { background-position: -64px -80px; }
|
||||
.ui-icon-shuffle { background-position: -80px -80px; }
|
||||
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
||||
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
||||
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
||||
.ui-icon-folder-open { background-position: -16px -96px; }
|
||||
.ui-icon-document { background-position: -32px -96px; }
|
||||
.ui-icon-document-b { background-position: -48px -96px; }
|
||||
.ui-icon-note { background-position: -64px -96px; }
|
||||
.ui-icon-mail-closed { background-position: -80px -96px; }
|
||||
.ui-icon-mail-open { background-position: -96px -96px; }
|
||||
.ui-icon-suitcase { background-position: -112px -96px; }
|
||||
.ui-icon-comment { background-position: -128px -96px; }
|
||||
.ui-icon-person { background-position: -144px -96px; }
|
||||
.ui-icon-print { background-position: -160px -96px; }
|
||||
.ui-icon-trash { background-position: -176px -96px; }
|
||||
.ui-icon-locked { background-position: -192px -96px; }
|
||||
.ui-icon-unlocked { background-position: -208px -96px; }
|
||||
.ui-icon-bookmark { background-position: -224px -96px; }
|
||||
.ui-icon-tag { background-position: -240px -96px; }
|
||||
.ui-icon-home { background-position: 0 -112px; }
|
||||
.ui-icon-flag { background-position: -16px -112px; }
|
||||
.ui-icon-calendar { background-position: -32px -112px; }
|
||||
.ui-icon-cart { background-position: -48px -112px; }
|
||||
.ui-icon-pencil { background-position: -64px -112px; }
|
||||
.ui-icon-clock { background-position: -80px -112px; }
|
||||
.ui-icon-disk { background-position: -96px -112px; }
|
||||
.ui-icon-calculator { background-position: -112px -112px; }
|
||||
.ui-icon-zoomin { background-position: -128px -112px; }
|
||||
.ui-icon-zoomout { background-position: -144px -112px; }
|
||||
.ui-icon-search { background-position: -160px -112px; }
|
||||
.ui-icon-wrench { background-position: -176px -112px; }
|
||||
.ui-icon-gear { background-position: -192px -112px; }
|
||||
.ui-icon-heart { background-position: -208px -112px; }
|
||||
.ui-icon-star { background-position: -224px -112px; }
|
||||
.ui-icon-link { background-position: -240px -112px; }
|
||||
.ui-icon-cancel { background-position: 0 -128px; }
|
||||
.ui-icon-plus { background-position: -16px -128px; }
|
||||
.ui-icon-plusthick { background-position: -32px -128px; }
|
||||
.ui-icon-minus { background-position: -48px -128px; }
|
||||
.ui-icon-minusthick { background-position: -64px -128px; }
|
||||
.ui-icon-close { background-position: -80px -128px; }
|
||||
.ui-icon-closethick { background-position: -96px -128px; }
|
||||
.ui-icon-key { background-position: -112px -128px; }
|
||||
.ui-icon-lightbulb { background-position: -128px -128px; }
|
||||
.ui-icon-scissors { background-position: -144px -128px; }
|
||||
.ui-icon-clipboard { background-position: -160px -128px; }
|
||||
.ui-icon-copy { background-position: -176px -128px; }
|
||||
.ui-icon-contact { background-position: -192px -128px; }
|
||||
.ui-icon-image { background-position: -208px -128px; }
|
||||
.ui-icon-video { background-position: -224px -128px; }
|
||||
.ui-icon-script { background-position: -240px -128px; }
|
||||
.ui-icon-alert { background-position: 0 -144px; }
|
||||
.ui-icon-info { background-position: -16px -144px; }
|
||||
.ui-icon-notice { background-position: -32px -144px; }
|
||||
.ui-icon-help { background-position: -48px -144px; }
|
||||
.ui-icon-check { background-position: -64px -144px; }
|
||||
.ui-icon-bullet { background-position: -80px -144px; }
|
||||
.ui-icon-radio-off { background-position: -96px -144px; }
|
||||
.ui-icon-radio-on { background-position: -112px -144px; }
|
||||
.ui-icon-pin-w { background-position: -128px -144px; }
|
||||
.ui-icon-pin-s { background-position: -144px -144px; }
|
||||
.ui-icon-play { background-position: 0 -160px; }
|
||||
.ui-icon-pause { background-position: -16px -160px; }
|
||||
.ui-icon-seek-next { background-position: -32px -160px; }
|
||||
.ui-icon-seek-prev { background-position: -48px -160px; }
|
||||
.ui-icon-seek-end { background-position: -64px -160px; }
|
||||
.ui-icon-seek-first { background-position: -80px -160px; }
|
||||
.ui-icon-stop { background-position: -96px -160px; }
|
||||
.ui-icon-eject { background-position: -112px -160px; }
|
||||
.ui-icon-volume-off { background-position: -128px -160px; }
|
||||
.ui-icon-volume-on { background-position: -144px -160px; }
|
||||
.ui-icon-power { background-position: 0 -176px; }
|
||||
.ui-icon-signal-diag { background-position: -16px -176px; }
|
||||
.ui-icon-signal { background-position: -32px -176px; }
|
||||
.ui-icon-battery-0 { background-position: -48px -176px; }
|
||||
.ui-icon-battery-1 { background-position: -64px -176px; }
|
||||
.ui-icon-battery-2 { background-position: -80px -176px; }
|
||||
.ui-icon-battery-3 { background-position: -96px -176px; }
|
||||
.ui-icon-circle-plus { background-position: 0 -192px; }
|
||||
.ui-icon-circle-minus { background-position: -16px -192px; }
|
||||
.ui-icon-circle-close { background-position: -32px -192px; }
|
||||
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
||||
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
||||
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
||||
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
||||
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
||||
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
||||
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
||||
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
||||
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
||||
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
||||
.ui-icon-circle-check { background-position: -208px -192px; }
|
||||
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
||||
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
||||
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
||||
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
||||
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
||||
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
||||
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
||||
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
||||
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
||||
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
||||
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
||||
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Corner radius */
|
||||
.ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; }
|
||||
.ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; }
|
||||
.ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; }
|
||||
.ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; }
|
||||
.ui-corner-top { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; }
|
||||
.ui-corner-bottom { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; }
|
||||
.ui-corner-right { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; }
|
||||
.ui-corner-left { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; }
|
||||
.ui-corner-all { -moz-border-radius: 5px; -webkit-border-radius: 5px; }
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
||||
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Accordion
|
||||
----------------------------------*/
|
||||
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
|
||||
.ui-accordion .ui-accordion-li-fix { display: inline; }
|
||||
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
|
||||
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
|
||||
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
||||
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
|
||||
.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
|
||||
----------------------------------*/
|
||||
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
|
||||
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
||||
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
||||
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
||||
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
||||
.ui-datepicker .ui-datepicker-next { right:2px; }
|
||||
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
||||
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
||||
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
||||
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
||||
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
|
||||
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
||||
.ui-datepicker select.ui-datepicker-month,
|
||||
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
||||
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
|
||||
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
||||
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
||||
.ui-datepicker td { border: 0; padding: 1px; }
|
||||
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
||||
|
||||
/* with multiple calendars */
|
||||
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
||||
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
||||
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
||||
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
||||
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
||||
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
||||
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
||||
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
||||
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
||||
.ui-datepicker-row-break { clear:both; width:100%; }
|
||||
|
||||
/* RTL support */
|
||||
.ui-datepicker-rtl { direction: rtl; }
|
||||
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
||||
|
||||
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
||||
.ui-datepicker-cover {
|
||||
display: none; /*sorry for IE5*/
|
||||
display/**/: block; /*sorry for IE5*/
|
||||
position: absolute; /*must have*/
|
||||
z-index: -1; /*must have*/
|
||||
filter: mask(); /*must have*/
|
||||
top: -4px; /*must have*/
|
||||
left: -4px; /*must have*/
|
||||
width: 200px; /*must have*/
|
||||
height: 200px; /*must have*/
|
||||
}/* Dialog
|
||||
----------------------------------*/
|
||||
.ui-dialog { position: relative; padding: .2em; width: 300px; }
|
||||
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
|
||||
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
|
||||
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
||||
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
||||
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
||||
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
||||
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
||||
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
|
||||
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
||||
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
||||
/* Progressbar
|
||||
----------------------------------*/
|
||||
.ui-progressbar { height:2em; text-align: left; }
|
||||
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
|
||||
----------------------------------*/
|
||||
.ui-resizable { position: relative;}
|
||||
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
|
||||
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
||||
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
|
||||
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
|
||||
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
|
||||
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
|
||||
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
||||
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
||||
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
||||
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
|
||||
----------------------------------*/
|
||||
.ui-slider { position: relative; text-align: left; }
|
||||
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
||||
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
|
||||
|
||||
.ui-slider-horizontal { height: .8em; }
|
||||
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
||||
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
||||
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
||||
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
||||
|
||||
.ui-slider-vertical { width: .8em; height: 100px; }
|
||||
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
||||
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
||||
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
||||
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
|
||||
----------------------------------*/
|
||||
.ui-tabs { padding: .2em; zoom: 1; }
|
||||
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
|
||||
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
|
||||
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
|
||||
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
|
||||
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
||||
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
||||
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
|
||||
.ui-tabs .ui-tabs-hide { display: none !important; }
|
||||
@@ -0,0 +1,118 @@
|
||||
=== Regenerate Thumbnails ===
|
||||
Contributors: Viper007Bond
|
||||
Donate link: http://www.viper007bond.com/donate/
|
||||
Tags: thumbnail, thumbnails
|
||||
Requires at least: 2.8
|
||||
Tested up to: 3.9
|
||||
Stable tag: trunk
|
||||
|
||||
Allows you to regenerate your thumbnails after changing the thumbnail sizes.
|
||||
|
||||
== Description ==
|
||||
|
||||
Regenerate Thumbnails allows you to regenerate the thumbnails for your image attachments. This is very handy if you've changed any of your thumbnail dimensions (via Settings -> Media) after previously uploading images or have changed to a theme with different featured post image dimensions.
|
||||
|
||||
You can either regenerate the thumbnails for all image uploads, individual image uploads, or specific multiple image uploads.
|
||||
|
||||
See the [screenshots tab](http://wordpress.org/extend/plugins/regenerate-thumbnails/screenshots/) for more details.
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Go to your admin area and select Plugins -> Add new from the menu.
|
||||
2. Search for "Regenerate Thumbnails".
|
||||
3. Click install.
|
||||
4. Click activate.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The plugin at work regenerating thumbnails
|
||||
2. You can resize single images by hovering over their row in the Media Library
|
||||
2. You can resize specific multiples images using the checkboxes and the "Bulk Actions" dropdown
|
||||
|
||||
== ChangeLog ==
|
||||
|
||||
= Version 2.2.4 =
|
||||
|
||||
* Better AJAX response error handling in the JavaScript. This should fix a long-standing bug in this plugin. Props Hew Sutton.
|
||||
|
||||
= Version 2.2.3 =
|
||||
|
||||
* Make the capability required to use this plugin filterable so themes and other plugins can change it. Props [Jackson Whelan](http://jacksonwhelan.com/).
|
||||
|
||||
= Version 2.2.2 =
|
||||
|
||||
* Don't check the nonce until we're sure that the action called was for this plugin. Fixes lots of "Are you sure you want to do this?" error messages.
|
||||
|
||||
= Version 2.2.1 =
|
||||
|
||||
* Fix the bottom bulk action dropdown. Thanks Stefan for pointing out the issue!
|
||||
|
||||
= Version 2.2.0 =
|
||||
|
||||
* Changes to the Bulk Action functionality were made shortly before the release of WordPress 3.1 which broke the way I implemented the specific multiple image regeneration feature. This version adds to the Bulk Action menu using Javascript as that's the only way to do it currently.
|
||||
|
||||
= Version 2.1.3 =
|
||||
|
||||
* Move the `error_reporting()` call in the AJAX handler to the beginning so that we're more sure that no PHP errors are outputted. Some hosts disable usage of `set_time_limit()` and calling it was causing a PHP warning to be outputted.
|
||||
|
||||
= Version 2.1.2 =
|
||||
|
||||
* When regenerating all images, newest images are done first rather than the oldest.
|
||||
* Fixed a bug with regeneration error reporting in some browsers. Thanks to pete-sch for reporting the error.
|
||||
* Supress PHP errors in the AJAX handler to avoid sending an invalid JSON response. Thanks to pete-sch for reporting the error.
|
||||
* Better and more detailed error reporting for when `wp_generate_attachment_metadata()` fails.
|
||||
|
||||
= Version 2.1.1 =
|
||||
|
||||
* Clean up the wording a bit to better match the new features and just be easier to understand.
|
||||
* Updated screenshots.
|
||||
|
||||
= Version 2.1.0 =
|
||||
|
||||
Lots of new features!
|
||||
|
||||
* Thanks to a lot of jQuery help from [Boris Schapira](http://borisschapira.com/), a failed image regeneration will no longer stop the whole process.
|
||||
* The results of each image regeneration is now outputted. You can easily see which images were successfully regenerated and which failed. Was inspired by a concept by Boris.
|
||||
* There is now a button on the regeneration page that will allow you to abort resizing images for any reason. Based on code by Boris.
|
||||
* You can now regenerate single images from the Media page. The link to do so will show up in the actions list when you hover over the row.
|
||||
* You can now bulk regenerate multiple from the Media page. Check the boxes and then select "Regenerate Thumbnails" form the "Bulk Actions" dropdown. WordPress 3.1+ only.
|
||||
* The total time that the regeneration process took is now displayed in the final status message.
|
||||
* jQuery UI Progressbar version upgraded.
|
||||
|
||||
= Version 2.0.3 =
|
||||
|
||||
* Switch out deprecated function call.
|
||||
|
||||
= Version 2.0.2 =
|
||||
|
||||
* Directly query the database to only fetch what the plugin needs (the attachment ID). This will reduce the memory required as it's not storing the whole row for each attachment.
|
||||
|
||||
= Version 2.0.1 =
|
||||
|
||||
* I accidentally left a `check_admin_referer()` (nonce check) commented out.
|
||||
|
||||
= Version 2.0.0 =
|
||||
|
||||
* Recoded from scratch. Now uses an AJAX request per attachment to do the resizing. No more PHP maximum execution time errors or anything like that. Also features a pretty progress bar to let the user know how it's going.
|
||||
|
||||
= Version 1.1.0 =
|
||||
|
||||
* WordPress 2.7 updates -- code + UI. Thanks to jdub and Patrick F.
|
||||
|
||||
= Version 1.0.0 =
|
||||
|
||||
* Initial release.
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.2.4 =
|
||||
Better AJAX response error handling in the JavaScript. This should fix a long-standing bug in this plugin. Props Hew Sutton.
|
||||
|
||||
= 2.2.3 =
|
||||
Make the capability required to use this plugin filterable so themes and other plugins can change it. Props [Jackson Whelan](http://jacksonwhelan.com/).
|
||||
|
||||
= 2.2.2 =
|
||||
Fixes lots of "Are you sure you want to do this?" error messages.
|
||||
|
||||
= 2.2.1 =
|
||||
Fix the bottom bulk action dropdown. Thanks Stefan for pointing out the issue!
|
||||
@@ -0,0 +1,405 @@
|
||||
<?php /*
|
||||
|
||||
**************************************************************************
|
||||
|
||||
Plugin Name: Regenerate Thumbnails
|
||||
Plugin URI: http://www.viper007bond.com/wordpress-plugins/regenerate-thumbnails/
|
||||
Description: Allows you to regenerate all thumbnails after changing the thumbnail sizes.
|
||||
Version: 2.2.4
|
||||
Author: Viper007Bond
|
||||
Author URI: http://www.viper007bond.com/
|
||||
|
||||
**************************************************************************
|
||||
|
||||
Copyright (C) 2008-2011 Viper007Bond
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
class RegenerateThumbnails {
|
||||
var $menu_id;
|
||||
|
||||
// Plugin initialization
|
||||
function RegenerateThumbnails() {
|
||||
// Load up the localization file if we're using WordPress in a different language
|
||||
// Place it in this plugin's "localization" folder and name it "regenerate-thumbnails-[value in wp-config].mo"
|
||||
load_plugin_textdomain( 'regenerate-thumbnails', false, '/regenerate-thumbnails/localization' );
|
||||
|
||||
add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueues' ) );
|
||||
add_action( 'wp_ajax_regeneratethumbnail', array( &$this, 'ajax_process_image' ) );
|
||||
add_filter( 'media_row_actions', array( &$this, 'add_media_row_action' ), 10, 2 );
|
||||
//add_filter( 'bulk_actions-upload', array( &$this, 'add_bulk_actions' ), 99 ); // A last minute change to 3.1 makes this no longer work
|
||||
add_action( 'admin_head-upload.php', array( &$this, 'add_bulk_actions_via_javascript' ) );
|
||||
add_action( 'admin_action_bulk_regenerate_thumbnails', array( &$this, 'bulk_action_handler' ) ); // Top drowndown
|
||||
add_action( 'admin_action_-1', array( &$this, 'bulk_action_handler' ) ); // Bottom dropdown (assumes top dropdown = default value)
|
||||
|
||||
// Allow people to change what capability is required to use this plugin
|
||||
$this->capability = apply_filters( 'regenerate_thumbs_cap', 'manage_options' );
|
||||
}
|
||||
|
||||
|
||||
// Register the management page
|
||||
function add_admin_menu() {
|
||||
$this->menu_id = add_management_page( __( 'Regenerate Thumbnails', 'regenerate-thumbnails' ), __( 'Regen. Thumbnails', 'regenerate-thumbnails' ), $this->capability, 'regenerate-thumbnails', array(&$this, 'regenerate_interface') );
|
||||
}
|
||||
|
||||
|
||||
// Enqueue the needed Javascript and CSS
|
||||
function admin_enqueues( $hook_suffix ) {
|
||||
if ( $hook_suffix != $this->menu_id )
|
||||
return;
|
||||
|
||||
// WordPress 3.1 vs older version compatibility
|
||||
if ( wp_script_is( 'jquery-ui-widget', 'registered' ) )
|
||||
wp_enqueue_script( 'jquery-ui-progressbar', plugins_url( 'jquery-ui/jquery.ui.progressbar.min.js', __FILE__ ), array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.8.6' );
|
||||
else
|
||||
wp_enqueue_script( 'jquery-ui-progressbar', plugins_url( 'jquery-ui/jquery.ui.progressbar.min.1.7.2.js', __FILE__ ), array( 'jquery-ui-core' ), '1.7.2' );
|
||||
|
||||
wp_enqueue_style( 'jquery-ui-regenthumbs', plugins_url( 'jquery-ui/redmond/jquery-ui-1.7.2.custom.css', __FILE__ ), array(), '1.7.2' );
|
||||
}
|
||||
|
||||
|
||||
// Add a "Regenerate Thumbnails" link to the media row actions
|
||||
function add_media_row_action( $actions, $post ) {
|
||||
if ( 'image/' != substr( $post->post_mime_type, 0, 6 ) || ! current_user_can( $this->capability ) )
|
||||
return $actions;
|
||||
|
||||
$url = wp_nonce_url( admin_url( 'tools.php?page=regenerate-thumbnails&goback=1&ids=' . $post->ID ), 'regenerate-thumbnails' );
|
||||
$actions['regenerate_thumbnails'] = '<a href="' . esc_url( $url ) . '" title="' . esc_attr( __( "Regenerate the thumbnails for this single image", 'regenerate-thumbnails' ) ) . '">' . __( 'Regenerate Thumbnails', 'regenerate-thumbnails' ) . '</a>';
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
|
||||
// Add "Regenerate Thumbnails" to the Bulk Actions media dropdown
|
||||
function add_bulk_actions( $actions ) {
|
||||
$delete = false;
|
||||
if ( ! empty( $actions['delete'] ) ) {
|
||||
$delete = $actions['delete'];
|
||||
unset( $actions['delete'] );
|
||||
}
|
||||
|
||||
$actions['bulk_regenerate_thumbnails'] = __( 'Regenerate Thumbnails', 'regenerate-thumbnails' );
|
||||
|
||||
if ( $delete )
|
||||
$actions['delete'] = $delete;
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
|
||||
// Add new items to the Bulk Actions using Javascript
|
||||
// A last minute change to the "bulk_actions-xxxxx" filter in 3.1 made it not possible to add items using that
|
||||
function add_bulk_actions_via_javascript() {
|
||||
if ( ! current_user_can( $this->capability ) )
|
||||
return;
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('select[name^="action"] option:last-child').before('<option value="bulk_regenerate_thumbnails"><?php echo esc_attr( __( 'Regenerate Thumbnails', 'regenerate-thumbnails' ) ); ?></option>');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Handles the bulk actions POST
|
||||
function bulk_action_handler() {
|
||||
if ( empty( $_REQUEST['action'] ) || ( 'bulk_regenerate_thumbnails' != $_REQUEST['action'] && 'bulk_regenerate_thumbnails' != $_REQUEST['action2'] ) )
|
||||
return;
|
||||
|
||||
if ( empty( $_REQUEST['media'] ) || ! is_array( $_REQUEST['media'] ) )
|
||||
return;
|
||||
|
||||
check_admin_referer( 'bulk-media' );
|
||||
|
||||
$ids = implode( ',', array_map( 'intval', $_REQUEST['media'] ) );
|
||||
|
||||
// Can't use wp_nonce_url() as it escapes HTML entities
|
||||
wp_redirect( add_query_arg( '_wpnonce', wp_create_nonce( 'regenerate-thumbnails' ), admin_url( 'tools.php?page=regenerate-thumbnails&goback=1&ids=' . $ids ) ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// The user interface plus thumbnail regenerator
|
||||
function regenerate_interface() {
|
||||
global $wpdb;
|
||||
|
||||
?>
|
||||
|
||||
<div id="message" class="updated fade" style="display:none"></div>
|
||||
|
||||
<div class="wrap regenthumbs">
|
||||
<h2><?php _e('Regenerate Thumbnails', 'regenerate-thumbnails'); ?></h2>
|
||||
|
||||
<?php
|
||||
|
||||
// If the button was clicked
|
||||
if ( ! empty( $_POST['regenerate-thumbnails'] ) || ! empty( $_REQUEST['ids'] ) ) {
|
||||
// Capability check
|
||||
if ( ! current_user_can( $this->capability ) )
|
||||
wp_die( __( 'Cheatin’ uh?' ) );
|
||||
|
||||
// Form nonce check
|
||||
check_admin_referer( 'regenerate-thumbnails' );
|
||||
|
||||
// Create the list of image IDs
|
||||
if ( ! empty( $_REQUEST['ids'] ) ) {
|
||||
$images = array_map( 'intval', explode( ',', trim( $_REQUEST['ids'], ',' ) ) );
|
||||
$ids = implode( ',', $images );
|
||||
} else {
|
||||
// Directly querying the database is normally frowned upon, but all
|
||||
// of the API functions will return the full post objects which will
|
||||
// suck up lots of memory. This is best, just not as future proof.
|
||||
if ( ! $images = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' ORDER BY ID DESC" ) ) {
|
||||
echo ' <p>' . sprintf( __( "Unable to find any images. Are you sure <a href='%s'>some exist</a>?", 'regenerate-thumbnails' ), admin_url( 'upload.php?post_mime_type=image' ) ) . "</p></div>";
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate the list of IDs
|
||||
$ids = array();
|
||||
foreach ( $images as $image )
|
||||
$ids[] = $image->ID;
|
||||
$ids = implode( ',', $ids );
|
||||
}
|
||||
|
||||
echo ' <p>' . __( "Please be patient while the thumbnails are regenerated. This can take a while if your server is slow (inexpensive hosting) or if you have many images. Do not navigate away from this page until this script is done or the thumbnails will not be resized. You will be notified via this page when the regenerating is completed.", 'regenerate-thumbnails' ) . '</p>';
|
||||
|
||||
$count = count( $images );
|
||||
|
||||
$text_goback = ( ! empty( $_GET['goback'] ) ) ? sprintf( __( 'To go back to the previous page, <a href="%s">click here</a>.', 'regenerate-thumbnails' ), 'javascript:history.go(-1)' ) : '';
|
||||
$text_failures = sprintf( __( 'All done! %1$s image(s) were successfully resized in %2$s seconds and there were %3$s failure(s). To try regenerating the failed images again, <a href="%4$s">click here</a>. %5$s', 'regenerate-thumbnails' ), "' + rt_successes + '", "' + rt_totaltime + '", "' + rt_errors + '", esc_url( wp_nonce_url( admin_url( 'tools.php?page=regenerate-thumbnails&goback=1' ), 'regenerate-thumbnails' ) . '&ids=' ) . "' + rt_failedlist + '", $text_goback );
|
||||
$text_nofailures = sprintf( __( 'All done! %1$s image(s) were successfully resized in %2$s seconds and there were 0 failures. %3$s', 'regenerate-thumbnails' ), "' + rt_successes + '", "' + rt_totaltime + '", $text_goback );
|
||||
?>
|
||||
|
||||
|
||||
<noscript><p><em><?php _e( 'You must enable Javascript in order to proceed!', 'regenerate-thumbnails' ) ?></em></p></noscript>
|
||||
|
||||
<div id="regenthumbs-bar" style="position:relative;height:25px;">
|
||||
<div id="regenthumbs-bar-percent" style="position:absolute;left:50%;top:50%;width:300px;margin-left:-150px;height:25px;margin-top:-9px;font-weight:bold;text-align:center;"></div>
|
||||
</div>
|
||||
|
||||
<p><input type="button" class="button hide-if-no-js" name="regenthumbs-stop" id="regenthumbs-stop" value="<?php _e( 'Abort Resizing Images', 'regenerate-thumbnails' ) ?>" /></p>
|
||||
|
||||
<h3 class="title"><?php _e( 'Debugging Information', 'regenerate-thumbnails' ) ?></h3>
|
||||
|
||||
<p>
|
||||
<?php printf( __( 'Total Images: %s', 'regenerate-thumbnails' ), $count ); ?><br />
|
||||
<?php printf( __( 'Images Resized: %s', 'regenerate-thumbnails' ), '<span id="regenthumbs-debug-successcount">0</span>' ); ?><br />
|
||||
<?php printf( __( 'Resize Failures: %s', 'regenerate-thumbnails' ), '<span id="regenthumbs-debug-failurecount">0</span>' ); ?>
|
||||
</p>
|
||||
|
||||
<ol id="regenthumbs-debuglist">
|
||||
<li style="display:none"></li>
|
||||
</ol>
|
||||
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
jQuery(document).ready(function($){
|
||||
var i;
|
||||
var rt_images = [<?php echo $ids; ?>];
|
||||
var rt_total = rt_images.length;
|
||||
var rt_count = 1;
|
||||
var rt_percent = 0;
|
||||
var rt_successes = 0;
|
||||
var rt_errors = 0;
|
||||
var rt_failedlist = '';
|
||||
var rt_resulttext = '';
|
||||
var rt_timestart = new Date().getTime();
|
||||
var rt_timeend = 0;
|
||||
var rt_totaltime = 0;
|
||||
var rt_continue = true;
|
||||
|
||||
// Create the progress bar
|
||||
$("#regenthumbs-bar").progressbar();
|
||||
$("#regenthumbs-bar-percent").html( "0%" );
|
||||
|
||||
// Stop button
|
||||
$("#regenthumbs-stop").click(function() {
|
||||
rt_continue = false;
|
||||
$('#regenthumbs-stop').val("<?php echo $this->esc_quotes( __( 'Stopping...', 'regenerate-thumbnails' ) ); ?>");
|
||||
});
|
||||
|
||||
// Clear out the empty list element that's there for HTML validation purposes
|
||||
$("#regenthumbs-debuglist li").remove();
|
||||
|
||||
// Called after each resize. Updates debug information and the progress bar.
|
||||
function RegenThumbsUpdateStatus( id, success, response ) {
|
||||
$("#regenthumbs-bar").progressbar( "value", ( rt_count / rt_total ) * 100 );
|
||||
$("#regenthumbs-bar-percent").html( Math.round( ( rt_count / rt_total ) * 1000 ) / 10 + "%" );
|
||||
rt_count = rt_count + 1;
|
||||
|
||||
if ( success ) {
|
||||
rt_successes = rt_successes + 1;
|
||||
$("#regenthumbs-debug-successcount").html(rt_successes);
|
||||
$("#regenthumbs-debuglist").append("<li>" + response.success + "</li>");
|
||||
}
|
||||
else {
|
||||
rt_errors = rt_errors + 1;
|
||||
rt_failedlist = rt_failedlist + ',' + id;
|
||||
$("#regenthumbs-debug-failurecount").html(rt_errors);
|
||||
$("#regenthumbs-debuglist").append("<li>" + response.error + "</li>");
|
||||
}
|
||||
}
|
||||
|
||||
// Called when all images have been processed. Shows the results and cleans up.
|
||||
function RegenThumbsFinishUp() {
|
||||
rt_timeend = new Date().getTime();
|
||||
rt_totaltime = Math.round( ( rt_timeend - rt_timestart ) / 1000 );
|
||||
|
||||
$('#regenthumbs-stop').hide();
|
||||
|
||||
if ( rt_errors > 0 ) {
|
||||
rt_resulttext = '<?php echo $text_failures; ?>';
|
||||
} else {
|
||||
rt_resulttext = '<?php echo $text_nofailures; ?>';
|
||||
}
|
||||
|
||||
$("#message").html("<p><strong>" + rt_resulttext + "</strong></p>");
|
||||
$("#message").show();
|
||||
}
|
||||
|
||||
// Regenerate a specified image via AJAX
|
||||
function RegenThumbs( id ) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
data: { action: "regeneratethumbnail", id: id },
|
||||
success: function( response ) {
|
||||
if ( response !== Object( response ) || ( typeof response.success === "undefined" && typeof response.error === "undefined" ) ) {
|
||||
response = new Object;
|
||||
response.success = false;
|
||||
response.error = "<?php printf( esc_js( __( 'The resize request was abnormally terminated (ID %s). This is likely due to the image exceeding available memory or some other type of fatal error.', 'regenerate-thumbnails' ) ), '" + id + "' ); ?>";
|
||||
}
|
||||
|
||||
if ( response.success ) {
|
||||
RegenThumbsUpdateStatus( id, true, response );
|
||||
}
|
||||
else {
|
||||
RegenThumbsUpdateStatus( id, false, response );
|
||||
}
|
||||
|
||||
if ( rt_images.length && rt_continue ) {
|
||||
RegenThumbs( rt_images.shift() );
|
||||
}
|
||||
else {
|
||||
RegenThumbsFinishUp();
|
||||
}
|
||||
},
|
||||
error: function( response ) {
|
||||
RegenThumbsUpdateStatus( id, false, response );
|
||||
|
||||
if ( rt_images.length && rt_continue ) {
|
||||
RegenThumbs( rt_images.shift() );
|
||||
}
|
||||
else {
|
||||
RegenThumbsFinishUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RegenThumbs( rt_images.shift() );
|
||||
});
|
||||
// ]]>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
// No button click? Display the form.
|
||||
else {
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field('regenerate-thumbnails') ?>
|
||||
|
||||
<p><?php printf( __( "Use this tool to regenerate thumbnails for all images that you have uploaded to your blog. This is useful if you've changed any of the thumbnail dimensions on the <a href='%s'>media settings page</a>. Old thumbnails will be kept to avoid any broken images due to hard-coded URLs.", 'regenerate-thumbnails' ), admin_url( 'options-media.php' ) ); ?></p>
|
||||
|
||||
<p><?php printf( __( "You can regenerate specific images (rather than all images) from the <a href='%s'>Media</a> page. Hover over an image's row and click the link to resize just that one image or use the checkboxes and the "Bulk Actions" dropdown to resize multiple images (WordPress 3.1+ only).", 'regenerate-thumbnails '), admin_url( 'upload.php' ) ); ?></p>
|
||||
|
||||
<p><?php _e( "Thumbnail regeneration is not reversible, but you can just change your thumbnail dimensions back to the old values and click the button again if you don't like the results.", 'regenerate-thumbnails' ); ?></p>
|
||||
|
||||
<p><?php _e( 'To begin, just press the button below.', 'regenerate-thumbnails '); ?></p>
|
||||
|
||||
<p><input type="submit" class="button hide-if-no-js" name="regenerate-thumbnails" id="regenerate-thumbnails" value="<?php _e( 'Regenerate All Thumbnails', 'regenerate-thumbnails' ) ?>" /></p>
|
||||
|
||||
<noscript><p><em><?php _e( 'You must enable Javascript in order to proceed!', 'regenerate-thumbnails' ) ?></em></p></noscript>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
} // End if button
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Process a single image ID (this is an AJAX handler)
|
||||
function ajax_process_image() {
|
||||
@error_reporting( 0 ); // Don't break the JSON result
|
||||
|
||||
header( 'Content-type: application/json' );
|
||||
|
||||
$id = (int) $_REQUEST['id'];
|
||||
$image = get_post( $id );
|
||||
|
||||
if ( ! $image || 'attachment' != $image->post_type || 'image/' != substr( $image->post_mime_type, 0, 6 ) )
|
||||
die( json_encode( array( 'error' => sprintf( __( 'Failed resize: %s is an invalid image ID.', 'regenerate-thumbnails' ), esc_html( $_REQUEST['id'] ) ) ) ) );
|
||||
|
||||
if ( ! current_user_can( $this->capability ) )
|
||||
$this->die_json_error_msg( $image->ID, __( "Your user account doesn't have permission to resize images", 'regenerate-thumbnails' ) );
|
||||
|
||||
$fullsizepath = get_attached_file( $image->ID );
|
||||
|
||||
if ( false === $fullsizepath || ! file_exists( $fullsizepath ) )
|
||||
$this->die_json_error_msg( $image->ID, sprintf( __( 'The originally uploaded image file cannot be found at %s', 'regenerate-thumbnails' ), '<code>' . esc_html( $fullsizepath ) . '</code>' ) );
|
||||
|
||||
@set_time_limit( 900 ); // 5 minutes per image should be PLENTY
|
||||
|
||||
$metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );
|
||||
|
||||
if ( is_wp_error( $metadata ) )
|
||||
$this->die_json_error_msg( $image->ID, $metadata->get_error_message() );
|
||||
if ( empty( $metadata ) )
|
||||
$this->die_json_error_msg( $image->ID, __( 'Unknown failure reason.', 'regenerate-thumbnails' ) );
|
||||
|
||||
// If this fails, then it just means that nothing was changed (old value == new value)
|
||||
wp_update_attachment_metadata( $image->ID, $metadata );
|
||||
|
||||
die( json_encode( array( 'success' => sprintf( __( '"%1$s" (ID %2$s) was successfully resized in %3$s seconds.', 'regenerate-thumbnails' ), esc_html( get_the_title( $image->ID ) ), $image->ID, timer_stop() ) ) ) );
|
||||
}
|
||||
|
||||
|
||||
// Helper to make a JSON error message
|
||||
function die_json_error_msg( $id, $message ) {
|
||||
die( json_encode( array( 'error' => sprintf( __( '"%1$s" (ID %2$s) failed to resize. The error message was: %3$s', 'regenerate-thumbnails' ), esc_html( get_the_title( $id ) ), $id, $message ) ) ) );
|
||||
}
|
||||
|
||||
|
||||
// Helper function to escape quotes in strings for use in Javascript
|
||||
function esc_quotes( $string ) {
|
||||
return str_replace( '"', '\"', $string );
|
||||
}
|
||||
}
|
||||
|
||||
// Start up this plugin
|
||||
add_action( 'init', 'RegenerateThumbnails' );
|
||||
function RegenerateThumbnails() {
|
||||
global $RegenerateThumbnails;
|
||||
$RegenerateThumbnails = new RegenerateThumbnails();
|
||||
}
|
||||
|
||||
?>
|
||||
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,231 @@
|
||||
# Copyright (C) 2011 WordPress Importer
|
||||
# This file is distributed under the same license as the WordPress Importer package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WordPress Importer 0.5\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wordpress-importer\n"
|
||||
"POT-Creation-Date: 2011-07-16 15:45:12+00:00\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
#: parsers.php:42 parsers.php:63
|
||||
msgid "There was an error when reading this WXR file"
|
||||
msgstr ""
|
||||
|
||||
#: parsers.php:43
|
||||
msgid ""
|
||||
"Details are shown above. The importer will now try again with a different "
|
||||
"parser..."
|
||||
msgstr ""
|
||||
|
||||
#: parsers.php:67 parsers.php:72 parsers.php:262 parsers.php:451
|
||||
msgid ""
|
||||
"This does not appear to be a WXR file, missing/invalid WXR version number"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:134 wordpress-importer.php:143
|
||||
#: wordpress-importer.php:194 wordpress-importer.php:202
|
||||
msgid "Sorry, there has been an error."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:135
|
||||
msgid "The file does not exist, please try again."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:178
|
||||
msgid "All done."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:178
|
||||
msgid "Have fun!"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:179
|
||||
msgid "Remember to update the passwords and roles of imported users."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:210
|
||||
msgid ""
|
||||
"This WXR file (version %s) may not be supported by this version of the "
|
||||
"importer. Please consider updating."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:235
|
||||
msgid ""
|
||||
"Failed to import author %s. Their posts will be attributed to the current "
|
||||
"user."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:261
|
||||
msgid "Assign Authors"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:262
|
||||
msgid ""
|
||||
"To make it easier for you to edit and save the imported content, you may "
|
||||
"want to reassign the author of the imported item to an existing user of this "
|
||||
"site. For example, you may want to import all the entries as <code>admin</"
|
||||
"code>s entries."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:264
|
||||
msgid ""
|
||||
"If a new user is created by WordPress, a new password will be randomly "
|
||||
"generated and the new user’s role will be set as %s. Manually changing "
|
||||
"the new user’s details will be necessary."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:274
|
||||
msgid "Import Attachments"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:277
|
||||
msgid "Download and import file attachments"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:281
|
||||
msgid "Submit"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:294
|
||||
msgid "Import author:"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:305
|
||||
msgid "or create new user with login name:"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:308
|
||||
msgid "as a new user:"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:316
|
||||
msgid "assign posts to an existing user:"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:318
|
||||
msgid "or assign posts to an existing user:"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:319
|
||||
msgid "- Select -"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:369
|
||||
msgid ""
|
||||
"Failed to create new user for %s. Their posts will be attributed to the "
|
||||
"current user."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:418
|
||||
msgid "Failed to import category %s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:456
|
||||
msgid "Failed to import post tag %s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:500 wordpress-importer.php:626
|
||||
msgid "Failed to import %s %s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:522
|
||||
msgid "Failed to import “%s”: Invalid post type %s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:543
|
||||
msgid "%s “%s” already exists."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:598
|
||||
msgid "Failed to import %s “%s”"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:744
|
||||
msgid "Menu item skipped due to missing menu slug"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:751
|
||||
msgid "Menu item skipped due to invalid menu slug: %s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:814
|
||||
msgid "Fetching attachments is not enabled"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:827
|
||||
msgid "Invalid file type"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:871
|
||||
msgid "Remote server did not respond"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:877
|
||||
msgid "Remote server returned error response %1$d %2$s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:884
|
||||
msgid "Remote file is incorrect size"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:889
|
||||
msgid "Zero size file downloaded"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:895
|
||||
msgid "Remote file is too large, limit is %s"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:994
|
||||
msgid "Import WordPress"
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:1001
|
||||
msgid ""
|
||||
"A new version of this importer is available. Please update to version %s to "
|
||||
"ensure compatibility with newer export files."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:1016
|
||||
msgid ""
|
||||
"Howdy! Upload your WordPress eXtended RSS (WXR) file and we’ll import "
|
||||
"the posts, pages, comments, custom fields, categories, and tags into this "
|
||||
"site."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:1017
|
||||
msgid "Choose a WXR (.xml) file to upload, then click Upload file and import."
|
||||
msgstr ""
|
||||
|
||||
#: wordpress-importer.php:1091
|
||||
msgid ""
|
||||
"Import <strong>posts, pages, comments, custom fields, categories, and tags</"
|
||||
"strong> from a WordPress export file."
|
||||
msgstr ""
|
||||
|
||||
#. Plugin Name of the plugin/theme
|
||||
msgid "WordPress Importer"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "http://wordpress.org/extend/plugins/wordpress-importer/"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid ""
|
||||
"Import posts, pages, comments, custom fields, categories, tags and more from "
|
||||
"a WordPress export file."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "wordpressdotorg"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "http://wordpress.org/"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,664 @@
|
||||
<?php
|
||||
/**
|
||||
* WordPress eXtended RSS file parser implementations
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Importer
|
||||
*/
|
||||
|
||||
/**
|
||||
* WordPress Importer class for managing parsing of WXR files.
|
||||
*/
|
||||
class WXR_Parser {
|
||||
function parse( $file ) {
|
||||
// Attempt to use proper XML parsers first
|
||||
if ( extension_loaded( 'simplexml' ) ) {
|
||||
$parser = new WXR_Parser_SimpleXML;
|
||||
$result = $parser->parse( $file );
|
||||
|
||||
// If SimpleXML succeeds or this is an invalid WXR file then return the results
|
||||
if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() )
|
||||
return $result;
|
||||
} else if ( extension_loaded( 'xml' ) ) {
|
||||
$parser = new WXR_Parser_XML;
|
||||
$result = $parser->parse( $file );
|
||||
|
||||
// If XMLParser succeeds or this is an invalid WXR file then return the results
|
||||
if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() )
|
||||
return $result;
|
||||
}
|
||||
|
||||
// We have a malformed XML file, so display the error and fallthrough to regex
|
||||
if ( isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG ) {
|
||||
echo '<pre>';
|
||||
if ( 'SimpleXML_parse_error' == $result->get_error_code() ) {
|
||||
foreach ( $result->get_error_data() as $error )
|
||||
echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n";
|
||||
} else if ( 'XML_parse_error' == $result->get_error_code() ) {
|
||||
$error = $result->get_error_data();
|
||||
echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] );
|
||||
}
|
||||
echo '</pre>';
|
||||
echo '<p><strong>' . __( 'There was an error when reading this WXR file', 'wordpress-importer' ) . '</strong><br />';
|
||||
echo __( 'Details are shown above. The importer will now try again with a different parser...', 'wordpress-importer' ) . '</p>';
|
||||
}
|
||||
|
||||
// use regular expressions if nothing else available or this is bad XML
|
||||
$parser = new WXR_Parser_Regex;
|
||||
return $parser->parse( $file );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WXR Parser that makes use of the SimpleXML PHP extension.
|
||||
*/
|
||||
class WXR_Parser_SimpleXML {
|
||||
function parse( $file ) {
|
||||
$authors = $posts = $categories = $tags = $terms = array();
|
||||
|
||||
$internal_errors = libxml_use_internal_errors(true);
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$old_value = null;
|
||||
if ( function_exists( 'libxml_disable_entity_loader' ) ) {
|
||||
$old_value = libxml_disable_entity_loader( true );
|
||||
}
|
||||
$success = $dom->loadXML( file_get_contents( $file ) );
|
||||
if ( ! is_null( $old_value ) ) {
|
||||
libxml_disable_entity_loader( $old_value );
|
||||
}
|
||||
|
||||
if ( ! $success || isset( $dom->doctype ) ) {
|
||||
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
|
||||
}
|
||||
|
||||
$xml = simplexml_import_dom( $dom );
|
||||
unset( $dom );
|
||||
|
||||
// halt if loading produces an error
|
||||
if ( ! $xml )
|
||||
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
|
||||
|
||||
$wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
|
||||
if ( ! $wxr_version )
|
||||
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
|
||||
|
||||
$wxr_version = (string) trim( $wxr_version[0] );
|
||||
// confirm that we are dealing with the correct file format
|
||||
if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
|
||||
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
|
||||
|
||||
$base_url = $xml->xpath('/rss/channel/wp:base_site_url');
|
||||
$base_url = (string) trim( $base_url[0] );
|
||||
|
||||
$namespaces = $xml->getDocNamespaces();
|
||||
if ( ! isset( $namespaces['wp'] ) )
|
||||
$namespaces['wp'] = 'http://wordpress.org/export/1.1/';
|
||||
if ( ! isset( $namespaces['excerpt'] ) )
|
||||
$namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
|
||||
|
||||
// grab authors
|
||||
foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) {
|
||||
$a = $author_arr->children( $namespaces['wp'] );
|
||||
$login = (string) $a->author_login;
|
||||
$authors[$login] = array(
|
||||
'author_id' => (int) $a->author_id,
|
||||
'author_login' => $login,
|
||||
'author_email' => (string) $a->author_email,
|
||||
'author_display_name' => (string) $a->author_display_name,
|
||||
'author_first_name' => (string) $a->author_first_name,
|
||||
'author_last_name' => (string) $a->author_last_name
|
||||
);
|
||||
}
|
||||
|
||||
// grab cats, tags and terms
|
||||
foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) {
|
||||
$t = $term_arr->children( $namespaces['wp'] );
|
||||
$categories[] = array(
|
||||
'term_id' => (int) $t->term_id,
|
||||
'category_nicename' => (string) $t->category_nicename,
|
||||
'category_parent' => (string) $t->category_parent,
|
||||
'cat_name' => (string) $t->cat_name,
|
||||
'category_description' => (string) $t->category_description
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) {
|
||||
$t = $term_arr->children( $namespaces['wp'] );
|
||||
$tags[] = array(
|
||||
'term_id' => (int) $t->term_id,
|
||||
'tag_slug' => (string) $t->tag_slug,
|
||||
'tag_name' => (string) $t->tag_name,
|
||||
'tag_description' => (string) $t->tag_description
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) {
|
||||
$t = $term_arr->children( $namespaces['wp'] );
|
||||
$terms[] = array(
|
||||
'term_id' => (int) $t->term_id,
|
||||
'term_taxonomy' => (string) $t->term_taxonomy,
|
||||
'slug' => (string) $t->term_slug,
|
||||
'term_parent' => (string) $t->term_parent,
|
||||
'term_name' => (string) $t->term_name,
|
||||
'term_description' => (string) $t->term_description
|
||||
);
|
||||
}
|
||||
|
||||
// grab posts
|
||||
foreach ( $xml->channel->item as $item ) {
|
||||
$post = array(
|
||||
'post_title' => (string) $item->title,
|
||||
'guid' => (string) $item->guid,
|
||||
);
|
||||
|
||||
$dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
|
||||
$post['post_author'] = (string) $dc->creator;
|
||||
|
||||
$content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
|
||||
$excerpt = $item->children( $namespaces['excerpt'] );
|
||||
$post['post_content'] = (string) $content->encoded;
|
||||
$post['post_excerpt'] = (string) $excerpt->encoded;
|
||||
|
||||
$wp = $item->children( $namespaces['wp'] );
|
||||
$post['post_id'] = (int) $wp->post_id;
|
||||
$post['post_date'] = (string) $wp->post_date;
|
||||
$post['post_date_gmt'] = (string) $wp->post_date_gmt;
|
||||
$post['comment_status'] = (string) $wp->comment_status;
|
||||
$post['ping_status'] = (string) $wp->ping_status;
|
||||
$post['post_name'] = (string) $wp->post_name;
|
||||
$post['status'] = (string) $wp->status;
|
||||
$post['post_parent'] = (int) $wp->post_parent;
|
||||
$post['menu_order'] = (int) $wp->menu_order;
|
||||
$post['post_type'] = (string) $wp->post_type;
|
||||
$post['post_password'] = (string) $wp->post_password;
|
||||
$post['is_sticky'] = (int) $wp->is_sticky;
|
||||
|
||||
if ( isset($wp->attachment_url) )
|
||||
$post['attachment_url'] = (string) $wp->attachment_url;
|
||||
|
||||
foreach ( $item->category as $c ) {
|
||||
$att = $c->attributes();
|
||||
if ( isset( $att['nicename'] ) )
|
||||
$post['terms'][] = array(
|
||||
'name' => (string) $c,
|
||||
'slug' => (string) $att['nicename'],
|
||||
'domain' => (string) $att['domain']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $wp->postmeta as $meta ) {
|
||||
$post['postmeta'][] = array(
|
||||
'key' => (string) $meta->meta_key,
|
||||
'value' => (string) $meta->meta_value
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( $wp->comment as $comment ) {
|
||||
$meta = array();
|
||||
if ( isset( $comment->commentmeta ) ) {
|
||||
foreach ( $comment->commentmeta as $m ) {
|
||||
$meta[] = array(
|
||||
'key' => (string) $m->meta_key,
|
||||
'value' => (string) $m->meta_value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$post['comments'][] = array(
|
||||
'comment_id' => (int) $comment->comment_id,
|
||||
'comment_author' => (string) $comment->comment_author,
|
||||
'comment_author_email' => (string) $comment->comment_author_email,
|
||||
'comment_author_IP' => (string) $comment->comment_author_IP,
|
||||
'comment_author_url' => (string) $comment->comment_author_url,
|
||||
'comment_date' => (string) $comment->comment_date,
|
||||
'comment_date_gmt' => (string) $comment->comment_date_gmt,
|
||||
'comment_content' => (string) $comment->comment_content,
|
||||
'comment_approved' => (string) $comment->comment_approved,
|
||||
'comment_type' => (string) $comment->comment_type,
|
||||
'comment_parent' => (string) $comment->comment_parent,
|
||||
'comment_user_id' => (int) $comment->comment_user_id,
|
||||
'commentmeta' => $meta,
|
||||
);
|
||||
}
|
||||
|
||||
$posts[] = $post;
|
||||
}
|
||||
|
||||
return array(
|
||||
'authors' => $authors,
|
||||
'posts' => $posts,
|
||||
'categories' => $categories,
|
||||
'tags' => $tags,
|
||||
'terms' => $terms,
|
||||
'base_url' => $base_url,
|
||||
'version' => $wxr_version
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WXR Parser that makes use of the XML Parser PHP extension.
|
||||
*/
|
||||
class WXR_Parser_XML {
|
||||
var $wp_tags = array(
|
||||
'wp:post_id', 'wp:post_date', 'wp:post_date_gmt', 'wp:comment_status', 'wp:ping_status', 'wp:attachment_url',
|
||||
'wp:status', 'wp:post_name', 'wp:post_parent', 'wp:menu_order', 'wp:post_type', 'wp:post_password',
|
||||
'wp:is_sticky', 'wp:term_id', 'wp:category_nicename', 'wp:category_parent', 'wp:cat_name', 'wp:category_description',
|
||||
'wp:tag_slug', 'wp:tag_name', 'wp:tag_description', 'wp:term_taxonomy', 'wp:term_parent',
|
||||
'wp:term_name', 'wp:term_description', 'wp:author_id', 'wp:author_login', 'wp:author_email', 'wp:author_display_name',
|
||||
'wp:author_first_name', 'wp:author_last_name',
|
||||
);
|
||||
var $wp_sub_tags = array(
|
||||
'wp:comment_id', 'wp:comment_author', 'wp:comment_author_email', 'wp:comment_author_url',
|
||||
'wp:comment_author_IP', 'wp:comment_date', 'wp:comment_date_gmt', 'wp:comment_content',
|
||||
'wp:comment_approved', 'wp:comment_type', 'wp:comment_parent', 'wp:comment_user_id',
|
||||
);
|
||||
|
||||
function parse( $file ) {
|
||||
$this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false;
|
||||
$this->authors = $this->posts = $this->term = $this->category = $this->tag = array();
|
||||
|
||||
$xml = xml_parser_create( 'UTF-8' );
|
||||
xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 );
|
||||
xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 );
|
||||
xml_set_object( $xml, $this );
|
||||
xml_set_character_data_handler( $xml, 'cdata' );
|
||||
xml_set_element_handler( $xml, 'tag_open', 'tag_close' );
|
||||
|
||||
if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
|
||||
$current_line = xml_get_current_line_number( $xml );
|
||||
$current_column = xml_get_current_column_number( $xml );
|
||||
$error_code = xml_get_error_code( $xml );
|
||||
$error_string = xml_error_string( $error_code );
|
||||
return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) );
|
||||
}
|
||||
xml_parser_free( $xml );
|
||||
|
||||
if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) )
|
||||
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
|
||||
|
||||
return array(
|
||||
'authors' => $this->authors,
|
||||
'posts' => $this->posts,
|
||||
'categories' => $this->category,
|
||||
'tags' => $this->tag,
|
||||
'terms' => $this->term,
|
||||
'base_url' => $this->base_url,
|
||||
'version' => $this->wxr_version
|
||||
);
|
||||
}
|
||||
|
||||
function tag_open( $parse, $tag, $attr ) {
|
||||
if ( in_array( $tag, $this->wp_tags ) ) {
|
||||
$this->in_tag = substr( $tag, 3 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( in_array( $tag, $this->wp_sub_tags ) ) {
|
||||
$this->in_sub_tag = substr( $tag, 3 );
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( $tag ) {
|
||||
case 'category':
|
||||
if ( isset($attr['domain'], $attr['nicename']) ) {
|
||||
$this->sub_data['domain'] = $attr['domain'];
|
||||
$this->sub_data['slug'] = $attr['nicename'];
|
||||
}
|
||||
break;
|
||||
case 'item': $this->in_post = true;
|
||||
case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break;
|
||||
case 'guid': $this->in_tag = 'guid'; break;
|
||||
case 'dc:creator': $this->in_tag = 'post_author'; break;
|
||||
case 'content:encoded': $this->in_tag = 'post_content'; break;
|
||||
case 'excerpt:encoded': $this->in_tag = 'post_excerpt'; break;
|
||||
|
||||
case 'wp:term_slug': $this->in_tag = 'slug'; break;
|
||||
case 'wp:meta_key': $this->in_sub_tag = 'key'; break;
|
||||
case 'wp:meta_value': $this->in_sub_tag = 'value'; break;
|
||||
}
|
||||
}
|
||||
|
||||
function cdata( $parser, $cdata ) {
|
||||
if ( ! trim( $cdata ) )
|
||||
return;
|
||||
|
||||
$this->cdata .= trim( $cdata );
|
||||
}
|
||||
|
||||
function tag_close( $parser, $tag ) {
|
||||
switch ( $tag ) {
|
||||
case 'wp:comment':
|
||||
unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data
|
||||
if ( ! empty( $this->sub_data ) )
|
||||
$this->data['comments'][] = $this->sub_data;
|
||||
$this->sub_data = false;
|
||||
break;
|
||||
case 'wp:commentmeta':
|
||||
$this->sub_data['commentmeta'][] = array(
|
||||
'key' => $this->sub_data['key'],
|
||||
'value' => $this->sub_data['value']
|
||||
);
|
||||
break;
|
||||
case 'category':
|
||||
if ( ! empty( $this->sub_data ) ) {
|
||||
$this->sub_data['name'] = $this->cdata;
|
||||
$this->data['terms'][] = $this->sub_data;
|
||||
}
|
||||
$this->sub_data = false;
|
||||
break;
|
||||
case 'wp:postmeta':
|
||||
if ( ! empty( $this->sub_data ) )
|
||||
$this->data['postmeta'][] = $this->sub_data;
|
||||
$this->sub_data = false;
|
||||
break;
|
||||
case 'item':
|
||||
$this->posts[] = $this->data;
|
||||
$this->data = false;
|
||||
break;
|
||||
case 'wp:category':
|
||||
case 'wp:tag':
|
||||
case 'wp:term':
|
||||
$n = substr( $tag, 3 );
|
||||
array_push( $this->$n, $this->data );
|
||||
$this->data = false;
|
||||
break;
|
||||
case 'wp:author':
|
||||
if ( ! empty($this->data['author_login']) )
|
||||
$this->authors[$this->data['author_login']] = $this->data;
|
||||
$this->data = false;
|
||||
break;
|
||||
case 'wp:base_site_url':
|
||||
$this->base_url = $this->cdata;
|
||||
break;
|
||||
case 'wp:wxr_version':
|
||||
$this->wxr_version = $this->cdata;
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( $this->in_sub_tag ) {
|
||||
$this->sub_data[$this->in_sub_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
|
||||
$this->in_sub_tag = false;
|
||||
} else if ( $this->in_tag ) {
|
||||
$this->data[$this->in_tag] = ! empty( $this->cdata ) ? $this->cdata : '';
|
||||
$this->in_tag = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->cdata = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WXR Parser that uses regular expressions. Fallback for installs without an XML parser.
|
||||
*/
|
||||
class WXR_Parser_Regex {
|
||||
var $authors = array();
|
||||
var $posts = array();
|
||||
var $categories = array();
|
||||
var $tags = array();
|
||||
var $terms = array();
|
||||
var $base_url = '';
|
||||
|
||||
function WXR_Parser_Regex() {
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
function __construct() {
|
||||
$this->has_gzip = is_callable( 'gzopen' );
|
||||
}
|
||||
|
||||
function parse( $file ) {
|
||||
$wxr_version = $in_post = false;
|
||||
|
||||
$fp = $this->fopen( $file, 'r' );
|
||||
if ( $fp ) {
|
||||
while ( ! $this->feof( $fp ) ) {
|
||||
$importline = rtrim( $this->fgets( $fp ) );
|
||||
|
||||
if ( ! $wxr_version && preg_match( '|<wp:wxr_version>(\d+\.\d+)</wp:wxr_version>|', $importline, $version ) )
|
||||
$wxr_version = $version[1];
|
||||
|
||||
if ( false !== strpos( $importline, '<wp:base_site_url>' ) ) {
|
||||
preg_match( '|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url );
|
||||
$this->base_url = $url[1];
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos( $importline, '<wp:category>' ) ) {
|
||||
preg_match( '|<wp:category>(.*?)</wp:category>|is', $importline, $category );
|
||||
$this->categories[] = $this->process_category( $category[1] );
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos( $importline, '<wp:tag>' ) ) {
|
||||
preg_match( '|<wp:tag>(.*?)</wp:tag>|is', $importline, $tag );
|
||||
$this->tags[] = $this->process_tag( $tag[1] );
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos( $importline, '<wp:term>' ) ) {
|
||||
preg_match( '|<wp:term>(.*?)</wp:term>|is', $importline, $term );
|
||||
$this->terms[] = $this->process_term( $term[1] );
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos( $importline, '<wp:author>' ) ) {
|
||||
preg_match( '|<wp:author>(.*?)</wp:author>|is', $importline, $author );
|
||||
$a = $this->process_author( $author[1] );
|
||||
$this->authors[$a['author_login']] = $a;
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos( $importline, '<item>' ) ) {
|
||||
$post = '';
|
||||
$in_post = true;
|
||||
continue;
|
||||
}
|
||||
if ( false !== strpos( $importline, '</item>' ) ) {
|
||||
$in_post = false;
|
||||
$this->posts[] = $this->process_post( $post );
|
||||
continue;
|
||||
}
|
||||
if ( $in_post ) {
|
||||
$post .= $importline . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$this->fclose($fp);
|
||||
}
|
||||
|
||||
if ( ! $wxr_version )
|
||||
return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) );
|
||||
|
||||
return array(
|
||||
'authors' => $this->authors,
|
||||
'posts' => $this->posts,
|
||||
'categories' => $this->categories,
|
||||
'tags' => $this->tags,
|
||||
'terms' => $this->terms,
|
||||
'base_url' => $this->base_url,
|
||||
'version' => $wxr_version
|
||||
);
|
||||
}
|
||||
|
||||
function get_tag( $string, $tag ) {
|
||||
preg_match( "|<$tag.*?>(.*?)</$tag>|is", $string, $return );
|
||||
if ( isset( $return[1] ) ) {
|
||||
if ( substr( $return[1], 0, 9 ) == '<![CDATA[' ) {
|
||||
if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) {
|
||||
preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches );
|
||||
$return = '';
|
||||
foreach( $matches[1] as $match )
|
||||
$return .= $match;
|
||||
} else {
|
||||
$return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] );
|
||||
}
|
||||
} else {
|
||||
$return = $return[1];
|
||||
}
|
||||
} else {
|
||||
$return = '';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function process_category( $c ) {
|
||||
return array(
|
||||
'term_id' => $this->get_tag( $c, 'wp:term_id' ),
|
||||
'cat_name' => $this->get_tag( $c, 'wp:cat_name' ),
|
||||
'category_nicename' => $this->get_tag( $c, 'wp:category_nicename' ),
|
||||
'category_parent' => $this->get_tag( $c, 'wp:category_parent' ),
|
||||
'category_description' => $this->get_tag( $c, 'wp:category_description' ),
|
||||
);
|
||||
}
|
||||
|
||||
function process_tag( $t ) {
|
||||
return array(
|
||||
'term_id' => $this->get_tag( $t, 'wp:term_id' ),
|
||||
'tag_name' => $this->get_tag( $t, 'wp:tag_name' ),
|
||||
'tag_slug' => $this->get_tag( $t, 'wp:tag_slug' ),
|
||||
'tag_description' => $this->get_tag( $t, 'wp:tag_description' ),
|
||||
);
|
||||
}
|
||||
|
||||
function process_term( $t ) {
|
||||
return array(
|
||||
'term_id' => $this->get_tag( $t, 'wp:term_id' ),
|
||||
'term_taxonomy' => $this->get_tag( $t, 'wp:term_taxonomy' ),
|
||||
'slug' => $this->get_tag( $t, 'wp:term_slug' ),
|
||||
'term_parent' => $this->get_tag( $t, 'wp:term_parent' ),
|
||||
'term_name' => $this->get_tag( $t, 'wp:term_name' ),
|
||||
'term_description' => $this->get_tag( $t, 'wp:term_description' ),
|
||||
);
|
||||
}
|
||||
|
||||
function process_author( $a ) {
|
||||
return array(
|
||||
'author_id' => $this->get_tag( $a, 'wp:author_id' ),
|
||||
'author_login' => $this->get_tag( $a, 'wp:author_login' ),
|
||||
'author_email' => $this->get_tag( $a, 'wp:author_email' ),
|
||||
'author_display_name' => $this->get_tag( $a, 'wp:author_display_name' ),
|
||||
'author_first_name' => $this->get_tag( $a, 'wp:author_first_name' ),
|
||||
'author_last_name' => $this->get_tag( $a, 'wp:author_last_name' ),
|
||||
);
|
||||
}
|
||||
|
||||
function process_post( $post ) {
|
||||
$post_id = $this->get_tag( $post, 'wp:post_id' );
|
||||
$post_title = $this->get_tag( $post, 'title' );
|
||||
$post_date = $this->get_tag( $post, 'wp:post_date' );
|
||||
$post_date_gmt = $this->get_tag( $post, 'wp:post_date_gmt' );
|
||||
$comment_status = $this->get_tag( $post, 'wp:comment_status' );
|
||||
$ping_status = $this->get_tag( $post, 'wp:ping_status' );
|
||||
$status = $this->get_tag( $post, 'wp:status' );
|
||||
$post_name = $this->get_tag( $post, 'wp:post_name' );
|
||||
$post_parent = $this->get_tag( $post, 'wp:post_parent' );
|
||||
$menu_order = $this->get_tag( $post, 'wp:menu_order' );
|
||||
$post_type = $this->get_tag( $post, 'wp:post_type' );
|
||||
$post_password = $this->get_tag( $post, 'wp:post_password' );
|
||||
$is_sticky = $this->get_tag( $post, 'wp:is_sticky' );
|
||||
$guid = $this->get_tag( $post, 'guid' );
|
||||
$post_author = $this->get_tag( $post, 'dc:creator' );
|
||||
|
||||
$post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
|
||||
$post_excerpt = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_excerpt );
|
||||
$post_excerpt = str_replace( '<br>', '<br />', $post_excerpt );
|
||||
$post_excerpt = str_replace( '<hr>', '<hr />', $post_excerpt );
|
||||
|
||||
$post_content = $this->get_tag( $post, 'content:encoded' );
|
||||
$post_content = preg_replace_callback( '|<(/?[A-Z]+)|', array( &$this, '_normalize_tag' ), $post_content );
|
||||
$post_content = str_replace( '<br>', '<br />', $post_content );
|
||||
$post_content = str_replace( '<hr>', '<hr />', $post_content );
|
||||
|
||||
$postdata = compact( 'post_id', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt',
|
||||
'post_title', 'status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent',
|
||||
'menu_order', 'post_type', 'post_password', 'is_sticky'
|
||||
);
|
||||
|
||||
$attachment_url = $this->get_tag( $post, 'wp:attachment_url' );
|
||||
if ( $attachment_url )
|
||||
$postdata['attachment_url'] = $attachment_url;
|
||||
|
||||
preg_match_all( '|<category domain="([^"]+?)" nicename="([^"]+?)">(.+?)</category>|is', $post, $terms, PREG_SET_ORDER );
|
||||
foreach ( $terms as $t ) {
|
||||
$post_terms[] = array(
|
||||
'slug' => $t[2],
|
||||
'domain' => $t[1],
|
||||
'name' => str_replace( array( '<![CDATA[', ']]>' ), '', $t[3] ),
|
||||
);
|
||||
}
|
||||
if ( ! empty( $post_terms ) ) $postdata['terms'] = $post_terms;
|
||||
|
||||
preg_match_all( '|<wp:comment>(.+?)</wp:comment>|is', $post, $comments );
|
||||
$comments = $comments[1];
|
||||
if ( $comments ) {
|
||||
foreach ( $comments as $comment ) {
|
||||
preg_match_all( '|<wp:commentmeta>(.+?)</wp:commentmeta>|is', $comment, $commentmeta );
|
||||
$commentmeta = $commentmeta[1];
|
||||
$c_meta = array();
|
||||
foreach ( $commentmeta as $m ) {
|
||||
$c_meta[] = array(
|
||||
'key' => $this->get_tag( $m, 'wp:meta_key' ),
|
||||
'value' => $this->get_tag( $m, 'wp:meta_value' ),
|
||||
);
|
||||
}
|
||||
|
||||
$post_comments[] = array(
|
||||
'comment_id' => $this->get_tag( $comment, 'wp:comment_id' ),
|
||||
'comment_author' => $this->get_tag( $comment, 'wp:comment_author' ),
|
||||
'comment_author_email' => $this->get_tag( $comment, 'wp:comment_author_email' ),
|
||||
'comment_author_IP' => $this->get_tag( $comment, 'wp:comment_author_IP' ),
|
||||
'comment_author_url' => $this->get_tag( $comment, 'wp:comment_author_url' ),
|
||||
'comment_date' => $this->get_tag( $comment, 'wp:comment_date' ),
|
||||
'comment_date_gmt' => $this->get_tag( $comment, 'wp:comment_date_gmt' ),
|
||||
'comment_content' => $this->get_tag( $comment, 'wp:comment_content' ),
|
||||
'comment_approved' => $this->get_tag( $comment, 'wp:comment_approved' ),
|
||||
'comment_type' => $this->get_tag( $comment, 'wp:comment_type' ),
|
||||
'comment_parent' => $this->get_tag( $comment, 'wp:comment_parent' ),
|
||||
'comment_user_id' => $this->get_tag( $comment, 'wp:comment_user_id' ),
|
||||
'commentmeta' => $c_meta,
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( ! empty( $post_comments ) ) $postdata['comments'] = $post_comments;
|
||||
|
||||
preg_match_all( '|<wp:postmeta>(.+?)</wp:postmeta>|is', $post, $postmeta );
|
||||
$postmeta = $postmeta[1];
|
||||
if ( $postmeta ) {
|
||||
foreach ( $postmeta as $p ) {
|
||||
$post_postmeta[] = array(
|
||||
'key' => $this->get_tag( $p, 'wp:meta_key' ),
|
||||
'value' => $this->get_tag( $p, 'wp:meta_value' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( ! empty( $post_postmeta ) ) $postdata['postmeta'] = $post_postmeta;
|
||||
|
||||
return $postdata;
|
||||
}
|
||||
|
||||
function _normalize_tag( $matches ) {
|
||||
return '<' . strtolower( $matches[1] );
|
||||
}
|
||||
|
||||
function fopen( $filename, $mode = 'r' ) {
|
||||
if ( $this->has_gzip )
|
||||
return gzopen( $filename, $mode );
|
||||
return fopen( $filename, $mode );
|
||||
}
|
||||
|
||||
function feof( $fp ) {
|
||||
if ( $this->has_gzip )
|
||||
return gzeof( $fp );
|
||||
return feof( $fp );
|
||||
}
|
||||
|
||||
function fgets( $fp, $len = 8192 ) {
|
||||
if ( $this->has_gzip )
|
||||
return gzgets( $fp, $len );
|
||||
return fgets( $fp, $len );
|
||||
}
|
||||
|
||||
function fclose( $fp ) {
|
||||
if ( $this->has_gzip )
|
||||
return gzclose( $fp );
|
||||
return fclose( $fp );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
=== WordPress Importer ===
|
||||
Contributors: wordpressdotorg
|
||||
Donate link:
|
||||
Tags: importer, wordpress
|
||||
Requires at least: 3.0
|
||||
Tested up to: 3.8
|
||||
Stable tag: 0.6.1
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
|
||||
|
||||
== Description ==
|
||||
|
||||
The WordPress Importer will import the following content from a WordPress export file:
|
||||
|
||||
* Posts, pages and other custom post types
|
||||
* Comments
|
||||
* Custom fields and post meta
|
||||
* Categories, tags and terms from custom taxonomies
|
||||
* Authors
|
||||
|
||||
For further information and instructions please see the [Codex page on Importing Content](http://codex.wordpress.org/Importing_Content#WordPress)
|
||||
|
||||
== Installation ==
|
||||
|
||||
The quickest method for installing the importer is:
|
||||
|
||||
1. Visit Tools -> Import in the WordPress dashboard
|
||||
1. Click on the WordPress link in the list of importers
|
||||
1. Click "Install Now"
|
||||
1. Finally click "Activate Plugin & Run Importer"
|
||||
|
||||
If you would prefer to do things manually then follow these instructions:
|
||||
|
||||
1. Upload the `wordpress-importer` folder to the `/wp-content/plugins/` directory
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
1. Go to the Tools -> Import screen, click on WordPress
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.6 =
|
||||
* Support for WXR 1.2 and multiple CDATA sections
|
||||
* Post aren't duplicates if their post_type's are different
|
||||
|
||||
= 0.5.2 =
|
||||
* Double check that the uploaded export file exists before processing it. This prevents incorrect error messages when
|
||||
an export file is uploaded to a server with bad permissions and WordPress 3.3 or 3.3.1 is being used.
|
||||
|
||||
= 0.5 =
|
||||
* Import comment meta (requires export from WordPress 3.2)
|
||||
* Minor bugfixes and enhancements
|
||||
|
||||
= 0.4 =
|
||||
* Map comment user_id where possible
|
||||
* Import attachments from `wp:attachment_url`
|
||||
* Upload attachments to correct directory
|
||||
* Remap resized image URLs correctly
|
||||
|
||||
= 0.3 =
|
||||
* Use an XML Parser if possible
|
||||
* Proper import support for nav menus
|
||||
* ... and much more, see [Trac ticket #15197](http://core.trac.wordpress.org/ticket/15197)
|
||||
|
||||
= 0.1 =
|
||||
* Initial release
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 0.6 =
|
||||
Support for exports from WordPress 3.4.
|
||||
|
||||
= 0.5.2 =
|
||||
Fix incorrect error message when the export file could not be uploaded.
|
||||
|
||||
= 0.5 =
|
||||
Import comment meta and other minor bugfixes and enhancements.
|
||||
|
||||
= 0.4 =
|
||||
Bug fixes for attachment importing and other small enhancements.
|
||||
|
||||
= 0.3 =
|
||||
Upgrade for a more robust and reliable experience when importing WordPress export files, and for compatibility with WordPress 3.1.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Help! I'm getting out of memory errors or a blank screen. =
|
||||
If your exported file is very large, the import script may run into your host's configured memory limit for PHP.
|
||||
|
||||
A message like "Fatal error: Allowed memory size of 8388608 bytes exhausted" indicates that the script can't successfully import your XML file under the current PHP memory limit. If you have access to the php.ini file, you can manually increase the limit; if you do not (your WordPress installation is hosted on a shared server, for instance), you might have to break your exported XML file into several smaller pieces and run the import script one at a time.
|
||||
|
||||
For those with shared hosting, the best alternative may be to consult hosting support to determine the safest approach for running the import. A host may be willing to temporarily lift the memory limit and/or run the process directly from their end.
|
||||
|
||||
-- [WordPress Codex: Importing Content](http://codex.wordpress.org/Importing_Content#Before_Importing)
|
||||
|
||||
== Filters ==
|
||||
|
||||
The importer has a couple of filters to allow you to completely enable/block certain features:
|
||||
|
||||
* `import_allow_create_users`: return false if you only want to allow mapping to existing users
|
||||
* `import_allow_fetch_attachments`: return false if you do not wish to allow importing and downloading of attachments
|
||||
* `import_attachment_size_limit`: return an integer value for the maximum file size in bytes to save (default is 0, which is unlimited)
|
||||
|
||||
There are also a few actions available to hook into:
|
||||
|
||||
* `import_start`: occurs after the export file has been uploaded and author import settings have been chosen
|
||||
* `import_end`: called after the last output from the importer
|
||||