Easy Updates Manager - Version 6.4.6

Version Description

Released 2017-11-24

  • Added icons to the plugins and themes screen to align it with WordPress 4.9.
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 Easy Updates Manager
Version 6.4.6
Comparing to
See all releases

Code changes from version 6.4.4 to 6.4.6

Files changed (52) hide show
  1. contributing.md +0 -24
  2. css/index.php +0 -0
  3. css/source/_mixin-flexbox.scss +0 -394
  4. css/source/style.scss +0 -390
  5. css/style.css +1 -1
  6. css/sweetalert2.css +0 -0
  7. images/index.php +0 -0
  8. images/spinner.gif +0 -0
  9. includes/MPSUM_Admin.php +85 -86
  10. includes/MPSUM_Admin_Advanced.php +0 -0
  11. includes/MPSUM_Admin_Core.php +0 -0
  12. includes/MPSUM_Admin_Dashboard.php +0 -0
  13. includes/MPSUM_Admin_Help.php +0 -0
  14. includes/MPSUM_Admin_Logs.php +0 -0
  15. includes/MPSUM_Admin_Plugins.php +0 -0
  16. includes/MPSUM_Admin_Screen_Options.php +0 -0
  17. includes/MPSUM_Admin_Themes.php +0 -0
  18. includes/MPSUM_Disable_Updates.php +0 -0
  19. includes/MPSUM_Disable_Updates_All.php +0 -0
  20. includes/MPSUM_Disable_Updates_Plugins.php +0 -0
  21. includes/MPSUM_Disable_Updates_Themes.php +0 -0
  22. includes/MPSUM_Disable_Updates_Translations.php +0 -0
  23. includes/MPSUM_Disable_Updates_WordPress.php +0 -0
  24. includes/MPSUM_List_Table.php +0 -0
  25. includes/MPSUM_Logs.php +0 -0
  26. includes/MPSUM_Logs_List_Table.php +0 -0
  27. includes/MPSUM_Plugins_List_Table.php +29 -19
  28. includes/MPSUM_Themes_List_Table.php +20 -18
  29. includes/MPSUM_Tracking.php +0 -0
  30. js/admin.js +0 -0
  31. js/index.php +0 -0
  32. js/source/dashboard/components/loading.jsx +0 -23
  33. js/source/dashboard/components/main.jsx +0 -144
  34. js/source/dashboard/components/ratingsnag.jsx +0 -46
  35. js/source/dashboard/components/toggleitem.jsx +0 -59
  36. js/source/dashboard/components/toggleiteminput.jsx +0 -95
  37. js/source/dashboard/components/toggleitemradio.jsx +0 -87
  38. js/source/dashboard/components/toggletabs.jsx +0 -65
  39. js/source/dashboard/components/togglewrapper.jsx +0 -81
  40. js/source/dashboard/components/trackingnag.jsx +0 -63
  41. js/source/dashboard/data/EUMActionTypes.jsx +0 -4
  42. js/source/dashboard/data/EUMActions.jsx +0 -16
  43. js/source/dashboard/data/EUMDispatcher.jsx +0 -3
  44. js/source/main.js +0 -2
  45. js/source/screenoptions.js +0 -64
  46. js/source/sweetalert2.common.js +0 -1635
  47. js/source/sweetalert2.js +0 -1641
  48. license.txt +0 -0
  49. main.php +74 -74
  50. readme.md +0 -0
  51. readme.txt +14 -49
  52. uninstall.php +0 -0
