Version Description
- Removed deprecated function $wpdb->escape(), replaced with esc_sql()
- Add German translation, thanks to Ulrich Pogson
- Updated screenshot-1.png
- Renamed default localization file
- Fixed broken if conditional during code clean up for version 2.2
Download this release
Release Info
Developer | mousesports |
Plugin | WordPress Database Reset |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 2.3
- css/jquery.bsmselect.css +76 -76
- css/wp-reset.css +15 -15
- js/jquery.bsmselect.compatibility.js +60 -60
- js/jquery.bsmselect.js +381 -381
- languages/default.mo +0 -0
- languages/{default.po → wordpress-database-reset.pot} +81 -81
- languages/wp-reset-de_DE.mo +0 -0
- languages/wp-reset-de_DE.po +114 -0
- languages/wp-reset-fr_FR.po +82 -82
- languages/wp-reset-pt_BR.po +119 -119
- readme.txt +17 -12
- screenshot-1.png +0 -0
- wp-reset.php +411 -471
css/jquery.bsmselect.css
CHANGED
@@ -1,76 +1,76 @@
|
|
1 |
-
.bsmContainer {
|
2 |
-
/* container that surrounds entire bsmSelect widget */
|
3 |
-
color: #555;
|
4 |
-
}
|
5 |
-
|
6 |
-
.bsmSelect {
|
7 |
-
/* the newly created regular 'select' */
|
8 |
-
display: inline;
|
9 |
-
}
|
10 |
-
|
11 |
-
.bsmOptionDisabled {
|
12 |
-
/* disabled options in new select */
|
13 |
-
color: #999;
|
14 |
-
}
|
15 |
-
|
16 |
-
.bsmHighlight {
|
17 |
-
/* the highlight span */
|
18 |
-
float: right;
|
19 |
-
padding: 0;
|
20 |
-
margin: 0 0 0 1em;
|
21 |
-
}
|
22 |
-
|
23 |
-
.bsmList {
|
24 |
-
/* html list that contains selected items */
|
25 |
-
border-color: #DFDFDF;
|
26 |
-
margin: 0.25em 0 1.5em 0;
|
27 |
-
position: relative;
|
28 |
-
display: block;
|
29 |
-
padding-left: 0;
|
30 |
-
list-style: none;
|
31 |
-
width: 287px;
|
32 |
-
}
|
33 |
-
|
34 |
-
.bsmListItem {
|
35 |
-
/* li item from the html list above */
|
36 |
-
position: relative;
|
37 |
-
margin-left: 0;
|
38 |
-
padding-left: 0;
|
39 |
-
list-style: none;
|
40 |
-
background: #FCFCFC;
|
41 |
-
border: 1px solid #DFDFDF;
|
42 |
-
width: 100%;
|
43 |
-
margin: 0 0 -1px 0;
|
44 |
-
line-height: 1em;
|
45 |
-
}
|
46 |
-
|
47 |
-
.bsmListItem:hover {
|
48 |
-
background-color: #F0F0F0;
|
49 |
-
}
|
50 |
-
|
51 |
-
.bsmListItemLabel {
|
52 |
-
/* this is a span that surrounds the text in the item, except for the remove link */
|
53 |
-
padding: 5px;
|
54 |
-
display: block;
|
55 |
-
}
|
56 |
-
|
57 |
-
.bsmListSortable .bsmListItemLabel {
|
58 |
-
cursor: move;
|
59 |
-
}
|
60 |
-
|
61 |
-
.bsmListItemRemove {
|
62 |
-
/* the remove link in each list item */
|
63 |
-
text-decoration: none;
|
64 |
-
position: absolute;
|
65 |
-
right: 0;
|
66 |
-
top: 0;
|
67 |
-
padding: 5px;
|
68 |
-
}
|
69 |
-
|
70 |
-
.bsmListItemRemove:hover {
|
71 |
-
text-decoration: underline;
|
72 |
-
}
|
73 |
-
|
74 |
-
#bsmListbsmContainer0 {
|
75 |
-
margin-top: 12px;
|
76 |
-
}
|
1 |
+
.bsmContainer {
|
2 |
+
/* container that surrounds entire bsmSelect widget */
|
3 |
+
color: #555;
|
4 |
+
}
|
5 |
+
|
6 |
+
.bsmSelect {
|
7 |
+
/* the newly created regular 'select' */
|
8 |
+
display: inline;
|
9 |
+
}
|
10 |
+
|
11 |
+
.bsmOptionDisabled {
|
12 |
+
/* disabled options in new select */
|
13 |
+
color: #999;
|
14 |
+
}
|
15 |
+
|
16 |
+
.bsmHighlight {
|
17 |
+
/* the highlight span */
|
18 |
+
float: right;
|
19 |
+
padding: 0;
|
20 |
+
margin: 0 0 0 1em;
|
21 |
+
}
|
22 |
+
|
23 |
+
.bsmList {
|
24 |
+
/* html list that contains selected items */
|
25 |
+
border-color: #DFDFDF;
|
26 |
+
margin: 0.25em 0 1.5em 0;
|
27 |
+
position: relative;
|
28 |
+
display: block;
|
29 |
+
padding-left: 0;
|
30 |
+
list-style: none;
|
31 |
+
width: 287px;
|
32 |
+
}
|
33 |
+
|
34 |
+
.bsmListItem {
|
35 |
+
/* li item from the html list above */
|
36 |
+
position: relative;
|
37 |
+
margin-left: 0;
|
38 |
+
padding-left: 0;
|
39 |
+
list-style: none;
|
40 |
+
background: #FCFCFC;
|
41 |
+
border: 1px solid #DFDFDF;
|
42 |
+
width: 100%;
|
43 |
+
margin: 0 0 -1px 0;
|
44 |
+
line-height: 1em;
|
45 |
+
}
|
46 |
+
|
47 |
+
.bsmListItem:hover {
|
48 |
+
background-color: #F0F0F0;
|
49 |
+
}
|
50 |
+
|
51 |
+
.bsmListItemLabel {
|
52 |
+
/* this is a span that surrounds the text in the item, except for the remove link */
|
53 |
+
padding: 5px;
|
54 |
+
display: block;
|
55 |
+
}
|
56 |
+
|
57 |
+
.bsmListSortable .bsmListItemLabel {
|
58 |
+
cursor: move;
|
59 |
+
}
|
60 |
+
|
61 |
+
.bsmListItemRemove {
|
62 |
+
/* the remove link in each list item */
|
63 |
+
text-decoration: none;
|
64 |
+
position: absolute;
|
65 |
+
right: 0;
|
66 |
+
top: 0;
|
67 |
+
padding: 5px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.bsmListItemRemove:hover {
|
71 |
+
text-decoration: underline;
|
72 |
+
}
|
73 |
+
|
74 |
+
#bsmListbsmContainer0 {
|
75 |
+
margin-top: 12px;
|
76 |
+
}
|
css/wp-reset.css
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
#select-buttons {
|
2 |
-
width: 208px;
|
3 |
-
}
|
4 |
-
|
5 |
-
#select-all {
|
6 |
-
float: right;
|
7 |
-
margin-top: 4px;
|
8 |
-
}
|
9 |
-
|
10 |
-
#loader {
|
11 |
-
position: absolute;
|
12 |
-
margin-left: 10px;
|
13 |
-
margin-top: 1px;
|
14 |
-
}
|
15 |
-
|
16 |
#reactivate {color: #21759B}
|
1 |
+
#select-buttons {
|
2 |
+
width: 208px;
|
3 |
+
}
|
4 |
+
|
5 |
+
#select-all {
|
6 |
+
float: right;
|
7 |
+
margin-top: 4px;
|
8 |
+
}
|
9 |
+
|
10 |
+
#loader {
|
11 |
+
position: absolute;
|
12 |
+
margin-left: 10px;
|
13 |
+
margin-top: 1px;
|
14 |
+
}
|
15 |
+
|
16 |
#reactivate {color: #21759B}
|
js/jquery.bsmselect.compatibility.js
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
/*
|
2 |
-
* Better Select Multiple Compatibility Plugin - jQuery Plugin
|
3 |
-
*
|
4 |
-
* Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
|
5 |
-
*
|
6 |
-
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
7 |
-
*
|
8 |
-
* version: v1.0.0 - 2010-09-05
|
9 |
-
*/
|
10 |
-
(function($) {
|
11 |
-
$.bsmSelect.plugins.compatibility = function()
|
12 |
-
{
|
13 |
-
if (!(this instanceof arguments.callee)) {
|
14 |
-
return new arguments.callee();
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
$.extend($.bsmSelect.plugins.compatibility.prototype, {
|
19 |
-
init: function(bsm) {
|
20 |
-
|
21 |
-
var o = bsm.options;
|
22 |
-
|
23 |
-
if (typeof o.animate != 'undefined')
|
24 |
-
{
|
25 |
-
if (o.animate === true) {
|
26 |
-
o.showEffect = $.bsmSelect.effects.verticalListAdd;
|
27 |
-
o.hideEffect = $.bsmSelect.effects.verticalListRemove;
|
28 |
-
} else if ($.isFunction(o.animate.add)) {
|
29 |
-
o.showEffect = o.animate.add;
|
30 |
-
} else if (typeof(o.animate.add) == 'string' && $.isFunction($.bsmSelect.effects[o.animate.add])) {
|
31 |
-
o.showEffect = $.bsmSelect.effects[o.animate.add];
|
32 |
-
} else {
|
33 |
-
o.showEffect = $.bsmSelect.effects.show;
|
34 |
-
}
|
35 |
-
|
36 |
-
if ($.isFunction(o.animate.drop)) {
|
37 |
-
o.hideEffect = o.animate.drop;
|
38 |
-
} else if (typeof(o.animate.drop) == 'string' && $.isFunction($.bsmSelect.effects[o.animate.drop])) {
|
39 |
-
o.hideEffect = $.bsmSelect.effects[o.animate.drop];
|
40 |
-
} else {
|
41 |
-
o.hideEffect = $.bsmSelect.effects.remove;
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
if (typeof o.highlight != 'undefined')
|
46 |
-
{
|
47 |
-
if (o.highlight === true) {
|
48 |
-
o.highlightEffect = $.bsmSelect.effects.highlight;
|
49 |
-
} else if ($.isFunction(o.highlight)) {
|
50 |
-
o.highlightEffect = o.highlight;
|
51 |
-
} else if (typeof(o.highlight) == 'string' && $.isFunction($.bsmSelect.effects[o.highlight])) {
|
52 |
-
o.highlightEffect = $.bsmSelect.effects[o.highlight];
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
});
|
59 |
-
})(jQuery);
|
60 |
-
|
1 |
+
/*
|
2 |
+
* Better Select Multiple Compatibility Plugin - jQuery Plugin
|
3 |
+
*
|
4 |
+
* Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
|
5 |
+
*
|
6 |
+
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
7 |
+
*
|
8 |
+
* version: v1.0.0 - 2010-09-05
|
9 |
+
*/
|
10 |
+
(function($) {
|
11 |
+
$.bsmSelect.plugins.compatibility = function()
|
12 |
+
{
|
13 |
+
if (!(this instanceof arguments.callee)) {
|
14 |
+
return new arguments.callee();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
$.extend($.bsmSelect.plugins.compatibility.prototype, {
|
19 |
+
init: function(bsm) {
|
20 |
+
|
21 |
+
var o = bsm.options;
|
22 |
+
|
23 |
+
if (typeof o.animate != 'undefined')
|
24 |
+
{
|
25 |
+
if (o.animate === true) {
|
26 |
+
o.showEffect = $.bsmSelect.effects.verticalListAdd;
|
27 |
+
o.hideEffect = $.bsmSelect.effects.verticalListRemove;
|
28 |
+
} else if ($.isFunction(o.animate.add)) {
|
29 |
+
o.showEffect = o.animate.add;
|
30 |
+
} else if (typeof(o.animate.add) == 'string' && $.isFunction($.bsmSelect.effects[o.animate.add])) {
|
31 |
+
o.showEffect = $.bsmSelect.effects[o.animate.add];
|
32 |
+
} else {
|
33 |
+
o.showEffect = $.bsmSelect.effects.show;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($.isFunction(o.animate.drop)) {
|
37 |
+
o.hideEffect = o.animate.drop;
|
38 |
+
} else if (typeof(o.animate.drop) == 'string' && $.isFunction($.bsmSelect.effects[o.animate.drop])) {
|
39 |
+
o.hideEffect = $.bsmSelect.effects[o.animate.drop];
|
40 |
+
} else {
|
41 |
+
o.hideEffect = $.bsmSelect.effects.remove;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
if (typeof o.highlight != 'undefined')
|
46 |
+
{
|
47 |
+
if (o.highlight === true) {
|
48 |
+
o.highlightEffect = $.bsmSelect.effects.highlight;
|
49 |
+
} else if ($.isFunction(o.highlight)) {
|
50 |
+
o.highlightEffect = o.highlight;
|
51 |
+
} else if (typeof(o.highlight) == 'string' && $.isFunction($.bsmSelect.effects[o.highlight])) {
|
52 |
+
o.highlightEffect = $.bsmSelect.effects[o.highlight];
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
});
|
59 |
+
})(jQuery);
|
60 |
+
|
js/jquery.bsmselect.js
CHANGED
@@ -1,381 +1,381 @@
|
|
1 |
-
/*
|
2 |
-
* Better Select Multiple - jQuery Plugin
|
3 |
-
*
|
4 |
-
* based on Alternate Select Multiple (asmSelect) 1.0.4a beta (http://www.ryancramer.com/projects/asmselect/)
|
5 |
-
*
|
6 |
-
* Copyright (c) 2009 by Ryan Cramer - http://www.ryancramer.com
|
7 |
-
* Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
|
8 |
-
*
|
9 |
-
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
10 |
-
*
|
11 |
-
* bsmSelect version: v1.4.3 - 2011-05-05
|
12 |
-
*/
|
13 |
-
|
14 |
-
(function($) {
|
15 |
-
|
16 |
-
function BsmSelect(target, options)
|
17 |
-
{
|
18 |
-
this.$original = $(target); // the original select multiple
|
19 |
-
this.buildingSelect = false; // is the new select being constructed right now?
|
20 |
-
this.ieClick = false; // in IE, has a click event occurred? ignore if not
|
21 |
-
this.ignoreOriginalChangeEvent = false; // originalChangeEvent bypassed when this is true
|
22 |
-
this.options = options;
|
23 |
-
this.buildDom();
|
24 |
-
}
|
25 |
-
|
26 |
-
BsmSelect.prototype = {
|
27 |
-
/**
|
28 |
-
* Generate an UID
|
29 |
-
*/
|
30 |
-
generateUid: function(index) {
|
31 |
-
return (this.uid = this.options.containerClass + index);
|
32 |
-
},
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Build the DOM for bsmSelect
|
36 |
-
*/
|
37 |
-
buildDom: function() {
|
38 |
-
var self = this, o = this.options;
|
39 |
-
|
40 |
-
if (o.addItemTarget === 'original') {
|
41 |
-
$('option', this.$original).each(function(i, o) {
|
42 |
-
if ($(o).data('bsm-order') === null) { $(o).data('bsm-order', i); }
|
43 |
-
});
|
44 |
-
}
|
45 |
-
|
46 |
-
for (var index = 0; $('#' + this.generateUid(index)).size(); index++) {}
|
47 |
-
|
48 |
-
this.$select = $('<select>', {
|
49 |
-
'class': o.selectClass,
|
50 |
-
name: o.selectClass + this.uid,
|
51 |
-
id: o.selectClass + this.uid,
|
52 |
-
change: $.proxy(this.selectChangeEvent, this),
|
53 |
-
click: $.proxy(this.selectClickEvent, this)
|
54 |
-
});
|
55 |
-
|
56 |
-
this.$list = $.isFunction(o.listType)
|
57 |
-
? o.listType(this.$original)
|
58 |
-
: $('<' + o.listType + '>', { id: o.listClass + this.uid });
|
59 |
-
|
60 |
-
this.$list.addClass(o.listClass);
|
61 |
-
|
62 |
-
this.$container = $('<div>', { 'class': o.containerClass, id: this.uid });
|
63 |
-
|
64 |
-
this.buildSelect();
|
65 |
-
|
66 |
-
this.$original.change($.proxy(this.originalChangeEvent, this)).wrap(this.$container).before(this.$select);
|
67 |
-
|
68 |
-
// if the list isn't already in the document, add it (it might be inserted by a custom callback)
|
69 |
-
if (!this.$list.parent().length) { this.$original.before(this.$list); }
|
70 |
-
|
71 |
-
if (this.$original.attr('id')) {
|
72 |
-
$('label[for=' + this.$original.attr('id') + ']').attr('for', this.$select.attr('id'));
|
73 |
-
}
|
74 |
-
|
75 |
-
// set up remove event (may be a link, or the list item itself)
|
76 |
-
this.$list.delegate('.' + o.removeClass, 'click', function() {
|
77 |
-
self.dropListItem($(this).closest('li'));
|
78 |
-
return false;
|
79 |
-
});
|
80 |
-
|
81 |
-
$.each(o.plugins, function() { this.init(self); });
|
82 |
-
},
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Triggered when an item has been selected
|
86 |
-
* Check to make sure it's not an IE screwup, and add it to the list
|
87 |
-
*/
|
88 |
-
selectChangeEvent: function() {
|
89 |
-
if ($.browser.msie && $.browser.version < 7 && !this.ieClick) { return; }
|
90 |
-
var bsmOpt = $('option:selected:eq(0)', this.$select);
|
91 |
-
if (bsmOpt.data('orig-option')) {
|
92 |
-
this.addListItem(bsmOpt);
|
93 |
-
this.triggerOriginalChange(bsmOpt.data('orig-option'), 'add');
|
94 |
-
}
|
95 |
-
this.ieClick = false;
|
96 |
-
},
|
97 |
-
|
98 |
-
/**
|
99 |
-
* IE6 lets you scroll around in a select without it being pulled down
|
100 |
-
* making sure a click preceded the change() event reduces the chance
|
101 |
-
* if unintended items being added. there may be a better solution?
|
102 |
-
*/
|
103 |
-
selectClickEvent: function() {
|
104 |
-
this.ieClick = true;
|
105 |
-
},
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Rebuild bsmSelect when the 'change' event is triggered on the original select
|
109 |
-
*/
|
110 |
-
originalChangeEvent: function() {
|
111 |
-
if (this.ignoreOriginalChangeEvent) {
|
112 |
-
// We don't want to rebuild everything when an item is added / droped
|
113 |
-
this.ignoreOriginalChangeEvent = false;
|
114 |
-
} else {
|
115 |
-
this.buildSelect();
|
116 |
-
// opera has an issue where it needs a force redraw, otherwise
|
117 |
-
// the items won't appear until something else forces a redraw
|
118 |
-
if ($.browser.opera) { this.$list.hide().show(); }
|
119 |
-
}
|
120 |
-
},
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Build the DOM for the new select
|
124 |
-
*/
|
125 |
-
buildSelect: function() {
|
126 |
-
var self = this;
|
127 |
-
|
128 |
-
this.buildingSelect = true;
|
129 |
-
|
130 |
-
// add a first option to be the home option / default selectLabel
|
131 |
-
this.$select.empty().prepend($('<option value=""></option>').text(this.$original.attr('title') || this.options.title));
|
132 |
-
this.$list.empty();
|
133 |
-
|
134 |
-
this.$original.children().each(function() {
|
135 |
-
if ($(this).is('option')) {
|
136 |
-
self.addSelectOption(self.$select, $(this));
|
137 |
-
} else if ($(this).is('optgroup')) {
|
138 |
-
self.addSelectOptionGroup(self.$select, $(this));
|
139 |
-
}
|
140 |
-
});
|
141 |
-
|
142 |
-
if (!this.options.debugMode) { this.$original.hide(); }
|
143 |
-
this.selectFirstItem();
|
144 |
-
this.buildingSelect = false;
|
145 |
-
},
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Append an option to the new select
|
149 |
-
*
|
150 |
-
* @param {jQuery} $parent Where to append the option
|
151 |
-
* @param {jQuery} $origOpt Option from the original select
|
152 |
-
*/
|
153 |
-
addSelectOption: function ($parent, $origOpt) {
|
154 |
-
var $bsmOpt = $('<option>', {
|
155 |
-
text: $origOpt.text(),
|
156 |
-
val: $origOpt.val() }).appendTo($parent).data('orig-option', $origOpt),
|
157 |
-
isSelected = $origOpt.is(':selected'),
|
158 |
-
isDisabled = $origOpt.is(':disabled');
|
159 |
-
$origOpt.data('bsm-option', $bsmOpt);
|
160 |
-
if (isSelected && !isDisabled) {
|
161 |
-
this.addListItem($bsmOpt);
|
162 |
-
this.disableSelectOption($bsmOpt);
|
163 |
-
} else if (!isSelected && isDisabled) {
|
164 |
-
this.disableSelectOption($bsmOpt);
|
165 |
-
}
|
166 |
-
},
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Append an option group to the new select
|
170 |
-
*
|
171 |
-
* @param {jQuery} $parent Where to append the group
|
172 |
-
* @param {jQuery} $group Model group from the original select
|
173 |
-
*/
|
174 |
-
addSelectOptionGroup: function($parent, $group)
|
175 |
-
{
|
176 |
-
var self = this,
|
177 |
-
$G = $('<optgroup>', { label: $group.attr('label')} ).appendTo($parent);
|
178 |
-
if ($group.is(':disabled')) { $G.attr('disabled', 'disabled'); }
|
179 |
-
$('option', $group).each(function() { self.addSelectOption($G, $(this)); });
|
180 |
-
},
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Select the first item of the new select
|
184 |
-
*/
|
185 |
-
selectFirstItem: function() {
|
186 |
-
$('option:eq(0)', this.$select).attr('selected', 'selected');
|
187 |
-
},
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Make an option disabled, indicating that it's already been selected
|
191 |
-
* because safari is the only browser that makes disabled items look 'disabled'
|
192 |
-
* we apply a class that reproduces the disabled look in other browsers
|
193 |
-
*
|
194 |
-
* @param {jQuery} $bsmOpt Option from the new select
|
195 |
-
*/
|
196 |
-
disableSelectOption: function($bsmOpt) {
|
197 |
-
$bsmOpt.addClass(this.options.optionDisabledClass)
|
198 |
-
.removeAttr('selected')
|
199 |
-
.attr('disabled', 'disabled')
|
200 |
-
.toggle(!this.options.hideWhenAdded);
|
201 |
-
if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display
|
202 |
-
},
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Enable a select option
|
206 |
-
*
|
207 |
-
* @param {jQuery} $bsmOpt Option from the new select
|
208 |
-
*/
|
209 |
-
enableSelectOption: function($bsmOpt) {
|
210 |
-
$bsmOpt.removeClass(this.options.optionDisabledClass)
|
211 |
-
.removeAttr('disabled')
|
212 |
-
.toggle(!this.options.hideWhenAdded);
|
213 |
-
if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display
|
214 |
-
},
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Append an item corresponding to the option to the list
|
218 |
-
*
|
219 |
-
* @param {jQuery} $bsmOpt Option from the new select
|
220 |
-
*/
|
221 |
-
addListItem: function($bsmOpt) {
|
222 |
-
var $item,
|
223 |
-
$origOpt = $bsmOpt.data('orig-option'),
|
224 |
-
o = this.options;
|
225 |
-
|
226 |
-
if (!$origOpt) { return; } // this is the first item, selectLabel
|
227 |
-
|
228 |
-
if (!this.buildingSelect) {
|
229 |
-
if ($origOpt.is(':selected')) { return; } // already have it
|
230 |
-
$origOpt.attr('selected', 'selected');
|
231 |
-
}
|
232 |
-
|
233 |
-
$item = $('<li>', { 'class': o.listItemClass })
|
234 |
-
.append($('<span>', { 'class': o.listItemLabelClass, html: o.extractLabel($bsmOpt, o)}))
|
235 |
-
.append($('<a>', { href: '#', 'class': o.removeClass, html: o.removeLabel }))
|
236 |
-
.data('bsm-option', $bsmOpt);
|
237 |
-
|
238 |
-
this.disableSelectOption($bsmOpt.data('item', $item));
|
239 |
-
|
240 |
-
switch (o.addItemTarget) {
|
241 |
-
case 'bottom':
|
242 |
-
this.$list.append($item.hide());
|
243 |
-
break;
|
244 |
-
case 'original':
|
245 |
-
var order = $origOpt.data('bsm-order'), inserted = false;
|
246 |
-
$('.' + o.listItemClass, this.$list).each(function() {
|
247 |
-
if (order < $(this).data('bsm-option').data('orig-option').data('bsm-order')) {
|
248 |
-
$item.hide().insertBefore(this);
|
249 |
-
inserted = true;
|
250 |
-
return false;
|
251 |
-
}
|
252 |
-
});
|
253 |
-
if (!inserted) { this.$list.append($item.hide()); }
|
254 |
-
break;
|
255 |
-
default:
|
256 |
-
this.$list.prepend($item.hide());
|
257 |
-
}
|
258 |
-
|
259 |
-
if (this.buildingSelect) {
|
260 |
-
$.bsmSelect.effects.show($item);
|
261 |
-
} else {
|
262 |
-
o.showEffect($item);
|
263 |
-
o.highlightEffect(this.$select, $item, o.highlightAddedLabel, this.options);
|
264 |
-
this.selectFirstItem();
|
265 |
-
}
|
266 |
-
},
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Remove an item from the list of selection
|
270 |
-
*
|
271 |
-
* @param {jQuey} $item A list item
|
272 |
-
*/
|
273 |
-
dropListItem: function($item) {
|
274 |
-
var $bsmOpt = $item.data('bsm-option'), o = this.options;
|
275 |
-
$bsmOpt.removeData('item').data('orig-option').removeAttr('selected');
|
276 |
-
(this.buildingSelect ? $.bsmSelect.effects.remove : o.hideEffect)($item);
|
277 |
-
this.enableSelectOption($bsmOpt);
|
278 |
-
o.highlightEffect(this.$select, $item, o.highlightRemovedLabel, o);
|
279 |
-
this.triggerOriginalChange($bsmOpt.data('orig-option'), 'drop');
|
280 |
-
},
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Trigger a change event on the original select multiple
|
284 |
-
* so that other scripts can pick them up
|
285 |
-
*
|
286 |
-
* @param {jQuery} $origOpt The option from the original select
|
287 |
-
* @param {String} type Event type
|
288 |
-
*/
|
289 |
-
triggerOriginalChange: function($origOpt, type) {
|
290 |
-
this.ignoreOriginalChangeEvent = true;
|
291 |
-
this.$original.trigger('change', [{
|
292 |
-
option: $origOpt,
|
293 |
-
value: $origOpt.val(),
|
294 |
-
item: $origOpt.data('bsm-option').data('item'),
|
295 |
-
type: type
|
296 |
-
}]);
|
297 |
-
}
|
298 |
-
};
|
299 |
-
|
300 |
-
$.fn.bsmSelect = function(customOptions) {
|
301 |
-
var options = $.extend({}, $.bsmSelect.conf, customOptions);
|
302 |
-
return this.each(function() {
|
303 |
-
var bsm = $(this).data("bsmSelect");
|
304 |
-
if (!bsm) {
|
305 |
-
bsm = new BsmSelect($(this), options);
|
306 |
-
$(this).data("bsmSelect", bsm);
|
307 |
-
}
|
308 |
-
});
|
309 |
-
};
|
310 |
-
|
311 |
-
$.bsmSelect = {};
|
312 |
-
$.extend($.bsmSelect, {
|
313 |
-
effects: {
|
314 |
-
show: function($el) { $el.show(); },
|
315 |
-
|
316 |
-
remove: function($el) { $el.remove(); },
|
317 |
-
|
318 |
-
highlight: function ($select, $item, label, conf) {
|
319 |
-
var $highlight,
|
320 |
-
id = $select.attr('id') + conf.highlightClass;
|
321 |
-
$('#' + id).remove();
|
322 |
-
$highlight = $('<span>', {
|
323 |
-
'class': conf.highlightClass,
|
324 |
-
id: id,
|
325 |
-
html: label + $item.children('.' + conf.listItemLabelClass).first().text()
|
326 |
-
}).hide();
|
327 |
-
$select.after($highlight.fadeIn('fast').delay(50).fadeOut('slow', function() { $(this).remove(); }));
|
328 |
-
},
|
329 |
-
|
330 |
-
verticalListAdd: function ($el) {
|
331 |
-
$el.animate({ opacity: 'show', height: 'show' }, 100, function() {
|
332 |
-
$(this).animate({ height: '+=2px' }, 100, function() {
|
333 |
-
$(this).animate({ height: '-=2px' }, 100);
|
334 |
-
});
|
335 |
-
});
|
336 |
-
},
|
337 |
-
|
338 |
-
verticalListRemove: function($el) {
|
339 |
-
$el.animate({ opacity: 'hide', height: 'hide' }, 100, function() {
|
340 |
-
$(this).prev('li').animate({ height: '-=2px' }, 100, function() {
|
341 |
-
$(this).animate({ height: '+=2px' }, 100);
|
342 |
-
});
|
343 |
-
$(this).remove();
|
344 |
-
});
|
345 |
-
}
|
346 |
-
},
|
347 |
-
plugins: {
|
348 |
-
}
|
349 |
-
});
|
350 |
-
|
351 |
-
// Default configuration
|
352 |
-
$.bsmSelect.conf = {
|
353 |
-
listType: 'ol', // Ordered list 'ol', or unordered list 'ul'
|
354 |
-
|
355 |
-
showEffect: $.bsmSelect.effects.show,
|
356 |
-
hideEffect: $.bsmSelect.effects.remove,
|
357 |
-
highlightEffect: $.noop,
|
358 |
-
|
359 |
-
addItemTarget: 'bottom', // Where to place new selected items in list: top or bottom
|
360 |
-
hideWhenAdded: false, // Hide the option when added to the list? works only in FF
|
361 |
-
debugMode: false, // Debug mode keeps original select visible
|
362 |
-
|
363 |
-
title: 'Select...', // Text used for the default select label
|
364 |
-
removeLabel: 'remove', // HTML used for the 'remove' link
|
365 |
-
highlightAddedLabel: 'Added: ', // Text that precedes highlight of added item
|
366 |
-
highlightRemovedLabel: 'Removed: ', // Text that precedes highlight of removed item
|
367 |
-
extractLabel: function($o) { return $o.html(); },
|
368 |
-
|
369 |
-
plugins: [], // An array of plugin objects to enable
|
370 |
-
|
371 |
-
containerClass: 'bsmContainer', // Class for container that wraps this widget
|
372 |
-
selectClass: 'bsmSelect', // Class for the newly created <select>
|
373 |
-
optionDisabledClass: 'bsmOptionDisabled', // Class for items that are already selected / disabled
|
374 |
-
listClass: 'bsmList', // Class for the list ($list)
|
375 |
-
listItemClass: 'bsmListItem', // Class for the <li> list items
|
376 |
-
listItemLabelClass: 'bsmListItemLabel', // Class for the label text that appears in list items
|
377 |
-
removeClass: 'bsmListItemRemove', // Class given to the 'remove' link
|
378 |
-
highlightClass: 'bsmHighlight' // Class given to the highlight <span>
|
379 |
-
};
|
380 |
-
|
381 |
-
})(jQuery);
|
1 |
+
/*
|
2 |
+
* Better Select Multiple - jQuery Plugin
|
3 |
+
*
|
4 |
+
* based on Alternate Select Multiple (asmSelect) 1.0.4a beta (http://www.ryancramer.com/projects/asmselect/)
|
5 |
+
*
|
6 |
+
* Copyright (c) 2009 by Ryan Cramer - http://www.ryancramer.com
|
7 |
+
* Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
|
8 |
+
*
|
9 |
+
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
10 |
+
*
|
11 |
+
* bsmSelect version: v1.4.3 - 2011-05-05
|
12 |
+
*/
|
13 |
+
|
14 |
+
(function($) {
|
15 |
+
|
16 |
+
function BsmSelect(target, options)
|
17 |
+
{
|
18 |
+
this.$original = $(target); // the original select multiple
|
19 |
+
this.buildingSelect = false; // is the new select being constructed right now?
|
20 |
+
this.ieClick = false; // in IE, has a click event occurred? ignore if not
|
21 |
+
this.ignoreOriginalChangeEvent = false; // originalChangeEvent bypassed when this is true
|
22 |
+
this.options = options;
|
23 |
+
this.buildDom();
|
24 |
+
}
|
25 |
+
|
26 |
+
BsmSelect.prototype = {
|
27 |
+
/**
|
28 |
+
* Generate an UID
|
29 |
+
*/
|
30 |
+
generateUid: function(index) {
|
31 |
+
return (this.uid = this.options.containerClass + index);
|
32 |
+
},
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Build the DOM for bsmSelect
|
36 |
+
*/
|
37 |
+
buildDom: function() {
|
38 |
+
var self = this, o = this.options;
|
39 |
+
|
40 |
+
if (o.addItemTarget === 'original') {
|
41 |
+
$('option', this.$original).each(function(i, o) {
|
42 |
+
if ($(o).data('bsm-order') === null) { $(o).data('bsm-order', i); }
|
43 |
+
});
|
44 |
+
}
|
45 |
+
|
46 |
+
for (var index = 0; $('#' + this.generateUid(index)).size(); index++) {}
|
47 |
+
|
48 |
+
this.$select = $('<select>', {
|
49 |
+
'class': o.selectClass,
|
50 |
+
name: o.selectClass + this.uid,
|
51 |
+
id: o.selectClass + this.uid,
|
52 |
+
change: $.proxy(this.selectChangeEvent, this),
|
53 |
+
click: $.proxy(this.selectClickEvent, this)
|
54 |
+
});
|
55 |
+
|
56 |
+
this.$list = $.isFunction(o.listType)
|
57 |
+
? o.listType(this.$original)
|
58 |
+
: $('<' + o.listType + '>', { id: o.listClass + this.uid });
|
59 |
+
|
60 |
+
this.$list.addClass(o.listClass);
|
61 |
+
|
62 |
+
this.$container = $('<div>', { 'class': o.containerClass, id: this.uid });
|
63 |
+
|
64 |
+
this.buildSelect();
|
65 |
+
|
66 |
+
this.$original.change($.proxy(this.originalChangeEvent, this)).wrap(this.$container).before(this.$select);
|
67 |
+
|
68 |
+
// if the list isn't already in the document, add it (it might be inserted by a custom callback)
|
69 |
+
if (!this.$list.parent().length) { this.$original.before(this.$list); }
|
70 |
+
|
71 |
+
if (this.$original.attr('id')) {
|
72 |
+
$('label[for=' + this.$original.attr('id') + ']').attr('for', this.$select.attr('id'));
|
73 |
+
}
|
74 |
+
|
75 |
+
// set up remove event (may be a link, or the list item itself)
|
76 |
+
this.$list.delegate('.' + o.removeClass, 'click', function() {
|
77 |
+
self.dropListItem($(this).closest('li'));
|
78 |
+
return false;
|
79 |
+
});
|
80 |
+
|
81 |
+
$.each(o.plugins, function() { this.init(self); });
|
82 |
+
},
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Triggered when an item has been selected
|
86 |
+
* Check to make sure it's not an IE screwup, and add it to the list
|
87 |
+
*/
|
88 |
+
selectChangeEvent: function() {
|
89 |
+
if ($.browser.msie && $.browser.version < 7 && !this.ieClick) { return; }
|
90 |
+
var bsmOpt = $('option:selected:eq(0)', this.$select);
|
91 |
+
if (bsmOpt.data('orig-option')) {
|
92 |
+
this.addListItem(bsmOpt);
|
93 |
+
this.triggerOriginalChange(bsmOpt.data('orig-option'), 'add');
|
94 |
+
}
|
95 |
+
this.ieClick = false;
|
96 |
+
},
|
97 |
+
|
98 |
+
/**
|
99 |
+
* IE6 lets you scroll around in a select without it being pulled down
|
100 |
+
* making sure a click preceded the change() event reduces the chance
|
101 |
+
* if unintended items being added. there may be a better solution?
|
102 |
+
*/
|
103 |
+
selectClickEvent: function() {
|
104 |
+
this.ieClick = true;
|
105 |
+
},
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Rebuild bsmSelect when the 'change' event is triggered on the original select
|
109 |
+
*/
|
110 |
+
originalChangeEvent: function() {
|
111 |
+
if (this.ignoreOriginalChangeEvent) {
|
112 |
+
// We don't want to rebuild everything when an item is added / droped
|
113 |
+
this.ignoreOriginalChangeEvent = false;
|
114 |
+
} else {
|
115 |
+
this.buildSelect();
|
116 |
+
// opera has an issue where it needs a force redraw, otherwise
|
117 |
+
// the items won't appear until something else forces a redraw
|
118 |
+
if ($.browser.opera) { this.$list.hide().show(); }
|
119 |
+
}
|
120 |
+
},
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Build the DOM for the new select
|
124 |
+
*/
|
125 |
+
buildSelect: function() {
|
126 |
+
var self = this;
|
127 |
+
|
128 |
+
this.buildingSelect = true;
|
129 |
+
|
130 |
+
// add a first option to be the home option / default selectLabel
|
131 |
+
this.$select.empty().prepend($('<option value=""></option>').text(this.$original.attr('title') || this.options.title));
|
132 |
+
this.$list.empty();
|
133 |
+
|
134 |
+
this.$original.children().each(function() {
|
135 |
+
if ($(this).is('option')) {
|
136 |
+
self.addSelectOption(self.$select, $(this));
|
137 |
+
} else if ($(this).is('optgroup')) {
|
138 |
+
self.addSelectOptionGroup(self.$select, $(this));
|
139 |
+
}
|
140 |
+
});
|
141 |
+
|
142 |
+
if (!this.options.debugMode) { this.$original.hide(); }
|
143 |
+
this.selectFirstItem();
|
144 |
+
this.buildingSelect = false;
|
145 |
+
},
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Append an option to the new select
|
149 |
+
*
|
150 |
+
* @param {jQuery} $parent Where to append the option
|
151 |
+
* @param {jQuery} $origOpt Option from the original select
|
152 |
+
*/
|
153 |
+
addSelectOption: function ($parent, $origOpt) {
|
154 |
+
var $bsmOpt = $('<option>', {
|
155 |
+
text: $origOpt.text(),
|
156 |
+
val: $origOpt.val() }).appendTo($parent).data('orig-option', $origOpt),
|
157 |
+
isSelected = $origOpt.is(':selected'),
|
158 |
+
isDisabled = $origOpt.is(':disabled');
|
159 |
+
$origOpt.data('bsm-option', $bsmOpt);
|
160 |
+
if (isSelected && !isDisabled) {
|
161 |
+
this.addListItem($bsmOpt);
|
162 |
+
this.disableSelectOption($bsmOpt);
|
163 |
+
} else if (!isSelected && isDisabled) {
|
164 |
+
this.disableSelectOption($bsmOpt);
|
165 |
+
}
|
166 |
+
},
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Append an option group to the new select
|
170 |
+
*
|
171 |
+
* @param {jQuery} $parent Where to append the group
|
172 |
+
* @param {jQuery} $group Model group from the original select
|
173 |
+
*/
|
174 |
+
addSelectOptionGroup: function($parent, $group)
|
175 |
+
{
|
176 |
+
var self = this,
|
177 |
+
$G = $('<optgroup>', { label: $group.attr('label')} ).appendTo($parent);
|
178 |
+
if ($group.is(':disabled')) { $G.attr('disabled', 'disabled'); }
|
179 |
+
$('option', $group).each(function() { self.addSelectOption($G, $(this)); });
|
180 |
+
},
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Select the first item of the new select
|
184 |
+
*/
|
185 |
+
selectFirstItem: function() {
|
186 |
+
$('option:eq(0)', this.$select).attr('selected', 'selected');
|
187 |
+
},
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Make an option disabled, indicating that it's already been selected
|
191 |
+
* because safari is the only browser that makes disabled items look 'disabled'
|
192 |
+
* we apply a class that reproduces the disabled look in other browsers
|
193 |
+
*
|
194 |
+
* @param {jQuery} $bsmOpt Option from the new select
|
195 |
+
*/
|
196 |
+
disableSelectOption: function($bsmOpt) {
|
197 |
+
$bsmOpt.addClass(this.options.optionDisabledClass)
|
198 |
+
.removeAttr('selected')
|
199 |
+
.attr('disabled', 'disabled')
|
200 |
+
.toggle(!this.options.hideWhenAdded);
|
201 |
+
if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display
|
202 |
+
},
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Enable a select option
|
206 |
+
*
|
207 |
+
* @param {jQuery} $bsmOpt Option from the new select
|
208 |
+
*/
|
209 |
+
enableSelectOption: function($bsmOpt) {
|
210 |
+
$bsmOpt.removeClass(this.options.optionDisabledClass)
|
211 |
+
.removeAttr('disabled')
|
212 |
+
.toggle(!this.options.hideWhenAdded);
|
213 |
+
if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display
|
214 |
+
},
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Append an item corresponding to the option to the list
|
218 |
+
*
|
219 |
+
* @param {jQuery} $bsmOpt Option from the new select
|
220 |
+
*/
|
221 |
+
addListItem: function($bsmOpt) {
|
222 |
+
var $item,
|
223 |
+
$origOpt = $bsmOpt.data('orig-option'),
|
224 |
+
o = this.options;
|
225 |
+
|
226 |
+
if (!$origOpt) { return; } // this is the first item, selectLabel
|
227 |
+
|
228 |
+
if (!this.buildingSelect) {
|
229 |
+
if ($origOpt.is(':selected')) { return; } // already have it
|
230 |
+
$origOpt.attr('selected', 'selected');
|
231 |
+
}
|
232 |
+
|
233 |
+
$item = $('<li>', { 'class': o.listItemClass })
|
234 |
+
.append($('<span>', { 'class': o.listItemLabelClass, html: o.extractLabel($bsmOpt, o)}))
|
235 |
+
.append($('<a>', { href: '#', 'class': o.removeClass, html: o.removeLabel }))
|
236 |
+
.data('bsm-option', $bsmOpt);
|
237 |
+
|
238 |
+
this.disableSelectOption($bsmOpt.data('item', $item));
|
239 |
+
|
240 |
+
switch (o.addItemTarget) {
|
241 |
+
case 'bottom':
|
242 |
+
this.$list.append($item.hide());
|
243 |
+
break;
|
244 |
+
case 'original':
|
245 |
+
var order = $origOpt.data('bsm-order'), inserted = false;
|
246 |
+
$('.' + o.listItemClass, this.$list).each(function() {
|
247 |
+
if (order < $(this).data('bsm-option').data('orig-option').data('bsm-order')) {
|
248 |
+
$item.hide().insertBefore(this);
|
249 |
+
inserted = true;
|
250 |
+
return false;
|
251 |
+
}
|
252 |
+
});
|
253 |
+
if (!inserted) { this.$list.append($item.hide()); }
|
254 |
+
break;
|
255 |
+
default:
|
256 |
+
this.$list.prepend($item.hide());
|
257 |
+
}
|
258 |
+
|
259 |
+
if (this.buildingSelect) {
|
260 |
+
$.bsmSelect.effects.show($item);
|
261 |
+
} else {
|
262 |
+
o.showEffect($item);
|
263 |
+
o.highlightEffect(this.$select, $item, o.highlightAddedLabel, this.options);
|
264 |
+
this.selectFirstItem();
|
265 |
+
}
|
266 |
+
},
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Remove an item from the list of selection
|
270 |
+
*
|
271 |
+
* @param {jQuey} $item A list item
|
272 |
+
*/
|
273 |
+
dropListItem: function($item) {
|
274 |
+
var $bsmOpt = $item.data('bsm-option'), o = this.options;
|
275 |
+
$bsmOpt.removeData('item').data('orig-option').removeAttr('selected');
|
276 |
+
(this.buildingSelect ? $.bsmSelect.effects.remove : o.hideEffect)($item);
|
277 |
+
this.enableSelectOption($bsmOpt);
|
278 |
+
o.highlightEffect(this.$select, $item, o.highlightRemovedLabel, o);
|
279 |
+
this.triggerOriginalChange($bsmOpt.data('orig-option'), 'drop');
|
280 |
+
},
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Trigger a change event on the original select multiple
|
284 |
+
* so that other scripts can pick them up
|
285 |
+
*
|
286 |
+
* @param {jQuery} $origOpt The option from the original select
|
287 |
+
* @param {String} type Event type
|
288 |
+
*/
|
289 |
+
triggerOriginalChange: function($origOpt, type) {
|
290 |
+
this.ignoreOriginalChangeEvent = true;
|
291 |
+
this.$original.trigger('change', [{
|
292 |
+
option: $origOpt,
|
293 |
+
value: $origOpt.val(),
|
294 |
+
item: $origOpt.data('bsm-option').data('item'),
|
295 |
+
type: type
|
296 |
+
}]);
|
297 |
+
}
|
298 |
+
};
|
299 |
+
|
300 |
+
$.fn.bsmSelect = function(customOptions) {
|
301 |
+
var options = $.extend({}, $.bsmSelect.conf, customOptions);
|
302 |
+
return this.each(function() {
|
303 |
+
var bsm = $(this).data("bsmSelect");
|
304 |
+
if (!bsm) {
|
305 |
+
bsm = new BsmSelect($(this), options);
|
306 |
+
$(this).data("bsmSelect", bsm);
|
307 |
+
}
|
308 |
+
});
|
309 |
+
};
|
310 |
+
|
311 |
+
$.bsmSelect = {};
|
312 |
+
$.extend($.bsmSelect, {
|
313 |
+
effects: {
|
314 |
+
show: function($el) { $el.show(); },
|
315 |
+
|
316 |
+
remove: function($el) { $el.remove(); },
|
317 |
+
|
318 |
+
highlight: function ($select, $item, label, conf) {
|
319 |
+
var $highlight,
|
320 |
+
id = $select.attr('id') + conf.highlightClass;
|
321 |
+
$('#' + id).remove();
|
322 |
+
$highlight = $('<span>', {
|
323 |
+
'class': conf.highlightClass,
|
324 |
+
id: id,
|
325 |
+
html: label + $item.children('.' + conf.listItemLabelClass).first().text()
|
326 |
+
}).hide();
|
327 |
+
$select.after($highlight.fadeIn('fast').delay(50).fadeOut('slow', function() { $(this).remove(); }));
|
328 |
+
},
|
329 |
+
|
330 |
+
verticalListAdd: function ($el) {
|
331 |
+
$el.animate({ opacity: 'show', height: 'show' }, 100, function() {
|
332 |
+
$(this).animate({ height: '+=2px' }, 100, function() {
|
333 |
+
$(this).animate({ height: '-=2px' }, 100);
|
334 |
+
});
|
335 |
+
});
|
336 |
+
},
|
337 |
+
|
338 |
+
verticalListRemove: function($el) {
|
339 |
+
$el.animate({ opacity: 'hide', height: 'hide' }, 100, function() {
|
340 |
+
$(this).prev('li').animate({ height: '-=2px' }, 100, function() {
|
341 |
+
$(this).animate({ height: '+=2px' }, 100);
|
342 |
+
});
|
343 |
+
$(this).remove();
|
344 |
+
});
|
345 |
+
}
|
346 |
+
},
|
347 |
+
plugins: {
|
348 |
+
}
|
349 |
+
});
|
350 |
+
|
351 |
+
// Default configuration
|
352 |
+
$.bsmSelect.conf = {
|
353 |
+
listType: 'ol', // Ordered list 'ol', or unordered list 'ul'
|
354 |
+
|
355 |
+
showEffect: $.bsmSelect.effects.show,
|
356 |
+
hideEffect: $.bsmSelect.effects.remove,
|
357 |
+
highlightEffect: $.noop,
|
358 |
+
|
359 |
+
addItemTarget: 'bottom', // Where to place new selected items in list: top or bottom
|
360 |
+
hideWhenAdded: false, // Hide the option when added to the list? works only in FF
|
361 |
+
debugMode: false, // Debug mode keeps original select visible
|
362 |
+
|
363 |
+
title: 'Select...', // Text used for the default select label
|
364 |
+
removeLabel: 'remove', // HTML used for the 'remove' link
|
365 |
+
highlightAddedLabel: 'Added: ', // Text that precedes highlight of added item
|
366 |
+
highlightRemovedLabel: 'Removed: ', // Text that precedes highlight of removed item
|
367 |
+
extractLabel: function($o) { return $o.html(); },
|
368 |
+
|
369 |
+
plugins: [], // An array of plugin objects to enable
|
370 |
+
|
371 |
+
containerClass: 'bsmContainer', // Class for container that wraps this widget
|
372 |
+
selectClass: 'bsmSelect', // Class for the newly created <select>
|
373 |
+
optionDisabledClass: 'bsmOptionDisabled', // Class for items that are already selected / disabled
|
374 |
+
listClass: 'bsmList', // Class for the list ($list)
|
375 |
+
listItemClass: 'bsmListItem', // Class for the <li> list items
|
376 |
+
listItemLabelClass: 'bsmListItemLabel', // Class for the label text that appears in list items
|
377 |
+
removeClass: 'bsmListItemRemove', // Class given to the 'remove' link
|
378 |
+
highlightClass: 'bsmHighlight' // Class given to the highlight <span>
|
379 |
+
};
|
380 |
+
|
381 |
+
})(jQuery);
|
languages/default.mo
DELETED
Binary file
|
languages/{default.po → wordpress-database-reset.pot}
RENAMED
@@ -1,81 +1,81 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-10-11 23:05-0500\n"
|
6 |
-
"PO-Revision-Date: 2011-10-15 09:38-0500\n"
|
7 |
-
"Last-Translator: \n"
|
8 |
-
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
-
"X-Poedit-Basepath: ../\n"
|
14 |
-
"X-Poedit-Language: English\n"
|
15 |
-
"X-Poedit-SearchPath-0: .\n"
|
16 |
-
|
17 |
-
#: wp-reset.php:110
|
18 |
-
msgid "You entered the wrong value - please try again"
|
19 |
-
msgstr ""
|
20 |
-
|
21 |
-
#: wp-reset.php:112
|
22 |
-
msgid "The WordPress database has been reset successfully"
|
23 |
-
msgstr ""
|
24 |
-
|
25 |
-
#: wp-reset.php:117
|
26 |
-
msgid "Database Reset"
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: wp-reset.php:118
|
30 |
-
msgid "Please type in (or copy/paste) the generated value into the text box"
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: wp-reset.php:123
|
34 |
-
msgid "Reset Database"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
#: wp-reset.php:127
|
38 |
-
msgid "Reactivate current plugins after reset?"
|
39 |
-
msgstr ""
|
40 |
-
|
41 |
-
#: wp-reset.php:133
|
42 |
-
#, php-format
|
43 |
-
msgid "The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: wp-reset.php:135
|
47 |
-
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: wp-reset.php:138
|
51 |
-
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: wp-reset.php:154
|
55 |
-
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
56 |
-
msgstr ""
|
57 |
-
|
58 |
-
#: wp-reset.php:194
|
59 |
-
msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
60 |
-
msgstr ""
|
61 |
-
|
62 |
-
#: wp-reset.php:195
|
63 |
-
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
64 |
-
msgstr ""
|
65 |
-
|
66 |
-
#: wp-reset.php:196
|
67 |
-
msgid "Goodbye for now."
|
68 |
-
msgstr ""
|
69 |
-
|
70 |
-
#: wp-reset.php:250
|
71 |
-
msgid "WordPress Database Reset"
|
72 |
-
msgstr ""
|
73 |
-
|
74 |
-
#: wp-reset.php:251
|
75 |
-
msgid "The WordPress database has been successfully reset to its default settings:"
|
76 |
-
msgstr ""
|
77 |
-
|
78 |
-
#: wp-reset.php:252
|
79 |
-
msgid "Password: The password you chose during the install."
|
80 |
-
msgstr ""
|
81 |
-
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-11 23:05-0500\n"
|
6 |
+
"PO-Revision-Date: 2011-10-15 09:38-0500\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: ../\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-SearchPath-0: .\n"
|
16 |
+
|
17 |
+
#: wp-reset.php:110
|
18 |
+
msgid "You entered the wrong value - please try again"
|
19 |
+
msgstr ""
|
20 |
+
|
21 |
+
#: wp-reset.php:112
|
22 |
+
msgid "The WordPress database has been reset successfully"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: wp-reset.php:117
|
26 |
+
msgid "Database Reset"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: wp-reset.php:118
|
30 |
+
msgid "Please type in (or copy/paste) the generated value into the text box"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: wp-reset.php:123
|
34 |
+
msgid "Reset Database"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: wp-reset.php:127
|
38 |
+
msgid "Reactivate current plugins after reset?"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: wp-reset.php:133
|
42 |
+
#, php-format
|
43 |
+
msgid "The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: wp-reset.php:135
|
47 |
+
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: wp-reset.php:138
|
51 |
+
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: wp-reset.php:154
|
55 |
+
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: wp-reset.php:194
|
59 |
+
msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: wp-reset.php:195
|
63 |
+
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: wp-reset.php:196
|
67 |
+
msgid "Goodbye for now."
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: wp-reset.php:250
|
71 |
+
msgid "WordPress Database Reset"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: wp-reset.php:251
|
75 |
+
msgid "The WordPress database has been successfully reset to its default settings:"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: wp-reset.php:252
|
79 |
+
msgid "Password: The password you chose during the install."
|
80 |
+
msgstr ""
|
81 |
+
|
languages/wp-reset-de_DE.mo
ADDED
Binary file
|
languages/wp-reset-de_DE.po
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-11 23:05-0500\n"
|
6 |
+
"PO-Revision-Date: 2013-10-30 22:41+0100\n"
|
7 |
+
"Last-Translator: Ulrich Pogson <grapplerulrich@gmail.com>\n"
|
8 |
+
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: ../\n"
|
14 |
+
"Language: en\n"
|
15 |
+
"X-Generator: Poedit 1.5.7\n"
|
16 |
+
"X-Poedit-SearchPath-0: .\n"
|
17 |
+
|
18 |
+
#: wp-reset.php:110
|
19 |
+
msgid "You entered the wrong value - please try again"
|
20 |
+
msgstr "Du hast den falschen Wert eingegeben - bitte versuchst du es nochmals"
|
21 |
+
|
22 |
+
#: wp-reset.php:112
|
23 |
+
msgid "The WordPress database has been reset successfully"
|
24 |
+
msgstr "Die WordPress-Datenbank wurde erfolgreich zurückgesetzt"
|
25 |
+
|
26 |
+
#: wp-reset.php:117
|
27 |
+
msgid "Database Reset"
|
28 |
+
msgstr "Database zurücksetzen"
|
29 |
+
|
30 |
+
#: wp-reset.php:118
|
31 |
+
msgid "Please type in (or copy/paste) the generated value into the text box"
|
32 |
+
msgstr ""
|
33 |
+
"Bitte gibst du (oder kopieren / einfügen) den generierten Wert in das "
|
34 |
+
"Textfeld ein"
|
35 |
+
|
36 |
+
#: wp-reset.php:123
|
37 |
+
msgid "Reset Database"
|
38 |
+
msgstr "Datenbank zurücksetzen"
|
39 |
+
|
40 |
+
#: wp-reset.php:127
|
41 |
+
msgid "Reactivate current plugins after reset?"
|
42 |
+
msgstr "Aktuelle Plugins nach dem Zurücksetzen reaktivieren?"
|
43 |
+
|
44 |
+
#: wp-reset.php:133
|
45 |
+
#, php-format
|
46 |
+
msgid ""
|
47 |
+
"The default user <strong><u>admin</u></strong> was never created for this "
|
48 |
+
"WordPress install. So <strong><u>%s</u></strong> will be recreated with its "
|
49 |
+
"current password instead"
|
50 |
+
msgstr ""
|
51 |
+
"Der Standard-Benutzername <strong><u>admin</ u></ strong> wurde nie für "
|
52 |
+
"diese WordPress Installation erstellt. So wird <strong><u>% s </ u></ "
|
53 |
+
"strong> dafür mit seinem aktuellen Kennwort erstellt"
|
54 |
+
|
55 |
+
#: wp-reset.php:135
|
56 |
+
msgid ""
|
57 |
+
"The default user <strong><u>admin</u></strong> will be recreated with its "
|
58 |
+
"current password upon resetting"
|
59 |
+
msgstr ""
|
60 |
+
"Der Standardbenutzer <strong><u>admin</ u></ strong> wird mit seinem "
|
61 |
+
"aktuellen Kennwort nach die Rücksetzung erstellt"
|
62 |
+
|
63 |
+
#: wp-reset.php:138
|
64 |
+
msgid ""
|
65 |
+
"Note that once you reset the database, all users will be deleted except the "
|
66 |
+
"initial admin user."
|
67 |
+
msgstr ""
|
68 |
+
"Bitte beachten, dass wenn du die Datenbank zurückzusetzt, werden alle "
|
69 |
+
"Benutzer mit Ausnahme der ersten Admin Benutzer gelöscht."
|
70 |
+
|
71 |
+
#: wp-reset.php:154
|
72 |
+
msgid ""
|
73 |
+
"Clicking OK will result in your database being reset to its initial "
|
74 |
+
"settings. Continue?"
|
75 |
+
msgstr ""
|
76 |
+
"Beim auf OK klicken wird die Datenbank zurückgesetzt zu seine ursprünglichen "
|
77 |
+
"Einstellungen. Weiterfahren?"
|
78 |
+
|
79 |
+
#: wp-reset.php:194
|
80 |
+
msgid ""
|
81 |
+
"Have any cool ideas for this plugin? Contact me either by <a href=\"http://"
|
82 |
+
"twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/"
|
83 |
+
"chrisberthe\">GitHub</a>."
|
84 |
+
msgstr ""
|
85 |
+
"Haben Sie coole Ideen für dieses Plugin? Kontaktieren Sie mich entweder auf "
|
86 |
+
"<a href=\"http://twitter.com/#!/chrisberthe\">Twitter</ a> oder <a href="
|
87 |
+
"\"https://github.com/chrisberthe\">GitHub</ a>."
|
88 |
+
|
89 |
+
#: wp-reset.php:195
|
90 |
+
msgid ""
|
91 |
+
"If this plugin becomes non-functional in any way due to WordPress upgrades, "
|
92 |
+
"rest assured I will update it."
|
93 |
+
msgstr ""
|
94 |
+
"Wenn dieses Plugin wird nicht-funktionieren in irgendeiner Weise durch die "
|
95 |
+
"WordPress Upgrades, sei dir versichert, dass ich es aktualisieren werde ."
|
96 |
+
|
97 |
+
#: wp-reset.php:196
|
98 |
+
msgid "Goodbye for now."
|
99 |
+
msgstr "Auf Wiedersehen!"
|
100 |
+
|
101 |
+
#: wp-reset.php:250
|
102 |
+
msgid "WordPress Database Reset"
|
103 |
+
msgstr "WordPress Database Reset"
|
104 |
+
|
105 |
+
#: wp-reset.php:251
|
106 |
+
msgid ""
|
107 |
+
"The WordPress database has been successfully reset to its default settings:"
|
108 |
+
msgstr ""
|
109 |
+
"Die WordPress-Datenbank wurde erfolgreich zu die Standardeinstellungen "
|
110 |
+
"zurückzusetzt"
|
111 |
+
|
112 |
+
#: wp-reset.php:252
|
113 |
+
msgid "Password: The password you chose during the install."
|
114 |
+
msgstr "Passwort: Das Passwort, das du während der Installation gewählt hast."
|
languages/wp-reset-fr_FR.po
CHANGED
@@ -1,82 +1,82 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-10-14 11:28-0500\n"
|
6 |
-
"PO-Revision-Date: 2011-10-15 09:37-0500\n"
|
7 |
-
"Last-Translator: \n"
|
8 |
-
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
-
"X-Poedit-Basepath: ../\n"
|
14 |
-
"X-Poedit-Language: French\n"
|
15 |
-
"X-Poedit-Country: FRANCE\n"
|
16 |
-
"X-Poedit-SearchPath-0: .\n"
|
17 |
-
|
18 |
-
#: wp-reset.php:110
|
19 |
-
msgid "You entered the wrong value - please try again"
|
20 |
-
msgstr "Vous avez entré une valeur incorrecte - s'il vous plaît essayez à nouveau."
|
21 |
-
|
22 |
-
#: wp-reset.php:112
|
23 |
-
msgid "The WordPress database has been reset successfully"
|
24 |
-
msgstr "La base de données WordPress a été réinitialisé avec succès"
|
25 |
-
|
26 |
-
#: wp-reset.php:117
|
27 |
-
msgid "Database Reset"
|
28 |
-
msgstr "Réinitialisation base de données"
|
29 |
-
|
30 |
-
#: wp-reset.php:118
|
31 |
-
msgid "Please type in (or copy/paste) the generated value into the text box"
|
32 |
-
msgstr "Veuillez entrer (ou copier / coller) la valeur générée dans la zone de texte"
|
33 |
-
|
34 |
-
#: wp-reset.php:123
|
35 |
-
msgid "Reset Database"
|
36 |
-
msgstr "Réinitialiser"
|
37 |
-
|
38 |
-
#: wp-reset.php:127
|
39 |
-
msgid "Reactivate current plugins after reset?"
|
40 |
-
msgstr "Réactiver les plugins actuels après la réinitialisation?"
|
41 |
-
|
42 |
-
#: wp-reset.php:133
|
43 |
-
#, php-format
|
44 |
-
msgid "The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead"
|
45 |
-
msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut n'a jamais été créé pour cette installation de WordPress. Alors <strong><u>%s</u></strong> sera plutôt recréé avec son mot de passe actuel."
|
46 |
-
|
47 |
-
#: wp-reset.php:135
|
48 |
-
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
49 |
-
msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut sera recréé avec son mot de passe actuel après la réinitialisation"
|
50 |
-
|
51 |
-
#: wp-reset.php:138
|
52 |
-
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
53 |
-
msgstr "Notez qu'une fois la base de données soit réinitialiser, tous les utilisateurs seront supprimées à l'exception de l'utilisateur admin initial."
|
54 |
-
|
55 |
-
#: wp-reset.php:154
|
56 |
-
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
57 |
-
msgstr "Si vous cliquez sur OK, votre base de données sera supprimé. Continuer?"
|
58 |
-
|
59 |
-
#: wp-reset.php:194
|
60 |
-
msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
61 |
-
msgstr "Avez-vous des idées pour ce plugin? "
|
62 |
-
|
63 |
-
#: wp-reset.php:195
|
64 |
-
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
65 |
-
msgstr "Si ce plugin ne marche plus à cause de mises à jour WordPress, rassurez-vous que je vais le mettre à jour dès que possible."
|
66 |
-
|
67 |
-
#: wp-reset.php:196
|
68 |
-
msgid "Goodbye for now."
|
69 |
-
msgstr "À bientôt."
|
70 |
-
|
71 |
-
#: wp-reset.php:250
|
72 |
-
msgid "WordPress Database Reset"
|
73 |
-
msgstr "Réinitialisation base de données"
|
74 |
-
|
75 |
-
#: wp-reset.php:251
|
76 |
-
msgid "The WordPress database has been successfully reset to its default settings:"
|
77 |
-
msgstr "La base de données WordPress a été réinitialisé avec succès:"
|
78 |
-
|
79 |
-
#: wp-reset.php:252
|
80 |
-
msgid "Password: The password you chose during the install."
|
81 |
-
msgstr "Mot de passe: Le mot de passe que vous avez choisi lors de l'installation."
|
82 |
-
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-14 11:28-0500\n"
|
6 |
+
"PO-Revision-Date: 2011-10-15 09:37-0500\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: ../\n"
|
14 |
+
"X-Poedit-Language: French\n"
|
15 |
+
"X-Poedit-Country: FRANCE\n"
|
16 |
+
"X-Poedit-SearchPath-0: .\n"
|
17 |
+
|
18 |
+
#: wp-reset.php:110
|
19 |
+
msgid "You entered the wrong value - please try again"
|
20 |
+
msgstr "Vous avez entré une valeur incorrecte - s'il vous plaît essayez à nouveau."
|
21 |
+
|
22 |
+
#: wp-reset.php:112
|
23 |
+
msgid "The WordPress database has been reset successfully"
|
24 |
+
msgstr "La base de données WordPress a été réinitialisé avec succès"
|
25 |
+
|
26 |
+
#: wp-reset.php:117
|
27 |
+
msgid "Database Reset"
|
28 |
+
msgstr "Réinitialisation base de données"
|
29 |
+
|
30 |
+
#: wp-reset.php:118
|
31 |
+
msgid "Please type in (or copy/paste) the generated value into the text box"
|
32 |
+
msgstr "Veuillez entrer (ou copier / coller) la valeur générée dans la zone de texte"
|
33 |
+
|
34 |
+
#: wp-reset.php:123
|
35 |
+
msgid "Reset Database"
|
36 |
+
msgstr "Réinitialiser"
|
37 |
+
|
38 |
+
#: wp-reset.php:127
|
39 |
+
msgid "Reactivate current plugins after reset?"
|
40 |
+
msgstr "Réactiver les plugins actuels après la réinitialisation?"
|
41 |
+
|
42 |
+
#: wp-reset.php:133
|
43 |
+
#, php-format
|
44 |
+
msgid "The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead"
|
45 |
+
msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut n'a jamais été créé pour cette installation de WordPress. Alors <strong><u>%s</u></strong> sera plutôt recréé avec son mot de passe actuel."
|
46 |
+
|
47 |
+
#: wp-reset.php:135
|
48 |
+
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
49 |
+
msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut sera recréé avec son mot de passe actuel après la réinitialisation"
|
50 |
+
|
51 |
+
#: wp-reset.php:138
|
52 |
+
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
53 |
+
msgstr "Notez qu'une fois la base de données soit réinitialiser, tous les utilisateurs seront supprimées à l'exception de l'utilisateur admin initial."
|
54 |
+
|
55 |
+
#: wp-reset.php:154
|
56 |
+
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
57 |
+
msgstr "Si vous cliquez sur OK, votre base de données sera supprimé. Continuer?"
|
58 |
+
|
59 |
+
#: wp-reset.php:194
|
60 |
+
msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
61 |
+
msgstr "Avez-vous des idées pour ce plugin? "
|
62 |
+
|
63 |
+
#: wp-reset.php:195
|
64 |
+
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
65 |
+
msgstr "Si ce plugin ne marche plus à cause de mises à jour WordPress, rassurez-vous que je vais le mettre à jour dès que possible."
|
66 |
+
|
67 |
+
#: wp-reset.php:196
|
68 |
+
msgid "Goodbye for now."
|
69 |
+
msgstr "À bientôt."
|
70 |
+
|
71 |
+
#: wp-reset.php:250
|
72 |
+
msgid "WordPress Database Reset"
|
73 |
+
msgstr "Réinitialisation base de données"
|
74 |
+
|
75 |
+
#: wp-reset.php:251
|
76 |
+
msgid "The WordPress database has been successfully reset to its default settings:"
|
77 |
+
msgstr "La base de données WordPress a été réinitialisé avec succès:"
|
78 |
+
|
79 |
+
#: wp-reset.php:252
|
80 |
+
msgid "Password: The password you chose during the install."
|
81 |
+
msgstr "Mot de passe: Le mot de passe que vous avez choisi lors de l'installation."
|
82 |
+
|
languages/wp-reset-pt_BR.po
CHANGED
@@ -1,119 +1,119 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-11-08 02:00-0300\n"
|
6 |
-
"PO-Revision-Date: 2011-11-08 06:20-0300\n"
|
7 |
-
"Last-Translator: Fernando Lopes <contato@fernandolopes.com.br>\n"
|
8 |
-
"Language-Team: Fernando Lopes <contato@fernandolopes.com.br>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
-
"X-Poedit-Basepath: ../\n"
|
14 |
-
"X-Poedit-Language: Portuguese\n"
|
15 |
-
"X-Poedit-Country: BRAZIL\n"
|
16 |
-
"X-Poedit-SearchPath-0: .\n"
|
17 |
-
"X-Poedit-SearchPath-1: ..\n"
|
18 |
-
|
19 |
-
#: wp-reset.php:156
|
20 |
-
#: ../wordpress-database-reset/wp-reset.php:156
|
21 |
-
msgid "You entered the wrong value - please try again"
|
22 |
-
msgstr "Você digitou o valor errado - por favor tente novamente"
|
23 |
-
|
24 |
-
#: wp-reset.php:158
|
25 |
-
#: ../wordpress-database-reset/wp-reset.php:158
|
26 |
-
msgid "You did not select any database tables"
|
27 |
-
msgstr "Você não selecionou nenhuma tabela do banco de dados"
|
28 |
-
|
29 |
-
#: wp-reset.php:160
|
30 |
-
#: ../wordpress-database-reset/wp-reset.php:160
|
31 |
-
msgid "The WordPress database has been reset successfully"
|
32 |
-
msgstr "O banco de dados do WordPress foi reiniciado com sucesso"
|
33 |
-
|
34 |
-
#: wp-reset.php:165
|
35 |
-
#: ../wordpress-database-reset/wp-reset.php:165
|
36 |
-
msgid "Database Reset"
|
37 |
-
msgstr "Reiniciar Banco de Dados"
|
38 |
-
|
39 |
-
#: wp-reset.php:167
|
40 |
-
#: ../wordpress-database-reset/wp-reset.php:167
|
41 |
-
msgid "Please choose from the following database tables the ones you would like to reset"
|
42 |
-
msgstr "Por favor, escolha a partir das tabelas do banco de dados abaixo o que você gostaria de reiniciar"
|
43 |
-
|
44 |
-
#: wp-reset.php:169
|
45 |
-
#: ../wordpress-database-reset/wp-reset.php:169
|
46 |
-
msgid "Select All"
|
47 |
-
msgstr "Selecionar Tudas"
|
48 |
-
|
49 |
-
#: wp-reset.php:176
|
50 |
-
#: ../wordpress-database-reset/wp-reset.php:176
|
51 |
-
msgid "Type in (or copy/paste) the generated value into the text box"
|
52 |
-
msgstr "Digite (ou copie/cole) o valor gerado na caixa de texto"
|
53 |
-
|
54 |
-
#: wp-reset.php:180
|
55 |
-
#: ../wordpress-database-reset/wp-reset.php:180
|
56 |
-
msgid "Reset Database"
|
57 |
-
msgstr "Reiniciar Banco de Dados"
|
58 |
-
|
59 |
-
#: wp-reset.php:186
|
60 |
-
#: ../wordpress-database-reset/wp-reset.php:186
|
61 |
-
msgid "Reactivate current plugins after reset?"
|
62 |
-
msgstr "Reativar os plugins atuais depois de reiniciar?"
|
63 |
-
|
64 |
-
#: wp-reset.php:193
|
65 |
-
#: ../wordpress-database-reset/wp-reset.php:193
|
66 |
-
#, php-format
|
67 |
-
msgid "The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead"
|
68 |
-
msgstr "O usuário padrão <strong><u>admin</u></strong>, nunca foi criado nesta instalação do WordPress. Então, o usuário <strong><u>%s</u></strong> será recriado com a sua senha atual"
|
69 |
-
|
70 |
-
#: wp-reset.php:195
|
71 |
-
#: ../wordpress-database-reset/wp-reset.php:195
|
72 |
-
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
73 |
-
msgstr "O usuário padrão <strong><u>admin</u></strong> será recriado com sua senha atual mediante a reinicialização"
|
74 |
-
|
75 |
-
#: wp-reset.php:198
|
76 |
-
#: ../wordpress-database-reset/wp-reset.php:198
|
77 |
-
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
78 |
-
msgstr "Note que, uma vez que você reiniciar o banco de dados, todos os usuários serão apagados, exceto o usuário <strong><u>admin</u></strong> inicial."
|
79 |
-
|
80 |
-
#: wp-reset.php:216
|
81 |
-
#: ../wordpress-database-reset/wp-reset.php:216
|
82 |
-
msgid "Select Table"
|
83 |
-
msgstr "Selecionar Tabela"
|
84 |
-
|
85 |
-
#: wp-reset.php:226
|
86 |
-
#: ../wordpress-database-reset/wp-reset.php:226
|
87 |
-
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
88 |
-
msgstr "Clicar em OK fará com que o banco de dados seja reiniciado para as configurações iniciais. Continuar?"
|
89 |
-
|
90 |
-
#: wp-reset.php:273
|
91 |
-
#: ../wordpress-database-reset/wp-reset.php:273
|
92 |
-
msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
93 |
-
msgstr "Tem alguma idéia legal para este plugin? Entre em contato comigo pelo <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> ou pelo <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
94 |
-
|
95 |
-
#: wp-reset.php:274
|
96 |
-
#: ../wordpress-database-reset/wp-reset.php:274
|
97 |
-
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
98 |
-
msgstr "Se este plugin se tornar não-funcional de alguma forma devido a upgrades WordPress, eu vou atualizá-lo."
|
99 |
-
|
100 |
-
#: wp-reset.php:275
|
101 |
-
#: ../wordpress-database-reset/wp-reset.php:275
|
102 |
-
msgid "Goodbye for now."
|
103 |
-
msgstr "Adeus por agora."
|
104 |
-
|
105 |
-
#: wp-reset.php:345
|
106 |
-
#: ../wordpress-database-reset/wp-reset.php:345
|
107 |
-
msgid "WordPress Database Reset"
|
108 |
-
msgstr "WordPress Reiniciar Banco de Dados"
|
109 |
-
|
110 |
-
#: wp-reset.php:346
|
111 |
-
#: ../wordpress-database-reset/wp-reset.php:346
|
112 |
-
msgid "The tables you selected have been successfully reset to their default settings:"
|
113 |
-
msgstr "As tabelas selecionadas foram reiniciadas com sucesso para suas configurações padrão:"
|
114 |
-
|
115 |
-
#: wp-reset.php:347
|
116 |
-
#: ../wordpress-database-reset/wp-reset.php:347
|
117 |
-
msgid "Password: The password you chose during the install."
|
118 |
-
msgstr "Senha: A senha que você escolheu durante a instalação."
|
119 |
-
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-11-08 02:00-0300\n"
|
6 |
+
"PO-Revision-Date: 2011-11-08 06:20-0300\n"
|
7 |
+
"Last-Translator: Fernando Lopes <contato@fernandolopes.com.br>\n"
|
8 |
+
"Language-Team: Fernando Lopes <contato@fernandolopes.com.br>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: ../\n"
|
14 |
+
"X-Poedit-Language: Portuguese\n"
|
15 |
+
"X-Poedit-Country: BRAZIL\n"
|
16 |
+
"X-Poedit-SearchPath-0: .\n"
|
17 |
+
"X-Poedit-SearchPath-1: ..\n"
|
18 |
+
|
19 |
+
#: wp-reset.php:156
|
20 |
+
#: ../wordpress-database-reset/wp-reset.php:156
|
21 |
+
msgid "You entered the wrong value - please try again"
|
22 |
+
msgstr "Você digitou o valor errado - por favor tente novamente"
|
23 |
+
|
24 |
+
#: wp-reset.php:158
|
25 |
+
#: ../wordpress-database-reset/wp-reset.php:158
|
26 |
+
msgid "You did not select any database tables"
|
27 |
+
msgstr "Você não selecionou nenhuma tabela do banco de dados"
|
28 |
+
|
29 |
+
#: wp-reset.php:160
|
30 |
+
#: ../wordpress-database-reset/wp-reset.php:160
|
31 |
+
msgid "The WordPress database has been reset successfully"
|
32 |
+
msgstr "O banco de dados do WordPress foi reiniciado com sucesso"
|
33 |
+
|
34 |
+
#: wp-reset.php:165
|
35 |
+
#: ../wordpress-database-reset/wp-reset.php:165
|
36 |
+
msgid "Database Reset"
|
37 |
+
msgstr "Reiniciar Banco de Dados"
|
38 |
+
|
39 |
+
#: wp-reset.php:167
|
40 |
+
#: ../wordpress-database-reset/wp-reset.php:167
|
41 |
+
msgid "Please choose from the following database tables the ones you would like to reset"
|
42 |
+
msgstr "Por favor, escolha a partir das tabelas do banco de dados abaixo o que você gostaria de reiniciar"
|
43 |
+
|
44 |
+
#: wp-reset.php:169
|
45 |
+
#: ../wordpress-database-reset/wp-reset.php:169
|
46 |
+
msgid "Select All"
|
47 |
+
msgstr "Selecionar Tudas"
|
48 |
+
|
49 |
+
#: wp-reset.php:176
|
50 |
+
#: ../wordpress-database-reset/wp-reset.php:176
|
51 |
+
msgid "Type in (or copy/paste) the generated value into the text box"
|
52 |
+
msgstr "Digite (ou copie/cole) o valor gerado na caixa de texto"
|
53 |
+
|
54 |
+
#: wp-reset.php:180
|
55 |
+
#: ../wordpress-database-reset/wp-reset.php:180
|
56 |
+
msgid "Reset Database"
|
57 |
+
msgstr "Reiniciar Banco de Dados"
|
58 |
+
|
59 |
+
#: wp-reset.php:186
|
60 |
+
#: ../wordpress-database-reset/wp-reset.php:186
|
61 |
+
msgid "Reactivate current plugins after reset?"
|
62 |
+
msgstr "Reativar os plugins atuais depois de reiniciar?"
|
63 |
+
|
64 |
+
#: wp-reset.php:193
|
65 |
+
#: ../wordpress-database-reset/wp-reset.php:193
|
66 |
+
#, php-format
|
67 |
+
msgid "The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead"
|
68 |
+
msgstr "O usuário padrão <strong><u>admin</u></strong>, nunca foi criado nesta instalação do WordPress. Então, o usuário <strong><u>%s</u></strong> será recriado com a sua senha atual"
|
69 |
+
|
70 |
+
#: wp-reset.php:195
|
71 |
+
#: ../wordpress-database-reset/wp-reset.php:195
|
72 |
+
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
73 |
+
msgstr "O usuário padrão <strong><u>admin</u></strong> será recriado com sua senha atual mediante a reinicialização"
|
74 |
+
|
75 |
+
#: wp-reset.php:198
|
76 |
+
#: ../wordpress-database-reset/wp-reset.php:198
|
77 |
+
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
78 |
+
msgstr "Note que, uma vez que você reiniciar o banco de dados, todos os usuários serão apagados, exceto o usuário <strong><u>admin</u></strong> inicial."
|
79 |
+
|
80 |
+
#: wp-reset.php:216
|
81 |
+
#: ../wordpress-database-reset/wp-reset.php:216
|
82 |
+
msgid "Select Table"
|
83 |
+
msgstr "Selecionar Tabela"
|
84 |
+
|
85 |
+
#: wp-reset.php:226
|
86 |
+
#: ../wordpress-database-reset/wp-reset.php:226
|
87 |
+
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
88 |
+
msgstr "Clicar em OK fará com que o banco de dados seja reiniciado para as configurações iniciais. Continuar?"
|
89 |
+
|
90 |
+
#: wp-reset.php:273
|
91 |
+
#: ../wordpress-database-reset/wp-reset.php:273
|
92 |
+
msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
93 |
+
msgstr "Tem alguma idéia legal para este plugin? Entre em contato comigo pelo <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> ou pelo <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
94 |
+
|
95 |
+
#: wp-reset.php:274
|
96 |
+
#: ../wordpress-database-reset/wp-reset.php:274
|
97 |
+
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
98 |
+
msgstr "Se este plugin se tornar não-funcional de alguma forma devido a upgrades WordPress, eu vou atualizá-lo."
|
99 |
+
|
100 |
+
#: wp-reset.php:275
|
101 |
+
#: ../wordpress-database-reset/wp-reset.php:275
|
102 |
+
msgid "Goodbye for now."
|
103 |
+
msgstr "Adeus por agora."
|
104 |
+
|
105 |
+
#: wp-reset.php:345
|
106 |
+
#: ../wordpress-database-reset/wp-reset.php:345
|
107 |
+
msgid "WordPress Database Reset"
|
108 |
+
msgstr "WordPress Reiniciar Banco de Dados"
|
109 |
+
|
110 |
+
#: wp-reset.php:346
|
111 |
+
#: ../wordpress-database-reset/wp-reset.php:346
|
112 |
+
msgid "The tables you selected have been successfully reset to their default settings:"
|
113 |
+
msgstr "As tabelas selecionadas foram reiniciadas com sucesso para suas configurações padrão:"
|
114 |
+
|
115 |
+
#: wp-reset.php:347
|
116 |
+
#: ../wordpress-database-reset/wp-reset.php:347
|
117 |
+
msgid "Password: The password you chose during the install."
|
118 |
+
msgstr "Senha: A senha que você escolheu durante a instalação."
|
119 |
+
|
readme.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
=== WordPress Database Reset ===
|
2 |
|
3 |
Contributors: mousesports
|
4 |
-
Tags: wordpress, database, database-reset, development, default-settings, default, wp-reset, security, secure
|
5 |
License: GPL2
|
6 |
-
Requires at least: 3.
|
7 |
-
Tested up to: 3.
|
8 |
-
Stable tag: 2.
|
9 |
|
10 |
-
A
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
WordPress Database Reset
|
15 |
|
16 |
This plugin will come in handy for both theme and plugin developers. There are different use case scenarios - one of which is being able to easily erase excess junk in the wp_options table that accumulates over time. Another would be to simply obtain a fresh install of the WordPress database after experimenting with various back-end options.
|
17 |
|
@@ -22,16 +22,21 @@ then activate the plugin. You could also use the built-in Add New Plugin
|
|
22 |
feature within WordPress. After activating, you will automatically be redirected
|
23 |
to the plugin page.
|
24 |
|
25 |
-
== Frequently Asked Questions ==
|
26 |
-
|
27 |
-
= Why reset the database? =
|
28 |
-
|
29 |
-
I wanted a simple and painless way to obtain a fresh clean database without actually having to reinstall WordPress. Plus, 9 times out of 10 I get tons of excess junk in the wp_options table after installing plugins and themes that do not clean up after themselves.
|
30 |
-
|
31 |
== Screenshots ==
|
32 |
1. The plugin page - a more secure way of resetting your database.
|
33 |
|
34 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
= 2.1 =
|
36 |
* Replaced 3.3 deprecated get_userdatabylogin() with get_user_by()
|
37 |
* Updated deprecated add_contextual_help() with add_help_tab()
|
1 |
=== WordPress Database Reset ===
|
2 |
|
3 |
Contributors: mousesports
|
4 |
+
Tags: wordpress, database, database-reset, restore, setup, development, default-settings, default, wp-reset, security, secure
|
5 |
License: GPL2
|
6 |
+
Requires at least: 3.5
|
7 |
+
Tested up to: 3.7.1
|
8 |
+
Stable tag: 2.3
|
9 |
|
10 |
+
A simple way to reset the database to the state of WordPress right after you install it for the first time.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
WordPress Database Reset allows for a secure and easy way to reinitialize your WordPress database back to its default settings without having to reinstall WordPress yourself.
|
15 |
|
16 |
This plugin will come in handy for both theme and plugin developers. There are different use case scenarios - one of which is being able to easily erase excess junk in the wp_options table that accumulates over time. Another would be to simply obtain a fresh install of the WordPress database after experimenting with various back-end options.
|
17 |
|
22 |
feature within WordPress. After activating, you will automatically be redirected
|
23 |
to the plugin page.
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
== Screenshots ==
|
26 |
1. The plugin page - a more secure way of resetting your database.
|
27 |
|
28 |
== Changelog ==
|
29 |
+
= 2.3 =
|
30 |
+
* Removed deprecated function $wpdb->escape(), replaced with esc_sql()
|
31 |
+
* Add German translation, thanks to Ulrich Pogson
|
32 |
+
* Updated screenshot-1.png
|
33 |
+
* Renamed default localization file
|
34 |
+
* Fixed broken if conditional during code clean up for version 2.2
|
35 |
+
|
36 |
+
= 2.2 =
|
37 |
+
* Fixed scripts and styles to only load on plugin page
|
38 |
+
* Formatted code to meet WordPress syntax standards
|
39 |
+
|
40 |
= 2.1 =
|
41 |
* Replaced 3.3 deprecated get_userdatabylogin() with get_user_by()
|
42 |
* Updated deprecated add_contextual_help() with add_help_tab()
|
screenshot-1.png
CHANGED
Binary file
|
wp-reset.php
CHANGED
@@ -1,472 +1,412 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: WordPress Database Reset
|
4 |
-
Plugin URI: https://github.com/chrisberthe/wordpress-database-reset
|
5 |
-
Description: A plugin that allows you to reset the database to WordPress's initial state.
|
6 |
-
Version: 2.
|
7 |
-
Author: Chris Berthe ☻
|
8 |
-
Author URI: https://github.com/chrisberthe
|
9 |
-
License: GNU General Public License
|
10 |
-
*/
|
11 |
-
|
12 |
-
if ( ! class_exists('
|
13 |
-
|
14 |
-
class
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Nonce value
|
18 |
-
*/
|
19 |
-
private $_nonce = 'wp-reset-nonce';
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Tables to preserve
|
23 |
-
*/
|
24 |
-
private $_tables;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* WordPress database tables
|
28 |
-
*/
|
29 |
-
private $_wp_tables;
|
30 |
-
|
31 |
-
/**
|
32 |
-
*
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
//
|
78 |
-
$
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
//
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
?>
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
<p><?php
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
<?php
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
*
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
*
|
346 |
-
*
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
return
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
*
|
383 |
-
*
|
384 |
-
*
|
385 |
-
*
|
386 |
-
* @
|
387 |
-
* @
|
388 |
-
|
389 |
-
|
390 |
-
{
|
391 |
-
global $wpdb;
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
// Array of table rows
|
413 |
-
foreach ($table_data as $row)
|
414 |
-
{
|
415 |
-
$columns = $values = array();
|
416 |
-
|
417 |
-
// Loop through current object row
|
418 |
-
foreach ($row as $column => $value)
|
419 |
-
{
|
420 |
-
$columns[] = $column;
|
421 |
-
$values[] = $wpdb->escape($value);
|
422 |
-
}
|
423 |
-
|
424 |
-
$wpdb->query("INSERT INTO $table_name (" . implode(', ', $columns) . ") VALUES ('" . implode("', '", $values) . "')");
|
425 |
-
}
|
426 |
-
}
|
427 |
-
break;
|
428 |
-
}
|
429 |
-
}
|
430 |
-
|
431 |
-
return;
|
432 |
-
}
|
433 |
-
|
434 |
-
/**
|
435 |
-
* Updates the user password and clears / sets
|
436 |
-
* the authentication cookie for the user
|
437 |
-
*
|
438 |
-
* @access private
|
439 |
-
* @param $user Current or admin user
|
440 |
-
* @param $keys Array returned by wp_install()
|
441 |
-
* @return TRUE on install success, FALSE otherwise
|
442 |
-
*/
|
443 |
-
function _wp_update_user($user, $keys)
|
444 |
-
{
|
445 |
-
global $wpdb;
|
446 |
-
extract($keys, EXTR_SKIP);
|
447 |
-
|
448 |
-
// Set the old password back to the user
|
449 |
-
$query = $wpdb->prepare("UPDATE $wpdb->users SET user_pass = '%s', user_activation_key = '' WHERE ID = '%d'", $user->user_pass, $user_id);
|
450 |
-
|
451 |
-
if ( $wpdb->query($query) )
|
452 |
-
{
|
453 |
-
// Delete the default_password_nag
|
454 |
-
// so it doesn't pop up with the password reminder after installing
|
455 |
-
if ( get_user_meta($user_id, 'default_password_nag') ) delete_user_meta($user_id, 'default_password_nag');
|
456 |
-
|
457 |
-
wp_clear_auth_cookie();
|
458 |
-
wp_set_auth_cookie($user_id);
|
459 |
-
|
460 |
-
return TRUE;
|
461 |
-
}
|
462 |
-
|
463 |
-
return FALSE;
|
464 |
-
}
|
465 |
-
|
466 |
-
}
|
467 |
-
|
468 |
-
$cb_wp_reset = new cb_wp_reset();
|
469 |
-
|
470 |
-
register_activation_hook( __FILE__, array('cb_wp_reset', 'plugin_activate') );
|
471 |
-
|
472 |
endif;
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WordPress Database Reset
|
4 |
+
Plugin URI: https://github.com/chrisberthe/wordpress-database-reset
|
5 |
+
Description: A plugin that allows you to reset the database to WordPress's initial state.
|
6 |
+
Version: 2.3
|
7 |
+
Author: Chris Berthe ☻
|
8 |
+
Author URI: https://github.com/chrisberthe
|
9 |
+
License: GNU General Public License
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! class_exists('CB_WP_Reset') && is_admin() ) :
|
13 |
+
|
14 |
+
class CB_WP_Reset {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Nonce value
|
18 |
+
*/
|
19 |
+
private $_nonce = 'wp-reset-nonce';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Tables to preserve
|
23 |
+
*/
|
24 |
+
private $_tables;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* WordPress database tables
|
28 |
+
*/
|
29 |
+
private $_wp_tables;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Loads default options
|
33 |
+
*
|
34 |
+
* @return void
|
35 |
+
*/
|
36 |
+
function __construct() {
|
37 |
+
add_action('init', array($this, 'init_language'));
|
38 |
+
add_action('admin_init', array($this, 'wp_reset_init'));
|
39 |
+
add_action('admin_init', array($this, '_redirect_user'));
|
40 |
+
add_action('admin_menu', array($this, 'add_admin_menu'));
|
41 |
+
add_filter('wp_mail', array($this, '_fix_mail'));
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Handles the admin page functionality
|
46 |
+
*
|
47 |
+
* @access public
|
48 |
+
* @uses wp_install Located in includes/upgrade.php (line 22)
|
49 |
+
*/
|
50 |
+
function wp_reset_init() {
|
51 |
+
global $wpdb, $current_user, $pagenow;
|
52 |
+
|
53 |
+
// Grab the WordPress database tables
|
54 |
+
$this->_wp_tables = $wpdb->tables();
|
55 |
+
|
56 |
+
// Check for valid input - goes ahead and drops / resets tables
|
57 |
+
if ( isset($_POST['wp-random-value'], $_POST['wp-reset-input']) && $_POST['wp-random-value'] == $_POST['wp-reset-input']
|
58 |
+
&& check_admin_referer('wp-nonce-submit', $this->_nonce) ) {
|
59 |
+
|
60 |
+
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
|
61 |
+
|
62 |
+
// No tables were selected
|
63 |
+
if ( ! isset($_POST['tables']) && empty($_POST['tables']) ) {
|
64 |
+
wp_redirect( admin_url( $pagenow ) . '?page=wp-reset&reset=no-select' ); exit();
|
65 |
+
}
|
66 |
+
|
67 |
+
// Get current options
|
68 |
+
$blog_title = get_option('blogname');
|
69 |
+
$public = get_option('blog_public');
|
70 |
+
|
71 |
+
$admin_user = get_user_by('login', 'admin');
|
72 |
+
$user = ( ! $admin_user || ! user_can($admin_user->ID, 'update_core') ) ? $current_user : $admin_user;
|
73 |
+
|
74 |
+
// Get the selected tables
|
75 |
+
$tables = (isset($_POST['tables'])) ? array_flip($_POST['tables']) : array();
|
76 |
+
|
77 |
+
// Compare the selected tables against the ones in the database
|
78 |
+
$this->_tables = array_diff_key($this->_wp_tables, $tables);
|
79 |
+
|
80 |
+
// Preserve the data from the tables that are unique
|
81 |
+
if ( 0 < count($this->_tables) )
|
82 |
+
$backup_tables = $this->_backup_tables($this->_tables);
|
83 |
+
|
84 |
+
// Grab the currently active plugins
|
85 |
+
if ( isset($_POST['wp-reset-check']) && 'true' == $_POST['wp-reset-check'] )
|
86 |
+
$active_plugins = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", 'active_plugins') );
|
87 |
+
|
88 |
+
// Run through the database columns, drop all the tables and
|
89 |
+
// install wp with previous settings
|
90 |
+
if ( $db_tables = $wpdb->get_col("SHOW TABLES LIKE '{$wpdb->prefix}%'") ) {
|
91 |
+
foreach ($db_tables as $db_table) {
|
92 |
+
$wpdb->query("DROP TABLE {$db_table}");
|
93 |
+
}
|
94 |
+
$keys = wp_install($blog_title, $user->user_login, $user->user_email, $public);
|
95 |
+
$this->_wp_update_user($user, $keys);
|
96 |
+
}
|
97 |
+
|
98 |
+
// Delete and replace tables with the backed up table data
|
99 |
+
if ( $backup_tables ) {
|
100 |
+
foreach ($this->_tables as $table) {
|
101 |
+
$wpdb->query("DELETE FROM " . $table);
|
102 |
+
}
|
103 |
+
$this->_backup_tables($backup_tables, 'reset');
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( ! empty($active_plugins) ) {
|
107 |
+
$wpdb->update($wpdb->options, array('option_value' => $active_plugins), array('option_name' => 'active_plugins'));
|
108 |
+
wp_redirect( admin_url($pagenow) . '?page=wp-reset&reset=success' ); exit();
|
109 |
+
}
|
110 |
+
|
111 |
+
wp_redirect( admin_url() ); exit();
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Displays the admin page
|
117 |
+
*
|
118 |
+
* @access public
|
119 |
+
* @return void
|
120 |
+
*/
|
121 |
+
function show_admin_page() {
|
122 |
+
global $current_user;
|
123 |
+
|
124 |
+
// Return to see if admin object exists
|
125 |
+
$admin_user = get_user_by('login', 'admin');
|
126 |
+
$random_string = wp_generate_password(5, false);
|
127 |
+
?>
|
128 |
+
<?php if ( isset($_POST['wp-random-value'], $_POST['wp-reset-input']) && $_POST['wp-random-value'] != $_POST['wp-reset-input'] ) : ?>
|
129 |
+
<div class="error"><p><strong><?php _e('You entered the wrong value - please try again', 'wp-reset') ?>.</strong></p></div>
|
130 |
+
<?php elseif ( isset($_GET['reset']) && 'no-select' == $_GET['reset'] ) : ?>
|
131 |
+
<div class="error"><p><strong><?php _e('You did not select any database tables', 'wp-reset') ?>.</strong></p></div>
|
132 |
+
<?php elseif ( isset($_GET['reset']) && 'success' == $_GET['reset'] ) : ?>
|
133 |
+
<div class="updated"><p><strong><?php _e('The WordPress database has been reset successfully', 'wp-reset') ?>.</strong></p></div>
|
134 |
+
<?php endif ?>
|
135 |
+
|
136 |
+
<div class="wrap">
|
137 |
+
<?php screen_icon() ?>
|
138 |
+
<h2><?php _e('Database Reset', 'wp-reset') ?></h2>
|
139 |
+
<form action="" method="POST" id="wp-reset-form">
|
140 |
+
<p><?php _e('Please choose from the following database tables the ones you would like to reset', 'wp-reset') ?>:</p>
|
141 |
+
<div id="select-buttons">
|
142 |
+
<span><a href='#' id="select-all"><?php _e('Select All', 'wp-reset') ?></a></span>
|
143 |
+
<select id="wp-tables" multiple="multiple" name="tables[]" onchange="changeHandler()">
|
144 |
+
<?php foreach ( $this->_wp_tables as $key => $value ) : ?>
|
145 |
+
<option><?php echo $key ?></option>
|
146 |
+
<?php endforeach ?>
|
147 |
+
</select>
|
148 |
+
</div>
|
149 |
+
<p><?php _e('Type in (or copy/paste) the generated value into the text box', 'wp-reset') ?>: <strong><?php echo $random_string ?></strong></p>
|
150 |
+
<?php wp_nonce_field('wp-nonce-submit', $this->_nonce) ?>
|
151 |
+
<input type="hidden" name="wp-random-value" value="<?php echo $random_string ?>" id="wp-random-value" />
|
152 |
+
<input type="text" name="wp-reset-input" value="" id="wp-reset-input" />
|
153 |
+
<input type="submit" name="wp-reset-submit" value="<?php _e('Reset Database', 'wp-reset') ?>" id="wp-reset-submit" class="button-primary" />
|
154 |
+
<img src="<?php echo plugins_url('css/i/ajax-loader.gif', __FILE__) ?>" alt="loader" id="loader" style="display: none" />
|
155 |
+
<div id="reactivate" style="display: none">
|
156 |
+
<p>
|
157 |
+
<label for="wp-reset-check">
|
158 |
+
<input type="checkbox" name="wp-reset-check" id="wp-reset-check" checked="checked" value="true" />
|
159 |
+
<?php _e('Reactivate current plugins after reset?', 'wp-reset') ?>
|
160 |
+
</label>
|
161 |
+
</p>
|
162 |
+
</div>
|
163 |
+
</form>
|
164 |
+
|
165 |
+
<?php if ( ! $admin_user || ! user_can($admin_user->ID, 'update_core') ) : ?>
|
166 |
+
<p style="margin-top: 25px"><?php printf( __('The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead', 'wp-reset'), $current_user->user_login ) ?>.</p>
|
167 |
+
<?php else : ?>
|
168 |
+
<p><?php _e('The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting', 'wp-reset') ?>.</p>
|
169 |
+
<?php endif ?>
|
170 |
+
|
171 |
+
<p><?php _e('Note that once you reset the database, all users will be deleted except the initial admin user.', 'wp-reset') ?></p>
|
172 |
+
</div>
|
173 |
+
<?php }
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Add JavaScript to the bottom of the plugin page
|
177 |
+
*
|
178 |
+
* @access public
|
179 |
+
* @return bool TRUE on reset confirmation
|
180 |
+
*/
|
181 |
+
function add_admin_javascript() {
|
182 |
+
?>
|
183 |
+
<script type="text/javascript">
|
184 |
+
/* <![CDATA[ */
|
185 |
+
(function($) {
|
186 |
+
|
187 |
+
$('#wp-tables').bsmSelect({
|
188 |
+
animate: true,
|
189 |
+
title: "<?php _e('Select Table', 'wp-reset') ?>",
|
190 |
+
plugins: [$.bsmSelect.plugins.compatibility()]
|
191 |
+
});
|
192 |
+
|
193 |
+
$("#select-all").click(function() {
|
194 |
+
$("#wp-tables").children().attr("selected", "selected").end().change();
|
195 |
+
return false;
|
196 |
+
});
|
197 |
+
|
198 |
+
$('#wp-reset-submit').click(function() {
|
199 |
+
var message = "<?php _e('Clicking OK will result in your database being reset to its initial settings. Continue?', 'wp-reset') ?>";
|
200 |
+
var reset = confirm(message);
|
201 |
+
|
202 |
+
if (reset) {
|
203 |
+
$('#wp-reset-form').submit();
|
204 |
+
$('#loader').show();
|
205 |
+
} else {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
});
|
209 |
+
|
210 |
+
window.changeHandler = function() {
|
211 |
+
var op = $("#wp-tables option[value='options']:selected");
|
212 |
+
$('#reactivate').toggle(op.length > 0);
|
213 |
+
}
|
214 |
+
|
215 |
+
})(jQuery);
|
216 |
+
/* ]]> */
|
217 |
+
</script>
|
218 |
+
<?php
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Adds our submenu item to the Tools menu
|
223 |
+
*
|
224 |
+
* @access public
|
225 |
+
* @return void
|
226 |
+
*/
|
227 |
+
function add_admin_menu() {
|
228 |
+
if ( current_user_can('update_core') ) {
|
229 |
+
$this->_hook = add_submenu_page('tools.php', 'Database Reset', 'Database Reset', 'update_core', 'wp-reset', array($this, 'show_admin_page'));
|
230 |
+
add_action('load-' . $this->_hook, array($this, 'option_page_actions'));
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Fires actions on option page load
|
236 |
+
*
|
237 |
+
* @return void
|
238 |
+
*/
|
239 |
+
function option_page_actions() {
|
240 |
+
add_action('admin_enqueue_scripts', array($this, 'add_plugin_styles_and_scripts'));
|
241 |
+
add_action('admin_footer', array($this, 'add_admin_javascript'));
|
242 |
+
$this->_add_help_screen();
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Adds v3.3 style help menu for plugin page
|
247 |
+
*
|
248 |
+
* @access private
|
249 |
+
* @return void
|
250 |
+
*/
|
251 |
+
function _add_help_screen() {
|
252 |
+
get_current_screen()->add_help_tab( array(
|
253 |
+
'id' => 'overview',
|
254 |
+
'title' => __( 'Overview' ),
|
255 |
+
'content' =>
|
256 |
+
'<p>' . __( 'This plugin allows you to securely and easily reinitialize the WordPress database back to its default settings without actually having to reinstall WordPress from scratch. This plugin will come in handy for both theme and plugin developers. Two possible use case scenarios would be to:') . '</p>' .
|
257 |
+
'<p>' . __( '<strong>1.</strong> Erase excess junk in the <code>wp_options</code> table that accumulates over time.<br /><strong>2.</strong> Revert back to a fresh install of the WordPress database after experimenting with various back-end options.' ) . '</p>'
|
258 |
+
) );
|
259 |
+
get_current_screen()->add_help_tab( array(
|
260 |
+
'id' => 'instructions',
|
261 |
+
'title' => __( 'Instructions' ),
|
262 |
+
'content' =>
|
263 |
+
'<p>' . __( 'Performing a database reset is quite straightforward.' ) . '</p>' .
|
264 |
+
'<p>' . __( 'Select the different tables you would like to reinitialize from the drop down list. You can select any number of tables. If you know you would like to reset the entire database, simply click the <code>Select All</code> button.' ) . '</p>' .
|
265 |
+
'<p>' . __( 'Next you will have to enter the <code>auto generated value</code> into the text box. Clicking on the <code>Reset Database</code> button will result in a pop-up.' ) . '</p>' .
|
266 |
+
'<p>' . __( 'Once you are sure you would like to proceed, click <code>OK</code> to reset.' ) . '</p>'
|
267 |
+
) );
|
268 |
+
|
269 |
+
get_current_screen()->set_help_sidebar(
|
270 |
+
'<p><strong>' . __( 'Contact information:' ) . '</strong></p>' .
|
271 |
+
'<p>' . __( 'Any ideas on features or ways to improve this plugin? Contact me at <a href="http://github.com/chrisberthe/" target="_blank">GitHub</a> or <a href="http://twitter.com/chrisberthe/" target="_blank">Twitter</a>.' ) . '</p>'
|
272 |
+
);
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Adds any plugin styles to our page
|
277 |
+
*
|
278 |
+
* @access public
|
279 |
+
* @return void
|
280 |
+
*/
|
281 |
+
function add_plugin_styles_and_scripts() {
|
282 |
+
wp_enqueue_style('wordpress-reset-css', plugins_url('css/wp-reset.css', __FILE__));
|
283 |
+
wp_enqueue_style('bsmselect-css', plugins_url('css/jquery.bsmselect.css', __FILE__));
|
284 |
+
|
285 |
+
wp_enqueue_script('bsmselect', plugins_url('js/jquery.bsmselect.js', __FILE__));
|
286 |
+
wp_enqueue_script('bsmselect-compatibility', plugins_url('js/jquery.bsmselect.compatibility.js', __FILE__));
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Load language path
|
291 |
+
*
|
292 |
+
* @access public
|
293 |
+
* @return void
|
294 |
+
*/
|
295 |
+
function init_language() {
|
296 |
+
$language_dir = basename(dirname(__FILE__)) . '/languages';
|
297 |
+
load_plugin_textdomain('wp-reset', false, $language_dir);
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* For activation hook
|
302 |
+
*
|
303 |
+
* @access public
|
304 |
+
* @return void
|
305 |
+
*/
|
306 |
+
function plugin_activate() {
|
307 |
+
add_option('wp-reset-activated', true);
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Redirects the user after the plugin is activated
|
312 |
+
*
|
313 |
+
* @access private
|
314 |
+
* @return void
|
315 |
+
*/
|
316 |
+
function _redirect_user() {
|
317 |
+
if ( get_option('wp-reset-activated', false) ) {
|
318 |
+
delete_option('wp-reset-activated');
|
319 |
+
wp_redirect(admin_url('tools.php') . '?page=wp-reset');
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Changes the password to a sentence rather than
|
325 |
+
* an auto-generated password that is sent by email
|
326 |
+
* right after the installation is complete
|
327 |
+
*
|
328 |
+
* @access private
|
329 |
+
* @return $mail Version with password changed
|
330 |
+
*/
|
331 |
+
function _fix_mail($mail) {
|
332 |
+
$subject = __('WordPress Database Reset', 'wp-reset');
|
333 |
+
$message = __('The tables you selected have been successfully reset to their default settings:', 'wp-reset');
|
334 |
+
$password = __('Password: The password you chose during the install.', 'wp-reset');
|
335 |
+
|
336 |
+
if ( stristr($mail['message'], 'Your new WordPress site has been successfully set up at:') ) {
|
337 |
+
$mail['subject'] = preg_replace('/New WordPress Site/', $subject, $mail['subject']);
|
338 |
+
$mail['message'] = preg_replace('/Your new WordPress site has been successfully set up at:+/', $message, $mail['message']);
|
339 |
+
$mail['message'] = preg_replace('/Password:\s.+/', $password, $mail['message']);
|
340 |
+
}
|
341 |
+
return $mail;
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Preserves all the results from the tables the user
|
346 |
+
* did not select from the drop-down. Also resets these
|
347 |
+
* results back after reinstalling WordPress.
|
348 |
+
*
|
349 |
+
* @access private
|
350 |
+
* @return array Backed up data if type backup, void if reset
|
351 |
+
*/
|
352 |
+
function _backup_tables($tables, $type = 'backup') {
|
353 |
+
global $wpdb;
|
354 |
+
|
355 |
+
if ( is_array($tables) ) {
|
356 |
+
switch ( $type ) {
|
357 |
+
case 'backup':
|
358 |
+
$backup_tables = array();
|
359 |
+
foreach ( $tables as $table ) {
|
360 |
+
$backup_tables[$table] = $wpdb->get_results("SELECT * FROM " . $table);
|
361 |
+
}
|
362 |
+
return $backup_tables;
|
363 |
+
break;
|
364 |
+
case 'reset':
|
365 |
+
foreach ( $tables as $table_name => $table_data ) {
|
366 |
+
foreach ($table_data as $row) {
|
367 |
+
$columns = $values = array();
|
368 |
+
foreach ( $row as $column => $value ) {
|
369 |
+
$columns[] = $column;
|
370 |
+
$values[] = esc_sql($value);
|
371 |
+
}
|
372 |
+
$wpdb->query("INSERT INTO $table_name (" . implode(', ', $columns) . ") VALUES ('" . implode("', '", $values) . "')");
|
373 |
+
}
|
374 |
+
}
|
375 |
+
break;
|
376 |
+
}
|
377 |
+
}
|
378 |
+
return;
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Updates the user password and clears / sets
|
383 |
+
* the authentication cookie for the user
|
384 |
+
*
|
385 |
+
* @access private
|
386 |
+
* @param $user Current or admin user
|
387 |
+
* @param $keys Array returned by wp_install()
|
388 |
+
* @return true on install success, false otherwise
|
389 |
+
*/
|
390 |
+
function _wp_update_user($user, $keys) {
|
391 |
+
global $wpdb;
|
392 |
+
extract($keys, EXTR_SKIP);
|
393 |
+
|
394 |
+
$query = $wpdb->prepare("UPDATE $wpdb->users SET user_pass = '%s', user_activation_key = '' WHERE ID = '%d'", $user->user_pass, $user_id);
|
395 |
+
|
396 |
+
if ( $wpdb->query($query) ) {
|
397 |
+
// Remove password reminder after installing
|
398 |
+
if ( get_user_meta($user_id, 'default_password_nag') ) delete_user_meta($user_id, 'default_password_nag');
|
399 |
+
|
400 |
+
wp_clear_auth_cookie();
|
401 |
+
wp_set_auth_cookie($user_id);
|
402 |
+
|
403 |
+
return true;
|
404 |
+
}
|
405 |
+
return false;
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
+
$cb_wp_reset = new CB_WP_Reset();
|
410 |
+
register_activation_hook( __FILE__, array('cb_wp_reset', 'plugin_activate') );
|
411 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
endif;
|