contributing.md DELETED
@@ -1,24 +0,0 @@
1
- Easy Updates Manager is a 100% volunteer run plugin. We are always happy to welcome new contributors to help make Easy Updates Manager a better plugin.
2
-
3
- # Getting Started with Contributing
4
- There are many ways that you can contribute to Easy Updates Manager.
5
- - Coding
6
- - Documentation
7
- - Support
8
- - Translations
9
-
10
- ## Coding
11
- Coding is not easy. A good start to contibuting with code is to create a pull request through GitHub.
12
-
13
- If you plan on doing this then please make sure that you use the most recent branch of Easy Updates Manager to make your changes on, and most importantly use the most recent version of WordPress to test your changes on.
14
-
15
- ## Documentation
16
- Documentation is always needing to be updated. Also there can never be too much documentation. For this reason we are more than happy for you to write up some documentation for Easy Updates Manager. This can consist of writing pages for our wiki, writing a post about how to use Easy Updates Manager, or even create a video about Easy Updates Manager. Either one of these we would very much appreciate.
17
-
18
- Note that if you want to right up stuff for the wiki then please submit an issue with your suggested wiki changes so that we can have a look.
19
-
20
- ## Support
21
- Support is a fairly big thing to manage. We volunteers at Easy Updates Manager want to make sure that our users get the best support they can. How you can help with this is extremely simple. Head on over to our <a href="https://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates">WordPress Support Forum</a> and answer some support topics.
22
-
23
- ## Translation
24
- We are always trying to expand Easy Updates Managers translations. If you are interested in translating Easy Updates Manager, please <a href="https://translate.wordpress.org/projects/wp-plugins/stops-core-theme-and-plugin-updates">go here</a>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/index.php CHANGED
File without changes
css/source/_mixin-flexbox.scss DELETED
@@ -1,394 +0,0 @@
1
- // Flexbox Mixins
2
- // http://philipwalton.github.io/solved-by-flexbox/
3
- // https://github.com/philipwalton/solved-by-flexbox
4
- //
5
- // Copyright (c) 2013 Brian Franco
6
- //
7
- // Permission is hereby granted, free of charge, to any person obtaining a
8
- // copy of this software and associated documentation files (the
9
- // "Software"), to deal in the Software without restriction, including
10
- // without limitation the rights to use, copy, modify, merge, publish,
11
- // distribute, sublicense, and/or sell copies of the Software, and to
12
- // permit persons to whom the Software is furnished to do so, subject to
13
- // the following conditions:
14
- // The above copyright notice and this permission notice shall be included
15
- // in all copies or substantial portions of the Software.
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- //
24
- // This is a set of mixins for those who want to mess around with flexbox
25
- // using the native support of current browsers. For full support table
26
- // check: http://caniuse.com/flexbox
27
- //
28
- // Basically this will use:
29
- //
30
- // * Fallback, old syntax (IE10, mobile webkit browsers - no wrapping)
31
- // * Final standards syntax (FF, Safari, Chrome, IE11, Opera)
32
- //
33
- // This was inspired by:
34
- //
35
- // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
36
- //
37
- // With help from:
38
- //
39
- // * http://w3.org/tr/css3-flexbox/
40
- // * http://the-echoplex.net/flexyboxes/
41
- // * http://msdn.microsoft.com/en-us/library/ie/hh772069(v=vs.85).aspx
42
- // * http://css-tricks.com/using-flexbox/
43
- // * http://dev.opera.com/articles/view/advanced-cross-browser-flexbox/
44
- // * https://developer.mozilla.org/en-us/docs/web/guide/css/flexible_boxes
45
-
46
- //----------------------------------------------------------------------
47
-
48
- // Flexbox Containers
49
- //
50
- // The 'flex' value causes an element to generate a block-level flex
51
- // container box.
52
- //
53
- // The 'inline-flex' value causes an element to generate a inline-level
54
- // flex container box.
55
- //
56
- // display: flex | inline-flex
57
- //
58
- // http://w3.org/tr/css3-flexbox/#flex-containers
59
- //
60
- // (Placeholder selectors for each type, for those who rather @extend)
61
-
62
- @mixin flexbox {
63
- display: -webkit-box;
64
- display: -webkit-flex;
65
- display: -moz-flex;
66
- display: -ms-flexbox;
67
- display: flex;
68
- }
69
-
70
- %flexbox { @include flexbox; }
71
-
72
- //----------------------------------
73
-
74
- @mixin inline-flex {
75
- display: -webkit-inline-box;
76
- display: -webkit-inline-flex;
77
- display: -moz-inline-flex;
78
- display: -ms-inline-flexbox;
79
- display: inline-flex;
80
- }
81
-
82
- %inline-flex { @include inline-flex; }
83
-
84
- //----------------------------------------------------------------------
85
-
86
- // Flexbox Direction
87
- //
88
- // The 'flex-direction' property specifies how flex items are placed in
89
- // the flex container, by setting the direction of the flex container's
90
- // main axis. This determines the direction that flex items are laid out in.
91
- //
92
- // Values: row | row-reverse | column | column-reverse
93
- // Default: row
94
- //
95
- // http://w3.org/tr/css3-flexbox/#flex-direction-property
96
-
97
- @mixin flex-direction($value: row) {
98
- @if $value == row-reverse {
99
- -webkit-box-direction: reverse;
100
- -webkit-box-orient: horizontal;
101
- } @else if $value == column {
102
- -webkit-box-direction: normal;
103
- -webkit-box-orient: vertical;
104
- } @else if $value == column-reverse {
105
- -webkit-box-direction: reverse;
106
- -webkit-box-orient: vertical;
107
- } @else {
108
- -webkit-box-direction: normal;
109
- -webkit-box-orient: horizontal;
110
- }
111
- -webkit-flex-direction: $value;
112
- -moz-flex-direction: $value;
113
- -ms-flex-direction: $value;
114
- flex-direction: $value;
115
- }
116
- // Shorter version:
117
- @mixin flex-dir($args...) { @include flex-direction($args...); }
118
-
119
- //----------------------------------------------------------------------
120
-
121
- // Flexbox Wrap
122
- //
123
- // The 'flex-wrap' property controls whether the flex container is single-line
124
- // or multi-line, and the direction of the cross-axis, which determines
125
- // the direction new lines are stacked in.
126
- //
127
- // Values: nowrap | wrap | wrap-reverse
128
- // Default: nowrap
129
- //
130
- // http://w3.org/tr/css3-flexbox/#flex-wrap-property
131
-
132
- @mixin flex-wrap($value: nowrap) {
133
- // No Webkit Box fallback.
134
- -webkit-flex-wrap: $value;
135
- -moz-flex-wrap: $value;
136
- @if $value == nowrap {
137
- -ms-flex-wrap: none;
138
- } @else {
139
- -ms-flex-wrap: $value;
140
- }
141
- flex-wrap: $value;
142
- }
143
-
144
- //----------------------------------------------------------------------
145
-
146
- // Flexbox Flow (shorthand)
147
- //
148
- // The 'flex-flow' property is a shorthand for setting the 'flex-direction'
149
- // and 'flex-wrap' properties, which together define the flex container's
150
- // main and cross axes.
151
- //
152
- // Values: <flex-direction> | <flex-wrap>
153
- // Default: row nowrap
154
- //
155
- // http://w3.org/tr/css3-flexbox/#flex-flow-property
156
-
157
- @mixin flex-flow($values: (row nowrap)) {
158
- // No Webkit Box fallback.
159
- -webkit-flex-flow: $values;
160
- -moz-flex-flow: $values;
161
- -ms-flex-flow: $values;
162
- flex-flow: $values;
163
- }
164
-
165
- //----------------------------------------------------------------------
166
-
167
- // Flexbox Order
168
- //
169
- // The 'order' property controls the order in which flex items appear within
170
- // their flex container, by assigning them to ordinal groups.
171
- //
172
- // Default: 0
173
- //
174
- // http://w3.org/tr/css3-flexbox/#order-property
175
-
176
- @mixin order($int: 0) {
177
- -webkit-box-ordinal-group: $int + 1;
178
- -webkit-order: $int;
179
- -moz-order: $int;
180
- -ms-flex-order: $int;
181
- order: $int;
182
- }
183
-
184
- //----------------------------------------------------------------------
185
-
186
- // Flexbox Grow
187
- //
188
- // The 'flex-grow' property sets the flex grow factor. Negative numbers
189
- // are invalid.
190
- //
191
- // Default: 0
192
- //
193
- // http://w3.org/tr/css3-flexbox/#flex-grow-property
194
-
195
- @mixin flex-grow($int: 0) {
196
- -webkit-box-flex: $int;
197
- -webkit-flex-grow: $int;
198
- -moz-flex-grow: $int;
199
- -ms-flex-positive: $int;
200
- flex-grow: $int;
201
- }
202
-
203
- //----------------------------------------------------------------------
204
-
205
- // Flexbox Shrink
206
- //
207
- // The 'flex-shrink' property sets the flex shrink factor. Negative numbers
208
- // are invalid.
209
- //
210
- // Default: 1
211
- //
212
- // http://w3.org/tr/css3-flexbox/#flex-shrink-property
213
-
214
- @mixin flex-shrink($int: 1) {
215
- -webkit-flex-shrink: $int;
216
- -moz-flex-shrink: $int;
217
- -ms-flex-negative: $int;
218
- flex-shrink: $int;
219
- }
220
-
221
- //----------------------------------------------------------------------
222
-
223
- // Flexbox Basis
224
- //
225
- // The 'flex-basis' property sets the flex basis. Negative lengths are invalid.
226
- //
227
- // Values: Like "width"
228
- // Default: auto
229
- //
230
- // http://www.w3.org/TR/css3-flexbox/#flex-basis-property
231
-
232
- @mixin flex-basis($value: auto) {
233
- -webkit-flex-basis: $value;
234
- -moz-flex-basis: $value;
235
- -ms-flex-preferred-size: $value;
236
- flex-basis: $value;
237
- }
238
-
239
- //----------------------------------------------------------------------
240
-
241
- // Flexbox "Flex" (shorthand)
242
- //
243
- // The 'flex' property specifies the components of a flexible length: the
244
- // flex grow factor and flex shrink factor, and the flex basis. When an
245
- // element is a flex item, 'flex' is consulted instead of the main size
246
- // property to determine the main size of the element. If an element is
247
- // not a flex item, 'flex' has no effect.
248
- //
249
- // Values: none | <flex-grow> <flex-shrink> || <flex-basis>
250
- // Default: See individual properties (1 1 0).
251
- //
252
- // http://w3.org/tr/css3-flexbox/#flex-property
253
-
254
- @mixin flex($fg: 1, $fs: null, $fb: null) {
255
-
256
- // Set a variable to be used by box-flex properties
257
- $fg-boxflex: $fg;
258
-
259
- // Box-Flex only supports a flex-grow value so let's grab the
260
- // first item in the list and just return that.
261
- @if type-of($fg) == 'list' {
262
- $fg-boxflex: nth($fg, 1);
263
- }
264
-
265
- -webkit-box-flex: $fg-boxflex;
266
- -webkit-flex: $fg $fs $fb;
267
- -moz-box-flex: $fg-boxflex;
268
- -moz-flex: $fg $fs $fb;
269
- -ms-flex: $fg $fs $fb;
270
- flex: $fg $fs $fb;
271
- }
272
-
273
- //----------------------------------------------------------------------
274
-
275
- // Flexbox Justify Content
276
- //
277
- // The 'justify-content' property aligns flex items along the main axis
278
- // of the current line of the flex container. This is done after any flexible
279
- // lengths and any auto margins have been resolved. Typically it helps distribute
280
- // extra free space leftover when either all the flex items on a line are
281
- // inflexible, or are flexible but have reached their maximum size. It also
282
- // exerts some control over the alignment of items when they overflow the line.
283
- //
284
- // Note: 'space-*' values not supported in older syntaxes.
285
- //
286
- // Values: flex-start | flex-end | center | space-between | space-around
287
- // Default: flex-start
288
- //
289
- // http://w3.org/tr/css3-flexbox/#justify-content-property
290
-
291
- @mixin justify-content($value: flex-start) {
292
- @if $value == flex-start {
293
- -webkit-box-pack: start;
294
- -ms-flex-pack: start;
295
- } @else if $value == flex-end {
296
- -webkit-box-pack: end;
297
- -ms-flex-pack: end;
298
- } @else if $value == space-between {
299
- -webkit-box-pack: justify;
300
- -ms-flex-pack: justify;
301
- } @else if $value == space-around {
302
- -ms-flex-pack: distribute;
303
- } @else {
304
- -webkit-box-pack: $value;
305
- -ms-flex-pack: $value;
306
- }
307
- -webkit-justify-content: $value;
308
- -moz-justify-content: $value;
309
- justify-content: $value;
310
- }
311
- // Shorter version:
312
- @mixin flex-just($args...) { @include justify-content($args...); }
313
-
314
- //----------------------------------------------------------------------
315
-
316
- // Flexbox Align Items
317
- //
318
- // Flex items can be aligned in the cross axis of the current line of the
319
- // flex container, similar to 'justify-content' but in the perpendicular
320
- // direction. 'align-items' sets the default alignment for all of the flex
321
- // container's items, including anonymous flex items. 'align-self' allows
322
- // this default alignment to be overridden for individual flex items. (For
323
- // anonymous flex items, 'align-self' always matches the value of 'align-items'
324
- // on their associated flex container.)
325
- //
326
- // Values: flex-start | flex-end | center | baseline | stretch
327
- // Default: stretch
328
- //
329
- // http://w3.org/tr/css3-flexbox/#align-items-property
330
-
331
- @mixin align-items($value: stretch) {
332
- @if $value == flex-start {
333
- -webkit-box-align: start;
334
- -ms-flex-align: start;
335
- } @else if $value == flex-end {
336
- -webkit-box-align: end;
337
- -ms-flex-align: end;
338
- } @else {
339
- -webkit-box-align: $value;
340
- -ms-flex-align: $value;
341
- }
342
- -webkit-align-items: $value;
343
- -moz-align-items: $value;
344
- align-items: $value;
345
- }
346
-
347
- //----------------------------------
348
-
349
- // Flexbox Align Self
350
- //
351
- // Values: auto | flex-start | flex-end | center | baseline | stretch
352
- // Default: auto
353
-
354
- @mixin align-self($value: auto) {
355
- // No Webkit Box Fallback.
356
- -webkit-align-self: $value;
357
- -moz-align-self: $value;
358
- @if $value == flex-start {
359
- -ms-flex-item-align: start;
360
- } @else if $value == flex-end {
361
- -ms-flex-item-align: end;
362
- } @else {
363
- -ms-flex-item-align: $value;
364
- }
365
- align-self: $value;
366
- }
367
-
368
- //----------------------------------------------------------------------
369
-
370
- // Flexbox Align Content
371
- //
372
- // The 'align-content' property aligns a flex container's lines within the
373
- // flex container when there is extra space in the cross-axis, similar to
374
- // how 'justify-content' aligns individual items within the main-axis. Note,
375
- // this property has no effect when the flexbox has only a single line.
376
- //
377
- // Values: flex-start | flex-end | center | space-between | space-around | stretch
378
- // Default: stretch
379
- //
380
- // http://w3.org/tr/css3-flexbox/#align-content-property
381
-
382
- @mixin align-content($value: stretch) {
383
- // No Webkit Box Fallback.
384
- -webkit-align-content: $value;
385
- -moz-align-content: $value;
386
- @if $value == flex-start {
387
- -ms-flex-line-pack: start;
388
- } @else if $value == flex-end {
389
- -ms-flex-line-pack: end;
390
- } @else {
391
- -ms-flex-line-pack: $value;
392
- }
393
- align-content: $value;
394
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/source/style.scss DELETED
@@ -1,390 +0,0 @@
1
- @import "mixin-flexbox";
2
-
3
- #eum-dashboard-app {
4
- width: 99%;
5
- margin:30px auto 0;
6
- &:after {
7
- display: inline-block;
8
- width: 100%;
9
- content: '';
10
- clear: both;
11
- }
12
- }
13
- #eum-dashboard-wrappers {
14
- clear: both;
15
- @include flexbox;
16
- @include justify-content(space-between);
17
- @include flex-wrap(wrap);
18
- }
19
- /* CSS hack for uneven items */
20
- #eum-dashboard-wrappers:after {
21
- content: ' ';
22
- display: block;
23
- width: 100%;
24
- max-width: 32%;
25
-
26
- }
27
- .dashboard-main-wrapper {
28
- width: 100%;
29
- max-width: 32%;
30
- display: inline-block;
31
- text-align: left;
32
- vertical-align: top;
33
- margin-bottom:30px;
34
- -webkit-box-sizing: border-box;
35
- -moz-box-sizing: border-box;
36
- box-sizing: border-box;
37
- }
38
- #dashboard-main-columns {
39
- margin-bottom:30px;
40
- }
41
- #dashboard-main-columns .dashboard-main-wrapper:last-child {
42
- padding:0;
43
- }
44
- .dashboard-item-wrapper {
45
- background: #e4e4e4; /* Old browsers */
46
- border-radius: 0px 0px 10px 10px;
47
- -moz-border-radius: 0px 0px 10px 10px;
48
- -webkit-border-radius: 0px 0px 10px 10px;
49
- border: 0px solid #eb3835;
50
- overflow: hidden;
51
- color: #000;
52
- font-weight: 700;
53
- }
54
- .dashboard-main-header {
55
- background: #111014;
56
- border-radius: 10px 10px 0px 0px;
57
- -moz-border-radius: 10px 10px 0px 0px;
58
- -webkit-border-radius: 10px 10px 0px 0px;
59
- border: 1px solid #e4e4e4;
60
- padding: 15px 10px;
61
- color: #fafafa;
62
- font-size: 14px;
63
- font-weight:400;
64
- }
65
-
66
- .dashboard-item-choice {
67
- input {
68
- max-height: 0;
69
- max-width: 0;
70
- opacity: 0;
71
- visibility: 0;
72
- &:disabled {
73
- opacity: 0;
74
- visibility: 0;
75
- }
76
- }
77
- input + label {
78
- display: block;
79
- position: relative;
80
- text-indent: -5000px;
81
- height: 19px;
82
- width: 37px;
83
- border-radius: 15px;
84
- float: right;
85
-
86
- &:before {
87
- content: "";
88
- position: absolute;
89
- display: block;
90
- height: 20px;
91
- width: 40px;
92
- top: 0;
93
- left: 0;
94
- border-radius: 15px;
95
- background: rgba(19, 191, 17, 0);
96
- box-shadow: inset 0 0 0px 1px #e33524;
97
-
98
- -moz-transition: .25s ease-in-out;
99
- -webkit-transition: .25s ease-in-out;
100
- transition: .25s ease-in-out;
101
- }
102
- &:after {
103
- content: "";
104
- position: absolute;
105
- display: block;
106
- height: 12px;
107
- width: 12px;
108
- top: 4px;
109
- left: 5px;
110
- border-radius: 15px;
111
- background: #e33524;
112
- -moz-transition: .25s ease-in-out;
113
- -webkit-transition: .25s ease-in-out;
114
- transition: .25s ease-in-out;
115
-
116
- }
117
- }
118
- .mpsum-spinner {
119
- float: right;
120
- }
121
- }
122
- .dashboard-main-wrapper input {
123
- &:checked {
124
- &:before {
125
- display: none;
126
- }
127
- +label:before {
128
- width: 40px;
129
- background: rgba(208, 208, 208, .3);
130
- box-shadow: inset 0 0 0px 1px #0daf88;
131
- }
132
- +label:after {
133
- left: 23px;
134
- background:rgba(37, 175, 118, 1);
135
- }
136
- }
137
- &:disabled {
138
- +label:after {
139
- background: gray;
140
- }
141
- }
142
- }
143
-
144
- #dashboard-main-outputs .dashboard-hide {
145
- display: none;
146
- }
147
- .dashboard-item-header {
148
- clear: both;
149
- float: left;
150
- width: 60%;
151
- font-weight: 100;
152
- }
153
- .dashboard-item {
154
- cursor: pointer;
155
- clear: both;
156
- border-bottom: 1px solid #d2d2d2;
157
- padding: 18px 15px;
158
- overflow: hidden;
159
- -webkit-transition: all 0.2s ease;
160
- -moz-transition: all 0.2s ease;
161
- -ms-transition: all 0.2s ease;
162
- -o-transition: all 0.2s ease;
163
- transition: all 0.2s ease;
164
- &:first-child {
165
- border-top: none;
166
- }
167
- &:hover {
168
- background:#ececec;
169
- -webkit-transition: all 0.2s ease;
170
- -moz-transition: all 0.2s ease;
171
- -ms-transition: all 0.2s ease;
172
- -o-transition: all 0.2s ease;
173
- transition: all 0.2s ease;
174
- }
175
- }
176
- .dashboard-item-header {
177
- color:#888;
178
- -webkit-transition: all 0.2s ease;
179
- -moz-transition: all 0.2s ease;
180
- -ms-transition: all 0.2s ease;
181
- -o-transition: all 0.2s ease;
182
- transition: all 0.2s ease;
183
- }
184
- .dashboard-item.active .dashboard-item-header{
185
- color:#000;
186
- -webkit-transition: all 0.2s ease;
187
- -moz-transition: all 0.2s ease;
188
- -ms-transition: all 0.2s ease;
189
- -o-transition: all 0.2s ease;
190
- transition: all 0.2s ease;
191
- }
192
- .dashboard-item.active .dashboard-item-header.input-radio {
193
- font-weight: 700;
194
- }
195
- .dashboard-item-header.input-radio {
196
- color:#555;
197
- font-weight: 400;
198
- }
199
- .dashboard-tab-item {
200
- background: #FFF;
201
- width: 50%;
202
- float: left;
203
- text-align: center;
204
- overflow: hidden;
205
- color:#ddd;
206
- }
207
- .dashboard-tab-item a,
208
- .dashboard-tab-item a:link,
209
- .dashboard-tab-item a:active,
210
- .dashboard-tab-item a:visited {
211
- display: block;
212
- width: 100%;
213
- background: #FFF;
214
- color: #aaa;
215
- text-decoration: none;
216
- padding: 15px 0;
217
- text-transform:uppercase;
218
- }
219
- .dashboard-tab-item.active a{
220
- font-weight: 800;
221
- color:#000;
222
- border-bottom:2px solid #1990f8;
223
- }
224
- .dashboard-tab-content.active {
225
- display: block;
226
- }
227
- .dashboard-tab-content {
228
- display: none;
229
- }
230
- .dashboard-tab {
231
- overflow: hidden;
232
- border: 1px solid #e4e4e4;
233
- border-top: none;
234
- }
235
- .dashboard-item-wrapper {
236
- max-height: 700px;
237
- overflow: auto;
238
- padding-bottom:20px;
239
- }
240
- .dashboard-item-wrapper p {
241
- padding: 15px;
242
- padding-bottom: 0;
243
- margin-bottom: 0;
244
- }
245
- /*
246
- .dashboard-main-wrapper:nth-child( odd ) {
247
- clear: left;
248
- }
249
- */
250
- .multi-choice {
251
- clear: both;
252
- margin-top: 20px;
253
- }
254
-
255
- label{
256
- font-weight: 100 !important;
257
-
258
- }
259
-
260
- .multi-choice-item input[type=radio] {
261
- -webkit-appearance: none; /* remove default */
262
- margin: 10px;
263
- width: 15px;
264
- height: 16px;
265
- border-radius: 12px;
266
- cursor: pointer;
267
- vertical-align: middle;
268
- outline: none;
269
- border:1px solid #e33524;
270
- background-color:#dddddd;
271
- -webkit-transition: background-position .15s cubic-bezier(.8, 0, 1, 1),
272
- -webkit-transform .25s cubic-bezier(.8, 0, 1, 1);
273
- }
274
-
275
- .multi-choice-item input[type=checkbox]:checked:before,
276
- .multi-choice-item input[type=radio]:checked:before {
277
- background-color:#0daf88 !important;
278
- }
279
-
280
- .multi-choice-item input[type=checkbox]:checked,
281
- .multi-choice-item input[type="radio"]:checked {
282
- -webkit-transition: background-position .2s .15s cubic-bezier(0, 0, .2, 1),
283
- -webkit-transform .25s cubic-bezier(0, 0, .2, 1);
284
- background:rgba(37, 175, 118, 1);
285
- border:1px solid #0daf88;
286
- }
287
- .multi-choice-item input[type="radio"]:checked:disabled {
288
- background: grey;
289
- }
290
- .multi-choice-item input[type=radio]:active {
291
- -webkit-transform: scale(1.5);
292
- -webkit-transition: -webkit-transform .1s cubic-bezier(0, 0, .2, 1);
293
- background:rgba(37, 175, 118, 1);
294
- }
295
- .multi-choice-item input[type="radio"]:active:disabled {
296
- background: inherit;
297
- }
298
-
299
-
300
- /* The up/down direction logic */
301
- #dashboard-main-outputs input,
302
- #dashboard-main-outputs input:active {
303
- background-position: 0 24px;
304
- }
305
- #dashboard-main-outputs input:checked {
306
- background-position: 0 0;
307
- }
308
- #dashboard-main-outputs input:checked ~ input,
309
- #dashboard-main-outputs input:checked ~ input:active {
310
- background-position: 0 -24px;
311
- }
312
- .button.delete {
313
- background-color: #e14d43;
314
- color: #FFF;
315
- }
316
- .mpsum-error,
317
- .mpsum-notice {
318
- background: #fff;
319
- border-left: 4px solid #dc3232;
320
- -webkit-box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
321
- box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
322
- margin: 5px 15px 2px;
323
- padding: 1px 12px;
324
- margin: 5px 0 15px;
325
- color: #ff0000;
326
- }
327
- .mpsum-notice {
328
- border-left-color: #00a0d2;
329
- color: #000;
330
- }
331
- .mpsum-error p,
332
- .mpsum-notice p {
333
- margin: 0.5em 0;
334
- padding: 2px;
335
- }
336
- .eum-ratings-nag {
337
- li {
338
- display: inline-block;
339
- margin-right: 10px;
340
- }
341
- a {
342
- display: inline-block;
343
- }
344
- }
345
-
346
- @media only screen and (max-width:1200px) {
347
- #eum-dashboard-app {
348
- width:100%;
349
- }
350
- }
351
- @media only screen and (max-width:1000px) {
352
- #eum-dashboard-app .dashboard-main-wrapper {
353
- width: 48.5%;
354
- max-width: 48.5%;
355
- padding:0;
356
-
357
- }
358
- .dashboard-item-wrapper {
359
- min-height: auto;
360
- max-height: 700px;
361
- overflow: auto;
362
- }
363
- }
364
- @media only screen and (max-width:782px) {
365
- #eum-dashboard-app .dashboard-main-wrapper {
366
- width: 98.5%;
367
- max-width: 98.5%;
368
- }
369
- #eum-dashboard-app {
370
- margin-top: 20px;
371
- }
372
- #eum-dashboard-app input[type=radio]:checked:before {
373
- margin:0 !important;
374
- }
375
- }
376
-
377
- .eum-button {
378
- padding: 20 10px;
379
- display: block;
380
- width: 90%;
381
- margin: 0 auto;
382
- margin-top: 20px !important;
383
- }
384
-
385
- .swal2-confirm {
386
- display: none;
387
- }
388
- .swal2-cancel {
389
- display: none !important;
390
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/style.css CHANGED
@@ -1 +1 @@
1
- #eum-dashboard-app{width:99%;margin:30px auto 0}#eum-dashboard-app:after{display:inline-block;width:100%;content:"";clear:both}#eum-dashboard-wrappers{clear:both;display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;-moz-justify-content:space-between;justify-content:space-between;-webkit-flex-wrap:wrap;-moz-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}#eum-dashboard-wrappers:after{content:" ";display:block;width:100%;max-width:32%}.dashboard-main-wrapper{width:100%;max-width:32%;display:inline-block;text-align:left;vertical-align:top;margin-bottom:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#dashboard-main-columns{margin-bottom:30px}#dashboard-main-columns .dashboard-main-wrapper:last-child{padding:0}.dashboard-item-wrapper{background:#e4e4e4;border-radius:0 0 10px 10px;-moz-border-radius:0 0 10px 10px;-webkit-border-radius:0 0 10px 10px;border:0 solid #eb3835;overflow:hidden;color:#000;font-weight:700}.dashboard-main-header{background:#111014;border-radius:10px 10px 0 0;-moz-border-radius:10px 10px 0 0;-webkit-border-radius:10px 10px 0 0;border:1px solid #e4e4e4;padding:15px 10px;color:#fafafa;font-size:14px;font-weight:400}.dashboard-item-choice input{max-height:0;max-width:0;opacity:0;visibility:0}.dashboard-item-choice input:disabled{opacity:0;visibility:0}.dashboard-item-choice input+label{display:block;position:relative;text-indent:-5000px;height:19px;width:37px;border-radius:15px;float:right}.dashboard-item-choice input+label:before{height:20px;width:40px;top:0;left:0;background:rgba(19,191,17,0);box-shadow:inset 0 0 0 1px #e33524}.dashboard-item-choice input+label:after,.dashboard-item-choice input+label:before{content:"";position:absolute;display:block;border-radius:15px;-moz-transition:.25s ease-in-out;-webkit-transition:.25s ease-in-out;transition:.25s ease-in-out}.dashboard-item-choice input+label:after{height:12px;width:12px;top:4px;left:5px;background:#e33524}.dashboard-item-choice .mpsum-spinner{float:right}.dashboard-main-wrapper input:checked:before{display:none}.dashboard-main-wrapper input:checked+label:before{width:40px;background:hsla(0,0%,82%,.3);box-shadow:inset 0 0 0 1px #0daf88}.dashboard-main-wrapper input:checked+label:after{left:23px;background:#25af76}.dashboard-main-wrapper input:disabled+label:after{background:gray}#dashboard-main-outputs .dashboard-hide{display:none}.dashboard-item-header{clear:both;float:left;width:60%;font-weight:100}.dashboard-item{cursor:pointer;clear:both;border-bottom:1px solid #d2d2d2;padding:18px 15px;overflow:hidden;-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.dashboard-item:first-child{border-top:none}.dashboard-item:hover{background:#ececec}.dashboard-item-header,.dashboard-item:hover{-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.dashboard-item-header{color:#888}.dashboard-item.active .dashboard-item-header{color:#000;-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.dashboard-item.active .dashboard-item-header.input-radio{font-weight:700}.dashboard-item-header.input-radio{color:#555;font-weight:400}.dashboard-tab-item{background:#fff;width:50%;float:left;text-align:center;overflow:hidden;color:#ddd}.dashboard-tab-item a,.dashboard-tab-item a:active,.dashboard-tab-item a:link,.dashboard-tab-item a:visited{display:block;width:100%;background:#fff;color:#aaa;text-decoration:none;padding:15px 0;text-transform:uppercase}.dashboard-tab-item.active a{font-weight:800;color:#000;border-bottom:2px solid #1990f8}.dashboard-tab-content.active{display:block}.dashboard-tab-content{display:none}.dashboard-tab{overflow:hidden;border:1px solid #e4e4e4;border-top:none}.dashboard-item-wrapper{max-height:700px;overflow:auto;padding-bottom:20px}.dashboard-item-wrapper p{padding:15px;padding-bottom:0;margin-bottom:0}.multi-choice{clear:both;margin-top:20px}label{font-weight:100!important}.multi-choice-item input[type=radio]{-webkit-appearance:none;margin:10px;width:15px;height:16px;border-radius:12px;cursor:pointer;vertical-align:middle;outline:none;border:1px solid #e33524;background-color:#ddd;-webkit-transition:background-position .15s cubic-bezier(.8,0,1,1),-webkit-transform .25s cubic-bezier(.8,0,1,1)}.multi-choice-item input[type=checkbox]:checked:before,.multi-choice-item input[type=radio]:checked:before{background-color:#0daf88!important}.multi-choice-item input[type=checkbox]:checked,.multi-choice-item input[type=radio]:checked{-webkit-transition:background-position .2s cubic-bezier(0,0,.2,1) .15s,-webkit-transform .25s cubic-bezier(0,0,.2,1);background:#25af76;border:1px solid #0daf88}.multi-choice-item input[type=radio]:checked:disabled{background:grey}.multi-choice-item input[type=radio]:active{-webkit-transform:scale(1.5);-webkit-transition:-webkit-transform .1s cubic-bezier(0,0,.2,1);background:#25af76}.multi-choice-item input[type=radio]:active:disabled{background:inherit}#dashboard-main-outputs input,#dashboard-main-outputs input:active{background-position:0 24px}#dashboard-main-outputs input:checked{background-position:0 0}#dashboard-main-outputs input:checked~input,#dashboard-main-outputs input:checked~input:active{background-position:0 -24px}.button.delete{background-color:#e14d43;color:#fff}.mpsum-error,.mpsum-notice{background:#fff;border-left:4px solid #dc3232;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px;margin:5px 0 15px;color:red}.mpsum-notice{border-left-color:#00a0d2;color:#000}.mpsum-error p,.mpsum-notice p{margin:.5em 0;padding:2px}.eum-ratings-nag li{margin-right:10px}.eum-ratings-nag a,.eum-ratings-nag li{display:inline-block}@media only screen and (max-width:1200px){#eum-dashboard-app{width:100%}}@media only screen and (max-width:1000px){#eum-dashboard-app .dashboard-main-wrapper{width:48.5%;max-width:48.5%;padding:0}.dashboard-item-wrapper{min-height:auto;max-height:700px;overflow:auto}}@media only screen and (max-width:782px){#eum-dashboard-app .dashboard-main-wrapper{width:98.5%;max-width:98.5%}#eum-dashboard-app{margin-top:20px}#eum-dashboard-app input[type=radio]:checked:before{margin:0!important}}.eum-button{padding:20 10px;display:block;width:90%;margin:0 auto;margin-top:20px!important}.swal2-confirm{display:none}.swal2-cancel{display:none!important}
1
+ #eum-dashboard-app{width:99%;margin:30px auto 0}#eum-dashboard-app:after{display:inline-block;width:100%;content:"";clear:both}#eum-dashboard-wrappers{clear:both;display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;-moz-justify-content:space-between;justify-content:space-between;-webkit-flex-wrap:wrap;-moz-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}#eum-dashboard-wrappers:after{content:" ";display:block;width:100%;max-width:32%}.dashboard-main-wrapper{width:100%;max-width:32%;display:inline-block;text-align:left;vertical-align:top;margin-bottom:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#dashboard-main-columns{margin-bottom:30px}#dashboard-main-columns .dashboard-main-wrapper:last-child{padding:0}.dashboard-item-wrapper{background:#e4e4e4;border-radius:0 0 10px 10px;-moz-border-radius:0 0 10px 10px;-webkit-border-radius:0 0 10px 10px;border:0 solid #eb3835;overflow:hidden;color:#000;font-weight:700}.dashboard-main-header{background:#111014;border-radius:10px 10px 0 0;-moz-border-radius:10px 10px 0 0;-webkit-border-radius:10px 10px 0 0;border:1px solid #e4e4e4;padding:15px 10px;color:#fafafa;font-size:14px;font-weight:400}.dashboard-item-choice input{max-height:0;max-width:0;opacity:0;visibility:0}.dashboard-item-choice input:disabled{opacity:0;visibility:0}.dashboard-item-choice input+label{display:block;position:relative;text-indent:-5000px;height:19px;width:37px;border-radius:15px;float:right}.dashboard-item-choice input+label:before{height:20px;width:40px;top:0;left:0;background:rgba(19,191,17,0);box-shadow:inset 0 0 0 1px #e33524}.dashboard-item-choice input+label:after,.dashboard-item-choice input+label:before{content:"";position:absolute;display:block;border-radius:15px;-moz-transition:.25s ease-in-out;-webkit-transition:.25s ease-in-out;transition:.25s ease-in-out}.dashboard-item-choice input+label:after{height:12px;width:12px;top:4px;left:5px;background:#e33524}.dashboard-item-choice .mpsum-spinner{float:right}.dashboard-main-wrapper input:checked:before{display:none}.dashboard-main-wrapper input:checked+label:before{width:40px;background:hsla(0,0%,82%,.3);box-shadow:inset 0 0 0 1px #0daf88}.dashboard-main-wrapper input:checked+label:after{left:23px;background:#25af76}.dashboard-main-wrapper input:disabled+label:after{background:gray}#dashboard-main-outputs .dashboard-hide{display:none}.dashboard-item-header{clear:both;float:left;width:60%;font-weight:100}.dashboard-item{cursor:pointer;clear:both;border-bottom:1px solid #d2d2d2;padding:18px 15px;overflow:hidden;-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.dashboard-item:first-child{border-top:none}.dashboard-item:hover{background:#ececec}.dashboard-item-header,.dashboard-item:hover{-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.dashboard-item-header{color:#888}.dashboard-item.active .dashboard-item-header{color:#000;-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.dashboard-item.active .dashboard-item-header.input-radio{font-weight:700}.dashboard-item-header.input-radio{color:#555;font-weight:400}.dashboard-tab-item{background:#fff;width:50%;float:left;text-align:center;overflow:hidden;color:#ddd}.dashboard-tab-item a,.dashboard-tab-item a:active,.dashboard-tab-item a:link,.dashboard-tab-item a:visited{display:block;width:100%;background:#fff;color:#aaa;text-decoration:none;padding:15px 0;text-transform:uppercase}.dashboard-tab-item.active a{font-weight:800;color:#000;border-bottom:2px solid #1990f8}.dashboard-tab-content.active{display:block}.dashboard-tab-content{display:none}.dashboard-tab{overflow:hidden;border:1px solid #e4e4e4;border-top:none}.dashboard-item-wrapper{max-height:700px;overflow:auto;padding-bottom:20px}.dashboard-item-wrapper p{padding:15px;padding-bottom:0;margin-bottom:0}.multi-choice{clear:both;margin-top:20px}label{font-weight:100!important}.multi-choice-item input[type=radio]{-webkit-appearance:none;margin:10px;width:15px;height:16px;border-radius:12px;cursor:pointer;vertical-align:middle;outline:none;border:1px solid #e33524;background-color:#ddd;-webkit-transition:background-position .15s cubic-bezier(.8,0,1,1),-webkit-transform .25s cubic-bezier(.8,0,1,1)}.multi-choice-item input[type=checkbox]:checked:before,.multi-choice-item input[type=radio]:checked:before{background-color:#0daf88!important}.multi-choice-item input[type=checkbox]:checked,.multi-choice-item input[type=radio]:checked{-webkit-transition:background-position .2s cubic-bezier(0,0,.2,1) .15s,-webkit-transform .25s cubic-bezier(0,0,.2,1);background:#25af76;border:1px solid #0daf88}.multi-choice-item input[type=radio]:checked:disabled{background:grey}.multi-choice-item input[type=radio]:active{-webkit-transform:scale(1.5);-webkit-transition:-webkit-transform .1s cubic-bezier(0,0,.2,1);background:#25af76}.multi-choice-item input[type=radio]:active:disabled{background:inherit}#dashboard-main-outputs input,#dashboard-main-outputs input:active{background-position:0 24px}#dashboard-main-outputs input:checked{background-position:0 0}#dashboard-main-outputs input:checked~input,#dashboard-main-outputs input:checked~input:active{background-position:0 -24px}.button.delete{background-color:#e14d43;color:#fff}.mpsum-error,.mpsum-notice{background:#fff;border-left:4px solid #dc3232;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px;margin:5px 0 15px;color:red}.mpsum-notice{border-left-color:#00a0d2;color:#000}.mpsum-error p,.mpsum-notice p{margin:.5em 0;padding:2px}.eum-ratings-nag li{margin-right:10px}.eum-ratings-nag a,.eum-ratings-nag li{display:inline-block}@media only screen and (max-width:1200px){#eum-dashboard-app{width:100%}}@media only screen and (max-width:1000px){#eum-dashboard-app .dashboard-main-wrapper{width:48.5%;max-width:48.5%;padding:0}.dashboard-item-wrapper{min-height:auto;max-height:700px;overflow:auto}}@media only screen and (max-width:782px){#eum-dashboard-app .dashboard-main-wrapper{width:98.5%;max-width:98.5%}#eum-dashboard-app{margin-top:20px}#eum-dashboard-app input[type=radio]:checked:before{margin:0!important}}.eum-button{padding:20 10px;display:block;width:90%;margin:0 auto;margin-top:20px!important}.plugins .plugin-title .dashicons,.plugins .plugin-title img{float:left;padding:0 10px 0 0;width:64px;height:64px}.plugins .plugin-title .dashicons:before{padding:2px;background-color:#eee;box-shadow:inset 0 0 10px hsla(210,6%,65%,.15);font-size:60px;color:#b4b9be}.eum-plugin-name{display:inline-block;margin-left:60px}.updates-table-screenshot{float:left;padding:0 10px 5px 0;width:85px;height:64px}.eum-theme-name{margin-right:85px}
css/sweetalert2.css CHANGED
File without changes
images/index.php CHANGED
File without changes
images/spinner.gif CHANGED
File without changes
includes/MPSUM_Admin.php CHANGED
@@ -9,7 +9,7 @@
9
  * @package WordPress
10
  */
11
  class MPSUM_Admin {
12
-
13
  /**
14
  * Holds the class instance.
15
  *
@@ -18,7 +18,7 @@ class MPSUM_Admin {
18
  * @var MPSUM_Admin $instance
19
  */
20
  private static $instance = null;
21
-
22
  /**
23
  * Holds the URL to the admin panel page
24
  *
@@ -27,7 +27,7 @@ class MPSUM_Admin {
27
  * @var string $url
28
  */
29
  private static $url = '';
30
-
31
  /**
32
  * Holds the slug to the admin panel page
33
  *
@@ -36,13 +36,13 @@ class MPSUM_Admin {
36
  * @var string $slug
37
  */
38
  private static $slug = 'mpsum-update-options';
39
-
40
  /**
41
  * Set a class instance.
42
  *
43
  * Set a class instance.
44
  *
45
- * @since 5.0.0
46
  * @access static
47
  *
48
  */
@@ -51,8 +51,8 @@ class MPSUM_Admin {
51
  self::$instance = new self;
52
  }
53
  return self::$instance;
54
- } //end get_instance
55
-
56
  /**
57
  * Class constructor.
58
  *
@@ -66,13 +66,13 @@ class MPSUM_Admin {
66
  add_action( 'init', array( $this, 'init' ), 9 );
67
  add_filter( 'set-screen-option', array( $this, 'add_screen_option_save' ), 10, 3 );
68
  } //end constructor
69
-
70
  /**
71
  * Save the screen options.
72
  *
73
  * Save the screen options.
74
  *
75
- * @since 6.2.0
76
  * @access static
77
  *
78
  * @return string URL to the admin panel page.
@@ -80,13 +80,13 @@ class MPSUM_Admin {
80
  public function add_screen_option_save( $status, $option, $value ) {
81
  return MPSUM_Admin_Screen_Options::save_options( $status, $option, $value );
82
  }
83
-
84
  /**
85
  * Return the URL to the admin panel page.
86
  *
87
  * Return the URL to the admin panel page.
88
  *
89
- * @since 5.0.0
90
  * @access static
91
  *
92
  * @return string URL to the admin panel page.
@@ -95,7 +95,7 @@ class MPSUM_Admin {
95
  $url = self::$url;
96
  if ( empty( $url ) ) {
97
  if ( is_multisite() ) {
98
- $url = add_query_arg( array( 'page' => self::get_slug() ), network_admin_url( 'index.php' ) );
99
  } else {
100
  $url = add_query_arg( array( 'page' => self::get_slug() ), admin_url( 'index.php' ) );
101
  }
@@ -103,13 +103,13 @@ class MPSUM_Admin {
103
  }
104
  return $url;
105
  }
106
-
107
  /**
108
  * Return the slug for the admin panel page.
109
  *
110
  * Return the slug for the admin panel page.
111
  *
112
- * @since 5.0.0
113
  * @access static
114
  *
115
  * @return string slug to the admin panel page.
@@ -117,31 +117,31 @@ class MPSUM_Admin {
117
  public static function get_slug() {
118
  return self::$slug;
119
  }
120
-
121
  /**
122
  * Initialize the admin menu.
123
  *
124
  * Initialize the admin menu.
125
  *
126
- * @since 5.0.0
127
  * @access public
128
  * @see __construct
129
  * @internal Uses init action
130
  *
131
  */
132
  public function init() {
133
-
134
  //Plugin and Theme actions
135
  if ( is_multisite() ) {
136
  add_action( 'network_admin_menu', array( $this, 'init_network_admin_menus' ) );
137
  } else {
138
  add_action( 'admin_menu', array( $this, 'init_single_site_admin_menus' ) );
139
  }
140
-
141
  //Add settings link to plugins screen
142
  $prefix = is_multisite() ? 'network_admin_' : '';
143
  add_action( $prefix . 'plugin_action_links_' . MPSUM_Updates_Manager::get_plugin_basename(), array( $this, 'plugin_settings_link' ) );
144
-
145
  //todo - maybe load these conditionally based on $_REQUEST[ 'tab' ] param
146
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
147
  new MPSUM_Admin_Dashboard( self::get_slug() );
@@ -152,17 +152,17 @@ class MPSUM_Admin {
152
  }
153
  new MPSUM_Admin_Core( self::get_slug() );
154
  new MPSUM_Admin_Advanced( self::get_slug() );
155
-
156
  MPSUM_Admin_Screen_Options::maybe_save_dashboard_screen_option();
157
-
158
- }
159
-
160
  /**
161
  * Initializes the help screen.
162
  *
163
  * Initializes the help screen.
164
  *
165
- * @since 5.0.0
166
  * @access public
167
  * @see init
168
  * @internal Uses load_{$hook} action
@@ -171,7 +171,7 @@ class MPSUM_Admin {
171
  public function init_help_screen() {
172
  new MPSUM_Admin_Help();
173
  }
174
-
175
  /**
176
  * Initializes the screen options.
177
  *
@@ -186,7 +186,7 @@ class MPSUM_Admin {
186
  public function init_screen_options() {
187
  MPSUM_Admin_Screen_Options::run();
188
  }
189
-
190
  /**
191
  * Returns formatted array of EUM options
192
  *
@@ -204,21 +204,21 @@ class MPSUM_Admin {
204
  $options[ 'core' ] = MPSUM_Admin_Core::get_defaults();
205
  }
206
  if ( ! isset( $options[ 'plugins' ] ) ) {
207
- $options[ 'plugins' ] = array();
208
  }
209
  if ( ! isset( $options[ 'themes' ] ) ) {
210
- $options[ 'themes' ] = array();
211
  }
212
  if ( ! isset( $options[ 'plugins_automatic' ] ) ) {
213
- $options[ 'plugins_automatic' ] = array();
214
  }
215
  if ( ! isset( $options[ 'themes_automatic' ] ) ) {
216
- $options[ 'themes_automatic' ] = array();
217
  }
218
  return $options;
219
-
220
  }
221
-
222
  /**
223
  * Returns whether a JSON component should be disabled or not.
224
  *
@@ -245,7 +245,7 @@ class MPSUM_Admin {
245
  return true;
246
  break;
247
  }
248
-
249
  } elseif ( 'off' == $options[ 'core' ][ 'plugin_updates' ] && 'plugin_updates' !== $option ) {
250
  switch( $context ) {
251
  case 'plugins':
@@ -275,9 +275,9 @@ class MPSUM_Admin {
275
  return true;
276
  break;
277
  }
278
-
279
  } elseif ( 'off' == $options[ 'core' ][ 'translation_updates' ] && 'translation_updates' != $option ) {
280
-
281
 
282
  switch( $option ) {
283
  case 'automatic_translation_updates':
@@ -297,7 +297,7 @@ class MPSUM_Admin {
297
  break;
298
  }
299
  }
300
-
301
  switch( $context ) {
302
  case 'plugins_automatic':
303
  if ( isset( $options[ 'core' ][ 'automatic_plugin_updates' ] ) && 'on' == $options[ 'core' ][ 'automatic_plugin_updates' ] ) {
@@ -330,7 +330,7 @@ class MPSUM_Admin {
330
  }
331
  return false;
332
  }
333
-
334
  /**
335
  * Returns whether a JSON component should be enabled or not.
336
  *
@@ -356,7 +356,7 @@ class MPSUM_Admin {
356
  case 'core':
357
  return false;
358
  break;
359
- }
360
  } elseif ( 'off' == $options[ 'core' ][ 'translation_updates' ] && 'translation_updates' != $option ) {
361
  switch( $option ) {
362
  case 'automatic_translation_updates':
@@ -380,7 +380,7 @@ class MPSUM_Admin {
380
  return false;
381
  break;
382
  }
383
-
384
  } elseif ( 'off' == $options[ 'core' ][ 'theme_updates' ] && 'theme_updates' != $option ) {
385
  switch( $context ) {
386
  case 'themes':
@@ -396,9 +396,9 @@ class MPSUM_Admin {
396
  break;
397
  }
398
  }
399
-
400
  if( isset( $options[ $context ][ $option ] ) && 'on' == $options[ $context ][ $option ] ) {
401
- return true;
402
  } else {
403
  switch( $context ) {
404
  case 'plugins':
@@ -450,7 +450,7 @@ class MPSUM_Admin {
450
  }
451
  return false;
452
  }
453
-
454
  /**
455
  * Returns whether a JSON component should be selected or not.
456
  *
@@ -474,7 +474,7 @@ class MPSUM_Admin {
474
  break;
475
  default:
476
  break;
477
- }
478
  } elseif ( 'off' == $options[ 'core' ][ 'plugin_updates' ] && 'plugin_updates' != $option ) {
479
  switch( $option ) {
480
  case 'automatic_plugin_updates':
@@ -493,12 +493,12 @@ class MPSUM_Admin {
493
  case 'automatic_plugin_updates':
494
  return 'off';
495
  break;
496
- }
497
  }
498
-
499
  return $options[ $context ][ $option ];
500
  }
501
-
502
  /**
503
  * Returns JSON options for use in React
504
  *
@@ -509,7 +509,7 @@ class MPSUM_Admin {
509
  */
510
  public function get_json_options() {
511
  $options = MPSUM_Updates_Manager::get_options();
512
-
513
  $boxes = array();
514
  $boxes[] = array(
515
  'title' => __( 'WordPress Updates', 'stops-core-theme-and-plugin-updates' ),
@@ -560,7 +560,7 @@ class MPSUM_Admin {
560
  'loading' => false,
561
  'context' => 'core'
562
  )
563
-
564
  ),
565
  );
566
  $boxes[] = array(
@@ -667,7 +667,7 @@ class MPSUM_Admin {
667
  )
668
  );
669
  $plugins = get_plugins();
670
- $plugin_items = array();
671
  $plugin_automatic_items = array();
672
  foreach( $plugins as $plugin_slug => $plugin_data ) {
673
  $plugin_items[] = array(
@@ -689,10 +689,10 @@ class MPSUM_Admin {
689
  'checked' => $this->get_json_maybe_checked( $plugin_slug, 'plugins_automatic' ),
690
  'loading' => false,
691
  'context' => 'plugins_automatic',
692
- );
693
  }
694
  $themes = wp_get_themes();
695
- $theme_items = array();
696
  $theme_automatic_items = array();
697
  foreach( $themes as $theme_slug => $theme_data ) {
698
  $theme_items[] = array(
@@ -718,7 +718,7 @@ class MPSUM_Admin {
718
  }
719
  $boxes[] = array(
720
  'title' => __( 'Plugin and Theme Updates', 'stops-core-theme-and-plugin-updates' ),
721
- 'items' => array(
722
  array(
723
  'id' => 'plugins-themes',
724
  'component' => 'ToggleTabs',
@@ -742,7 +742,7 @@ class MPSUM_Admin {
742
  );
743
  $boxes[] = array(
744
  'title' => __( 'Plugin and Theme Automatic Updates', 'stops-core-theme-and-plugin-updates' ),
745
- 'items' => array(
746
  array(
747
  'id' => 'plugins-themes-automatic',
748
  'component' => 'ToggleTabs',
@@ -781,33 +781,33 @@ class MPSUM_Admin {
781
  );
782
  return $boxes;
783
  }
784
-
785
  public function enqueue_scripts() {
786
  $pagenow = isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : false;
787
  $is_active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : false;
788
-
789
  //Check to make sure we're on the mpsum admin page
790
  if ( $pagenow != 'mpsum-update-options' ) {
791
- return;
792
  }
793
-
794
  // Get user data
795
  $user_id = get_current_user_id();
796
  $dashboard_showing = get_user_meta( $user_id, 'mpsum_dashboard', true );
797
-
798
  // Get options
799
  $options = MPSUM_Updates_Manager::get_options( 'core' );
800
-
801
  wp_enqueue_script( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/js/admin.js' ), array( 'jquery' ), '20171106', true );
802
-
803
  $user_id = get_current_user_id();
804
  $dashboard_showing = get_user_meta( $user_id, 'mpsum_dashboard', true );
805
  if ( ! $dashboard_showing ) {
806
  $dashboard_showing = 'on';
807
  }
808
-
809
  $options = $options = MPSUM_Updates_Manager::get_options();
810
-
811
  /**
812
  * Filter whether a ratings nag is enabled/disabled or not
813
  *
@@ -819,7 +819,7 @@ class MPSUM_Admin {
819
  if ( isset( $options[ 'core' ][ 'ratings_nag' ] ) && false == $options[ 'core' ][ 'ratings_nag' ] ) {
820
  $ratings_nag_showing = false;
821
  }
822
-
823
  /**
824
  * Filter whether a tracking nag is enabled/disabled or not
825
  *
@@ -831,15 +831,15 @@ class MPSUM_Admin {
831
  if ( isset( $options[ 'core' ][ 'tracking_nag' ] ) && 'off' == $options[ 'core' ][ 'tracking_nag' ] ) {
832
  $tracking_nag_showing = 'off';
833
  }
834
-
835
  $has_wizard = 'off';
836
  $maybe_has_wizard = MPSUM_Updates_Manager::get_options( 'core' );
837
  if ( empty( $maybe_has_wizard ) ) {
838
  $has_wizard = 'off'; // Change to "on" to turn back on modal
839
  }
840
-
841
  // tracking_nag
842
- wp_localize_script( 'mpsum_dashboard', 'mpsum', array(
843
  'spinner' => MPSUM_Updates_Manager::get_plugin_url( '/images/spinner.gif' ),
844
  'tabs' => _x( 'Tabs', 'Show or hide admin tabs', 'stops-core-theme-and-plugin-updates' ),
845
  'dashboard' => _x( 'Show Dashboard', 'Show or hide the dashboard', 'stops-core-theme-and-plugin-updates' ),
@@ -869,16 +869,15 @@ class MPSUM_Admin {
869
  'welcome_skip' => __( 'Configure Manually', 'stops-core-theme-and-plugin-updates' ),
870
  'new_user' => $has_wizard,
871
  ) );
872
- wp_enqueue_style( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/css/style.css' ), array(), '20170801' );
873
- wp_enqueue_style( 'sweetalert2', MPSUM_Updates_Manager::get_plugin_url( '/css/sweetalert2.css' ), array(), '20170801' );
874
  }
875
-
876
  /**
877
  * Adds a sub-menu page for multisite.
878
  *
879
  * Adds a sub-menu page for multisite.
880
  *
881
- * @since 5.0.0
882
  * @access public
883
  * @see init
884
  * @internal Uses network_admin_menu action
@@ -890,13 +889,13 @@ class MPSUM_Admin {
890
  add_action( "load-$hook", array( $this, 'init_help_screen' ) );
891
  add_action( "load-$hook", array( $this, 'init_screen_options' ) );
892
  }
893
-
894
  /**
895
  * Adds a sub-menu page for single-site.
896
  *
897
  * Adds a sub-menu page for single-site.
898
  *
899
- * @since 5.0.0
900
  * @access public
901
  * @see init
902
  * @internal Uses admin_menu action
@@ -905,16 +904,16 @@ class MPSUM_Admin {
905
  public function init_single_site_admin_menus() {
906
  $hook = add_dashboard_page( __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ) , __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ), 'install_plugins', self::get_slug(), array( $this, 'output_admin_interface' ) );
907
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
908
- add_action( "load-$hook", array( $this, 'init_help_screen' ) );
909
  add_action( "load-$hook", array( $this, 'init_screen_options' ) );
910
  }
911
-
912
  /**
913
  * Outputs admin interface for sub-menu.
914
  *
915
  * Outputs admin interface for sub-menu.
916
  *
917
- * @since 5.0.0
918
  * @access public
919
  * @see init_network_admin_menus, init_single_site_admin_menus
920
  *
@@ -928,7 +927,7 @@ class MPSUM_Admin {
928
  <?php
929
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
930
  $tabs = array();
931
-
932
  if ( 'off' !== get_user_meta( get_current_user_id(), 'mpsum_dashboard', true ) ) {
933
  $tabs[] = array(
934
  'url' => add_query_arg( array( 'tab' => 'dashboard' ), self::get_url() ), /* URL to the tab */
@@ -937,7 +936,7 @@ class MPSUM_Admin {
937
  'action' => 'mpsum_admin_tab_dashboard' /* action variable in do_action */
938
  );
939
  }
940
-
941
  $tabs[] = array(
942
  'url' => add_query_arg( array( 'tab' => 'main' ), self::get_url() ), /* URL to the tab */
943
  'label' => esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ),
@@ -986,15 +985,15 @@ class MPSUM_Admin {
986
  $do_action = isset( $tab[ 'action' ] ) ? $tab[ 'action' ] : false;
987
  }
988
  $tab_url = isset( $tab[ 'url' ] ) ? $tab[ 'url' ] : '';
989
- $tab_label = isset( $tab[ 'label' ] ) ? $tab[ 'label' ] : '';
990
  $tab_html .= sprintf( '<a href="%s" class="%s">%s</a>', esc_url( $tab_url ), esc_attr( implode( ' ', $classes ) ), esc_html( $tab[ 'label' ] ) );
991
  }
992
  $tab_html .= '</h2>';
993
  if ( $tabs_count > 1 ) {
994
- echo $tab_html;
995
  }
996
  if ( $do_action ) {
997
-
998
  /**
999
  * Perform a tab action.
1000
  *
@@ -1004,21 +1003,21 @@ class MPSUM_Admin {
1004
  *
1005
  * @param string $action Can be mpsum_admin_tab_main, mpsum_admin_tab_plugins, mpsum_admin_tab_themes, and mpsum_admin_tab_advanced.
1006
  */
1007
- do_action( $do_action );
1008
  }
1009
- }
1010
  ?>
1011
-
1012
  </div><!-- .wrap -->
1013
  <?php
1014
  } //end output_admin_interface
1015
-
1016
  /**
1017
  * Outputs admin interface for sub-menu.
1018
  *
1019
  * Outputs admin interface for sub-menu.
1020
  *
1021
- * @since 5.0.0
1022
  * @access public
1023
  * @see __construct
1024
  * @internal Uses $prefix . "plugin_action_links_$plugin_file" action
@@ -1026,7 +1025,7 @@ class MPSUM_Admin {
1026
  */
1027
  public function plugin_settings_link( $settings ) {
1028
  $admin_anchor = sprintf( '<a href="%s">%s</a>', esc_url( $this->get_url() ), esc_html__( 'Configure', 'stops-core-theme-and-plugin-updates' ) );
1029
-
1030
  if ( ! is_array( $settings ) ) {
1031
  return array( $admin_anchor );
1032
  } else {
9
  * @package WordPress
10
  */
11
  class MPSUM_Admin {
12
+
13
  /**
14
  * Holds the class instance.
15
  *
18
  * @var MPSUM_Admin $instance
19
  */
20
  private static $instance = null;
21
+
22
  /**
23
  * Holds the URL to the admin panel page
24
  *
27
  * @var string $url
28
  */
29
  private static $url = '';
30
+
31
  /**
32
  * Holds the slug to the admin panel page
33
  *
36
  * @var string $slug
37
  */
38
  private static $slug = 'mpsum-update-options';
39
+
40
  /**
41
  * Set a class instance.
42
  *
43
  * Set a class instance.
44
  *
45
+ * @since 5.0.0
46
  * @access static
47
  *
48
  */
51
  self::$instance = new self;
52
  }
53
  return self::$instance;
54
+ } //end get_instance
55
+
56
  /**
57
  * Class constructor.
58
  *
66
  add_action( 'init', array( $this, 'init' ), 9 );
67
  add_filter( 'set-screen-option', array( $this, 'add_screen_option_save' ), 10, 3 );
68
  } //end constructor
69
+
70
  /**
71
  * Save the screen options.
72
  *
73
  * Save the screen options.
74
  *
75
+ * @since 6.2.0
76
  * @access static
77
  *
78
  * @return string URL to the admin panel page.
80
  public function add_screen_option_save( $status, $option, $value ) {
81
  return MPSUM_Admin_Screen_Options::save_options( $status, $option, $value );
82
  }
83
+
84
  /**
85
  * Return the URL to the admin panel page.
86
  *
87
  * Return the URL to the admin panel page.
88
  *
89
+ * @since 5.0.0
90
  * @access static
91
  *
92
  * @return string URL to the admin panel page.
95
  $url = self::$url;
96
  if ( empty( $url ) ) {
97
  if ( is_multisite() ) {
98
+ $url = add_query_arg( array( 'page' => self::get_slug() ), network_admin_url( 'index.php' ) );
99
  } else {
100
  $url = add_query_arg( array( 'page' => self::get_slug() ), admin_url( 'index.php' ) );
101
  }
103
  }
104
  return $url;
105
  }
106
+
107
  /**
108
  * Return the slug for the admin panel page.
109
  *
110
  * Return the slug for the admin panel page.
111
  *
112
+ * @since 5.0.0
113
  * @access static
114
  *
115
  * @return string slug to the admin panel page.
117
  public static function get_slug() {
118
  return self::$slug;
119
  }
120
+
121
  /**
122
  * Initialize the admin menu.
123
  *
124
  * Initialize the admin menu.
125
  *
126
+ * @since 5.0.0
127
  * @access public
128
  * @see __construct
129
  * @internal Uses init action
130
  *
131
  */
132
  public function init() {
133
+
134
  //Plugin and Theme actions
135
  if ( is_multisite() ) {
136
  add_action( 'network_admin_menu', array( $this, 'init_network_admin_menus' ) );
137
  } else {
138
  add_action( 'admin_menu', array( $this, 'init_single_site_admin_menus' ) );
139
  }
140
+
141
  //Add settings link to plugins screen
142
  $prefix = is_multisite() ? 'network_admin_' : '';
143
  add_action( $prefix . 'plugin_action_links_' . MPSUM_Updates_Manager::get_plugin_basename(), array( $this, 'plugin_settings_link' ) );
144
+
145
  //todo - maybe load these conditionally based on $_REQUEST[ 'tab' ] param
146
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
147
  new MPSUM_Admin_Dashboard( self::get_slug() );
152
  }
153
  new MPSUM_Admin_Core( self::get_slug() );
154
  new MPSUM_Admin_Advanced( self::get_slug() );
155
+
156
  MPSUM_Admin_Screen_Options::maybe_save_dashboard_screen_option();
157
+
158
+ }
159
+
160
  /**
161
  * Initializes the help screen.
162
  *
163
  * Initializes the help screen.
164
  *
165
+ * @since 5.0.0
166
  * @access public
167
  * @see init
168
  * @internal Uses load_{$hook} action
171
  public function init_help_screen() {
172
  new MPSUM_Admin_Help();
173
  }
174
+
175
  /**
176
  * Initializes the screen options.
177
  *
186
  public function init_screen_options() {
187
  MPSUM_Admin_Screen_Options::run();
188
  }
189
+
190
  /**
191
  * Returns formatted array of EUM options
192
  *
204
  $options[ 'core' ] = MPSUM_Admin_Core::get_defaults();
205
  }
206
  if ( ! isset( $options[ 'plugins' ] ) ) {
207
+ $options[ 'plugins' ] = array();
208
  }
209
  if ( ! isset( $options[ 'themes' ] ) ) {
210
+ $options[ 'themes' ] = array();
211
  }
212
  if ( ! isset( $options[ 'plugins_automatic' ] ) ) {
213
+ $options[ 'plugins_automatic' ] = array();
214
  }
215
  if ( ! isset( $options[ 'themes_automatic' ] ) ) {
216
+ $options[ 'themes_automatic' ] = array();
217
  }
218
  return $options;
219
+
220
  }
221
+
222
  /**
223
  * Returns whether a JSON component should be disabled or not.
224
  *
245
  return true;
246
  break;
247
  }
248
+
249
  } elseif ( 'off' == $options[ 'core' ][ 'plugin_updates' ] && 'plugin_updates' !== $option ) {
250
  switch( $context ) {
251
  case 'plugins':
275
  return true;
276
  break;
277
  }
278
+
279
  } elseif ( 'off' == $options[ 'core' ][ 'translation_updates' ] && 'translation_updates' != $option ) {
280
+
281
 
282
  switch( $option ) {
283
  case 'automatic_translation_updates':
297
  break;
298
  }
299
  }
300
+
301
  switch( $context ) {
302
  case 'plugins_automatic':
303
  if ( isset( $options[ 'core' ][ 'automatic_plugin_updates' ] ) && 'on' == $options[ 'core' ][ 'automatic_plugin_updates' ] ) {
330
  }
331
  return false;
332
  }
333
+
334
  /**
335
  * Returns whether a JSON component should be enabled or not.
336
  *
356
  case 'core':
357
  return false;
358
  break;
359
+ }
360
  } elseif ( 'off' == $options[ 'core' ][ 'translation_updates' ] && 'translation_updates' != $option ) {
361
  switch( $option ) {
362
  case 'automatic_translation_updates':
380
  return false;
381
  break;
382
  }
383
+
384
  } elseif ( 'off' == $options[ 'core' ][ 'theme_updates' ] && 'theme_updates' != $option ) {
385
  switch( $context ) {
386
  case 'themes':
396
  break;
397
  }
398
  }
399
+
400
  if( isset( $options[ $context ][ $option ] ) && 'on' == $options[ $context ][ $option ] ) {
401
+ return true;
402
  } else {
403
  switch( $context ) {
404
  case 'plugins':
450
  }
451
  return false;
452
  }
453
+
454
  /**
455
  * Returns whether a JSON component should be selected or not.
456
  *
474
  break;
475
  default:
476
  break;
477
+ }
478
  } elseif ( 'off' == $options[ 'core' ][ 'plugin_updates' ] && 'plugin_updates' != $option ) {
479
  switch( $option ) {
480
  case 'automatic_plugin_updates':
493
  case 'automatic_plugin_updates':
494
  return 'off';
495
  break;
496
+ }
497
  }
498
+
499
  return $options[ $context ][ $option ];
500
  }
501
+
502
  /**
503
  * Returns JSON options for use in React
504
  *
509
  */
510
  public function get_json_options() {
511
  $options = MPSUM_Updates_Manager::get_options();
512
+
513
  $boxes = array();
514
  $boxes[] = array(
515
  'title' => __( 'WordPress Updates', 'stops-core-theme-and-plugin-updates' ),
560
  'loading' => false,
561
  'context' => 'core'
562
  )
563
+
564
  ),
565
  );
566
  $boxes[] = array(
667
  )
668
  );
669
  $plugins = get_plugins();
670
+ $plugin_items = array();
671
  $plugin_automatic_items = array();
672
  foreach( $plugins as $plugin_slug => $plugin_data ) {
673
  $plugin_items[] = array(
689
  'checked' => $this->get_json_maybe_checked( $plugin_slug, 'plugins_automatic' ),
690
  'loading' => false,
691
  'context' => 'plugins_automatic',
692
+ );
693
  }
694
  $themes = wp_get_themes();
695
+ $theme_items = array();
696
  $theme_automatic_items = array();
697
  foreach( $themes as $theme_slug => $theme_data ) {
698
  $theme_items[] = array(
718
  }
719
  $boxes[] = array(
720
  'title' => __( 'Plugin and Theme Updates', 'stops-core-theme-and-plugin-updates' ),
721
+ 'items' => array(
722
  array(
723
  'id' => 'plugins-themes',
724
  'component' => 'ToggleTabs',
742
  );
743
  $boxes[] = array(
744
  'title' => __( 'Plugin and Theme Automatic Updates', 'stops-core-theme-and-plugin-updates' ),
745
+ 'items' => array(
746
  array(
747
  'id' => 'plugins-themes-automatic',
748
  'component' => 'ToggleTabs',
781
  );
782
  return $boxes;
783
  }
784
+
785
  public function enqueue_scripts() {
786
  $pagenow = isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : false;
787
  $is_active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : false;
788
+
789
  //Check to make sure we're on the mpsum admin page
790
  if ( $pagenow != 'mpsum-update-options' ) {
791
+ return;
792
  }
793
+
794
  // Get user data
795
  $user_id = get_current_user_id();
796
  $dashboard_showing = get_user_meta( $user_id, 'mpsum_dashboard', true );
797
+
798
  // Get options
799
  $options = MPSUM_Updates_Manager::get_options( 'core' );
800
+
801
  wp_enqueue_script( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/js/admin.js' ), array( 'jquery' ), '20171106', true );
802
+
803
  $user_id = get_current_user_id();
804
  $dashboard_showing = get_user_meta( $user_id, 'mpsum_dashboard', true );
805
  if ( ! $dashboard_showing ) {
806
  $dashboard_showing = 'on';
807
  }
808
+
809
  $options = $options = MPSUM_Updates_Manager::get_options();
810
+
811
  /**
812
  * Filter whether a ratings nag is enabled/disabled or not
813
  *
819
  if ( isset( $options[ 'core' ][ 'ratings_nag' ] ) && false == $options[ 'core' ][ 'ratings_nag' ] ) {
820
  $ratings_nag_showing = false;
821
  }
822
+
823
  /**
824
  * Filter whether a tracking nag is enabled/disabled or not
825
  *
831
  if ( isset( $options[ 'core' ][ 'tracking_nag' ] ) && 'off' == $options[ 'core' ][ 'tracking_nag' ] ) {
832
  $tracking_nag_showing = 'off';
833
  }
834
+
835
  $has_wizard = 'off';
836
  $maybe_has_wizard = MPSUM_Updates_Manager::get_options( 'core' );
837
  if ( empty( $maybe_has_wizard ) ) {
838
  $has_wizard = 'off'; // Change to "on" to turn back on modal
839
  }
840
+
841
  // tracking_nag
842
+ wp_localize_script( 'mpsum_dashboard', 'mpsum', array(
843
  'spinner' => MPSUM_Updates_Manager::get_plugin_url( '/images/spinner.gif' ),
844
  'tabs' => _x( 'Tabs', 'Show or hide admin tabs', 'stops-core-theme-and-plugin-updates' ),
845
  'dashboard' => _x( 'Show Dashboard', 'Show or hide the dashboard', 'stops-core-theme-and-plugin-updates' ),
869
  'welcome_skip' => __( 'Configure Manually', 'stops-core-theme-and-plugin-updates' ),
870
  'new_user' => $has_wizard,
871
  ) );
872
+ wp_enqueue_style( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/css/style.css' ), array(), '20171124' );
 
873
  }
874
+
875
  /**
876
  * Adds a sub-menu page for multisite.
877
  *
878
  * Adds a sub-menu page for multisite.
879
  *
880
+ * @since 5.0.0
881
  * @access public
882
  * @see init
883
  * @internal Uses network_admin_menu action
889
  add_action( "load-$hook", array( $this, 'init_help_screen' ) );
890
  add_action( "load-$hook", array( $this, 'init_screen_options' ) );
891
  }
892
+
893
  /**
894
  * Adds a sub-menu page for single-site.
895
  *
896
  * Adds a sub-menu page for single-site.
897
  *
898
+ * @since 5.0.0
899
  * @access public
900
  * @see init
901
  * @internal Uses admin_menu action
904
  public function init_single_site_admin_menus() {
905
  $hook = add_dashboard_page( __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ) , __( 'Updates Options', 'stops-core-theme-and-plugin-updates' ), 'install_plugins', self::get_slug(), array( $this, 'output_admin_interface' ) );
906
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
907
+ add_action( "load-$hook", array( $this, 'init_help_screen' ) );
908
  add_action( "load-$hook", array( $this, 'init_screen_options' ) );
909
  }
910
+
911
  /**
912
  * Outputs admin interface for sub-menu.
913
  *
914
  * Outputs admin interface for sub-menu.
915
  *
916
+ * @since 5.0.0
917
  * @access public
918
  * @see init_network_admin_menus, init_single_site_admin_menus
919
  *
927
  <?php
928
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
929
  $tabs = array();
930
+
931
  if ( 'off' !== get_user_meta( get_current_user_id(), 'mpsum_dashboard', true ) ) {
932
  $tabs[] = array(
933
  'url' => add_query_arg( array( 'tab' => 'dashboard' ), self::get_url() ), /* URL to the tab */
936
  'action' => 'mpsum_admin_tab_dashboard' /* action variable in do_action */
937
  );
938
  }
939
+
940
  $tabs[] = array(
941
  'url' => add_query_arg( array( 'tab' => 'main' ), self::get_url() ), /* URL to the tab */
942
  'label' => esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ),
985
  $do_action = isset( $tab[ 'action' ] ) ? $tab[ 'action' ] : false;
986
  }
987
  $tab_url = isset( $tab[ 'url' ] ) ? $tab[ 'url' ] : '';
988
+ $tab_label = isset( $tab[ 'label' ] ) ? $tab[ 'label' ] : '';
989
  $tab_html .= sprintf( '<a href="%s" class="%s">%s</a>', esc_url( $tab_url ), esc_attr( implode( ' ', $classes ) ), esc_html( $tab[ 'label' ] ) );
990
  }
991
  $tab_html .= '</h2>';
992
  if ( $tabs_count > 1 ) {
993
+ echo $tab_html;
994
  }
995
  if ( $do_action ) {
996
+
997
  /**
998
  * Perform a tab action.
999
  *
1003
  *
1004
  * @param string $action Can be mpsum_admin_tab_main, mpsum_admin_tab_plugins, mpsum_admin_tab_themes, and mpsum_admin_tab_advanced.
1005
  */
1006
+ do_action( $do_action );
1007
  }
1008
+ }
1009
  ?>
1010
+
1011
  </div><!-- .wrap -->
1012
  <?php
1013
  } //end output_admin_interface
1014
+
1015
  /**
1016
  * Outputs admin interface for sub-menu.
1017
  *
1018
  * Outputs admin interface for sub-menu.
1019
  *
1020
+ * @since 5.0.0
1021
  * @access public
1022
  * @see __construct
1023
  * @internal Uses $prefix . "plugin_action_links_$plugin_file" action
1025
  */
1026
  public function plugin_settings_link( $settings ) {
1027
  $admin_anchor = sprintf( '<a href="%s">%s</a>', esc_url( $this->get_url() ), esc_html__( 'Configure', 'stops-core-theme-and-plugin-updates' ) );
1028
+
1029
  if ( ! is_array( $settings ) ) {
1030
  return array( $admin_anchor );
1031
  } else {
includes/MPSUM_Admin_Advanced.php CHANGED
File without changes
includes/MPSUM_Admin_Core.php CHANGED
File without changes
includes/MPSUM_Admin_Dashboard.php CHANGED
File without changes
includes/MPSUM_Admin_Help.php CHANGED
File without changes
includes/MPSUM_Admin_Logs.php CHANGED
File without changes
includes/MPSUM_Admin_Plugins.php CHANGED
File without changes
includes/MPSUM_Admin_Screen_Options.php CHANGED
File without changes
includes/MPSUM_Admin_Themes.php CHANGED
File without changes
includes/MPSUM_Disable_Updates.php CHANGED
File without changes
includes/MPSUM_Disable_Updates_All.php CHANGED
File without changes
includes/MPSUM_Disable_Updates_Plugins.php CHANGED
File without changes
includes/MPSUM_Disable_Updates_Themes.php CHANGED
File without changes
includes/MPSUM_Disable_Updates_Translations.php CHANGED
File without changes
includes/MPSUM_Disable_Updates_WordPress.php CHANGED
File without changes
includes/MPSUM_List_Table.php CHANGED
File without changes
includes/MPSUM_Logs.php CHANGED
File without changes
includes/MPSUM_Logs_List_Table.php CHANGED
File without changes
includes/MPSUM_Plugins_List_Table.php CHANGED
@@ -8,7 +8,7 @@
8
  * @access private
9
  */
10
  class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
11
-
12
  private $tab = '';
13
 
14
  /**
@@ -28,9 +28,9 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
28
  'plural' => 'plugins',
29
  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
30
  ) );
31
-
32
  $this->tab = isset( $args[ 'tab' ] ) ? $args[ 'tab' ] : '';
33
-
34
 
35
  $status = 'all';
36
  if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'update_disabled', 'update_enabled', 'automatic' ) ) ) {
@@ -52,7 +52,7 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
52
  }
53
 
54
  public function prepare_items() {
55
-
56
  global $orderby, $order, $totals, $status;
57
  $order = 'DESC';
58
  $page = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 1;
@@ -76,9 +76,9 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
76
 
77
  $screen = $this->screen;
78
 
79
-
80
  $plugin_info = get_site_transient( 'update_plugins' );
81
-
82
  $plugin_options = MPSUM_Updates_Manager::get_options( 'plugins' );
83
  $plugin_automatic_options = MPSUM_Updates_Manager::get_options( 'plugins_automatic' );
84
  foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
@@ -88,8 +88,8 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
88
  } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
89
  $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
90
  }
91
-
92
-
93
  if ( false !== $key = array_search( $plugin_file, $plugin_options ) ) {
94
  $plugins[ 'update_disabled' ][ $plugin_file ] = $plugin_data;
95
  } else {
@@ -99,18 +99,18 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
99
  }
100
  }
101
  }
102
-
103
  $totals = array();
104
  foreach ( $plugins as $type => $list )
105
  $totals[ $type ] = count( $list );
106
-
107
  //Disable the automatic updates view
108
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
109
  if ( isset( $core_options[ 'automatic_plugin_updates' ] ) && 'individual' !== $core_options[ 'automatic_plugin_updates' ] ) {
110
  unset( $totals[ 'automatic' ] );
111
  $plugins[ 'automatic' ] = array();
112
  }
113
-
114
  if ( empty( $plugins[ $status ] ) )
115
  $status = 'all';
116
 
@@ -122,19 +122,19 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
122
  }
123
 
124
  $total_this_page = $totals[ $status ];
125
-
126
  // Get plugins per page
127
  $user_id = get_current_user_id();
128
  $plugins_per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
129
  if ( ! is_numeric( $plugins_per_page ) ) {
130
  $plugins_per_page = 100;
131
  }
132
-
133
  $start = ( $page - 1 ) * $plugins_per_page;
134
 
135
  if ( $total_this_page > $plugins_per_page )
136
  $this->items = array_slice( $this->items, $start, $plugins_per_page );
137
-
138
  $this->set_pagination_args( array(
139
  'total_items' => $total_this_page,
140
  'per_page' => $plugins_per_page,
@@ -249,7 +249,7 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
249
  global $status;
250
 
251
  $actions = array();
252
-
253
  $actions[ 'allow-update-selected' ] = esc_html__( 'Allow Updates', 'stops-core-theme-and-plugin-updates' );
254
  $actions[ 'disallow-update-selected' ] = esc_html__( 'Disallow Updates', 'stops-core-theme-and-plugin-updates' );
255
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
@@ -257,7 +257,7 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
257
  $actions[ 'allow-automatic-selected' ] = esc_html__( 'Allow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
258
  $actions[ 'disallow-automatic-selected' ] = esc_html__( 'Disallow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
259
  }
260
-
261
  return $actions;
262
  }
263
 
@@ -341,7 +341,7 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
341
  list( $plugin_file, $plugin_data ) = $item;
342
  $context = 'all';
343
  $screen = $this->screen;
344
-
345
  /**
346
  * Filter the action links that show up under each plugin row.
347
  *
@@ -357,7 +357,7 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
357
  $plugin_options = MPSUM_Updates_Manager::get_options( 'plugins' );
358
  if ( false !== $key = array_search( $plugin_file, $plugin_options ) ) {
359
  $class = 'inactive';
360
- }
361
  $checkbox_id = "checkbox_" . md5($plugin_data['Name']);
362
  $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s', 'stops-core-theme-and-plugin-updates' ), $plugin_data['Name'] ) . "</label>"
363
  . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />";
@@ -380,7 +380,17 @@ class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
380
  echo "<th scope='row' class='check-column'>$checkbox</th>";
381
  break;
382
  case 'name':
383
- echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
 
 
 
 
 
 
 
 
 
 
384
  echo $this->row_actions( $actions, true );
385
  echo "</td>";
386
  break;
8
  * @access private
9
  */
10
  class MPSUM_Plugins_List_Table extends MPSUM_List_Table {
11
+
12
  private $tab = '';
13
 
14
  /**
28
  'plural' => 'plugins',
29
  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
30
  ) );
31
+
32
  $this->tab = isset( $args[ 'tab' ] ) ? $args[ 'tab' ] : '';
33
+
34
 
35
  $status = 'all';
36
  if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'update_disabled', 'update_enabled', 'automatic' ) ) ) {
52
  }
53
 
54
  public function prepare_items() {
55
+
56
  global $orderby, $order, $totals, $status;
57
  $order = 'DESC';
58
  $page = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 1;
76
 
77
  $screen = $this->screen;
78
 
79
+
80
  $plugin_info = get_site_transient( 'update_plugins' );
81
+
82
  $plugin_options = MPSUM_Updates_Manager::get_options( 'plugins' );
83
  $plugin_automatic_options = MPSUM_Updates_Manager::get_options( 'plugins_automatic' );
84
  foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
88
  } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
89
  $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
90
  }
91
+
92
+
93
  if ( false !== $key = array_search( $plugin_file, $plugin_options ) ) {
94
  $plugins[ 'update_disabled' ][ $plugin_file ] = $plugin_data;
95
  } else {
99
  }
100
  }
101
  }
102
+
103
  $totals = array();
104
  foreach ( $plugins as $type => $list )
105
  $totals[ $type ] = count( $list );
106
+
107
  //Disable the automatic updates view
108
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
109
  if ( isset( $core_options[ 'automatic_plugin_updates' ] ) && 'individual' !== $core_options[ 'automatic_plugin_updates' ] ) {
110
  unset( $totals[ 'automatic' ] );
111
  $plugins[ 'automatic' ] = array();
112
  }
113
+
114
  if ( empty( $plugins[ $status ] ) )
115
  $status = 'all';
116
 
122
  }
123
 
124
  $total_this_page = $totals[ $status ];
125
+
126
  // Get plugins per page
127
  $user_id = get_current_user_id();
128
  $plugins_per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
129
  if ( ! is_numeric( $plugins_per_page ) ) {
130
  $plugins_per_page = 100;
131
  }
132
+
133
  $start = ( $page - 1 ) * $plugins_per_page;
134
 
135
  if ( $total_this_page > $plugins_per_page )
136
  $this->items = array_slice( $this->items, $start, $plugins_per_page );
137
+
138
  $this->set_pagination_args( array(
139
  'total_items' => $total_this_page,
140
  'per_page' => $plugins_per_page,
249
  global $status;
250
 
251
  $actions = array();
252
+
253
  $actions[ 'allow-update-selected' ] = esc_html__( 'Allow Updates', 'stops-core-theme-and-plugin-updates' );
254
  $actions[ 'disallow-update-selected' ] = esc_html__( 'Disallow Updates', 'stops-core-theme-and-plugin-updates' );
255
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
257
  $actions[ 'allow-automatic-selected' ] = esc_html__( 'Allow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
258
  $actions[ 'disallow-automatic-selected' ] = esc_html__( 'Disallow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
259
  }
260
+
261
  return $actions;
262
  }
263
 
341
  list( $plugin_file, $plugin_data ) = $item;
342
  $context = 'all';
343
  $screen = $this->screen;
344
+
345
  /**
346
  * Filter the action links that show up under each plugin row.
347
  *
357
  $plugin_options = MPSUM_Updates_Manager::get_options( 'plugins' );
358
  if ( false !== $key = array_search( $plugin_file, $plugin_options ) ) {
359
  $class = 'inactive';
360
+ }
361
  $checkbox_id = "checkbox_" . md5($plugin_data['Name']);
362
  $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s', 'stops-core-theme-and-plugin-updates' ), $plugin_data['Name'] ) . "</label>"
363
  . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />";
380
  echo "<th scope='row' class='check-column'>$checkbox</th>";
381
  break;
382
  case 'name':
383
+ echo "<td class='plugin-title'$style>";
384
+ $icon = '<span class="dashicons dashicons-admin-plugins"></span>';
385
+ $preferred_icons = array( 'svg', '1x', '2x', 'default' );
386
+ foreach ( $preferred_icons as $preferred_icon ) {
387
+ if ( isset( $plugin_data[ 'icons' ][ $preferred_icon ] ) && ! empty( $plugin_data[ 'icons' ][ $preferred_icon ] ) ) {
388
+ $icon = '<img src="' . esc_url( $plugin_data[ 'icons' ][ $preferred_icon ] ) . '" alt="" />';
389
+ break;
390
+ }
391
+ }
392
+ echo $icon;
393
+ echo "<strong class='eum-plugin-name'>$plugin_name</strong>";
394
  echo $this->row_actions( $actions, true );
395
  echo "</td>";
396
  break;
includes/MPSUM_Themes_List_Table.php CHANGED
@@ -30,7 +30,7 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
30
  'plural' => 'themes',
31
  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
32
  ) );
33
-
34
  $this->tab = isset( $args[ 'tab' ] ) ? $args[ 'tab' ] : '';
35
 
36
  $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
@@ -57,12 +57,12 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
57
  return current_user_can( 'manage_network_themes' );
58
  }
59
 
60
- public function prepare_items() {
61
  global $totals, $status;
62
  $order = 'DESC';
63
  $page = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 1;
64
  $orderby = 'Name';
65
-
66
  $themes = array(
67
  /**
68
  * Filter the full array of WP_Theme objects to list in the Multisite
@@ -76,7 +76,7 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
76
  'update_enabled' => array(),
77
  'update_disabled' => array(),
78
  'automatic' => array()
79
-
80
  );
81
 
82
 
@@ -92,23 +92,23 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
92
  $themes[ 'automatic' ][ $theme ] = $theme_data;
93
  }
94
  }
95
- }
96
-
97
  $totals = array();
98
-
99
- foreach ( $themes as $type => $list )
100
  $totals[ $type ] = count( $list );
101
-
102
  //Disable the automatic updates view
103
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
104
  if ( isset( $core_options[ 'automatic_theme_updates' ] ) && 'individual' !== $core_options[ 'automatic_theme_updates' ] ) {
105
  unset( $totals[ 'automatic' ] );
106
  $themes[ 'automatic' ] = array();
107
  }
108
-
109
  if ( empty( $themes[ $status ] ) )
110
  $status = 'all';
111
-
112
  $this->items = $themes[ $status ];
113
  WP_Theme::sort_by_name( $this->items );
114
 
@@ -127,14 +127,14 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
127
  }
128
  }
129
  $total_this_page = count( $themes[ 'all' ] );
130
-
131
  // Get themes per page
132
  $user_id = get_current_user_id();
133
  $themes_per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
134
  if ( ! is_numeric( $themes_per_page ) ) {
135
  $themes_per_page = 100;
136
  }
137
-
138
  $start = ( $page - 1 ) * $themes_per_page;
139
 
140
  if ( $total_this_page > $themes_per_page )
@@ -260,7 +260,7 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
260
  global $status;
261
 
262
  $actions = array();
263
-
264
  $actions[ 'allow-update-selected' ] = esc_html__( 'Allow Updates', 'stops-core-theme-and-plugin-updates' );
265
  $actions[ 'disallow-update-selected' ] = esc_html__( 'Disallow Updates', 'stops-core-theme-and-plugin-updates' );
266
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
@@ -268,7 +268,7 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
268
  $actions[ 'allow-automatic-selected' ] = esc_html__( 'Allow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
269
  $actions[ 'disallow-automatic-selected' ] = esc_html__( 'Disallow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
270
  }
271
-
272
  return $actions;
273
  }
274
 
@@ -309,11 +309,11 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
309
  $theme_options = MPSUM_Updates_Manager::get_options( 'themes' );
310
  if ( false !== $key = array_search( $stylesheet, $theme_options ) ) {
311
  $class = 'inactive';
312
- }
313
  echo "<tr id='$id' class='$class'>";
314
 
315
  list( $columns, $hidden ) = $this->get_column_info();
316
-
317
  foreach ( $columns as $column_name => $column_display_name ) {
318
  $style = '';
319
  if ( in_array( $column_name, $hidden ) )
@@ -324,7 +324,9 @@ class MPSUM_Themes_List_Table extends MPSUM_List_Table {
324
  echo "<th scope='row' class='check-column'>$checkbox</th>";
325
  break;
326
  case 'name':
327
- echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
 
 
328
  echo $this->row_actions( $actions, true );
329
  echo "</td>";
330
  break;
30
  'plural' => 'themes',
31
  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
32
  ) );
33
+
34
  $this->tab = isset( $args[ 'tab' ] ) ? $args[ 'tab' ] : '';
35
 
36
  $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
57
  return current_user_can( 'manage_network_themes' );
58
  }
59
 
60
+ public function prepare_items() {
61
  global $totals, $status;
62
  $order = 'DESC';
63
  $page = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 1;
64
  $orderby = 'Name';
65
+
66
  $themes = array(
67
  /**
68
  * Filter the full array of WP_Theme objects to list in the Multisite
76
  'update_enabled' => array(),
77
  'update_disabled' => array(),
78
  'automatic' => array()
79
+
80
  );
81
 
82
 
92
  $themes[ 'automatic' ][ $theme ] = $theme_data;
93
  }
94
  }
95
+ }
96
+
97
  $totals = array();
98
+
99
+ foreach ( $themes as $type => $list )
100
  $totals[ $type ] = count( $list );
101
+
102
  //Disable the automatic updates view
103
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
104
  if ( isset( $core_options[ 'automatic_theme_updates' ] ) && 'individual' !== $core_options[ 'automatic_theme_updates' ] ) {
105
  unset( $totals[ 'automatic' ] );
106
  $themes[ 'automatic' ] = array();
107
  }
108
+
109
  if ( empty( $themes[ $status ] ) )
110
  $status = 'all';
111
+
112
  $this->items = $themes[ $status ];
113
  WP_Theme::sort_by_name( $this->items );
114
 
127
  }
128
  }
129
  $total_this_page = count( $themes[ 'all' ] );
130
+
131
  // Get themes per page
132
  $user_id = get_current_user_id();
133
  $themes_per_page = get_user_meta( $user_id, 'mpsum_items_per_page', true );
134
  if ( ! is_numeric( $themes_per_page ) ) {
135
  $themes_per_page = 100;
136
  }
137
+
138
  $start = ( $page - 1 ) * $themes_per_page;
139
 
140
  if ( $total_this_page > $themes_per_page )
260
  global $status;
261
 
262
  $actions = array();
263
+
264
  $actions[ 'allow-update-selected' ] = esc_html__( 'Allow Updates', 'stops-core-theme-and-plugin-updates' );
265
  $actions[ 'disallow-update-selected' ] = esc_html__( 'Disallow Updates', 'stops-core-theme-and-plugin-updates' );
266
  $core_options = MPSUM_Updates_Manager::get_options( 'core' );
268
  $actions[ 'allow-automatic-selected' ] = esc_html__( 'Allow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
269
  $actions[ 'disallow-automatic-selected' ] = esc_html__( 'Disallow Automatic Updates', 'stops-core-theme-and-plugin-updates' );
270
  }
271
+
272
  return $actions;
273
  }
274
 
309
  $theme_options = MPSUM_Updates_Manager::get_options( 'themes' );
310
  if ( false !== $key = array_search( $stylesheet, $theme_options ) ) {
311
  $class = 'inactive';
312
+ }
313
  echo "<tr id='$id' class='$class'>";
314
 
315
  list( $columns, $hidden ) = $this->get_column_info();
316
+
317
  foreach ( $columns as $column_name => $column_display_name ) {
318
  $style = '';
319
  if ( in_array( $column_name, $hidden ) )
324
  echo "<th scope='row' class='check-column'>$checkbox</th>";
325
  break;
326
  case 'name':
327
+ echo "<td class='theme-title'$style>";
328
+ echo "<img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' class='updates-table-screenshot' alt='' />";
329
+ echo "<strong class='eum-theme-name'>" . $theme->display('Name') . "</strong>";
330
  echo $this->row_actions( $actions, true );
331
  echo "</td>";
332
  break;
includes/MPSUM_Tracking.php CHANGED
File without changes
js/admin.js CHANGED
File without changes
js/index.php CHANGED
File without changes
js/source/dashboard/components/loading.jsx DELETED
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
-
4
- class LoadingGif extends React.Component {
5
-
6
- constructor(props) {
7
- super(props);
8
- }
9
- render() {
10
- return (
11
- <div className="mpsum-spinner">
12
- <img src={this.props.src} />
13
- </div>
14
- );
15
- }
16
- }
17
- LoadingGif.propTypes = {
18
- src: React.PropTypes.string.isRequired,
19
- };
20
- LoadingGif.defaultProps = {
21
- src: mpsum.spinner
22
- };
23
- export default LoadingGif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/main.jsx DELETED
@@ -1,144 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
- import ToggleWrapper from './togglewrapper.jsx';
4
- import EUMActionTypes from '../data/EUMActionTypes.jsx';
5
- import EUMDispatcher from '../data/EUMDispatcher.jsx';
6
- import EventEmitter from 'Event-Emitter';
7
- import update from "immutability-helper";
8
- import LoadingGif from './loading.jsx';
9
- import RatingsNag from './ratingsnag.jsx';
10
- import TrackingNag from './trackingnag.jsx';
11
-
12
-
13
- var _storeJSON = null;
14
-
15
- var loadJSON = function( data ) {
16
- _storeJSON = data;
17
- }
18
-
19
-
20
- var EUMStore = update(EventEmitter.prototype, {
21
- $merge: {
22
- getJSON: function() {
23
- return _storeJSON;
24
- },
25
- emitChange: function() {
26
- this.emit( 'change' );
27
- },
28
- addChangeListener: function( callback ) {
29
- this.on( 'change', callback );
30
- },
31
- removeChangeListener: function( callback ) {
32
- this.removeListener( 'change',callback );
33
- }
34
- }
35
- } );
36
-
37
- EUMDispatcher.register( function( action ) {
38
- switch( action.type ) {
39
- case EUMActionTypes.ITEM_TOGGLE:
40
- let xhr = new XMLHttpRequest();
41
- xhr.open( 'POST', ajaxurl );
42
- xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
43
- xhr.onload = function() {
44
- if ( xhr.status === 200 ) {
45
- let json = JSON.parse( xhr.response );
46
- _storeJSON = json;
47
-
48
- EUMStore.emitChange();
49
- }
50
- };
51
- xhr.onload = xhr.onload.bind(this);
52
- xhr.send(
53
- 'action=mpsum_ajax_action' +
54
- '&_ajax_nonce=' + mpsum.admin_nonce +
55
- '&context=' + action.context +
56
- '&data_action=' + action.action +
57
- '&value=' + action.value +
58
- '&id=' + action.id
59
- );
60
- break;
61
- }
62
- return true;
63
- } );
64
-
65
- var getState = function() {
66
- return _storeJSON;
67
- }
68
-
69
- var initState = function() {
70
- let xhr = new XMLHttpRequest();
71
- xhr.open( 'POST', ajaxurl );
72
- xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
73
- xhr.onload = function() {
74
- if ( xhr.status === 200 ) {
75
- let json = JSON.parse( xhr.response );
76
- _storeJSON = json;
77
- EUMStore.emitChange();
78
- }
79
- };
80
- xhr.onload = xhr.onload.bind(this);
81
- xhr.send(
82
- 'action=mpsum_ajax_get_json' +
83
- '&_ajax_nonce=' + mpsum.admin_nonce
84
- );
85
- }
86
-
87
-
88
- class App extends React.Component {
89
- constructor(props) {
90
- super(props);
91
- this.state = {
92
- options: [],
93
- loading: true
94
- };
95
- this._onChange = this._onChange.bind(this);
96
- }
97
- _onChange() {
98
- this.setState( { options: getState(), loading: false } );
99
- }
100
- createWrapper( title, items ) {
101
- return <ToggleWrapper class="" title={title} items={items} key={title} />
102
- }
103
- createWrappers( data ) {
104
- if ( this.state.loading ) {
105
- return (
106
- <div id="eum-dashboard-loading">
107
- <LoadingGif />
108
- </div>
109
- )
110
- }
111
- let wrappers = [];
112
- if ( data.length > 0 ) {
113
- for( var value of data ) {
114
- wrappers.push( this.createWrapper( value.title, value.items ) );
115
- }
116
- }
117
- return wrappers;
118
-
119
- }
120
- componentDidMount() {
121
- EUMStore.addChangeListener(this._onChange);
122
- initState();
123
- }
124
- componentWillUnmount() {
125
- EUMStore.removeChangeListener(this._onChange);
126
- }
127
- render() {
128
- return (
129
- <div>
130
- <TrackingNag />
131
- <div id="eum-dashboard-wrappers">
132
- {this.createWrappers(this.state.options)}
133
- </div>
134
- </div>
135
- );
136
- }
137
- }
138
- let appContainer = document.getElementById('eum-dashboard-app');
139
- if ( null !== appContainer ) {
140
- render(
141
- <App />,
142
- appContainer
143
- );
144
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/ratingsnag.jsx DELETED
@@ -1,46 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
-
4
- class RatingsNag extends React.Component {
5
-
6
- constructor(props) {
7
- super(props);
8
- this.state = {
9
- disabled: !mpsum.ratings_nag.enabled
10
- }
11
- this.disabled = this.disabled.bind( this );
12
- }
13
- disabled(e) {
14
- e.preventDefault();
15
- this.setState({disabled:true});
16
- let xhr = new XMLHttpRequest();
17
- xhr.open( 'POST', ajaxurl );
18
- xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
19
- xhr.send(
20
- 'action=mpsum_ajax_remove_ratings_nag' +
21
- '&_ajax_nonce=' + mpsum.admin_nonce
22
- );
23
- }
24
- display() {
25
- if ( false === this.state.disabled ) {
26
- return (
27
- <div className="eum-ratings-nag mpsum-notice">
28
- <p><strong>{mpsum.ratings_nag.text}</strong></p>
29
- <ul>
30
- <li><a className="button button-primary" target="_new" href={mpsum.ratings_nag.url}>{mpsum.ratings_nag.affirm}</a></li>
31
- <li><a className="button button-secondary" href="#" onClick={this.disabled}>{mpsum.ratings_nag.cancel}</a></li>
32
- </ul>
33
- </div>
34
- )
35
- }
36
- return;
37
- }
38
- render() {
39
- return (
40
- <div>
41
- {this.display()}
42
- </div>
43
- );
44
- }
45
- }
46
- export default RatingsNag;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/toggleitem.jsx DELETED
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
- import EUM from './main.jsx';
4
- import EUMActions from '../data/EUMActions.jsx';
5
- import ToggleItemInput from './toggleiteminput.jsx';
6
-
7
- class ToggleItem extends React.Component {
8
-
9
- constructor(props) {
10
- super(props);
11
- this.state = {
12
- checked : this.props.checked,
13
- disabled : this.props.disabled,
14
- label : mpsum.enabled,
15
- loading : false
16
- };
17
- }
18
- componentWillReceiveProps(newprops) {
19
- this.setState({
20
- loading:newprops.loading,
21
- checked:newprops.checked,
22
- disabled:newprops.disabled
23
- });
24
- }
25
- render() {
26
- return (
27
- <div>
28
- <ToggleItemInput
29
- id={this.props.id}
30
- name={this.props.name}
31
- onChange={this.itemChange}
32
- checked={this.state.checked}
33
- disabled={this.state.disabled}
34
- context={this.props.context}
35
- title={this.props.title}
36
- />
37
- </div>
38
- );
39
- }
40
- }
41
- ToggleItem.propTypes = {
42
- id: React.PropTypes.string,
43
- checked: React.PropTypes.bool.isRequired,
44
- title: React.PropTypes.string.isRequired,
45
- disabled: React.PropTypes.bool.isRequired,
46
- name: React.PropTypes.string.isRequired,
47
- context: React.PropTypes.string.isRequired,
48
- loading: React.PropTypes.bool.isRequired
49
- };
50
- ToggleItem.defaultProps = {
51
- id: '',
52
- checked: false,
53
- title: '',
54
- disabled: false,
55
- name: '',
56
- context: '',
57
- loading: false
58
- };
59
- export default ToggleItem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/toggleiteminput.jsx DELETED
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
- import LoadingGif from './loading.jsx';
4
- import EUM from './main.jsx';
5
- import EUMActions from '../data/EUMActions.jsx';
6
-
7
- class ToggleItemInput extends React.Component {
8
-
9
- constructor(props) {
10
- super(props);
11
- this.state = {
12
- checked : this.props.checked,
13
- itemClasses : this.maybeActiveItem(),
14
- disabled : this.props.disabled,
15
- label : mpsum.enabled,
16
- loading : false
17
- };
18
- this.itemChange = this.itemChange.bind(this);
19
- }
20
- maybeSetActive(checked) {
21
- if(checked) {
22
- return 'dashboard-item active';
23
- } else {
24
- return 'dashboard-item';
25
- }
26
- }
27
- maybeActiveItem() {
28
- return this.maybeSetActive(this.props.checked);
29
- }
30
- itemChange(event) {
31
- this.setState({
32
- loading: true
33
- });
34
- EUMActions.itemToggle( this.props.context, this.props.name, ( this.state.checked ? 'off' : 'on' ), this.props.id );
35
-
36
- }
37
- getLabel() {
38
- if ( this.state.loading ) {
39
- return(
40
- <LoadingGif />
41
- )
42
- }
43
- return (
44
- <label htmlFor={this.props.name}>
45
- {this.state.label}
46
- </label>
47
- );
48
- }
49
- componentWillReceiveProps(newprops) {
50
- this.setState({
51
- loading:newprops.loading,
52
- checked:newprops.checked,
53
- disabled:newprops.disabled
54
- });
55
- }
56
- render() {
57
- return (
58
- <div className={this.maybeActiveItem()}>
59
- <div className="dashboard-item-header input-radio">
60
- {this.props.title}
61
- </div>
62
- <div className="dashboard-item-choice">
63
- <input
64
- id={this.props.name}
65
- type="checkbox"
66
- className="dashboard-hide"
67
- name={this.props.name}
68
- value="on"
69
- onChange={this.itemChange}
70
- checked={this.state.checked}
71
- disabled={this.state.disabled}
72
- />
73
- {this.getLabel()}
74
- </div>
75
- </div>
76
- );
77
- }
78
- }
79
- ToggleItemInput.propTypes = {
80
- id: React.PropTypes.string,
81
- checked: React.PropTypes.bool.isRequired,
82
- disabled: React.PropTypes.bool.isRequired,
83
- name: React.PropTypes.string.isRequired,
84
- context: React.PropTypes.string.isRequired,
85
- loading: React.PropTypes.bool.isRequired
86
- };
87
- ToggleItemInput.defaultProps = {
88
- id: '',
89
- checked: false,
90
- disabled: false,
91
- name: '',
92
- context: '',
93
- loading: false
94
- };
95
- export default ToggleItemInput;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/toggleitemradio.jsx DELETED
@@ -1,87 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
- import LoadingGif from './loading.jsx';
4
- import EUM from './main.jsx';
5
- import EUMActions from '../data/EUMActions.jsx';
6
-
7
- class ToggleItemRadio extends React.Component {
8
-
9
- constructor(props) {
10
- super(props);
11
- this.state = {
12
- checked : this.props.checked,
13
- disabled : this.props.disabled,
14
- label : mpsum.enabled,
15
- loading : false,
16
- choices : this.props.choices
17
- };
18
- this.itemChange = this.itemChange.bind(this);
19
- }
20
- itemChange(e) {
21
- e.preventDefault();
22
- this.setState({loading:true});
23
- EUMActions.itemToggle( this.props.context, this.props.name, e.target.value );
24
-
25
- }
26
- displayChoices() {
27
-
28
- if ( false === this.state.loading ) {
29
- var choices = [];
30
- for( var choice of this.props.choices ) {
31
- choices.push(
32
- <div key={choice.id} className="multi-choice-item">
33
- <input type="radio" value={choice.value} id={choice.id} checked={this.state.checked==choice.value ? true : false } onChange={this.itemChange} disabled={this.state.disabled} />
34
- &nbsp;
35
- <label htmlFor={choice.id}>{choice.label}</label>
36
- </div>
37
- );
38
- }
39
- return (
40
- <div className="multi-choice">
41
- {choices}
42
- </div>
43
- )
44
- } else {
45
- return(
46
- <LoadingGif />
47
- )
48
- }
49
-
50
- }
51
- componentWillReceiveProps(newprops) {
52
- this.setState({
53
- loading:newprops.loading,
54
- checked:newprops.checked,
55
- disabled:newprops.disabled
56
- });
57
- }
58
- render() {
59
- return (
60
- <div>
61
- <div className="dashboard-item active">
62
- <div className="dashboard-item-header input-radio">
63
- {this.props.title}
64
- </div>
65
- {this.displayChoices()}
66
- </div>
67
- </div>
68
- );
69
- }
70
- }
71
- ToggleItemRadio.propTypes = {
72
- checked: React.PropTypes.string.isRequired,
73
- title: React.PropTypes.string.isRequired,
74
- disabled: React.PropTypes.bool.isRequired,
75
- name: React.PropTypes.string.isRequired,
76
- context: React.PropTypes.string.isRequired,
77
- loading: React.PropTypes.bool.isRequired
78
- };
79
- ToggleItemRadio.defaultProps = {
80
- checked: 'default',
81
- title: '',
82
- disabled: false,
83
- name: '',
84
- context: '',
85
- loading: false
86
- };
87
- export default ToggleItemRadio;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/toggletabs.jsx DELETED
@@ -1,65 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
- import ToggleItemInput from './toggleiteminput.jsx';
4
-
5
- class ToggleTabs extends React.Component {
6
- constructor(props) {
7
- super(props);
8
- this.state = {
9
- tabs : this.props.tabs,
10
- active : this.props.active
11
- };
12
- this.tabClicked = this.tabClicked.bind(this);
13
- }
14
- tabClicked( e ) {
15
- e.preventDefault();
16
- this.setState({active:e.target.id});
17
- }
18
- showTabs() {
19
- var tabs = [];
20
- var tabContent = [];
21
- for( var tab of this.props.tabs ) {
22
- var className = 'dashboard-tab-header-plugin dashboard-tab-item ' + (this.state.active == tab.id ? 'active' : '' );
23
- tabs.push(
24
- <div className={className} key={tab.id}>
25
- <a href="#" onClick={this.tabClicked} id={tab.id}>{tab.label}</a>
26
- </div>
27
- );
28
- var tabItemClassName = 'dashboard-tab-content ' + (this.state.active == tab.id ? 'active' : null );
29
- var tabItems = [];
30
- for( var asset of tab.items ) {
31
- tabItems.push(
32
- <ToggleItemInput
33
- id={asset.id}
34
- title={asset.title}
35
- name={asset.id + '_' + asset.context}
36
- key={asset.id + '_' + asset.context}
37
- checked={asset.checked}
38
- disabled={asset.disabled}
39
- context={tab.context}
40
- loading={tab.loading}
41
- />
42
- )
43
- }
44
- tabContent.push(
45
- <div className={tabItemClassName} key={tab.id}>
46
- {tabItems}
47
- </div>
48
- );
49
- }
50
- return (
51
- <div className='dashboard-tab'>
52
- {tabs}
53
- {tabContent}
54
- </div>
55
- );
56
- }
57
- render() {
58
- return (
59
- <div>
60
- {this.showTabs()}
61
- </div>
62
- );
63
- }
64
- }
65
- export default ToggleTabs;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/togglewrapper.jsx DELETED
@@ -1,81 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
- import ToggleItem from './toggleitem.jsx';
4
- import ToggleItemRadio from './toggleitemradio.jsx';
5
- import ToggleTabs from './toggletabs.jsx';
6
-
7
- class ToggleWrapper extends React.Component {
8
- constructor(props) {
9
- super(props);
10
- }
11
- createItems() {
12
- var items = [];
13
- for( var item of this.props.items ) {
14
- if ( 'ToggleItem' == item.component ) {
15
- items.push( this.createToggleComponent( item ) );
16
- } else if( 'ToggleItemRadio' == item.component ) {
17
- items.push( this.createToggleRadioComponent( item ) );
18
- } else if( 'ToggleTabs' == item.component ) {
19
- items.push( this.createToggleTabsComponent (item ) );
20
- }
21
- }
22
- return items;
23
- }
24
- createToggleTabsComponent( item ) {
25
- return (
26
- <div key={item.id}>
27
- <ToggleTabs
28
- tabs={item.tabs}
29
- active={item.active}
30
- />
31
- </div>
32
- )
33
- }
34
- createToggleComponent( item ) {
35
- return (
36
- <div key={item.name}>
37
- <ToggleItem
38
- title={item.title}
39
- name={item.name}
40
- checked={item.checked}
41
- disabled={item.disabled}
42
- context={item.context}
43
- loading={item.loading}
44
- />
45
- </div>
46
- );
47
- }
48
- createToggleRadioComponent( item ) {
49
- return (
50
- <div key={item.name}>
51
- <ToggleItemRadio
52
- title={item.title}
53
- name={item.name}
54
- checked={item.checked}
55
- disabled={item.disabled}
56
- context={item.context}
57
- update={this.props.update}
58
- loading={item.loading}
59
- choices={item.choices}
60
- />
61
- </div>
62
- );
63
- }
64
- render() {
65
- return (
66
- <div className="dashboard-main-wrapper">
67
- <div className="dashboard-main-header">{this.props.title}</div>
68
- <div className="dashboard-item-wrapper">
69
- {this.createItems()}
70
- </div>
71
- </div>
72
- );
73
- }
74
- }
75
- ToggleWrapper.propTypes = {
76
- title: React.PropTypes.string.isRequired,
77
- };
78
- ToggleWrapper.defaultProps = {
79
- title: '',
80
- };
81
- export default ToggleWrapper;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/components/trackingnag.jsx DELETED
@@ -1,63 +0,0 @@
1
- import React from 'react';
2
- import {render} from 'react-dom';
3
-
4
- class TrackingNag extends React.Component {
5
-
6
- constructor(props) {
7
- super(props);
8
- this.state = {
9
- disabled: 'off' === mpsum.tracking_nag.enabled ? true : false
10
- }
11
- this.disabled = this.disabled.bind( this );
12
- this.enabled = this.enabled.bind( this );
13
- console.log( mpsum );
14
- }
15
- disabled(e) {
16
- e.preventDefault();
17
- this.setState({disabled:true});
18
- let xhr = new XMLHttpRequest();
19
- xhr.open( 'POST', ajaxurl );
20
- xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
21
- xhr.send(
22
- 'action=mpsum_ajax_remove_tracking_nag' +
23
- '&_ajax_nonce=' + mpsum.admin_nonce
24
- );
25
- }
26
- enabled(e) {
27
- e.preventDefault();
28
- this.setState({disabled:true});
29
- let xhr = new XMLHttpRequest();
30
- xhr.open( 'POST', ajaxurl );
31
- xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
32
- xhr.send(
33
- 'action=mpsum_ajax_enable_tracking' +
34
- '&_ajax_nonce=' + mpsum.admin_nonce
35
- );
36
- }
37
- display() {
38
- if ( false === this.state.disabled ) {
39
- return (
40
- <div className="eum-tracking-nag mpsum-notice">
41
- <p>
42
- <strong>{mpsum.tracking_nag.text}</strong>
43
- &nbsp;
44
- <a target="_blank" href={mpsum.tracking_nag.url}>{mpsum.tracking_nag.help}</a>
45
- </p>
46
- <ul>
47
- <li><button className="button button-primary" onClick={this.enabled}>{mpsum.tracking_nag.affirm}</button></li>
48
- <li><button className="button button-secondary" onClick={this.disabled}>{mpsum.tracking_nag.cancel}</button></li>
49
- </ul>
50
- </div>
51
- )
52
- }
53
- return;
54
- }
55
- render() {
56
- return (
57
- <div>
58
- {this.display()}
59
- </div>
60
- );
61
- }
62
- }
63
- export default TrackingNag;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/data/EUMActionTypes.jsx DELETED
@@ -1,4 +0,0 @@
1
- const ActionTypes = {
2
- ITEM_TOGGLE: 'ITEM_TOGGLE'
3
- }
4
- export default ActionTypes;
 
 
 
 
js/source/dashboard/data/EUMActions.jsx DELETED
@@ -1,16 +0,0 @@
1
- import EUMActionTypes from './EUMActionTypes.jsx';
2
- import EUMDispatcher from './EUMDispatcher.jsx';
3
-
4
- const Actions = {
5
- itemToggle( context, action, value, id ) {
6
- EUMDispatcher.dispatch({
7
- type: EUMActionTypes.ITEM_TOGGLE,
8
- context,
9
- action,
10
- value,
11
- id
12
- });
13
- }
14
- }
15
-
16
- export default Actions;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/dashboard/data/EUMDispatcher.jsx DELETED
@@ -1,3 +0,0 @@
1
- import {Dispatcher} from 'flux';
2
-
3
- export default new Dispatcher();
 
 
 
js/source/main.js DELETED
@@ -1,2 +0,0 @@
1
- require('./dashboard/components/main.jsx');
2
- require('./screenoptions.js');
 
 
js/source/screenoptions.js DELETED
@@ -1,64 +0,0 @@
1
- jQuery( document ).ready( function( $ ) {
2
- /* Screen Options */
3
- var dashboard_checked = '';
4
- if ( 'on' == mpsum.dashboard_showing ) {
5
- dashboard_checked = ' checked="checked"';
6
- }
7
- var screen_options_html = '<fieldset class="screen-options">';
8
- screen_options_html += '<legend>' + mpsum.tabs + '</legend>';
9
- screen_options_html += '<input type="hidden" value="off" name="mpsum_dashboard" />';
10
- screen_options_html += '<input type="checkbox" id="mpsum_dashboard" value="on" name="mpsum_dashboard"' + dashboard_checked + '/>';
11
- screen_options_html += '&nbsp;<label for="mpsum_dashboard">' + mpsum.dashboard + '</label>';
12
- screen_options_html += '</fieldset>';
13
- $( '#screen-options-wrap #adv-settings' ).prepend( screen_options_html );
14
-
15
- if ( mpsum.new_user == 'on' ) {
16
- swal({
17
- html:
18
- '<div id="mpsum-welcome-modal">' +
19
- '<h2>' + mpsum.welcome + '</h2>, ' +
20
- '<h3>' + mpsum.welcome_intro + '</h3>' +
21
- '<button id="eum-enable-autoupdates" class="eum-button button button-primary" name="eum_enable_automatic" value="on" id="eum_type_1">' +
22
- mpsum.welcome_automatic +
23
- '</button>' +
24
- '<button id="eum-disable-manually" class="eum-button button button-primary" name="eum_type_disable_updates" value="on" id="eum_type_2">' +
25
- mpsum.welcome_disable +
26
- '</button>' +
27
- '<button id="eum-configure-manually" class="eum-button button button-primary" name="eum_enable_automatic" value="on" id="eum_type_1">' +
28
- 'Configure Manually' +
29
- '</button>' +
30
- '</div>',
31
- type: 'question',
32
- showCloseButton: true,
33
- });
34
- }
35
-
36
-
37
- jQuery( 'body' ).on( 'click', '#eum-configure-manually', function( e ) {
38
- e.preventDefault();
39
- jQuery( '#mpsum-welcome-modal' ).html();
40
- jQuery.post( ajaxurl, {action: 'mpsum_ajax_remove_wizard', _ajax_nonce: mpsum.admin_nonce}, function( response ) {
41
- window.top.location.reload();
42
- } );
43
- } );
44
-
45
-
46
- jQuery( 'body' ).on( 'click', '#eum-disable-manually', function( e ) {
47
- e.preventDefault();
48
- jQuery( '#mpsum-welcome-modal' ).html();
49
- jQuery.post( ajaxurl, {action: 'mpsum_ajax_disable_updates', _ajax_nonce: mpsum.admin_nonce}, function( response ) {
50
- //swal.close();
51
- window.top.location.reload();
52
- } );
53
- } );
54
-
55
- jQuery( 'body' ).on( 'click', '#eum-enable-autoupdates', function( e ) {
56
- e.preventDefault();
57
- jQuery( '#mpsum-welcome-modal' ).html();
58
- jQuery.post( ajaxurl, {action: 'mpsum_ajax_enable_automatic_updates', _ajax_nonce: mpsum.admin_nonce}, function( response ) {
59
- //swal.close();
60
- window.top.location.reload();
61
- } );
62
- } )
63
-
64
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/sweetalert2.common.js DELETED
@@ -1,1635 +0,0 @@
1
- /*!
2
- * sweetalert2 v6.6.6
3
- * Released under the MIT License.
4
- */
5
- 'use strict';
6
-
7
- var defaultParams = {
8
- title: '',
9
- titleText: '',
10
- text: '',
11
- html: '',
12
- type: null,
13
- customClass: '',
14
- target: 'body',
15
- animation: true,
16
- allowOutsideClick: true,
17
- allowEscapeKey: true,
18
- allowEnterKey: true,
19
- showConfirmButton: true,
20
- showCancelButton: false,
21
- preConfirm: null,
22
- confirmButtonText: 'OK',
23
- confirmButtonColor: '#3085d6',
24
- confirmButtonClass: null,
25
- cancelButtonText: 'Cancel',
26
- cancelButtonColor: '#aaa',
27
- cancelButtonClass: null,
28
- buttonsStyling: true,
29
- reverseButtons: false,
30
- focusCancel: false,
31
- showCloseButton: false,
32
- showLoaderOnConfirm: false,
33
- imageUrl: null,
34
- imageWidth: null,
35
- imageHeight: null,
36
- imageClass: null,
37
- timer: null,
38
- width: 500,
39
- padding: 20,
40
- background: '#fff',
41
- input: null,
42
- inputPlaceholder: '',
43
- inputValue: '',
44
- inputOptions: {},
45
- inputAutoTrim: true,
46
- inputClass: null,
47
- inputAttributes: {},
48
- inputValidator: null,
49
- progressSteps: [],
50
- currentProgressStep: null,
51
- progressStepsDistance: '40px',
52
- onOpen: null,
53
- onClose: null,
54
- useRejections: true
55
- };
56
-
57
- var swalPrefix = 'swal2-';
58
-
59
- var prefix = function prefix(items) {
60
- var result = {};
61
- for (var i in items) {
62
- result[items[i]] = swalPrefix + items[i];
63
- }
64
- return result;
65
- };
66
-
67
- var swalClasses = prefix(['container', 'shown', 'iosfix', 'modal', 'overlay', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'content', 'buttonswrapper', 'confirm', 'cancel', 'icon', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea', 'inputerror', 'validationerror', 'progresssteps', 'activeprogressstep', 'progresscircle', 'progressline', 'loading', 'styled']);
68
-
69
- var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);
70
-
71
- /*
72
- * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color)
73
- */
74
- var colorLuminance = function colorLuminance(hex, lum) {
75
- // Validate hex string
76
- hex = String(hex).replace(/[^0-9a-f]/gi, '');
77
- if (hex.length < 6) {
78
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
79
- }
80
- lum = lum || 0;
81
-
82
- // Convert to decimal and change luminosity
83
- var rgb = '#';
84
- for (var i = 0; i < 3; i++) {
85
- var c = parseInt(hex.substr(i * 2, 2), 16);
86
- c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16);
87
- rgb += ('00' + c).substr(c.length);
88
- }
89
-
90
- return rgb;
91
- };
92
-
93
- var uniqueArray = function uniqueArray(arr) {
94
- var result = [];
95
- for (var i in arr) {
96
- if (result.indexOf(arr[i]) === -1) {
97
- result.push(arr[i]);
98
- }
99
- }
100
- return result;
101
- };
102
-
103
- /* global MouseEvent */
104
-
105
- // Remember state in cases where opening and handling a modal will fiddle with it.
106
- var states = {
107
- previousWindowKeyDown: null,
108
- previousActiveElement: null,
109
- previousBodyPadding: null
110
-
111
- /*
112
- * Add modal + overlay to DOM
113
- */
114
- };var init = function init(params) {
115
- if (typeof document === 'undefined') {
116
- console.error('SweetAlert2 requires document to initialize');
117
- return;
118
- }
119
-
120
- var container = document.createElement('div');
121
- container.className = swalClasses.container;
122
- container.innerHTML = sweetHTML;
123
-
124
- var targetElement = document.querySelector(params.target);
125
- if (!targetElement) {
126
- console.warn('SweetAlert2: Can\'t find the target "' + params.target + '"');
127
- targetElement = document.body;
128
- }
129
- targetElement.appendChild(container);
130
-
131
- var modal = getModal();
132
- var input = getChildByClass(modal, swalClasses.input);
133
- var file = getChildByClass(modal, swalClasses.file);
134
- var range = modal.querySelector('.' + swalClasses.range + ' input');
135
- var rangeOutput = modal.querySelector('.' + swalClasses.range + ' output');
136
- var select = getChildByClass(modal, swalClasses.select);
137
- var checkbox = modal.querySelector('.' + swalClasses.checkbox + ' input');
138
- var textarea = getChildByClass(modal, swalClasses.textarea);
139
-
140
- input.oninput = function () {
141
- sweetAlert.resetValidationError();
142
- };
143
-
144
- input.onkeydown = function (event) {
145
- setTimeout(function () {
146
- if (event.keyCode === 13 && params.allowEnterKey) {
147
- event.stopPropagation();
148
- sweetAlert.clickConfirm();
149
- }
150
- }, 0);
151
- };
152
-
153
- file.onchange = function () {
154
- sweetAlert.resetValidationError();
155
- };
156
-
157
- range.oninput = function () {
158
- sweetAlert.resetValidationError();
159
- rangeOutput.value = range.value;
160
- };
161
-
162
- range.onchange = function () {
163
- sweetAlert.resetValidationError();
164
- range.previousSibling.value = range.value;
165
- };
166
-
167
- select.onchange = function () {
168
- sweetAlert.resetValidationError();
169
- };
170
-
171
- checkbox.onchange = function () {
172
- sweetAlert.resetValidationError();
173
- };
174
-
175
- textarea.oninput = function () {
176
- sweetAlert.resetValidationError();
177
- };
178
-
179
- return modal;
180
- };
181
-
182
- /*
183
- * Manipulate DOM
184
- */
185
-
186
- var sweetHTML = ('\n <div role="dialog" aria-labelledby="' + swalClasses.title + '" aria-describedby="' + swalClasses.content + '" class="' + swalClasses.modal + '" tabindex="-1">\n <ul class="' + swalClasses.progresssteps + '"></ul>\n <div class="' + swalClasses.icon + ' ' + iconTypes.error + '">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.question + '">?</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.warning + '">!</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.info + '">i</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.success + '">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="' + swalClasses.image + '" />\n <h2 class="' + swalClasses.title + '" id="' + swalClasses.title + '"></h2>\n <div id="' + swalClasses.content + '" class="' + swalClasses.content + '"></div>\n <input class="' + swalClasses.input + '" />\n <input type="file" class="' + swalClasses.file + '" />\n <div class="' + swalClasses.range + '">\n <output></output>\n <input type="range" />\n </div>\n <select class="' + swalClasses.select + '"></select>\n <div class="' + swalClasses.radio + '"></div>\n <label for="' + swalClasses.checkbox + '" class="' + swalClasses.checkbox + '">\n <input type="checkbox" />\n </label>\n <textarea class="' + swalClasses.textarea + '"></textarea>\n <div class="' + swalClasses.validationerror + '"></div>\n <div class="' + swalClasses.buttonswrapper + '">\n <button type="button" class="' + swalClasses.confirm + '">OK</button>\n <button type="button" class="' + swalClasses.cancel + '">Cancel</button>\n </div>\n <button type="button" class="' + swalClasses.close + '" aria-label="Close this dialog">\xD7</button>\n </div>\n').replace(/(^|\n)\s*/g, '');
187
-
188
- var getContainer = function getContainer() {
189
- return document.body.querySelector('.' + swalClasses.container);
190
- };
191
-
192
- var getModal = function getModal() {
193
- return getContainer() ? getContainer().querySelector('.' + swalClasses.modal) : null;
194
- };
195
-
196
- var getIcons = function getIcons() {
197
- var modal = getModal();
198
- return modal.querySelectorAll('.' + swalClasses.icon);
199
- };
200
-
201
- var elementByClass = function elementByClass(className) {
202
- return getContainer() ? getContainer().querySelector('.' + className) : null;
203
- };
204
-
205
- var getTitle = function getTitle() {
206
- return elementByClass(swalClasses.title);
207
- };
208
-
209
- var getContent = function getContent() {
210
- return elementByClass(swalClasses.content);
211
- };
212
-
213
- var getImage = function getImage() {
214
- return elementByClass(swalClasses.image);
215
- };
216
-
217
- var getButtonsWrapper = function getButtonsWrapper() {
218
- return elementByClass(swalClasses.buttonswrapper);
219
- };
220
-
221
- var getProgressSteps = function getProgressSteps() {
222
- return elementByClass(swalClasses.progresssteps);
223
- };
224
-
225
- var getValidationError = function getValidationError() {
226
- return elementByClass(swalClasses.validationerror);
227
- };
228
-
229
- var getConfirmButton = function getConfirmButton() {
230
- return elementByClass(swalClasses.confirm);
231
- };
232
-
233
- var getCancelButton = function getCancelButton() {
234
- return elementByClass(swalClasses.cancel);
235
- };
236
-
237
- var getCloseButton = function getCloseButton() {
238
- return elementByClass(swalClasses.close);
239
- };
240
-
241
- var getFocusableElements = function getFocusableElements(focusCancel) {
242
- var buttons = [getConfirmButton(), getCancelButton()];
243
- if (focusCancel) {
244
- buttons.reverse();
245
- }
246
- var focusableElements = buttons.concat(Array.prototype.slice.call(getModal().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, *[tabindex]:not([tabindex="-1"])')));
247
- return uniqueArray(focusableElements);
248
- };
249
-
250
- var hasClass = function hasClass(elem, className) {
251
- if (elem.classList) {
252
- return elem.classList.contains(className);
253
- }
254
- return false;
255
- };
256
-
257
- var focusInput = function focusInput(input) {
258
- input.focus();
259
-
260
- // place cursor at end of text in text input
261
- if (input.type !== 'file') {
262
- // http://stackoverflow.com/a/2345915/1331425
263
- var val = input.value;
264
- input.value = '';
265
- input.value = val;
266
- }
267
- };
268
-
269
- var addClass = function addClass(elem, className) {
270
- if (!elem || !className) {
271
- return;
272
- }
273
- var classes = className.split(/\s+/).filter(Boolean);
274
- classes.forEach(function (className) {
275
- elem.classList.add(className);
276
- });
277
- };
278
-
279
- var removeClass = function removeClass(elem, className) {
280
- if (!elem || !className) {
281
- return;
282
- }
283
- var classes = className.split(/\s+/).filter(Boolean);
284
- classes.forEach(function (className) {
285
- elem.classList.remove(className);
286
- });
287
- };
288
-
289
- var getChildByClass = function getChildByClass(elem, className) {
290
- for (var i = 0; i < elem.childNodes.length; i++) {
291
- if (hasClass(elem.childNodes[i], className)) {
292
- return elem.childNodes[i];
293
- }
294
- }
295
- };
296
-
297
- var show = function show(elem, display) {
298
- if (!display) {
299
- display = 'block';
300
- }
301
- elem.style.opacity = '';
302
- elem.style.display = display;
303
- };
304
-
305
- var hide = function hide(elem) {
306
- elem.style.opacity = '';
307
- elem.style.display = 'none';
308
- };
309
-
310
- var empty = function empty(elem) {
311
- while (elem.firstChild) {
312
- elem.removeChild(elem.firstChild);
313
- }
314
- };
315
-
316
- // borrowed from jqeury $(elem).is(':visible') implementation
317
- var isVisible = function isVisible(elem) {
318
- return elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length;
319
- };
320
-
321
- var removeStyleProperty = function removeStyleProperty(elem, property) {
322
- if (elem.style.removeProperty) {
323
- elem.style.removeProperty(property);
324
- } else {
325
- elem.style.removeAttribute(property);
326
- }
327
- };
328
-
329
- var fireClick = function fireClick(node) {
330
- if (!isVisible(node)) {
331
- return false;
332
- }
333
-
334
- // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
335
- // Then fixed for today's Chrome browser.
336
- if (typeof MouseEvent === 'function') {
337
- // Up-to-date approach
338
- var mevt = new MouseEvent('click', {
339
- view: window,
340
- bubbles: false,
341
- cancelable: true
342
- });
343
- node.dispatchEvent(mevt);
344
- } else if (document.createEvent) {
345
- // Fallback
346
- var evt = document.createEvent('MouseEvents');
347
- evt.initEvent('click', false, false);
348
- node.dispatchEvent(evt);
349
- } else if (document.createEventObject) {
350
- node.fireEvent('onclick');
351
- } else if (typeof node.onclick === 'function') {
352
- node.onclick();
353
- }
354
- };
355
-
356
- var animationEndEvent = function () {
357
- var testEl = document.createElement('div');
358
- var transEndEventNames = {
359
- 'WebkitAnimation': 'webkitAnimationEnd',
360
- 'OAnimation': 'oAnimationEnd oanimationend',
361
- 'msAnimation': 'MSAnimationEnd',
362
- 'animation': 'animationend'
363
- };
364
- for (var i in transEndEventNames) {
365
- if (transEndEventNames.hasOwnProperty(i) && testEl.style[i] !== undefined) {
366
- return transEndEventNames[i];
367
- }
368
- }
369
-
370
- return false;
371
- }();
372
-
373
- // Reset previous window keydown handler and focued element
374
- var resetPrevState = function resetPrevState() {
375
- window.onkeydown = states.previousWindowKeyDown;
376
- if (states.previousActiveElement && states.previousActiveElement.focus) {
377
- var x = window.scrollX;
378
- var y = window.scrollY;
379
- states.previousActiveElement.focus();
380
- if (x && y) {
381
- // IE has no scrollX/scrollY support
382
- window.scrollTo(x, y);
383
- }
384
- }
385
- };
386
-
387
- // Measure width of scrollbar
388
- // https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286
389
- var measureScrollbar = function measureScrollbar() {
390
- var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
391
- if (supportsTouch) {
392
- return 0;
393
- }
394
- var scrollDiv = document.createElement('div');
395
- scrollDiv.style.width = '50px';
396
- scrollDiv.style.height = '50px';
397
- scrollDiv.style.overflow = 'scroll';
398
- document.body.appendChild(scrollDiv);
399
- var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
400
- document.body.removeChild(scrollDiv);
401
- return scrollbarWidth;
402
- };
403
-
404
- // JavaScript Debounce Function
405
- // Simplivied version of https://davidwalsh.name/javascript-debounce-function
406
- var debounce = function debounce(func, wait) {
407
- var timeout = void 0;
408
- return function () {
409
- var later = function later() {
410
- timeout = null;
411
- func();
412
- };
413
- clearTimeout(timeout);
414
- timeout = setTimeout(later, wait);
415
- };
416
- };
417
-
418
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
419
- return typeof obj;
420
- } : function (obj) {
421
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
422
- };
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
- var _extends = Object.assign || function (target) {
445
- for (var i = 1; i < arguments.length; i++) {
446
- var source = arguments[i];
447
-
448
- for (var key in source) {
449
- if (Object.prototype.hasOwnProperty.call(source, key)) {
450
- target[key] = source[key];
451
- }
452
- }
453
- }
454
-
455
- return target;
456
- };
457
-
458
- var modalParams = _extends({}, defaultParams);
459
- var queue = [];
460
- var swal2Observer = void 0;
461
-
462
- /*
463
- * Set type, text and actions on modal
464
- */
465
- var setParameters = function setParameters(params) {
466
- var modal = getModal() || init(params);
467
-
468
- for (var param in params) {
469
- if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
470
- console.warn('SweetAlert2: Unknown parameter "' + param + '"');
471
- }
472
- }
473
-
474
- // Set modal width
475
- modal.style.width = typeof params.width === 'number' ? params.width + 'px' : params.width;
476
-
477
- modal.style.padding = params.padding + 'px';
478
- modal.style.background = params.background;
479
- var successIconParts = modal.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
480
- for (var i = 0; i < successIconParts.length; i++) {
481
- successIconParts[i].style.background = params.background;
482
- }
483
-
484
- var title = getTitle();
485
- var content = getContent();
486
- var buttonsWrapper = getButtonsWrapper();
487
- var confirmButton = getConfirmButton();
488
- var cancelButton = getCancelButton();
489
- var closeButton = getCloseButton();
490
-
491
- // Title
492
- if (params.titleText) {
493
- title.innerText = params.titleText;
494
- } else {
495
- title.innerHTML = params.title.split('\n').join('<br />');
496
- }
497
-
498
- // Content
499
- if (params.text || params.html) {
500
- if (_typeof(params.html) === 'object') {
501
- content.innerHTML = '';
502
- if (0 in params.html) {
503
- for (var _i = 0; _i in params.html; _i++) {
504
- content.appendChild(params.html[_i].cloneNode(true));
505
- }
506
- } else {
507
- content.appendChild(params.html.cloneNode(true));
508
- }
509
- } else if (params.html) {
510
- content.innerHTML = params.html;
511
- } else if (params.text) {
512
- content.textContent = params.text;
513
- }
514
- show(content);
515
- } else {
516
- hide(content);
517
- }
518
-
519
- // Close button
520
- if (params.showCloseButton) {
521
- show(closeButton);
522
- } else {
523
- hide(closeButton);
524
- }
525
-
526
- // Custom Class
527
- modal.className = swalClasses.modal;
528
- if (params.customClass) {
529
- addClass(modal, params.customClass);
530
- }
531
-
532
- // Progress steps
533
- var progressStepsContainer = getProgressSteps();
534
- var currentProgressStep = parseInt(params.currentProgressStep === null ? sweetAlert.getQueueStep() : params.currentProgressStep, 10);
535
- if (params.progressSteps.length) {
536
- show(progressStepsContainer);
537
- empty(progressStepsContainer);
538
- if (currentProgressStep >= params.progressSteps.length) {
539
- console.warn('SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
540
- }
541
- params.progressSteps.forEach(function (step, index) {
542
- var circle = document.createElement('li');
543
- addClass(circle, swalClasses.progresscircle);
544
- circle.innerHTML = step;
545
- if (index === currentProgressStep) {
546
- addClass(circle, swalClasses.activeprogressstep);
547
- }
548
- progressStepsContainer.appendChild(circle);
549
- if (index !== params.progressSteps.length - 1) {
550
- var line = document.createElement('li');
551
- addClass(line, swalClasses.progressline);
552
- line.style.width = params.progressStepsDistance;
553
- progressStepsContainer.appendChild(line);
554
- }
555
- });
556
- } else {
557
- hide(progressStepsContainer);
558
- }
559
-
560
- // Icon
561
- var icons = getIcons();
562
- for (var _i2 = 0; _i2 < icons.length; _i2++) {
563
- hide(icons[_i2]);
564
- }
565
- if (params.type) {
566
- var validType = false;
567
- for (var iconType in iconTypes) {
568
- if (params.type === iconType) {
569
- validType = true;
570
- break;
571
- }
572
- }
573
- if (!validType) {
574
- console.error('SweetAlert2: Unknown alert type: ' + params.type);
575
- return false;
576
- }
577
- var icon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type]);
578
- show(icon);
579
-
580
- // Animate icon
581
- if (params.animation) {
582
- switch (params.type) {
583
- case 'success':
584
- addClass(icon, 'swal2-animate-success-icon');
585
- addClass(icon.querySelector('.swal2-success-line-tip'), 'swal2-animate-success-line-tip');
586
- addClass(icon.querySelector('.swal2-success-line-long'), 'swal2-animate-success-line-long');
587
- break;
588
- case 'error':
589
- addClass(icon, 'swal2-animate-error-icon');
590
- addClass(icon.querySelector('.swal2-x-mark'), 'swal2-animate-x-mark');
591
- break;
592
- default:
593
- break;
594
- }
595
- }
596
- }
597
-
598
- // Custom image
599
- var image = getImage();
600
- if (params.imageUrl) {
601
- image.setAttribute('src', params.imageUrl);
602
- show(image);
603
-
604
- if (params.imageWidth) {
605
- image.setAttribute('width', params.imageWidth);
606
- } else {
607
- image.removeAttribute('width');
608
- }
609
-
610
- if (params.imageHeight) {
611
- image.setAttribute('height', params.imageHeight);
612
- } else {
613
- image.removeAttribute('height');
614
- }
615
-
616
- image.className = swalClasses.image;
617
- if (params.imageClass) {
618
- addClass(image, params.imageClass);
619
- }
620
- } else {
621
- hide(image);
622
- }
623
-
624
- // Cancel button
625
- if (params.showCancelButton) {
626
- cancelButton.style.display = 'inline-block';
627
- } else {
628
- hide(cancelButton);
629
- }
630
-
631
- // Confirm button
632
- if (params.showConfirmButton) {
633
- removeStyleProperty(confirmButton, 'display');
634
- } else {
635
- hide(confirmButton);
636
- }
637
-
638
- // Buttons wrapper
639
- if (!params.showConfirmButton && !params.showCancelButton) {
640
- hide(buttonsWrapper);
641
- } else {
642
- show(buttonsWrapper);
643
- }
644
-
645
- // Edit text on cancel and confirm buttons
646
- confirmButton.innerHTML = params.confirmButtonText;
647
- cancelButton.innerHTML = params.cancelButtonText;
648
-
649
- // Set buttons to selected background colors
650
- if (params.buttonsStyling) {
651
- confirmButton.style.backgroundColor = params.confirmButtonColor;
652
- cancelButton.style.backgroundColor = params.cancelButtonColor;
653
- }
654
-
655
- // Add buttons custom classes
656
- confirmButton.className = swalClasses.confirm;
657
- addClass(confirmButton, params.confirmButtonClass);
658
- cancelButton.className = swalClasses.cancel;
659
- addClass(cancelButton, params.cancelButtonClass);
660
-
661
- // Buttons styling
662
- if (params.buttonsStyling) {
663
- addClass(confirmButton, swalClasses.styled);
664
- addClass(cancelButton, swalClasses.styled);
665
- } else {
666
- removeClass(confirmButton, swalClasses.styled);
667
- removeClass(cancelButton, swalClasses.styled);
668
-
669
- confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = '';
670
- cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = '';
671
- }
672
-
673
- // CSS animation
674
- if (params.animation === true) {
675
- removeClass(modal, swalClasses.noanimation);
676
- } else {
677
- addClass(modal, swalClasses.noanimation);
678
- }
679
- };
680
-
681
- /*
682
- * Animations
683
- */
684
- var openModal = function openModal(animation, onComplete) {
685
- var container = getContainer();
686
- var modal = getModal();
687
-
688
- if (animation) {
689
- addClass(modal, swalClasses.show);
690
- addClass(container, swalClasses.fade);
691
- removeClass(modal, swalClasses.hide);
692
- } else {
693
- removeClass(modal, swalClasses.fade);
694
- }
695
- show(modal);
696
-
697
- // scrolling is 'hidden' until animation is done, after that 'auto'
698
- container.style.overflowY = 'hidden';
699
- if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
700
- modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
701
- modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
702
- container.style.overflowY = 'auto';
703
- });
704
- } else {
705
- container.style.overflowY = 'auto';
706
- }
707
-
708
- addClass(document.documentElement, swalClasses.shown);
709
- addClass(document.body, swalClasses.shown);
710
- addClass(container, swalClasses.shown);
711
- fixScrollbar();
712
- iOSfix();
713
- states.previousActiveElement = document.activeElement;
714
- if (onComplete !== null && typeof onComplete === 'function') {
715
- setTimeout(function () {
716
- onComplete(modal);
717
- });
718
- }
719
- };
720
-
721
- var fixScrollbar = function fixScrollbar() {
722
- // for queues, do not do this more than once
723
- if (states.previousBodyPadding !== null) {
724
- return;
725
- }
726
- // if the body has overflow
727
- if (document.body.scrollHeight > window.innerHeight) {
728
- // add padding so the content doesn't shift after removal of scrollbar
729
- states.previousBodyPadding = document.body.style.paddingRight;
730
- document.body.style.paddingRight = measureScrollbar() + 'px';
731
- }
732
- };
733
-
734
- var undoScrollbar = function undoScrollbar() {
735
- if (states.previousBodyPadding !== null) {
736
- document.body.style.paddingRight = states.previousBodyPadding;
737
- states.previousBodyPadding = null;
738
- }
739
- };
740
-
741
- // Fix iOS scrolling http://stackoverflow.com/q/39626302/1331425
742
- var iOSfix = function iOSfix() {
743
- var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
744
- if (iOS && !hasClass(document.body, swalClasses.iosfix)) {
745
- var offset = document.body.scrollTop;
746
- document.body.style.top = offset * -1 + 'px';
747
- addClass(document.body, swalClasses.iosfix);
748
- }
749
- };
750
-
751
- var undoIOSfix = function undoIOSfix() {
752
- if (hasClass(document.body, swalClasses.iosfix)) {
753
- var offset = parseInt(document.body.style.top, 10);
754
- removeClass(document.body, swalClasses.iosfix);
755
- document.body.style.top = '';
756
- document.body.scrollTop = offset * -1;
757
- }
758
- };
759
-
760
- // SweetAlert entry point
761
- var sweetAlert = function sweetAlert() {
762
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
763
- args[_key] = arguments[_key];
764
- }
765
-
766
- if (args[0] === undefined) {
767
- console.error('SweetAlert2 expects at least 1 attribute!');
768
- return false;
769
- }
770
-
771
- var params = _extends({}, modalParams);
772
-
773
- switch (_typeof(args[0])) {
774
- case 'string':
775
- params.title = args[0];
776
- params.html = args[1];
777
- params.type = args[2];
778
-
779
- break;
780
-
781
- case 'object':
782
- _extends(params, args[0]);
783
- params.extraParams = args[0].extraParams;
784
-
785
- if (params.input === 'email' && params.inputValidator === null) {
786
- params.inputValidator = function (email) {
787
- return new Promise(function (resolve, reject) {
788
- var emailRegex = /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
789
- if (emailRegex.test(email)) {
790
- resolve();
791
- } else {
792
- reject('Invalid email address');
793
- }
794
- });
795
- };
796
- }
797
-
798
- if (params.input === 'url' && params.inputValidator === null) {
799
- params.inputValidator = function (url) {
800
- return new Promise(function (resolve, reject) {
801
- // taken from https://stackoverflow.com/a/3809435/1331425
802
- var urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/;
803
- if (urlRegex.test(url)) {
804
- resolve();
805
- } else {
806
- reject('Invalid URL');
807
- }
808
- });
809
- };
810
- }
811
- break;
812
-
813
- default:
814
- console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got ' + _typeof(args[0]));
815
- return false;
816
- }
817
-
818
- setParameters(params);
819
-
820
- var container = getContainer();
821
- var modal = getModal();
822
-
823
- return new Promise(function (resolve, reject) {
824
- // Close on timer
825
- if (params.timer) {
826
- modal.timeout = setTimeout(function () {
827
- sweetAlert.closeModal(params.onClose);
828
- if (params.useRejections) {
829
- reject('timer');
830
- } else {
831
- resolve({ dismiss: 'timer' });
832
- }
833
- }, params.timer);
834
- }
835
-
836
- // Get input element by specified type or, if type isn't specified, by params.input
837
- var getInput = function getInput(inputType) {
838
- inputType = inputType || params.input;
839
- if (!inputType) {
840
- return null;
841
- }
842
- switch (inputType) {
843
- case 'select':
844
- case 'textarea':
845
- case 'file':
846
- return getChildByClass(modal, swalClasses[inputType]);
847
- case 'checkbox':
848
- return modal.querySelector('.' + swalClasses.checkbox + ' input');
849
- case 'radio':
850
- return modal.querySelector('.' + swalClasses.radio + ' input:checked') || modal.querySelector('.' + swalClasses.radio + ' input:first-child');
851
- case 'range':
852
- return modal.querySelector('.' + swalClasses.range + ' input');
853
- default:
854
- return getChildByClass(modal, swalClasses.input);
855
- }
856
- };
857
-
858
- // Get the value of the modal input
859
- var getInputValue = function getInputValue() {
860
- var input = getInput();
861
- if (!input) {
862
- return null;
863
- }
864
- switch (params.input) {
865
- case 'checkbox':
866
- return input.checked ? 1 : 0;
867
- case 'radio':
868
- return input.checked ? input.value : null;
869
- case 'file':
870
- return input.files.length ? input.files[0] : null;
871
- default:
872
- return params.inputAutoTrim ? input.value.trim() : input.value;
873
- }
874
- };
875
-
876
- // input autofocus
877
- if (params.input) {
878
- setTimeout(function () {
879
- var input = getInput();
880
- if (input) {
881
- focusInput(input);
882
- }
883
- }, 0);
884
- }
885
-
886
- var confirm = function confirm(value) {
887
- if (params.showLoaderOnConfirm) {
888
- sweetAlert.showLoading();
889
- }
890
-
891
- if (params.preConfirm) {
892
- params.preConfirm(value, params.extraParams).then(function (preConfirmValue) {
893
- sweetAlert.closeModal(params.onClose);
894
- resolve(preConfirmValue || value);
895
- }, function (error) {
896
- sweetAlert.hideLoading();
897
- if (error) {
898
- sweetAlert.showValidationError(error);
899
- }
900
- });
901
- } else {
902
- sweetAlert.closeModal(params.onClose);
903
- if (params.useRejections) {
904
- resolve(value);
905
- } else {
906
- resolve({ value: value });
907
- }
908
- }
909
- };
910
-
911
- // Mouse interactions
912
- var onButtonEvent = function onButtonEvent(event) {
913
- var e = event || window.event;
914
- var target = e.target || e.srcElement;
915
- var confirmButton = getConfirmButton();
916
- var cancelButton = getCancelButton();
917
- var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target));
918
- var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target));
919
-
920
- switch (e.type) {
921
- case 'mouseover':
922
- case 'mouseup':
923
- if (params.buttonsStyling) {
924
- if (targetedConfirm) {
925
- confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1);
926
- } else if (targetedCancel) {
927
- cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1);
928
- }
929
- }
930
- break;
931
- case 'mouseout':
932
- if (params.buttonsStyling) {
933
- if (targetedConfirm) {
934
- confirmButton.style.backgroundColor = params.confirmButtonColor;
935
- } else if (targetedCancel) {
936
- cancelButton.style.backgroundColor = params.cancelButtonColor;
937
- }
938
- }
939
- break;
940
- case 'mousedown':
941
- if (params.buttonsStyling) {
942
- if (targetedConfirm) {
943
- confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2);
944
- } else if (targetedCancel) {
945
- cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2);
946
- }
947
- }
948
- break;
949
- case 'click':
950
- // Clicked 'confirm'
951
- if (targetedConfirm && sweetAlert.isVisible()) {
952
- sweetAlert.disableButtons();
953
- if (params.input) {
954
- var inputValue = getInputValue();
955
-
956
- if (params.inputValidator) {
957
- sweetAlert.disableInput();
958
- params.inputValidator(inputValue, params.extraParams).then(function () {
959
- sweetAlert.enableButtons();
960
- sweetAlert.enableInput();
961
- confirm(inputValue);
962
- }, function (error) {
963
- sweetAlert.enableButtons();
964
- sweetAlert.enableInput();
965
- if (error) {
966
- sweetAlert.showValidationError(error);
967
- }
968
- });
969
- } else {
970
- confirm(inputValue);
971
- }
972
- } else {
973
- confirm(true);
974
- }
975
-
976
- // Clicked 'cancel'
977
- } else if (targetedCancel && sweetAlert.isVisible()) {
978
- sweetAlert.disableButtons();
979
- sweetAlert.closeModal(params.onClose);
980
- if (params.useRejections) {
981
- reject('cancel');
982
- } else {
983
- resolve({ dismiss: 'cancel' });
984
- }
985
- }
986
- break;
987
- default:
988
- }
989
- };
990
-
991
- var buttons = modal.querySelectorAll('button');
992
- for (var i = 0; i < buttons.length; i++) {
993
- buttons[i].onclick = onButtonEvent;
994
- buttons[i].onmouseover = onButtonEvent;
995
- buttons[i].onmouseout = onButtonEvent;
996
- buttons[i].onmousedown = onButtonEvent;
997
- }
998
-
999
- // Closing modal by close button
1000
- getCloseButton().onclick = function () {
1001
- sweetAlert.closeModal(params.onClose);
1002
- if (params.useRejections) {
1003
- reject('close');
1004
- } else {
1005
- resolve({ dismiss: 'close' });
1006
- }
1007
- };
1008
-
1009
- // Closing modal by overlay click
1010
- container.onclick = function (e) {
1011
- if (e.target !== container) {
1012
- return;
1013
- }
1014
- if (params.allowOutsideClick) {
1015
- sweetAlert.closeModal(params.onClose);
1016
- if (params.useRejections) {
1017
- reject('overlay');
1018
- } else {
1019
- resolve({ dismiss: 'overlay' });
1020
- }
1021
- }
1022
- };
1023
-
1024
- var buttonsWrapper = getButtonsWrapper();
1025
- var confirmButton = getConfirmButton();
1026
- var cancelButton = getCancelButton();
1027
-
1028
- // Reverse buttons (Confirm on the right side)
1029
- if (params.reverseButtons) {
1030
- confirmButton.parentNode.insertBefore(cancelButton, confirmButton);
1031
- } else {
1032
- confirmButton.parentNode.insertBefore(confirmButton, cancelButton);
1033
- }
1034
-
1035
- // Focus handling
1036
- var setFocus = function setFocus(index, increment) {
1037
- var focusableElements = getFocusableElements(params.focusCancel);
1038
- // search for visible elements and select the next possible match
1039
- for (var _i3 = 0; _i3 < focusableElements.length; _i3++) {
1040
- index = index + increment;
1041
-
1042
- // rollover to first item
1043
- if (index === focusableElements.length) {
1044
- index = 0;
1045
-
1046
- // go to last item
1047
- } else if (index === -1) {
1048
- index = focusableElements.length - 1;
1049
- }
1050
-
1051
- // determine if element is visible
1052
- var el = focusableElements[index];
1053
- if (isVisible(el)) {
1054
- return el.focus();
1055
- }
1056
- }
1057
- };
1058
-
1059
- var handleKeyDown = function handleKeyDown(event) {
1060
- var e = event || window.event;
1061
- var keyCode = e.keyCode || e.which;
1062
-
1063
- if ([9, 13, 32, 27, 37, 38, 39, 40].indexOf(keyCode) === -1) {
1064
- // Don't do work on keys we don't care about.
1065
- return;
1066
- }
1067
-
1068
- var targetElement = e.target || e.srcElement;
1069
-
1070
- var focusableElements = getFocusableElements(params.focusCancel);
1071
- var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
1072
- for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
1073
- if (targetElement === focusableElements[_i4]) {
1074
- btnIndex = _i4;
1075
- break;
1076
- }
1077
- }
1078
-
1079
- // TAB
1080
- if (keyCode === 9) {
1081
- if (!e.shiftKey) {
1082
- // Cycle to the next button
1083
- setFocus(btnIndex, 1);
1084
- } else {
1085
- // Cycle to the prev button
1086
- setFocus(btnIndex, -1);
1087
- }
1088
- e.stopPropagation();
1089
- e.preventDefault();
1090
-
1091
- // ARROWS - switch focus between buttons
1092
- } else if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
1093
- // focus Cancel button if Confirm button is currently focused
1094
- if (document.activeElement === confirmButton && isVisible(cancelButton)) {
1095
- cancelButton.focus();
1096
- // and vice versa
1097
- } else if (document.activeElement === cancelButton && isVisible(confirmButton)) {
1098
- confirmButton.focus();
1099
- }
1100
-
1101
- // ENTER/SPACE
1102
- } else if (keyCode === 13 || keyCode === 32) {
1103
- if (btnIndex === -1 && params.allowEnterKey) {
1104
- // ENTER/SPACE clicked outside of a button.
1105
- if (params.focusCancel) {
1106
- fireClick(cancelButton, e);
1107
- } else {
1108
- fireClick(confirmButton, e);
1109
- }
1110
- e.stopPropagation();
1111
- e.preventDefault();
1112
- }
1113
-
1114
- // ESC
1115
- } else if (keyCode === 27 && params.allowEscapeKey === true) {
1116
- sweetAlert.closeModal(params.onClose);
1117
- if (params.useRejections) {
1118
- reject('esc');
1119
- } else {
1120
- resolve({ dismiss: 'esc' });
1121
- }
1122
- }
1123
- };
1124
-
1125
- if (!window.onkeydown || window.onkeydown.toString() !== handleKeyDown.toString()) {
1126
- states.previousWindowKeyDown = window.onkeydown;
1127
- window.onkeydown = handleKeyDown;
1128
- }
1129
-
1130
- // Loading state
1131
- if (params.buttonsStyling) {
1132
- confirmButton.style.borderLeftColor = params.confirmButtonColor;
1133
- confirmButton.style.borderRightColor = params.confirmButtonColor;
1134
- }
1135
-
1136
- /**
1137
- * Show spinner instead of Confirm button and disable Cancel button
1138
- */
1139
- sweetAlert.hideLoading = sweetAlert.disableLoading = function () {
1140
- if (!params.showConfirmButton) {
1141
- hide(confirmButton);
1142
- if (!params.showCancelButton) {
1143
- hide(getButtonsWrapper());
1144
- }
1145
- }
1146
- removeClass(buttonsWrapper, swalClasses.loading);
1147
- removeClass(modal, swalClasses.loading);
1148
- confirmButton.disabled = false;
1149
- cancelButton.disabled = false;
1150
- };
1151
-
1152
- sweetAlert.getTitle = function () {
1153
- return getTitle();
1154
- };
1155
- sweetAlert.getContent = function () {
1156
- return getContent();
1157
- };
1158
- sweetAlert.getInput = function () {
1159
- return getInput();
1160
- };
1161
- sweetAlert.getImage = function () {
1162
- return getImage();
1163
- };
1164
- sweetAlert.getButtonsWrapper = function () {
1165
- return getButtonsWrapper();
1166
- };
1167
- sweetAlert.getConfirmButton = function () {
1168
- return getConfirmButton();
1169
- };
1170
- sweetAlert.getCancelButton = function () {
1171
- return getCancelButton();
1172
- };
1173
-
1174
- sweetAlert.enableButtons = function () {
1175
- confirmButton.disabled = false;
1176
- cancelButton.disabled = false;
1177
- };
1178
-
1179
- sweetAlert.disableButtons = function () {
1180
- confirmButton.disabled = true;
1181
- cancelButton.disabled = true;
1182
- };
1183
-
1184
- sweetAlert.enableConfirmButton = function () {
1185
- confirmButton.disabled = false;
1186
- };
1187
-
1188
- sweetAlert.disableConfirmButton = function () {
1189
- confirmButton.disabled = true;
1190
- };
1191
-
1192
- sweetAlert.enableInput = function () {
1193
- var input = getInput();
1194
- if (!input) {
1195
- return false;
1196
- }
1197
- if (input.type === 'radio') {
1198
- var radiosContainer = input.parentNode.parentNode;
1199
- var radios = radiosContainer.querySelectorAll('input');
1200
- for (var _i5 = 0; _i5 < radios.length; _i5++) {
1201
- radios[_i5].disabled = false;
1202
- }
1203
- } else {
1204
- input.disabled = false;
1205
- }
1206
- };
1207
-
1208
- sweetAlert.disableInput = function () {
1209
- var input = getInput();
1210
- if (!input) {
1211
- return false;
1212
- }
1213
- if (input && input.type === 'radio') {
1214
- var radiosContainer = input.parentNode.parentNode;
1215
- var radios = radiosContainer.querySelectorAll('input');
1216
- for (var _i6 = 0; _i6 < radios.length; _i6++) {
1217
- radios[_i6].disabled = true;
1218
- }
1219
- } else {
1220
- input.disabled = true;
1221
- }
1222
- };
1223
-
1224
- // Set modal min-height to disable scrolling inside the modal
1225
- sweetAlert.recalculateHeight = debounce(function () {
1226
- var modal = getModal();
1227
- if (!modal) {
1228
- return;
1229
- }
1230
- var prevState = modal.style.display;
1231
- modal.style.minHeight = '';
1232
- show(modal);
1233
- modal.style.minHeight = modal.scrollHeight + 1 + 'px';
1234
- modal.style.display = prevState;
1235
- }, 50);
1236
-
1237
- // Show block with validation error
1238
- sweetAlert.showValidationError = function (error) {
1239
- var validationError = getValidationError();
1240
- validationError.innerHTML = error;
1241
- show(validationError);
1242
-
1243
- var input = getInput();
1244
- if (input) {
1245
- focusInput(input);
1246
- addClass(input, swalClasses.inputerror);
1247
- }
1248
- };
1249
-
1250
- // Hide block with validation error
1251
- sweetAlert.resetValidationError = function () {
1252
- var validationError = getValidationError();
1253
- hide(validationError);
1254
- sweetAlert.recalculateHeight();
1255
-
1256
- var input = getInput();
1257
- if (input) {
1258
- removeClass(input, swalClasses.inputerror);
1259
- }
1260
- };
1261
-
1262
- sweetAlert.getProgressSteps = function () {
1263
- return params.progressSteps;
1264
- };
1265
-
1266
- sweetAlert.setProgressSteps = function (progressSteps) {
1267
- params.progressSteps = progressSteps;
1268
- setParameters(params);
1269
- };
1270
-
1271
- sweetAlert.showProgressSteps = function () {
1272
- show(getProgressSteps());
1273
- };
1274
-
1275
- sweetAlert.hideProgressSteps = function () {
1276
- hide(getProgressSteps());
1277
- };
1278
-
1279
- sweetAlert.enableButtons();
1280
- sweetAlert.hideLoading();
1281
- sweetAlert.resetValidationError();
1282
-
1283
- // inputs
1284
- var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
1285
- var input = void 0;
1286
- for (var _i7 = 0; _i7 < inputTypes.length; _i7++) {
1287
- var inputClass = swalClasses[inputTypes[_i7]];
1288
- var inputContainer = getChildByClass(modal, inputClass);
1289
- input = getInput(inputTypes[_i7]);
1290
-
1291
- // set attributes
1292
- if (input) {
1293
- for (var j in input.attributes) {
1294
- if (input.attributes.hasOwnProperty(j)) {
1295
- var attrName = input.attributes[j].name;
1296
- if (attrName !== 'type' && attrName !== 'value') {
1297
- input.removeAttribute(attrName);
1298
- }
1299
- }
1300
- }
1301
- for (var attr in params.inputAttributes) {
1302
- input.setAttribute(attr, params.inputAttributes[attr]);
1303
- }
1304
- }
1305
-
1306
- // set class
1307
- inputContainer.className = inputClass;
1308
- if (params.inputClass) {
1309
- addClass(inputContainer, params.inputClass);
1310
- }
1311
-
1312
- hide(inputContainer);
1313
- }
1314
-
1315
- var populateInputOptions = void 0;
1316
- switch (params.input) {
1317
- case 'text':
1318
- case 'email':
1319
- case 'password':
1320
- case 'number':
1321
- case 'tel':
1322
- case 'url':
1323
- input = getChildByClass(modal, swalClasses.input);
1324
- input.value = params.inputValue;
1325
- input.placeholder = params.inputPlaceholder;
1326
- input.type = params.input;
1327
- show(input);
1328
- break;
1329
- case 'file':
1330
- input = getChildByClass(modal, swalClasses.file);
1331
- input.placeholder = params.inputPlaceholder;
1332
- input.type = params.input;
1333
- show(input);
1334
- break;
1335
- case 'range':
1336
- var range = getChildByClass(modal, swalClasses.range);
1337
- var rangeInput = range.querySelector('input');
1338
- var rangeOutput = range.querySelector('output');
1339
- rangeInput.value = params.inputValue;
1340
- rangeInput.type = params.input;
1341
- rangeOutput.value = params.inputValue;
1342
- show(range);
1343
- break;
1344
- case 'select':
1345
- var select = getChildByClass(modal, swalClasses.select);
1346
- select.innerHTML = '';
1347
- if (params.inputPlaceholder) {
1348
- var placeholder = document.createElement('option');
1349
- placeholder.innerHTML = params.inputPlaceholder;
1350
- placeholder.value = '';
1351
- placeholder.disabled = true;
1352
- placeholder.selected = true;
1353
- select.appendChild(placeholder);
1354
- }
1355
- populateInputOptions = function populateInputOptions(inputOptions) {
1356
- for (var optionValue in inputOptions) {
1357
- var option = document.createElement('option');
1358
- option.value = optionValue;
1359
- option.innerHTML = inputOptions[optionValue];
1360
- if (params.inputValue === optionValue) {
1361
- option.selected = true;
1362
- }
1363
- select.appendChild(option);
1364
- }
1365
- show(select);
1366
- select.focus();
1367
- };
1368
- break;
1369
- case 'radio':
1370
- var radio = getChildByClass(modal, swalClasses.radio);
1371
- radio.innerHTML = '';
1372
- populateInputOptions = function populateInputOptions(inputOptions) {
1373
- for (var radioValue in inputOptions) {
1374
- var radioInput = document.createElement('input');
1375
- var radioLabel = document.createElement('label');
1376
- var radioLabelSpan = document.createElement('span');
1377
- radioInput.type = 'radio';
1378
- radioInput.name = swalClasses.radio;
1379
- radioInput.value = radioValue;
1380
- if (params.inputValue === radioValue) {
1381
- radioInput.checked = true;
1382
- }
1383
- radioLabelSpan.innerHTML = inputOptions[radioValue];
1384
- radioLabel.appendChild(radioInput);
1385
- radioLabel.appendChild(radioLabelSpan);
1386
- radioLabel.for = radioInput.id;
1387
- radio.appendChild(radioLabel);
1388
- }
1389
- show(radio);
1390
- var radios = radio.querySelectorAll('input');
1391
- if (radios.length) {
1392
- radios[0].focus();
1393
- }
1394
- };
1395
- break;
1396
- case 'checkbox':
1397
- var checkbox = getChildByClass(modal, swalClasses.checkbox);
1398
- var checkboxInput = getInput('checkbox');
1399
- checkboxInput.type = 'checkbox';
1400
- checkboxInput.value = 1;
1401
- checkboxInput.id = swalClasses.checkbox;
1402
- checkboxInput.checked = Boolean(params.inputValue);
1403
- var label = checkbox.getElementsByTagName('span');
1404
- if (label.length) {
1405
- checkbox.removeChild(label[0]);
1406
- }
1407
- label = document.createElement('span');
1408
- label.innerHTML = params.inputPlaceholder;
1409
- checkbox.appendChild(label);
1410
- show(checkbox);
1411
- break;
1412
- case 'textarea':
1413
- var textarea = getChildByClass(modal, swalClasses.textarea);
1414
- textarea.value = params.inputValue;
1415
- textarea.placeholder = params.inputPlaceholder;
1416
- show(textarea);
1417
- break;
1418
- case null:
1419
- break;
1420
- default:
1421
- console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "' + params.input + '"');
1422
- break;
1423
- }
1424
-
1425
- if (params.input === 'select' || params.input === 'radio') {
1426
- if (params.inputOptions instanceof Promise) {
1427
- sweetAlert.showLoading();
1428
- params.inputOptions.then(function (inputOptions) {
1429
- sweetAlert.hideLoading();
1430
- populateInputOptions(inputOptions);
1431
- });
1432
- } else if (_typeof(params.inputOptions) === 'object') {
1433
- populateInputOptions(params.inputOptions);
1434
- } else {
1435
- console.error('SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got ' + _typeof(params.inputOptions));
1436
- }
1437
- }
1438
-
1439
- openModal(params.animation, params.onOpen);
1440
-
1441
- // Focus the first element (input or button)
1442
- if (params.allowEnterKey) {
1443
- setFocus(-1, 1);
1444
- } else {
1445
- if (document.activeElement) {
1446
- document.activeElement.blur();
1447
- }
1448
- }
1449
-
1450
- // fix scroll
1451
- getContainer().scrollTop = 0;
1452
-
1453
- // Observe changes inside the modal and adjust height
1454
- if (typeof MutationObserver !== 'undefined' && !swal2Observer) {
1455
- swal2Observer = new MutationObserver(sweetAlert.recalculateHeight);
1456
- swal2Observer.observe(modal, { childList: true, characterData: true, subtree: true });
1457
- }
1458
- });
1459
- };
1460
-
1461
- /*
1462
- * Global function to determine if swal2 modal is shown
1463
- */
1464
- sweetAlert.isVisible = function () {
1465
- return !!getModal();
1466
- };
1467
-
1468
- /*
1469
- * Global function for chaining sweetAlert modals
1470
- */
1471
- sweetAlert.queue = function (steps) {
1472
- queue = steps;
1473
- var resetQueue = function resetQueue() {
1474
- queue = [];
1475
- document.body.removeAttribute('data-swal2-queue-step');
1476
- };
1477
- var queueResult = [];
1478
- return new Promise(function (resolve, reject) {
1479
- (function step(i, callback) {
1480
- if (i < queue.length) {
1481
- document.body.setAttribute('data-swal2-queue-step', i);
1482
-
1483
- sweetAlert(queue[i]).then(function (result) {
1484
- queueResult.push(result);
1485
- step(i + 1, callback);
1486
- }, function (dismiss) {
1487
- resetQueue();
1488
- reject(dismiss);
1489
- });
1490
- } else {
1491
- resetQueue();
1492
- resolve(queueResult);
1493
- }
1494
- })(0);
1495
- });
1496
- };
1497
-
1498
- /*
1499
- * Global function for getting the index of current modal in queue
1500
- */
1501
- sweetAlert.getQueueStep = function () {
1502
- return document.body.getAttribute('data-swal2-queue-step');
1503
- };
1504
-
1505
- /*
1506
- * Global function for inserting a modal to the queue
1507
- */
1508
- sweetAlert.insertQueueStep = function (step, index) {
1509
- if (index && index < queue.length) {
1510
- return queue.splice(index, 0, step);
1511
- }
1512
- return queue.push(step);
1513
- };
1514
-
1515
- /*
1516
- * Global function for deleting a modal from the queue
1517
- */
1518
- sweetAlert.deleteQueueStep = function (index) {
1519
- if (typeof queue[index] !== 'undefined') {
1520
- queue.splice(index, 1);
1521
- }
1522
- };
1523
-
1524
- /*
1525
- * Global function to close sweetAlert
1526
- */
1527
- sweetAlert.close = sweetAlert.closeModal = function (onComplete) {
1528
- var container = getContainer();
1529
- var modal = getModal();
1530
- if (!modal) {
1531
- return;
1532
- }
1533
- removeClass(modal, swalClasses.show);
1534
- addClass(modal, swalClasses.hide);
1535
- clearTimeout(modal.timeout);
1536
-
1537
- resetPrevState();
1538
-
1539
- var removeModalAndResetState = function removeModalAndResetState() {
1540
- if (container.parentNode) {
1541
- container.parentNode.removeChild(container);
1542
- }
1543
- removeClass(document.documentElement, swalClasses.shown);
1544
- removeClass(document.body, swalClasses.shown);
1545
- undoScrollbar();
1546
- undoIOSfix();
1547
- };
1548
-
1549
- // If animation is supported, animate
1550
- if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
1551
- modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
1552
- modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
1553
- if (hasClass(modal, swalClasses.hide)) {
1554
- removeModalAndResetState();
1555
- }
1556
- });
1557
- } else {
1558
- // Otherwise, remove immediately
1559
- removeModalAndResetState();
1560
- }
1561
- if (onComplete !== null && typeof onComplete === 'function') {
1562
- setTimeout(function () {
1563
- onComplete(modal);
1564
- });
1565
- }
1566
- };
1567
-
1568
- /*
1569
- * Global function to click 'Confirm' button
1570
- */
1571
- sweetAlert.clickConfirm = function () {
1572
- return getConfirmButton().click();
1573
- };
1574
-
1575
- /*
1576
- * Global function to click 'Cancel' button
1577
- */
1578
- sweetAlert.clickCancel = function () {
1579
- return getCancelButton().click();
1580
- };
1581
-
1582
- /**
1583
- * Show spinner instead of Confirm button and disable Cancel button
1584
- */
1585
- sweetAlert.showLoading = sweetAlert.enableLoading = function () {
1586
- var modal = getModal();
1587
- if (!modal) {
1588
- sweetAlert('');
1589
- }
1590
- var buttonsWrapper = getButtonsWrapper();
1591
- var confirmButton = getConfirmButton();
1592
- var cancelButton = getCancelButton();
1593
-
1594
- show(buttonsWrapper);
1595
- show(confirmButton, 'inline-block');
1596
- addClass(buttonsWrapper, swalClasses.loading);
1597
- addClass(modal, swalClasses.loading);
1598
- confirmButton.disabled = true;
1599
- cancelButton.disabled = true;
1600
- };
1601
-
1602
- /**
1603
- * Set default params for each popup
1604
- * @param {Object} userParams
1605
- */
1606
- sweetAlert.setDefaults = function (userParams) {
1607
- if (!userParams || (typeof userParams === 'undefined' ? 'undefined' : _typeof(userParams)) !== 'object') {
1608
- return console.error('SweetAlert2: the argument for setDefaults() is required and has to be a object');
1609
- }
1610
-
1611
- for (var param in userParams) {
1612
- if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
1613
- console.warn('SweetAlert2: Unknown parameter "' + param + '"');
1614
- delete userParams[param];
1615
- }
1616
- }
1617
-
1618
- _extends(modalParams, userParams);
1619
- };
1620
-
1621
- /**
1622
- * Reset default params for each popup
1623
- */
1624
- sweetAlert.resetDefaults = function () {
1625
- modalParams = _extends({}, defaultParams);
1626
- };
1627
-
1628
- sweetAlert.noop = function () {};
1629
-
1630
- sweetAlert.version = '6.6.6';
1631
-
1632
- sweetAlert.default = sweetAlert;
1633
-
1634
- module.exports = sweetAlert;
1635
- if (window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/source/sweetalert2.js DELETED
@@ -1,1641 +0,0 @@
1
- /*!
2
- * sweetalert2 v6.6.6
3
- * Released under the MIT License.
4
- */
5
- (function (global, factory) {
6
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
7
- typeof define === 'function' && define.amd ? define(factory) :
8
- (global.Sweetalert2 = factory());
9
- }(this, (function () { 'use strict';
10
-
11
- var defaultParams = {
12
- title: '',
13
- titleText: '',
14
- text: '',
15
- html: '',
16
- type: null,
17
- customClass: '',
18
- target: 'body',
19
- animation: true,
20
- allowOutsideClick: true,
21
- allowEscapeKey: true,
22
- allowEnterKey: true,
23
- showConfirmButton: true,
24
- showCancelButton: false,
25
- preConfirm: null,
26
- confirmButtonText: 'OK',
27
- confirmButtonColor: '#3085d6',
28
- confirmButtonClass: null,
29
- cancelButtonText: 'Cancel',
30
- cancelButtonColor: '#aaa',
31
- cancelButtonClass: null,
32
- buttonsStyling: true,
33
- reverseButtons: false,
34
- focusCancel: false,
35
- showCloseButton: false,
36
- showLoaderOnConfirm: false,
37
- imageUrl: null,
38
- imageWidth: null,
39
- imageHeight: null,
40
- imageClass: null,
41
- timer: null,
42
- width: 500,
43
- padding: 20,
44
- background: '#fff',
45
- input: null,
46
- inputPlaceholder: '',
47
- inputValue: '',
48
- inputOptions: {},
49
- inputAutoTrim: true,
50
- inputClass: null,
51
- inputAttributes: {},
52
- inputValidator: null,
53
- progressSteps: [],
54
- currentProgressStep: null,
55
- progressStepsDistance: '40px',
56
- onOpen: null,
57
- onClose: null,
58
- useRejections: true
59
- };
60
-
61
- var swalPrefix = 'swal2-';
62
-
63
- var prefix = function prefix(items) {
64
- var result = {};
65
- for (var i in items) {
66
- result[items[i]] = swalPrefix + items[i];
67
- }
68
- return result;
69
- };
70
-
71
- var swalClasses = prefix(['container', 'shown', 'iosfix', 'modal', 'overlay', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'content', 'buttonswrapper', 'confirm', 'cancel', 'icon', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea', 'inputerror', 'validationerror', 'progresssteps', 'activeprogressstep', 'progresscircle', 'progressline', 'loading', 'styled']);
72
-
73
- var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);
74
-
75
- /*
76
- * Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color)
77
- */
78
- var colorLuminance = function colorLuminance(hex, lum) {
79
- // Validate hex string
80
- hex = String(hex).replace(/[^0-9a-f]/gi, '');
81
- if (hex.length < 6) {
82
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
83
- }
84
- lum = lum || 0;
85
-
86
- // Convert to decimal and change luminosity
87
- var rgb = '#';
88
- for (var i = 0; i < 3; i++) {
89
- var c = parseInt(hex.substr(i * 2, 2), 16);
90
- c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16);
91
- rgb += ('00' + c).substr(c.length);
92
- }
93
-
94
- return rgb;
95
- };
96
-
97
- var uniqueArray = function uniqueArray(arr) {
98
- var result = [];
99
- for (var i in arr) {
100
- if (result.indexOf(arr[i]) === -1) {
101
- result.push(arr[i]);
102
- }
103
- }
104
- return result;
105
- };
106
-
107
- /* global MouseEvent */
108
-
109
- // Remember state in cases where opening and handling a modal will fiddle with it.
110
- var states = {
111
- previousWindowKeyDown: null,
112
- previousActiveElement: null,
113
- previousBodyPadding: null
114
-
115
- /*
116
- * Add modal + overlay to DOM
117
- */
118
- };var init = function init(params) {
119
- if (typeof document === 'undefined') {
120
- console.error('SweetAlert2 requires document to initialize');
121
- return;
122
- }
123
-
124
- var container = document.createElement('div');
125
- container.className = swalClasses.container;
126
- container.innerHTML = sweetHTML;
127
-
128
- var targetElement = document.querySelector(params.target);
129
- if (!targetElement) {
130
- console.warn('SweetAlert2: Can\'t find the target "' + params.target + '"');
131
- targetElement = document.body;
132
- }
133
- targetElement.appendChild(container);
134
-
135
- var modal = getModal();
136
- var input = getChildByClass(modal, swalClasses.input);
137
- var file = getChildByClass(modal, swalClasses.file);
138
- var range = modal.querySelector('.' + swalClasses.range + ' input');
139
- var rangeOutput = modal.querySelector('.' + swalClasses.range + ' output');
140
- var select = getChildByClass(modal, swalClasses.select);
141
- var checkbox = modal.querySelector('.' + swalClasses.checkbox + ' input');
142
- var textarea = getChildByClass(modal, swalClasses.textarea);
143
-
144
- input.oninput = function () {
145
- sweetAlert.resetValidationError();
146
- };
147
-
148
- input.onkeydown = function (event) {
149
- setTimeout(function () {
150
- if (event.keyCode === 13 && params.allowEnterKey) {
151
- event.stopPropagation();
152
- sweetAlert.clickConfirm();
153
- }
154
- }, 0);
155
- };
156
-
157
- file.onchange = function () {
158
- sweetAlert.resetValidationError();
159
- };
160
-
161
- range.oninput = function () {
162
- sweetAlert.resetValidationError();
163
- rangeOutput.value = range.value;
164
- };
165
-
166
- range.onchange = function () {
167
- sweetAlert.resetValidationError();
168
- range.previousSibling.value = range.value;
169
- };
170
-
171
- select.onchange = function () {
172
- sweetAlert.resetValidationError();
173
- };
174
-
175
- checkbox.onchange = function () {
176
- sweetAlert.resetValidationError();
177
- };
178
-
179
- textarea.oninput = function () {
180
- sweetAlert.resetValidationError();
181
- };
182
-
183
- return modal;
184
- };
185
-
186
- /*
187
- * Manipulate DOM
188
- */
189
-
190
- var sweetHTML = ('\n <div role="dialog" aria-labelledby="' + swalClasses.title + '" aria-describedby="' + swalClasses.content + '" class="' + swalClasses.modal + '" tabindex="-1">\n <ul class="' + swalClasses.progresssteps + '"></ul>\n <div class="' + swalClasses.icon + ' ' + iconTypes.error + '">\n <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n </div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.question + '">?</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.warning + '">!</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.info + '">i</div>\n <div class="' + swalClasses.icon + ' ' + iconTypes.success + '">\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n </div>\n <img class="' + swalClasses.image + '" />\n <h2 class="' + swalClasses.title + '" id="' + swalClasses.title + '"></h2>\n <div id="' + swalClasses.content + '" class="' + swalClasses.content + '"></div>\n <input class="' + swalClasses.input + '" />\n <input type="file" class="' + swalClasses.file + '" />\n <div class="' + swalClasses.range + '">\n <output></output>\n <input type="range" />\n </div>\n <select class="' + swalClasses.select + '"></select>\n <div class="' + swalClasses.radio + '"></div>\n <label for="' + swalClasses.checkbox + '" class="' + swalClasses.checkbox + '">\n <input type="checkbox" />\n </label>\n <textarea class="' + swalClasses.textarea + '"></textarea>\n <div class="' + swalClasses.validationerror + '"></div>\n <div class="' + swalClasses.buttonswrapper + '">\n <button type="button" class="' + swalClasses.confirm + '">OK</button>\n <button type="button" class="' + swalClasses.cancel + '">Cancel</button>\n </div>\n <button type="button" class="' + swalClasses.close + '" aria-label="Close this dialog">\xD7</button>\n </div>\n').replace(/(^|\n)\s*/g, '');
191
-
192
- var getContainer = function getContainer() {
193
- return document.body.querySelector('.' + swalClasses.container);
194
- };
195
-
196
- var getModal = function getModal() {
197
- return getContainer() ? getContainer().querySelector('.' + swalClasses.modal) : null;
198
- };
199
-
200
- var getIcons = function getIcons() {
201
- var modal = getModal();
202
- return modal.querySelectorAll('.' + swalClasses.icon);
203
- };
204
-
205
- var elementByClass = function elementByClass(className) {
206
- return getContainer() ? getContainer().querySelector('.' + className) : null;
207
- };
208
-
209
- var getTitle = function getTitle() {
210
- return elementByClass(swalClasses.title);
211
- };
212
-
213
- var getContent = function getContent() {
214
- return elementByClass(swalClasses.content);
215
- };
216
-
217
- var getImage = function getImage() {
218
- return elementByClass(swalClasses.image);
219
- };
220
-
221
- var getButtonsWrapper = function getButtonsWrapper() {
222
- return elementByClass(swalClasses.buttonswrapper);
223
- };
224
-
225
- var getProgressSteps = function getProgressSteps() {
226
- return elementByClass(swalClasses.progresssteps);
227
- };
228
-
229
- var getValidationError = function getValidationError() {
230
- return elementByClass(swalClasses.validationerror);
231
- };
232
-
233
- var getConfirmButton = function getConfirmButton() {
234
- return elementByClass(swalClasses.confirm);
235
- };
236
-
237
- var getCancelButton = function getCancelButton() {
238
- return elementByClass(swalClasses.cancel);
239
- };
240
-
241
- var getCloseButton = function getCloseButton() {
242
- return elementByClass(swalClasses.close);
243
- };
244
-
245
- var getFocusableElements = function getFocusableElements(focusCancel) {
246
- var buttons = [getConfirmButton(), getCancelButton()];
247
- if (focusCancel) {
248
- buttons.reverse();
249
- }
250
- var focusableElements = buttons.concat(Array.prototype.slice.call(getModal().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, *[tabindex]:not([tabindex="-1"])')));
251
- return uniqueArray(focusableElements);
252
- };
253
-
254
- var hasClass = function hasClass(elem, className) {
255
- if (elem.classList) {
256
- return elem.classList.contains(className);
257
- }
258
- return false;
259
- };
260
-
261
- var focusInput = function focusInput(input) {
262
- input.focus();
263
-
264
- // place cursor at end of text in text input
265
- if (input.type !== 'file') {
266
- // http://stackoverflow.com/a/2345915/1331425
267
- var val = input.value;
268
- input.value = '';
269
- input.value = val;
270
- }
271
- };
272
-
273
- var addClass = function addClass(elem, className) {
274
- if (!elem || !className) {
275
- return;
276
- }
277
- var classes = className.split(/\s+/).filter(Boolean);
278
- classes.forEach(function (className) {
279
- elem.classList.add(className);
280
- });
281
- };
282
-
283
- var removeClass = function removeClass(elem, className) {
284
- if (!elem || !className) {
285
- return;
286
- }
287
- var classes = className.split(/\s+/).filter(Boolean);
288
- classes.forEach(function (className) {
289
- elem.classList.remove(className);
290
- });
291
- };
292
-
293
- var getChildByClass = function getChildByClass(elem, className) {
294
- for (var i = 0; i < elem.childNodes.length; i++) {
295
- if (hasClass(elem.childNodes[i], className)) {
296
- return elem.childNodes[i];
297
- }
298
- }
299
- };
300
-
301
- var show = function show(elem, display) {
302
- if (!display) {
303
- display = 'block';
304
- }
305
- elem.style.opacity = '';
306
- elem.style.display = display;
307
- };
308
-
309
- var hide = function hide(elem) {
310
- elem.style.opacity = '';
311
- elem.style.display = 'none';
312
- };
313
-
314
- var empty = function empty(elem) {
315
- while (elem.firstChild) {
316
- elem.removeChild(elem.firstChild);
317
- }
318
- };
319
-
320
- // borrowed from jqeury $(elem).is(':visible') implementation
321
- var isVisible = function isVisible(elem) {
322
- return elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length;
323
- };
324
-
325
- var removeStyleProperty = function removeStyleProperty(elem, property) {
326
- if (elem.style.removeProperty) {
327
- elem.style.removeProperty(property);
328
- } else {
329
- elem.style.removeAttribute(property);
330
- }
331
- };
332
-
333
- var fireClick = function fireClick(node) {
334
- if (!isVisible(node)) {
335
- return false;
336
- }
337
-
338
- // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
339
- // Then fixed for today's Chrome browser.
340
- if (typeof MouseEvent === 'function') {
341
- // Up-to-date approach
342
- var mevt = new MouseEvent('click', {
343
- view: window,
344
- bubbles: false,
345
- cancelable: true
346
- });
347
- node.dispatchEvent(mevt);
348
- } else if (document.createEvent) {
349
- // Fallback
350
- var evt = document.createEvent('MouseEvents');
351
- evt.initEvent('click', false, false);
352
- node.dispatchEvent(evt);
353
- } else if (document.createEventObject) {
354
- node.fireEvent('onclick');
355
- } else if (typeof node.onclick === 'function') {
356
- node.onclick();
357
- }
358
- };
359
-
360
- var animationEndEvent = function () {
361
- var testEl = document.createElement('div');
362
- var transEndEventNames = {
363
- 'WebkitAnimation': 'webkitAnimationEnd',
364
- 'OAnimation': 'oAnimationEnd oanimationend',
365
- 'msAnimation': 'MSAnimationEnd',
366
- 'animation': 'animationend'
367
- };
368
- for (var i in transEndEventNames) {
369
- if (transEndEventNames.hasOwnProperty(i) && testEl.style[i] !== undefined) {
370
- return transEndEventNames[i];
371
- }
372
- }
373
-
374
- return false;
375
- }();
376
-
377
- // Reset previous window keydown handler and focued element
378
- var resetPrevState = function resetPrevState() {
379
- window.onkeydown = states.previousWindowKeyDown;
380
- if (states.previousActiveElement && states.previousActiveElement.focus) {
381
- var x = window.scrollX;
382
- var y = window.scrollY;
383
- states.previousActiveElement.focus();
384
- if (x && y) {
385
- // IE has no scrollX/scrollY support
386
- window.scrollTo(x, y);
387
- }
388
- }
389
- };
390
-
391
- // Measure width of scrollbar
392
- // https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286
393
- var measureScrollbar = function measureScrollbar() {
394
- var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
395
- if (supportsTouch) {
396
- return 0;
397
- }
398
- var scrollDiv = document.createElement('div');
399
- scrollDiv.style.width = '50px';
400
- scrollDiv.style.height = '50px';
401
- scrollDiv.style.overflow = 'scroll';
402
- document.body.appendChild(scrollDiv);
403
- var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
404
- document.body.removeChild(scrollDiv);
405
- return scrollbarWidth;
406
- };
407
-
408
- // JavaScript Debounce Function
409
- // Simplivied version of https://davidwalsh.name/javascript-debounce-function
410
- var debounce = function debounce(func, wait) {
411
- var timeout = void 0;
412
- return function () {
413
- var later = function later() {
414
- timeout = null;
415
- func();
416
- };
417
- clearTimeout(timeout);
418
- timeout = setTimeout(later, wait);
419
- };
420
- };
421
-
422
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
423
- return typeof obj;
424
- } : function (obj) {
425
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
426
- };
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
- var _extends = Object.assign || function (target) {
449
- for (var i = 1; i < arguments.length; i++) {
450
- var source = arguments[i];
451
-
452
- for (var key in source) {
453
- if (Object.prototype.hasOwnProperty.call(source, key)) {
454
- target[key] = source[key];
455
- }
456
- }
457
- }
458
-
459
- return target;
460
- };
461
-
462
- var modalParams = _extends({}, defaultParams);
463
- var queue = [];
464
- var swal2Observer = void 0;
465
-
466
- /*
467
- * Set type, text and actions on modal
468
- */
469
- var setParameters = function setParameters(params) {
470
- var modal = getModal() || init(params);
471
-
472
- for (var param in params) {
473
- if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
474
- console.warn('SweetAlert2: Unknown parameter "' + param + '"');
475
- }
476
- }
477
-
478
- // Set modal width
479
- modal.style.width = typeof params.width === 'number' ? params.width + 'px' : params.width;
480
-
481
- modal.style.padding = params.padding + 'px';
482
- modal.style.background = params.background;
483
- var successIconParts = modal.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
484
- for (var i = 0; i < successIconParts.length; i++) {
485
- successIconParts[i].style.background = params.background;
486
- }
487
-
488
- var title = getTitle();
489
- var content = getContent();
490
- var buttonsWrapper = getButtonsWrapper();
491
- var confirmButton = getConfirmButton();
492
- var cancelButton = getCancelButton();
493
- var closeButton = getCloseButton();
494
-
495
- // Title
496
- if (params.titleText) {
497
- title.innerText = params.titleText;
498
- } else {
499
- title.innerHTML = params.title.split('\n').join('<br />');
500
- }
501
-
502
- // Content
503
- if (params.text || params.html) {
504
- if (_typeof(params.html) === 'object') {
505
- content.innerHTML = '';
506
- if (0 in params.html) {
507
- for (var _i = 0; _i in params.html; _i++) {
508
- content.appendChild(params.html[_i].cloneNode(true));
509
- }
510
- } else {
511
- content.appendChild(params.html.cloneNode(true));
512
- }
513
- } else if (params.html) {
514
- content.innerHTML = params.html;
515
- } else if (params.text) {
516
- content.textContent = params.text;
517
- }
518
- show(content);
519
- } else {
520
- hide(content);
521
- }
522
-
523
- // Close button
524
- if (params.showCloseButton) {
525
- show(closeButton);
526
- } else {
527
- hide(closeButton);
528
- }
529
-
530
- // Custom Class
531
- modal.className = swalClasses.modal;
532
- if (params.customClass) {
533
- addClass(modal, params.customClass);
534
- }
535
-
536
- // Progress steps
537
- var progressStepsContainer = getProgressSteps();
538
- var currentProgressStep = parseInt(params.currentProgressStep === null ? sweetAlert.getQueueStep() : params.currentProgressStep, 10);
539
- if (params.progressSteps.length) {
540
- show(progressStepsContainer);
541
- empty(progressStepsContainer);
542
- if (currentProgressStep >= params.progressSteps.length) {
543
- console.warn('SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
544
- }
545
- params.progressSteps.forEach(function (step, index) {
546
- var circle = document.createElement('li');
547
- addClass(circle, swalClasses.progresscircle);
548
- circle.innerHTML = step;
549
- if (index === currentProgressStep) {
550
- addClass(circle, swalClasses.activeprogressstep);
551
- }
552
- progressStepsContainer.appendChild(circle);
553
- if (index !== params.progressSteps.length - 1) {
554
- var line = document.createElement('li');
555
- addClass(line, swalClasses.progressline);
556
- line.style.width = params.progressStepsDistance;
557
- progressStepsContainer.appendChild(line);
558
- }
559
- });
560
- } else {
561
- hide(progressStepsContainer);
562
- }
563
-
564
- // Icon
565
- var icons = getIcons();
566
- for (var _i2 = 0; _i2 < icons.length; _i2++) {
567
- hide(icons[_i2]);
568
- }
569
- if (params.type) {
570
- var validType = false;
571
- for (var iconType in iconTypes) {
572
- if (params.type === iconType) {
573
- validType = true;
574
- break;
575
- }
576
- }
577
- if (!validType) {
578
- console.error('SweetAlert2: Unknown alert type: ' + params.type);
579
- return false;
580
- }
581
- var icon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type]);
582
- show(icon);
583
-
584
- // Animate icon
585
- if (params.animation) {
586
- switch (params.type) {
587
- case 'success':
588
- addClass(icon, 'swal2-animate-success-icon');
589
- addClass(icon.querySelector('.swal2-success-line-tip'), 'swal2-animate-success-line-tip');
590
- addClass(icon.querySelector('.swal2-success-line-long'), 'swal2-animate-success-line-long');
591
- break;
592
- case 'error':
593
- addClass(icon, 'swal2-animate-error-icon');
594
- addClass(icon.querySelector('.swal2-x-mark'), 'swal2-animate-x-mark');
595
- break;
596
- default:
597
- break;
598
- }
599
- }
600
- }
601
-
602
- // Custom image
603
- var image = getImage();
604
- if (params.imageUrl) {
605
- image.setAttribute('src', params.imageUrl);
606
- show(image);
607
-
608
- if (params.imageWidth) {
609
- image.setAttribute('width', params.imageWidth);
610
- } else {
611
- image.removeAttribute('width');
612
- }
613
-
614
- if (params.imageHeight) {
615
- image.setAttribute('height', params.imageHeight);
616
- } else {
617
- image.removeAttribute('height');
618
- }
619
-
620
- image.className = swalClasses.image;
621
- if (params.imageClass) {
622
- addClass(image, params.imageClass);
623
- }
624
- } else {
625
- hide(image);
626
- }
627
-
628
- // Cancel button
629
- if (params.showCancelButton) {
630
- cancelButton.style.display = 'inline-block';
631
- } else {
632
- hide(cancelButton);
633
- }
634
-
635
- // Confirm button
636
- if (params.showConfirmButton) {
637
- removeStyleProperty(confirmButton, 'display');
638
- } else {
639
- hide(confirmButton);
640
- }
641
-
642
- // Buttons wrapper
643
- if (!params.showConfirmButton && !params.showCancelButton) {
644
- hide(buttonsWrapper);
645
- } else {
646
- show(buttonsWrapper);
647
- }
648
-
649
- // Edit text on cancel and confirm buttons
650
- confirmButton.innerHTML = params.confirmButtonText;
651
- cancelButton.innerHTML = params.cancelButtonText;
652
-
653
- // Set buttons to selected background colors
654
- if (params.buttonsStyling) {
655
- confirmButton.style.backgroundColor = params.confirmButtonColor;
656
- cancelButton.style.backgroundColor = params.cancelButtonColor;
657
- }
658
-
659
- // Add buttons custom classes
660
- confirmButton.className = swalClasses.confirm;
661
- addClass(confirmButton, params.confirmButtonClass);
662
- cancelButton.className = swalClasses.cancel;
663
- addClass(cancelButton, params.cancelButtonClass);
664
-
665
- // Buttons styling
666
- if (params.buttonsStyling) {
667
- addClass(confirmButton, swalClasses.styled);
668
- addClass(cancelButton, swalClasses.styled);
669
- } else {
670
- removeClass(confirmButton, swalClasses.styled);
671
- removeClass(cancelButton, swalClasses.styled);
672
-
673
- confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = '';
674
- cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = '';
675
- }
676
-
677
- // CSS animation
678
- if (params.animation === true) {
679
- removeClass(modal, swalClasses.noanimation);
680
- } else {
681
- addClass(modal, swalClasses.noanimation);
682
- }
683
- };
684
-
685
- /*
686
- * Animations
687
- */
688
- var openModal = function openModal(animation, onComplete) {
689
- var container = getContainer();
690
- var modal = getModal();
691
-
692
- if (animation) {
693
- addClass(modal, swalClasses.show);
694
- addClass(container, swalClasses.fade);
695
- removeClass(modal, swalClasses.hide);
696
- } else {
697
- removeClass(modal, swalClasses.fade);
698
- }
699
- show(modal);
700
-
701
- // scrolling is 'hidden' until animation is done, after that 'auto'
702
- container.style.overflowY = 'hidden';
703
- if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
704
- modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
705
- modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
706
- container.style.overflowY = 'auto';
707
- });
708
- } else {
709
- container.style.overflowY = 'auto';
710
- }
711
-
712
- addClass(document.documentElement, swalClasses.shown);
713
- addClass(document.body, swalClasses.shown);
714
- addClass(container, swalClasses.shown);
715
- fixScrollbar();
716
- iOSfix();
717
- states.previousActiveElement = document.activeElement;
718
- if (onComplete !== null && typeof onComplete === 'function') {
719
- setTimeout(function () {
720
- onComplete(modal);
721
- });
722
- }
723
- };
724
-
725
- var fixScrollbar = function fixScrollbar() {
726
- // for queues, do not do this more than once
727
- if (states.previousBodyPadding !== null) {
728
- return;
729
- }
730
- // if the body has overflow
731
- if (document.body.scrollHeight > window.innerHeight) {
732
- // add padding so the content doesn't shift after removal of scrollbar
733
- states.previousBodyPadding = document.body.style.paddingRight;
734
- document.body.style.paddingRight = measureScrollbar() + 'px';
735
- }
736
- };
737
-
738
- var undoScrollbar = function undoScrollbar() {
739
- if (states.previousBodyPadding !== null) {
740
- document.body.style.paddingRight = states.previousBodyPadding;
741
- states.previousBodyPadding = null;
742
- }
743
- };
744
-
745
- // Fix iOS scrolling http://stackoverflow.com/q/39626302/1331425
746
- var iOSfix = function iOSfix() {
747
- var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
748
- if (iOS && !hasClass(document.body, swalClasses.iosfix)) {
749
- var offset = document.body.scrollTop;
750
- document.body.style.top = offset * -1 + 'px';
751
- addClass(document.body, swalClasses.iosfix);
752
- }
753
- };
754
-
755
- var undoIOSfix = function undoIOSfix() {
756
- if (hasClass(document.body, swalClasses.iosfix)) {
757
- var offset = parseInt(document.body.style.top, 10);
758
- removeClass(document.body, swalClasses.iosfix);
759
- document.body.style.top = '';
760
- document.body.scrollTop = offset * -1;
761
- }
762
- };
763
-
764
- // SweetAlert entry point
765
- var sweetAlert = function sweetAlert() {
766
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
767
- args[_key] = arguments[_key];
768
- }
769
-
770
- if (args[0] === undefined) {
771
- console.error('SweetAlert2 expects at least 1 attribute!');
772
- return false;
773
- }
774
-
775
- var params = _extends({}, modalParams);
776
-
777
- switch (_typeof(args[0])) {
778
- case 'string':
779
- params.title = args[0];
780
- params.html = args[1];
781
- params.type = args[2];
782
-
783
- break;
784
-
785
- case 'object':
786
- _extends(params, args[0]);
787
- params.extraParams = args[0].extraParams;
788
-
789
- if (params.input === 'email' && params.inputValidator === null) {
790
- params.inputValidator = function (email) {
791
- return new Promise(function (resolve, reject) {
792
- var emailRegex = /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
793
- if (emailRegex.test(email)) {
794
- resolve();
795
- } else {
796
- reject('Invalid email address');
797
- }
798
- });
799
- };
800
- }
801
-
802
- if (params.input === 'url' && params.inputValidator === null) {
803
- params.inputValidator = function (url) {
804
- return new Promise(function (resolve, reject) {
805
- // taken from https://stackoverflow.com/a/3809435/1331425
806
- var urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/;
807
- if (urlRegex.test(url)) {
808
- resolve();
809
- } else {
810
- reject('Invalid URL');
811
- }
812
- });
813
- };
814
- }
815
- break;
816
-
817
- default:
818
- console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got ' + _typeof(args[0]));
819
- return false;
820
- }
821
-
822
- setParameters(params);
823
-
824
- var container = getContainer();
825
- var modal = getModal();
826
-
827
- return new Promise(function (resolve, reject) {
828
- // Close on timer
829
- if (params.timer) {
830
- modal.timeout = setTimeout(function () {
831
- sweetAlert.closeModal(params.onClose);
832
- if (params.useRejections) {
833
- reject('timer');
834
- } else {
835
- resolve({ dismiss: 'timer' });
836
- }
837
- }, params.timer);
838
- }
839
-
840
- // Get input element by specified type or, if type isn't specified, by params.input
841
- var getInput = function getInput(inputType) {
842
- inputType = inputType || params.input;
843
- if (!inputType) {
844
- return null;
845
- }
846
- switch (inputType) {
847
- case 'select':
848
- case 'textarea':
849
- case 'file':
850
- return getChildByClass(modal, swalClasses[inputType]);
851
- case 'checkbox':
852
- return modal.querySelector('.' + swalClasses.checkbox + ' input');
853
- case 'radio':
854
- return modal.querySelector('.' + swalClasses.radio + ' input:checked') || modal.querySelector('.' + swalClasses.radio + ' input:first-child');
855
- case 'range':
856
- return modal.querySelector('.' + swalClasses.range + ' input');
857
- default:
858
- return getChildByClass(modal, swalClasses.input);
859
- }
860
- };
861
-
862
- // Get the value of the modal input
863
- var getInputValue = function getInputValue() {
864
- var input = getInput();
865
- if (!input) {
866
- return null;
867
- }
868
- switch (params.input) {
869
- case 'checkbox':
870
- return input.checked ? 1 : 0;
871
- case 'radio':
872
- return input.checked ? input.value : null;
873
- case 'file':
874
- return input.files.length ? input.files[0] : null;
875
- default:
876
- return params.inputAutoTrim ? input.value.trim() : input.value;
877
- }
878
- };
879
-
880
- // input autofocus
881
- if (params.input) {
882
- setTimeout(function () {
883
- var input = getInput();
884
- if (input) {
885
- focusInput(input);
886
- }
887
- }, 0);
888
- }
889
-
890
- var confirm = function confirm(value) {
891
- if (params.showLoaderOnConfirm) {
892
- sweetAlert.showLoading();
893
- }
894
-
895
- if (params.preConfirm) {
896
- params.preConfirm(value, params.extraParams).then(function (preConfirmValue) {
897
- sweetAlert.closeModal(params.onClose);
898
- resolve(preConfirmValue || value);
899
- }, function (error) {
900
- sweetAlert.hideLoading();
901
- if (error) {
902
- sweetAlert.showValidationError(error);
903
- }
904
- });
905
- } else {
906
- sweetAlert.closeModal(params.onClose);
907
- if (params.useRejections) {
908
- resolve(value);
909
- } else {
910
- resolve({ value: value });
911
- }
912
- }
913
- };
914
-
915
- // Mouse interactions
916
- var onButtonEvent = function onButtonEvent(event) {
917
- var e = event || window.event;
918
- var target = e.target || e.srcElement;
919
- var confirmButton = getConfirmButton();
920
- var cancelButton = getCancelButton();
921
- var targetedConfirm = confirmButton && (confirmButton === target || confirmButton.contains(target));
922
- var targetedCancel = cancelButton && (cancelButton === target || cancelButton.contains(target));
923
-
924
- switch (e.type) {
925
- case 'mouseover':
926
- case 'mouseup':
927
- if (params.buttonsStyling) {
928
- if (targetedConfirm) {
929
- confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1);
930
- } else if (targetedCancel) {
931
- cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1);
932
- }
933
- }
934
- break;
935
- case 'mouseout':
936
- if (params.buttonsStyling) {
937
- if (targetedConfirm) {
938
- confirmButton.style.backgroundColor = params.confirmButtonColor;
939
- } else if (targetedCancel) {
940
- cancelButton.style.backgroundColor = params.cancelButtonColor;
941
- }
942
- }
943
- break;
944
- case 'mousedown':
945
- if (params.buttonsStyling) {
946
- if (targetedConfirm) {
947
- confirmButton.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2);
948
- } else if (targetedCancel) {
949
- cancelButton.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2);
950
- }
951
- }
952
- break;
953
- case 'click':
954
- // Clicked 'confirm'
955
- if (targetedConfirm && sweetAlert.isVisible()) {
956
- sweetAlert.disableButtons();
957
- if (params.input) {
958
- var inputValue = getInputValue();
959
-
960
- if (params.inputValidator) {
961
- sweetAlert.disableInput();
962
- params.inputValidator(inputValue, params.extraParams).then(function () {
963
- sweetAlert.enableButtons();
964
- sweetAlert.enableInput();
965
- confirm(inputValue);
966
- }, function (error) {
967
- sweetAlert.enableButtons();
968
- sweetAlert.enableInput();
969
- if (error) {
970
- sweetAlert.showValidationError(error);
971
- }
972
- });
973
- } else {
974
- confirm(inputValue);
975
- }
976
- } else {
977
- confirm(true);
978
- }
979
-
980
- // Clicked 'cancel'
981
- } else if (targetedCancel && sweetAlert.isVisible()) {
982
- sweetAlert.disableButtons();
983
- sweetAlert.closeModal(params.onClose);
984
- if (params.useRejections) {
985
- reject('cancel');
986
- } else {
987
- resolve({ dismiss: 'cancel' });
988
- }
989
- }
990
- break;
991
- default:
992
- }
993
- };
994
-
995
- var buttons = modal.querySelectorAll('button');
996
- for (var i = 0; i < buttons.length; i++) {
997
- buttons[i].onclick = onButtonEvent;
998
- buttons[i].onmouseover = onButtonEvent;
999
- buttons[i].onmouseout = onButtonEvent;
1000
- buttons[i].onmousedown = onButtonEvent;
1001
- }
1002
-
1003
- // Closing modal by close button
1004
- getCloseButton().onclick = function () {
1005
- sweetAlert.closeModal(params.onClose);
1006
- if (params.useRejections) {
1007
- reject('close');
1008
- } else {
1009
- resolve({ dismiss: 'close' });
1010
- }
1011
- };
1012
-
1013
- // Closing modal by overlay click
1014
- container.onclick = function (e) {
1015
- if (e.target !== container) {
1016
- return;
1017
- }
1018
- if (params.allowOutsideClick) {
1019
- sweetAlert.closeModal(params.onClose);
1020
- if (params.useRejections) {
1021
- reject('overlay');
1022
- } else {
1023
- resolve({ dismiss: 'overlay' });
1024
- }
1025
- }
1026
- };
1027
-
1028
- var buttonsWrapper = getButtonsWrapper();
1029
- var confirmButton = getConfirmButton();
1030
- var cancelButton = getCancelButton();
1031
-
1032
- // Reverse buttons (Confirm on the right side)
1033
- if (params.reverseButtons) {
1034
- confirmButton.parentNode.insertBefore(cancelButton, confirmButton);
1035
- } else {
1036
- confirmButton.parentNode.insertBefore(confirmButton, cancelButton);
1037
- }
1038
-
1039
- // Focus handling
1040
- var setFocus = function setFocus(index, increment) {
1041
- var focusableElements = getFocusableElements(params.focusCancel);
1042
- // search for visible elements and select the next possible match
1043
- for (var _i3 = 0; _i3 < focusableElements.length; _i3++) {
1044
- index = index + increment;
1045
-
1046
- // rollover to first item
1047
- if (index === focusableElements.length) {
1048
- index = 0;
1049
-
1050
- // go to last item
1051
- } else if (index === -1) {
1052
- index = focusableElements.length - 1;
1053
- }
1054
-
1055
- // determine if element is visible
1056
- var el = focusableElements[index];
1057
- if (isVisible(el)) {
1058
- return el.focus();
1059
- }
1060
- }
1061
- };
1062
-
1063
- var handleKeyDown = function handleKeyDown(event) {
1064
- var e = event || window.event;
1065
- var keyCode = e.keyCode || e.which;
1066
-
1067
- if ([9, 13, 32, 27, 37, 38, 39, 40].indexOf(keyCode) === -1) {
1068
- // Don't do work on keys we don't care about.
1069
- return;
1070
- }
1071
-
1072
- var targetElement = e.target || e.srcElement;
1073
-
1074
- var focusableElements = getFocusableElements(params.focusCancel);
1075
- var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
1076
- for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
1077
- if (targetElement === focusableElements[_i4]) {
1078
- btnIndex = _i4;
1079
- break;
1080
- }
1081
- }
1082
-
1083
- // TAB
1084
- if (keyCode === 9) {
1085
- if (!e.shiftKey) {
1086
- // Cycle to the next button
1087
- setFocus(btnIndex, 1);
1088
- } else {
1089
- // Cycle to the prev button
1090
- setFocus(btnIndex, -1);
1091
- }
1092
- e.stopPropagation();
1093
- e.preventDefault();
1094
-
1095
- // ARROWS - switch focus between buttons
1096
- } else if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
1097
- // focus Cancel button if Confirm button is currently focused
1098
- if (document.activeElement === confirmButton && isVisible(cancelButton)) {
1099
- cancelButton.focus();
1100
- // and vice versa
1101
- } else if (document.activeElement === cancelButton && isVisible(confirmButton)) {
1102
- confirmButton.focus();
1103
- }
1104
-
1105
- // ENTER/SPACE
1106
- } else if (keyCode === 13 || keyCode === 32) {
1107
- if (btnIndex === -1 && params.allowEnterKey) {
1108
- // ENTER/SPACE clicked outside of a button.
1109
- if (params.focusCancel) {
1110
- fireClick(cancelButton, e);
1111
- } else {
1112
- fireClick(confirmButton, e);
1113
- }
1114
- e.stopPropagation();
1115
- e.preventDefault();
1116
- }
1117
-
1118
- // ESC
1119
- } else if (keyCode === 27 && params.allowEscapeKey === true) {
1120
- sweetAlert.closeModal(params.onClose);
1121
- if (params.useRejections) {
1122
- reject('esc');
1123
- } else {
1124
- resolve({ dismiss: 'esc' });
1125
- }
1126
- }
1127
- };
1128
-
1129
- if (!window.onkeydown || window.onkeydown.toString() !== handleKeyDown.toString()) {
1130
- states.previousWindowKeyDown = window.onkeydown;
1131
- window.onkeydown = handleKeyDown;
1132
- }
1133
-
1134
- // Loading state
1135
- if (params.buttonsStyling) {
1136
- confirmButton.style.borderLeftColor = params.confirmButtonColor;
1137
- confirmButton.style.borderRightColor = params.confirmButtonColor;
1138
- }
1139
-
1140
- /**
1141
- * Show spinner instead of Confirm button and disable Cancel button
1142
- */
1143
- sweetAlert.hideLoading = sweetAlert.disableLoading = function () {
1144
- if (!params.showConfirmButton) {
1145
- hide(confirmButton);
1146
- if (!params.showCancelButton) {
1147
- hide(getButtonsWrapper());
1148
- }
1149
- }
1150
- removeClass(buttonsWrapper, swalClasses.loading);
1151
- removeClass(modal, swalClasses.loading);
1152
- confirmButton.disabled = false;
1153
- cancelButton.disabled = false;
1154
- };
1155
-
1156
- sweetAlert.getTitle = function () {
1157
- return getTitle();
1158
- };
1159
- sweetAlert.getContent = function () {
1160
- return getContent();
1161
- };
1162
- sweetAlert.getInput = function () {
1163
- return getInput();
1164
- };
1165
- sweetAlert.getImage = function () {
1166
- return getImage();
1167
- };
1168
- sweetAlert.getButtonsWrapper = function () {
1169
- return getButtonsWrapper();
1170
- };
1171
- sweetAlert.getConfirmButton = function () {
1172
- return getConfirmButton();
1173
- };
1174
- sweetAlert.getCancelButton = function () {
1175
- return getCancelButton();
1176
- };
1177
-
1178
- sweetAlert.enableButtons = function () {
1179
- confirmButton.disabled = false;
1180
- cancelButton.disabled = false;
1181
- };
1182
-
1183
- sweetAlert.disableButtons = function () {
1184
- confirmButton.disabled = true;
1185
- cancelButton.disabled = true;
1186
- };
1187
-
1188
- sweetAlert.enableConfirmButton = function () {
1189
- confirmButton.disabled = false;
1190
- };
1191
-
1192
- sweetAlert.disableConfirmButton = function () {
1193
- confirmButton.disabled = true;
1194
- };
1195
-
1196
- sweetAlert.enableInput = function () {
1197
- var input = getInput();
1198
- if (!input) {
1199
- return false;
1200
- }
1201
- if (input.type === 'radio') {
1202
- var radiosContainer = input.parentNode.parentNode;
1203
- var radios = radiosContainer.querySelectorAll('input');
1204
- for (var _i5 = 0; _i5 < radios.length; _i5++) {
1205
- radios[_i5].disabled = false;
1206
- }
1207
- } else {
1208
- input.disabled = false;
1209
- }
1210
- };
1211
-
1212
- sweetAlert.disableInput = function () {
1213
- var input = getInput();
1214
- if (!input) {
1215
- return false;
1216
- }
1217
- if (input && input.type === 'radio') {
1218
- var radiosContainer = input.parentNode.parentNode;
1219
- var radios = radiosContainer.querySelectorAll('input');
1220
- for (var _i6 = 0; _i6 < radios.length; _i6++) {
1221
- radios[_i6].disabled = true;
1222
- }
1223
- } else {
1224
- input.disabled = true;
1225
- }
1226
- };
1227
-
1228
- // Set modal min-height to disable scrolling inside the modal
1229
- sweetAlert.recalculateHeight = debounce(function () {
1230
- var modal = getModal();
1231
- if (!modal) {
1232
- return;
1233
- }
1234
- var prevState = modal.style.display;
1235
- modal.style.minHeight = '';
1236
- show(modal);
1237
- modal.style.minHeight = modal.scrollHeight + 1 + 'px';
1238
- modal.style.display = prevState;
1239
- }, 50);
1240
-
1241
- // Show block with validation error
1242
- sweetAlert.showValidationError = function (error) {
1243
- var validationError = getValidationError();
1244
- validationError.innerHTML = error;
1245
- show(validationError);
1246
-
1247
- var input = getInput();
1248
- if (input) {
1249
- focusInput(input);
1250
- addClass(input, swalClasses.inputerror);
1251
- }
1252
- };
1253
-
1254
- // Hide block with validation error
1255
- sweetAlert.resetValidationError = function () {
1256
- var validationError = getValidationError();
1257
- hide(validationError);
1258
- sweetAlert.recalculateHeight();
1259
-
1260
- var input = getInput();
1261
- if (input) {
1262
- removeClass(input, swalClasses.inputerror);
1263
- }
1264
- };
1265
-
1266
- sweetAlert.getProgressSteps = function () {
1267
- return params.progressSteps;
1268
- };
1269
-
1270
- sweetAlert.setProgressSteps = function (progressSteps) {
1271
- params.progressSteps = progressSteps;
1272
- setParameters(params);
1273
- };
1274
-
1275
- sweetAlert.showProgressSteps = function () {
1276
- show(getProgressSteps());
1277
- };
1278
-
1279
- sweetAlert.hideProgressSteps = function () {
1280
- hide(getProgressSteps());
1281
- };
1282
-
1283
- sweetAlert.enableButtons();
1284
- sweetAlert.hideLoading();
1285
- sweetAlert.resetValidationError();
1286
-
1287
- // inputs
1288
- var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
1289
- var input = void 0;
1290
- for (var _i7 = 0; _i7 < inputTypes.length; _i7++) {
1291
- var inputClass = swalClasses[inputTypes[_i7]];
1292
- var inputContainer = getChildByClass(modal, inputClass);
1293
- input = getInput(inputTypes[_i7]);
1294
-
1295
- // set attributes
1296
- if (input) {
1297
- for (var j in input.attributes) {
1298
- if (input.attributes.hasOwnProperty(j)) {
1299
- var attrName = input.attributes[j].name;
1300
- if (attrName !== 'type' && attrName !== 'value') {
1301
- input.removeAttribute(attrName);
1302
- }
1303
- }
1304
- }
1305
- for (var attr in params.inputAttributes) {
1306
- input.setAttribute(attr, params.inputAttributes[attr]);
1307
- }
1308
- }
1309
-
1310
- // set class
1311
- inputContainer.className = inputClass;
1312
- if (params.inputClass) {
1313
- addClass(inputContainer, params.inputClass);
1314
- }
1315
-
1316
- hide(inputContainer);
1317
- }
1318
-
1319
- var populateInputOptions = void 0;
1320
- switch (params.input) {
1321
- case 'text':
1322
- case 'email':
1323
- case 'password':
1324
- case 'number':
1325
- case 'tel':
1326
- case 'url':
1327
- input = getChildByClass(modal, swalClasses.input);
1328
- input.value = params.inputValue;
1329
- input.placeholder = params.inputPlaceholder;
1330
- input.type = params.input;
1331
- show(input);
1332
- break;
1333
- case 'file':
1334
- input = getChildByClass(modal, swalClasses.file);
1335
- input.placeholder = params.inputPlaceholder;
1336
- input.type = params.input;
1337
- show(input);
1338
- break;
1339
- case 'range':
1340
- var range = getChildByClass(modal, swalClasses.range);
1341
- var rangeInput = range.querySelector('input');
1342
- var rangeOutput = range.querySelector('output');
1343
- rangeInput.value = params.inputValue;
1344
- rangeInput.type = params.input;
1345
- rangeOutput.value = params.inputValue;
1346
- show(range);
1347
- break;
1348
- case 'select':
1349
- var select = getChildByClass(modal, swalClasses.select);
1350
- select.innerHTML = '';
1351
- if (params.inputPlaceholder) {
1352
- var placeholder = document.createElement('option');
1353
- placeholder.innerHTML = params.inputPlaceholder;
1354
- placeholder.value = '';
1355
- placeholder.disabled = true;
1356
- placeholder.selected = true;
1357
- select.appendChild(placeholder);
1358
- }
1359
- populateInputOptions = function populateInputOptions(inputOptions) {
1360
- for (var optionValue in inputOptions) {
1361
- var option = document.createElement('option');
1362
- option.value = optionValue;
1363
- option.innerHTML = inputOptions[optionValue];
1364
- if (params.inputValue === optionValue) {
1365
- option.selected = true;
1366
- }
1367
- select.appendChild(option);
1368
- }
1369
- show(select);
1370
- select.focus();
1371
- };
1372
- break;
1373
- case 'radio':
1374
- var radio = getChildByClass(modal, swalClasses.radio);
1375
- radio.innerHTML = '';
1376
- populateInputOptions = function populateInputOptions(inputOptions) {
1377
- for (var radioValue in inputOptions) {
1378
- var radioInput = document.createElement('input');
1379
- var radioLabel = document.createElement('label');
1380
- var radioLabelSpan = document.createElement('span');
1381
- radioInput.type = 'radio';
1382
- radioInput.name = swalClasses.radio;
1383
- radioInput.value = radioValue;
1384
- if (params.inputValue === radioValue) {
1385
- radioInput.checked = true;
1386
- }
1387
- radioLabelSpan.innerHTML = inputOptions[radioValue];
1388
- radioLabel.appendChild(radioInput);
1389
- radioLabel.appendChild(radioLabelSpan);
1390
- radioLabel.for = radioInput.id;
1391
- radio.appendChild(radioLabel);
1392
- }
1393
- show(radio);
1394
- var radios = radio.querySelectorAll('input');
1395
- if (radios.length) {
1396
- radios[0].focus();
1397
- }
1398
- };
1399
- break;
1400
- case 'checkbox':
1401
- var checkbox = getChildByClass(modal, swalClasses.checkbox);
1402
- var checkboxInput = getInput('checkbox');
1403
- checkboxInput.type = 'checkbox';
1404
- checkboxInput.value = 1;
1405
- checkboxInput.id = swalClasses.checkbox;
1406
- checkboxInput.checked = Boolean(params.inputValue);
1407
- var label = checkbox.getElementsByTagName('span');
1408
- if (label.length) {
1409
- checkbox.removeChild(label[0]);
1410
- }
1411
- label = document.createElement('span');
1412
- label.innerHTML = params.inputPlaceholder;
1413
- checkbox.appendChild(label);
1414
- show(checkbox);
1415
- break;
1416
- case 'textarea':
1417
- var textarea = getChildByClass(modal, swalClasses.textarea);
1418
- textarea.value = params.inputValue;
1419
- textarea.placeholder = params.inputPlaceholder;
1420
- show(textarea);
1421
- break;
1422
- case null:
1423
- break;
1424
- default:
1425
- console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "' + params.input + '"');
1426
- break;
1427
- }
1428
-
1429
- if (params.input === 'select' || params.input === 'radio') {
1430
- if (params.inputOptions instanceof Promise) {
1431
- sweetAlert.showLoading();
1432
- params.inputOptions.then(function (inputOptions) {
1433
- sweetAlert.hideLoading();
1434
- populateInputOptions(inputOptions);
1435
- });
1436
- } else if (_typeof(params.inputOptions) === 'object') {
1437
- populateInputOptions(params.inputOptions);
1438
- } else {
1439
- console.error('SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got ' + _typeof(params.inputOptions));
1440
- }
1441
- }
1442
-
1443
- openModal(params.animation, params.onOpen);
1444
-
1445
- // Focus the first element (input or button)
1446
- if (params.allowEnterKey) {
1447
- setFocus(-1, 1);
1448
- } else {
1449
- if (document.activeElement) {
1450
- document.activeElement.blur();
1451
- }
1452
- }
1453
-
1454
- // fix scroll
1455
- getContainer().scrollTop = 0;
1456
-
1457
- // Observe changes inside the modal and adjust height
1458
- if (typeof MutationObserver !== 'undefined' && !swal2Observer) {
1459
- swal2Observer = new MutationObserver(sweetAlert.recalculateHeight);
1460
- swal2Observer.observe(modal, { childList: true, characterData: true, subtree: true });
1461
- }
1462
- });
1463
- };
1464
-
1465
- /*
1466
- * Global function to determine if swal2 modal is shown
1467
- */
1468
- sweetAlert.isVisible = function () {
1469
- return !!getModal();
1470
- };
1471
-
1472
- /*
1473
- * Global function for chaining sweetAlert modals
1474
- */
1475
- sweetAlert.queue = function (steps) {
1476
- queue = steps;
1477
- var resetQueue = function resetQueue() {
1478
- queue = [];
1479
- document.body.removeAttribute('data-swal2-queue-step');
1480
- };
1481
- var queueResult = [];
1482
- return new Promise(function (resolve, reject) {
1483
- (function step(i, callback) {
1484
- if (i < queue.length) {
1485
- document.body.setAttribute('data-swal2-queue-step', i);
1486
-
1487
- sweetAlert(queue[i]).then(function (result) {
1488
- queueResult.push(result);
1489
- step(i + 1, callback);
1490
- }, function (dismiss) {
1491
- resetQueue();
1492
- reject(dismiss);
1493
- });
1494
- } else {
1495
- resetQueue();
1496
- resolve(queueResult);
1497
- }
1498
- })(0);
1499
- });
1500
- };
1501
-
1502
- /*
1503
- * Global function for getting the index of current modal in queue
1504
- */
1505
- sweetAlert.getQueueStep = function () {
1506
- return document.body.getAttribute('data-swal2-queue-step');
1507
- };
1508
-
1509
- /*
1510
- * Global function for inserting a modal to the queue
1511
- */
1512
- sweetAlert.insertQueueStep = function (step, index) {
1513
- if (index && index < queue.length) {
1514
- return queue.splice(index, 0, step);
1515
- }
1516
- return queue.push(step);
1517
- };
1518
-
1519
- /*
1520
- * Global function for deleting a modal from the queue
1521
- */
1522
- sweetAlert.deleteQueueStep = function (index) {
1523
- if (typeof queue[index] !== 'undefined') {
1524
- queue.splice(index, 1);
1525
- }
1526
- };
1527
-
1528
- /*
1529
- * Global function to close sweetAlert
1530
- */
1531
- sweetAlert.close = sweetAlert.closeModal = function (onComplete) {
1532
- var container = getContainer();
1533
- var modal = getModal();
1534
- if (!modal) {
1535
- return;
1536
- }
1537
- removeClass(modal, swalClasses.show);
1538
- addClass(modal, swalClasses.hide);
1539
- clearTimeout(modal.timeout);
1540
-
1541
- resetPrevState();
1542
-
1543
- var removeModalAndResetState = function removeModalAndResetState() {
1544
- if (container.parentNode) {
1545
- container.parentNode.removeChild(container);
1546
- }
1547
- removeClass(document.documentElement, swalClasses.shown);
1548
- removeClass(document.body, swalClasses.shown);
1549
- undoScrollbar();
1550
- undoIOSfix();
1551
- };
1552
-
1553
- // If animation is supported, animate
1554
- if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
1555
- modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
1556
- modal.removeEventListener(animationEndEvent, swalCloseEventFinished);
1557
- if (hasClass(modal, swalClasses.hide)) {
1558
- removeModalAndResetState();
1559
- }
1560
- });
1561
- } else {
1562
- // Otherwise, remove immediately
1563
- removeModalAndResetState();
1564
- }
1565
- if (onComplete !== null && typeof onComplete === 'function') {
1566
- setTimeout(function () {
1567
- onComplete(modal);
1568
- });
1569
- }
1570
- };
1571
-
1572
- /*
1573
- * Global function to click 'Confirm' button
1574
- */
1575
- sweetAlert.clickConfirm = function () {
1576
- return getConfirmButton().click();
1577
- };
1578
-
1579
- /*
1580
- * Global function to click 'Cancel' button
1581
- */
1582
- sweetAlert.clickCancel = function () {
1583
- return getCancelButton().click();
1584
- };
1585
-
1586
- /**
1587
- * Show spinner instead of Confirm button and disable Cancel button
1588
- */
1589
- sweetAlert.showLoading = sweetAlert.enableLoading = function () {
1590
- var modal = getModal();
1591
- if (!modal) {
1592
- sweetAlert('');
1593
- }
1594
- var buttonsWrapper = getButtonsWrapper();
1595
- var confirmButton = getConfirmButton();
1596
- var cancelButton = getCancelButton();
1597
-
1598
- show(buttonsWrapper);
1599
- show(confirmButton, 'inline-block');
1600
- addClass(buttonsWrapper, swalClasses.loading);
1601
- addClass(modal, swalClasses.loading);
1602
- confirmButton.disabled = true;
1603
- cancelButton.disabled = true;
1604
- };
1605
-
1606
- /**
1607
- * Set default params for each popup
1608
- * @param {Object} userParams
1609
- */
1610
- sweetAlert.setDefaults = function (userParams) {
1611
- if (!userParams || (typeof userParams === 'undefined' ? 'undefined' : _typeof(userParams)) !== 'object') {
1612
- return console.error('SweetAlert2: the argument for setDefaults() is required and has to be a object');
1613
- }
1614
-
1615
- for (var param in userParams) {
1616
- if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
1617
- console.warn('SweetAlert2: Unknown parameter "' + param + '"');
1618
- delete userParams[param];
1619
- }
1620
- }
1621
-
1622
- _extends(modalParams, userParams);
1623
- };
1624
-
1625
- /**
1626
- * Reset default params for each popup
1627
- */
1628
- sweetAlert.resetDefaults = function () {
1629
- modalParams = _extends({}, defaultParams);
1630
- };
1631
-
1632
- sweetAlert.noop = function () {};
1633
-
1634
- sweetAlert.version = '6.6.6';
1635
-
1636
- sweetAlert.default = sweetAlert;
1637
-
1638
- return sweetAlert;
1639
-
1640
- })));
1641
- if (window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
license.txt CHANGED
File without changes
main.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Easy Updates Manager
4
  Plugin URI: https://easyupdatesmanager.com
5
  Description: Manage and disable WordPress updates, including core, plugin, theme, and automatic updates - Works with Multisite and has built-in logging features.
6
  Author: Easy Updates Manager Team
7
- Version: 6.4.4
8
  Requires at least: 4.4
9
  Author URI: https://easyupdatesmanager.com
10
  Contributors: kidsguide, ronalfy
@@ -12,7 +12,7 @@ Text Domain: stops-core-theme-and-plugin-updates
12
  Domain Path: /languages
13
  Updates: true
14
  Network: true
15
- */
16
 
17
  /**
18
  * Main plugin class
@@ -24,7 +24,7 @@ Network: true
24
  * @package WordPress
25
  */
26
  class MPSUM_Updates_Manager {
27
-
28
  /**
29
  * Holds the class instance.
30
  *
@@ -33,7 +33,7 @@ class MPSUM_Updates_Manager {
33
  * @var MPSUM_Updates_Manager $instance
34
  */
35
  private static $instance = null;
36
-
37
  /**
38
  * Stores the plugin's options
39
  *
@@ -42,13 +42,13 @@ class MPSUM_Updates_Manager {
42
  * @var array $options
43
  */
44
  private static $options = false;
45
-
46
  /**
47
  * Retrieve a class instance.
48
  *
49
  * Retrieve a class instance.
50
  *
51
- * @since 5.0.0
52
  * @access static
53
  *
54
  * @return MPSUM_Updates_Manager Instance of the class.
@@ -59,21 +59,21 @@ class MPSUM_Updates_Manager {
59
  }
60
  return self::$instance;
61
  } //end get_instance
62
-
63
  /**
64
  * Retrieve the plugin basename.
65
  *
66
  * Retrieve the plugin basename.
67
  *
68
- * @since 5.0.0
69
  * @access static
70
  *
71
  * @return string plugin basename
72
  */
73
  public static function get_plugin_basename() {
74
- return plugin_basename( __FILE__ );
75
  }
76
-
77
  /**
78
  * Class constructor.
79
  *
@@ -89,9 +89,9 @@ class MPSUM_Updates_Manager {
89
 
90
  add_action( 'init', array( $this, 'init' ) );
91
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
92
-
93
  add_filter( 'cron_schedules', array( $this, 'set_monthly_cron_schedule' ) );
94
-
95
  add_action( 'eum-monthly', array( 'MPSUM_Tracking', 'send' ) );
96
  } //end constructor
97
 
@@ -100,14 +100,14 @@ class MPSUM_Updates_Manager {
100
  *
101
  * Run code during the init action.
102
  *
103
- * @since 6.2.5
104
  * @access public
105
  *
106
  */
107
  public function init() {
108
  /* Localization Code */
109
  load_plugin_textdomain( 'stops-core-theme-and-plugin-updates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
110
-
111
  // Logging
112
  $options = MPSUM_Updates_Manager::get_options( 'core' );
113
  if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
@@ -120,7 +120,7 @@ class MPSUM_Updates_Manager {
120
  *
121
  * Return the absolute path to an asset based on a relative argument.
122
  *
123
- * @since 5.0.0
124
  * @access static
125
  *
126
  * @param string $path Relative path to the asset.
@@ -130,15 +130,15 @@ class MPSUM_Updates_Manager {
130
  $dir = rtrim( plugin_dir_path(__FILE__), '/' );
131
  if ( !empty( $path ) && is_string( $path) )
132
  $dir .= '/' . ltrim( $path, '/' );
133
- return $dir;
134
  }
135
-
136
  /**
137
  * Return the web path to an asset.
138
  *
139
  * Return the web path to an asset based on a relative argument.
140
  *
141
- * @since 5.0.0
142
  * @access static
143
  *
144
  * @param string $path Relative path to the asset.
@@ -148,15 +148,15 @@ class MPSUM_Updates_Manager {
148
  $dir = rtrim( plugin_dir_url(__FILE__), '/' );
149
  if ( !empty( $path ) && is_string( $path) )
150
  $dir .= '/' . ltrim( $path, '/' );
151
- return $dir;
152
  }
153
-
154
  /**
155
  * Retrieve the plugin's options
156
  *
157
  * Retrieve the plugin's options based on context
158
  *
159
- * @since 5.0.0
160
  * @access static
161
  *
162
  * @param string $context Context to retrieve options for. This is used as an array key.
@@ -169,35 +169,35 @@ class MPSUM_Updates_Manager {
169
  if ( false === $options || true === $force_reload ) {
170
  $options = get_site_option( 'MPSUM', false, false );
171
  }
172
-
173
  if ( false === $options ) {
174
- $options = self::maybe_migrate_options();
175
  }
176
-
177
  //Store options
178
  if ( !is_array( $options ) ) {
179
- $options = array();
180
  }
181
  self::$options = $options;
182
-
183
  //Attempt to get context
184
  if ( !empty( $context ) && is_string( $context ) ) {
185
  if ( array_key_exists( $context, $options ) ) {
186
- return (array)$options[ $context ];
187
  } else {
188
- return array();
189
  }
190
  }
191
-
192
  return $options;
193
  } //get_options
194
-
195
  /**
196
  * Auto-loads classes.
197
  *
198
  * Auto-load classes that belong to this plugin.
199
  *
200
- * @since 5.0.0
201
  * @access private
202
  *
203
  * @param string $class_name The name of the class.
@@ -209,15 +209,15 @@ class MPSUM_Updates_Manager {
209
  $file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
210
  if ( file_exists( $file ) ) {
211
  include_once( $file );
212
- }
213
  }
214
-
215
  /**
216
  * Determine whether to migrate options from an older version of the plugin.
217
  *
218
  * Migrate old options to new plugin format.
219
  *
220
- * @since 5.0.0
221
  * @access private
222
  *
223
  * @return bool|array false if no migration, associative array of options if migration successful
@@ -225,7 +225,7 @@ class MPSUM_Updates_Manager {
225
  public static function maybe_migrate_options() {
226
  $options = false;
227
  $original_options = get_option( '_disable_updates', false );
228
-
229
  if ( false !== $original_options && is_array( $original_options ) ) {
230
  $options = array(
231
  'core' => array(),
@@ -283,28 +283,28 @@ class MPSUM_Updates_Manager {
283
  $options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
284
  $options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
285
  }
286
-
287
  delete_option( '_disable_updates' );
288
  delete_site_option( '_disable_updates' );
289
  update_site_option( 'MPSUM', $options );
290
-
291
  }
292
- return $options;
293
  }
294
-
295
  /**
296
  * Initialize the plugin and its dependencies.
297
  *
298
  * Initialize the plugin and its dependencies.
299
  *
300
- * @since 5.0.0
301
  * @access public
302
  * @see __construct
303
  * @internal Uses plugins_loaded action
304
  *
305
  */
306
  public function plugins_loaded() {
307
-
308
  //Skip disable updates if a user is excluded
309
  $disable_updates_skip = false;
310
  if ( current_user_can( 'install_plugins' ) ) {
@@ -318,7 +318,7 @@ class MPSUM_Updates_Manager {
318
  if ( false === $disable_updates_skip ) {
319
  MPSUM_Disable_Updates::run();
320
  }
321
-
322
  add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
323
  add_action( 'wp_ajax_mpsum_ajax_get_json', array( $this, 'ajax_get_json' ) );
324
  add_action( 'wp_ajax_mpsum_ajax_remove_ratings_nag', array( $this, 'ajax_remove_ratings_nag' ) );
@@ -327,20 +327,20 @@ class MPSUM_Updates_Manager {
327
  add_action( 'wp_ajax_mpsum_ajax_disable_updates', array( $this, 'ajax_disable_updates' ) );
328
  add_action( 'wp_ajax_mpsum_ajax_remove_wizard', array( $this, 'ajax_remove_wizard' ) );
329
  add_action( 'wp_ajax_mpsum_ajax_enable_automatic_updates', array( $this, 'ajax_enable_automatic_updates' ) );
330
-
331
  $not_doing_ajax = ( !defined( 'DOING_AJAX' ) || !DOING_AJAX );
332
  $not_admin_disabled = ( !defined( 'MPSUM_DISABLE_ADMIN' ) || !MPSUM_DISABLE_ADMIN );
333
  if ( is_admin() && $not_doing_ajax && $not_admin_disabled ) {
334
- MPSUM_Admin::run();
335
- }
336
  }
337
-
338
  public function ajax_enable_automatic_updates() {
339
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
340
  die( 'Cheating, huh' );
341
  }
342
  $options = MPSUM_Updates_Manager::get_options( 'core' );
343
-
344
  // Load auto update options
345
  $options['automatic_translation_updates'] = 'on';
346
  $options['automatic_theme_updates'] = 'on';
@@ -353,7 +353,7 @@ class MPSUM_Updates_Manager {
353
  MPSUM_Updates_Manager::update_options( $options, 'core' );
354
  die( '' );
355
  }
356
-
357
  public function ajax_remove_wizard() {
358
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
359
  die( 'Cheating, huh' );
@@ -365,9 +365,9 @@ class MPSUM_Updates_Manager {
365
  MPSUM_Updates_Manager::update_options( $options, 'core' );
366
  die( '' );
367
  }
368
-
369
  public function ajax_disable_updates() {
370
-
371
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
372
  die( 'Cheating, huh' );
373
  }
@@ -379,9 +379,9 @@ class MPSUM_Updates_Manager {
379
  MPSUM_Updates_Manager::update_options( $options, 'core' );
380
  die( '' );
381
  }
382
-
383
  public function ajax_remove_tracking_nag() {
384
-
385
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
386
  die( 'Cheating, huh' );
387
  }
@@ -391,26 +391,26 @@ class MPSUM_Updates_Manager {
391
  MPSUM_Updates_Manager::update_options( $options, 'core' );
392
  die( '' );
393
  }
394
-
395
  public function ajax_enable_tracking() {
396
-
397
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
398
  die( 'Cheating, huh' );
399
  }
400
-
401
  // Enable Tracking
402
  $options = MPSUM_Updates_Manager::get_options( 'core' );
403
  $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
404
  $options[ 'tracking_nag' ] = 'off';
405
  $options[ 'tracking_enabled' ] = 'on';
406
  MPSUM_Updates_Manager::update_options( $options, 'core' );
407
-
408
  $cron = new MPSUM_Tracking();
409
  MPSUM_Tracking::enable_cron();
410
-
411
  die( '' );
412
  }
413
-
414
  public function set_monthly_cron_schedule( $schedules ) {
415
  $schedules['eum-monthly'] = array(
416
  'interval' => MONTH_IN_SECONDS,
@@ -418,9 +418,9 @@ class MPSUM_Updates_Manager {
418
  );
419
  return $schedules;
420
  }
421
-
422
  public function ajax_remove_ratings_nag() {
423
-
424
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
425
  die( 'Cheating, huh' );
426
  }
@@ -431,16 +431,16 @@ class MPSUM_Updates_Manager {
431
  MPSUM_Updates_Manager::update_options( $options, 'core' );
432
  die( '' );
433
  }
434
-
435
  public function ajax_get_json() {
436
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
437
  die( 'Cheating, huh' );
438
  }
439
  die( json_encode( MPSUM_Admin::run()->get_json_options() ) );
440
  }
441
-
442
  public function ajax_update_option() {
443
-
444
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
445
  die( 'Cheating, huh' );
446
  }
@@ -449,10 +449,10 @@ class MPSUM_Updates_Manager {
449
  }
450
  /* Get Ajax Options */
451
  $context = sanitize_text_field( $_POST[ 'context' ] );
452
- $option = sanitize_text_field( $_POST[ 'data_action' ] );
453
  $option_value = sanitize_text_field( $_POST[ 'value' ] );
454
  $id = sanitize_text_field( $_POST[ 'id' ] );
455
-
456
  $options = MPSUM_Updates_Manager::get_options( $context );
457
  $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
458
  if ( 'core' == $context ) {
@@ -470,7 +470,7 @@ class MPSUM_Updates_Manager {
470
  $plugin_options[] = $id;
471
  $plugin_options = array_values( array_unique( $plugin_options ) );
472
  }
473
-
474
  MPSUM_Updates_Manager::update_options( $plugin_options, $context );
475
  } elseif( 'plugins_automatic' == $context || 'themes_automatic' == $context ) {
476
  $plugin_options = MPSUM_Updates_Manager::get_options( $context );
@@ -485,14 +485,14 @@ class MPSUM_Updates_Manager {
485
  $options[] = $id;
486
  $plugin_options = array_values( array_unique( $options ) );
487
  }
488
-
489
  MPSUM_Updates_Manager::update_options( $plugin_options, $context );
490
  }
491
-
492
  die( json_encode( MPSUM_Admin::run()->get_json_options() ) );
493
-
494
  }
495
-
496
  /**
497
  * Save plugin options.
498
  *
@@ -506,17 +506,17 @@ class MPSUM_Updates_Manager {
506
  */
507
  public static function update_options( $options = array(), $context = '' ) {
508
  $options_to_save = self::get_options();
509
-
510
  if ( !empty( $context ) && is_string( $context ) ) {
511
  $options_to_save[ $context ] = $options;
512
  } else {
513
- $options_to_save = $options;
514
  }
515
-
516
  self::$options = $options_to_save;
517
  update_site_option( 'MPSUM', $options_to_save );
518
  }
519
-
520
  } //end class MPSUM_Updates_Manager
521
 
522
  MPSUM_Updates_Manager::get_instance();
4
  Plugin URI: https://easyupdatesmanager.com
5
  Description: Manage and disable WordPress updates, including core, plugin, theme, and automatic updates - Works with Multisite and has built-in logging features.
6
  Author: Easy Updates Manager Team
7
+ Version: 6.4.6
8
  Requires at least: 4.4
9
  Author URI: https://easyupdatesmanager.com
10
  Contributors: kidsguide, ronalfy
12
  Domain Path: /languages
13
  Updates: true
14
  Network: true
15
+ */
16
 
17
  /**
18
  * Main plugin class
24
  * @package WordPress
25
  */
26
  class MPSUM_Updates_Manager {
27
+
28
  /**
29
  * Holds the class instance.
30
  *
33
  * @var MPSUM_Updates_Manager $instance
34
  */
35
  private static $instance = null;
36
+
37
  /**
38
  * Stores the plugin's options
39
  *
42
  * @var array $options
43
  */
44
  private static $options = false;
45
+
46
  /**
47
  * Retrieve a class instance.
48
  *
49
  * Retrieve a class instance.
50
  *
51
+ * @since 5.0.0
52
  * @access static
53
  *
54
  * @return MPSUM_Updates_Manager Instance of the class.
59
  }
60
  return self::$instance;
61
  } //end get_instance
62
+
63
  /**
64
  * Retrieve the plugin basename.
65
  *
66
  * Retrieve the plugin basename.
67
  *
68
+ * @since 5.0.0
69
  * @access static
70
  *
71
  * @return string plugin basename
72
  */
73
  public static function get_plugin_basename() {
74
+ return plugin_basename( __FILE__ );
75
  }
76
+
77
  /**
78
  * Class constructor.
79
  *
89
 
90
  add_action( 'init', array( $this, 'init' ) );
91
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
92
+
93
  add_filter( 'cron_schedules', array( $this, 'set_monthly_cron_schedule' ) );
94
+
95
  add_action( 'eum-monthly', array( 'MPSUM_Tracking', 'send' ) );
96
  } //end constructor
97
 
100
  *
101
  * Run code during the init action.
102
  *
103
+ * @since 6.2.5
104
  * @access public
105
  *
106
  */
107
  public function init() {
108
  /* Localization Code */
109
  load_plugin_textdomain( 'stops-core-theme-and-plugin-updates', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
110
+
111
  // Logging
112
  $options = MPSUM_Updates_Manager::get_options( 'core' );
113
  if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
120
  *
121
  * Return the absolute path to an asset based on a relative argument.
122
  *
123
+ * @since 5.0.0
124
  * @access static
125
  *
126
  * @param string $path Relative path to the asset.
130
  $dir = rtrim( plugin_dir_path(__FILE__), '/' );
131
  if ( !empty( $path ) && is_string( $path) )
132
  $dir .= '/' . ltrim( $path, '/' );
133
+ return $dir;
134
  }
135
+
136
  /**
137
  * Return the web path to an asset.
138
  *
139
  * Return the web path to an asset based on a relative argument.
140
  *
141
+ * @since 5.0.0
142
  * @access static
143
  *
144
  * @param string $path Relative path to the asset.
148
  $dir = rtrim( plugin_dir_url(__FILE__), '/' );
149
  if ( !empty( $path ) && is_string( $path) )
150
  $dir .= '/' . ltrim( $path, '/' );
151
+ return $dir;
152
  }
153
+
154
  /**
155
  * Retrieve the plugin's options
156
  *
157
  * Retrieve the plugin's options based on context
158
  *
159
+ * @since 5.0.0
160
  * @access static
161
  *
162
  * @param string $context Context to retrieve options for. This is used as an array key.
169
  if ( false === $options || true === $force_reload ) {
170
  $options = get_site_option( 'MPSUM', false, false );
171
  }
172
+
173
  if ( false === $options ) {
174
+ $options = self::maybe_migrate_options();
175
  }
176
+
177
  //Store options
178
  if ( !is_array( $options ) ) {
179
+ $options = array();
180
  }
181
  self::$options = $options;
182
+
183
  //Attempt to get context
184
  if ( !empty( $context ) && is_string( $context ) ) {
185
  if ( array_key_exists( $context, $options ) ) {
186
+ return (array)$options[ $context ];
187
  } else {
188
+ return array();
189
  }
190
  }
191
+
192
  return $options;
193
  } //get_options
194
+
195
  /**
196
  * Auto-loads classes.
197
  *
198
  * Auto-load classes that belong to this plugin.
199
  *
200
+ * @since 5.0.0
201
  * @access private
202
  *
203
  * @param string $class_name The name of the class.
209
  $file = MPSUM_Updates_Manager::get_plugin_dir( "includes/{$class_name}.php" );
210
  if ( file_exists( $file ) ) {
211
  include_once( $file );
212
+ }
213
  }
214
+
215
  /**
216
  * Determine whether to migrate options from an older version of the plugin.
217
  *
218
  * Migrate old options to new plugin format.
219
  *
220
+ * @since 5.0.0
221
  * @access private
222
  *
223
  * @return bool|array false if no migration, associative array of options if migration successful
225
  public static function maybe_migrate_options() {
226
  $options = false;
227
  $original_options = get_option( '_disable_updates', false );
228
+
229
  if ( false !== $original_options && is_array( $original_options ) ) {
230
  $options = array(
231
  'core' => array(),
283
  $options[ 'core' ][ 'automatic_plugin_updates' ] = 'off';
284
  $options[ 'core' ][ 'automatic_theme_updates' ] = 'off';
285
  }
286
+
287
  delete_option( '_disable_updates' );
288
  delete_site_option( '_disable_updates' );
289
  update_site_option( 'MPSUM', $options );
290
+
291
  }
292
+ return $options;
293
  }
294
+
295
  /**
296
  * Initialize the plugin and its dependencies.
297
  *
298
  * Initialize the plugin and its dependencies.
299
  *
300
+ * @since 5.0.0
301
  * @access public
302
  * @see __construct
303
  * @internal Uses plugins_loaded action
304
  *
305
  */
306
  public function plugins_loaded() {
307
+
308
  //Skip disable updates if a user is excluded
309
  $disable_updates_skip = false;
310
  if ( current_user_can( 'install_plugins' ) ) {
318
  if ( false === $disable_updates_skip ) {
319
  MPSUM_Disable_Updates::run();
320
  }
321
+
322
  add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
323
  add_action( 'wp_ajax_mpsum_ajax_get_json', array( $this, 'ajax_get_json' ) );
324
  add_action( 'wp_ajax_mpsum_ajax_remove_ratings_nag', array( $this, 'ajax_remove_ratings_nag' ) );
327
  add_action( 'wp_ajax_mpsum_ajax_disable_updates', array( $this, 'ajax_disable_updates' ) );
328
  add_action( 'wp_ajax_mpsum_ajax_remove_wizard', array( $this, 'ajax_remove_wizard' ) );
329
  add_action( 'wp_ajax_mpsum_ajax_enable_automatic_updates', array( $this, 'ajax_enable_automatic_updates' ) );
330
+
331
  $not_doing_ajax = ( !defined( 'DOING_AJAX' ) || !DOING_AJAX );
332
  $not_admin_disabled = ( !defined( 'MPSUM_DISABLE_ADMIN' ) || !MPSUM_DISABLE_ADMIN );
333
  if ( is_admin() && $not_doing_ajax && $not_admin_disabled ) {
334
+ MPSUM_Admin::run();
335
+ }
336
  }
337
+
338
  public function ajax_enable_automatic_updates() {
339
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
340
  die( 'Cheating, huh' );
341
  }
342
  $options = MPSUM_Updates_Manager::get_options( 'core' );
343
+
344
  // Load auto update options
345
  $options['automatic_translation_updates'] = 'on';
346
  $options['automatic_theme_updates'] = 'on';
353
  MPSUM_Updates_Manager::update_options( $options, 'core' );
354
  die( '' );
355
  }
356
+
357
  public function ajax_remove_wizard() {
358
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
359
  die( 'Cheating, huh' );
365
  MPSUM_Updates_Manager::update_options( $options, 'core' );
366
  die( '' );
367
  }
368
+
369
  public function ajax_disable_updates() {
370
+
371
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
372
  die( 'Cheating, huh' );
373
  }
379
  MPSUM_Updates_Manager::update_options( $options, 'core' );
380
  die( '' );
381
  }
382
+
383
  public function ajax_remove_tracking_nag() {
384
+
385
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
386
  die( 'Cheating, huh' );
387
  }
391
  MPSUM_Updates_Manager::update_options( $options, 'core' );
392
  die( '' );
393
  }
394
+
395
  public function ajax_enable_tracking() {
396
+
397
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
398
  die( 'Cheating, huh' );
399
  }
400
+
401
  // Enable Tracking
402
  $options = MPSUM_Updates_Manager::get_options( 'core' );
403
  $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
404
  $options[ 'tracking_nag' ] = 'off';
405
  $options[ 'tracking_enabled' ] = 'on';
406
  MPSUM_Updates_Manager::update_options( $options, 'core' );
407
+
408
  $cron = new MPSUM_Tracking();
409
  MPSUM_Tracking::enable_cron();
410
+
411
  die( '' );
412
  }
413
+
414
  public function set_monthly_cron_schedule( $schedules ) {
415
  $schedules['eum-monthly'] = array(
416
  'interval' => MONTH_IN_SECONDS,
418
  );
419
  return $schedules;
420
  }
421
+
422
  public function ajax_remove_ratings_nag() {
423
+
424
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
425
  die( 'Cheating, huh' );
426
  }
431
  MPSUM_Updates_Manager::update_options( $options, 'core' );
432
  die( '' );
433
  }
434
+
435
  public function ajax_get_json() {
436
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
437
  die( 'Cheating, huh' );
438
  }
439
  die( json_encode( MPSUM_Admin::run()->get_json_options() ) );
440
  }
441
+
442
  public function ajax_update_option() {
443
+
444
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) || ! current_user_can( 'install_plugins' ) ) {
445
  die( 'Cheating, huh' );
446
  }
449
  }
450
  /* Get Ajax Options */
451
  $context = sanitize_text_field( $_POST[ 'context' ] );
452
+ $option = sanitize_text_field( $_POST[ 'data_action' ] );
453
  $option_value = sanitize_text_field( $_POST[ 'value' ] );
454
  $id = sanitize_text_field( $_POST[ 'id' ] );
455
+
456
  $options = MPSUM_Updates_Manager::get_options( $context );
457
  $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
458
  if ( 'core' == $context ) {
470
  $plugin_options[] = $id;
471
  $plugin_options = array_values( array_unique( $plugin_options ) );
472
  }
473
+
474
  MPSUM_Updates_Manager::update_options( $plugin_options, $context );
475
  } elseif( 'plugins_automatic' == $context || 'themes_automatic' == $context ) {
476
  $plugin_options = MPSUM_Updates_Manager::get_options( $context );
485
  $options[] = $id;
486
  $plugin_options = array_values( array_unique( $options ) );
487
  }
488
+
489
  MPSUM_Updates_Manager::update_options( $plugin_options, $context );
490
  }
491
+
492
  die( json_encode( MPSUM_Admin::run()->get_json_options() ) );
493
+
494
  }
495
+
496
  /**
497
  * Save plugin options.
498
  *
506
  */
507
  public static function update_options( $options = array(), $context = '' ) {
508
  $options_to_save = self::get_options();
509
+
510
  if ( !empty( $context ) && is_string( $context ) ) {
511
  $options_to_save[ $context ] = $options;
512
  } else {
513
+ $options_to_save = $options;
514
  }
515
+
516
  self::$options = $options_to_save;
517
  update_site_option( 'MPSUM', $options_to_save );
518
  }
519
+
520
  } //end class MPSUM_Updates_Manager
521
 
522
  MPSUM_Updates_Manager::get_instance();
readme.md CHANGED
File without changes
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Easy Updates Manager ===
2
  Contributors: kidsguide, ronalfy, roary86, bigwing
3
- Tags: automatic updates, disable updates, plugin updates, multisite
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
- Stable tag: 6.4.4
7
  License: GPLv2 or later
8
 
9
  Manage all your WordPress updates, including individual updates, automatic updates, logs, and loads more. Also works with WordPress Multisite.
@@ -101,72 +101,37 @@ Check out our video on how the automatic updating works in WordPress.
101
 
102
  Not currently.
103
 
 
 
 
 
104
  = Additional Information and FAQ =
105
 
106
  For additional information and FAQs for Easy Updates Manager check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = 6.4.4 =
111
  Released 2017-11-07
112
 
113
  * Removed wizard. It was annoying too many people. A better admin UI may help with this.
114
  * Bug fix: tracking could not be disabled if you enabled it, and Reset All Options. Tracking be disabled under the Advanced Tab.
115
- * Enhancement: Logs now show a From (version) and a To (version) to satisfy a user feature request and will hopefully make logs that more useful.
116
 
117
  = 6.4.0 =
118
  Released 2017-08-01
119
 
120
  * New wizard for new users of the plugin. Automatic updates are recommended by default.
121
 
122
- = 6.3.3 =
123
- Released 2017-07-26
124
-
125
- = 6.3.1 =
126
- Released 2017-07-06
127
-
128
- * Hot fix: Yoast SEO conflict with Babel Polyfill dependency resulting in empty EUM Dashboard. We have restructured our JavaScript build dependencies to minimize this occurring again.
129
- * Bug fix: Allow white space after comma in email field. Props <a href="https://github.com/nicomollet">Nico Mollet</a>.
130
-
131
- = 6.3.0 =
132
- Released 2017-02-21
133
-
134
- * Enhancement: new React-powered Dashboard to make configuring the plugin as intuitive and easy as possible
135
-
136
- = 6.2.11 =
137
- Released 2017-02-13
138
-
139
- * Bug fix: Manual logs only logging one plugin update even if there are multiple
140
-
141
- = 6.2.9 =
142
- Released 2016-12-07
143
-
144
- * Bug fix: Manual logs not logging plugin or theme updates
145
-
146
- = 6.2.7 =
147
- Released 2016-12-01
148
-
149
- * Bug fix: Saving general settings disables logs
150
- * Logs now out of beta. Woo hoo!
151
-
152
-
153
  For past changelogs, please visit our <a href="https://github.com/easy-updates-manager/easy-updates-manager/releases">GitHub</a>.
154
 
155
  == Upgrade Notice ==
156
 
157
- = 6.4.0 =
158
-
159
- New wizard for new users of the plugin. Automatic updates are recommended by default.
160
-
161
- = 6.3.0 =
162
-
163
- Enhancement: new React-powered Dashboard to make configuring the plugin as intuitive and easy as possible
164
-
165
- = 6.2.11 =
166
- Bug fix: Manual logs only logging one plugin update even if there are multiple
167
-
168
- = 6.2.9 =
169
- Bug fix: manual log updates not working with 4.7
170
 
171
- = 6.2.7 =
172
- Bug fix: logs disabled when general settings updated
1
  === Easy Updates Manager ===
2
  Contributors: kidsguide, ronalfy, roary86, bigwing
3
+ Tags: updates manager, easy updates manager, disable updates manager, disable updates, update control, plugin updates, theme updates, core updates, automatic updates, multisite, logs
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
+ Stable tag: 6.4.6
7
  License: GPLv2 or later
8
 
9
  Manage all your WordPress updates, including individual updates, automatic updates, logs, and loads more. Also works with WordPress Multisite.
101
 
102
  Not currently.
103
 
104
+ = Does Easy Updates Manager work with third party plugins and themes? =
105
+
106
+ Since third party providers use custom update mechanisms, we cannot guarantee that they will work with Easy Updates Manager.
107
+
108
  = Additional Information and FAQ =
109
 
110
  For additional information and FAQs for Easy Updates Manager check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
111
 
112
  == Changelog ==
113
 
114
+ = 6.4.6 =
115
+ Released 2017-11-24
116
+
117
+ * Added icons to the plugins and themes screen to align it with WordPress 4.9.
118
+
119
  = 6.4.4 =
120
  Released 2017-11-07
121
 
122
  * Removed wizard. It was annoying too many people. A better admin UI may help with this.
123
  * Bug fix: tracking could not be disabled if you enabled it, and Reset All Options. Tracking be disabled under the Advanced Tab.
124
+ * Enhancement: Logs now show a From (version) and a To (version) to satisfy a user feature request and will hopefully make logs that more useful.
125
 
126
  = 6.4.0 =
127
  Released 2017-08-01
128
 
129
  * New wizard for new users of the plugin. Automatic updates are recommended by default.
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  For past changelogs, please visit our <a href="https://github.com/easy-updates-manager/easy-updates-manager/releases">GitHub</a>.
132
 
133
  == Upgrade Notice ==
134
 
135
+ = 6.4.6 =
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
+ New icons in the plugins and themes tabs.
 
uninstall.php CHANGED
File without changes