TablePress - Version 1.9

Version Description

This update includes several new features, enhancements, and bugfixes. Updating is recommended.

Download this release

Release Info

Developer TobiasBg
Plugin Icon 128x128 TablePress
Version 1.9
Comparing to
See all releases

Code changes from version 1.8.1 to 1.9

admin/css/codemirror.css CHANGED
@@ -1,361 +1,9 @@
1
- /* CodeMirror Default Styling */
2
- /* BASICS */
3
-
4
- .CodeMirror {
5
- /* Set height, width, borders, and global font properties here */
6
- font-family: monospace;
7
- height: 300px;
8
- color: black;
9
- direction: ltr;
10
- }
11
-
12
- /* PADDING */
13
-
14
- .CodeMirror-lines {
15
- padding: 4px 0; /* Vertical padding around content */
16
- }
17
- .CodeMirror pre {
18
- padding: 0 4px; /* Horizontal padding of content */
19
- }
20
-
21
- .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
22
- background-color: white; /* The little square between H and V scrollbars */
23
- }
24
-
25
- /* GUTTER */
26
-
27
- .CodeMirror-gutters {
28
- border-right: 1px solid #ddd;
29
- background-color: #f7f7f7;
30
- white-space: nowrap;
31
- }
32
- .CodeMirror-linenumbers {}
33
- .CodeMirror-linenumber {
34
- padding: 0 3px 0 5px;
35
- min-width: 20px;
36
- text-align: right;
37
- color: #999;
38
- white-space: nowrap;
39
- }
40
-
41
- .CodeMirror-guttermarker { color: black; }
42
- .CodeMirror-guttermarker-subtle { color: #999; }
43
-
44
- /* CURSOR */
45
-
46
- .CodeMirror-cursor {
47
- border-left: 1px solid black;
48
- border-right: none;
49
- width: 0;
50
- }
51
- /* Shown when moving in bi-directional text */
52
- .CodeMirror div.CodeMirror-secondarycursor {
53
- border-left: 1px solid silver;
54
- }
55
- .cm-fat-cursor .CodeMirror-cursor {
56
- width: auto;
57
- border: 0 !important;
58
- background: #7e7;
59
- }
60
- .cm-fat-cursor div.CodeMirror-cursors {
61
- z-index: 1;
62
- }
63
-
64
- .cm-animate-fat-cursor {
65
- width: auto;
66
- border: 0;
67
- -webkit-animation: blink 1.06s steps(1) infinite;
68
- animation: blink 1.06s steps(1) infinite;
69
- background-color: #7e7;
70
- }
71
- @-webkit-keyframes blink {
72
- 0% {}
73
- 50% { background-color: transparent; }
74
- 100% {}
75
- }
76
- @keyframes blink {
77
- 0% {}
78
- 50% { background-color: transparent; }
79
- 100% {}
80
- }
81
-
82
- /* Can style cursor different in overwrite (non-insert) mode */
83
- .CodeMirror-overwrite .CodeMirror-cursor {}
84
-
85
- .cm-tab { display: inline-block; text-decoration: inherit; }
86
-
87
- .CodeMirror-rulers {
88
- position: absolute;
89
- left: 0; right: 0; top: -50px; bottom: -20px;
90
- overflow: hidden;
91
- }
92
- .CodeMirror-ruler {
93
- border-left: 1px solid #ccc;
94
- top: 0; bottom: 0;
95
- position: absolute;
96
- }
97
-
98
- /* DEFAULT THEME */
99
-
100
- .cm-s-default .cm-header {color: blue;}
101
- .cm-s-default .cm-quote {color: #090;}
102
- .cm-negative {color: #d44;}
103
- .cm-positive {color: #292;}
104
- .cm-header, .cm-strong {font-weight: bold;}
105
- .cm-em {font-style: italic;}
106
- .cm-link {text-decoration: underline;}
107
- .cm-strikethrough {text-decoration: line-through;}
108
-
109
- .cm-s-default .cm-keyword {color: #708;}
110
- .cm-s-default .cm-atom {color: #219;}
111
- .cm-s-default .cm-number {color: #164;}
112
- .cm-s-default .cm-def {color: #00f;}
113
- .cm-s-default .cm-variable,
114
- .cm-s-default .cm-punctuation,
115
- .cm-s-default .cm-property,
116
- .cm-s-default .cm-operator {}
117
- .cm-s-default .cm-variable-2 {color: #05a;}
118
- .cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
119
- .cm-s-default .cm-comment {color: #a50;}
120
- .cm-s-default .cm-string {color: #a11;}
121
- .cm-s-default .cm-string-2 {color: #f50;}
122
- .cm-s-default .cm-meta {color: #555;}
123
- .cm-s-default .cm-qualifier {color: #555;}
124
- .cm-s-default .cm-builtin {color: #30a;}
125
- .cm-s-default .cm-bracket {color: #997;}
126
- .cm-s-default .cm-tag {color: #170;}
127
- .cm-s-default .cm-attribute {color: #00c;}
128
- .cm-s-default .cm-hr {color: #999;}
129
- .cm-s-default .cm-link {color: #00c;}
130
-
131
- .cm-s-default .cm-error {color: #f00;}
132
- .cm-invalidchar {color: #f00;}
133
-
134
- .CodeMirror-composing { border-bottom: 2px solid; }
135
-
136
- /* Default styles for common addons */
137
-
138
- div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
139
- div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
140
- .CodeMirror-matchingtag {
141
- background: #ff9600;
142
- background: rgba(255, 150, 0, .3);
143
- }
144
- .CodeMirror-activeline-background {background: #e8f2ff;}
145
-
146
- /* STOP */
147
-
148
- /* The rest of this file contains styles related to the mechanics of
149
- the editor. You probably shouldn't touch them. */
150
-
151
- .CodeMirror {
152
- position: relative;
153
- overflow: hidden;
154
- background: white;
155
- }
156
-
157
- .CodeMirror-scroll {
158
- overflow: scroll !important; /* Things will break if this is overridden */
159
- /* 30px is the magic margin used to hide the element's real scrollbars */
160
- /* See overflow: hidden in .CodeMirror */
161
- margin-bottom: -30px; margin-right: -30px;
162
- padding-bottom: 30px;
163
- height: 100%;
164
- outline: none; /* Prevent dragging from highlighting the element */
165
- position: relative;
166
- }
167
- .CodeMirror-sizer {
168
- position: relative;
169
- border-right: 30px solid transparent;
170
- }
171
-
172
- /* The fake, visible scrollbars. Used to force redraw during scrolling
173
- before actual scrolling happens, thus preventing shaking and
174
- flickering artifacts. */
175
- .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
176
- position: absolute;
177
- z-index: 6;
178
- display: none;
179
- }
180
- .CodeMirror-vscrollbar {
181
- right: 0; top: 0;
182
- overflow-x: hidden;
183
- overflow-y: scroll;
184
- }
185
- .CodeMirror-hscrollbar {
186
- bottom: 0; left: 0;
187
- overflow-y: hidden;
188
- overflow-x: scroll;
189
- }
190
- .CodeMirror-scrollbar-filler {
191
- right: 0; bottom: 0;
192
- }
193
- .CodeMirror-gutter-filler {
194
- left: 0; bottom: 0;
195
- }
196
-
197
- .CodeMirror-gutters {
198
- position: absolute; left: 0; top: 0;
199
- min-height: 100%;
200
- z-index: 3;
201
- }
202
- .CodeMirror-gutter {
203
- white-space: normal;
204
- height: 100%;
205
- display: inline-block;
206
- vertical-align: top;
207
- margin-bottom: -30px;
208
- }
209
- .CodeMirror-gutter-wrapper {
210
- position: absolute;
211
- z-index: 4;
212
- background: none !important;
213
- border: none !important;
214
- }
215
- .CodeMirror-gutter-background {
216
- position: absolute;
217
- top: 0; bottom: 0;
218
- z-index: 4;
219
- }
220
- .CodeMirror-gutter-elt {
221
- position: absolute;
222
- cursor: default;
223
- z-index: 4;
224
- }
225
- .CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
226
- .CodeMirror-gutter-wrapper ::selection { background-color: transparent }
227
-
228
- .CodeMirror-lines {
229
- cursor: text;
230
- min-height: 1px; /* prevents collapsing before first draw */
231
- }
232
- .CodeMirror pre {
233
- /* Reset some styles that the rest of the page might have set */
234
- -webkit-border-radius: 0;
235
- border-radius: 0;
236
- border-width: 0;
237
- background: transparent;
238
- font-family: inherit;
239
- font-size: inherit;
240
- margin: 0;
241
- white-space: pre;
242
- word-wrap: normal;
243
- line-height: inherit;
244
- color: inherit;
245
- z-index: 2;
246
- position: relative;
247
- overflow: visible;
248
- -webkit-tap-highlight-color: transparent;
249
- -webkit-font-variant-ligatures: contextual;
250
- -moz-font-variant-ligatures: contextual;
251
- font-variant-ligatures: contextual;
252
- }
253
- .CodeMirror-wrap pre {
254
- word-wrap: break-word;
255
- white-space: pre-wrap;
256
- word-break: normal;
257
- }
258
-
259
- .CodeMirror-linebackground {
260
- position: absolute;
261
- left: 0; right: 0; top: 0; bottom: 0;
262
- z-index: 0;
263
- }
264
-
265
- .CodeMirror-linewidget {
266
- position: relative;
267
- z-index: 2;
268
- overflow: auto;
269
- }
270
-
271
- .CodeMirror-widget {}
272
-
273
- .CodeMirror-rtl pre { direction: rtl; }
274
-
275
- .CodeMirror-code {
276
- outline: none;
277
- }
278
-
279
- /* Force content-box sizing for the elements where we expect it */
280
- .CodeMirror-scroll,
281
- .CodeMirror-sizer,
282
- .CodeMirror-gutter,
283
- .CodeMirror-gutters,
284
- .CodeMirror-linenumber {
285
- -moz-box-sizing: content-box;
286
- -webkit-box-sizing: content-box;
287
- box-sizing: content-box;
288
- }
289
-
290
- .CodeMirror-measure {
291
- position: absolute;
292
- width: 100%;
293
- height: 0;
294
- overflow: hidden;
295
- visibility: hidden;
296
- }
297
-
298
- .CodeMirror-cursor {
299
- position: absolute;
300
- pointer-events: none;
301
- }
302
- .CodeMirror-measure pre { position: static; }
303
-
304
- div.CodeMirror-cursors {
305
- visibility: hidden;
306
- position: relative;
307
- z-index: 3;
308
- }
309
- div.CodeMirror-dragcursors {
310
- visibility: visible;
311
- }
312
-
313
- .CodeMirror-focused div.CodeMirror-cursors {
314
- visibility: visible;
315
- }
316
-
317
- .CodeMirror-selected { background: #d9d9d9; }
318
- .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
319
- .CodeMirror-crosshair { cursor: crosshair; }
320
- .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
321
- .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
322
-
323
- .cm-searching {
324
- background-color: #ffa;
325
- background-color: rgba(255, 255, 0, .4);
326
- }
327
-
328
- /* Used to force a border model for a node */
329
- .cm-force-border { padding-right: .1px; }
330
-
331
- @media print {
332
- /* Hide the cursor when printing */
333
- .CodeMirror div.CodeMirror-cursors {
334
- visibility: hidden;
335
- }
336
- }
337
-
338
- /* See issue #2901 */
339
- .cm-tab-wrap-hack:after { content: ''; }
340
-
341
- /* Help users use markselection to safely style text background */
342
- span.CodeMirror-selectedtext { background: none; }
343
-
344
  /* CodeMirror Styling for TablePress page/customizations compared to original CSS in this file */
345
- #option-custom-css,
346
  #tablepress-page .CodeMirror {
347
- font-family: Consolas, Monaco, monospace;
348
- font-size: 14px;
349
- line-height: 1.4;
350
- width: 99% !important; /* The !important flag overrides a jQueryUI resizable inline style. */
351
  height: 100px;
352
- margin: 1px 1px 7px;
353
  }
354
- #option-custom-css {
355
- margin: 1px;
356
- -moz-tab-size: 2;
357
- -o-tab-size: 2;
358
- tab-size: 2;
359
  }
360
  #tablepress-page .CodeMirror-scroll {
361
  background-color: #fff;
@@ -370,19 +18,12 @@ span.CodeMirror-selectedtext { background: none; }
370
  padding-bottom: 0;
371
  margin-right: 0;
372
  }
373
- #option-custom-css,
374
- #tablepress-page .CodeMirror-lines {
375
- padding: 4px 6px 1px 6px;
376
- }
377
- #tablepress-page .CodeMirror pre {
378
- padding: 0;
379
  }
380
  #tablepress-page .CodeMirror.disabled .CodeMirror-scroll {
381
  background-color: #eeeeee;
382
  }
383
- #tablepress-page .CodeMirror-focused .CodeMirror-scroll {
384
- border-color: #5b9dd9;
385
- }
386
  #tablepress-page .CodeMirror-focused {
387
  -webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
388
  box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
@@ -390,9 +31,7 @@ span.CodeMirror-selectedtext { background: none; }
390
  #tablepress-page .CodeMirror-focused .CodeMirror-scroll {
391
  -webkit-box-shadow: none;
392
  box-shadow: none;
393
- }
394
- #tablepress-page .CodeMirror.large {
395
- height: 500px;
396
  }
397
 
398
  /* jQuery UI resizable styles, for the resizable CodeMirror instance */
@@ -408,7 +47,7 @@ span.CodeMirror-selectedtext { background: none; }
408
  }
409
  .ui-resizable-s {
410
  cursor: s-resize;
411
- height: 7px;
412
  width: 100%;
413
  bottom: -5px;
414
  left: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* CodeMirror Styling for TablePress page/customizations compared to original CSS in this file */
 
2
  #tablepress-page .CodeMirror {
 
 
 
 
3
  height: 100px;
 
4
  }
5
+ #tablepress-page .CodeMirror.large {
6
+ height: 500px;
 
 
 
7
  }
8
  #tablepress-page .CodeMirror-scroll {
9
  background-color: #fff;
18
  padding-bottom: 0;
19
  margin-right: 0;
20
  }
21
+ #tablepress-page .CodeMirror-scroll .CodeMirror-sizer {
22
+ border-right-width: 0 !important;
 
 
 
 
23
  }
24
  #tablepress-page .CodeMirror.disabled .CodeMirror-scroll {
25
  background-color: #eeeeee;
26
  }
 
 
 
27
  #tablepress-page .CodeMirror-focused {
28
  -webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
29
  box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
31
  #tablepress-page .CodeMirror-focused .CodeMirror-scroll {
32
  -webkit-box-shadow: none;
33
  box-shadow: none;
34
+ border-color: #5b9dd9;
 
 
35
  }
36
 
37
  /* jQuery UI resizable styles, for the resizable CodeMirror instance */
47
  }
48
  .ui-resizable-s {
49
  cursor: s-resize;
50
+ height: 10px;
51
  width: 100%;
52
  bottom: -5px;
53
  left: 0;
admin/css/codemirror.min.css CHANGED
@@ -1 +1 @@
1
- .CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:#ff9600;background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;-moz-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}#option-custom-css,#tablepress-page .CodeMirror{font-family:Consolas,Monaco,monospace;font-size:14px;line-height:1.4;width:99%!important;height:100px;margin:1px 1px 7px}#option-custom-css{margin:1px;-moz-tab-size:2;-o-tab-size:2;tab-size:2}#tablepress-page .CodeMirror-scroll{background-color:#fff;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07);-webkit-transition:50ms border-color ease-in-out;transition:50ms border-color ease-in-out;height:100%;height:-webkit-calc(100% - 2px);height:calc(100% - 2px);padding-bottom:0;margin-right:0}#option-custom-css,#tablepress-page .CodeMirror-lines{padding:4px 6px 1px 6px}#tablepress-page .CodeMirror pre{padding:0}#tablepress-page .CodeMirror.disabled .CodeMirror-scroll{background-color:#eee}#tablepress-page .CodeMirror-focused .CodeMirror-scroll{border-color:#5b9dd9}#tablepress-page .CodeMirror-focused{-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);box-shadow:0 0 2px rgba(30,140,190,.8)}#tablepress-page .CodeMirror-focused .CodeMirror-scroll{-webkit-box-shadow:none;box-shadow:none}#tablepress-page .CodeMirror.large{height:500px}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}
1
+ #tablepress-page .CodeMirror{height:100px}#tablepress-page .CodeMirror.large{height:500px}#tablepress-page .CodeMirror-scroll{background-color:#fff;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07);-webkit-transition:50ms border-color ease-in-out;transition:50ms border-color ease-in-out;height:100%;height:-webkit-calc(100% - 2px);height:calc(100% - 2px);padding-bottom:0;margin-right:0}#tablepress-page .CodeMirror-scroll .CodeMirror-sizer{border-right-width:0!important}#tablepress-page .CodeMirror.disabled .CodeMirror-scroll{background-color:#eee}#tablepress-page .CodeMirror-focused{-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);box-shadow:0 0 2px rgba(30,140,190,.8)}#tablepress-page .CodeMirror-focused .CodeMirror-scroll{-webkit-box-shadow:none;box-shadow:none;border-color:#5b9dd9}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-s{cursor:s-resize;height:10px;width:100%;bottom:-5px;left:0}
admin/css/common-rtl.css CHANGED
@@ -28,7 +28,6 @@
28
  margin-left: 0;
29
  margin-right: 2em;
30
  }
31
- #tablepress-page .table-shortcode,
32
- #tablepress-page .CodeMirror {
33
  direction: ltr;
34
  }
28
  margin-left: 0;
29
  margin-right: 2em;
30
  }
31
+ #tablepress-page .table-shortcode {
 
32
  direction: ltr;
33
  }
admin/css/common-rtl.min.css CHANGED
@@ -1 +1 @@
1
- #row-import-source td.column-2,#row-import-type td.column-2{direction:ltr;text-align:right}#table-new-id,#tablepress-nav .wp-heading-inline,#tablepress_add-add-table .form-field-small{float:right}@media screen and (max-width:700px){#tablepress-nav .nav-tab{margin:0 .5em 10px 0}}#tablepress-nav .nav-tab-separator{margin-left:0;margin-right:2em}#tablepress-page .CodeMirror,#tablepress-page .table-shortcode{direction:ltr}
1
+ #row-import-source td.column-2,#row-import-type td.column-2{direction:ltr;text-align:right}#table-new-id,#tablepress-nav .wp-heading-inline,#tablepress_add-add-table .form-field-small{float:right}@media screen and (max-width:700px){#tablepress-nav .nav-tab{margin:0 .5em 10px 0}}#tablepress-nav .nav-tab-separator{margin-left:0;margin-right:2em}#tablepress-page .table-shortcode{direction:ltr}
admin/js/codemirror.js ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * JavaScript code for the CodeMirror handling on the "Options" screen
3
+ *
4
+ * @package TablePress
5
+ * @subpackage Views JavaScript
6
+ * @author Tobias Bäthge
7
+ * @since 1.9.0
8
+ */
9
+
10
+ /* global wp, tablepress_codemirror_settings */
11
+
12
+ jQuery( document ).ready( function( $ ) {
13
+
14
+ 'use strict';
15
+
16
+ /**
17
+ * Invoke CodeMirror on the "Custom CSS" textarea.
18
+ *
19
+ * @since 1.9.0
20
+ */
21
+ var CM_custom_css = wp.codeEditor.initialize( document.getElementById( 'option-custom-css' ), tablepress_codemirror_settings );
22
+
23
+ /**
24
+ * Make the CodeMirror textarea vertically resizable.
25
+ *
26
+ * @since 1.7.0
27
+ */
28
+ $( CM_custom_css.codemirror.getWrapperElement() ).resizable( {
29
+ handles: 's',
30
+ resize: function() {
31
+ var $this = $(this);
32
+ CM_custom_css.codemirror.setSize( $this.width(), $this.height() );
33
+ }
34
+ } );
35
+
36
+ /**
37
+ * Let CodeMirror textarea grow on first focus, if it is not disabled.
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ $( '#tablepress-page' ).find( '.CodeMirror' ).on( 'mousedown.codemirror', function() {
42
+ var $this = $(this);
43
+ if ( ! $this.hasClass( 'disabled' ) ) {
44
+ $this.addClass( 'large' );
45
+ CM_custom_css.codemirror.refresh();
46
+ $this.off( 'mousedown.codemirror' );
47
+ }
48
+ } );
49
+
50
+ /**
51
+ * Enable/disable CodeMirror according to state of "Load Custom CSS" checkbox.
52
+ *
53
+ * @since 1.0.0
54
+ */
55
+ $( '#option-use-custom-css' ).on( 'change', function() {
56
+ var use_custom_css = $(this).prop( 'checked' );
57
+ CM_custom_css.codemirror.setOption( 'readOnly', ! use_custom_css );
58
+ $( '#tablepress-page' ).find( '.CodeMirror' ).toggleClass( 'disabled', ! use_custom_css );
59
+ } ).change();
60
+
61
+ } );
admin/js/codemirror.min.js CHANGED
@@ -1,341 +1 @@
1
- // CodeMirror version 5.30.0
2
- (function(Ha,na){Ha.CodeMirror=na()})(this,function(){function Ha(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function na(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function ba(a,b){return na(a).appendChild(b)}function u(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function cb(a,b,c,d){a=u(a,b,c,d);
3
- a.setAttribute("role","presentation");return a}function za(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function ta(){try{var a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function Ia(a,b){var c=a.className;Ha(b).test(c)||(a.className+=(c?" ":"")+b)}function Pc(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&
4
- !Ha(c[d]).test(b)&&(b+=" "+c[d]);return b}function Qc(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Ja(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function fa(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(0>f||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}}function N(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}
5
- function Rc(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function Sc(a){for(;ic.length<=a;)ic.push(A(ic)+" ");return ic[a]}function A(a){return a[a.length-1]}function jc(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function ig(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function Zd(){}function $d(a,b){if(Object.create)var c=Object.create(a);
6
- else Zd.prototype=a,c=new Zd;b&&Ja(b,c);return c}function Tc(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||jg.test(a))}function kc(a,b){return b?-1<b.source.indexOf("\\w")&&Tc(a)?!0:b.test(a):Tc(a)}function ae(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Uc(a){return 768<=a.charCodeAt(0)&&kg.test(a)}function be(a,b,c){for(;(0>c?0<b:b<a.length)&&Uc(a.charAt(b));)b+=c;return b}function tb(a,b,c){for(var d=b>c?-1:1;;){if(b==c)return b;var e=(b+c)/
7
- 2;e=0>d?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:c;a(e)?c=e:b=e+d}}function lg(a,b,c){this.input=c;this.scrollbarFiller=u("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=u("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=cb("div",null,"CodeMirror-code");this.selectionDiv=u("div",null,null,"position: relative; z-index: 1");this.cursorDiv=u("div",null,"CodeMirror-cursors");
8
- this.measure=u("div",null,"CodeMirror-measure");this.lineMeasure=u("div",null,"CodeMirror-measure");this.lineSpace=cb("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var d=cb("div",[this.lineSpace],"CodeMirror-lines");this.mover=u("div",[d],null,"position: relative");this.sizer=u("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=u("div",null,null,"position: absolute; height: 30px; width: 1px;");
9
- this.gutters=u("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=u("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=u("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");z&&8>E&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);R||Aa&&ub||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=
10
- this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=
11
- this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function t(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b<f){c=e;break}b-=f}return c.lines[b]}function Ka(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function Vc(a,
12
- b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function oa(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function B(a){if(null==a.parent)return null;var b=a.parent;a=N(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a+b.first}function La(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);
13
- for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function vb(a,b){return b>=a.first&&b<a.first+a.size}function Wc(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function r(a,b,c){void 0===c&&(c=null);if(!(this instanceof r))return new r(a,b,c);this.line=a;this.ch=b;this.sticky=c}function x(a,b){return a.line-b.line||a.ch-b.ch}function Xc(a,b){return a.sticky==b.sticky&&0==x(a,b)}function Yc(a){return r(a.line,a.ch)}function lc(a,b){return 0>x(a,b)?b:a}
14
- function mc(a,b){return 0>x(a,b)?a:b}function v(a,b){if(b.line<a.first)return r(a.first,0);var c=a.first+a.size-1;if(b.line>c)return r(c,t(a,c).text.length);c=t(a,b.line).text.length;var d=b.ch;c=null==d||d>c?r(b.line,c):0>d?r(b.line,0):b;return c}function ce(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=v(a,b[d]);return c}function nc(a,b,c){this.marker=a;this.from=b;this.to=c}function wb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Zc(a,b){if(b.full)return null;
15
- var c=vb(a,b.from.line)&&t(a,b.from.line).markedSpans,d=vb(a,b.to.line)&&t(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==x(b.from,b.to),h;if(c)for(var k=0;k<c.length;++k){var l=c[k],m=l.marker;if(null==l.from||(m.inclusiveLeft?l.from<=e:l.from<e)||!(l.from!=e||"bookmark"!=m.type||g&&l.marker.insertLeft)){var p=null==l.to||(m.inclusiveRight?l.to>=e:l.to>e);(h||(h=[])).push(new nc(m,l.from,p?null:l.to))}}c=h;var n;if(d)for(h=0;h<d.length;++h)if(k=d[h],l=k.marker,null==
16
- k.to||(l.inclusiveRight?k.to>=f:k.to>f)||k.from==f&&"bookmark"==l.type&&(!g||k.marker.insertLeft))m=null==k.from||(l.inclusiveLeft?k.from<=f:k.from<f),(n||(n=[])).push(new nc(l,m?null:k.from-f,null==k.to?null:k.to-f));d=n;f=1==b.text.length;g=A(b.text).length+(f?e:0);if(c)for(n=0;n<c.length;++n)if(h=c[n],null==h.to)(k=wb(d,h.marker),k)?f&&(h.to=null==k.to?null:k.to+g):h.to=e;if(d)for(e=0;e<d.length;++e)n=d[e],null!=n.to&&(n.to+=g),null==n.from?wb(c,n.marker)||(n.from=g,f&&(c||(c=[])).push(n)):(n.from+=
17
- g,f&&(c||(c=[])).push(n));c&&(c=de(c));d&&d!=c&&(d=de(d));e=[c];if(!f){f=b.text.length-2;var q;if(0<f&&c)for(g=0;g<c.length;++g)null==c[g].to&&(q||(q=[])).push(new nc(c[g].marker,null,null));for(c=0;c<f;++c)e.push(q);e.push(d)}return e}function de(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function mg(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=
18
- a.markedSpans[b].marker;!c.readOnly||d&&-1!=N(d,c)||(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>x(g.to,e.from)||0<x(g.from,e.to))){var h=[f,1],k=x(g.from,e.from),l=x(g.to,e.to);(0>k||!c.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||!c.inclusiveRight&&!l)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-3}}}return a}function ee(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);
19
- a.markedSpans=null}}function fe(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function ge(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;c=a.find();var d=b.find(),e=x(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=x(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function Ma(a,b){var c=Ba&&a.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&null==(b?d.from:d.to)&&(!f||0>ge(f,
20
- d.marker)))var f=d.marker;return f}function he(a,b,c,d,e){a=t(a,b);if(a=Ba&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=x(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=x(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0<=x(g.to,c):0<x(g.to,c))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=x(g.from,d):0>x(g.from,d))))return!0}}}
21
- function pa(a){for(var b;b=Ma(a,!0);)a=b.find(-1,!0).line;return a}function $c(a,b){var c=t(a,b),d=pa(c);return c==d?b:B(d)}function ie(a,b){if(b>a.lastLine())return b;var c=t(a,b),d;if(!Na(a,c))return b;for(;d=Ma(c,!1);)c=d.find(1,!0).line;return B(c)+1}function Na(a,b){var c=Ba&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&ad(a,b,d)))return!0}function ad(a,b,c){if(null==c.to)return b=c.marker.find(1,
22
- !0),ad(a,b.line,wb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&ad(a,b,d))return!0}function qa(a){a=pa(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&
23
- (e=a.children[d],e!=c);++d)b+=e.height;return b}function oc(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Ma(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=Ma(d,!1);)a=c.find(0,!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function bd(a){var b=a.display;a=a.doc;b.maxLine=t(a,a.first);b.maxLineLength=oc(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var d=oc(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function ng(a,b,c,
24
- d){if(!a)return d(b,c,"ltr",0);for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr",f),e=!0}e||d(b,c,"ltr")}function xb(a,b,c){var d;yb=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b)return e;f.to==b&&(f.from!=f.to&&"before"==c?d=e:yb=e);f.from==b&&(f.from!=f.to&&"before"!=c?d=e:yb=e)}return null!=d?d:yb}function ua(a,b){var c=a.order;null==c&&(c=a.order=og(a.text,b));return c}function ca(a,b,c){if(a.removeEventListener)a.removeEventListener(b,
25
- c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=N(d,c),-1<c&&(a[b]=d.slice(0,c).concat(d.slice(c+1))))}}function G(a,b){var c=a._handlers&&a._handlers[b]||pc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function K(a,b,c){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});G(a,c||b.type,a,b);return cd(b)||b.codemirrorIgnore}function je(a){var b=a._handlers&&a._handlers.cursorActivity;
26
- if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)-1==N(a,b[c])&&a.push(b[c])}}function ha(a,b){return 0<(a._handlers&&a._handlers[b]||pc).length}function db(a){a.prototype.on=function(a,c){w(this,a,c)};a.prototype.off=function(a,c){ca(this,a,c)}}function S(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function ke(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function cd(a){return null!=a.defaultPrevented?a.defaultPrevented:
27
- 0==a.returnValue}function zb(a){S(a);ke(a)}function le(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));ia&&a.ctrlKey&&1==b&&(b=3);return b}function pg(a){if(null==dd){var b=u("span","\u200b");ba(a,u("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(dd=1>=b.offsetWidth&&2<b.offsetHeight&&!(z&&8>E))}a=dd?u("span","\u200b"):u("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a}function qg(a,
28
- b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));ed[a]=b}function qc(a){if("string"==typeof a&&eb.hasOwnProperty(a))a=eb[a];else if(a&&"string"==typeof a.name&&eb.hasOwnProperty(a.name)){var b=eb[a.name];"string"==typeof b&&(b={name:b});a=$d(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return qc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return qc("application/json")}return"string"==typeof a?{name:a}:
29
- a||{name:"null"}}function fd(a,b){b=qc(b);var c=ed[b.name];if(!c)return fd(a,"text/plain");c=c(a,b);if(fb.hasOwnProperty(b.name)){var d=fb[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}c.name=b.name;b.helperType&&(c.helperType=b.helperType);if(b.modeProps)for(var f in b.modeProps)c[f]=b.modeProps[f];return c}function rg(a,b){var c=fb.hasOwnProperty(a)?fb[a]:fb[a]={};Ja(b,c)}function Oa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c=
30
- {},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c}function gd(a,b){for(var c;a.innerMode;){c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}}function me(a,b,c){return a.startState?a.startState(b,c):!0}function ne(a,b,c,d){var e=[a.state.modeGen],f={};oe(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);d=c.state;for(var g=function(d){var g=a.state.overlays[d],h=1,k=0;c.state=!0;oe(a,b.text,g.mode,c,function(a,b){for(var d=
31
- h;k<a;){var c=e[h];c>a&&e.splice(h,1,a,e[h+1],c);h+=2;k=Math.min(a,c)}if(b)if(g.opaque)e.splice(d,h-d,a,"overlay "+b),h=d+2;else for(;d<h;d+=2)c=e[d+1],e[d+1]=(c?c+" ":"")+"overlay "+b},f)},h=0;h<a.state.overlays.length;++h)g(h);c.state=d;return{styles:e,classes:f.bgClass||f.textClass?f:null}}function pe(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Ab(a,B(b)),e=b.text.length>a.options.maxHighlightLength&&Oa(a.doc.mode,d.state),f=ne(a,b,d);e&&(d.state=e);b.stateAfter=d.save(!e);b.styles=
32
- f.styles;f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Ab(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new va(d,!0,b);var f=sg(a,b,c),g=f>d.first&&t(d,f-1).stateAfter,h=g?va.fromSaved(d,g,f):new va(d,me(d.mode),f);d.iter(f,b,function(d){hd(a,d.text,h);var c=h.line;d.stateAfter=c==b-1||0==c%5||c>=e.viewFrom&&c<e.viewTo?h.save():
33
- null;h.nextLine()});c&&(d.modeFrontier=h.line);return h}function hd(a,b,c,d){var e=a.doc.mode;a=new H(b,a.options.tabSize,c);a.start=a.pos=d||0;for(""==b&&qe(e,c.state);!a.eol();)id(e,a,c.state),a.start=a.pos}function qe(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=gd(a,b);if(c.mode.blankLine)return c.mode.blankLine(c.state)}}function id(a,b,c,d){for(var e=0;10>e;e++){d&&(d[0]=gd(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");
34
- }function re(a,b,c,d){var e=a.doc,f=e.mode;b=v(e,b);var g=t(e,b.line);c=Ab(a,b.line,c);a=new H(g.text,a.options.tabSize,c);var h;for(d&&(h=[]);(d||a.pos<b.ch)&&!a.eol();){a.start=a.pos;var k=id(f,a,c.state);d&&h.push(new se(a,k,Oa(e.mode,c.state)))}return d?h:new se(a,k,c.state)}function te(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+
35
- "(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function oe(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var k=0,l=null,m=new H(b,a.options.tabSize,d),p=a.options.addModeClass&&[null];for(""==b&&te(qe(c,d.state),f);!m.eol();){if(m.pos>a.options.maxHighlightLength){h=!1;g&&hd(a,b,d,m.pos);m.pos=b.length;var n=null}else n=te(id(c,m,d.state,p),f);if(p){var q=p[0].name;q&&(n="m-"+(n?q+" "+n:q))}if(!h||l!=n){for(;k<m.start;)k=Math.min(m.start,k+5E3),e(k,l);l=n}m.start=m.pos}for(;k<
36
- m.pos;)a=Math.min(m.pos,k+5E3),e(a,l),k=a}function sg(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=t(f,b-1),k=h.stateAfter;if(k&&(!c||b+(k instanceof rc?k.lookAhead:0)<=f.modeFrontier))return b;h=fa(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function tg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var e=t(a,d).stateAfter;if(e&&(!(e instanceof rc)||
37
- d+e.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function ue(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?ug:vg;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function ve(a,b){var c=cb("span",null,null,R?"padding-right: .1px":null);c={pre:cb("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(z||R)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f=
38
- void 0;c.pos=0;c.addToken=wg;var g=a.display.measure;if(null!=jd)g=jd;else{var h=ba(g,document.createTextNode("A\u062eA")),k=Bb(h,0,1).getBoundingClientRect();h=Bb(h,1,2).getBoundingClientRect();na(g);g=k&&k.left!=k.right?jd=3>h.right-k.right:!1}g&&(f=ua(e,a.doc.direction))&&(c.addToken=xg(c.addToken,f));c.map=[];var l=b!=a.display.externalMeasured&&B(e);a:{var m=h=k=g=void 0,p=void 0,n=void 0,q=void 0;f=c;l=pe(a,e,l);var C=e.markedSpans,r=e.text,t=0;if(C)for(var u=r.length,I=0,w=1,x="",v=0;;){if(v==
39
- I){p=m=h=k=n="";g=null;v=Infinity;for(var wa=[],Y=void 0,y=0;y<C.length;++y){var O=C[y],T=O.marker;"bookmark"==T.type&&O.from==I&&T.widgetNode?wa.push(T):O.from<=I&&(null==O.to||O.to>I||T.collapsed&&O.to==I&&O.from==I)?(null!=O.to&&O.to!=I&&v>O.to&&(v=O.to,m=""),T.className&&(p+=" "+T.className),T.css&&(n=(n?n+";":"")+T.css),T.startStyle&&O.from==I&&(h+=" "+T.startStyle),T.endStyle&&O.to==v&&(Y||(Y=[])).push(T.endStyle,O.to),T.title&&!k&&(k=T.title),T.collapsed&&(!g||0>ge(g.marker,T))&&(g=O)):O.from>
40
- I&&v>O.from&&(v=O.from)}if(Y)for(y=0;y<Y.length;y+=2)Y[y+1]==v&&(m+=" "+Y[y]);if(!g||g.from==I)for(Y=0;Y<wa.length;++Y)we(f,0,wa[Y]);if(g&&(g.from||0)==I){we(f,(null==g.to?u+1:g.to)-I,g.marker,null==g.from);if(null==g.to)break a;g.to==I&&(g=!1)}}if(I>=u)break;for(wa=Math.min(u,v);;){if(x){Y=I+x.length;g||(y=Y>wa?x.slice(0,wa-I):x,f.addToken(f,y,q?q+p:p,h,I+y.length==v?m:"",k,n));if(Y>=wa){x=x.slice(wa-I);I=wa;break}I=Y;h=""}x=r.slice(t,t=l[w++]);q=ue(l[w++],f.cm.options)}}else for(g=1;g<l.length;g+=
41
- 2)f.addToken(f,r.slice(t,t=l[g]),ue(l[g+1],f.cm.options))}e.styleClasses&&(e.styleClasses.bgClass&&(c.bgClass=Pc(e.styleClasses.bgClass,c.bgClass||"")),e.styleClasses.textClass&&(c.textClass=Pc(e.styleClasses.textClass,c.textClass||"")));0==c.map.length&&c.map.push(0,0,c.content.appendChild(pg(a.display.measure)));0==d?(b.measure.map=c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}R&&(d=c.content.lastChild,/\bcm-tab\b/.test(d.className)||
42
- d.querySelector&&d.querySelector(".cm-tab"))&&(c.content.className="cm-tab-wrap-hack");G(a,"renderLine",a,b.line,c.pre);c.pre.className&&(c.textClass=Pc(c.pre.className,c.textClass||""));return c}function yg(a){var b=u("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function wg(a,b,c,d,e,f,g){if(b){if(a.splitSpaces){var h=a.trailingSpace;if(1<b.length&&!/ /.test(b))h=b;else{for(var k="",l=0;l<b.length;l++){var m=b.charAt(l);
43
- " "!=m||!h||l!=b.length-1&&32!=b.charCodeAt(l+1)||(m="\u00a0");k+=m;h=" "==m}h=k}}else h=b;k=h;l=a.cm.state.specialChars;m=!1;if(l.test(b)){h=document.createDocumentFragment();for(var p=0;;){l.lastIndex=p;var n=l.exec(b),q=n?n.index-p:b.length-p;if(q){var C=document.createTextNode(k.slice(p,p+q));z&&9>E?h.appendChild(u("span",[C])):h.appendChild(C);a.map.push(a.pos,a.pos+q,C);a.col+=q;a.pos+=q}if(!n)break;p+=q+1;"\t"==n[0]?(n=a.cm.options.tabSize,n-=a.col%n,q=h.appendChild(u("span",Sc(n),"cm-tab")),
44
- q.setAttribute("role","presentation"),q.setAttribute("cm-text","\t"),a.col+=n):("\r"==n[0]||"\n"==n[0]?(q=h.appendChild(u("span","\r"==n[0]?"\u240d":"\u2424","cm-invalidchar")),q.setAttribute("cm-text",n[0])):(q=a.cm.options.specialCharPlaceholder(n[0]),q.setAttribute("cm-text",n[0]),z&&9>E?h.appendChild(u("span",[q])):h.appendChild(q)),a.col+=1);a.map.push(a.pos,a.pos+1,q);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),z&&9>E&&(m=!0),a.pos+=b.length;
45
- a.trailingSpace=32==k.charCodeAt(b.length-1);if(c||d||e||m||g)return b=c||"",d&&(b+=d),e&&(b+=e),d=u("span",[h],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(h)}}function xg(a,b){return function(c,d,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=c.pos,m=l+d.length;;){for(var p=void 0,n=0;n<b.length&&!(p=b[n],p.to>l&&p.from<=l);n++);if(p.to>=m)return a(c,d,e,f,g,h,k);a(c,d.slice(0,p.to-l),e,f,null,h,k);f=null;d=d.slice(p.to-l);l=p.to}}}function we(a,b,c,d){var e=
46
- !d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function xe(a,b,c){for(var d=this.line=b,e;d=Ma(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?B(A(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Na(a,b)}function sc(a,b,c){var d=[],e;for(e=
47
- b;e<c;)b=new xe(a.doc,t(a.doc,e),e),e+=b.size,d.push(b);return d}function zg(a,b){var c=a.ownsGroup;if(c)try{var d=c.delayedCallbacks,e=0;do{for(;e<d.length;e++)d[e].call(null);for(var f=0;f<c.ops.length;f++){var g=c.ops[f];if(g.cursorActivityHandlers)for(;g.cursorActivityCalled<g.cursorActivityHandlers.length;)g.cursorActivityHandlers[g.cursorActivityCalled++].call(null,g.cm)}}while(e<d.length)}finally{gb=null,b(c)}}function P(a,b){var c=a._handlers&&a._handlers[b]||pc;if(c.length){var d=Array.prototype.slice.call(arguments,
48
- 2);if(gb)var e=gb.delayedCallbacks;else Cb?e=Cb:(e=Cb=[],setTimeout(Ag,0));for(var f=function(a){e.push(function(){return c[a].apply(null,d)})},g=0;g<c.length;++g)f(g)}}function Ag(){var a=Cb;Cb=null;for(var b=0;b<a.length;++b)a[b]()}function ye(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){f=a;var g=b,h=g.text.className,k=ze(f,g);g.text==g.node&&(g.node=k.pre);g.text.parentNode.replaceChild(k.pre,g.text);g.text=k.pre;k.bgClass!=g.bgClass||k.textClass!=g.textClass?
49
- (g.bgClass=k.bgClass,g.textClass=k.textClass,kd(f,g)):h&&(g.text.className=h)}else if("gutter"==f)Ae(a,b,c,d);else if("class"==f)kd(a,b);else if("widget"==f){f=a;g=b;h=d;g.alignable&&(g.alignable=null);k=g.node.firstChild;for(var l;k;k=l)l=k.nextSibling,"CodeMirror-linewidget"==k.className&&g.node.removeChild(k);Be(f,g,h)}}b.changes=null}function Db(a){a.node==a.text&&(a.node=u("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),
50
- z&&8>E&&(a.node.style.zIndex=2));return a.node}function ze(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):ve(a,b)}function kd(a,b){var c=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;c&&(c+=" CodeMirror-linebackground");if(b.background)c?b.background.className=c:(b.background.parentNode.removeChild(b.background),b.background=null);else if(c){var d=Db(b);b.background=d.insertBefore(u("div",null,c),d.firstChild);
51
- a.display.input.setUneditable(b.background)}b.line.wrapClass?Db(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");b.text.className=(b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass)||""}function Ae(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var e=Db(b);b.gutterBackground=u("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,
52
- "left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=Db(b),g=b.gutter=u("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);!a.options.lineNumbers||
53
- e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(u("div",Wc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(f=e.hasOwnProperty(c)&&e[c])&&g.appendChild(u("div",[f],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function Bg(a,b,c,d){var e=ze(a,b);b.text=b.node=e.pre;e.bgClass&&
54
- (b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);kd(a,b);Ae(a,b,c,d);Be(a,b,d);return b.node}function Be(a,b,c){Ce(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)Ce(a,b.rest[d],b,c,!1)}function Ce(a,b,c,d,e){if(b.widgets){var f=Db(c),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=u("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||k.setAttribute("cm-ignore-events","true");var l=h,m=k,p=d;if(l.noHScroll){(c.alignable||(c.alignable=[])).push(m);var n=p.wrapperWidth;
55
- m.style.left=p.fixedPos+"px";l.coverGutter||(n-=p.gutterTotalWidth,m.style.paddingLeft=p.gutterTotalWidth+"px");m.style.width=n+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-p.gutterTotalWidth+"px"));a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,c.gutter||c.text):f.appendChild(k);P(h,"redraw")}}}function Eb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!za(document.body,a.node)){var c="position: relative;";
56
- a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+"px;");ba(b.display.measure,u("div",[a.node],null,c))}return a.height=a.node.parentNode.offsetHeight}function xa(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function ld(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function De(a){if(a.cachedPaddingH)return a.cachedPaddingH;
57
- var b=ba(a.measure,u("pre","x"));b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b);return b}function ra(a){return 30-a.display.nativeBarWidth}function Pa(a){return a.display.scroller.clientWidth-ra(a)-a.display.barWidth}function md(a){return a.display.scroller.clientHeight-ra(a)-a.display.barHeight}function Ee(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};
58
- for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(B(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function nd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Qa(a,b)];var c=a.display.externalMeasured;if(c&&b>=c.lineN&&b<c.lineN+c.size)return c}function Ra(a,b){var c=B(b),d=nd(a,c);d&&!d.text?d=null:d&&d.changes&&(ye(a,d,c,od(a)),a.curOp.forceUpdate=!0);if(!d){var e=
59
- pa(b);d=B(e);e=a.display.externalMeasured=new xe(a.doc,e,d);e.lineN=d;d=e.built=ve(a,e);e.text=d.pre;ba(a.display.lineMeasure,d.pre);d=e}c=Ee(d,b,c);return{line:b,view:d,rect:null,map:c.map,cache:c.cache,before:c.before,hasHeights:!1}}function ja(a,b,c,d,e){b.before&&(c=-1);var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,k=a.options.lineWrapping,l=k&&Pa(a);if(!g.measure.heights||k&&g.measure.width!=
60
- l){var m=g.measure.heights=[];if(k)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),k=0;k<g.length-1;k++){l=g[k];var p=g[k+1];2<Math.abs(l.bottom-p.bottom)&&m.push((l.bottom+p.top)/2-h.top)}m.push(h.bottom-h.top)}b.hasHeights=!0}m=d;g=Fe(b.map,c,m);d=g.node;h=g.start;k=g.end;c=g.collapse;if(3==d.nodeType){for(var n=0;4>n;n++){for(;h&&Uc(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+k<g.coverEnd&&Uc(b.line.text.charAt(g.coverStart+k));)++k;if(z&&9>E&&0==h&&k==g.coverEnd-g.coverStart)var q=
61
- d.parentNode.getBoundingClientRect();else{q=Bb(d,h,k).getClientRects();k=Ge;if("left"==m)for(l=0;l<q.length&&(k=q[l]).left==k.right;l++);else for(l=q.length-1;0<=l&&(k=q[l]).left==k.right;l--);q=k}if(q.left||q.right||0==h)break;k=h;--h;c="right"}z&&11>E&&((n=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=pd?n=pd:(m=ba(a.display.measure,u("span","x")),n=m.getBoundingClientRect(),m=Bb(m,0,1).getBoundingClientRect(),n=pd=1<Math.abs(n.left-m.left)),n=!n),n||(n=
62
- screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,q={left:q.left*n,right:q.right*n,top:q.top*m,bottom:q.bottom*m}))}else 0<h&&(c=m="right"),q=a.options.lineWrapping&&1<(n=d.getClientRects()).length?n["right"==m?n.length-1:0]:d.getBoundingClientRect();!(z&&9>E)||h||q&&(q.left||q.right)||(q=(q=d.parentNode.getClientRects()[0])?{left:q.left,right:q.left+Fb(a.display),top:q.top,bottom:q.bottom}:Ge);d=q.top-b.rect.top;h=q.bottom-b.rect.top;n=(d+h)/2;m=b.view.measure.heights;for(g=
63
- 0;g<m.length-1&&!(n<m[g]);g++);c={left:("right"==c?q.right:q.left)-b.rect.left,right:("left"==c?q.left:q.right)-b.rect.left,top:g?m[g-1]:0,bottom:m[g]};q.left||q.right||(c.bogus=!0);a.options.singleCursorHeightPerLine||(c.rtop=d,c.rbottom=h);a=c;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function Fe(a,b,c){for(var d,e,f,g,h,k,l=0;l<a.length;l+=3){h=a[l];k=a[l+1];if(b<h)e=0,f=1,g="left";else if(b<k)e=b-h,f=e+1;else if(l==a.length-3||b==
64
- k&&a[l+3]>b)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){d=a[l+2];h==k&&c==(d.insertLeft?"left":"right")&&(g=c);if("left"==c&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)d=a[(l-=3)+2],g="left";if("right"==c&&e==k-h)for(;l<a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)d=a[(l+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function He(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}
65
- function Ie(a){a.display.externalMeasure=null;na(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)He(a.display.view[b])}function Gb(a){Ie(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Je(){return tc&&uc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}
66
- function Ke(){return tc&&uc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function qd(a){var b=0;if(a.widgets)for(var c=0;c<a.widgets.length;++c)a.widgets[c].above&&(b+=Eb(a.widgets[c]));return b}function vc(a,b,c,d,e){e||(e=qd(b),c.top+=e,c.bottom+=e);if("line"==d)return c;d||(d="local");b=qa(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||
67
- "window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:Ke()),d=a.left+("window"==d?0:Je()),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function Le(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=Je(),b-=Ke()):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function rd(a,b,c,d,e){d||(d=t(a.doc,b.line));var f=d;b=b.ch;d=ja(a,Ra(a,d),b,e);return vc(a,
68
- f,d,c)}function ka(a,b,c,d,e,f){function g(b,g){var h=ja(a,e,b,g?"right":"left",f);g?h.left=h.right:h.right=h.left;return vc(a,d,h,c)}function h(a,b,d){return g(d?a-1:a,1==k[b].level!=d)}d=d||t(a.doc,b.line);e||(e=Ra(a,d));var k=ua(d,a.doc.direction),l=b.ch;b=b.sticky;l>=d.text.length?(l=d.text.length,b="before"):0>=l&&(l=0,b="after");if(!k)return g("before"==b?l-1:l,"before"==b);var m=xb(k,l,b),p=yb;m=h(l,m,"before"==b);null!=p&&(m.other=h(l,p,"before"!=b));return m}function Me(a,b){var c=0;b=v(a.doc,
69
- b);a.options.lineWrapping||(c=Fb(a.display)*b.ch);var d=t(a.doc,b.line),e=qa(d)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:e,bottom:e+d.height}}function sd(a,b,c,d,e){a=r(a,b,c);a.xRel=e;d&&(a.outside=!0);return a}function td(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return sd(d.first,0,null,!0,-1);var e=La(d,c),f=d.first+d.size-1;if(e>f)return sd(d.first+d.size-1,t(d,f).text.length,null,!0,1);0>b&&(b=0);for(d=t(d,e);;)if(e=Cg(a,d,e,b,c),f=(d=Ma(d,!1))&&d.find(0,!0),d&&(e.ch>
70
- f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=B(d=f.to.line);else return e}function Ne(a,b,c,d){d-=qd(b);b=b.text.length;var e=tb(function(b){return ja(a,c,b-1).bottom<=d},b,0);b=tb(function(b){return ja(a,c,b).top>d},e,b);return{begin:e,end:b}}function ud(a,b,c,d){c||(c=Ra(a,b));d=vc(a,b,ja(a,c,d),"line").top;return Ne(a,b,c,d)}function vd(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function Cg(a,b,c,d,e){e-=qa(b);var f=Ra(a,b),g=qd(b),h=0,k=b.text.length,l=!0,m=ua(b,a.doc.direction);
71
- m&&(m=(a.options.lineWrapping?Dg:Eg)(a,b,c,f,m,d,e),h=(l=1!=m.level)?m.from:m.to-1,k=l?m.to:m.from-1);var p=null,n=null;m=tb(function(b){var c=ja(a,f,b);c.top+=g;c.bottom+=g;if(!vd(c,d,e,!1))return!1;c.top<=e&&c.left<=d&&(p=b,n=c);return!0},h,k);var q=!1;n?(h=d-n.left<n.right-d,l=h==l,m=p+(l?0:1),l=l?"after":"before",h=h?n.left:n.right):(l||m!=k&&m!=h||m++,l=0==m?"after":m==b.text.length?"before":ja(a,f,m-(l?1:0)).bottom+g<=e==l?"after":"before",q=ka(a,r(c,m,l),"line",b,f),h=q.left,q=e<q.top||e>=
72
- q.bottom);m=be(b.text,m,1);return sd(c,m,l,q,d-h)}function Eg(a,b,c,d,e,f,g){var h=tb(function(h){h=e[h];var k=1!=h.level;return vd(ka(a,r(c,k?h.to:h.from,k?"before":"after"),"line",b,d),f,g,!0)},0,e.length-1),k=e[h];if(0<h){var l=1!=k.level;l=ka(a,r(c,l?k.from:k.to,l?"after":"before"),"line",b,d);vd(l,f,g,!0)&&l.top>g&&(k=e[h-1])}return k}function Dg(a,b,c,d,e,f,g){c=Ne(a,b,d,g);b=c.begin;c=c.end;for(var h=g=null,k=0;k<e.length;k++){var l=e[k];if(!(l.from>=c||l.to<=b)){var m=ja(a,d,1!=l.level?Math.min(c,
73
- l.to)-1:Math.max(b,l.from)).right;m=m<f?f-m+1E9:m-f;if(!g||h>m)g=l,h=m}}g||(g=e[e.length-1]);g.from<b&&(g={from:b,to:g.to,level:g.level});g.to>c&&(g={from:g.from,to:c,level:g.level});return g}function Sa(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Ta){Ta=u("pre");for(var b=0;49>b;++b)Ta.appendChild(document.createTextNode("x")),Ta.appendChild(u("br"));Ta.appendChild(document.createTextNode("x"))}ba(a.measure,Ta);b=Ta.offsetHeight/50;3<b&&(a.cachedTextHeight=b);na(a.measure);
74
- return b||1}function Fb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=u("span","xxxxxxxxxx"),c=u("pre",[b]);ba(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function od(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:wd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,
75
- gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function wd(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Oe(a){var b=Sa(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Fb(a.display)-3);return function(e){if(Na(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function xd(a){var b=a.doc,c=Oe(a);
76
- b.iter(function(a){var b=c(a);b!=a.height&&oa(a,b)})}function Ua(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;c=e.lineSpace.getBoundingClientRect();try{var f=b.clientX-c.left;var g=b.clientY-c.top}catch(k){return null}b=td(a,f,g);var h;d&&1==b.xRel&&(h=t(a.doc,b.line).text).length==b.ch&&(d=fa(h,h.length,a.options.tabSize)-h.length,b=r(b.line,Math.max(0,Math.round((f-De(a.display).left)/Fb(a.display))-d)));return b}function Qa(a,b){if(b>=
77
- a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Hb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Pe(a,b){void 0===b&&(b=!0);for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(b||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<
78
- a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&Qe(a,h.head,e);k||Fg(a,h,f)}}return d}function Qe(a,b,c){b=ka(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var d=c.appendChild(u("div","\u00a0","CodeMirror-cursor"));d.style.left=b.left+"px";d.style.top=b.top+"px";d.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px";b.other&&(a=c.appendChild(u("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=b.other.left+
79
- "px",a.style.top=b.other.top+"px",a.style.height=.85*(b.other.bottom-b.other.top)+"px")}function wc(a,b){return a.top-b.top||a.left-b.left}function Fg(a,b,c){function d(a,b,d,c){0>b&&(b=0);b=Math.round(b);c=Math.round(c);h.appendChild(u("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n top: "+b+"px; width: "+(null==d?m-a:d)+"px;\n height: "+(c-b)+"px"))}function e(b,c,e){function f(d,c){return rd(a,r(b,d),"div",h,c)}var h=
80
- t(g,b),k=h.text.length,n,q,p=ua(h,g.direction);ng(p,c||0,null==e?k:e,function(b,g,p,r){var C=f(b,"ltr"==p?"left":"right"),t=f(g-1,"ltr"==p?"right":"left");if("ltr"==p)p=null==c&&0==b?l:C.left,g=null==e&&g==k?m:t.right,3>=t.top-C.top?d(p,t.top,g-p,t.bottom):(d(p,C.top,null,C.bottom),C.bottom<t.top&&d(l,C.bottom,null,t.top),d(l,t.top,t.right,t.bottom));else if(b<g){var u=null==c&&0==b?m:C.right;p=null==e&&g==k?l:t.left;if(3>=t.top-C.top)d(p,t.top,u-p,t.bottom);else{var v=l;r&&(b=ud(a,h,null,b).end,
81
- v=f(b-(/\s/.test(h.text.charAt(b-1))?2:1),"left").left);d(v,C.top,u-v,C.bottom);C.bottom<t.top&&d(l,C.bottom,null,t.top);g=ud(a,h,null,g).begin;g=f(g,"right").right-p;d(p,t.top,g,t.bottom)}}if(!n||0>wc(C,n))n=C;0>wc(t,n)&&(n=t);if(!q||0>wc(C,q))q=C;0>wc(t,q)&&(q=t)});return{start:n,end:q}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=De(a.display),l=k.left,m=Math.max(f.sizerWidth,Pa(a)-f.sizer.offsetLeft)-k.right;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var p=
82
- t(g,f.line);k=t(g,b.line);k=pa(p)==pa(k);f=e(f.line,f.ch,k?p.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),d(l,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(l,f.bottom,null,b.top)}c.appendChild(h)}function yd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=
83
- (c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Re(a){a.state.focused||(a.display.input.focus(),zd(a))}function Se(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Ib(a))},100)}function zd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(G(a,"focus",a,b),a.state.focused=!0,Ia(a.display.wrapper,"CodeMirror-focused"),
84
- a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),R&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),yd(a))}function Ib(a,b){a.state.delayingBlurEvent||(a.state.focused&&(G(a,"blur",a,b),a.state.focused=!1,Va(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function xc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=
85
- a.view[c];if(!d.hidden){if(z&&8>E){var e=d.node.offsetTop+d.node.offsetHeight;var f=e-b;b=e}else f=d.node.getBoundingClientRect(),f=f.bottom-f.top;e=d.line.height-f;2>f&&(f=Sa(a));if(.005<e||-.005>e)if(oa(d.line,f),Te(d.line),d.rest)for(f=0;f<d.rest.length;f++)Te(d.rest[f])}}}function Te(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function Ad(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);
86
- var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight;d=La(b,d);e=La(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;f<d?(d=f,e=La(b,qa(t(b,f))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=e&&(d=La(b,qa(t(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Ue(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=wd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&
87
- (c[g].gutter&&(c[g].gutter.style.left=f),c[g].gutterBackground&&(c[g].gutterBackground.style.left=f));var h=c[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function Ve(a){if(!a.options.lineNumbers)return!1;var b=a.doc;b=Wc(a.options,b.first+b.size-1);var c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(u("div",[u("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth;d=d.offsetWidth-
88
- e;c.lineGutter.style.width="";c.lineNumInnerWidth=Math.max(e,c.lineGutter.offsetWidth-d)+1;c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";Bd(a);return!0}return!1}function Cd(a,b){var c=a.display,d=Sa(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:c.scroller.scrollTop,f=md(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+ld(c),k=b.top<d;d=b.bottom>h-d;b.top<e?g.scrollTop=
89
- k?0:b.top:b.bottom>e+f&&(f=Math.min(b.top,(d?h:b.bottom)-f),f!=e&&(g.scrollTop=f));e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;c=Pa(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(f=b.right-b.left>c)b.right=b.left+c;10>b.left?g.scrollLeft=0:b.left<e?g.scrollLeft=Math.max(0,b.left-(f?0:10)):b.right>c+e-3&&(g.scrollLeft=b.right+(f?0:10)-c);return g}function yc(a,b){null!=b&&(zc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}
90
- function hb(a){zc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Jb(a,b,c){null==b&&null==c||zc(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function zc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=Me(a,b.from),d=Me(a,b.to);We(a,c,d,b.margin)}}function We(a,b,c,d){b=Cd(a,{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});Jb(a,
91
- b.scrollLeft,b.scrollTop)}function Kb(a,b){2>Math.abs(a.doc.scrollTop-b)||(Aa||Dd(a,{top:b}),Xe(a,b,!0),Aa&&Dd(a),Lb(a,100))}function Xe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function Wa(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft:
92
- 2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,Ue(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Mb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+ld(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+
93
- ra(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function ib(a,b){b||(b=Mb(a));var c=a.display.barWidth,d=a.display.barHeight;Ye(a,b);for(var e=0;4>e&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&xc(a),Ye(a,Mb(a)),c=a.display.barWidth,d=a.display.barHeight}function Ye(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=
94
- d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Ze(a){a.display.scrollbars&&(a.display.scrollbars.clear(),
95
- a.display.scrollbars.addClass&&Va(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new $e[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);w(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?Wa(a,b):Kb(a,b)},a);a.display.scrollbars.addClass&&Ia(a.display.wrapper,a.display.scrollbars.addClass)}function Xa(a){a.curOp=
96
- {cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Gg};a=a.curOp;gb?gb.ops.push(a):a.ownsGroup=gb={ops:[a],delayedCallbacks:[]}}function Ya(a){zg(a.curOp,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){var d=a[b],e=d.cm,f=e.display,g=e.display;!g.scrollbarsClipped&&
97
- g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=ra(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=ra(e)+"px",g.scrollbarsClipped=!0);d.updateMaxLine&&bd(e);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&(d.scrollToPos.from.line<f.viewFrom||d.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new Ac(e,d.mustUpdate&&
98
- {top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(b=0;b<a.length;b++)d=a[b],d.updatedDisplay=d.mustUpdate&&Ed(d.cm,d.update);for(b=0;b<a.length;b++)if(d=a[b],e=d.cm,f=e.display,d.updatedDisplay&&xc(e),d.barMeasure=Mb(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=f.maxLine.text.length,g=ja(e,Ra(e,f.maxLine),g,void 0),d.adjustWidthTo=g.left+3,e.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+d.adjustWidthTo+ra(e)+e.display.barWidth),
99
- d.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+d.adjustWidthTo-Pa(e))),d.updatedDisplay||d.selectionChanged)d.preparedSelection=f.input.prepareSelection();for(b=0;b<a.length;b++)d=a[b],e=d.cm,null!=d.adjustWidthTo&&(e.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<e.doc.scrollLeft&&Wa(e,Math.min(e.display.scroller.scrollLeft,d.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=d.focus&&d.focus==ta(),d.preparedSelection&&e.display.input.showSelection(d.preparedSelection,f),(d.updatedDisplay||
100
- d.startHeight!=e.doc.height)&&ib(e,d.barMeasure),d.updatedDisplay&&Fd(e,d.barMeasure),d.selectionChanged&&yd(e),e.state.focused&&d.updateInput&&e.display.input.reset(d.typing),f&&Re(d.cm);for(b=0;b<a.length;b++){var h=void 0;d=a[b];e=d.cm;f=e.display;g=e.doc;d.updatedDisplay&&af(e,d.update);null==f.wheelStartX||null==d.scrollTop&&null==d.scrollLeft&&!d.scrollToPos||(f.wheelStartX=f.wheelStartY=null);null!=d.scrollTop&&Xe(e,d.scrollTop,d.forceScroll);null!=d.scrollLeft&&Wa(e,d.scrollLeft,!0,!0);if(d.scrollToPos){var k=
101
- v(g,d.scrollToPos.from),l=v(g,d.scrollToPos.to),m=d.scrollToPos.margin;null==m&&(m=0);e.options.lineWrapping||k!=l||(k=k.ch?r(k.line,"before"==k.sticky?k.ch-1:k.ch,"after"):k,l="before"==k.sticky?r(k.line,k.ch+1,"before"):k);for(var p=0;5>p;p++){var n=!1;h=ka(e,k);var q=l&&l!=k?ka(e,l):h;h={left:Math.min(h.left,q.left),top:Math.min(h.top,q.top)-m,right:Math.max(h.left,q.left),bottom:Math.max(h.bottom,q.bottom)+m};q=Cd(e,h);var C=e.doc.scrollTop,t=e.doc.scrollLeft;null!=q.scrollTop&&(Kb(e,q.scrollTop),
102
- 1<Math.abs(e.doc.scrollTop-C)&&(n=!0));null!=q.scrollLeft&&(Wa(e,q.scrollLeft),1<Math.abs(e.doc.scrollLeft-t)&&(n=!0));if(!n)break}l=h;K(e,"scrollCursorIntoView")||(m=e.display,p=m.sizer.getBoundingClientRect(),k=null,0>l.top+p.top?k=!0:l.bottom+p.top>(window.innerHeight||document.documentElement.clientHeight)&&(k=!1),null==k||Hg||(l=u("div","\u200b",null,"position: absolute;\n top: "+(l.top-m.viewOffset-e.display.lineSpace.offsetTop)+"px;\n height: "+
103
- (l.bottom-l.top+ra(e)+m.barHeight)+"px;\n left: "+l.left+"px; width: "+Math.max(2,l.right-l.left)+"px;"),e.display.lineSpace.appendChild(l),l.scrollIntoView(k),e.display.lineSpace.removeChild(l)))}l=d.maybeHiddenMarkers;k=d.maybeUnhiddenMarkers;if(l)for(m=0;m<l.length;++m)l[m].lines.length||G(l[m],"hide");if(k)for(l=0;l<k.length;++l)k[l].lines.length&&G(k[l],"unhide");f.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);d.changeObjs&&G(e,"changes",e,d.changeObjs);
104
- d.update&&d.update.finish()}})}function Z(a,b){if(a.curOp)return b();Xa(a);try{return b()}finally{Ya(a)}}function L(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Xa(a);try{return b.apply(a,arguments)}finally{Ya(a)}}}function U(a){return function(){if(this.curOp)return a.apply(this,arguments);Xa(this);try{return a.apply(this,arguments)}finally{Ya(this)}}}function M(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);Xa(b);try{return a.apply(this,arguments)}finally{Ya(b)}}}
105
- function W(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)Ba&&$c(a.doc,b)<e.viewTo&&Ca(a);else if(c<=e.viewFrom)Ba&&ie(a.doc,c+d)>e.viewFrom?Ca(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Ca(a);else if(b<=e.viewFrom){var f=Bc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Ca(a)}else if(c>=
106
- e.viewTo)(f=Bc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Ca(a);else{f=Bc(a,b,b,-1);var g=Bc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(sc(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):Ca(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=null)}function Da(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=
107
- d.view[Qa(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==N(a,c)&&a.push(c)))}function Ca(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Bc(a,b,c,d){var e=Qa(a,b),f=a.display.view;if(!Ba||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=a.display.viewFrom,h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<d){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;c+=b}for(;$c(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-
108
- (0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function bf(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function Lb(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,Qc(Ig,a))}function Ig(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Ab(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=
109
- f.styles,h=f.text.length>a.options.maxHighlightLength?Oa(b.mode,d.state):null,k=ne(a,f,d,!0);h&&(d.state=h);f.styles=k.styles;h=f.styleClasses;(k=k.classes)?f.styleClasses=k:h&&(f.styleClasses=null);k=!g||g.length!=f.styles.length||h!=k&&(!h||!k||h.bgClass!=k.bgClass||h.textClass!=k.textClass);for(h=0;!k&&h<g.length;++h)k=g[h]!=f.styles[h];k&&e.push(d.line);f.stateAfter=d.save()}else f.text.length<=a.options.maxHighlightLength&&hd(a,f.text,d),f.stateAfter=0==d.line%5?d.save():null;d.nextLine();if(+new Date>
110
- c)return Lb(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&Z(a,function(){for(var b=0;b<e.length;b++)Da(a,e[b],"text")})}}function Ed(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return Ca(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==bf(a))return!1;Ve(a)&&(Ca(a),b.dims=od(a));var e=d.first+d.size,f=Math.max(b.visible.from-
111
- a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&20>f-c.viewFrom&&(f=Math.max(d.first,c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));Ba&&(f=$c(a.doc,f),g=ie(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=sc(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=sc(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(Qa(a,
112
- f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(sc(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,Qa(a,g))));e.viewTo=g;c.viewOffset=qa(t(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=bf(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;a.hasFocus()?f=null:(f=ta())&&za(a.display.lineDiv,f)?(f={activeElt:f},window.getSelection&&(e=window.getSelection(),e.anchorNode&&e.extend&&za(a.display.lineDiv,e.anchorNode)&&
113
- (f.anchorNode=e.anchorNode,f.anchorOffset=e.anchorOffset,f.focusNode=e.focusNode,f.focusOffset=e.focusOffset))):f=null;4<g&&(c.lineDiv.style.display="none");Jg(a,c.updateLineNumbers,b.dims);4<g&&(c.lineDiv.style.display="");c.renderedView=c.view;(g=f)&&g.activeElt&&g.activeElt!=ta()&&(g.activeElt.focus(),g.anchorNode&&za(document.body,g.anchorNode)&&za(document.body,g.focusNode)&&(f=window.getSelection(),e=document.createRange(),e.setEnd(g.anchorNode,g.anchorOffset),e.collapse(!1),f.removeAllRanges(),
114
- f.addRange(e),f.extend(g.focusNode,g.focusOffset)));na(c.cursorDiv);na(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Lb(a,400));c.updateLineNumbers=null;return!0}function af(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||!a.options.lineWrapping||b.oldDisplayWidth==Pa(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+ld(a.display)-md(a),c.top)}),b.visible=Ad(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&
115
- b.visible.to<=a.display.viewTo)break;if(!Ed(a,b))break;xc(a);d=Mb(a);Hb(a);ib(a,d);Fd(a,d);b.force=!1}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function Dd(a,b){var c=new Ac(a,b);if(Ed(a,c)){xc(a);af(a,c);var d=Mb(a);Hb(a);ib(a,d);Fd(a,d);c.finish()}}function Jg(a,b,c){function d(b){var d=
116
- b.nextSibling;R&&ia&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return d}var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view;e=e.viewFrom;for(var l=0;l<k.length;l++){var m=k[l];if(!m.hidden)if(m.node&&m.node.parentNode==g){for(;h!=m.node;)h=d(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1<N(m.changes,"gutter")&&(h=!1),ye(a,m,e,c));h&&(na(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(Wc(a.options,e))));h=m.node.nextSibling}else{var p=
117
- Bg(a,m,e,c);g.insertBefore(p,h)}e+=m.size}for(;h;)h=d(h)}function Bd(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function Fd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+ra(a)+"px"}function cf(a){var b=a.display.gutters,c=a.options.gutters;na(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(u("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==
118
- e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";Bd(a)}function Gd(a){var b=N(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function df(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);
119
- return{x:b,y:c}}function Kg(a){a=df(a);a.x*=da;a.y*=da;return a}function ef(a,b){var c=df(b),d=c.x;c=c.y;var e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,h=f.scrollHeight>f.clientHeight;if(d&&g||c&&h){if(c&&ia&&R){g=b.target;var k=e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==g){a.display.currentWheelTarget=g;break a}}!d||Aa||la||null==da?(c&&null!=da&&(h=c*da,g=a.doc.scrollTop,k=g+e.wrapper.clientHeight,0>h?g=Math.max(0,g+h-50):k=Math.min(a.doc.height,k+h+50),
120
- Dd(a,{top:g,bottom:k})),20>Cc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY;a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(da=(da*Cc+a)/(Cc+1),++Cc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&h&&Kb(a,Math.max(0,f.scrollTop+c*da)),Wa(a,Math.max(0,f.scrollLeft+d*da)),(!c||c&&h)&&S(b),e.wheelStartX=
121
- null)}}function ma(a,b){var c=a[b];a.sort(function(a,b){return x(a.from(),b.from())});b=N(a,c);for(c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=x(e.to(),d.from())){var f=mc(e.from(),d.from()),g=lc(e.to(),d.to());d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new y(d?g:f,d?f:g))}}return new ea(a,b)}function ya(a,b){return new ea([new y(a,b||a)],0)}function Ea(a){return a.text?r(a.from.line+a.text.length-1,A(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function ff(a,
122
- b){if(0>x(a,b.from))return a;if(0>=x(a,b.to))return Ea(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Ea(b).ch-b.to.ch);return r(c,d)}function Hd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new y(ff(e.anchor,b),ff(e.head,b)))}return ma(c,a.sel.primIndex)}function gf(a,b,c){return a.line==b.line?r(c.line,a.ch-b.ch+c.ch):r(c.line+(a.line-b.line),a.ch)}function Id(a){a.doc.mode=fd(a.options,a.doc.modeOption);Nb(a)}function Nb(a){a.doc.iter(function(a){a.stateAfter&&
123
- (a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;Lb(a,100);a.state.modeGen++;a.curOp&&W(a)}function hf(a,b){return 0==b.from.ch&&0==b.to.ch&&""==A(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Jd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);ee(a);fe(a,e);c=d?d(a):1;c!=a.height&&oa(a,c);P(a,"change",a,b)}function f(a,b){for(var e=[],f=a;f<b;++f)e.push(new jb(k[f],
124
- c?c[f]:null,d));return e}var g=b.from,h=b.to,k=b.text,l=t(a,g.line),m=t(a,h.line),p=A(k),n=c?c[k.length-1]:null,q=h.line-g.line;b.full?(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):hf(a,b)?(h=f(0,k.length-1),e(m,m.text,n),q&&a.remove(g.line,q),h.length&&a.insert(g.line,h)):l==m?1==k.length?e(l,l.text.slice(0,g.ch)+p+l.text.slice(h.ch),n):(q=f(1,k.length-1),q.push(new jb(p+l.text.slice(h.ch),n,d)),e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),a.insert(g.line+1,q)):1==k.length?(e(l,l.text.slice(0,
125
- g.ch)+k[0]+m.text.slice(h.ch),c?c[0]:null),a.remove(g.line+1,q)):(e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),e(m,p+m.text.slice(h.ch),n),n=f(1,k.length-1),1<q&&a.remove(g.line+1,q-1),a.insert(g.line+1,n));P(a,"change",a,b)}function Za(a,b,c){function d(a,f,g){if(a.linked)for(var e=0;e<a.linked.length;++e){var k=a.linked[e];if(k.doc!=f){var l=g&&k.sharedHist;if(!c||l)b(k.doc,l),d(k.doc,a,l)}}}d(a,null,!0)}function jf(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;xd(a);
126
- Id(a);kf(a);a.options.lineWrapping||bd(a);a.options.mode=b.modeOption;W(a)}function kf(a){("rtl"==a.doc.direction?Ia:Va)(a.display.lineDiv,"CodeMirror-rtl")}function Lg(a){Z(a,function(){kf(a);W(a)})}function Dc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Kd(a,b){var c={from:Yc(b.from),to:Ea(b),text:Ka(a,b.from,b.to)};lf(a,c,b.from.line,
127
- b.to.line+1);Za(a,function(a){return lf(a,c,b.from.line,b.to.line+1)},!0);return c}function mf(a){for(;a.length;)if(A(a).ranges)a.pop();else break}function nf(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g;if(g=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(e.lastOp==d){mf(e.done);var h=A(e.done)}else e.done.length&&!A(e.done).ranges?h=A(e.done):1<e.done.length&&!e.done[e.done.length-
128
- 2].ranges?(e.done.pop(),h=A(e.done)):h=void 0;g=h}if(g){var k=A(h.changes);0==x(b.from,b.to)&&0==x(b.from,k.to)?k.to=Ea(b):h.changes.push(Kd(a,b))}else for((h=A(e.done))&&h.ranges||Ec(a.sel,e.done),h={changes:[Kd(a,b)],generation:e.generation},e.done.push(h);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;k||G(a,"historyAdded")}function Ec(a,
129
- b){var c=A(b);c&&c.ranges&&c.equals(a)||b.push(a)}function lf(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=d.markedSpans);++f})}function Mg(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function of(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(Mg(c[e]));c=d}else c=null;
130
- d=Zc(a,b);if(!c)return d;if(!d)return c;for(e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g){var h=0;a:for(;h<g.length;++h){for(var k=g[h],l=0;l<f.length;++l)if(f[l].marker==k.marker)continue a;f.push(k)}}else g&&(c[e]=g)}return c}function kb(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?ea.prototype.deepCopy.call(f):f);else{f=f.changes;var g=[];d.push({changes:g});for(var h=0;h<f.length;++h){var k=f[h],l;g.push({from:k.from,to:k.to,text:k.text});if(b)for(var m in k)(l=m.match(/^spans_(\d+)$/))&&
131
- -1<N(b,Number(l[1]))&&(A(g)[m]=k[m],delete k[m])}}}return d}function Ld(a,b,c,d){return d?(a=a.anchor,c&&(d=0>x(b,a),d!=0>x(c,a)?(a=b,b=c):d!=0>x(b,c)&&(b=c)),new y(a,b)):new y(c||b,b)}function Fc(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));Q(a,new ea([Ld(a.sel.primary(),b,c,e)],0),d)}function pf(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;f<a.sel.ranges.length;f++)d[f]=Ld(a.sel.ranges[f],b[f],null,e);b=ma(d,a.sel.primIndex);Q(a,b,c)}function Md(a,b,c,d){var e=
132
- a.sel.ranges.slice(0);e[b]=c;Q(a,ma(e,a.sel.primIndex),d)}function Ng(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var d=0;d<b.length;d++)this.ranges[d]=new y(v(a,b[d].anchor),v(a,b[d].head))},origin:c&&c.origin};G(a,"beforeSelectionChange",a,c);a.cm&&G(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?ma(c.ranges,c.ranges.length-1):b}function qf(a,b,c){var d=a.history.done,e=A(d);e&&e.ranges?(d[d.length-1]=b,Gc(a,b,c)):Q(a,b,c)}function Q(a,b,c){Gc(a,b,c);b=a.sel;
133
- var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=A(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:Ec(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&mf(e.undone)}function Gc(a,
134
- b,c){if(ha(a,"beforeSelectionChange")||a.cm&&ha(a.cm,"beforeSelectionChange"))b=Ng(a,b,c);var d=c&&c.bias||(0>x(b.primary().head,a.sel.primary().head)?-1:1);rf(a,sf(a,b,d,!0));c&&!1===c.scroll||!a.cm||hb(a.cm)}function rf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,je(a.cm)),P(a,"cursorActivity",a))}function tf(a){rf(a,sf(a,a.sel,null,!1))}function sf(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&
135
- a.sel.ranges[f],k=Nd(a,g.anchor,h&&h.anchor,c,d);h=Nd(a,g.head,h&&h.head,c,d);if(e||k!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new y(k,h)}return e?ma(e,b.primIndex):b}function lb(a,b,c,d,e){var f=t(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker;if((null==h.from||(k.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(k.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(G(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;
136
- continue}else break;if(k.atomic){if(c){g=k.find(0>d?1:-1);h=void 0;if(0>d?k.inclusiveRight:k.inclusiveLeft)g=uf(a,g,-d,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=x(g,c))&&(0>d?0>h:0<h))return lb(a,g,b,d,e)}c=k.find(0>d?-1:1);if(0>d?k.inclusiveLeft:k.inclusiveRight)c=uf(a,c,d,c.line==b.line?f:null);return c?lb(a,c,b,d,e):null}}}return b}function Nd(a,b,c,d,e){d=d||1;b=lb(a,b,c,d,e)||!e&&lb(a,b,c,d,!0)||lb(a,b,c,-d,e)||!e&&lb(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,r(a.first,0))}function uf(a,
137
- b,c,d){return 0>c&&0==b.ch?b.line>a.first?v(a,r(b.line-1)):null:0<c&&b.ch==(d||t(a,b.line)).text.length?b.line<a.first+a.size-1?r(b.line+1,0):null:new r(b.line,b.ch+c)}function vf(a){a.setSelection(r(a.firstLine(),0),r(a.lastLine()),sa)}function wf(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,g,h){b&&(d.from=v(a,b));c&&(d.to=v(a,c));g&&(d.text=g);void 0!==h&&(d.origin=h)});G(a,"beforeChange",a,d);a.cm&&
138
- G(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function mb(a,b,c){if(a.cm){if(!a.cm.curOp)return L(a.cm,mb)(a,b,c);if(a.cm.state.suppressEdits)return}if(ha(a,"beforeChange")||a.cm&&ha(a.cm,"beforeChange"))if(b=wf(a,b,!0),!b)return;if(c=xf&&!c&&mg(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)yf(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text,origin:b.origin});else yf(a,b)}function yf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=x(b.from,b.to)){var c=
139
- Hd(a,b);nf(a,b,c,a.cm?a.cm.curOp.id:NaN);Ob(a,b,c,Zc(a,b));var d=[];Za(a,function(a,c){c||-1!=N(d,a.history)||(zf(a.history,b),d.push(a.history));Ob(a,b,null,Zc(a,b))})}}function Hc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,k=0;k<g.length&&(e=g[k],c?!e.ranges||e.equals(a.sel):e.ranges);k++);if(k!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=g.pop(),e.ranges){Ec(e,h);if(c&&!e.equals(a.sel)){Q(a,e,{clearRedo:!1});
140
- return}f=e}else break;var l=[];Ec(f,h);h.push({changes:l,generation:d.generation});d.generation=e.generation||++d.maxGeneration;var m=ha(a,"beforeChange")||a.cm&&ha(a.cm,"beforeChange");c=function(d){var c=e.changes[d];c.origin=b;if(m&&!wf(a,c,!1))return g.length=0,{};l.push(Kd(a,c));var f=d?Hd(a,c):A(g);Ob(a,c,f,of(a,c));!d&&a.cm&&a.cm.scrollIntoView({from:c.from,to:Ea(c)});var h=[];Za(a,function(a,b){b||-1!=N(h,a.history)||(zf(a.history,c),h.push(a.history));Ob(a,c,null,of(a,c))})};for(d=e.changes.length-
141
- 1;0<=d;--d)if(f=c(d))return f.v}}}function Af(a,b){if(0!=b&&(a.first+=b,a.sel=new ea(jc(a.sel.ranges,function(a){return new y(r(a.anchor.line+b,a.anchor.ch),r(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){W(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)Da(a.cm,d,"gutter")}}function Ob(a,b,c,d){if(a.cm&&!a.cm.curOp)return L(a.cm,Ob)(a,b,c,d);if(b.to.line<a.first)Af(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=
142
- b.text.length-1-(a.first-b.from.line);Af(a,e);b={from:r(a.first,0),to:r(b.to.line+e,b.to.ch),text:[A(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:r(e,t(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Ka(a,b.from,b.to);c||(c=Hd(a,b));a.cm?Og(a.cm,b,d):Jd(a,b,d);Gc(a,c,sa)}}function Og(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=B(pa(t(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,
143
- b.to)&&je(a);Jd(d,b,c,Oe(a));a.options.lineWrapping||(d.iter(k,f.line+b.text.length,function(a){var b=oc(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));tg(d,f.line);Lb(a,400);c=b.text.length-(g.line-f.line)-1;b.full?W(a):f.line!=g.line||1!=b.text.length||hf(a.doc,b)?W(a,f.line,g.line+1,c):Da(a,f.line,"text");c=ha(a,"changes");if((d=ha(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&P(a,"change",a,b),
144
- c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function nb(a,b,c,d,e){d||(d=c);if(0>x(d,c)){var f=[d,c];c=f[0];d=f[1];f}"string"==typeof b&&(b=a.splitLines(b));mb(a,{from:c,to:d,text:b,origin:e})}function Bf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Cf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++)Bf(f.ranges[g].anchor,b,c,d),Bf(f.ranges[g].head,
145
- b,c,d);else{for(var h=0;h<f.changes.length;++h){var k=f.changes[h];if(c<k.from.line)k.from=r(k.from.line+d,k.from.ch),k.to=r(k.to.line+d,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function zf(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Cf(a.done,c,d,e);Cf(a.undone,c,d,e)}function Pb(a,b,c,d){var e=b,f=b;"number"==typeof b?f=t(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=B(b);if(null==e)return null;d(f,e)&&a.cm&&Da(a.cm,e,c);return f}function Qb(a){this.lines=
146
- a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function Rb(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;this.parent=null}function Pg(a,b,c,d){var e=new Sb(a,c,d),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);Pb(a,b,"widget",function(b){var d=b.widgets||(b.widgets=[]);null==e.insertAt?d.push(e):d.splice(Math.min(d.length-1,Math.max(0,e.insertAt)),0,e);e.line=
147
- b;f&&!Na(a,b)&&(d=qa(b)<a.scrollTop,oa(b,b.height+Eb(e)),d&&yc(f,e.height),f.curOp.forceUpdate=!0);return!0});P(f,"lineWidgetAdded",f,e,"number"==typeof b?b:B(b));return e}function ob(a,b,c,d,e){if(d&&d.shared)return Qg(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return L(a.cm,ob)(a,b,c,d,e);var f=new Fa(a,e);e=x(b,c);d&&Ja(d,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=cb("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events",
148
- "true"),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(he(a,b.line,b,c,f)||b.line!=c.line&&he(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");Ba=!0}f.addToHistory&&nf(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&pa(a)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&oa(a,0);var d=new nc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=
149
- a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,c.line+1,function(b){Na(a,b)&&oa(b,0)});f.clearOnEnter&&w(f,"beforeCursorEnter",function(){return f.clear()});f.readOnly&&(xf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++Df,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)W(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)Da(h,d,
150
- "text");f.atomic&&tf(h.doc);P(h,"markerAdded",h,f)}return f}function Qg(a,b,c,d,e){d=Ja(d);d.shared=!1;var f=[ob(a,b,c,d,e)],g=f[0],h=d.widgetNode;Za(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(ob(a,v(a,b),v(a,c),d,e));for(var k=0;k<a.linked.length;++k)if(a.linked[k].isParent)return;g=A(f)});return new Tb(f,g)}function Ef(a){return a.findMarks(r(a.first,0),a.clipPos(r(a.lastLine())),function(a){return a.parent})}function Rg(a){for(var b=function(b){b=a[b];var d=[b.primary.doc];Za(b.primary.doc,
151
- function(a){return d.push(a)});for(var c=0;c<b.markers.length;c++){var g=b.markers[c];-1==N(d,g.doc)&&(g.parent=null,b.markers.splice(c--,1))}},c=0;c<a.length;c++)b(c)}function Sg(a){var b=this;Ff(b);if(!K(b,a)&&!xa(b.display,a)){S(a);z&&(Gf=+new Date);var c=Ua(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=N(b.options.allowDropFileTypes,a.type)){var h=new FileReader;
152
- h.onload=L(b,function(){var a=h.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");f[d]=a;++g==e&&(c=v(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"},mb(b.doc,a),qf(b.doc,ya(c,Ea(a))))});h.readAsText(a)}},k=0;k<e;++k)h(d[k],k);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(h=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&
153
- (k=b.listSelections());Gc(b.doc,ya(c,c));if(k)for(d=0;d<k.length;++d)nb(b.doc,"",k[d].anchor,k[d].head,"drag");b.replaceSelection(h,"around","paste");b.display.input.focus()}}catch(l){}}}function Ff(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function Hf(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Tg(){var a;w(window,"resize",
154
- function(){null==a&&(a=setTimeout(function(){a=null;Hf(Ug)},100))});w(window,"blur",function(){return Hf(Ib)})}function Ug(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function Vg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=
155
- !0;else if(/^s(hift)?$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function Wg(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var e=jc(c.split(" "),Vg),f=0;f<e.length;f++){if(f==e.length-1){var g=e.join(" ");var h=d}else g=e.slice(0,f+1).join(" "),h="...";var k=b[g];if(!k)b[g]=h;else if(k!=h)throw Error("Inconsistent bindings for "+
156
- g);}delete a[c]}}for(var l in b)a[l]=b[l];return a}function pb(a,b,c,d){b=Ic(b);var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return pb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=pb(a,b.fallthrough[e],c,d);if(f)return f}}}function If(a){a="string"==typeof a?a:Ga[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Jf(a,
157
- b,c){var d=a;b.altKey&&"Alt"!=d&&(a="Alt-"+a);(Kf?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a);(Kf?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a);!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a);return a}function Lf(a,b){if(la&&34==a.keyCode&&a["char"])return!1;var c=Ga[a.keyCode];return null==c||a.altGraphKey?!1:Jf(c,a,b)}function Ic(a){return"string"==typeof a?Ub[a]:a}function qb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=x(f.from,A(d).to);){var g=d.pop();
158
- if(0>x(g.from,f.from)){f.from=g.from;break}}d.push(f)}Z(a,function(){for(var b=d.length-1;0<=b;b--)nb(a.doc,"",d[b].from,d[b].to,"+delete");hb(a)})}function Od(a,b,c){b=be(a.text,b+c,c);return 0>b||b>a.text.length?null:b}function Pd(a,b,c){a=Od(a,b.ch,c);return null==a?null:new r(b.line,a,0>c?"after":"before")}function Qd(a,b,c,d,e){if(a&&(a=ua(c,b.doc.direction))){a=0>e?A(a):a[0];var f=0>e==(1==a.level)?"after":"before";if(0<a.level){var g=Ra(b,c);var h=0>e?c.text.length-1:0;var k=ja(b,g,h).top;
159
- h=tb(function(a){return ja(b,g,a).top==k},0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=Od(c,h,1))}else h=0>e?a.to:a.from;return new r(d,h,f)}return new r(d,0>e?c.text.length:0,0>e?"before":"after")}function Xg(a,b,c,d){var e=ua(b,a.doc.direction);if(!e)return Pd(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):0>=c.ch&&(c.ch=0,c.sticky="after");var f=xb(e,c.ch,c.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0<d?g.to>c.ch:g.from<c.ch))return Pd(b,c,d);var h=function(a,
160
- d){return Od(b,a instanceof r?a.ch:a,d)},k,l=function(d){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};k=k||Ra(a,b);return ud(a,b,k,d)},m=l("before"==c.sticky?h(c,-1):c.ch);if("rtl"==a.doc.direction||1==g.level){var p=1==g.level==0>d,n=h(c,p?1:-1);if(null!=n&&(p?n<=g.to&&n<=m.end:n>=g.from&&n>=m.begin))return new r(c.line,n,p?"before":"after")}g=function(a,b,d){for(var f=function(a,b){return b?new r(c.line,h(a,1),"before"):new r(c.line,a,"after")};0<=a&&a<e.length;a+=b){var g=e[a],
161
- k=0<b==(1!=g.level),l=k?d.begin:h(d.end,-1);if(g.from<=l&&l<g.to)return f(l,k);l=k?g.from:h(g.to,-1);if(d.begin<=l&&l<d.end)return f(l,k)}};if(f=g(f+d,d,m))return f;m=0<d?m.end:h(m.begin,-1);return null==m||0<d&&m==b.text.length||!(f=g(0<d?0:e.length-1,d,l(m)))?null:f}function Mf(a,b){var c=t(a.doc,b),d=pa(c);d!=c&&(b=B(d));return Qd(!0,a,d,b,1)}function Nf(a,b){var c=Mf(a,b.line),d=t(a.doc,c.line),e=ua(d,a.doc.direction);return e&&0!=e[0].level?c:(d=Math.max(0,d.text.search(/\S/)),r(c.line,b.line==
162
- c.line&&b.ch<=d&&b.ch?0:d,c.sticky))}function Jc(a,b,c){if("string"==typeof b&&(b=Vb[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Kc}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Yg(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=pb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&pb(b,a.options.extraKeys,c,a)||pb(b,a.options.keyMap,c,a)}function Wb(a,
163
- b,c,d){var e=a.state.keySeq;if(e){if(If(b))return"handled";Zg.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});b=e+" "+b}d=Yg(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&P(a,"keyHandled",a,b,c);if("handled"==d||"multi"==d)S(c),yd(a);return e&&!d&&/\'$/.test(b)?(S(c),!0):!!d}function Of(a,b){var c=Lf(b,!0);return c?b.shiftKey&&!a.state.keySeq?Wb(a,"Shift-"+c,b,function(b){return Jc(a,b,!0)})||Wb(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):
164
- b.motion)return Jc(a,b)}):Wb(a,c,b,function(b){return Jc(a,b)}):!1}function $g(a,b,c){return Wb(a,"'"+c+"'",b,function(b){return Jc(a,b,!0)})}function Pf(a){this.curOp.focus=ta();if(!K(this,a)){z&&11>E&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Of(this,a);la&&(Rd=c?b:null,!c&&88==b&&!ah&&(ia?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||bh(this)}}function bh(a){function b(a){18!=
165
- a.keyCode&&a.altKey||(Va(c,"CodeMirror-crosshair"),ca(document,"keyup",b),ca(document,"mouseover",b))}var c=a.display.lineDiv;Ia(c,"CodeMirror-crosshair");w(document,"keyup",b);w(document,"mouseover",b)}function Qf(a){16==a.keyCode&&(this.doc.sel.shift=!1);K(this,a)}function Rf(a){if(!(xa(this.display,a)||K(this,a)||a.ctrlKey&&!a.altKey||ia&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(la&&b==Rd)Rd=null,S(a);else if(!la||a.which&&!(10>a.which)||!Of(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=
166
- b&&!$g(this,a,b))this.display.input.onKeyPress(a)}}function ch(a,b){var c=+new Date;if(Xb&&Xb.compare(c,a,b))return Yb=Xb=null,"triple";if(Yb&&Yb.compare(c,a,b))return Xb=new Sd(c,a,b),Yb=null,"double";Yb=new Sd(c,a,b);Xb=null;return"single"}function Sf(a){var b=this.display;if(!(K(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,xa(b,a))R||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Lc(this,a,"gutterClick",
167
- !0)){var c=Ua(this,a),d=le(a),e=c?ch(c,d):"single";window.focus();1==d&&this.state.selectingText&&this.state.selectingText(a);c&&dh(this,d,c,e,a)||(1==d?c?eh(this,c,e,a):(a.target||a.srcElement)==b.scroller&&S(a):2==d?(c&&Fc(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(Td?Tf(this,a):Se(this)))}}function dh(a,b,c,d,e){var f="Click";"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f);return Wb(a,Jf((1==b?"Left":2==b?"Middle":"Right")+f,e),e,function(b){"string"==typeof b&&
168
- (b=Vb[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Kc}finally{a.state.suppressEdits=!1}return d})}function eh(a,b,c,d){z?setTimeout(Qc(Re,a),0):a.curOp.focus=ta();var e=a.getOption("configureMouse");e=e?e(a,c,d):{};null==e.unit&&(e.unit=(fh?d.shiftKey&&d.metaKey:d.altKey)?"rectangle":"single"==c?"char":"double"==c?"word":"line");if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||d.shiftKey;null==e.addNew&&(e.addNew=ia?d.metaKey:d.ctrlKey);null==e.moveOnDrag&&
169
- (e.moveOnDrag=!(ia?d.altKey:d.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&gh&&!a.isReadOnly()&&"single"==c&&-1<(g=f.contains(b))&&(0>x((g=f.ranges[g]).from(),b)||0<b.xRel)&&(0<x(g.to(),b)||0>b.xRel)?hh(a,d,b,e):ih(a,d,b,e)}function hh(a,b,c,d){var e=a.display,f=!1,g=L(a,function(b){R&&(e.scroller.draggable=!1);a.state.draggingText=!1;ca(document,"mouseup",g);ca(document,"mousemove",h);ca(e.scroller,"dragstart",k);ca(e.scroller,"drop",g);f||(S(b),d.addNew||Fc(a.doc,c,null,null,d.extend),R||z&&
170
- 9==E?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())}),h=function(a){f=f||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},k=function(){return f=!0};R&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();w(document,"mouseup",g);w(document,"mousemove",h);w(e.scroller,"dragstart",k);w(e.scroller,"drop",g);Se(a);setTimeout(function(){return e.input.focus()},20)}function Uf(a,b,c){if("char"==
171
- c)return new y(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new y(r(b.line,0),v(a.doc,r(b.line+1,0)));a=c(a,b);return new y(a.from,a.to)}function ih(a,b,c,d){function e(b){if(0!=x(q,b))if(q=b,"rectangle"==d.unit){var e=[],f=a.options.tabSize,g=fa(t(k,c.line).text,c.ch,f),h=fa(t(k,b.line).text,b.ch,f),m=Math.min(g,h);g=Math.max(g,h);h=Math.min(c.line,b.line);for(var C=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=C;h++){var u=t(k,h).text,w=Rc(u,m,f);m==g?e.push(new y(r(h,w),r(h,
172
- w))):u.length>w&&e.push(new y(r(h,w),r(h,Rc(u,g,f))))}e.length||e.push(new y(c,c));Q(k,ma(l.ranges.slice(0,p).concat(e),p),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else e=n,m=Uf(a,b,d.unit),b=e.anchor,0<x(m.anchor,b)?(f=m.head,b=mc(e.from(),m.anchor)):(f=m.anchor,b=lc(e.to(),m.head)),e=l.ranges.slice(0),e[p]=jh(a,new y(v(k,b),f)),Q(k,ma(e,p),Ud)}function f(b){var c=++u,g=Ua(a,b,!0,"rectangle"==d.unit);if(g)if(0!=x(g,q)){a.curOp.focus=ta();e(g);var l=Ad(h,k);(g.line>=l.to||g.line<l.from)&&
173
- setTimeout(L(a,function(){u==c&&f(b)}),150)}else{var m=b.clientY<C.top?-20:b.clientY>C.bottom?20:0;m&&setTimeout(L(a,function(){u==c&&(h.scroller.scrollTop+=m,f(b))}),50)}}function g(b){a.state.selectingText=!1;u=Infinity;S(b);h.input.focus();ca(document,"mousemove",z);ca(document,"mouseup",A);k.history.lastSelOrigin=null}var h=a.display,k=a.doc;S(b);var l=k.sel,m=l.ranges;if(d.addNew&&!d.extend){var p=k.sel.contains(c);var n=-1<p?m[p]:new y(c,c)}else n=k.sel.primary(),p=k.sel.primIndex;"rectangle"==
174
- d.unit?(d.addNew||(n=new y(c,c)),c=Ua(a,b,!0,!0),p=-1):(b=Uf(a,c,d.unit),n=d.extend?Ld(n,b.anchor,b.head,d.extend):b);d.addNew?-1==p?(p=m.length,Q(k,ma(m.concat([n]),p),{scroll:!1,origin:"*mouse"})):1<m.length&&m[p].empty()&&"char"==d.unit&&!d.extend?(Q(k,ma(m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),l=k.sel):Md(k,p,n,Ud):(p=0,Q(k,new ea([n],0),Ud),l=k.sel);var q=c,C=h.wrapper.getBoundingClientRect(),u=0,z=L(a,function(a){le(a)?f(a):g(a)}),A=L(a,g);a.state.selectingText=A;w(document,
175
- "mousemove",z);w(document,"mouseup",A)}function jh(a,b){var c=b.anchor,d=b.head,e=t(a.doc,c.line);if(0==x(c,d)&&c.sticky==d.sticky)return b;e=ua(e);if(!e)return b;var f=xb(e,c.ch,c.sticky),g=e[f];if(g.from!=c.ch&&g.to!=c.ch)return b;var h=f+(g.from==c.ch==(1!=g.level)?0:1);if(0==h||h==e.length)return b;if(d.line!=c.line)var k=0<(d.line-c.line)*("ltr"==a.doc.direction?1:-1);else k=xb(e,d.ch,d.sticky),f=k-f||(d.ch-c.ch)*(1==g.level?-1:1),k=k==h-1||k==h?0>f:0<f;e=e[h+(k?-1:0)];e=(h=k==(1==e.level))?
176
- e.from:e.to;h=h?"after":"before";return c.ch==e&&c.sticky==h?b:new y(new r(c.line,e,h),d)}function Lc(a,b,c,d){if(b.touches){var e=b.touches[0].clientX;var f=b.touches[0].clientY}else try{e=b.clientX,f=b.clientY}catch(k){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&S(b);d=a.display;var g=d.lineDiv.getBoundingClientRect();if(f>g.bottom||!ha(a,c))return cd(b);f-=g.top-d.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=d.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=
177
- e)return e=La(a.doc,f),G(a,c,a,e,a.options.gutters[g],b),cd(b)}}function Tf(a,b){var c;(c=xa(a.display,b))||(c=ha(a,"gutterContextMenu")?Lc(a,b,"gutterContextMenu",!1):!1);if(!c&&!K(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function Vf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Gb(a)}function Zb(a){cf(a);W(a);Ue(a)}function kh(a,b,c){!b!=!(c&&c!=rb)&&(c=a.display.dragFunctions,b=b?w:ca,b(a.display.scroller,
178
- "dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,"drop",c.drop))}function lh(a){a.options.lineWrapping?(Ia(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Va(a.display.wrapper,"CodeMirror-wrap"),bd(a));xd(a);W(a);Gb(a);setTimeout(function(){return ib(a)},100)}function F(a,b){var c=this;if(!(this instanceof F))return new F(a,b);this.options=
179
- b=b?Ja(b):{};Ja(Wf,b,!1);Gd(b);var d=b.value;"string"==typeof d&&(d=new X(d,b.mode,null,b.lineSeparator,b.direction));this.doc=d;var e=new F.inputStyles[b.inputStyle](this);e=this.display=new lg(a,d,e);e.wrapper.CodeMirror=this;cf(this);Vf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Ze(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new $a,
180
- keySeq:null,specialChars:null};b.autofocus&&!ub&&e.input.focus();z&&11>E&&setTimeout(function(){return c.display.input.reset(!0)},20);mh(this);Xf||(Tg(),Xf=!0);Xa(this);this.curOp.forceUpdate=!0;jf(this,d);b.autofocus&&!ub||this.hasFocus()?setTimeout(Qc(zd,this),20):Ib(this);for(var f in Mc)if(Mc.hasOwnProperty(f))Mc[f](c,b[f],rb);Ve(this);b.finishInit&&b.finishInit(this);for(d=0;d<Vd.length;++d)Vd[d](c);Ya(this);R&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&
181
- (e.lineDiv.style.textRendering="auto")}function mh(a){function b(){d.activeTouch&&(e=setTimeout(function(){return d.activeTouch=null},1E3),f=d.activeTouch,f.end=+new Date)}function c(a,b){if(null==b.left)return!0;var d=b.left-a.left,c=b.top-a.top;return 400<d*d+c*c}var d=a.display;w(d.scroller,"mousedown",L(a,Sf));z&&11>E?w(d.scroller,"dblclick",L(a,function(b){if(!K(a,b)){var d=Ua(a,b);!d||Lc(a,b,"gutterClick",!0)||xa(a.display,b)||(S(b),b=a.findWordAt(d),Fc(a.doc,b.anchor,b.head))}})):w(d.scroller,
182
- "dblclick",function(b){return K(a,b)||S(b)});Td||w(d.scroller,"contextmenu",function(b){return Tf(a,b)});var e,f={end:0};w(d.scroller,"touchstart",function(b){var c;if(c=!K(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&!Lc(a,b,"gutterClick",!0)&&(d.input.ensurePolled(),clearTimeout(e),c=+new Date,d.activeTouch={start:c,moved:!1,prev:300>=c-f.end?f:null},1==b.touches.length&&(d.activeTouch.left=b.touches[0].pageX,d.activeTouch.top=b.touches[0].pageY))});w(d.scroller,
183
- "touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});w(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!xa(d,e)&&null!=f.left&&!f.moved&&300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page");f=!f.prev||c(f,f.prev)?new y(g,g):!f.prev.prev||c(f,f.prev.prev)?a.findWordAt(g):new y(r(g.line,0),v(a.doc,r(g.line+1,0)));a.setSelection(f.anchor,f.head);a.focus();S(e)}b()});w(d.scroller,"touchcancel",b);w(d.scroller,"scroll",function(){d.scroller.clientHeight&&(Kb(a,d.scroller.scrollTop),
184
- Wa(a,d.scroller.scrollLeft,!0),G(a,"scroll",a))});w(d.scroller,"mousewheel",function(b){return ef(a,b)});w(d.scroller,"DOMMouseScroll",function(b){return ef(a,b)});w(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(b){K(a,b)||zb(b)},over:function(b){if(!K(a,b)){var d=Ua(a,b);if(d){var c=document.createDocumentFragment();Qe(a,d,c);a.display.dragCursor||(a.display.dragCursor=u("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,
185
- a.display.cursorDiv));ba(a.display.dragCursor,c)}zb(b)}},start:function(b){if(z&&(!a.state.draggingText||100>+new Date-Gf))zb(b);else if(!K(a,b)&&!xa(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Yf)){var d=u("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";la&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop);
186
- b.dataTransfer.setDragImage(d,0,0);la&&d.parentNode.removeChild(d)}},drop:L(a,Sg),leave:function(b){K(a,b)||Ff(a)}};var g=d.input.getField();w(g,"keyup",function(b){return Qf.call(a,b)});w(g,"keydown",L(a,Pf));w(g,"keypress",L(a,Rf));w(g,"focus",function(b){return zd(a,b)});w(g,"blur",function(b){return Ib(a,b)})}function $b(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(e.mode.indent?f=Ab(a,b).state:c="prev");var g=a.options.tabSize,h=t(e,b),k=fa(h.text,null,g);h.stateAfter&&(h.stateAfter=
187
- null);var l=h.text.match(/^\s*/)[0];if(!d&&!/\S/.test(h.text)){var m=0;c="not"}else if("smart"==c&&(m=e.mode.indent(f,h.text.slice(l.length),h.text),m==Kc||150<m)){if(!d)return;c="prev"}"prev"==c?m=b>e.first?fa(t(e,b-1).text,null,g):0:"add"==c?m=k+a.options.indentUnit:"subtract"==c?m=k-a.options.indentUnit:"number"==typeof c&&(m=k+c);m=Math.max(0,m);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)d+=g,c+="\t";d<m&&(c+=Sc(m-d));if(c!=l)return nb(e,c,r(b,0),r(b,l.length),"+input"),
188
- h.stateAfter=null,!0;for(g=0;g<e.sel.ranges.length;g++)if(h=e.sel.ranges[g],h.head.line==b&&h.head.ch<l.length){b=r(b,l.length);Md(e,g,new y(b,b));break}}function Wd(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Xd(b),k=null;if(g&&1<d.ranges.length)if(aa&&aa.text.join("\n")==b){if(0==d.ranges.length%aa.text.length){k=[];for(var l=0;l<aa.text.length;l++)k.push(f.splitLines(aa.text[l]))}}else h.length==d.ranges.length&&a.options.pasteLinesPerSelection&&
189
- (k=jc(h,function(a){return[a]}));for(l=d.ranges.length-1;0<=l;l--){var m=d.ranges[l];var p=m.from(),n=m.to();m.empty()&&(c&&0<c?p=r(p.line,p.ch-c):a.state.overwrite&&!g?n=r(n.line,Math.min(t(f,n.line).text.length,n.ch+A(h).length)):aa&&aa.lineWise&&aa.text.join("\n")==b&&(p=n=r(p.line,0)));m=a.curOp.updateInput;p={from:p,to:n,text:k?k[l%k.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};mb(a.doc,p);P(a,"inputRead",a,p)}b&&!g&&Zf(a,b);hb(a);a.curOp.updateInput=m;a.curOp.typing=!0;
190
- a.state.pasteIncoming=a.state.cutIncoming=!1}function $f(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||Z(b,function(){return Wd(b,c,0,null,"paste")}),!0}function Zf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<
191
- b.indexOf(f.electricChars.charAt(h))){g=$b(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(t(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=$b(a,e.head.line,"smart"));g&&P(a,"electricInput",a,e.head.line)}}}function ag(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line;e={anchor:r(e,0),head:r(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function bg(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize",
192
- "off");a.setAttribute("spellcheck",!!b)}function cg(){var a=u("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),b=u("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");R?a.style.width="1000px":a.setAttribute("wrap","off");ac&&(a.style.border="1px solid black");bg(a);return b}function Yd(a,b,c,d,e){function f(d){var f=e?Xg(a.cm,k,b,c):Pd(k,b,c);if(null==f){if(d=!d)d=b.line+c,d<a.first||d>=a.first+a.size?d=!1:(b=
193
- new r(d,b.ch,b.sticky),d=k=t(a,d));if(d)b=Qd(e,a.cm,k,b.line,c);else return!1}else b=f;return!0}var g=b,h=c,k=t(a,b.line);if("char"==d)f();else if("column"==d)f(!0);else if("word"==d||"group"==d){var l=null;d="group"==d;for(var m=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||f(!p);p=!1){var n=k.text.charAt(b.ch)||"\n";n=kc(n,m)?"w":d&&"\n"==n?"n":!d||/\s/.test(n)?null:"p";!d||p||n||(n="s");if(l&&l!=n){0>c&&(c=1,f(),b.sticky="after");break}n&&(l=n);if(0<c&&!f(!p))break}}h=Nd(a,b,g,h,!0);Xc(g,h)&&
194
- (h.hitSide=!0);return h}function dg(a,b,c,d){var e=a.doc,f=b.left;if("page"==d){var g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*Sa(a.display),3);g=(0<c?b.bottom:b.top)+c*g}else"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){b=td(a,f,g);if(!b.outside)break;if(0>c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function eg(a,b){var c=nd(a,b.line);if(!c||c.hidden)return null;var d=t(a.doc,b.line);c=Ee(c,d,b.line);d=ua(d,a.doc.direction);
195
- var e="left";d&&(e=xb(d,b.ch)%2?"right":"left");c=Fe(c.map,b.ch,e);c.offset="right"==c.collapse?c.end:c.start;return c}function nh(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function sb(a,b){b&&(a.bad=!0);return a}function oh(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(a){a&&(l&&(k+=m,l=!1),k+=a)}function h(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)g(c||b.textContent.replace(/\u200b/g,""));else{c=b.getAttribute("cm-marker");
196
- var q;if(c)b=a.findMarks(r(d,0),r(e+1,0),f(+c)),b.length&&(q=b[0].find(0))&&g(Ka(a.doc,q.from,q.to).join(m));else if("false"!=b.getAttribute("contenteditable")){(q=/^(pre|div|p)$/i.test(b.nodeName))&&l&&(k+=m,l=!1);for(c=0;c<b.childNodes.length;c++)h(b.childNodes[c]);q&&(l=!0)}}}else 3==b.nodeType&&g(b.nodeValue)}for(var k="",l=!1,m=a.doc.lineSeparator();;){h(b);if(b==c)break;b=b.nextSibling}return k}function Nc(a,b,c){if(b==a.display.lineDiv){var d=a.display.lineDiv.childNodes[c];if(!d)return sb(a.clipPos(r(a.display.viewTo-
197
- 1)),!0);b=null;c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return ph(f,b,c)}}function ph(a,b,c){function d(b,d,c){for(var e=-1;e<(l?l.length:0);e++)for(var f=0>e?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==d){d=B(0>e?a.line:a.rest[e]);e=f[g]+c;if(0>c||h!=b)e=f[g+(c?1:0)];return r(d,e)}}}var e=a.text.firstChild,f=!1;if(!b||!za(e,
198
- b))return sb(r(B(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?A(a.rest):a.line,sb(r(B(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=a.measure,l=k.maps;if(b=d(g,h,c))return sb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return sb(r(b.line,b.ch-g),f);g+=e.textContent.length}for(h=
199
- h.previousSibling;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return sb(r(b.line,b.ch+c),f);c+=h.textContent.length}}var V=navigator.userAgent,fg=navigator.platform,Aa=/gecko\/\d/i.test(V),gg=/MSIE \d/.test(V),hg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(V),bc=/Edge\/(\d+)/.exec(V),z=gg||hg||bc,E=z&&(gg?document.documentMode||6:+(bc||hg)[1]),R=!bc&&/WebKit\//.test(V),qh=R&&/Qt\/\d+\.\d+/.test(V),tc=!bc&&/Chrome\//.test(V),la=/Opera\//.test(V),Yf=/Apple Computer/.test(navigator.vendor),rh=
200
- /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(V),Hg=/PhantomJS/.test(V),ac=!bc&&/AppleWebKit/.test(V)&&/Mobile\/\w+/.test(V),uc=/Android/.test(V),ub=ac||uc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(V),ia=ac||/Mac/.test(fg),fh=/\bCrOS\b/.test(V),sh=/win/i.test(fg),ab=la&&V.match(/Version\/(\d*\.\d*)/);ab&&(ab=Number(ab[1]));ab&&15<=ab&&(la=!1,R=!0);var Kf=ia&&(qh||la&&(null==ab||12.11>ab)),Td=Aa||z&&9<=E,Va=function(a,b){var c=a.className,d=Ha(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);
201
- a.className=c.slice(0,d.index)+(e?d[1]+e:"")}};var Bb=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var cc=function(a){a.select()};ac?cc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:z&&(cc=function(a){try{a.select()}catch(b){}});var $a=
202
- function(){this.id=null};$a.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Kc={toString:function(){return"CodeMirror.Pass"}},sa={scroll:!1},Ud={origin:"*mouse"},dc={origin:"+move"},ic=[""],jg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,kg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
203
- xf=!1,Ba=!1,yb=null,og=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
204
- 1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,d){this.level=a;this.from=b;this.to=d}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h,k){var l="ltr"==k?"L":"R";if(0==h.length||"ltr"==k&&!c.test(h))return!1;for(var m=h.length,p=[],n=0;n<m;++n)p.push(a(h.charCodeAt(n)));n=0;for(var q=l;n<m;++n){var r=p[n];"m"==r?p[n]=q:q=r}n=0;for(q=l;n<m;++n)r=p[n],"1"==r&&"r"==q?p[n]="n":e.test(r)&&(q=r,"r"==r&&(p[n]="R"));
205
- n=1;for(q=p[0];n<m-1;++n)r=p[n],"+"==r&&"1"==q&&"1"==p[n+1]?p[n]="1":","!=r||q!=p[n+1]||"1"!=q&&"n"!=q||(p[n]=q),q=r;for(n=0;n<m;++n)if(q=p[n],","==q)p[n]="N";else if("%"==q){for(q=n+1;q<m&&"%"==p[q];++q);for(r=n&&"!"==p[n-1]||q<m&&"1"==p[q]?"1":"N";n<q;++n)p[n]=r;n=q-1}n=0;for(q=l;n<m;++n)r=p[n],"L"==q&&"1"==r?p[n]="L":e.test(r)&&(q=r);for(q=0;q<m;++q)if(d.test(p[q])){for(n=q+1;n<m&&d.test(p[n]);++n);r="L"==(q?p[q-1]:l);for(r=r==("L"==(n<m?p[n]:l))?r?"L":"R":l;q<n;++q)p[q]=r;q=n-1}l=[];var t;for(n=
206
- 0;n<m;)if(f.test(p[n])){q=n;for(++n;n<m&&f.test(p[n]);++n);l.push(new b(0,q,n))}else{var u=n;q=l.length;for(++n;n<m&&"L"!=p[n];++n);for(r=u;r<n;)if(g.test(p[r])){u<r&&l.splice(q,0,new b(1,u,r));u=r;for(++r;r<n&&g.test(p[r]);++r);l.splice(q,0,new b(2,u,r));u=r}else++r;u<n&&l.splice(q,0,new b(1,u,n))}1==l[0].level&&(t=h.match(/^\s+/))&&(l[0].from=t[0].length,l.unshift(new b(0,0,t[0].length)));1==A(l).level&&(t=h.match(/\s+$/))&&(A(l).to-=t[0].length,l.push(new b(0,m-t[0].length,m)));return"rtl"==k?
207
- l.reverse():l}}(),pc=[],w=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||pc).concat(c))},gh=function(){if(z&&9>E)return!1;var a=u("div");return"draggable"in a||"dragDrop"in a}(),dd,jd,Xd=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):
208
- (c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},th=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},ah=function(){var a=u("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),pd=null,ed={},eb={},fb={},H=function(a,b,c){this.pos=this.start=
209
- 0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};H.prototype.eol=function(){return this.pos>=this.string.length};H.prototype.sol=function(){return this.pos==this.lineStart};H.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};H.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};H.prototype.eat=function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?
210
- a.test(b):a(b)))return++this.pos,b};H.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};H.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};H.prototype.skipToEnd=function(){this.pos=this.string.length};H.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};H.prototype.backUp=function(a){this.pos-=a};H.prototype.column=function(){this.lastColumnPos<
211
- this.start&&(this.lastColumnValue=fa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?fa(this.string,this.lineStart,this.tabSize):0)};H.prototype.indentation=function(){return fa(this.string,null,this.tabSize)-(this.lineStart?fa(this.string,this.lineStart,this.tabSize):0)};H.prototype.match=function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,
212
- a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}};H.prototype.current=function(){return this.string.slice(this.start,this.pos)};H.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};H.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};var rc=function(a,b){this.state=a;this.lookAhead=b},va=function(a,
213
- b,c,d){this.state=b;this.doc=a;this.line=c;this.maxLookAhead=d||0};va.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};va.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};va.fromSaved=function(a,b,c){return b instanceof rc?new va(a,Oa(a.mode,b.state),c,b.lookAhead):new va(a,Oa(a.mode,b),c)};va.prototype.save=function(a){a=!1!==a?Oa(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?
214
- new rc(a,this.maxLookAhead):a};var se=function(a,b,c){this.start=a.start;this.end=a.pos;this.string=a.current();this.type=b||null;this.state=c},jb=function(a,b,c){this.text=a;fe(this,b);this.height=c?c(this):1};jb.prototype.lineNo=function(){return B(this)};db(jb);var vg={},ug={},gb=null,Cb=null,Ge={left:0,right:0,top:0,bottom:0},Ta,bb=function(a,b,c){this.cm=c;var d=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],
215
- "CodeMirror-hscrollbar");a(d);a(e);w(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});w(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;z&&8>E&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};bb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=Math.max(0,
216
- a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=
217
- !0);return{right:c?d:0,bottom:b?d:0}};bb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};bb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};bb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=ia&&!rh?"12px":"18px";this.horiz.style.pointerEvents=
218
- this.vert.style.pointerEvents="none";this.disableHoriz=new $a;this.disableVert=new $a};bb.prototype.enableZeroWidthBar=function(a,b,c){function d(){var e=a.getBoundingClientRect();("vert"==c?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=a?a.style.pointerEvents="none":b.set(1E3,d)}a.style.pointerEvents="auto";b.set(1E3,d)};bb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};
219
- var ec=function(){};ec.prototype.update=function(){return{bottom:0,right:0}};ec.prototype.setScrollLeft=function(){};ec.prototype.setScrollTop=function(){};ec.prototype.clear=function(){};var $e={"native":bb,"null":ec},Gg=0,Ac=function(a,b,c){var d=a.display;this.viewport=b;this.visible=Ad(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=Pa(a);this.force=c;this.dims=od(a);this.events=[]};Ac.prototype.signal=
220
- function(a,b){ha(a,b)&&this.events.push(arguments)};Ac.prototype.finish=function(){for(var a=0;a<this.events.length;a++)G.apply(null,this.events[a])};var Cc=0,da=null;z?da=-.53:Aa?da=15:tc?da=-.7:Yf&&(da=-1/3);var ea=function(a,b){this.ranges=a;this.primIndex=b};ea.prototype.primary=function(){return this.ranges[this.primIndex]};ea.prototype.equals=function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=
221
- this.ranges[b],d=a.ranges[b];if(!Xc(c.anchor,d.anchor)||!Xc(c.head,d.head))return!1}return!0};ea.prototype.deepCopy=function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new y(Yc(this.ranges[b].anchor),Yc(this.ranges[b].head));return new ea(a,this.primIndex)};ea.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};ea.prototype.contains=function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=x(b,
222
- d.from())&&0>=x(a,d.to()))return c}return-1};var y=function(a,b){this.anchor=a;this.head=b};y.prototype.from=function(){return mc(this.anchor,this.head)};y.prototype.to=function(){return lc(this.anchor,this.head)};y.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};Qb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;ee(f);P(e,
223
- "delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Rb.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,
224
- e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof Qb))&&(c=[],this.collapse(c),this.children=[new Qb(c)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],
225
- f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new Qb(e.lines.slice(b,b+=25)),e.height-=c.height,this.children.splice(++d,0,c),c.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new Rb(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=N(a.parent.children,a);a.parent.children.splice(c+
226
- 1,0,b)}else c=new Rb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};var Sb=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b};Sb.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,
227
- d=B(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=Eb(this);oa(c,Math.max(0,c.height-f));a&&(Z(a,function(){var b=-f;qa(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&yc(a,b);Da(a,d,"widget")}),P(a,"lineWidgetCleared",a,this,d))}};Sb.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=Eb(this)-b;e&&(oa(d,d.height+e),c&&Z(c,function(){c.curOp.forceUpdate=!0;qa(d)<(c.curOp&&c.curOp.scrollTop||
228
- c.doc.scrollTop)&&yc(c,e);P(c,"lineWidgetChanged",c,a,B(d))}))};db(Sb);var Df=0,Fa=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++Df};Fa.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&Xa(a);if(ha(this,"clear")){var c=this.find();c&&P(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=wb(f.markedSpans,this);a&&!this.collapsed?Da(a,B(f),"text"):a&&(null!=g.to&&(d=B(f)),null!=g.from&&(c=B(f)));for(var h=
229
- f,k=void 0,l=f.markedSpans,m=g,p=0;p<l.length;++p)l[p]!=m&&(k||(k=[])).push(l[p]);h.markedSpans=k;null==g.from&&this.collapsed&&!Na(this.doc,f)&&a&&oa(f,Sa(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=pa(this.lines[e]),g=oc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&W(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=
230
- !1,a&&tf(a.doc));a&&P(a,"markerCleared",a,this,c,d);b&&Ya(a);this.parent&&this.parent.clear()}};Fa.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=wb(f.markedSpans,this);if(null!=g.from&&(c=r(b?f:B(f),g.from),-1==a))return c;if(null!=g.to&&(d=r(b?f:B(f),g.to),1==a))return d}return c&&{from:c,to:d}};Fa.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&Z(d,function(){var e=b.line,f=
231
- B(b.line);if(f=nd(d,f))He(f),d.curOp.selectionChanged=d.curOp.forceUpdate=!0;d.curOp.updateMaxLine=!0;Na(c.doc,e)||null==c.height||(f=c.height,c.height=null,(f=Eb(c)-f)&&oa(e,e.height+f));P(d,"markerChanged",d,a)})};Fa.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=N(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Fa.prototype.detachLine=function(a){this.lines.splice(N(this.lines,
232
- a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};db(Fa);var Tb=function(a,b){this.markers=a;this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};Tb.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();P(this,"clear")}};Tb.prototype.find=function(a,b){return this.primary.find(a,b)};db(Tb);var uh=0,X=function(a,b,c,d,e){if(!(this instanceof
233
- X))return new X(a,b,c,d,e);null==c&&(c=0);Rb.call(this,[new Qb([new jb("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=c;c=r(c,0);this.sel=ya(c);this.history=new Dc(null);this.id=++uh;this.modeOption=b;this.lineSep=d;this.direction="rtl"==e?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Jd(this,{from:c,to:c,text:a});Q(this,ya(c),sa)};X.prototype=$d(Rb.prototype,{constructor:X,iter:function(a,
234
- b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=Vc(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:M(function(a){var b=r(this.first,0),c=this.first+this.size-1;mb(this,{from:b,to:r(c,t(this,c).text.length),text:this.splitLines(a),origin:"setValue",
235
- full:!0},!0);this.cm&&Jb(this.cm,0,0);Q(this,ya(b),sa)}),replaceRange:function(a,b,c,d){b=v(this,b);c=c?v(this,c):b;nb(this,a,b,c,d)},getRange:function(a,b,c){a=Ka(this,v(this,a),v(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(vb(this,a))return t(this,a)},getLineNumber:function(a){return B(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=t(this,a));return pa(a)},lineCount:function(){return this.size},
236
- firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return v(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:M(function(a,b,c){a=v(this,"number"==typeof a?r(a,b||0):a);Q(this,ya(a,null),c)}),setSelection:M(function(a,
237
- b,c){var d=v(this,a);a=v(this,b||a);Q(this,ya(d,a),c)}),extendSelection:M(function(a,b,c){Fc(this,v(this,a),b&&v(this,b),c)}),extendSelections:M(function(a,b){pf(this,ce(this,a),b)}),extendSelectionsBy:M(function(a,b){var c=jc(this.sel.ranges,a);pf(this,ce(this,c),b)}),setSelections:M(function(a,b,c){if(a.length){for(var d=[],e=0;e<a.length;e++)d[e]=new y(v(this,a[e].anchor),v(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));Q(this,ma(d,b),c)}}),addSelection:M(function(a,b,c){var d=
238
- this.sel.ranges.slice(0);d.push(new y(v(this,a),v(this,b||a)));Q(this,ma(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=Ka(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Ka(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=
239
- a;this.replaceSelections(d,b,c||"+input")},replaceSelections:M(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=r(this.first,0);for(f=0;f<d.length;f++){var h=d[f];g=gf(h.from,c,e);var k=gf(Ea(h),c,e);c=h.to;e=k;"around"==b?(h=this.sel.ranges[f],h=0>x(h.head,h.anchor),a[f]=new y(h?k:g,h?g:k)):a[f]=new y(g,g)}a=new ea(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)mb(this,
240
- d[a]);b?qf(this,b):this.cm&&hb(this.cm)}),undo:M(function(){Hc(this,"undo")}),redo:M(function(){Hc(this,"redo")}),undoSelection:M(function(){Hc(this,"undo",!0)}),redoSelection:M(function(){Hc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=
241
- new Dc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:kb(this.history.done),undone:kb(this.history.undone)}},setHistory:function(a){var b=this.history=new Dc(this.history.maxGeneration);b.done=kb(a.done.slice(0),
242
- null,!0);b.undone=kb(a.undone.slice(0),null,!0)},setGutterMarker:M(function(a,b,c){return Pb(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&ae(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:M(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&Pb(b,c,"gutter",function(){c.gutterMarkers[a]=null;ae(c.gutterMarkers)&&(c.gutterMarkers=null);return!0})})}),lineInfo:function(a){if("number"==typeof a){if(!vb(this,a))return null;var b=
243
- a;a=t(this,a);if(!a)return null}else if(b=B(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:M(function(a,b,c){return Pb(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[d]){if(Ha(c).test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:M(function(a,b,
244
- c){return Pb(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=a[d];if(f)if(null==c)a[d]=null;else{var g=f.match(Ha(c));if(!g)return!1;var h=g.index+g[0].length;a[d]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}else return!1;return!0})}),addLineWidget:M(function(a,b,c){return Pg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return ob(this,v(this,a),v(this,
245
- b),c,c&&c.type||"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=v(this,a);return ob(this,a,a,c,"bookmark")},findMarksAt:function(a){a=v(this,a);var b=[],c=t(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=
246
- v(this,a);b=v(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];null!=h.to&&e==a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;
247
- this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c});return v(this,r(c,b))},indexFromPos:function(a){a=v(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new X(Vc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=
248
- this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new X(Vc(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=Ef(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),
249
- f=b.clipPos(e.from);e=b.clipPos(e.to);x(f,e)&&(f=ob(b,f,e,d.primary,d.primary.type),d.markers.push(f),f.parent=d)}return b},unlinkDoc:function(a){a instanceof F&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);Rg(Ef(this));break}if(a.history==this.history){var c=[a.id];Za(a,function(a){return c.push(a.id)},!0);a.history=new Dc(null);a.history.done=kb(this.history.done,c);a.history.undone=kb(this.history.undone,c)}},
250
- iterLinkedDocs:function(a){Za(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):Xd(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:M(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&Lg(this.cm))})});X.prototype.eachLine=X.prototype.iter;for(var Gf=0,Xf=!1,Ga={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",
251
- 17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",
252
- 63302:"Insert"},fc=0;10>fc;fc++)Ga[fc+48]=Ga[fc+96]=String(fc);for(var Oc=65;90>=Oc;Oc++)Ga[Oc]=String.fromCharCode(Oc);for(var gc=1;12>=gc;gc++)Ga[gc+111]=Ga[gc+63235]="F"+gc;var Ub={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",
253
- Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll",
254
- "Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars",
255
- "Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace",
256
- "Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};Ub["default"]=ia?Ub.macDefault:Ub.pcDefault;var Vb={selectAll:vf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),sa)},killLine:function(a){return qb(a,function(b){if(b.empty()){var c=
257
- t(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:r(b.head.line+1,0)}:{from:b.head,to:r(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return qb(a,function(b){return{from:r(b.from().line,0),to:v(a.doc,r(b.to().line+1,0))}})},delLineLeft:function(a){return qb(a,function(a){return{from:r(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return qb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,
258
- top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return qb(a,function(b){var c=a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(r(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(r(a.lastLine()))},
259
- goLineStart:function(a){return a.extendSelectionsBy(function(b){return Mf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return Nf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var c=t(a.doc,b);var d=c;for(var e;e=Ma(d,!1);)d=e.find(1,!0).line;d!=c&&(b=B(d));return Qd(!0,a,c,b,-1)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=
260
- a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},dc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},dc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?Nf(a,b.head):c},dc)},goLineUp:function(a){return a.moveV(-1,
261
- "line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,
262
- "group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},
263
- indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from();f=fa(a.getLine(f.line),f.ch,d);b.push(Sc(d-f%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return Z(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=
264
- b[d].head,f=t(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new r(e.line,e.ch-1)),0<e.ch)e=new r(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),r(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=t(a.doc,e.line-1).text;g&&(e=new r(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),r(e.line-1,g.length-1),e,"+transpose"))}c.push(new y(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return Z(a,function(){for(var b=a.listSelections(),
265
- c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);hb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Zg=new $a,Rd=null,Sd=function(a,b,c){this.time=a;this.pos=b;this.button=c};Sd.prototype.compare=function(a,b,c){return this.time+400>a&&0==x(b,this.pos)&&c==this.button};var Yb,Xb,rb={toString:function(){return"CodeMirror.Init"}},
266
- Wf={},Mc={};F.defaults=Wf;F.optionHandlers=Mc;var Vd=[];F.defineInitHook=function(a){return Vd.push(a)};var aa=null,D=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new $a;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};D.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())aa={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=
267
- ag(e);aa={lineWise:!0,text:b.text};"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,sa);e.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=aa.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=cg();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);a.value=aa.text.join("\n");var m=document.activeElement;cc(a);setTimeout(function(){e.display.lineSpace.removeChild(g);
268
- m.focus();m==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;bg(f,e.options.spellcheck);w(f,"paste",function(a){K(e,a)||$f(a,e)||11>=E&&setTimeout(L(e,function(){return c.updateFromDOM()}),20)});w(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});w(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});w(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});w(f,
269
- "touchstart",function(){return d.forceCompositionEnd()});w(f,"input",function(){c.composing||c.readFromDOMSoon()});w(f,"copy",b);w(f,"cut",b)};D.prototype.prepareSelection=function(){var a=Pe(this.cm,!1);a.focus=this.cm.state.focused;return a};D.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};D.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from();
270
- c=c.to();if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line<b.display.viewFrom)a.removeAllRanges();else{var e=Nc(b,a.anchorNode,a.anchorOffset),f=Nc(b,a.focusNode,a.focusOffset);if(!e||e.bad||!f||f.bad||0!=x(mc(e,f),d)||0!=x(lc(e,f),c))if(e=b.display.view,d=d.line>=b.display.viewFrom&&eg(b,d)||{node:e[0].measure.map[2],offset:0},c=c.line<b.display.viewTo&&eg(b,c),c||(c=e[e.length-1].measure,c=c.maps?c.maps[c.maps.length-1]:c.map,c={node:c[c.length-1],offset:c[c.length-2]-c[c.length-
271
- 3]}),d&&c){e=a.rangeCount&&a.getRangeAt(0);try{var g=Bb(d.node,d.offset,c.offset,c.node)}catch(h){}g&&(!Aa&&b.state.focused?(a.collapse(d.node,d.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),e&&null==a.anchorNode?a.addRange(e):Aa&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};D.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&
272
- a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)};D.prototype.showMultipleSelections=function(a){ba(this.cm.display.cursorDiv,a.cursors);ba(this.cm.display.selectionDiv,a.selection)};D.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};D.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;
273
- a=a.getRangeAt(0).commonAncestorContainer;return za(this.div,a)};D.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};D.prototype.blur=function(){this.div.blur()};D.prototype.getField=function(){return this.div};D.prototype.supportsTouch=function(){return!0};D.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=
274
- this;this.selectionInEditor()?this.pollSelection():Z(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};D.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};D.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),
275
- b=this.cm;if(uc&&tc&&this.cm.options.gutters.length&&nh(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var c=Nc(b,a.anchorNode,a.anchorOffset),d=Nc(b,a.focusNode,a.focusOffset);c&&d&&Z(b,function(){Q(b.doc,ya(c,d),sa);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}}};D.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=
276
- null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();0==d.ch&&d.line>a.firstLine()&&(d=r(d.line-1,t(a.doc,d.line-1).length));e.ch==t(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=r(e.line+1,0));if(d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f;d.line==b.viewFrom||0==(f=Qa(a,d.line))?(c=B(b.view[0].line),f=b.view[0].node):(c=B(b.view[f].line),f=b.view[f-1].node.nextSibling);var g=Qa(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=B(b.view[g+1].line)-
277
- 1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(oh(a,f,b,c,e));for(f=Ka(a.doc,r(c,0),r(e,t(a.doc,e).text.length));1<b.length&&1<f.length;)if(A(b)==A(f))b.pop(),f.pop(),e--;else if(b[0]==f[0])b.shift(),f.shift(),c++;else break;var h=0;g=0;for(var k=b[0],l=f[0],m=Math.min(k.length,l.length);h<m&&k.charCodeAt(h)==l.charCodeAt(h);)++h;k=A(b);l=A(f);for(m=Math.min(k.length-(1==b.length?h:0),l.length-(1==f.length?h:0));g<m&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)++g;
278
- if(1==b.length&&1==f.length&&c==d.line)for(;h&&h>d.ch&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)h--,g++;b[b.length-1]=k.slice(0,k.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(h).replace(/\u200b+$/,"");d=r(c,h);c=r(e,f.length?A(f).length-g:0);if(1<b.length||b[0]||x(d,c))return nb(a.doc,b,d,c,"+input"),!0};D.prototype.ensurePolled=function(){this.forceCompositionEnd()};D.prototype.reset=function(){this.forceCompositionEnd()};D.prototype.forceCompositionEnd=function(){this.composing&&
279
- (clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};D.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;a.updateFromDOM()},80))};D.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||Z(this.cm,function(){return W(a.cm)})};D.prototype.setUneditable=function(a){a.contentEditable=
280
- "false"};D.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||L(this.cm,Wd)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};D.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};D.prototype.onContextMenu=function(){};D.prototype.resetPosition=function(){};D.prototype.needsContentAttribute=!0;var J=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new $a;this.hasSelection=!1;this.composing=
281
- null};J.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())aa={lineWise:!1,text:e.getSelections()};else if(e.options.lineWiseCopyCut){var b=ag(e);aa={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,sa):(d.prevInput="",g.value=b.text.join("\n"),cc(g))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=cg(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);ac&&(g.style.width="0px");
282
- w(g,"input",function(){z&&9<=E&&c.hasSelection&&(c.hasSelection=null);d.poll()});w(g,"paste",function(a){K(e,a)||$f(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});w(g,"cut",b);w(g,"copy",b);w(a.scroller,"paste",function(b){xa(a,b)||K(e,b)||(e.state.pasteIncoming=!0,d.focus())});w(a.lineSpace,"selectstart",function(b){xa(a,b)||S(b)});w(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});
283
- w(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};J.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Pe(a);if(a.options.moveInputWithCursor){a=ka(a,c.sel.primary().head,"div");c=b.wrapper.getBoundingClientRect();var e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d};J.prototype.showSelection=
284
- function(a){var b=this.cm.display;ba(b.cursorDiv,a.cursors);ba(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};J.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&cc(this.textarea),z&&9<=E&&(this.hasSelection=a)):a||(this.prevInput=this.textarea.value="",z&&9<=E&&(this.hasSelection=null))}};
285
- J.prototype.getField=function(){return this.textarea};J.prototype.supportsTouch=function(){return!1};J.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!ub||ta()!=this.textarea))try{this.textarea.focus()}catch(a){}};J.prototype.blur=function(){this.textarea.blur()};J.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};J.prototype.receivedFocus=function(){this.slowPoll()};J.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,
286
- function(){a.poll();a.cm.state.focused&&a.slowPoll()})};J.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};J.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||th(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;
287
- if(z&&9<=E&&this.hasSelection===e||ia&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||d||(d="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}var g=0;for(f=Math.min(d.length,e.length);g<f&&d.charCodeAt(g)==e.charCodeAt(g);)++g;Z(b,function(){Wd(b,e.slice(g),d.length-g,null,a.composing?"*compose":null);1E3<e.length||-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),
288
- a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};J.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};J.prototype.onKeyPress=function(){z&&9<=E&&(this.hasSelection=null);this.fastPoll()};J.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="\u200b"+(a?g.value:"");g.value="\u21da";g.value=b;d.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=
289
- b.length;f.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=m;g.style.cssText=l;z&&9>E&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k);if(null!=g.selectionStart){(!z||z&&9>E)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==d.prevInput?L(e,vf)(e):10>a++?f.detectingSelectAll=setTimeout(c,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,
290
- g=d.textarea,h=Ua(e,a),k=f.scroller.scrollTop;if(h&&!la){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&L(e,Q)(e.doc,ya(h),sa);var l=g.style.cssText,m=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(z?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
291
- if(R)var p=window.scrollY;f.input.focus();R&&window.scrollTo(null,p);f.input.reset();e.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);z&&9<=E&&b();if(Td){zb(a);var n=function(){ca(window,"mouseup",n);setTimeout(c,20)};w(window,"mouseup",n)}else setTimeout(c,50)}};J.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};J.prototype.setUneditable=function(){};J.prototype.needsContentAttribute=
292
- !1;(function(a){function b(b,e,f,g){a.defaults[b]=e;f&&(c[b]=g?function(a,b,d){d!=rb&&f(a,b,d)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=rb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Id(a)},!0);b("indentUnit",2,Id,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){Nb(a);Gb(a);W(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,
293
- e);if(-1==f)break;e=f+b.length;c.push(r(d,f))}d++});for(var e=c.length-1;0<=e;e--)nb(a.doc,b,c[e],r(c[e].line,c[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=rb&&a.refresh()});b("specialCharPlaceholder",yg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",ub?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");
294
- },!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!sh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Vf(a);Zb(a)},!0);b("keyMap","default",function(a,b,c){b=Ic(b);(c=c!=rb&&Ic(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,lh,!0);b("gutters",[],function(a){Gd(a.options);Zb(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?wd(a.display)+
295
- "px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return ib(a)},!0);b("scrollbarStyle","native",function(a){Ze(a);ib(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){Gd(a.options);Zb(a)},!0);b("firstLineNumber",1,Zb,!0);b("lineNumberFormatter",function(a){return a},Zb,!0);b("showCursorWhenSelecting",!1,Hb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",
296
- !0);b("readOnly",!1,function(a,b){"nocursor"==b&&(Ib(a),a.display.input.blur());a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,kh);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Hb,!0);b("singleCursorHeightPerLine",!0,Hb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,Nb,!0);b("addModeClass",!1,Nb,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=
297
- b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,Nb,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null);b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)})(F);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},
298
- setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&L(this,b[a])(this,c,e),G(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Ic(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:U(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");
299
- ig(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;W(this)}),removeOverlay:U(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a){b.splice(c,1);this.state.modeGen++;W(this);break}}}),indentLine:U(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");vb(this.doc,a)&&$b(this,
300
- a,b,c)}),indentSelection:U(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var h=b[d];if(h.empty())h.head.line>c&&($b(this,h.head.line,a,!0),c=h.head.line,d==this.doc.sel.primIndex&&hb(this));else{var k=h.from();h=h.to();var l=Math.max(c,k.line);c=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1;for(h=l;h<c;++h)$b(this,h,a);h=this.doc.sel.ranges;0==k.ch&&b.length==h.length&&0<h[d].from().ch&&Md(this.doc,d,new y(k,h[d].to()),sa)}}}),getTokenAt:function(a,b){return re(this,a,b)},getLineTokens:function(a,
301
- b){return re(this,r(a),b,!0)},getTokenTypeAt:function(a){a=v(this.doc,a);var b=pe(this,t(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var h=c+d>>1;if((h?b[2*h-1]:0)>=a)d=h;else if(b[2*h+1]<a)c=h+1;else{b=b[2*h+2];break}}c=b?b.indexOf("overlay "):-1;return 0>c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,
302
- b){var d=[];if(!c.hasOwnProperty(b))return d;var e=c[b],h=this.getModeAt(a);if("string"==typeof h[b])e[h[b]]&&d.push(e[h[b]]);else if(h[b])for(var k=0;k<h[b].length;k++){var l=e[h[b][k]];l&&d.push(l)}else h.helperType&&e[h.helperType]?d.push(e[h.helperType]):e[h.name]&&d.push(e[h.name]);for(k=0;k<e._global.length;k++)l=e._global[k],l.pred(h,this)&&-1==N(d,l.val)&&d.push(l.val);return d},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-
303
- 1));return Ab(this,a+1,b).state},cursorCoords:function(a,b){var c=this.doc.sel.primary();c=null==a?c.head:"object"==typeof a?v(this.doc,a):a?c.from():c.to();return ka(this,c,b||"page")},charCoords:function(a,b){return rd(this,v(this.doc,a),b||"page")},coordsChar:function(a,b){a=Le(this,a,b||"page");return td(this,a.left,a.top)},lineAtHeight:function(a,b){a=Le(this,{top:a,left:0},b||"page").top;return La(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var e=
304
- this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0);a=t(this.doc,a)}return vc(this,a,{top:0,left:0},b||"page",c||d).top+(d?this.doc.height-qa(a):0)},defaultTextHeight:function(){return Sa(this.display)},defaultCharWidth:function(){return Fb(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,g,h){var d=this.display;a=ka(this,v(this.doc,a));var e=a.bottom,f=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events",
305
- "true");this.display.input.setUneditable(b);d.sizer.appendChild(b);if("over"==g)e=a.top;else if("above"==g||"near"==g){var p=Math.max(d.wrapper.clientHeight,this.doc.height),n=Math.max(d.sizer.clientWidth,d.lineSpace.clientWidth);("above"==g||a.bottom+b.offsetHeight>p)&&a.top>b.offsetHeight?e=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=p&&(e=a.bottom);f+b.offsetWidth>n&&(f=n-b.offsetWidth)}b.style.top=e+"px";b.style.left=b.style.right="";"right"==h?(f=d.sizer.clientWidth-b.offsetWidth,b.style.right=
306
- "0px"):("left"==h?f=0:"middle"==h&&(f=(d.sizer.clientWidth-b.offsetWidth)/2),b.style.left=f+"px");c&&(a=Cd(this,{left:f,top:e,right:f+b.offsetWidth,bottom:e+b.offsetHeight}),null!=a.scrollTop&&Kb(this,a.scrollTop),null!=a.scrollLeft&&Wa(this,a.scrollLeft))},triggerOnKeyDown:U(Pf),triggerOnKeyPress:U(Rf),triggerOnKeyUp:Qf,triggerOnMouseDown:U(Sf),execCommand:function(a){if(Vb.hasOwnProperty(a))return Vb[a].call(null,this)},triggerElectric:U(function(a){Zf(this,a)}),findPosH:function(a,b,c,g){var d=
307
- 1;0>b&&(d=-1,b=-b);a=v(this.doc,a);for(var e=0;e<b&&(a=Yd(this.doc,a,d,c,g),!a.hitSide);++e);return a},moveH:U(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Yd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},dc)}),deleteH:U(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):qb(this,function(d){var e=Yd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),
308
- findPosV:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);var e=v(this.doc,a);for(a=0;a<b&&(e=ka(this,e,"div"),null==g?g=e.left:e.left=g,e=dg(this,e,d,c),!e.hitSide);++a);return e},moveV:U(function(a,b){var c=this,d=this.doc,e=[],k=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(f){if(k)return 0>a?f.from():f.to();var g=ka(c,f.head,"div");null!=f.goalColumn&&(g.left=f.goalColumn);e.push(g.left);var h=dg(c,g,a,b);"page"==b&&f==d.sel.primary()&&yc(c,rd(c,h,"div").top-
309
- g.top);return h},dc);if(e.length)for(var l=0;l<d.sel.ranges.length;l++)d.sel.ranges[l].goalColumn=e[l]}),findWordAt:function(a){var b=t(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var h=this.getHelper(a,"wordChars");"before"!=a.sticky&&d!=b.length||!c?++d:--c;var k=b.charAt(c);for(k=kc(k,h)?function(a){return kc(a,h)}:/\s/.test(k)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!kc(a)};0<c&&k(b.charAt(c-1));)--c;for(;d<b.length&&k(b.charAt(d));)++d}return new y(r(a.line,c),r(a.line,
310
- d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?Ia(this.display.cursorDiv,"CodeMirror-overwrite"):Va(this.display.cursorDiv,"CodeMirror-overwrite"),G(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==ta()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:U(function(a,b){Jb(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,
311
- top:a.scrollTop,height:a.scrollHeight-ra(this)-this.display.barHeight,width:a.scrollWidth-ra(this)-this.display.barWidth,clientHeight:md(this),clientWidth:Pa(this)}},scrollIntoView:U(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:r(a,0),to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;if(null!=a.from.line){var c=a;zc(this);this.curOp.scrollToPos=c}else We(this,a.from,a.to,a.margin)}),
312
- setSize:U(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));null!=b&&(this.display.wrapper.style.height=d(b));this.options.lineWrapping&&Ie(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Da(c,e,"widget");break}++e});this.curOp.forceUpdate=!0;G(this,"refresh",this)}),operation:function(a){return Z(this,
313
- a)},startOperation:function(){return Xa(this)},endOperation:function(){return Ya(this)},refresh:U(function(){var a=this.display.cachedTextHeight;W(this);this.curOp.forceUpdate=!0;Gb(this);Jb(this,this.doc.scrollLeft,this.doc.scrollTop);Bd(this);(null==a||.5<Math.abs(a-Sa(this.display)))&&xd(this);G(this,"refresh",this)}),swapDoc:U(function(a){var b=this.doc;b.cm=null;jf(this,a);Gb(this);this.display.input.reset();Jb(this,a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;P(this,"swapDoc",this,b);
314
- return b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};db(a);a.registerHelper=function(b,e,f){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][e]=f};a.registerGlobalHelper=function(b,e,f,g){a.registerHelper(b,e,g);c[b]._global.push({pred:f,val:g})}})(F);var vh="iter insert remove copy getEditor constructor".split(" "),
315
- hc;for(hc in X.prototype)X.prototype.hasOwnProperty(hc)&&0>N(vh,hc)&&(F.prototype[hc]=function(a){return function(){return a.apply(this.doc,arguments)}}(X.prototype[hc]));db(X);F.inputStyles={textarea:J,contenteditable:D};F.defineMode=function(a){F.defaults.mode||"null"==a||(F.defaults.mode=a);qg.apply(this,arguments)};F.defineMIME=function(a,b){eb[a]=b};F.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});F.defineMIME("text/plain","null");F.defineExtension=function(a,
316
- b){F.prototype[a]=b};F.defineDocExtension=function(a,b){X.prototype[a]=b};F.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b=b?Ja(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=ta();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(w(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var e=a.form;var f=e.submit;try{var g=e.submit=function(){c();
317
- e.submit=f;e.submit();e.submit=g}}catch(k){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(ca(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=f))}};a.style.display="none";var h=F(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return h};(function(a){a.off=ca;a.on=w;a.wheelEventPixels=Kg;a.Doc=X;a.splitLines=Xd;a.countColumn=
318
- fa;a.findColumn=Rc;a.isWordChar=Tc;a.Pass=Kc;a.signal=G;a.Line=jb;a.changeEnd=Ea;a.scrollbarModel=$e;a.Pos=r;a.cmpPos=x;a.modes=ed;a.mimeModes=eb;a.resolveMode=qc;a.getMode=fd;a.modeExtensions=fb;a.extendMode=rg;a.copyState=Oa;a.startState=me;a.innerMode=gd;a.commands=Vb;a.keyMap=Ub;a.keyName=Lf;a.isModifierKey=If;a.lookupKey=pb;a.normalizeKeyMap=Wg;a.StringStream=H;a.SharedTextMarker=Tb;a.TextMarker=Fa;a.LineWidget=Sb;a.e_preventDefault=S;a.e_stopPropagation=ke;a.e_stop=zb;a.addClass=Ia;a.contains=
319
- za;a.rmClass=Va;a.keyNames=Ga})(F);F.version="5.30.0";return F});
320
-
321
- // CodeMirror CSS mode version 5.30.0
322
- (function(k){k(CodeMirror)})(function(k){function g(g){for(var d={},f=0;f<g.length;++f)d[g[f].toLowerCase()]=!0;return d}function x(g,d){for(var f=!1,k;null!=(k=g.next());){if(f&&"/"==k){d.tokenize=null;break}f="*"==k}return["comment","comment"]}k.defineMode("css",function(g,d){function f(a,c){y=c;return a}function q(a,c){var b=a.next();if(w[b]){var d=w[b](a,c);if(!1!==d)return d}if("@"==b)return a.eatWhile(/[\w\\\-]/),f("def",a.current());if("="==b||("~"==b||"|"==b)&&a.eat("="))return f(null,"compare");
323
- if('"'==b||"'"==b)return c.tokenize=G(b),c.tokenize(a,c);if("#"==b)return a.eatWhile(/[\w\\\-]/),f("atom","hash");if("!"==b)return a.match(/^\s*\w*/),f("keyword","important");if(/\d/.test(b)||"."==b&&a.eat(/\d/))return a.eatWhile(/[\w.%]/),f("number","unit");if("-"===b){if(/[\d.]/.test(a.peek()))return a.eatWhile(/[\w.%]/),f("number","unit");if(a.match(/^-[\w\\\-]+/))return a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?f("variable-2","variable-definition"):f("variable-2","variable");if(a.match(/^\w+-/))return f("meta",
324
- "meta")}else return/[,+>*\/]/.test(b)?f(null,"select-op"):"."==b&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?f("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(b)?f(null,b):"u"==b&&a.match(/rl(-prefix)?\(/)||"d"==b&&a.match("omain(")||"r"==b&&a.match("egexp(")?(a.backUp(1),c.tokenize=x,f("property","word")):/[\w\\\-]/.test(b)?(a.eatWhile(/[\w\\\-]/),f("property","word")):f(null,null)}function G(a){return function(c,b){for(var d=!1,e;null!=(e=c.next());){if(e==a&&!d){")"==a&&c.backUp(1);break}d=!d&&"\\"==e}if(e==
325
- a||!d&&")"!=a)b.tokenize=null;return f("string","string")}}function x(a,c){a.next();a.match(/\s*[\"\')]/,!1)?c.tokenize=null:c.tokenize=G(")");return f(null,"(")}function r(a,c,b){this.type=a;this.indent=c;this.prev=b}function h(a,c,b,d){a.context=new r(b,c.indentation()+(!1===d?0:v),a.context);return b}function l(a){a.context.prev&&(a.context=a.context.prev);return a.context.type}function n(a,c,b,d){for(d=d||1;0<d;d--)b.context=b.context.prev;return m[b.context.type](a,c,b)}function t(a){a=a.current().toLowerCase();
326
- e=H.hasOwnProperty(a)?"atom":I.hasOwnProperty(a)?"keyword":"variable"}var u=d.inline;d.propertyKeywords||(d=k.resolveMode("text/css"));var v=g.indentUnit,w=d.tokenHooks,z=d.documentTypes||{},A=d.mediaTypes||{},B=d.mediaFeatures||{},C=d.mediaValueKeywords||{},J=d.propertyKeywords||{},K=d.nonStandardPropertyKeywords||{},D=d.fontProperties||{},E=d.counterDescriptors||{},I=d.colorKeywords||{},H=d.valueKeywords||{},p=d.allowNested,F=!0===d.supportsAtComponent,y,e,m={top:function(a,c,b){if("{"==a)return h(b,
327
- c,"block");if("}"==a&&b.context.prev)return l(b);if(F&&/@component/.test(a))return h(b,c,"atComponentBlock");if(/^@(-moz-)?document$/.test(a))return h(b,c,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(a))return h(b,c,"atBlock");if(/^@(font-face|counter-style)/.test(a))return b.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return h(b,c,"at");if("hash"==a)e="builtin";else if("word"==a)e="tag";
328
- else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return h(b,c,"interpolation");if(":"==a)return"pseudo";if(p&&"("==a)return h(b,c,"parens")}return b.context.type},block:function(a,c,b){if("word"==a){a=c.current().toLowerCase();if(J.hasOwnProperty(a))return e="property","maybeprop";if(K.hasOwnProperty(a))return e="string-2","maybeprop";if(p)return e=c.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block";e+=" error";return"maybeprop"}if("meta"==a)return"block";if(p||"hash"!=a&&
329
- "qualifier"!=a)return m.top(a,c,b);e="error";return"block"},maybeprop:function(a,c,b){return":"==a?h(b,c,"prop"):m[b.context.type](a,c,b)},prop:function(a,c,b){if(";"==a)return l(b);if("{"==a&&p)return h(b,c,"propBlock");if("}"==a||"{"==a)return n(a,c,b);if("("==a)return h(b,c,"parens");if("hash"==a&&!/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(c.current()))e+=" error";else if("word"==a)t(c);else if("interpolation"==a)return h(b,c,"interpolation");return"prop"},propBlock:function(a,
330
- c,b){return"}"==a?l(b):"word"==a?(e="property","maybeprop"):b.context.type},parens:function(a,c,b){if("{"==a||"}"==a)return n(a,c,b);if(")"==a)return l(b);if("("==a)return h(b,c,"parens");if("interpolation"==a)return h(b,c,"interpolation");"word"==a&&t(c);return"parens"},pseudo:function(a,c,b){return"meta"==a?"pseudo":"word"==a?(e="variable-3",b.context.type):m[b.context.type](a,c,b)},documentTypes:function(a,c,b){return"word"==a&&z.hasOwnProperty(c.current())?(e="tag",b.context.type):m.atBlock(a,
331
- c,b)},atBlock:function(a,c,b){if("("==a)return h(b,c,"atBlock_parens");if("}"==a||";"==a)return n(a,c,b);if("{"==a)return l(b)&&h(b,c,p?"block":"top");if("interpolation"==a)return h(b,c,"interpolation");"word"==a&&(a=c.current().toLowerCase(),e="only"==a||"not"==a||"and"==a||"or"==a?"keyword":A.hasOwnProperty(a)?"attribute":B.hasOwnProperty(a)?"property":C.hasOwnProperty(a)?"keyword":J.hasOwnProperty(a)?"property":K.hasOwnProperty(a)?"string-2":H.hasOwnProperty(a)?"atom":I.hasOwnProperty(a)?"keyword":
332
- "error");return b.context.type},atComponentBlock:function(a,c,b){if("}"==a)return n(a,c,b);if("{"==a)return l(b)&&h(b,c,p?"block":"top",!1);"word"==a&&(e="error");return b.context.type},atBlock_parens:function(a,c,b){return")"==a?l(b):"{"==a||"}"==a?n(a,c,b,2):m.atBlock(a,c,b)},restricted_atBlock_before:function(a,c,b){return"{"==a?h(b,c,"restricted_atBlock"):"word"==a&&"@counter-style"==b.stateArg?(e="variable","restricted_atBlock_before"):m[b.context.type](a,c,b)},restricted_atBlock:function(a,
333
- c,b){return"}"==a?(b.stateArg=null,l(b)):"word"==a?(e="@font-face"==b.stateArg&&!D.hasOwnProperty(c.current().toLowerCase())||"@counter-style"==b.stateArg&&!E.hasOwnProperty(c.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(a,c,b){return"word"==a?(e="variable","keyframes"):"{"==a?h(b,c,"top"):m[b.context.type](a,c,b)},at:function(a,c,b){if(";"==a)return l(b);if("{"==a||"}"==a)return n(a,c,b);"word"==a?e="tag":"hash"==a&&(e="builtin");return"at"},interpolation:function(a,
334
- c,b){if("}"==a)return l(b);if("{"==a||";"==a)return n(a,c,b);"word"==a?e="variable":"variable"!=a&&"("!=a&&")"!=a&&(e="error");return"interpolation"}};return{startState:function(a){return{tokenize:null,state:u?"block":"top",stateArg:null,context:new r(u?"block":"top",a||0,null)}},token:function(a,c){if(!c.tokenize&&a.eatSpace())return null;var b=(c.tokenize||q)(a,c);b&&"object"==typeof b&&(y=b[1],b=b[0]);e=b;"comment"!=y&&(c.state=m[c.state](y,a,c));return e},indent:function(a,c){var b=a.context,
335
- d=c&&c.charAt(0),e=b.indent;"prop"!=b.type||"}"!=d&&")"!=d||(b=b.prev);if(b.prev)if("}"==d&&("block"==b.type||"top"==b.type||"interpolation"==b.type||"restricted_atBlock"==b.type))b=b.prev,e=b.indent;else if(")"==d&&("parens"==b.type||"atBlock_parens"==b.type)||"{"==d&&("at"==b.type||"atBlock"==b.type))e=Math.max(0,b.indent-v);return e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:d.lineComment,fold:"brace"}});var q=["domain","regexp","url","url-prefix"],B=g(q),r="all aural braille handheld print projection screen tty tv embossed".split(" "),
336
- C=g(r),t="width min-width max-width height min-height max-height device-width min-device-width max-device-width device-height min-device-height max-device-height aspect-ratio min-aspect-ratio max-aspect-ratio device-aspect-ratio min-device-aspect-ratio max-device-aspect-ratio color min-color max-color color-index min-color-index max-color-index monochrome min-monochrome max-monochrome resolution min-resolution max-resolution scan grid orientation device-pixel-ratio min-device-pixel-ratio max-device-pixel-ratio pointer any-pointer hover any-hover".split(" "),
337
- D=g(t),u="landscape portrait none coarse fine on-demand hover interlace progressive".split(" "),E=g(u),v="align-content align-items align-self alignment-adjust alignment-baseline anchor-point animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function appearance azimuth backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side caret-color clear clip color color-profile column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset crop cue cue-after cue-before cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit fit-position flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float float-offset flow-from flow-into font font-feature-settings font-family font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-rows grid-column grid-column-end grid-column-gap grid-column-start grid-gap grid-row grid-row-end grid-row-gap grid-row-start grid-template grid-template-areas grid-template-columns grid-template-rows hanging-punctuation height hyphens icon image-orientation image-rendering image-resolution inline-box-align justify-content justify-items justify-self left letter-spacing line-break line-height line-stacking line-stacking-ruby line-stacking-shift line-stacking-strategy list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up object-fit object-position opacity order orphans outline outline-color outline-offset outline-style outline-width overflow overflow-style overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page page-break-after page-break-before page-break-inside page-policy pause pause-after pause-before perspective perspective-origin pitch pitch-range place-content place-items place-self play-during position presentation-level punctuation-trim quotes region-break-after region-break-before region-break-inside region-fragment rendering-intent resize rest rest-after rest-before richness right rotation rotation-point ruby-align ruby-overhang ruby-position ruby-span shape-image-threshold shape-inside shape-margin shape-outside size speak speak-as speak-header speak-numeral speak-punctuation speech-rate stress string-set tab-size table-layout target target-name target-new target-position text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-skip text-decoration-style text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-height text-indent text-justify text-outline text-overflow text-shadow text-size-adjust text-space-collapse text-transform text-underline-position text-wrap top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi user-select vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-range voice-rate voice-stress voice-volume volume white-space widows width will-change word-break word-spacing word-wrap z-index clip-path clip-rule mask enable-background filter flood-color flood-opacity lighting-color stop-color stop-opacity pointer-events color-interpolation color-interpolation-filters color-rendering fill fill-opacity fill-rule image-rendering marker marker-end marker-mid marker-start shape-rendering stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-rendering baseline-shift dominant-baseline glyph-orientation-horizontal glyph-orientation-vertical text-anchor writing-mode".split(" "),
338
- F=g(v),w="scrollbar-arrow-color scrollbar-base-color scrollbar-dark-shadow-color scrollbar-face-color scrollbar-highlight-color scrollbar-shadow-color scrollbar-3d-light-color scrollbar-track-color shape-inside searchfield-cancel-button searchfield-decoration searchfield-results-button searchfield-results-decoration zoom".split(" "),L=g(w),M=g("font-family src unicode-range font-variant font-feature-settings font-stretch font-weight font-style".split(" ")),N=g("additive-symbols fallback negative pad prefix range speak-as suffix symbols system".split(" ")),
339
- z="aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkturquoise darkviolet deeppink deepskyblue dimgray dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray grey green greenyellow honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightpink lightsalmon lightseagreen lightskyblue lightslategray lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" "),
340
- O=g(z),A="above absolute activeborder additive activecaption afar after-white-space ahead alias all all-scroll alphabetic alternate always amharic amharic-abegede antialiased appworkspace arabic-indic armenian asterisks attr auto auto-flow avoid avoid-column avoid-page avoid-region background backwards baseline below bidi-override binary bengali blink block block-axis bold bolder border border-box both bottom break break-all break-word bullets button button-bevel buttonface buttonhighlight buttonshadow buttontext calc cambodian capitalize caps-lock-indicator caption captiontext caret cell center checkbox circle cjk-decimal cjk-earthly-branch cjk-heavenly-stem cjk-ideographic clear clip close-quote col-resize collapse color color-burn color-dodge column column-reverse compact condensed contain content contents content-box context-menu continuous copy counter counters cover crop cross crosshair currentcolor cursive cyclic darken dashed decimal decimal-leading-zero default default-button dense destination-atop destination-in destination-out destination-over devanagari difference disc discard disclosure-closed disclosure-open document dot-dash dot-dot-dash dotted double down e-resize ease ease-in ease-in-out ease-out element ellipse ellipsis embed end ethiopic ethiopic-abegede ethiopic-abegede-am-et ethiopic-abegede-gez ethiopic-abegede-ti-er ethiopic-abegede-ti-et ethiopic-halehame-aa-er ethiopic-halehame-aa-et ethiopic-halehame-am-et ethiopic-halehame-gez ethiopic-halehame-om-et ethiopic-halehame-sid-et ethiopic-halehame-so-et ethiopic-halehame-ti-er ethiopic-halehame-ti-et ethiopic-halehame-tig ethiopic-numeric ew-resize exclusion expanded extends extra-condensed extra-expanded fantasy fast fill fixed flat flex flex-end flex-start footnotes forwards from geometricPrecision georgian graytext grid groove gujarati gurmukhi hand hangul hangul-consonant hard-light hebrew help hidden hide higher highlight highlighttext hiragana hiragana-iroha horizontal hsl hsla hue icon ignore inactiveborder inactivecaption inactivecaptiontext infinite infobackground infotext inherit initial inline inline-axis inline-block inline-flex inline-grid inline-table inset inside intrinsic invert italic japanese-formal japanese-informal justify kannada katakana katakana-iroha keep-all khmer korean-hangul-formal korean-hanja-formal korean-hanja-informal landscape lao large larger left level lighter lighten line-through linear linear-gradient lines list-item listbox listitem local logical loud lower lower-alpha lower-armenian lower-greek lower-hexadecimal lower-latin lower-norwegian lower-roman lowercase ltr luminosity malayalam match matrix matrix3d media-controls-background media-current-time-display media-fullscreen-button media-mute-button media-play-button media-return-to-realtime-button media-rewind-button media-seek-back-button media-seek-forward-button media-slider media-sliderthumb media-time-remaining-display media-volume-slider media-volume-slider-container media-volume-sliderthumb medium menu menulist menulist-button menulist-text menulist-textfield menutext message-box middle min-intrinsic mix mongolian monospace move multiple multiply myanmar n-resize narrower ne-resize nesw-resize no-close-quote no-drop no-open-quote no-repeat none normal not-allowed nowrap ns-resize numbers numeric nw-resize nwse-resize oblique octal opacity open-quote optimizeLegibility optimizeSpeed oriya oromo outset outside outside-shape overlay overline padding padding-box painted page paused persian perspective plus-darker plus-lighter pointer polygon portrait pre pre-line pre-wrap preserve-3d progress push-button radial-gradient radio read-only read-write read-write-plaintext-only rectangle region relative repeat repeating-linear-gradient repeating-radial-gradient repeat-x repeat-y reset reverse rgb rgba ridge right rotate rotate3d rotateX rotateY rotateZ round row row-resize row-reverse rtl run-in running s-resize sans-serif saturation scale scale3d scaleX scaleY scaleZ screen scroll scrollbar scroll-position se-resize searchfield searchfield-cancel-button searchfield-decoration searchfield-results-button searchfield-results-decoration self-start self-end semi-condensed semi-expanded separate serif show sidama simp-chinese-formal simp-chinese-informal single skew skewX skewY skip-white-space slide slider-horizontal slider-vertical sliderthumb-horizontal sliderthumb-vertical slow small small-caps small-caption smaller soft-light solid somali source-atop source-in source-out source-over space space-around space-between space-evenly spell-out square square-button start static status-bar stretch stroke sub subpixel-antialiased super sw-resize symbolic symbols system-ui table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group tamil telugu text text-bottom text-top textarea textfield thai thick thin threeddarkshadow threedface threedhighlight threedlightshadow threedshadow tibetan tigre tigrinya-er tigrinya-er-abegede tigrinya-et tigrinya-et-abegede to top trad-chinese-formal trad-chinese-informal transform translate translate3d translateX translateY translateZ transparent ultra-condensed ultra-expanded underline unset up upper-alpha upper-armenian upper-greek upper-hexadecimal upper-latin upper-norwegian upper-roman uppercase urdu url var vertical vertical-text visible visibleFill visiblePainted visibleStroke visual w-resize wait wave wider window windowframe windowtext words wrap wrap-reverse x-large x-small xor xx-large xx-small".split(" "),
341
- P=g(A);q=q.concat(r).concat(t).concat(u).concat(v).concat(w).concat(z).concat(A);k.registerHelper("hintWords","css",q);k.defineMIME("text/css",{documentTypes:B,mediaTypes:C,mediaFeatures:D,mediaValueKeywords:E,propertyKeywords:F,nonStandardPropertyKeywords:L,fontProperties:M,counterDescriptors:N,colorKeywords:O,valueKeywords:P,tokenHooks:{"/":function(g,d){if(!g.eat("*"))return!1;d.tokenize=x;return x(g,d)}},name:"css"})});
1
+ jQuery(document).ready(function(e){"use strict";var r=wp.codeEditor.initialize(document.getElementById("option-custom-css"),tablepress_codemirror_settings);e(r.codemirror.getWrapperElement()).resizable({handles:"s",resize:function(){var o=e(this);r.codemirror.setSize(o.width(),o.height())}}),e("#tablepress-page").find(".CodeMirror").on("mousedown.codemirror",function(){var o=e(this);o.hasClass("disabled")||(o.addClass("large"),r.codemirror.refresh(),o.off("mousedown.codemirror"))}),e("#option-use-custom-css").on("change",function(){var o=e(this).prop("checked");r.codemirror.setOption("readOnly",!o),e("#tablepress-page").find(".CodeMirror").toggleClass("disabled",!o)}).change()});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/js/edit.min.js CHANGED
@@ -1 +1 @@
1
- window.tp=window.tp||{},jQuery(document).ready(function(e){"use strict";var t=function(t){return e(document.getElementById(t))};tp.made_changes=!1,tp.table={id:t("table-id").val(),new_id:t("table-new-id").val(),rows:parseInt(t("number-rows").val(),10),columns:parseInt(t("number-columns").val(),10),head:t("option-table-head").prop("checked"),foot:t("option-table-foot").prop("checked"),no_data_columns_pre:2,no_data_columns_post:1,body_cells_pre:'<tr><td><span class="move-handle"></span></td><td><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][rows][]" value="1" /></td>',body_cells_post:'<td><span class="move-handle"></span></td></tr>',body_cell:'<td><textarea rows="1"></textarea></td>',head_cell:'<th class="head"><span class="sort-control sort-desc" title="'+tablepress_strings.sort_desc+'"><span class="sorting-indicator"></span></span><span class="sort-control sort-asc" title="'+tablepress_strings.sort_asc+'"><span class="sorting-indicator"></span></span><span class="move-handle"></span></th>',foot_cell:'<th><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][columns][]" value="1" /></th>',set_table_changed:function(){tp.made_changes=!0},unset_table_changed:function(){tp.made_changes=!1,t("edit-form-body").one("change","textarea",tp.table.set_table_changed),e("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed)},change_id:function(){return""===e.trim(t("table-new-id").val())?(alert(tablepress_strings.table_id_not_empty),void t("table-new-id").val(tp.table.new_id).focus().select()):"0"===e.trim(t("table-new-id").val())?(alert(tablepress_strings.table_id_not_zero),void t("table-new-id").val(tp.table.new_id).focus().select()):void(this.value!==tp.table.new_id&&(confirm(tablepress_strings.ays_change_table_id)?(tp.table.new_id=this.value,e(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]").click(),tp.table.set_table_changed()):e(this).val(tp.table.new_id)))},change_table_head:function(){tp.table.head=e(this).prop("checked"),t("option-use-datatables").prop("disabled",!tp.table.head).change(),t("notice-datatables-head-row").toggle(!tp.table.head),tp.rows.stripe()},change_table_foot:function(){tp.table.foot=e(this).prop("checked"),tp.rows.stripe()},change_print_name_description:function(){t(this.id+"-position").prop("disabled",!e(this).prop("checked"))},change_datatables:function(){var e=t("option-use-datatables"),a=!(e.prop("checked")&&!e.prop("disabled"));e.closest("tbody").find("input").not(e).prop("disabled",a),tp.table.change_datatables_pagination()},change_datatables_pagination:function(){var e=t("option-datatables-paginate"),a=e.prop("checked")&&!e.prop("disabled");t("option-datatables-lengthchange").prop("disabled",!a),t("option-datatables-paginate_entries").prop("disabled",!a)},prepare_ajax_request:function(a,n){var o,s=t("edit-form-body"),r=[],i={rows:tp.table.rows,columns:tp.table.columns,hidden_rows:0,hidden_columns:0},l={rows:[],columns:[]};return s.children().each(function(t,a){r[t]=e(a).find("textarea").map(function(){return e(this).val()}).get()}),r=JSON.stringify(r),o={table_head:tp.table.head,table_foot:tp.table.foot,alternating_row_colors:t("option-alternating-row-colors").prop("checked"),row_hover:t("option-row-hover").prop("checked"),print_name:t("option-print-name").prop("checked"),print_description:t("option-print-description").prop("checked"),print_name_position:t("option-print-name-position").val(),print_description_position:t("option-print-description-position").val(),extra_css_classes:t("option-extra-css-classes").val(),use_datatables:t("option-use-datatables").prop("checked"),datatables_sort:t("option-datatables-sort").prop("checked"),datatables_filter:t("option-datatables-filter").prop("checked"),datatables_paginate:t("option-datatables-paginate").prop("checked"),datatables_lengthchange:t("option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:t("option-datatables-paginate_entries").val(),datatables_info:t("option-datatables-info").prop("checked"),datatables_scrollx:t("option-datatables-scrollx").prop("checked"),datatables_custom_commands:t("option-datatables-custom-commands").val()},o=JSON.stringify(o),l.rows=s.find('input[type="hidden"]').map(function(){return"1"===e(this).val()?1:(i.hidden_rows+=1,0)}).get(),l.columns=t("edit-form-foot").find('input[type="hidden"]').map(function(){return"1"===e(this).val()?1:(i.hidden_columns+=1,0)}).get(),l=JSON.stringify(l),{action:a,_ajax_nonce:e(n).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:t("table-name").val(),description:t("table-description").val(),number:i,data:r,options:o,visibility:l}}},preview:{trigger:function(){return tp.made_changes?t("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(t("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void t("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(t("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void t("option-extra-css-classes").focus().select()):(e(this).closest("p").append('<span class="animation-preview spinner is-active" title="'+tablepress_strings.preparing_preview+'"/>'),e("body").addClass("wait"),t("table-preview").empty(),e.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),success:tp.table.preview.ajax_success,error:tp.table.preview.ajax_error,dataType:"json"}),!1):(tp.table.preview.show(e(this).attr("href")+"&TB_iframe=true"),!1)},ajax_success:function(e,t){void 0===t||"success"!==t?tp.table.preview.error("AJAX call successful, but unclear status."):void 0===e||null===e||"-1"===e||void 0===e.success||!0!==e.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(e)},ajax_error:function(e,t,a){tp.table.preview.error("AJAX call failed: "+t+" - "+a)},success:function(a){t("table-preview").empty(),e('<iframe id="table-preview-iframe" />').load(function(){var t=e(this).contents();t.find("head").append(a.head_html),t.find("body").append(a.body_html)}).appendTo("#table-preview"),e(".animation-preview").remove(),e("body").removeClass("wait"),tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(t){e(".animation-preview").closest("p").after('<div class="ajax-alert preview-error error"><p>'+tablepress_strings.preview_error+": "+t+"</p></div>"),e(".animation-preview").remove(),e(".preview-error").delay(6e3).fadeOut(2e3,function(){e(this).remove()}),e("body").removeClass("wait")},show:function(t){var a=e(window).width()-120,n=e(window).height()-120;e("#wpadminbar").length&&(n-=parseInt(e("#wpadminbar").css("height"),10)),tb_show(e(".show-preview-button").first().text(),t+"&height="+n+"&width="+a,!1)}}},tp.rows={create:function(a){var n,o,s,r="";for(n=0;n<a;n++){for(r+=tp.table.body_cells_pre,o=0;o<tp.table.columns;o++)r+=tp.table.body_cell;r+=tp.table.body_cells_post}return s=t("edit-form-foot").find(".column-hidden").map(function(){return e(this).index()}).get(),e(r).each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,s)}).addClass("column-hidden")})},append:function(){var e=t("rows-append-number").val();if(!/^[1-9][0-9]{0,4}$/.test(e))return alert(tablepress_strings.append_num_rows_invalid),void t("rows-append-number").focus().select();t("edit-form-body").append(tp.rows.create(e)),tp.rows.stripe(),tp.reindex()},insert:function(e){var a=t("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==a.length?(a.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},duplicate:function(a){var n=t("edit-form-body").find("input:checked").prop("checked",a.shiftKey).closest("tr");0!==n.length?(n.each(function(t,a){var n=e(a),o=n.find("textarea"),s=n.clone();s.find("textarea").removeAttr("id").each(function(t,a){e(a).val(o.eq(t).val())}),n.after(s)}),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},hide:function(e){var a=t("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==a.length?(a.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},unhide:function(e){var a=t("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==a.length?(a.removeClass("row-hidden").find(".visibility").val("1"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},remove:function(){var e,a=t("edit-form-body").find("input:checked").closest("tr");0!==a.length?tp.table.rows!==a.length?(e=1===a.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(e)&&(a.remove(),tp.rows.stripe(),tp.reindex())):alert(tablepress_strings.no_remove_all_rows):alert(tablepress_strings.no_rows_selected)},move:{start:function(t,a){e(a.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+(tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>'),e(a.helper).removeClass("odd head-row foot-row")},change:function(e,t){tp.rows.stripe(t.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var t=e(this).parent().index(),a=e(this).hasClass("sort-asc")?1:-1,n=e("#edit-form-body"),o=n.find(".head-row").prevAll().addBack(),s=n.find(".foot-row").nextAll().addBack(),r=n.children().not(o).not(s).get(),i=function(e,t){var a,n,o=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,s=/^\s+|\s+$/g,r=/\s+/g,i=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,c=/^0/,d=e.replace(s,"")||"",p=t.replace(s,"")||"",u=d.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),_=parseInt(d.match(l),16)||1!==u.length&&Date.parse(d),m=parseInt(p.match(l),16)||_&&p.match(i)&&Date.parse(p)||null,b=function(e,t){return(!e.match(c)||1===t)&&parseFloat(e)||e.replace(r," ").replace(s,"")||0};if(m){if(_<m)return-1;if(_>m)return 1}for(var f=0,v=u.length,g=h.length,w=Math.max(v,g);f<w;f++){if(a=b(u[f]||"",v),n=b(h[f]||"",g),isNaN(a)!==isNaN(n))return isNaN(a)?1:-1;if(/[^\x00-\x80]/.test(a+n)&&a.localeCompare){var x=a.localeCompare(n);return x/Math.abs(x)}if(a<n)return-1;if(a>n)return 1}};e.each(r,function(a,n){n.sort_key=(""+e(n).children().eq(t).find("textarea").val()).toLowerCase()}),r.sort(function(e,t){return a*i(e.sort_key,t.sort_key)}),e.each(r,function(e,t){t.sort_key=null}),n.append(o),n.append(r),n.append(s),tp.rows.stripe(),tp.reindex()},stripe:function(a){void 0===a&&(a=null),a=e(a);var n=t("edit-form-body").children().removeClass("odd head-row foot-row").not(a);n.filter(":even").addClass("odd"),n=n.not(".row-hidden"),a.hasClass("row-hidden")&&(n=n.not(".ui-sortable-placeholder")),tp.table.head&&n.first().addClass("head-row"),tp.table.foot&&n.last().addClass("foot-row")}},tp.columns={append:function(){var a,n=t("columns-append-number").val(),o="",s="",r="";if(!/^[1-9][0-9]{0,4}$/.test(n))return alert(tablepress_strings.append_num_columns_invalid),void t("columns-append-number").focus().select();for(a=0;a<n;a++)s+=tp.table.body_cell,o+=tp.table.head_cell,r+=tp.table.foot_cell;t("edit-form-body").children().each(function(t,a){e(a).children().slice(-tp.table.no_data_columns_post).before(s)}),t("edit-form-head").children().slice(-tp.table.no_data_columns_post).before(o),t("edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(r),tp.reindex()},insert:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,n)}).before(tp.table.body_cell)}),t("edit-form-head").children().filter(function(t){return-1!==e.inArray(t,n)}).before(tp.table.head_cell),o.before(tp.table.foot_cell),tp.reindex()):alert(tablepress_strings.no_columns_selected)},duplicate:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form").find("tr").each(function(t,a){e(a).children().each(function(t,a){if(-1!==e.inArray(t,n)){var o=e(a),s=o.clone();s.find("textarea").removeAttr("id").val(o.find("textarea").val()),o.after(s)}})}),tp.reindex()):alert(tablepress_strings.no_columns_selected)},hide:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().add("#edit-form-head").each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,n)}).addClass("column-hidden")}),o.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},unhide:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().add("#edit-form-head").each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,n)}).removeClass("column-hidden")}),o.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},remove:function(){var a,n,o=t("edit-form-foot").find("input:checked").closest("th");0!==o.length?tp.table.columns!==o.length?(n=1===o.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural,confirm(n)&&(a=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().add("#edit-form-head").each(function(t,n){e(n).children().filter(function(t){return-1!==e.inArray(t,a)}).remove()}),o.remove(),tp.reindex())):alert(tablepress_strings.no_remove_all_columns):alert(tablepress_strings.no_columns_selected)},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(a,n){var o,s=e(n.item);tp.columns.move.source_idx=s.index(),tp.columns.move.$rows=t("edit-form-body").children().add("#edit-form-foot"),tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=e(this),e('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell),tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide(),tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover"),o=tp.columns.move.$helper.eq(1).width(),tp.columns.move.$helper.eq(0).width(o),tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder"),tp.columns.move.$placeholder.find("div").width(o)},change:function(t,a){tp.columns.move.target_idx=e(a.placeholder).index(),tp.columns.move.target_idx-tp.columns.move.source_idx==1?tp.columns.move.target_idx+=1:tp.columns.move.target_idx===tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell=e(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))}),tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(e,t){tp.columns.move.$helper.css("left",t.position.left)},stop:function(){tp.columns.move.$helper.remove(),tp.columns.move.$cells.each(function(){tp.columns.move.$cell=e(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show(),tp.columns.move.$placeholder.remove(),tp.columns.move.source_idx=tp.columns.move.target_idx=-1,tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell=tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null,tp.reindex()}},number_to_letter:function(e){for(var t="";e>0;)t=String.fromCharCode(65+(e-1)%26)+t,e=Math.floor((e-1)/26);return t}},tp.cells={$focus:e(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus"),tp.cells.$focus=e(this).closest("tr").addClass("focus")},advanced_editor:{prompt_shown:!1,keyopen:function(a){if(a.shiftKey){var n=t("advanced-editor-content");tp.cells.$textarea=e(this).blur(),n.val(tp.cells.$textarea.val()),t("advanced-editor").wpdialog("open"),n.get(0).selectionStart=n.get(0).selectionEnd=n.val().length,n.focus()}},buttonopen:function(){(tp.cells.advanced_editor.prompt_shown||confirm(tablepress_strings.advanced_editor_open))&&(tp.cells.advanced_editor.prompt_shown=!0,t("edit-form-body").one("click","textarea",function(){var a=t("advanced-editor-content");tp.cells.$textarea=e(this).blur(),a.val(tp.cells.$textarea.val()),t("advanced-editor").wpdialog("open"),a.get(0).selectionStart=a.get(0).selectionEnd=a.val().length,a.focus()}))},save:function(){var e=t("advanced-editor-content").blur().val();tp.cells.$textarea.val()!==e&&(tp.cells.$textarea.val(e),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed()),tp.cells.$textarea.focus(),tp.cells.advanced_editor.close()},close:function(){return t("advanced-editor").wpdialog("close"),!1}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(t){if("undefined"===t.shiftKey)return!0;if(t.shiftKey){if(!tp.cells.checkboxes.last_clicked[t.data.parent])return!0;var a=e(t.data.parent).find(":checkbox"),n=a.index(tp.cells.checkboxes.last_clicked[t.data.parent]),o=a.index(this);n!==o&&a.slice(Math.min(n,o),Math.max(n,o)).prop("checked",e(this).prop("checked"))}return tp.cells.checkboxes.last_clicked[t.data.parent]=this,!0}}},tp.content={link:{prompt_shown:!1,add:function(){(tp.content.link.prompt_shown||confirm(tablepress_strings.link_add))&&(tp.content.link.prompt_shown=!0,t("edit-form-body").one("mousedown","textarea",function(){var t=this.id;e(document).one("mouseup",function(){"undefined"!=typeof wpLink&&(wpLink.open(t),tp.table.set_table_changed())})}))}},image:{prompt_shown:!1,add:function(){(tp.content.image.prompt_shown||confirm(tablepress_strings.image_add))&&(tp.content.image.prompt_shown=!0,t("edit-form-body").one("click","textarea",function(){var t=this.id,a={frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0};this.selectionStart=this.selectionEnd=this.value.length,e(this).blur(),wp.media.editor.open(t,a),tp.table.set_table_changed()}))}},span:{prompt_shown:!1,add:function(a){var n="#rowspan#"===a?tablepress_strings.rowspan_add:tablepress_strings.colspan_add;if(!1===tp.content.span.prompt_shown&&(tp.content.span.prompt_shown={},tp.content.span.prompt_shown["#rowspan#"]=tp.content.span.prompt_shown["#colspan#"]=!1),t("option-use-datatables").prop("checked")){if(!confirm(tablepress_strings.span_add_datatables_warning))return;t("option-use-datatables").prop("checked",!1).change()}(tp.content.span.prompt_shown[a]||confirm(n))&&(tp.content.span.prompt_shown[a]=!0,t("edit-form-body").one("click","textarea",function(){var t=e(this),n=t.parent().index(),o=t.closest("tr").index();if("#rowspan#"===a){if(0===o)return void alert(tablepress_strings.no_rowspan_first_row);if(tp.table.head&&1===o)return void alert(tablepress_strings.no_rowspan_table_head);if(tp.table.foot&&tp.table.rows-1===o)return void alert(tablepress_strings.no_rowspan_table_foot)}else if("#colspan#"===a&&tp.table.no_data_columns_pre===n)return void alert(tablepress_strings.no_colspan_first_col);t.val(a),tp.table.set_table_changed()}))}}},tp.check={table_id:function(t){if(37!==t.which&&39!==t.which){var a=e(this);a.val(a.val().replace(/[^0-9a-zA-Z-_]/g,""))}},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},tp.reindex=function(){var a,n,o=t("edit-form-body").children(),s={};tp.table.rows=o.length,tp.table.rows>0?tp.table.columns=o.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:tp.table.columns=0,o.each(function(o,r){(a=e(r)).find("textarea").val(function(e,a){return""===a||"="!==a.charAt(0)?a:a.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(e,a,o){return s.hasOwnProperty(a)||((n=t("cell-"+a)).length?s[a]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):s[a]=a),e=s[a],void 0!==o&&""!==o&&(s.hasOwnProperty(o)||((n=t("cell-"+o)).length?s[o]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):s[o]=o),e+=":"+s[o]),e})}).attr("name",function(e){return"table[data]["+o+"]["+e+"]"}),a.find(".move-handle").html(o+1)}).each(function(t,a){e(a).find("textarea").attr("id",function(e){return"cell-"+tp.columns.number_to_letter(e+1)+(t+1)})}),t("edit-form-head").find(".move-handle").html(function(e){return tp.columns.number_to_letter(e+1)}),t("number-rows").val(tp.table.rows),t("number-columns").val(tp.table.columns),tp.table.set_table_changed()},tp.save_changes={trigger:function(a){return t("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(t("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void t("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(t("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void t("option-extra-css-classes").focus().select()):a.shiftKey?(tp.made_changes=!1,void t("tablepress-page").find("form").submit()):(e(this).closest("p").append('<span class="animation-saving spinner is-active" title="'+tablepress_strings.saving_changes+'"/>'),e(".save-changes-button").prop("disabled",!0),e("body").addClass("wait"),void e.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_save_table","#nonce-edit-table"),success:tp.save_changes.ajax_success,error:tp.save_changes.ajax_error,dataType:"json"}))},ajax_success:function(e,t){if(void 0===t||"success"!==t)tp.save_changes.error("AJAX call successful, but unclear status. Try again while holding down the &#8220;Shift&#8221; key.");else if(void 0===e||null===e||"-1"===e||void 0===e.success)tp.save_changes.error("AJAX call successful, but unclear data. Try again while holding down the &#8220;Shift&#8221; key.");else if(!0!==e.success){var a="";void 0!==e.error_details&&tablepress_options.print_debug_output&&(a="</p><p>These errors were encountered:</p><pre>"+e.error_details+"</pre><p>"),tp.save_changes.error("AJAX call successful, internal saving process failed. Try again while holding down the &#8220;Shift&#8221; key."+a)}else tp.save_changes.success(e)},ajax_error:function(e,t,a){tp.save_changes.error("AJAX call failed: "+t+" - "+a+". Try again while holding down the &#8220;Shift&#8221; key.")},success:function(a){tp.table.id!==a.table_id&&"pushState"in window.history&&null!==window.history.pushState&&window.history.pushState("","",window.location.href.replace(/table_id=[0-9a-zA-Z-_]+/gi,"table_id="+a.table_id)),t("edit-form").removeClass("tablepress-edit-screen-id-"+tp.table.id).addClass("tablepress-edit-screen-id-"+a.table_id),tp.table.id=tp.table.new_id=a.table_id,t("table-id").val(tp.table.id),t("table-new-id").val(tp.table.new_id),e(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]"),t("nonce-edit-table").val(a.new_edit_nonce),t("nonce-preview-table").val(a.new_preview_nonce);var n=e(".show-preview-button");n.length&&n.attr("href",n.first().attr("href").replace(/item=[a-zA-Z0-9_-]+/g,"item="+a.table_id).replace(/&_wpnonce=[a-z0-9]+/gi,"&_wpnonce="+a.new_preview_nonce)),t("last-modified").text(a.last_modified),t("last-editor").text(a.last_editor),tp.table.unset_table_changed(),tp.save_changes.after_saving_dialog("success",tablepress_strings[a.message])},error:function(e){tp.save_changes.after_saving_dialog("error",e)},after_saving_dialog:function(t,a){a=void 0===a?"":": "+a;var n,o="save-changes-"+t;"success"===t?(o+=" notice notice-success",n=3e3):(o+=" notice notice-error",n=6e3),e(".animation-saving").closest("p").after('<div class="ajax-alert '+o+'"><p>'+tablepress_strings["save_changes_"+t]+a+"</p></div>"),e(".animation-saving").remove(),e(".save-changes-"+t).delay(n).fadeOut(2e3,function(){e(this).remove()}),e(".save-changes-button").prop("disabled",!1),e("body").removeClass("wait")}},tp.init=function(){var a={click:{"#rows-insert":tp.rows.insert,"#columns-insert":tp.columns.insert,"#rows-duplicate":tp.rows.duplicate,"#columns-duplicate":tp.columns.duplicate,"#rows-remove":tp.rows.remove,"#columns-remove":tp.columns.remove,"#rows-hide":tp.rows.hide,"#columns-hide":tp.columns.hide,"#rows-unhide":tp.rows.unhide,"#columns-unhide":tp.columns.unhide,"#rows-append":tp.rows.append,"#columns-append":tp.columns.append,"#link-add":tp.content.link.add,"#image-add":tp.content.image.add,"#span-add-rowspan":function(){tp.content.span.add("#rowspan#")},"#span-add-colspan":function(){tp.content.span.add("#colspan#")},".show-preview-button":tp.table.preview.trigger,".save-changes-button":tp.save_changes.trigger,".show-help-box":function(){e(this).next().wpdialog({title:e(this).attr("title"),height:470,width:320,modal:!0,dialogClass:"wp-dialog",resizable:!1})}},keyup:{"#table-new-id":tp.check.table_id},change:{"#option-table-head":tp.table.change_table_head,"#option-table-foot":tp.table.change_table_foot,"#option-use-datatables":tp.table.change_datatables,"#option-datatables-paginate":tp.table.change_datatables_pagination},blur:{"#table-new-id":tp.table.change_id}},n=t("edit-form-body");e.each(a,function(t,a){e.each(a,function(a,n){e(a).on(t,n)})}),e(window).on("beforeunload",tp.check.changes_saved),t("option-table-head").change(),t("option-print-name").change(tp.table.change_print_name_description).change(),t("option-print-description").change(tp.table.change_print_name_description).change(),n.one("change","textarea",tp.table.set_table_changed),e("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed),tablepress_options.cells_advanced_editor?(n.on("click","textarea",tp.cells.advanced_editor.keyopen),t("advanced-editor-open").on("click",tp.cells.advanced_editor.buttonopen),t("advanced-editor-confirm").on("click",tp.cells.advanced_editor.save),t("advanced-editor-cancel").on("click",tp.cells.advanced_editor.close),t("advanced-editor").wpdialog({autoOpen:!1,title:t("advanced-editor-open").val(),width:600,modal:!0,dialogClass:"wp-dialog",resizable:!1}),t("wp-link").on("focus","input",function(e){e.stopPropagation()})):t("advanced-editor-open").hide(),e("body").on("focus",".media-modal .media-frame-content input, .media-modal .media-frame-content textarea",function(e){e.stopPropagation()}),tablepress_options.cells_auto_grow&&n.on("focus","textarea",tp.cells.autogrow),t("edit-form-body").on("click","input:checkbox",{parent:"#edit-form-body"},tp.cells.checkboxes.multi_select),t("edit-form-foot").on("click","input:checkbox",{parent:"#edit-form-foot"},tp.cells.checkboxes.multi_select),t("edit-form-head").on("click",".sort-control",tp.rows.sort),t("tablepress-page").find("form").on("submit",function(){e(this).find(".tablepress-postbox-table").find("input, select").prop("disabled",!1)}),n.sortable({axis:"y",containment:t("edit-form"),forceHelperSize:!0,handle:".move-handle",start:tp.rows.move.start,change:tp.rows.move.change,stop:tp.rows.move.stop,update:tp.reindex}),t("edit-form-head").sortable({axis:"x",items:".head",containment:"parent",forceHelperSize:!0,helper:"clone",handle:".move-handle",start:tp.columns.move.start,stop:tp.columns.move.stop,change:tp.columns.move.change,sort:tp.columns.move.sort}).disableSelection()},tp.init()});
1
+ window.tp=window.tp||{},jQuery(document).ready(function(e){"use strict";var t=function(t){return e(document.getElementById(t))};tp.made_changes=!1,tp.table={id:t("table-id").val(),new_id:t("table-new-id").val(),rows:parseInt(t("number-rows").val(),10),columns:parseInt(t("number-columns").val(),10),head:t("option-table-head").prop("checked"),foot:t("option-table-foot").prop("checked"),no_data_columns_pre:2,no_data_columns_post:1,body_cells_pre:'<tr><td><span class="move-handle"></span></td><td><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][rows][]" value="1" /></td>',body_cells_post:'<td><span class="move-handle"></span></td></tr>',body_cell:'<td><textarea rows="1"></textarea></td>',head_cell:'<th class="head"><span class="sort-control sort-desc" title="'+tablepress_strings.sort_desc+'"><span class="sorting-indicator"></span></span><span class="sort-control sort-asc" title="'+tablepress_strings.sort_asc+'"><span class="sorting-indicator"></span></span><span class="move-handle"></span></th>',foot_cell:'<th><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][columns][]" value="1" /></th>',set_table_changed:function(){tp.made_changes=!0},unset_table_changed:function(){tp.made_changes=!1,t("edit-form-body").one("change","textarea",tp.table.set_table_changed),e("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed)},change_id:function(){return""===e.trim(t("table-new-id").val())?(alert(tablepress_strings.table_id_not_empty),void t("table-new-id").val(tp.table.new_id).focus().select()):"0"===e.trim(t("table-new-id").val())?(alert(tablepress_strings.table_id_not_zero),void t("table-new-id").val(tp.table.new_id).focus().select()):void(this.value!==tp.table.new_id&&(confirm(tablepress_strings.ays_change_table_id)?(tp.table.new_id=this.value,e(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]").click(),tp.table.set_table_changed()):e(this).val(tp.table.new_id)))},change_table_head:function(){tp.table.head=e(this).prop("checked"),t("option-use-datatables").prop("disabled",!tp.table.head).change(),t("notice-datatables-head-row").toggle(!tp.table.head),tp.rows.stripe()},change_table_foot:function(){tp.table.foot=e(this).prop("checked"),tp.rows.stripe()},change_print_name_description:function(){t(this.id+"-position").prop("disabled",!e(this).prop("checked"))},change_datatables:function(){var e=t("option-use-datatables"),a=!(e.prop("checked")&&!e.prop("disabled"));e.closest("tbody").find("input").not(e).prop("disabled",a),tp.table.change_datatables_pagination()},change_datatables_pagination:function(){var e=t("option-datatables-paginate"),a=e.prop("checked")&&!e.prop("disabled");t("option-datatables-lengthchange").prop("disabled",!a),t("option-datatables-paginate_entries").prop("disabled",!a)},prepare_ajax_request:function(a,n){var o,s=t("edit-form-body"),r=[],i={rows:tp.table.rows,columns:tp.table.columns,hidden_rows:0,hidden_columns:0},l={rows:[],columns:[]};return s.children().each(function(t,a){r[t]=e(a).find("textarea").map(function(){return e(this).val()}).get()}),r=JSON.stringify(r),o={table_head:tp.table.head,table_foot:tp.table.foot,alternating_row_colors:t("option-alternating-row-colors").prop("checked"),row_hover:t("option-row-hover").prop("checked"),print_name:t("option-print-name").prop("checked"),print_description:t("option-print-description").prop("checked"),print_name_position:t("option-print-name-position").val(),print_description_position:t("option-print-description-position").val(),extra_css_classes:t("option-extra-css-classes").val(),use_datatables:t("option-use-datatables").prop("checked"),datatables_sort:t("option-datatables-sort").prop("checked"),datatables_filter:t("option-datatables-filter").prop("checked"),datatables_paginate:t("option-datatables-paginate").prop("checked"),datatables_lengthchange:t("option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:t("option-datatables-paginate_entries").val(),datatables_info:t("option-datatables-info").prop("checked"),datatables_scrollx:t("option-datatables-scrollx").prop("checked"),datatables_custom_commands:t("option-datatables-custom-commands").val()},o=JSON.stringify(o),l.rows=s.find('input[type="hidden"]').map(function(){return"1"===e(this).val()?1:(i.hidden_rows+=1,0)}).get(),l.columns=t("edit-form-foot").find('input[type="hidden"]').map(function(){return"1"===e(this).val()?1:(i.hidden_columns+=1,0)}).get(),l=JSON.stringify(l),{action:a,_ajax_nonce:e(n).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:t("table-name").val(),description:t("table-description").val(),number:i,data:r,options:o,visibility:l}}},preview:{trigger:function(){return tp.made_changes?t("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(t("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void t("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(t("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void t("option-extra-css-classes").focus().select()):(e(this).closest("p").append('<span class="animation-preview spinner is-active" title="'+tablepress_strings.preparing_preview+'"/>'),e("body").addClass("wait"),t("table-preview").empty(),e.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),success:tp.table.preview.ajax_success,error:tp.table.preview.ajax_error,dataType:"json"}),!1):(tp.table.preview.show(e(this).attr("href")+"&TB_iframe=true"),!1)},ajax_success:function(e,t){void 0===t||"success"!==t?tp.table.preview.error("AJAX call successful, but unclear status."):void 0===e||null===e||"-1"===e||void 0===e.success||!0!==e.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(e)},ajax_error:function(e,t,a){tp.table.preview.error("AJAX call failed: "+t+" - "+a)},success:function(a){t("table-preview").empty(),e('<iframe id="table-preview-iframe" />').load(function(){var t=e(this).contents();t.find("head").append(a.head_html),t.find("body").append(a.body_html)}).appendTo("#table-preview"),e(".animation-preview").remove(),e("body").removeClass("wait"),tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(t){e(".animation-preview").closest("p").after('<div class="ajax-alert preview-error error"><p>'+tablepress_strings.preview_error+": "+t+"</p></div>"),e(".animation-preview").remove(),e(".preview-error").delay(6e3).fadeOut(2e3,function(){e(this).remove()}),e("body").removeClass("wait")},show:function(t){var a=e(window).width()-120,n=e(window).height()-120;e("#wpadminbar").length&&(n-=parseInt(e("#wpadminbar").css("height"),10)),tb_show(e(".show-preview-button").first().text(),t+"&height="+n+"&width="+a,!1)}}},tp.rows={create:function(a){var n,o,s,r="";for(n=0;n<a;n++){for(r+=tp.table.body_cells_pre,o=0;o<tp.table.columns;o++)r+=tp.table.body_cell;r+=tp.table.body_cells_post}return s=t("edit-form-foot").find(".column-hidden").map(function(){return e(this).index()}).get(),e(r).each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,s)}).addClass("column-hidden")})},append:function(){var e=t("rows-append-number").val();if(!/^[1-9][0-9]{0,4}$/.test(e))return alert(tablepress_strings.append_num_rows_invalid),void t("rows-append-number").focus().select();t("edit-form-body").append(tp.rows.create(e)),tp.rows.stripe(),tp.reindex()},insert:function(e){var a=t("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==a.length?(a.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},duplicate:function(a){var n=t("edit-form-body").find("input:checked").prop("checked",a.shiftKey).closest("tr");0!==n.length?(n.each(function(t,a){var n=e(a),o=n.find("textarea"),s=n.clone();s.find("textarea").removeAttr("id").each(function(t,a){e(a).val(o.eq(t).val())}),n.after(s)}),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},hide:function(e){var a=t("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==a.length?(a.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},unhide:function(e){var a=t("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==a.length?(a.removeClass("row-hidden").find(".visibility").val("1"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},remove:function(){var e,a=t("edit-form-body").find("input:checked").closest("tr");0!==a.length?tp.table.rows!==a.length?(e=1===a.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(e)&&(a.remove(),tp.rows.stripe(),tp.reindex())):alert(tablepress_strings.no_remove_all_rows):alert(tablepress_strings.no_rows_selected)},move:{start:function(t,a){e(a.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+(tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>'),e(a.helper).removeClass("odd head-row foot-row")},change:function(e,t){tp.rows.stripe(t.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var t=e(this).parent().index(),a=e(this).hasClass("sort-asc")?1:-1,n=e("#edit-form-body"),o=n.find(".head-row").prevAll().addBack(),s=n.find(".foot-row").nextAll().addBack(),r=n.children().not(o).not(s).get();e.each(r,function(a,n){n.sort_key=(""+e(n).children().eq(t).find("textarea").val()).toLowerCase()}),r.sort(function(e,t){return a*function(e,t){var a,n,o=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,s=/^\s+|\s+$/g,r=/\s+/g,i=/^0x[0-9a-f]+$/i,l=/^0/,c=e.replace(s,"")||"",d=t.replace(s,"")||"",p=c.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),u=d.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=parseInt(c.match(i),16)||1!==p.length&&Date.parse(c),_=parseInt(d.match(i),16)||h&&d.match(/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/)&&Date.parse(d)||null,m=function(e,t){return(!e.match(l)||1===t)&&parseFloat(e)||e.replace(r," ").replace(s,"")||0};if(_){if(h<_)return-1;if(h>_)return 1}for(var b=0,f=p.length,v=u.length,g=Math.max(f,v);b<g;b++){if(a=m(p[b]||"",f),n=m(u[b]||"",v),isNaN(a)!==isNaN(n))return isNaN(a)?1:-1;if(/[^\x00-\x80]/.test(a+n)&&a.localeCompare){var w=a.localeCompare(n);return w/Math.abs(w)}if(a<n)return-1;if(a>n)return 1}}(e.sort_key,t.sort_key)}),e.each(r,function(e,t){t.sort_key=null}),n.append(o),n.append(r),n.append(s),tp.rows.stripe(),tp.reindex()},stripe:function(a){void 0===a&&(a=null),a=e(a);var n=t("edit-form-body").children().removeClass("odd head-row foot-row").not(a);n.filter(":even").addClass("odd"),n=n.not(".row-hidden"),a.hasClass("row-hidden")&&(n=n.not(".ui-sortable-placeholder")),tp.table.head&&n.first().addClass("head-row"),tp.table.foot&&n.last().addClass("foot-row")}},tp.columns={append:function(){var a,n=t("columns-append-number").val(),o="",s="",r="";if(!/^[1-9][0-9]{0,4}$/.test(n))return alert(tablepress_strings.append_num_columns_invalid),void t("columns-append-number").focus().select();for(a=0;a<n;a++)s+=tp.table.body_cell,o+=tp.table.head_cell,r+=tp.table.foot_cell;t("edit-form-body").children().each(function(t,a){e(a).children().slice(-tp.table.no_data_columns_post).before(s)}),t("edit-form-head").children().slice(-tp.table.no_data_columns_post).before(o),t("edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(r),tp.reindex()},insert:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,n)}).before(tp.table.body_cell)}),t("edit-form-head").children().filter(function(t){return-1!==e.inArray(t,n)}).before(tp.table.head_cell),o.before(tp.table.foot_cell),tp.reindex()):alert(tablepress_strings.no_columns_selected)},duplicate:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form").find("tr").each(function(t,a){e(a).children().each(function(t,a){if(-1!==e.inArray(t,n)){var o=e(a),s=o.clone();s.find("textarea").removeAttr("id").val(o.find("textarea").val()),o.after(s)}})}),tp.reindex()):alert(tablepress_strings.no_columns_selected)},hide:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().add("#edit-form-head").each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,n)}).addClass("column-hidden")}),o.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},unhide:function(a){var n,o=t("edit-form-foot").find("input:checked").prop("checked",a.shiftKey).closest("th");0!==o.length?(n=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().add("#edit-form-head").each(function(t,a){e(a).children().filter(function(t){return-1!==e.inArray(t,n)}).removeClass("column-hidden")}),o.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},remove:function(){var a,n,o=t("edit-form-foot").find("input:checked").closest("th");0!==o.length?tp.table.columns!==o.length?(n=1===o.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural,confirm(n)&&(a=o.map(function(){return e(this).index()}).get(),t("edit-form-body").children().add("#edit-form-head").each(function(t,n){e(n).children().filter(function(t){return-1!==e.inArray(t,a)}).remove()}),o.remove(),tp.reindex())):alert(tablepress_strings.no_remove_all_columns):alert(tablepress_strings.no_columns_selected)},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(a,n){var o,s=e(n.item);tp.columns.move.source_idx=s.index(),tp.columns.move.$rows=t("edit-form-body").children().add("#edit-form-foot"),tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=e(this),e('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell),tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide(),tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover"),o=tp.columns.move.$helper.eq(1).width(),tp.columns.move.$helper.eq(0).width(o),tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder"),tp.columns.move.$placeholder.find("div").width(o)},change:function(t,a){tp.columns.move.target_idx=e(a.placeholder).index(),tp.columns.move.target_idx-tp.columns.move.source_idx==1?tp.columns.move.target_idx+=1:tp.columns.move.target_idx===tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell=e(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))}),tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(e,t){tp.columns.move.$helper.css("left",t.position.left)},stop:function(){tp.columns.move.$helper.remove(),tp.columns.move.$cells.each(function(){tp.columns.move.$cell=e(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show(),tp.columns.move.$placeholder.remove(),tp.columns.move.source_idx=tp.columns.move.target_idx=-1,tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell=tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null,tp.reindex()}},number_to_letter:function(e){for(var t="";e>0;)t=String.fromCharCode(65+(e-1)%26)+t,e=Math.floor((e-1)/26);return t}},tp.cells={$focus:e(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus"),tp.cells.$focus=e(this).closest("tr").addClass("focus")},advanced_editor:{prompt_shown:!1,keyopen:function(a){if(a.shiftKey){var n=t("advanced-editor-content");tp.cells.$textarea=e(this).blur(),n.val(tp.cells.$textarea.val()),t("advanced-editor").wpdialog("open"),n.get(0).selectionStart=n.get(0).selectionEnd=n.val().length,n.focus()}},buttonopen:function(){(tp.cells.advanced_editor.prompt_shown||confirm(tablepress_strings.advanced_editor_open))&&(tp.cells.advanced_editor.prompt_shown=!0,t("edit-form-body").one("click","textarea",function(){var a=t("advanced-editor-content");tp.cells.$textarea=e(this).blur(),a.val(tp.cells.$textarea.val()),t("advanced-editor").wpdialog("open"),a.get(0).selectionStart=a.get(0).selectionEnd=a.val().length,a.focus()}))},save:function(){var e=t("advanced-editor-content").blur().val();tp.cells.$textarea.val()!==e&&(tp.cells.$textarea.val(e),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed()),tp.cells.$textarea.focus(),tp.cells.advanced_editor.close()},close:function(){return t("advanced-editor").wpdialog("close"),!1}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(t){if("undefined"===t.shiftKey)return!0;if(t.shiftKey){if(!tp.cells.checkboxes.last_clicked[t.data.parent])return!0;var a=e(t.data.parent).find(":checkbox"),n=a.index(tp.cells.checkboxes.last_clicked[t.data.parent]),o=a.index(this);n!==o&&a.slice(Math.min(n,o),Math.max(n,o)).prop("checked",e(this).prop("checked"))}return tp.cells.checkboxes.last_clicked[t.data.parent]=this,!0}}},tp.content={link:{prompt_shown:!1,add:function(){(tp.content.link.prompt_shown||confirm(tablepress_strings.link_add))&&(tp.content.link.prompt_shown=!0,t("edit-form-body").one("mousedown","textarea",function(){var t=this.id;e(document).one("mouseup",function(){"undefined"!=typeof wpLink&&(wpLink.open(t),tp.table.set_table_changed())})}))}},image:{prompt_shown:!1,add:function(){(tp.content.image.prompt_shown||confirm(tablepress_strings.image_add))&&(tp.content.image.prompt_shown=!0,t("edit-form-body").one("click","textarea",function(){var t=this.id,a={frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0};this.selectionStart=this.selectionEnd=this.value.length,e(this).blur(),wp.media.editor.open(t,a),tp.table.set_table_changed()}))}},span:{prompt_shown:!1,add:function(a){var n="#rowspan#"===a?tablepress_strings.rowspan_add:tablepress_strings.colspan_add;if(!1===tp.content.span.prompt_shown&&(tp.content.span.prompt_shown={},tp.content.span.prompt_shown["#rowspan#"]=tp.content.span.prompt_shown["#colspan#"]=!1),t("option-use-datatables").prop("checked")){if(!confirm(tablepress_strings.span_add_datatables_warning))return;t("option-use-datatables").prop("checked",!1).change()}(tp.content.span.prompt_shown[a]||confirm(n))&&(tp.content.span.prompt_shown[a]=!0,t("edit-form-body").one("click","textarea",function(){var t=e(this),n=t.parent().index(),o=t.closest("tr").index();if("#rowspan#"===a){if(0===o)return void alert(tablepress_strings.no_rowspan_first_row);if(tp.table.head&&1===o)return void alert(tablepress_strings.no_rowspan_table_head);if(tp.table.foot&&tp.table.rows-1===o)return void alert(tablepress_strings.no_rowspan_table_foot)}else if("#colspan#"===a&&tp.table.no_data_columns_pre===n)return void alert(tablepress_strings.no_colspan_first_col);t.val(a),tp.table.set_table_changed()}))}}},tp.check={table_id:function(t){if(37!==t.which&&39!==t.which){var a=e(this);a.val(a.val().replace(/[^0-9a-zA-Z-_]/g,""))}},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},tp.reindex=function(){var a,n,o=t("edit-form-body").children(),s={};tp.table.rows=o.length,tp.table.rows>0?tp.table.columns=o.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:tp.table.columns=0,o.each(function(o,r){(a=e(r)).find("textarea").val(function(e,a){return""===a||"="!==a.charAt(0)?a:a.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(e,a,o){return s.hasOwnProperty(a)||((n=t("cell-"+a)).length?s[a]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):s[a]=a),e=s[a],void 0!==o&&""!==o&&(s.hasOwnProperty(o)||((n=t("cell-"+o)).length?s[o]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):s[o]=o),e+=":"+s[o]),e})}).attr("name",function(e){return"table[data]["+o+"]["+e+"]"}),a.find(".move-handle").html(o+1)}).each(function(t,a){e(a).find("textarea").attr("id",function(e){return"cell-"+tp.columns.number_to_letter(e+1)+(t+1)})}),t("edit-form-head").find(".move-handle").html(function(e){return tp.columns.number_to_letter(e+1)}),t("number-rows").val(tp.table.rows),t("number-columns").val(tp.table.columns),tp.table.set_table_changed()},tp.save_changes={trigger:function(a){return t("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(t("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void t("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(t("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void t("option-extra-css-classes").focus().select()):a.shiftKey?(tp.made_changes=!1,void t("tablepress-page").find("form").submit()):(e(this).closest("p").append('<span class="animation-saving spinner is-active" title="'+tablepress_strings.saving_changes+'"/>'),e(".save-changes-button").prop("disabled",!0),e("body").addClass("wait"),void e.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_save_table","#nonce-edit-table"),success:tp.save_changes.ajax_success,error:tp.save_changes.ajax_error,dataType:"json"}))},ajax_success:function(e,t){if(void 0===t||"success"!==t)tp.save_changes.error("AJAX call successful, but unclear status. Try again while holding down the &#8220;Shift&#8221; key.");else if(void 0===e||null===e||"-1"===e||void 0===e.success)tp.save_changes.error("AJAX call successful, but unclear data. Try again while holding down the &#8220;Shift&#8221; key.");else if(!0!==e.success){var a="";void 0!==e.error_details&&tablepress_options.print_debug_output&&(a="</p><p>These errors were encountered:</p><pre>"+e.error_details+"</pre><p>"),tp.save_changes.error("AJAX call successful, internal saving process failed. Try again while holding down the &#8220;Shift&#8221; key."+a)}else tp.save_changes.success(e)},ajax_error:function(e,t,a){tp.save_changes.error("AJAX call failed: "+t+" - "+a+". Try again while holding down the &#8220;Shift&#8221; key.")},success:function(a){tp.table.id!==a.table_id&&"pushState"in window.history&&null!==window.history.pushState&&window.history.pushState("","",window.location.href.replace(/table_id=[0-9a-zA-Z-_]+/gi,"table_id="+a.table_id)),t("edit-form").removeClass("tablepress-edit-screen-id-"+tp.table.id).addClass("tablepress-edit-screen-id-"+a.table_id),tp.table.id=tp.table.new_id=a.table_id,t("table-id").val(tp.table.id),t("table-new-id").val(tp.table.new_id),e(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]"),t("nonce-edit-table").val(a.new_edit_nonce),t("nonce-preview-table").val(a.new_preview_nonce);var n=e(".show-preview-button");n.length&&n.attr("href",n.first().attr("href").replace(/item=[a-zA-Z0-9_-]+/g,"item="+a.table_id).replace(/&_wpnonce=[a-z0-9]+/gi,"&_wpnonce="+a.new_preview_nonce)),t("last-modified").text(a.last_modified),t("last-editor").text(a.last_editor),tp.table.unset_table_changed(),tp.save_changes.after_saving_dialog("success",tablepress_strings[a.message])},error:function(e){tp.save_changes.after_saving_dialog("error",e)},after_saving_dialog:function(t,a){a=void 0===a?"":": "+a;var n,o="save-changes-"+t;"success"===t?(o+=" notice notice-success",n=3e3):(o+=" notice notice-error",n=6e3),e(".animation-saving").closest("p").after('<div class="ajax-alert '+o+'"><p>'+tablepress_strings["save_changes_"+t]+a+"</p></div>"),e(".animation-saving").remove(),e(".save-changes-"+t).delay(n).fadeOut(2e3,function(){e(this).remove()}),e(".save-changes-button").prop("disabled",!1),e("body").removeClass("wait")}},tp.init=function(){var a={click:{"#rows-insert":tp.rows.insert,"#columns-insert":tp.columns.insert,"#rows-duplicate":tp.rows.duplicate,"#columns-duplicate":tp.columns.duplicate,"#rows-remove":tp.rows.remove,"#columns-remove":tp.columns.remove,"#rows-hide":tp.rows.hide,"#columns-hide":tp.columns.hide,"#rows-unhide":tp.rows.unhide,"#columns-unhide":tp.columns.unhide,"#rows-append":tp.rows.append,"#columns-append":tp.columns.append,"#link-add":tp.content.link.add,"#image-add":tp.content.image.add,"#span-add-rowspan":function(){tp.content.span.add("#rowspan#")},"#span-add-colspan":function(){tp.content.span.add("#colspan#")},".show-preview-button":tp.table.preview.trigger,".save-changes-button":tp.save_changes.trigger,".show-help-box":function(){e(this).next().wpdialog({title:e(this).attr("title"),height:470,width:320,modal:!0,dialogClass:"wp-dialog",resizable:!1})}},keyup:{"#table-new-id":tp.check.table_id},change:{"#option-table-head":tp.table.change_table_head,"#option-table-foot":tp.table.change_table_foot,"#option-use-datatables":tp.table.change_datatables,"#option-datatables-paginate":tp.table.change_datatables_pagination},blur:{"#table-new-id":tp.table.change_id}},n=t("edit-form-body");e.each(a,function(t,a){e.each(a,function(a,n){e(a).on(t,n)})}),e(window).on("beforeunload",tp.check.changes_saved),t("option-table-head").change(),t("option-print-name").change(tp.table.change_print_name_description).change(),t("option-print-description").change(tp.table.change_print_name_description).change(),n.one("change","textarea",tp.table.set_table_changed),e("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed),tablepress_options.cells_advanced_editor?(n.on("click","textarea",tp.cells.advanced_editor.keyopen),t("advanced-editor-open").on("click",tp.cells.advanced_editor.buttonopen),t("advanced-editor-confirm").on("click",tp.cells.advanced_editor.save),t("advanced-editor-cancel").on("click",tp.cells.advanced_editor.close),t("advanced-editor").wpdialog({autoOpen:!1,title:t("advanced-editor-open").val(),width:600,modal:!0,dialogClass:"wp-dialog",resizable:!1}),t("wp-link").on("focus","input",function(e){e.stopPropagation()})):t("advanced-editor-open").hide(),e("body").on("focus",".media-modal .media-frame-content input, .media-modal .media-frame-content textarea",function(e){e.stopPropagation()}),tablepress_options.cells_auto_grow&&n.on("focus","textarea",tp.cells.autogrow),t("edit-form-body").on("click","input:checkbox",{parent:"#edit-form-body"},tp.cells.checkboxes.multi_select),t("edit-form-foot").on("click","input:checkbox",{parent:"#edit-form-foot"},tp.cells.checkboxes.multi_select),t("edit-form-head").on("click",".sort-control",tp.rows.sort),t("tablepress-page").find("form").on("submit",function(){e(this).find(".tablepress-postbox-table").find("input, select").prop("disabled",!1)}),n.sortable({axis:"y",containment:t("edit-form"),forceHelperSize:!0,handle:".move-handle",start:tp.rows.move.start,change:tp.rows.move.change,stop:tp.rows.move.stop,update:tp.reindex}),t("edit-form-head").sortable({axis:"x",items:".head",containment:"parent",forceHelperSize:!0,helper:"clone",handle:".move-handle",start:tp.columns.move.start,stop:tp.columns.move.stop,change:tp.columns.move.change,sort:tp.columns.move.sort}).disableSelection()},tp.init()});
admin/js/options.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * JavaScript code for the "Options" screen
3
  *
4
  * @package TablePress
5
  * @subpackage Views JavaScript
@@ -7,60 +7,19 @@
7
  * @since 1.0.0
8
  */
9
 
10
- /* global confirm, CodeMirror, tablepress_strings */
11
 
12
  jQuery( document ).ready( function( $ ) {
13
 
14
  'use strict';
15
 
16
  /**
17
- * Invoke CodeMirror on the "Custom CSS" textarea.
18
- *
19
- * @since 1.0.0
20
- */
21
- var CM_custom_css = CodeMirror.fromTextArea( document.getElementById( 'option-custom-css' ), {
22
- mode: 'css',
23
- indentUnit: 2,
24
- tabSize: 2,
25
- indentWithTabs: true
26
- } );
27
-
28
- /**
29
- * Make the CodeMirror textarea vertically resizable.
30
- *
31
- * @since 1.7.0
32
- */
33
- $( CM_custom_css.getWrapperElement() ).resizable( {
34
- handles: 's',
35
- resize: function() {
36
- var $this = $(this);
37
- CM_custom_css.setSize( $this.width(), $this.height() );
38
- }
39
- } );
40
-
41
- /**
42
- * "Custom CSS" textarea grows on focus, if it is not disabled, but only once.
43
- *
44
- * @since 1.0.0
45
- */
46
- $( '#tablepress-page' ).find( '.CodeMirror' ).on( 'mousedown.codemirror', function() {
47
- var $this = $(this);
48
- if ( ! $this.hasClass( 'disabled' ) ) {
49
- $this.addClass( 'large' );
50
- CM_custom_css.refresh();
51
- $this.off( 'mousedown.codemirror' );
52
- }
53
- } );
54
-
55
- /**
56
- * Enable/disable "Custom CSS" textarea and "Load from file" checkbox according to state of "Use Custom CSS" checkbox.
57
  *
58
  * @since 1.0.0
59
  */
60
  $( '#option-use-custom-css' ).on( 'change', function() {
61
- var use_custom_css = $(this).prop( 'checked' );
62
- CM_custom_css.setOption( 'readOnly', ! use_custom_css );
63
- $( '#tablepress-page' ).find( '.CodeMirror' ).toggleClass( 'disabled', ! use_custom_css );
64
  } ).change();
65
 
66
  /**
1
  /**
2
+ * JavaScript code for the "Options" screen, without the CodeMirror handling
3
  *
4
  * @package TablePress
5
  * @subpackage Views JavaScript
7
  * @since 1.0.0
8
  */
9
 
10
+ /* global confirm, tablepress_strings */
11
 
12
  jQuery( document ).ready( function( $ ) {
13
 
14
  'use strict';
15
 
16
  /**
17
+ * Enable/disable the regular textarea according to state of "Load Custom CSS" checkbox.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  *
19
  * @since 1.0.0
20
  */
21
  $( '#option-use-custom-css' ).on( 'change', function() {
22
+ $( '#option-custom-css' ).prop( 'disabled', ! $(this).prop( 'checked' ) );
 
 
23
  } ).change();
24
 
25
  /**
admin/js/options.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(e){"use strict";var s=CodeMirror.fromTextArea(document.getElementById("option-custom-css"),{mode:"css",indentUnit:2,tabSize:2,indentWithTabs:!0});e(s.getWrapperElement()).resizable({handles:"s",resize:function(){var n=e(this);s.setSize(n.width(),n.height())}}),e("#tablepress-page").find(".CodeMirror").on("mousedown.codemirror",function(){var n=e(this);n.hasClass("disabled")||(n.addClass("large"),s.refresh(),n.off("mousedown.codemirror"))}),e("#option-use-custom-css").on("change",function(){var n=e(this).prop("checked");s.setOption("readOnly",!n),e("#tablepress-page").find(".CodeMirror").toggleClass("disabled",!n)}).change(),e("#tablepress-page").on("submit","form",function(){e(this).find("input, select, textarea").prop("disabled",!1)}),e("#uninstall-tablepress").on("click",function(){return!!confirm(tablepress_strings.uninstall_warning_1)&&confirm(tablepress_strings.uninstall_warning_2)})});
1
+ jQuery(document).ready(function(n){"use strict";n("#option-use-custom-css").on("change",function(){n("#option-custom-css").prop("disabled",!n(this).prop("checked"))}).change(),n("#tablepress-page").on("submit","form",function(){n(this).find("input, select, textarea").prop("disabled",!1)}),n("#uninstall-tablepress").on("click",function(){return!!confirm(tablepress_strings.uninstall_warning_1)&&confirm(tablepress_strings.uninstall_warning_2)})});
classes/class-admin-page-helper.php CHANGED
@@ -76,7 +76,7 @@ class TablePress_Admin_Page {
76
  * @return string New admin footer content.
77
  */
78
  public function _admin_footer_text( $content ) {
79
- $content .= ' &bull; ' . sprintf( __( 'Thank you for using <a href="%s">TablePress</a>.', 'tablepress' ) , 'https://tablepress.org/' );
80
  $content .= ' ' . sprintf( __( 'Support the plugin with your <a href="%s">donation</a>!', 'tablepress' ), 'https://tablepress.org/donate/' );
81
  return $content;
82
  }
76
  * @return string New admin footer content.
77
  */
78
  public function _admin_footer_text( $content ) {
79
+ $content .= ' &bull; ' . sprintf( __( 'Thank you for using <a href="%s">TablePress</a>.', 'tablepress' ), 'https://tablepress.org/' );
80
  $content .= ' ' . sprintf( __( 'Support the plugin with your <a href="%s">donation</a>!', 'tablepress' ), 'https://tablepress.org/donate/' );
81
  return $content;
82
  }
classes/class-controller.php CHANGED
@@ -99,7 +99,7 @@ abstract class TablePress_Controller {
99
  if ( 0 === TablePress::$model_options->get( 'first_activation' ) ) {
100
  // Save initial set of plugin options, and time of first activation of the plugin, on first activation.
101
  TablePress::$model_options->update( array(
102
- 'first_activation' => current_time( 'timestamp' ),
103
  'plugin_options_db_version' => TablePress::db_version,
104
  ) );
105
  } else {
@@ -107,9 +107,9 @@ abstract class TablePress_Controller {
107
  TablePress::$model_options->merge_plugin_options_defaults();
108
  $updated_options = array(
109
  'plugin_options_db_version' => TablePress::db_version,
110
- 'prev_tablepress_version' => TablePress::$model_options->get( 'tablepress_version' ),
111
- 'tablepress_version' => TablePress::version,
112
- 'message_plugin_update' => true,
113
  );
114
 
115
  // Only write files, if "Custom CSS" is to be used, and if there is "Custom CSS".
99
  if ( 0 === TablePress::$model_options->get( 'first_activation' ) ) {
100
  // Save initial set of plugin options, and time of first activation of the plugin, on first activation.
101
  TablePress::$model_options->update( array(
102
+ 'first_activation' => current_time( 'timestamp' ),
103
  'plugin_options_db_version' => TablePress::db_version,
104
  ) );
105
  } else {
107
  TablePress::$model_options->merge_plugin_options_defaults();
108
  $updated_options = array(
109
  'plugin_options_db_version' => TablePress::db_version,
110
+ 'prev_tablepress_version' => TablePress::$model_options->get( 'tablepress_version' ),
111
+ 'tablepress_version' => TablePress::version,
112
+ 'message_plugin_update' => true,
113
  );
114
 
115
  // Only write files, if "Custom CSS" is to be used, and if there is "Custom CSS".
classes/class-css.php CHANGED
@@ -29,11 +29,11 @@ class TablePress_CSS {
29
  * @return string Sanitized and tidied CSS code.
30
  */
31
  public function sanitize_css( $css ) {
32
- $csstidy = TablePress::load_class( 'CSSTidy', 'class.csstidy.php', 'libraries/csstidy' );
33
 
34
  // Sanitization and not just tidying for users without enough privileges.
35
  if ( ! current_user_can( 'unfiltered_html' ) ) {
36
- $csstidy->optimise = new CSSTidy_custom_sanitize( $csstidy );
37
 
38
  // Let "arrows" survive, otherwise this might be recognized as the beginning of an HTML tag and removed with other stuff behind it.
39
  $css = str_replace( '<=', '&lt;=', $css );
@@ -75,8 +75,8 @@ class TablePress_CSS {
75
  * @return string Minified CSS code.
76
  */
77
  public function minify_css( $css ) {
78
- $csstidy = TablePress::load_class( 'CSSTidy', 'class.csstidy.php', 'libraries/csstidy' );
79
- $csstidy->optimise = new CSSTidy_custom_sanitize( $csstidy );
80
  $csstidy->set_cfg( 'remove_bslash', false );
81
  $csstidy->set_cfg( 'compress_colors', true );
82
  $csstidy->set_cfg( 'compress_font-weight', true );
@@ -327,7 +327,7 @@ class TablePress_CSS {
327
  $default_css = str_replace( 'url(tablepress.', 'url(' . $absolute_path, $default_css );
328
  }
329
  $file_content = array(
330
- 'normal' => $custom_css_normal,
331
  'minified' => $custom_css_minified,
332
  'combined' => $default_css . "\n" . $custom_css_minified,
333
  );
29
  * @return string Sanitized and tidied CSS code.
30
  */
31
  public function sanitize_css( $css ) {
32
+ $csstidy = TablePress::load_class( 'TablePress_CSSTidy', 'class.csstidy.php', 'libraries/csstidy' );
33
 
34
  // Sanitization and not just tidying for users without enough privileges.
35
  if ( ! current_user_can( 'unfiltered_html' ) ) {
36
+ $csstidy->optimise = new TablePress_CSSTidy_custom_sanitize( $csstidy );
37
 
38
  // Let "arrows" survive, otherwise this might be recognized as the beginning of an HTML tag and removed with other stuff behind it.
39
  $css = str_replace( '<=', '&lt;=', $css );
75
  * @return string Minified CSS code.
76
  */
77
  public function minify_css( $css ) {
78
+ $csstidy = TablePress::load_class( 'TablePress_CSSTidy', 'class.csstidy.php', 'libraries/csstidy' );
79
+ $csstidy->optimise = new TablePress_CSSTidy_custom_sanitize( $csstidy );
80
  $csstidy->set_cfg( 'remove_bslash', false );
81
  $csstidy->set_cfg( 'compress_colors', true );
82
  $csstidy->set_cfg( 'compress_font-weight', true );
327
  $default_css = str_replace( 'url(tablepress.', 'url(' . $absolute_path, $default_css );
328
  }
329
  $file_content = array(
330
+ 'normal' => $custom_css_normal,
331
  'minified' => $custom_css_minified,
332
  'combined' => $default_css . "\n" . $custom_css_minified,
333
  );
classes/class-export.php CHANGED
@@ -52,13 +52,13 @@ class TablePress_Export {
52
  public function __construct() {
53
  // Initiate here, because function call not possible outside a class method.
54
  $this->export_formats = array(
55
- 'csv' => __( 'CSV - Character-Separated Values', 'tablepress' ),
56
  'html' => __( 'HTML - Hypertext Markup Language', 'tablepress' ),
57
  'json' => __( 'JSON - JavaScript Object Notation', 'tablepress' ),
58
  );
59
  $this->csv_delimiters = array(
60
- ';' => __( '; (semicolon)', 'tablepress' ),
61
- ',' => __( ', (comma)', 'tablepress' ),
62
  'tab' => __( '\t (tabulator)', 'tablepress' ),
63
  );
64
 
52
  public function __construct() {
53
  // Initiate here, because function call not possible outside a class method.
54
  $this->export_formats = array(
55
+ 'csv' => __( 'CSV - Character-Separated Values', 'tablepress' ),
56
  'html' => __( 'HTML - Hypertext Markup Language', 'tablepress' ),
57
  'json' => __( 'JSON - JavaScript Object Notation', 'tablepress' ),
58
  );
59
  $this->csv_delimiters = array(
60
+ ';' => __( '; (semicolon)', 'tablepress' ),
61
+ ',' => __( ', (comma)', 'tablepress' ),
62
  'tab' => __( '\t (tabulator)', 'tablepress' ),
63
  );
64
 
classes/class-import.php CHANGED
@@ -175,7 +175,7 @@ class TablePress_Import {
175
  return;
176
  }
177
  libxml_clear_errors(); // Clear errors so that we only catch those inside the table in the next line.
178
- $table = simplexml_import_dom( $dom_tables[0] );
179
  if ( false === $table ) {
180
  $this->imported_table = false;
181
  return;
@@ -202,7 +202,7 @@ class TablePress_Import {
202
  }
203
 
204
  $html_table = array(
205
- 'data' => array(),
206
  'options' => array(),
207
  );
208
  if ( isset( $table->thead ) ) {
@@ -247,7 +247,7 @@ class TablePress_Import {
247
  $new_row[] = $matches[1];
248
 
249
  // Look for colspan and add correct number of cells.
250
- if( 1 === preg_match( '#<t(?:d|h).*colspan="(\d+)".*?>#is', $cell->asXml(), $matches ) ) {
251
  for ( $i = 1; $i < (int) $matches[1]; $i++ ) {
252
  $new_row[] = '#colspan#';
253
  }
175
  return;
176
  }
177
  libxml_clear_errors(); // Clear errors so that we only catch those inside the table in the next line.
178
+ $table = simplexml_import_dom( $dom_tables->item( 0 ) );
179
  if ( false === $table ) {
180
  $this->imported_table = false;
181
  return;
202
  }
203
 
204
  $html_table = array(
205
+ 'data' => array(),
206
  'options' => array(),
207
  );
208
  if ( isset( $table->thead ) ) {
247
  $new_row[] = $matches[1];
248
 
249
  // Look for colspan and add correct number of cells.
250
+ if ( 1 === preg_match( '#<t(?:d|h).*colspan="(\d+)".*?>#is', $cell->asXml(), $matches ) ) {
251
  for ( $i = 1; $i < (int) $matches[1]; $i++ ) {
252
  $new_row[] = '#colspan#';
253
  }
classes/class-render.php CHANGED
@@ -53,7 +53,7 @@ class TablePress_Render {
53
  protected $span_trigger = array(
54
  'colspan' => '#colspan#',
55
  'rowspan' => '#rowspan#',
56
- 'span' => '#span#',
57
  );
58
 
59
  /**
@@ -174,25 +174,25 @@ class TablePress_Render {
174
  $elements = array( 'rows', 'columns' );
175
  foreach ( $actions as $action ) {
176
  foreach ( $elements as $element ) {
177
- if ( empty( $this->render_options["{$action}_{$element}"] ) ) {
178
- $this->render_options["{$action}_{$element}"] = array();
179
  continue;
180
  }
181
 
182
  // Add all rows/columns to array if "all" value set for one of the four parameters.
183
- if ( 'all' === $this->render_options["{$action}_{$element}"] ) {
184
- $this->render_options["{$action}_{$element}"] = range( 0, ${'num_' . $element} - 1 );
185
  continue;
186
  }
187
 
188
  // We have a list of rows/columns (possibly with ranges in it).
189
- $this->render_options["{$action}_{$element}"] = explode( ',', $this->render_options["{$action}_{$element}"] );
190
  // Support for ranges like 3-6 or A-BA.
191
  $range_cells = array();
192
- foreach ( $this->render_options["{$action}_{$element}"] as $key => $value ) {
193
  $range_dash = strpos( $value, '-' );
194
  if ( false !== $range_dash ) {
195
- unset( $this->render_options["{$action}_{$element}"][ $key ] );
196
  $start = substr( $value, 0, $range_dash );
197
  if ( ! is_numeric( $start ) ) {
198
  $start = TablePress::letter_to_number( $start );
@@ -205,21 +205,21 @@ class TablePress_Render {
205
  $range_cells = array_merge( $range_cells, $current_range );
206
  }
207
  }
208
- $this->render_options["{$action}_{$element}"] = array_merge( $this->render_options["{$action}_{$element}"], $range_cells );
209
  /*
210
  * Parse single letters and change from regular numbering to zero-based numbering,
211
  * as rows/columns are indexed from 0 internally, but from 1 externally
212
  */
213
- foreach ( $this->render_options["{$action}_{$element}"] as $key => $value ) {
214
  if ( ! is_numeric( $value ) ) {
215
  $value = TablePress::letter_to_number( $value );
216
  }
217
- $this->render_options["{$action}_{$element}"][ $key ] = (int) $value - 1;
218
  }
219
 
220
  // Remove duplicate entries and sort the array.
221
- $this->render_options["{$action}_{$element}"] = array_unique( $this->render_options["{$action}_{$element}"] );
222
- sort( $this->render_options["{$action}_{$element}"], SORT_NUMERIC );
223
  }
224
  }
225
 
@@ -684,7 +684,7 @@ class TablePress_Render {
684
  $tr_attributes = array();
685
 
686
  // "class" attribute.
687
- $row_classes = 'row-' . ( $row_idx + 1 ) ;
688
  if ( $this->render_options['alternating_row_colors'] ) {
689
  $row_classes .= ( 1 === ( $row_idx % 2 ) ) ? ' even' : ' odd';
690
  }
@@ -778,39 +778,39 @@ class TablePress_Render {
778
  public function get_default_render_options() {
779
  // Attention: Array keys have to be lowercase, otherwise they won't match the Shortcode attributes, which will be passed in lowercase by WP.
780
  return array(
781
- 'id' => '',
782
- 'column_widths' => '',
783
- 'alternating_row_colors' => null,
784
- 'row_hover' => null,
785
- 'table_head' => null,
786
- 'table_foot' => null,
787
- 'first_column_th' => false,
788
- 'print_name' => null,
789
- 'print_name_position' => null,
790
- 'print_description' => null,
791
- 'print_description_position' => null,
792
- 'cache_table_output' => true,
793
- 'convert_line_breaks' => true,
794
- 'extra_css_classes' => null,
795
- 'use_datatables' => null,
796
- 'datatables_sort' => null,
797
- 'datatables_paginate' => null,
798
  'datatables_paginate_entries' => null,
799
- 'datatables_lengthchange' => null,
800
- 'datatables_filter' => null,
801
- 'datatables_info' => null,
802
- 'datatables_scrollx' => null,
803
- 'datatables_scrolly' => false,
804
- 'datatables_custom_commands' => null,
805
- 'datatables_locale' => get_locale(),
806
- 'show_rows' => '',
807
- 'show_columns' => '',
808
- 'hide_rows' => '',
809
- 'hide_columns' => '',
810
- 'cellspacing' => false,
811
- 'cellpadding' => false,
812
- 'border' => false,
813
- 'shortcode_debug' => false,
814
  );
815
  }
816
 
53
  protected $span_trigger = array(
54
  'colspan' => '#colspan#',
55
  'rowspan' => '#rowspan#',
56
+ 'span' => '#span#',
57
  );
58
 
59
  /**
174
  $elements = array( 'rows', 'columns' );
175
  foreach ( $actions as $action ) {
176
  foreach ( $elements as $element ) {
177
+ if ( empty( $this->render_options[ "{$action}_{$element}" ] ) ) {
178
+ $this->render_options[ "{$action}_{$element}" ] = array();
179
  continue;
180
  }
181
 
182
  // Add all rows/columns to array if "all" value set for one of the four parameters.
183
+ if ( 'all' === $this->render_options[ "{$action}_{$element}" ] ) {
184
+ $this->render_options[ "{$action}_{$element}" ] = range( 0, ${'num_' . $element} - 1 );
185
  continue;
186
  }
187
 
188
  // We have a list of rows/columns (possibly with ranges in it).
189
+ $this->render_options[ "{$action}_{$element}" ] = explode( ',', $this->render_options[ "{$action}_{$element}" ] );
190
  // Support for ranges like 3-6 or A-BA.
191
  $range_cells = array();
192
+ foreach ( $this->render_options[ "{$action}_{$element}" ] as $key => $value ) {
193
  $range_dash = strpos( $value, '-' );
194
  if ( false !== $range_dash ) {
195
+ unset( $this->render_options[ "{$action}_{$element}" ][ $key ] );
196
  $start = substr( $value, 0, $range_dash );
197
  if ( ! is_numeric( $start ) ) {
198
  $start = TablePress::letter_to_number( $start );
205
  $range_cells = array_merge( $range_cells, $current_range );
206
  }
207
  }
208
+ $this->render_options[ "{$action}_{$element}" ] = array_merge( $this->render_options[ "{$action}_{$element}" ], $range_cells );
209
  /*
210
  * Parse single letters and change from regular numbering to zero-based numbering,
211
  * as rows/columns are indexed from 0 internally, but from 1 externally
212
  */
213
+ foreach ( $this->render_options[ "{$action}_{$element}" ] as $key => $value ) {
214
  if ( ! is_numeric( $value ) ) {
215
  $value = TablePress::letter_to_number( $value );
216
  }
217
+ $this->render_options[ "{$action}_{$element}" ][ $key ] = (int) $value - 1;
218
  }
219
 
220
  // Remove duplicate entries and sort the array.
221
+ $this->render_options[ "{$action}_{$element}" ] = array_unique( $this->render_options[ "{$action}_{$element}" ] );
222
+ sort( $this->render_options[ "{$action}_{$element}" ], SORT_NUMERIC );
223
  }
224
  }
225
 
684
  $tr_attributes = array();
685
 
686
  // "class" attribute.
687
+ $row_classes = 'row-' . ( $row_idx + 1 );
688
  if ( $this->render_options['alternating_row_colors'] ) {
689
  $row_classes .= ( 1 === ( $row_idx % 2 ) ) ? ' even' : ' odd';
690
  }
778
  public function get_default_render_options() {
779
  // Attention: Array keys have to be lowercase, otherwise they won't match the Shortcode attributes, which will be passed in lowercase by WP.
780
  return array(
781
+ 'id' => '',
782
+ 'column_widths' => '',
783
+ 'alternating_row_colors' => null,
784
+ 'row_hover' => null,
785
+ 'table_head' => null,
786
+ 'table_foot' => null,
787
+ 'first_column_th' => false,
788
+ 'print_name' => null,
789
+ 'print_name_position' => null,
790
+ 'print_description' => null,
791
+ 'print_description_position' => null,
792
+ 'cache_table_output' => true,
793
+ 'convert_line_breaks' => true,
794
+ 'extra_css_classes' => null,
795
+ 'use_datatables' => null,
796
+ 'datatables_sort' => null,
797
+ 'datatables_paginate' => null,
798
  'datatables_paginate_entries' => null,
799
+ 'datatables_lengthchange' => null,
800
+ 'datatables_filter' => null,
801
+ 'datatables_info' => null,
802
+ 'datatables_scrollx' => null,
803
+ 'datatables_scrolly' => false,
804
+ 'datatables_custom_commands' => null,
805
+ 'datatables_locale' => get_locale(),
806
+ 'show_rows' => '',
807
+ 'show_columns' => '',
808
+ 'hide_rows' => '',
809
+ 'hide_columns' => '',
810
+ 'cellspacing' => false,
811
+ 'cellpadding' => false,
812
+ 'border' => false,
813
+ 'shortcode_debug' => false,
814
  );
815
  }
816
 
classes/class-tablepress.php CHANGED
@@ -26,7 +26,7 @@ abstract class TablePress {
26
  * @since 1.0.0
27
  * @const string
28
  */
29
- const version = '1.8.1';
30
 
31
  /**
32
  * TablePress internal plugin version ("options scheme" version).
@@ -36,7 +36,7 @@ abstract class TablePress {
36
  * @since 1.0.0
37
  * @const int
38
  */
39
- const db_version = 35;
40
 
41
  /**
42
  * TablePress "table scheme" (data format structure) version.
@@ -113,9 +113,9 @@ abstract class TablePress {
113
  return;
114
  }
115
 
116
- // Check if minimum requirements are fulfilled, currently WordPress 4.7.
117
  include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version.
118
- if ( version_compare( str_replace( '-src', '', $wp_version ), '4.7', '<' ) ) {
119
  // Show error notice to admins, if WP is not installed in the minimum required version, in which case TablePress will not work.
120
  if ( current_user_can( 'update_plugins' ) ) {
121
  add_action( 'admin_notices', array( 'TablePress', 'show_minimum_requirements_error_notice' ) );
@@ -403,9 +403,9 @@ abstract class TablePress {
403
 
404
  // $default_params also determines the order of the values in the query string.
405
  $default_params = array(
406
- 'page' => false,
407
  'action' => false,
408
- 'item' => false,
409
  );
410
  $params = array_merge( $default_params, $params );
411
 
26
  * @since 1.0.0
27
  * @const string
28
  */
29
+ const version = '1.9';
30
 
31
  /**
32
  * TablePress internal plugin version ("options scheme" version).
36
  * @since 1.0.0
37
  * @const int
38
  */
39
+ const db_version = 36;
40
 
41
  /**
42
  * TablePress "table scheme" (data format structure) version.
113
  return;
114
  }
115
 
116
+ // Check if minimum requirements are fulfilled, currently WordPress 4.9.1.
117
  include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version.
118
+ if ( version_compare( str_replace( '-src', '', $wp_version ), '4.9.1', '<' ) ) {
119
  // Show error notice to admins, if WP is not installed in the minimum required version, in which case TablePress will not work.
120
  if ( current_user_can( 'update_plugins' ) ) {
121
  add_action( 'admin_notices', array( 'TablePress', 'show_minimum_requirements_error_notice' ) );
403
 
404
  // $default_params also determines the order of the values in the query string.
405
  $default_params = array(
406
+ 'page' => false,
407
  'action' => false,
408
+ 'item' => false,
409
  );
410
  $params = array_merge( $default_params, $params );
411
 
classes/class-view.php CHANGED
@@ -99,8 +99,8 @@ abstract class TablePress_View {
99
  add_filter( "get_user_option_screen_layout_{$screen->id}", array( $this, 'set_current_screen_layout_columns' ) );
100
 
101
  $screen->add_help_tab( array(
102
- 'id' => 'tablepress-help', // This should be unique for the screen.
103
- 'title' => __( 'TablePress Help', 'tablepress' ),
104
  'content' => '<p>' . $this->help_tab_content() . '</p>'
105
  . '<p>' . sprintf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin&#8217;s website</a> or on its page in the <a href="%2$s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ) . ' '
106
  . sprintf( __( 'For technical information, please see the <a href="%s">documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' ) . ' '
@@ -155,7 +155,7 @@ abstract class TablePress_View {
155
  }
156
  $this->admin_page->enqueue_script( 'common', array( 'jquery-core', 'postbox' ), array(
157
  'common' => array(
158
- 'ays_delete_single_table' => _n( 'Do you really want to delete this table?', 'Do you really want to delete these tables?', 1, 'tablepress' ),
159
  'ays_delete_multiple_tables' => _n( 'Do you really want to delete this table?', 'Do you really want to delete these tables?', 2, 'tablepress' ),
160
  )
161
  ) );
@@ -217,10 +217,10 @@ abstract class TablePress_View {
217
 
218
  $long_id = "tablepress_{$this->action}-{$id}";
219
  $this->textboxes[ $context ][ $id ] = array(
220
- 'id' => $long_id,
221
  'callback' => $callback,
222
- 'context' => $context,
223
- 'wrap' => $wrap,
224
  );
225
  }
226
 
@@ -292,8 +292,10 @@ abstract class TablePress_View {
292
  if ( ! $this->has_meta_boxes ) {
293
  return;
294
  }
295
- wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); echo "\n";
296
- wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); echo "\n";
 
 
297
  }
298
 
299
  /**
@@ -305,7 +307,8 @@ abstract class TablePress_View {
305
  * @param array $box Information about the text box.
306
  */
307
  protected function action_nonce_field( array $data, array $box ) {
308
- wp_nonce_field( TablePress::nonce( $this->action ) ); echo "\n";
 
309
  }
310
 
311
  /**
99
  add_filter( "get_user_option_screen_layout_{$screen->id}", array( $this, 'set_current_screen_layout_columns' ) );
100
 
101
  $screen->add_help_tab( array(
102
+ 'id' => 'tablepress-help', // This should be unique for the screen.
103
+ 'title' => __( 'TablePress Help', 'tablepress' ),
104
  'content' => '<p>' . $this->help_tab_content() . '</p>'
105
  . '<p>' . sprintf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin&#8217;s website</a> or on its page in the <a href="%2$s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ) . ' '
106
  . sprintf( __( 'For technical information, please see the <a href="%s">documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' ) . ' '
155
  }
156
  $this->admin_page->enqueue_script( 'common', array( 'jquery-core', 'postbox' ), array(
157
  'common' => array(
158
+ 'ays_delete_single_table' => _n( 'Do you really want to delete this table?', 'Do you really want to delete these tables?', 1, 'tablepress' ),
159
  'ays_delete_multiple_tables' => _n( 'Do you really want to delete this table?', 'Do you really want to delete these tables?', 2, 'tablepress' ),
160
  )
161
  ) );
217
 
218
  $long_id = "tablepress_{$this->action}-{$id}";
219
  $this->textboxes[ $context ][ $id ] = array(
220
+ 'id' => $long_id,
221
  'callback' => $callback,
222
+ 'context' => $context,
223
+ 'wrap' => $wrap,
224
  );
225
  }
226
 
292
  if ( ! $this->has_meta_boxes ) {
293
  return;
294
  }
295
+ wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
296
+ echo "\n";
297
+ wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
298
+ echo "\n";
299
  }
300
 
301
  /**
307
  * @param array $box Information about the text box.
308
  */
309
  protected function action_nonce_field( array $data, array $box ) {
310
+ wp_nonce_field( TablePress::nonce( $this->action ) );
311
+ echo "\n";
312
  }
313
 
314
  /**
controllers/controller-admin.php CHANGED
@@ -202,10 +202,10 @@ class TablePress_Admin_Controller extends TablePress_Controller {
202
  $admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' );
203
  $admin_page->enqueue_script( 'quicktags-button', array( 'quicktags', 'media-upload' ), array(
204
  'editor_button' => array(
205
- 'caption' => __( 'Table', 'tablepress' ),
206
- 'title' => __( 'Insert a Table from TablePress', 'tablepress' ),
207
  'thickbox_title' => __( 'Insert a Table from TablePress', 'tablepress' ),
208
- 'thickbox_url' => TablePress::url( array( 'action' => 'editor_button_thickbox' ), true, 'admin-post.php' ),
209
  ),
210
  ) );
211
 
@@ -251,7 +251,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
251
  * @since 1.0.0
252
  */
253
  public function add_tablepress_hidpi_css() {
254
- echo '<style type="text/css">@media print,(-o-min-device-pixel-ratio:5/4),(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){';
255
  echo '#content_tablepress_insert_table span{background:url(' . plugins_url( 'admin/img/tablepress-editor-button-2x.png', TABLEPRESS__FILE__ ) . ') no-repeat 0 0;background-size:20px 20px}';
256
  echo '#content_tablepress_insert_table img{display:none}';
257
  echo '}</style>' . "\n";
@@ -284,9 +284,9 @@ class TablePress_Admin_Controller extends TablePress_Controller {
284
  // Might need $this->init_i18n_support(); here.
285
  $wp_admin_bar->add_menu( array(
286
  'parent' => 'new-content',
287
- 'id' => 'new-tablepress-table',
288
- 'title' => __( 'TablePress Table', 'tablepress' ),
289
- 'href' => TablePress::url( array( 'action' => 'add' ) ),
290
  ) );
291
  }
292
 
@@ -371,7 +371,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
371
  // Pre-define some view data.
372
  $data = array(
373
  'view_actions' => $this->view_actions,
374
- 'message' => ( ! empty( $_GET['message'] ) ) ? $_GET['message'] : false,
375
  );
376
 
377
  // Depending on the action, load more necessary data for the corresponding view.
@@ -414,7 +414,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
414
  */
415
  TablePress::$model_options->update( array(
416
  'use_custom_css_file' => true,
417
- 'custom_css_version' => TablePress::$model_options->get( 'custom_css_version' ) + 1,
418
  ) );
419
  TablePress::redirect( array( 'action' => 'options', 'message' => 'success_save' ) );
420
  } else { // leaves only $result = false
@@ -542,54 +542,54 @@ class TablePress_Admin_Controller extends TablePress_Controller {
542
  */
543
  protected function init_view_actions() {
544
  $this->view_actions = array(
545
- 'list' => array(
546
- 'show_entry' => true,
547
- 'page_title' => __( 'All Tables', 'tablepress' ),
548
  'admin_menu_title' => __( 'All Tables', 'tablepress' ),
549
- 'nav_tab_title' => __( 'All Tables', 'tablepress' ),
550
- 'required_cap' => 'tablepress_list_tables',
551
  ),
552
- 'add' => array(
553
- 'show_entry' => true,
554
- 'page_title' => __( 'Add New Table', 'tablepress' ),
555
  'admin_menu_title' => __( 'Add New Table', 'tablepress' ),
556
- 'nav_tab_title' => __( 'Add New', 'tablepress' ),
557
- 'required_cap' => 'tablepress_add_tables',
558
  ),
559
- 'edit' => array(
560
- 'show_entry' => false,
561
- 'page_title' => __( 'Edit Table', 'tablepress' ),
562
  'admin_menu_title' => '',
563
- 'nav_tab_title' => '',
564
- 'required_cap' => 'tablepress_edit_tables',
565
  ),
566
- 'import' => array(
567
- 'show_entry' => true,
568
- 'page_title' => __( 'Import a Table', 'tablepress' ),
569
  'admin_menu_title' => __( 'Import a Table', 'tablepress' ),
570
- 'nav_tab_title' => _x( 'Import', 'navigation bar', 'tablepress' ),
571
- 'required_cap' => 'tablepress_import_tables',
572
  ),
573
- 'export' => array(
574
- 'show_entry' => true,
575
- 'page_title' => __( 'Export a Table', 'tablepress' ),
576
  'admin_menu_title' => __( 'Export a Table', 'tablepress' ),
577
- 'nav_tab_title' => _x( 'Export', 'navigation bar', 'tablepress' ),
578
- 'required_cap' => 'tablepress_export_tables',
579
  ),
580
  'options' => array(
581
- 'show_entry' => true,
582
- 'page_title' => __( 'Plugin Options', 'tablepress' ),
583
  'admin_menu_title' => __( 'Plugin Options', 'tablepress' ),
584
- 'nav_tab_title' => __( 'Plugin Options', 'tablepress' ),
585
- 'required_cap' => 'tablepress_access_options_screen',
586
  ),
587
- 'about' => array(
588
- 'show_entry' => true,
589
- 'page_title' => __( 'About', 'tablepress' ),
590
  'admin_menu_title' => __( 'About TablePress', 'tablepress' ),
591
- 'nav_tab_title' => __( 'About', 'tablepress' ),
592
- 'required_cap' => 'tablepress_access_about_screen',
593
  ),
594
  );
595
 
@@ -719,9 +719,20 @@ class TablePress_Admin_Controller extends TablePress_Controller {
719
  // Evaluate options that have a checkbox (only necessary in Admin Controller, where they might not be set (if unchecked)).
720
  $checkbox_options = array(
721
  // Table Options.
722
- 'table_head', 'table_foot', 'alternating_row_colors', 'row_hover', 'print_name', 'print_description',
 
 
 
 
 
723
  // DataTables JS Features.
724
- 'use_datatables', 'datatables_sort', 'datatables_filter', 'datatables_paginate', 'datatables_lengthchange', 'datatables_info', 'datatables_scrollx',
 
 
 
 
 
 
725
  );
726
  foreach ( $checkbox_options as $option ) {
727
  $edit_table['options'][ $option ] = ( isset( $edit_table['options'][ $option ] ) && 'true' === $edit_table['options'][ $option ] );
@@ -801,11 +812,11 @@ class TablePress_Admin_Controller extends TablePress_Controller {
801
 
802
  // Create a new table array with information from the posted data.
803
  $new_table = array(
804
- 'name' => $name,
805
  'description' => $description,
806
- 'data' => array_fill( 0, $num_rows, array_fill( 0, $num_columns, '' ) ),
807
- 'visibility' => array(
808
- 'rows' => array_fill( 0, $num_rows, 1 ),
809
  'columns' => array_fill( 0, $num_columns, 1 ),
810
  ),
811
  );
@@ -1129,7 +1140,10 @@ class TablePress_Admin_Controller extends TablePress_Controller {
1129
  }
1130
  break;
1131
  case 'server':
1132
- if ( ! empty( $import['server'] ) && ABSPATH !== $import['server'] ) {
 
 
 
1133
  $import_data['file_location'] = $import['server'];
1134
  $import_data['file_name'] = pathinfo( $import['server'], PATHINFO_BASENAME );
1135
  if ( is_readable( $import['server'] ) ) {
@@ -1349,7 +1363,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
1349
  $num_rows = count( $imported_table['data'] );
1350
  $num_columns = count( $imported_table['data'][0] );
1351
  $imported_table['visibility'] = array(
1352
- 'rows' => array_pad( array_slice( $existing_table['visibility']['rows'], 0, $num_rows ), $num_rows, 1 ),
1353
  'columns' => array_pad( array_slice( $existing_table['visibility']['columns'], 0, $num_columns ), $num_columns, 1 ),
1354
  );
1355
 
@@ -1545,12 +1559,12 @@ class TablePress_Admin_Controller extends TablePress_Controller {
1545
  //
1546
  // Create a new table array with information from the imported table.
1547
  $new_table = array(
1548
- 'name' => $wptr_table['name'],
1549
  'description' => $wptr_table['description'],
1550
- 'data' => $wptr_table['data'],
1551
- 'options' => array(),
1552
- 'visibility' => array(
1553
- 'rows' => array_fill( 0, count( $wptr_table['data'] ), 1 ),
1554
  'columns' => array_fill( 0, count( $wptr_table['data'][0] ), 1 ),
1555
  ),
1556
  );
@@ -1580,10 +1594,19 @@ class TablePress_Admin_Controller extends TablePress_Controller {
1580
  }
1581
  }
1582
  // Array key is the same in both plugins for the following options.
1583
- foreach ( array( 'alternating_row_colors', 'row_hover',
1584
- 'print_name', 'print_name_position', 'print_description', 'print_description_position',
1585
- 'datatables_sort', 'datatables_filter', 'datatables_paginate',
1586
- 'datatables_lengthchange', 'datatables_paginate_entries', 'datatables_info'
 
 
 
 
 
 
 
 
 
1587
  ) as $_option ) {
1588
  if ( isset( $wptr_table['options'][ $_option ] ) ) {
1589
  $new_table['options'][ $_option ] = $wptr_table['options'][ $_option ];
@@ -1826,7 +1849,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
1826
  $render_options = apply_filters( 'tablepress_shortcode_table_shortcode_atts', $render_options );
1827
  $_render->set_input( $table, $render_options );
1828
  $view_data = array(
1829
- 'table_id' => $table_id,
1830
  'head_html' => $_render->get_preview_css(),
1831
  'body_html' => $_render->get_output(),
1832
  );
@@ -1877,7 +1900,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
1877
 
1878
  $plugin = TABLEPRESS_BASENAME;
1879
 
1880
- if ( ! current_user_can( 'activate_plugins' ) || ! current_user_can( 'tablepress_edit_options' ) || ! current_user_can( 'tablepress_delete_tables' ) || is_plugin_active_for_network( $plugin ) ) {
1881
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'default' ), 403 );
1882
  }
1883
 
202
  $admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' );
203
  $admin_page->enqueue_script( 'quicktags-button', array( 'quicktags', 'media-upload' ), array(
204
  'editor_button' => array(
205
+ 'caption' => __( 'Table', 'tablepress' ),
206
+ 'title' => __( 'Insert a Table from TablePress', 'tablepress' ),
207
  'thickbox_title' => __( 'Insert a Table from TablePress', 'tablepress' ),
208
+ 'thickbox_url' => TablePress::url( array( 'action' => 'editor_button_thickbox' ), true, 'admin-post.php' ),
209
  ),
210
  ) );
211
 
251
  * @since 1.0.0
252
  */
253
  public function add_tablepress_hidpi_css() {
254
+ echo '<style type="text/css">@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){';
255
  echo '#content_tablepress_insert_table span{background:url(' . plugins_url( 'admin/img/tablepress-editor-button-2x.png', TABLEPRESS__FILE__ ) . ') no-repeat 0 0;background-size:20px 20px}';
256
  echo '#content_tablepress_insert_table img{display:none}';
257
  echo '}</style>' . "\n";
284
  // Might need $this->init_i18n_support(); here.
285
  $wp_admin_bar->add_menu( array(
286
  'parent' => 'new-content',
287
+ 'id' => 'new-tablepress-table',
288
+ 'title' => __( 'TablePress Table', 'tablepress' ),
289
+ 'href' => TablePress::url( array( 'action' => 'add' ) ),
290
  ) );
291
  }
292
 
371
  // Pre-define some view data.
372
  $data = array(
373
  'view_actions' => $this->view_actions,
374
+ 'message' => ( ! empty( $_GET['message'] ) ) ? $_GET['message'] : false,
375
  );
376
 
377
  // Depending on the action, load more necessary data for the corresponding view.
414
  */
415
  TablePress::$model_options->update( array(
416
  'use_custom_css_file' => true,
417
+ 'custom_css_version' => TablePress::$model_options->get( 'custom_css_version' ) + 1,
418
  ) );
419
  TablePress::redirect( array( 'action' => 'options', 'message' => 'success_save' ) );
420
  } else { // leaves only $result = false
542
  */
543
  protected function init_view_actions() {
544
  $this->view_actions = array(
545
+ 'list' => array(
546
+ 'show_entry' => true,
547
+ 'page_title' => __( 'All Tables', 'tablepress' ),
548
  'admin_menu_title' => __( 'All Tables', 'tablepress' ),
549
+ 'nav_tab_title' => __( 'All Tables', 'tablepress' ),
550
+ 'required_cap' => 'tablepress_list_tables',
551
  ),
552
+ 'add' => array(
553
+ 'show_entry' => true,
554
+ 'page_title' => __( 'Add New Table', 'tablepress' ),
555
  'admin_menu_title' => __( 'Add New Table', 'tablepress' ),
556
+ 'nav_tab_title' => __( 'Add New', 'tablepress' ),
557
+ 'required_cap' => 'tablepress_add_tables',
558
  ),
559
+ 'edit' => array(
560
+ 'show_entry' => false,
561
+ 'page_title' => __( 'Edit Table', 'tablepress' ),
562
  'admin_menu_title' => '',
563
+ 'nav_tab_title' => '',
564
+ 'required_cap' => 'tablepress_edit_tables',
565
  ),
566
+ 'import' => array(
567
+ 'show_entry' => true,
568
+ 'page_title' => __( 'Import a Table', 'tablepress' ),
569
  'admin_menu_title' => __( 'Import a Table', 'tablepress' ),
570
+ 'nav_tab_title' => _x( 'Import', 'navigation bar', 'tablepress' ),
571
+ 'required_cap' => 'tablepress_import_tables',
572
  ),
573
+ 'export' => array(
574
+ 'show_entry' => true,
575
+ 'page_title' => __( 'Export a Table', 'tablepress' ),
576
  'admin_menu_title' => __( 'Export a Table', 'tablepress' ),
577
+ 'nav_tab_title' => _x( 'Export', 'navigation bar', 'tablepress' ),
578
+ 'required_cap' => 'tablepress_export_tables',
579
  ),
580
  'options' => array(
581
+ 'show_entry' => true,
582
+ 'page_title' => __( 'Plugin Options', 'tablepress' ),
583
  'admin_menu_title' => __( 'Plugin Options', 'tablepress' ),
584
+ 'nav_tab_title' => __( 'Plugin Options', 'tablepress' ),
585
+ 'required_cap' => 'tablepress_access_options_screen',
586
  ),
587
+ 'about' => array(
588
+ 'show_entry' => true,
589
+ 'page_title' => __( 'About', 'tablepress' ),
590
  'admin_menu_title' => __( 'About TablePress', 'tablepress' ),
591
+ 'nav_tab_title' => __( 'About', 'tablepress' ),
592
+ 'required_cap' => 'tablepress_access_about_screen',
593
  ),
594
  );
595
 
719
  // Evaluate options that have a checkbox (only necessary in Admin Controller, where they might not be set (if unchecked)).
720
  $checkbox_options = array(
721
  // Table Options.
722
+ 'table_head',
723
+ 'table_foot',
724
+ 'alternating_row_colors',
725
+ 'row_hover',
726
+ 'print_name',
727
+ 'print_description',
728
  // DataTables JS Features.
729
+ 'use_datatables',
730
+ 'datatables_sort',
731
+ 'datatables_filter',
732
+ 'datatables_paginate',
733
+ 'datatables_lengthchange',
734
+ 'datatables_info',
735
+ 'datatables_scrollx',
736
  );
737
  foreach ( $checkbox_options as $option ) {
738
  $edit_table['options'][ $option ] = ( isset( $edit_table['options'][ $option ] ) && 'true' === $edit_table['options'][ $option ] );
812
 
813
  // Create a new table array with information from the posted data.
814
  $new_table = array(
815
+ 'name' => $name,
816
  'description' => $description,
817
+ 'data' => array_fill( 0, $num_rows, array_fill( 0, $num_columns, '' ) ),
818
+ 'visibility' => array(
819
+ 'rows' => array_fill( 0, $num_rows, 1 ),
820
  'columns' => array_fill( 0, $num_columns, 1 ),
821
  ),
822
  );
1140
  }
1141
  break;
1142
  case 'server':
1143
+ if ( ! empty( $import['server'] ) && ABSPATH !== $import['server']
1144
+ && ( ( ! is_multisite() && current_user_can( 'manage_options' ) ) || is_super_admin() )
1145
+ ) {
1146
+ // For security reasons, the `server` source is only available for administrators.
1147
  $import_data['file_location'] = $import['server'];
1148
  $import_data['file_name'] = pathinfo( $import['server'], PATHINFO_BASENAME );
1149
  if ( is_readable( $import['server'] ) ) {
1363
  $num_rows = count( $imported_table['data'] );
1364
  $num_columns = count( $imported_table['data'][0] );
1365
  $imported_table['visibility'] = array(
1366
+ 'rows' => array_pad( array_slice( $existing_table['visibility']['rows'], 0, $num_rows ), $num_rows, 1 ),
1367
  'columns' => array_pad( array_slice( $existing_table['visibility']['columns'], 0, $num_columns ), $num_columns, 1 ),
1368
  );
1369
 
1559
  //
1560
  // Create a new table array with information from the imported table.
1561
  $new_table = array(
1562
+ 'name' => $wptr_table['name'],
1563
  'description' => $wptr_table['description'],
1564
+ 'data' => $wptr_table['data'],
1565
+ 'options' => array(),
1566
+ 'visibility' => array(
1567
+ 'rows' => array_fill( 0, count( $wptr_table['data'] ), 1 ),
1568
  'columns' => array_fill( 0, count( $wptr_table['data'][0] ), 1 ),
1569
  ),
1570
  );
1594
  }
1595
  }
1596
  // Array key is the same in both plugins for the following options.
1597
+ foreach ( array(
1598
+ 'alternating_row_colors',
1599
+ 'row_hover',
1600
+ 'print_name',
1601
+ 'print_name_position',
1602
+ 'print_description',
1603
+ 'print_description_position',
1604
+ 'datatables_sort',
1605
+ 'datatables_filter',
1606
+ 'datatables_paginate',
1607
+ 'datatables_lengthchange',
1608
+ 'datatables_paginate_entries',
1609
+ 'datatables_info',
1610
  ) as $_option ) {
1611
  if ( isset( $wptr_table['options'][ $_option ] ) ) {
1612
  $new_table['options'][ $_option ] = $wptr_table['options'][ $_option ];
1849
  $render_options = apply_filters( 'tablepress_shortcode_table_shortcode_atts', $render_options );
1850
  $_render->set_input( $table, $render_options );
1851
  $view_data = array(
1852
+ 'table_id' => $table_id,
1853
  'head_html' => $_render->get_preview_css(),
1854
  'body_html' => $_render->get_output(),
1855
  );
1900
 
1901
  $plugin = TABLEPRESS_BASENAME;
1902
 
1903
+ if ( ! current_user_can( 'deactivate_plugin', $plugin ) || ! current_user_can( 'tablepress_edit_options' ) || ! current_user_can( 'tablepress_delete_tables' ) || is_plugin_active_for_network( $plugin ) ) {
1904
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'default' ), 403 );
1905
  }
1906
 
controllers/controller-admin_ajax.php CHANGED
@@ -280,7 +280,7 @@ class TablePress_Admin_AJAX_Controller extends TablePress_Controller {
280
 
281
  // Generate the response.
282
  $response = array(
283
- 'success' => $success,
284
  'head_html' => $head_html,
285
  'body_html' => $body_html,
286
  );
280
 
281
  // Generate the response.
282
  $response = array(
283
+ 'success' => $success,
284
  'head_html' => $head_html,
285
  'body_html' => $body_html,
286
  );
controllers/controller-frontend.php CHANGED
@@ -53,9 +53,6 @@ class TablePress_Frontend_Controller extends TablePress_Controller {
53
  // Remove WP-Table Reloaded Shortcodes and CSS, and add TablePress Shortcodes.
54
  add_action( 'init', array( $this, 'init_shortcodes' ), 20 ); // run on priority 20 as WP-Table Reloaded Shortcodes are registered at priority 10
55
 
56
- // Make TablePress Shortcodes work in text widgets.
57
- add_filter( 'widget_text', array( $this, 'widget_text_filter' ) );
58
-
59
  /**
60
  * Filter whether the WordPress search shall also search TablePress tables.
61
  *
@@ -310,7 +307,7 @@ class TablePress_Frontend_Controller extends TablePress_Controller {
310
  $parameters['lengthChange'] = '"lengthChange":false';
311
  }
312
  if ( 10 !== $js_options['datatables_paginate_entries'] ) {
313
- $parameters['pageLength'] = '"pageLength":'. $js_options['datatables_paginate_entries'];
314
  }
315
  } else {
316
  $parameters['paging'] = '"paging":false';
@@ -522,7 +519,7 @@ JS;
522
  // Generate unique HTML ID, depending on how often this table has already been shown on this page.
523
  if ( ! isset( $this->shown_tables[ $table_id ] ) ) {
524
  $this->shown_tables[ $table_id ] = array(
525
- 'count' => 0,
526
  'instances' => array(),
527
  );
528
  }
@@ -575,10 +572,20 @@ JS;
575
  if ( $render_options['use_datatables'] && $render_options['table_head'] && count( $table['data'] ) > 1 ) {
576
  // Get options for the DataTables JavaScript library from the table's render options.
577
  $js_options = array();
578
- foreach ( array( 'alternating_row_colors', 'datatables_sort', 'datatables_paginate',
579
- 'datatables_paginate', 'datatables_paginate_entries', 'datatables_lengthchange',
580
- 'datatables_filter', 'datatables_info', 'datatables_scrollx', 'datatables_scrolly',
581
- 'datatables_locale', 'datatables_custom_commands' ) as $option ) {
 
 
 
 
 
 
 
 
 
 
582
  $js_options[ $option ] = $render_options[ $option ];
583
  }
584
  /**
@@ -660,9 +667,9 @@ JS;
660
 
661
  // Parse Shortcode attributes, only allow those that are specified.
662
  $default_shortcode_atts = array(
663
- 'id' => '',
664
- 'field' => '',
665
- 'format' => '',
666
  );
667
  /**
668
  * Filter the available/default attributes for the [table-info] Shortcode.
@@ -800,32 +807,6 @@ JS;
800
  return $output;
801
  }
802
 
803
- /**
804
- * Handle Shortcodes in text widgets, by temporarily removing all Shortcodes, registering only the plugin's two,
805
- * running WP's Shortcode routines, and then restoring old behavior/Shortcodes.
806
- *
807
- * @since 1.0.0
808
- *
809
- * @global array $shortcode_tags WordPress container for storing Shortcode definitions.
810
- *
811
- * @param string $content Text content of the text widget, will be searched for one of TablePress's Shortcodes.
812
- * @return string Text of the text widget, with eventually found Shortcodes having been replaced by corresponding output.
813
- */
814
- public function widget_text_filter( $content ) {
815
- global $shortcode_tags;
816
- // Backup the currently registered Shortcodes and clear the global array.
817
- $orig_shortcode_tags = $shortcode_tags;
818
- $shortcode_tags = array();
819
- // Register TablePress's Shortcodes (which are then the only ones registered).
820
- add_shortcode( TablePress::$shortcode_info, array( $this, 'shortcode_table_info' ) );
821
- add_shortcode( TablePress::$shortcode, array( $this, 'shortcode_table' ) );
822
- // Run the WP Shortcode routines on the widget text (i.e. search for TablePress's Shortcodes).
823
- $content = do_shortcode( $content );
824
- // Restore the original Shortcodes (which includes TablePress's Shortcodes, for use in posts and pages).
825
- $shortcode_tags = $orig_shortcode_tags;
826
- return $content;
827
- }
828
-
829
  /**
830
  * Expand WP Search to also find posts and pages that have a search term in a table that is shown in them.
831
  *
@@ -904,6 +885,7 @@ JS;
904
  // If $_GET['exact'] is set, WordPress doesn't use % in SQL LIKE clauses.
905
  $exact = get_query_var( 'exact' );
906
  $n = ( empty( $exact ) ) ? '%' : '';
 
907
  foreach ( $query_result as $search_term => $table_ids ) {
908
  $search_term = esc_sql( $wpdb->esc_like( $search_term ) );
909
  $old_or = "OR ({$wpdb->posts}.post_content LIKE '{$n}{$search_term}{$n}')";
@@ -912,6 +894,7 @@ JS;
912
  $new_or = $old_or . " OR ({$wpdb->posts}.post_content REGEXP '{$regexp}')";
913
  $search_sql = str_replace( $old_or, $new_or, $search_sql );
914
  }
 
915
 
916
  return $search_sql;
917
  }
53
  // Remove WP-Table Reloaded Shortcodes and CSS, and add TablePress Shortcodes.
54
  add_action( 'init', array( $this, 'init_shortcodes' ), 20 ); // run on priority 20 as WP-Table Reloaded Shortcodes are registered at priority 10
55
 
 
 
 
56
  /**
57
  * Filter whether the WordPress search shall also search TablePress tables.
58
  *
307
  $parameters['lengthChange'] = '"lengthChange":false';
308
  }
309
  if ( 10 !== $js_options['datatables_paginate_entries'] ) {
310
+ $parameters['pageLength'] = '"pageLength":' . $js_options['datatables_paginate_entries'];
311
  }
312
  } else {
313
  $parameters['paging'] = '"paging":false';
519
  // Generate unique HTML ID, depending on how often this table has already been shown on this page.
520
  if ( ! isset( $this->shown_tables[ $table_id ] ) ) {
521
  $this->shown_tables[ $table_id ] = array(
522
+ 'count' => 0,
523
  'instances' => array(),
524
  );
525
  }
572
  if ( $render_options['use_datatables'] && $render_options['table_head'] && count( $table['data'] ) > 1 ) {
573
  // Get options for the DataTables JavaScript library from the table's render options.
574
  $js_options = array();
575
+ foreach ( array(
576
+ 'alternating_row_colors',
577
+ 'datatables_sort',
578
+ 'datatables_paginate',
579
+ 'datatables_paginate',
580
+ 'datatables_paginate_entries',
581
+ 'datatables_lengthchange',
582
+ 'datatables_filter',
583
+ 'datatables_info',
584
+ 'datatables_scrollx',
585
+ 'datatables_scrolly',
586
+ 'datatables_locale',
587
+ 'datatables_custom_commands',
588
+ ) as $option ) {
589
  $js_options[ $option ] = $render_options[ $option ];
590
  }
591
  /**
667
 
668
  // Parse Shortcode attributes, only allow those that are specified.
669
  $default_shortcode_atts = array(
670
+ 'id' => '',
671
+ 'field' => '',
672
+ 'format' => '',
673
  );
674
  /**
675
  * Filter the available/default attributes for the [table-info] Shortcode.
807
  return $output;
808
  }
809
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
  /**
811
  * Expand WP Search to also find posts and pages that have a search term in a table that is shown in them.
812
  *
885
  // If $_GET['exact'] is set, WordPress doesn't use % in SQL LIKE clauses.
886
  $exact = get_query_var( 'exact' );
887
  $n = ( empty( $exact ) ) ? '%' : '';
888
+ $search_sql = $wpdb->remove_placeholder_escape( $search_sql );
889
  foreach ( $query_result as $search_term => $table_ids ) {
890
  $search_term = esc_sql( $wpdb->esc_like( $search_term ) );
891
  $old_or = "OR ({$wpdb->posts}.post_content LIKE '{$n}{$search_term}{$n}')";
894
  $new_or = $old_or . " OR ({$wpdb->posts}.post_content REGEXP '{$regexp}')";
895
  $search_sql = str_replace( $old_or, $new_or, $search_sql );
896
  }
897
+ $search_sql = $wpdb->add_placeholder_escape( $search_sql );
898
 
899
  return $search_sql;
900
  }
libraries/csstidy/class.csstidy.php CHANGED
@@ -71,7 +71,7 @@ if ( ! function_exists( 'ctype_alpha' ) ) {
71
  * @return bool Whether all characters in the string are alphabetic characters.
72
  */
73
  function ctype_alpha( $text ) {
74
- return ( 1 === preg_match( '/^[a-zA-Z]+$/', $text ) );
75
  }
76
  }
77
  if ( ! function_exists( 'ctype_xdigit' ) ) {
@@ -84,7 +84,7 @@ if ( ! function_exists( 'ctype_xdigit' ) ) {
84
  * @return bool Whether $text is a hexadecimal number.
85
  */
86
  function ctype_xdigit( $text ) {
87
- return ( 1 === preg_match( '/^[a-fA-F0-9]+$/', $text ) );
88
  }
89
  }
90
 
@@ -94,13 +94,13 @@ if ( ! function_exists( 'ctype_xdigit' ) ) {
94
  * @TODO: Make these class constants of CSSTidy.
95
  * @since 1.0.0
96
  */
97
- define( 'AT_START', 1 );
98
- define( 'AT_END', 2 );
99
- define( 'SEL_START', 3 );
100
- define( 'SEL_END', 4 );
101
- define( 'PROPERTY', 5 );
102
- define( 'VALUE', 6 );
103
- define( 'COMMENT', 7 );
104
  define( 'DEFAULT_AT', 41 );
105
 
106
  /**
@@ -128,7 +128,7 @@ require dirname( __FILE__ ) . '/class.csstidy_optimise.php';
128
  * @package CSSTidy
129
  * @since 1.0.0
130
  */
131
- class CSSTidy {
132
 
133
  /**
134
  * The parsed CSS.
@@ -152,7 +152,7 @@ class CSSTidy {
152
  * Instance of the CSS Printer class.
153
  *
154
  * @since 1.0.0
155
- * @var CSSTidy_print
156
  */
157
  public $print;
158
 
@@ -160,7 +160,7 @@ class CSSTidy {
160
  * Instance of the CSS Optimiser class.
161
  *
162
  * @since 1.0.0
163
- * @var CSSTidy_optimise
164
  */
165
  public $optimise;
166
 
@@ -421,8 +421,8 @@ class CSSTidy {
421
  $this->settings['template'] = ''; // say that property exists.
422
  $this->set_cfg( 'template', 'default' ); // Call load_template.
423
 
424
- $this->print = new CSSTidy_print( $this );
425
- $this->optimise = new CSSTidy_optimise( $this );
426
 
427
  $this->tokens_list = &$this->data['csstidy']['tokens'];
428
  }
@@ -522,7 +522,10 @@ class CSSTidy {
522
  $line = $this->line;
523
  }
524
  $line = intval( $line );
525
- $add = array( 'm' => $message, 't' => $type );
 
 
 
526
  if ( ! isset( $this->log[ $line ] ) || ! in_array( $add, $this->log[ $line ], true ) ) {
527
  $this->log[ $line ][] = $add;
528
  }
@@ -766,7 +769,7 @@ class CSSTidy {
766
  }
767
  $this->log( 'Invalid @-rule: ' . $invalid_at_name . ' (removed)', 'Warning' );
768
  }
769
- } elseif ( ( '"' === $string[ $i ] || "'" === $string[ $i ] ) ) {
770
  $this->cur_string[] = $string[ $i ];
771
  $this->status = 'instr';
772
  $this->str_char[] = $string[ $i ];
@@ -805,7 +808,7 @@ class CSSTidy {
805
  }
806
  } else {
807
  $lastpos = strlen( $this->selector ) - 1;
808
- if ( -1 === $lastpos || ! ( ( ctype_space( $this->selector[ $lastpos ] ) || $this->is_token( $this->selector, $lastpos ) && ',' === $this->selector[ $lastpos ] ) && ctype_space( $string[ $i ] ) ) ) {
809
  $this->selector .= $string[ $i ];
810
  }
811
  }
@@ -851,7 +854,7 @@ class CSSTidy {
851
  break;
852
  /* Case in-value */
853
  case 'iv':
854
- $pn = ( ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) && $this->property_is_next( $string, $i + 1 ) || $i === strlen( $string ) - 1 );
855
  if ( ( $this->is_token( $string, $i ) || $pn ) && ( ! ( ',' === $string[ $i ] && ! ctype_space( $string[ $i + 1 ] ) ) ) ) {
856
  if ( '/' === $string[ $i ] && '*' === @$string[ $i + 1 ] ) {
857
  $this->status = 'ic';
@@ -888,7 +891,7 @@ class CSSTidy {
888
  if ( empty( $this->sub_value_arr ) ) {
889
  // Quote URLs in imports only if they're not already inside url() and not already quoted.
890
  if ( 'url(' !== substr( $this->sub_value, 0, 4 ) ) {
891
- if ( ! ( $this->sub_value[0] === substr( $this->sub_value, -1 ) && in_array( $this->sub_value[0], array( "'", '"' ), true ) ) ) {
892
  $this->sub_value = '"' . $this->sub_value . '"';
893
  }
894
  }
@@ -986,9 +989,9 @@ class CSSTidy {
986
  break;
987
  /* Case in string */
988
  case 'instr':
989
- $_str_char = $this->str_char[count( $this->str_char ) - 1];
990
- $_cur_string = $this->cur_string[count( $this->cur_string ) - 1];
991
- $_quoted_string = $this->quoted_string[count( $this->quoted_string ) - 1];
992
  $temp_add = $string[ $i ];
993
 
994
  // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses,
@@ -1034,7 +1037,7 @@ class CSSTidy {
1034
  array_pop( $this->str_char );
1035
 
1036
  if ( ')' === $_str_char ) {
1037
- $_cur_string = "(" . trim( substr( $_cur_string, 1, -1 ) ) . ")";
1038
  }
1039
 
1040
  if ( 'iv' === $this->status ) {
@@ -1119,7 +1122,7 @@ class CSSTidy {
1119
  $lastpos = 0;
1120
  $this->sel_separate[] = strlen( $this->selector );
1121
  foreach ( $this->sel_separate as $num => $pos ) {
1122
- if ( $num === count( $this->sel_separate ) - 1 ) {
1123
  $pos += 1;
1124
  }
1125
 
@@ -1196,7 +1199,7 @@ class CSSTidy {
1196
  return $media;
1197
  }
1198
  end( $this->css );
1199
- list( $at, ) = each( $this->css );
1200
  if ( $at === $media ) {
1201
  return $media;
1202
  }
@@ -1239,7 +1242,7 @@ class CSSTidy {
1239
 
1240
  // If last is the same, keep it.
1241
  end( $this->css[ $media ] );
1242
- list( $sel, ) = each( $this->css[ $media ] );
1243
  if ( $sel === $selector ) {
1244
  return $selector;
1245
  }
@@ -1400,7 +1403,7 @@ class CSSTidy {
1400
  if ( ( ',' === $value[ $i ] || ' ' === $value[ $i ] ) && true === $in_str ) {
1401
  $in_str = false;
1402
  $strings[] = $current_string;
1403
- $current_string = "";
1404
  } elseif ( '"' === $value[ $i ] || "'" === $value[ $i ] ) {
1405
  if ( $in_str === $value[ $i ] ) {
1406
  $strings[] = $current_string;
@@ -1429,4 +1432,4 @@ class CSSTidy {
1429
  return $strings;
1430
  }
1431
 
1432
- } // class CSSTidy
71
  * @return bool Whether all characters in the string are alphabetic characters.
72
  */
73
  function ctype_alpha( $text ) {
74
+ return ( 1 === preg_match( '/^[a-zA-Z]+$/', $text ) );
75
  }
76
  }
77
  if ( ! function_exists( 'ctype_xdigit' ) ) {
84
  * @return bool Whether $text is a hexadecimal number.
85
  */
86
  function ctype_xdigit( $text ) {
87
+ return ( 1 === preg_match( '/^[a-fA-F0-9]+$/', $text ) );
88
  }
89
  }
90
 
94
  * @TODO: Make these class constants of CSSTidy.
95
  * @since 1.0.0
96
  */
97
+ define( 'AT_START', 1 );
98
+ define( 'AT_END', 2 );
99
+ define( 'SEL_START', 3 );
100
+ define( 'SEL_END', 4 );
101
+ define( 'PROPERTY', 5 );
102
+ define( 'VALUE', 6 );
103
+ define( 'COMMENT', 7 );
104
  define( 'DEFAULT_AT', 41 );
105
 
106
  /**
128
  * @package CSSTidy
129
  * @since 1.0.0
130
  */
131
+ class TablePress_CSSTidy {
132
 
133
  /**
134
  * The parsed CSS.
152
  * Instance of the CSS Printer class.
153
  *
154
  * @since 1.0.0
155
+ * @var TablePress_CSSTidy_print
156
  */
157
  public $print;
158
 
160
  * Instance of the CSS Optimiser class.
161
  *
162
  * @since 1.0.0
163
+ * @var TablePress_CSSTidy_optimise
164
  */
165
  public $optimise;
166
 
421
  $this->settings['template'] = ''; // say that property exists.
422
  $this->set_cfg( 'template', 'default' ); // Call load_template.
423
 
424
+ $this->print = new TablePress_CSSTidy_print( $this );
425
+ $this->optimise = new TablePress_CSSTidy_optimise( $this );
426
 
427
  $this->tokens_list = &$this->data['csstidy']['tokens'];
428
  }
522
  $line = $this->line;
523
  }
524
  $line = intval( $line );
525
+ $add = array(
526
+ 'm' => $message,
527
+ 't' => $type,
528
+ );
529
  if ( ! isset( $this->log[ $line ] ) || ! in_array( $add, $this->log[ $line ], true ) ) {
530
  $this->log[ $line ][] = $add;
531
  }
769
  }
770
  $this->log( 'Invalid @-rule: ' . $invalid_at_name . ' (removed)', 'Warning' );
771
  }
772
+ } elseif ( ( '"' === $string[ $i ] || "'" === $string[ $i ] ) ) {
773
  $this->cur_string[] = $string[ $i ];
774
  $this->status = 'instr';
775
  $this->str_char[] = $string[ $i ];
808
  }
809
  } else {
810
  $lastpos = strlen( $this->selector ) - 1;
811
+ if ( -1 === $lastpos || ! ( ( ctype_space( $this->selector[ $lastpos ] ) || $this->is_token( $this->selector, $lastpos ) && ',' === $this->selector[ $lastpos ] ) && ctype_space( $string[ $i ] ) ) ) {
812
  $this->selector .= $string[ $i ];
813
  }
814
  }
854
  break;
855
  /* Case in-value */
856
  case 'iv':
857
+ $pn = ( ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) && $this->property_is_next( $string, $i + 1 ) || ( strlen( $string ) - 1 ) === $i );
858
  if ( ( $this->is_token( $string, $i ) || $pn ) && ( ! ( ',' === $string[ $i ] && ! ctype_space( $string[ $i + 1 ] ) ) ) ) {
859
  if ( '/' === $string[ $i ] && '*' === @$string[ $i + 1 ] ) {
860
  $this->status = 'ic';
891
  if ( empty( $this->sub_value_arr ) ) {
892
  // Quote URLs in imports only if they're not already inside url() and not already quoted.
893
  if ( 'url(' !== substr( $this->sub_value, 0, 4 ) ) {
894
+ if ( ! ( substr( $this->sub_value, -1 ) === $this->sub_value[0] && in_array( $this->sub_value[0], array( "'", '"' ), true ) ) ) {
895
  $this->sub_value = '"' . $this->sub_value . '"';
896
  }
897
  }
989
  break;
990
  /* Case in string */
991
  case 'instr':
992
+ $_str_char = $this->str_char[ count( $this->str_char ) - 1 ];
993
+ $_cur_string = $this->cur_string[ count( $this->cur_string ) - 1 ];
994
+ $_quoted_string = $this->quoted_string[ count( $this->quoted_string ) - 1 ];
995
  $temp_add = $string[ $i ];
996
 
997
  // Add another string to the stack. Strings can't be nested inside of quotes, only parentheses,
1037
  array_pop( $this->str_char );
1038
 
1039
  if ( ')' === $_str_char ) {
1040
+ $_cur_string = '(' . trim( substr( $_cur_string, 1, -1 ) ) . ')';
1041
  }
1042
 
1043
  if ( 'iv' === $this->status ) {
1122
  $lastpos = 0;
1123
  $this->sel_separate[] = strlen( $this->selector );
1124
  foreach ( $this->sel_separate as $num => $pos ) {
1125
+ if ( ( count( $this->sel_separate ) - 1 ) === $num ) {
1126
  $pos += 1;
1127
  }
1128
 
1199
  return $media;
1200
  }
1201
  end( $this->css );
1202
+ $at = key( $this->css );
1203
  if ( $at === $media ) {
1204
  return $media;
1205
  }
1242
 
1243
  // If last is the same, keep it.
1244
  end( $this->css[ $media ] );
1245
+ $sel = key( $this->css[ $media ] );
1246
  if ( $sel === $selector ) {
1247
  return $selector;
1248
  }
1403
  if ( ( ',' === $value[ $i ] || ' ' === $value[ $i ] ) && true === $in_str ) {
1404
  $in_str = false;
1405
  $strings[] = $current_string;
1406
+ $current_string = '';
1407
  } elseif ( '"' === $value[ $i ] || "'" === $value[ $i ] ) {
1408
  if ( $in_str === $value[ $i ] ) {
1409
  $strings[] = $current_string;
1432
  return $strings;
1433
  }
1434
 
1435
+ } // class TablePress_CSSTidy
libraries/csstidy/class.csstidy_optimise.php CHANGED
@@ -51,7 +51,7 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
51
  * @author Florian Schmitz (floele at gmail dot com) 2005-2006
52
  * @version 1.0
53
  */
54
- class CSSTidy_optimise {
55
 
56
  /**
57
  * CSSTidy instance.
@@ -208,11 +208,11 @@ class CSSTidy_optimise {
208
  }
209
 
210
  if ( 'font' === $this->property && $this->parser->get_cfg( 'optimise_shorthands' ) > 1 ) {
211
- $this->css[ $this->at ][ $this->selector ]['font']='';
212
  $this->parser->merge_css_blocks( $this->at, $this->selector, $this->dissolve_short_font( $this->value ) );
213
  }
214
  if ( 'background' === $this->property && $this->parser->get_cfg( 'optimise_shorthands' ) > 2 ) {
215
- $this->css[ $this->at ][ $this->selector ]['background']='';
216
  $this->parser->merge_css_blocks( $this->at, $this->selector, $this->dissolve_short_bg( $this->value ) );
217
  }
218
  if ( isset( $shorthands[ $this->property ] ) ) {
@@ -360,13 +360,13 @@ class CSSTidy_optimise {
360
  if ( false !== stripos( $color, 'progid:' ) ) {
361
  return $color;
362
  }
363
- preg_match_all( ",rgb\([^)]+\),i", $color, $matches, PREG_SET_ORDER );
364
  if ( count( $matches ) ) {
365
  foreach ( $matches as $m ) {
366
  $color = str_replace( $m[0], $this->cut_color( $m[0] ), $color );
367
  }
368
  }
369
- preg_match_all( ",#[0-9a-f]{6}(?=[^0-9a-f]),i", $color, $matches, PREG_SET_ORDER );
370
  if ( count( $matches ) ) {
371
  foreach ( $matches as $m ) {
372
  $color = str_replace( $m[0], $this->cut_color( $m[0] ), $color );
@@ -478,8 +478,7 @@ class CSSTidy_optimise {
478
  if ( in_array( $this->property, $color_values ) ) {
479
  if ( 3 === strlen( $temp[ $l ] ) || 6 === strlen( $temp[ $l ] ) ) {
480
  $temp[ $l ] = '#' . $temp[ $l ];
481
- }
482
- else {
483
  $temp[ $l ] = '0';
484
  }
485
  continue;
@@ -489,7 +488,7 @@ class CSSTidy_optimise {
489
  if ( '' === $number[1] && in_array( $this->property, $unit_values, true ) ) {
490
  $number[1] = 'px';
491
  }
492
- } elseif ( $number[1] !== 's' && $number[1] !== 'ms' ) {
493
  $number[1] = '';
494
  }
495
 
@@ -766,7 +765,16 @@ class CSSTidy_optimise {
766
  $origin = array( 'border', 'padding', 'content' );
767
  $pos = array( 'top', 'center', 'bottom', 'left', 'right' );
768
  $important = '';
769
- $return = array( 'background-image' => null, 'background-size' => null, 'background-repeat' => null, 'background-position' => null, 'background-attachment' => null, 'background-clip' => null, 'background-origin' => null, 'background-color' => null );
 
 
 
 
 
 
 
 
 
770
 
771
  if ( $this->parser->is_important( $str_value ) ) {
772
  $important = ' !important';
@@ -905,7 +913,7 @@ class CSSTidy_optimise {
905
  // Add new background property.
906
  if ( '' !== $new_bg_value ) {
907
  $input_css['background'] = $new_bg_value . $important;
908
- } elseif ( isset ( $input_css['background'] ) ) {
909
  $input_css['background'] = 'none';
910
  }
911
 
@@ -926,7 +934,14 @@ class CSSTidy_optimise {
926
  $font_variant = array( 'normal', 'small-caps' );
927
  $font_style = array( 'normal', 'italic', 'oblique' );
928
  $important = '';
929
- $return = array( 'font-style' => null, 'font-variant' => null, 'font-weight' => null, 'font-size' => null, 'line-height' => null, 'font-family' => null );
 
 
 
 
 
 
 
930
 
931
  if ( $this->parser->is_important( $str_value ) ) {
932
  $important = ' !important';
@@ -1016,19 +1031,19 @@ class CSSTidy_optimise {
1016
  if ( isset( $input_css['font-family'] ) && isset( $input_css['font-size'] ) && 'inherit' !== $input_css['font-family'] ) {
1017
  // Fix several words in font-family - add quotes.
1018
  if ( isset( $input_css['font-family'] ) ) {
1019
- $families = explode( ",", $input_css['font-family'] );
1020
  $result_families = array();
1021
  foreach ( $families as $family ) {
1022
  $family = trim( $family );
1023
  $len = strlen( $family );
1024
- if ( strpos( $family, " " ) &&
1025
  ! ( ( '"' === $family[0] && '"' === $family[ $len - 1 ] ) ||
1026
  ( "'" === $family[0] && "'" === $family[ $len - 1 ] ) ) ) {
1027
  $family = '"' . $family . '"';
1028
  }
1029
  $result_families[] = $family;
1030
  }
1031
- $input_css['font-family'] = implode( ",", $result_families );
1032
  }
1033
  foreach ( $font_prop_default as $font_property => $default_value ) {
1034
  // Skip if property does not exist.
@@ -1072,12 +1087,12 @@ class CSSTidy_optimise {
1072
  return $input_css;
1073
  }
1074
 
1075
- } // class CSSTidy_optimise
1076
 
1077
  /**
1078
  * Sanitization class
1079
  */
1080
- class CSSTidy_custom_sanitize extends CSSTidy_optimise {
1081
 
1082
  /**
1083
  * [$props_w_urls description]
@@ -1173,4 +1188,4 @@ class CSSTidy_custom_sanitize extends CSSTidy_optimise {
1173
  return "url('$url')";
1174
  }
1175
 
1176
- } // class CSSTidy_custom_sanitize
51
  * @author Florian Schmitz (floele at gmail dot com) 2005-2006
52
  * @version 1.0
53
  */
54
+ class TablePress_CSSTidy_optimise {
55
 
56
  /**
57
  * CSSTidy instance.
208
  }
209
 
210
  if ( 'font' === $this->property && $this->parser->get_cfg( 'optimise_shorthands' ) > 1 ) {
211
+ $this->css[ $this->at ][ $this->selector ]['font'] = '';
212
  $this->parser->merge_css_blocks( $this->at, $this->selector, $this->dissolve_short_font( $this->value ) );
213
  }
214
  if ( 'background' === $this->property && $this->parser->get_cfg( 'optimise_shorthands' ) > 2 ) {
215
+ $this->css[ $this->at ][ $this->selector ]['background'] = '';
216
  $this->parser->merge_css_blocks( $this->at, $this->selector, $this->dissolve_short_bg( $this->value ) );
217
  }
218
  if ( isset( $shorthands[ $this->property ] ) ) {
360
  if ( false !== stripos( $color, 'progid:' ) ) {
361
  return $color;
362
  }
363
+ preg_match_all( ',rgb\([^)]+\),i', $color, $matches, PREG_SET_ORDER );
364
  if ( count( $matches ) ) {
365
  foreach ( $matches as $m ) {
366
  $color = str_replace( $m[0], $this->cut_color( $m[0] ), $color );
367
  }
368
  }
369
+ preg_match_all( ',#[0-9a-f]{6}(?=[^0-9a-f]),i', $color, $matches, PREG_SET_ORDER );
370
  if ( count( $matches ) ) {
371
  foreach ( $matches as $m ) {
372
  $color = str_replace( $m[0], $this->cut_color( $m[0] ), $color );
478
  if ( in_array( $this->property, $color_values ) ) {
479
  if ( 3 === strlen( $temp[ $l ] ) || 6 === strlen( $temp[ $l ] ) ) {
480
  $temp[ $l ] = '#' . $temp[ $l ];
481
+ } else {
 
482
  $temp[ $l ] = '0';
483
  }
484
  continue;
488
  if ( '' === $number[1] && in_array( $this->property, $unit_values, true ) ) {
489
  $number[1] = 'px';
490
  }
491
+ } elseif ( 's' !== $number[1] && 'ms' !== $number[1] ) {
492
  $number[1] = '';
493
  }
494
 
765
  $origin = array( 'border', 'padding', 'content' );
766
  $pos = array( 'top', 'center', 'bottom', 'left', 'right' );
767
  $important = '';
768
+ $return = array(
769
+ 'background-image' => null,
770
+ 'background-size' => null,
771
+ 'background-repeat' => null,
772
+ 'background-position' => null,
773
+ 'background-attachment' => null,
774
+ 'background-clip' => null,
775
+ 'background-origin' => null,
776
+ 'background-color' => null,
777
+ );
778
 
779
  if ( $this->parser->is_important( $str_value ) ) {
780
  $important = ' !important';
913
  // Add new background property.
914
  if ( '' !== $new_bg_value ) {
915
  $input_css['background'] = $new_bg_value . $important;
916
+ } elseif ( isset( $input_css['background'] ) ) {
917
  $input_css['background'] = 'none';
918
  }
919
 
934
  $font_variant = array( 'normal', 'small-caps' );
935
  $font_style = array( 'normal', 'italic', 'oblique' );
936
  $important = '';
937
+ $return = array(
938
+ 'font-style' => null,
939
+ 'font-variant' => null,
940
+ 'font-weight' => null,
941
+ 'font-size' => null,
942
+ 'line-height' => null,
943
+ 'font-family' => null,
944
+ );
945
 
946
  if ( $this->parser->is_important( $str_value ) ) {
947
  $important = ' !important';
1031
  if ( isset( $input_css['font-family'] ) && isset( $input_css['font-size'] ) && 'inherit' !== $input_css['font-family'] ) {
1032
  // Fix several words in font-family - add quotes.
1033
  if ( isset( $input_css['font-family'] ) ) {
1034
+ $families = explode( ',', $input_css['font-family'] );
1035
  $result_families = array();
1036
  foreach ( $families as $family ) {
1037
  $family = trim( $family );
1038
  $len = strlen( $family );
1039
+ if ( strpos( $family, ' ' ) &&
1040
  ! ( ( '"' === $family[0] && '"' === $family[ $len - 1 ] ) ||
1041
  ( "'" === $family[0] && "'" === $family[ $len - 1 ] ) ) ) {
1042
  $family = '"' . $family . '"';
1043
  }
1044
  $result_families[] = $family;
1045
  }
1046
+ $input_css['font-family'] = implode( ',', $result_families );
1047
  }
1048
  foreach ( $font_prop_default as $font_property => $default_value ) {
1049
  // Skip if property does not exist.
1087
  return $input_css;
1088
  }
1089
 
1090
+ } // class TablePress_CSSTidy_optimise
1091
 
1092
  /**
1093
  * Sanitization class
1094
  */
1095
+ class TablePress_CSSTidy_custom_sanitize extends TablePress_CSSTidy_optimise {
1096
 
1097
  /**
1098
  * [$props_w_urls description]
1188
  return "url('$url')";
1189
  }
1190
 
1191
+ } // class TablePress_CSSTidy_custom_sanitize
libraries/csstidy/class.csstidy_print.php CHANGED
@@ -50,7 +50,7 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
50
  * @author Florian Schmitz (floele at gmail dot com) 2005-2006
51
  * @version 1.1.0
52
  */
53
- class CSSTidy_print {
54
 
55
  /**
56
  * CSSTidy instance.
@@ -336,7 +336,7 @@ class CSSTidy_print {
336
  break;
337
  case AT_END:
338
  $out = &$output;
339
- $in_at_out = str_replace( "\n\n", "\r\n", $in_at_out); // don't fill empty lines
340
  $in_at_out = str_replace( "\n", "\n" . $template[10], $in_at_out );
341
  $in_at_out = str_replace( "\r\n", "\n\n", $in_at_out );
342
  $out .= $template[10] . $in_at_out . $template[9];
@@ -529,4 +529,4 @@ class CSSTidy_print {
529
  }
530
  }
531
 
532
- } // class CSSTidy_print
50
  * @author Florian Schmitz (floele at gmail dot com) 2005-2006
51
  * @version 1.1.0
52
  */
53
+ class TablePress_CSSTidy_print {
54
 
55
  /**
56
  * CSSTidy instance.
336
  break;
337
  case AT_END:
338
  $out = &$output;
339
+ $in_at_out = str_replace( "\n\n", "\r\n", $in_at_out ); // don't fill empty lines
340
  $in_at_out = str_replace( "\n", "\n" . $template[10], $in_at_out );
341
  $in_at_out = str_replace( "\r\n", "\n\n", $in_at_out );
342
  $out .= $template[10] . $in_at_out . $template[9];
529
  }
530
  }
531
 
532
+ } // class TablePress_CSSTidy_print
libraries/csstidy/data-tp.inc.php CHANGED
@@ -19,14 +19,14 @@ $data['csstidy']['all_properties']['zoom'] = 'CSS3.0';
19
 
20
  // Support browser prefixes for properties only in the latest CSS draft.
21
  foreach ( $data['csstidy']['all_properties'] as $property => $levels ) {
22
- $data['csstidy']['all_properties']['*' . $property] = $levels; // IE7 hacks
23
 
24
  if ( false === strpos( $levels, ',' ) ) {
25
- $data['csstidy']['all_properties']['-moz-' . $property] = $levels;
26
- $data['csstidy']['all_properties']['-webkit-' . $property] = $levels;
27
- $data['csstidy']['all_properties']['-ms-' . $property] = $levels;
28
- $data['csstidy']['all_properties']['-o-' . $property] = $levels;
29
- $data['csstidy']['all_properties']['-khtml-' . $property] = $levels;
30
 
31
  if ( in_array( $property, $data['csstidy']['unit_values'] ) ) {
32
  $data['csstidy']['unit_values'][] = '-moz-' . $property;
@@ -88,3 +88,14 @@ $data['csstidy']['all_properties']['-ms-touch-action'] = 'CSS3.0';
88
  $data['csstidy']['all_properties']['-webkit-overflow-scrolling'] = 'CSS3.0';
89
  $data['csstidy']['all_properties']['pointer-events'] = 'CSS3.0';
90
  $data['csstidy']['all_properties']['font-feature-settings'] = 'CSS3.0';
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  // Support browser prefixes for properties only in the latest CSS draft.
21
  foreach ( $data['csstidy']['all_properties'] as $property => $levels ) {
22
+ $data['csstidy']['all_properties'][ '*' . $property ] = $levels; // IE7 hacks
23
 
24
  if ( false === strpos( $levels, ',' ) ) {
25
+ $data['csstidy']['all_properties'][ '-moz-' . $property ] = $levels;
26
+ $data['csstidy']['all_properties'][ '-webkit-' . $property ] = $levels;
27
+ $data['csstidy']['all_properties'][ '-ms-' . $property ] = $levels;
28
+ $data['csstidy']['all_properties'][ '-o-' . $property ] = $levels;
29
+ $data['csstidy']['all_properties'][ '-khtml-' . $property ] = $levels;
30
 
31
  if ( in_array( $property, $data['csstidy']['unit_values'] ) ) {
32
  $data['csstidy']['unit_values'][] = '-moz-' . $property;
88
  $data['csstidy']['all_properties']['-webkit-overflow-scrolling'] = 'CSS3.0';
89
  $data['csstidy']['all_properties']['pointer-events'] = 'CSS3.0';
90
  $data['csstidy']['all_properties']['font-feature-settings'] = 'CSS3.0';
91
+ $data['csstidy']['all_properties']['font-kerning'] = 'CSS3.0';
92
+ $data['csstidy']['all_properties']['font-language-override'] = 'CSS3.0';
93
+ $data['csstidy']['all_properties']['font-synthesis'] = 'CSS3.0';
94
+ $data['csstidy']['all_properties']['font-variant-alternates'] = 'CSS3.0';
95
+ $data['csstidy']['all_properties']['font-variant-caps'] = 'CSS3.0';
96
+ $data['csstidy']['all_properties']['font-variant-east-asian'] = 'CSS3.0';
97
+ $data['csstidy']['all_properties']['font-variant-ligatures'] = 'CSS3.0';
98
+ $data['csstidy']['all_properties']['font-variant-numeric'] = 'CSS3.0';
99
+ $data['csstidy']['all_properties']['font-variant-position'] = 'CSS3.0';
100
+ $data['csstidy']['all_properties']['font-variation-settings'] = 'CSS3.0';
101
+ $data['csstidy']['all_properties']['line-height-step'] = 'CSS3.0';
libraries/csstidy/data.inc.php CHANGED
@@ -57,22 +57,22 @@ $data['csstidy']['units'] = array( 'in', 'cm', 'mm', 'pt', 'pc', 'px', 'rem', 'e
57
  * Available at-rules.
58
  */
59
  $data['csstidy']['at_rules'] = array(
60
- 'page' => 'is',
61
- 'font-face' => 'atis',
62
- 'charset' => 'iv',
63
- 'import' => 'iv',
64
- 'namespace' => 'iv',
65
- 'media' => 'at',
66
- 'keyframes' => 'at',
67
- '-moz-keyframes' => 'at',
68
- '-o-keyframes' => 'at',
69
  '-webkit-keyframes' => 'at',
70
- '-ms-keyframes' => 'at',
71
- 'viewport' => 'at',
72
- '-webkit-viewport' => 'at',
73
- '-moz-viewport' => 'at',
74
- '-ms-viewport' => 'at',
75
- 'supports' => 'at',
76
  );
77
 
78
  /**
@@ -82,11 +82,49 @@ $data['csstidy']['at_rules'] = array(
82
  * @see compress_numbers();
83
  */
84
  $data['csstidy']['unit_values'] = array(
85
- 'background', 'background-position', 'background-size', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-width',
86
- 'border-top-width', 'border-right-width', 'border-left-width', 'border-bottom-width', 'bottom', 'border-spacing', 'column-gap', 'column-width',
87
- 'font-size', 'height', 'left', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'max-height',
88
- 'max-width', 'min-height', 'min-width', 'outline', 'outline-width', 'padding', 'padding-top', 'padding-right',
89
- 'padding-bottom', 'padding-left', 'perspective', 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  );
91
 
92
  /**
@@ -592,22 +630,22 @@ $data['csstidy']['multiple_properties'] = array_merge( $data['csstidy']['color_v
592
  * @see CSSTidy::load_template()
593
  */
594
  $data['csstidy']['predefined_templates']['default'][] = '<span class="at">'; //string before @rule
595
- $data['csstidy']['predefined_templates']['default'][] = '</span> <span class="format">{</span>'."\n"; //bracket after @-rule
596
  $data['csstidy']['predefined_templates']['default'][] = '<span class="selector">'; //string before selector
597
- $data['csstidy']['predefined_templates']['default'][] = '</span> <span class="format">{</span>'."\n"; //bracket after selector
598
  $data['csstidy']['predefined_templates']['default'][] = '<span class="property">'; //string before property
599
  $data['csstidy']['predefined_templates']['default'][] = '</span><span class="value">'; //string after property+before value
600
- $data['csstidy']['predefined_templates']['default'][] = '</span><span class="format">;</span>'."\n"; //string after value
601
  $data['csstidy']['predefined_templates']['default'][] = '<span class="format">}</span>'; //closing bracket - selector
602
  $data['csstidy']['predefined_templates']['default'][] = "\n\n"; //space between blocks {...}
603
- $data['csstidy']['predefined_templates']['default'][] = "\n".'<span class="format">}</span>'. "\n\n"; //closing bracket @-rule
604
  $data['csstidy']['predefined_templates']['default'][] = ''; //indent in @-rule
605
  $data['csstidy']['predefined_templates']['default'][] = '<span class="comment">'; // before comment
606
- $data['csstidy']['predefined_templates']['default'][] = '</span>'."\n"; // after comment
607
  $data['csstidy']['predefined_templates']['default'][] = "\n"; // after each line @-rule
608
 
609
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="at">';
610
- $data['csstidy']['predefined_templates']['high_compression'][] = '</span> <span class="format">{</span>'."\n";
611
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="selector">';
612
  $data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">{</span>';
613
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="property">';
@@ -615,7 +653,7 @@ $data['csstidy']['predefined_templates']['high_compression'][] = '</span><span c
615
  $data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">;</span>';
616
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="format">}</span>';
617
  $data['csstidy']['predefined_templates']['high_compression'][] = "\n";
618
- $data['csstidy']['predefined_templates']['high_compression'][] = "\n". '<span class="format">}'."\n".'</span>';
619
  $data['csstidy']['predefined_templates']['high_compression'][] = '';
620
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
621
  $data['csstidy']['predefined_templates']['high_compression'][] = '</span>'; // after comment
@@ -637,18 +675,18 @@ $data['csstidy']['predefined_templates']['highest_compression'][] = '</span>'; /
637
  $data['csstidy']['predefined_templates']['highest_compression'][] = '';
638
 
639
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="at">';
640
- $data['csstidy']['predefined_templates']['low_compression'][] = '</span> <span class="format">{</span>'."\n";
641
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="selector">';
642
- $data['csstidy']['predefined_templates']['low_compression'][] = '</span>'."\n".'<span class="format">{</span>'."\n";
643
  $data['csstidy']['predefined_templates']['low_compression'][] = ' <span class="property">';
644
  $data['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="value">';
645
- $data['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="format">;</span>'."\n";
646
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="format">}</span>';
647
  $data['csstidy']['predefined_templates']['low_compression'][] = "\n\n";
648
- $data['csstidy']['predefined_templates']['low_compression'][] = "\n".'<span class="format">}</span>'."\n\n";
649
  $data['csstidy']['predefined_templates']['low_compression'][] = ' ';
650
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="comment">'; // before comment
651
- $data['csstidy']['predefined_templates']['low_compression'][] = '</span>'."\n"; // after comment
652
  $data['csstidy']['predefined_templates']['low_compression'][] = "\n";
653
 
654
  // Add TablePress specific modifications.
57
  * Available at-rules.
58
  */
59
  $data['csstidy']['at_rules'] = array(
60
+ 'page' => 'is',
61
+ 'font-face' => 'atis',
62
+ 'charset' => 'iv',
63
+ 'import' => 'iv',
64
+ 'namespace' => 'iv',
65
+ 'media' => 'at',
66
+ 'keyframes' => 'at',
67
+ '-moz-keyframes' => 'at',
68
+ '-o-keyframes' => 'at',
69
  '-webkit-keyframes' => 'at',
70
+ '-ms-keyframes' => 'at',
71
+ 'viewport' => 'at',
72
+ '-webkit-viewport' => 'at',
73
+ '-moz-viewport' => 'at',
74
+ '-ms-viewport' => 'at',
75
+ 'supports' => 'at',
76
  );
77
 
78
  /**
82
  * @see compress_numbers();
83
  */
84
  $data['csstidy']['unit_values'] = array(
85
+ 'background',
86
+ 'background-position',
87
+ 'background-size',
88
+ 'border',
89
+ 'border-top',
90
+ 'border-right',
91
+ 'border-bottom',
92
+ 'border-left',
93
+ 'border-width',
94
+ 'border-top-width',
95
+ 'border-right-width',
96
+ 'border-left-width',
97
+ 'border-bottom-width',
98
+ 'bottom',
99
+ 'border-spacing',
100
+ 'column-gap',
101
+ 'column-width',
102
+ 'font-size',
103
+ 'height',
104
+ 'left',
105
+ 'margin',
106
+ 'margin-top',
107
+ 'margin-right',
108
+ 'margin-bottom',
109
+ 'margin-left',
110
+ 'max-height',
111
+ 'max-width',
112
+ 'min-height',
113
+ 'min-width',
114
+ 'outline',
115
+ 'outline-width',
116
+ 'padding',
117
+ 'padding-top',
118
+ 'padding-right',
119
+ 'padding-bottom',
120
+ 'padding-left',
121
+ 'perspective',
122
+ 'right',
123
+ 'top',
124
+ 'text-indent',
125
+ 'letter-spacing',
126
+ 'word-spacing',
127
+ 'width',
128
  );
129
 
130
  /**
630
  * @see CSSTidy::load_template()
631
  */
632
  $data['csstidy']['predefined_templates']['default'][] = '<span class="at">'; //string before @rule
633
+ $data['csstidy']['predefined_templates']['default'][] = '</span> <span class="format">{</span>' . "\n"; //bracket after @-rule
634
  $data['csstidy']['predefined_templates']['default'][] = '<span class="selector">'; //string before selector
635
+ $data['csstidy']['predefined_templates']['default'][] = '</span> <span class="format">{</span>' . "\n"; //bracket after selector
636
  $data['csstidy']['predefined_templates']['default'][] = '<span class="property">'; //string before property
637
  $data['csstidy']['predefined_templates']['default'][] = '</span><span class="value">'; //string after property+before value
638
+ $data['csstidy']['predefined_templates']['default'][] = '</span><span class="format">;</span>' . "\n"; //string after value
639
  $data['csstidy']['predefined_templates']['default'][] = '<span class="format">}</span>'; //closing bracket - selector
640
  $data['csstidy']['predefined_templates']['default'][] = "\n\n"; //space between blocks {...}
641
+ $data['csstidy']['predefined_templates']['default'][] = "\n" . '<span class="format">}</span>' . "\n\n"; //closing bracket @-rule
642
  $data['csstidy']['predefined_templates']['default'][] = ''; //indent in @-rule
643
  $data['csstidy']['predefined_templates']['default'][] = '<span class="comment">'; // before comment
644
+ $data['csstidy']['predefined_templates']['default'][] = '</span>' . "\n"; // after comment
645
  $data['csstidy']['predefined_templates']['default'][] = "\n"; // after each line @-rule
646
 
647
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="at">';
648
+ $data['csstidy']['predefined_templates']['high_compression'][] = '</span> <span class="format">{</span>' . "\n";
649
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="selector">';
650
  $data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">{</span>';
651
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="property">';
653
  $data['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">;</span>';
654
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="format">}</span>';
655
  $data['csstidy']['predefined_templates']['high_compression'][] = "\n";
656
+ $data['csstidy']['predefined_templates']['high_compression'][] = "\n" . '<span class="format">}' . "\n" . '</span>';
657
  $data['csstidy']['predefined_templates']['high_compression'][] = '';
658
  $data['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
659
  $data['csstidy']['predefined_templates']['high_compression'][] = '</span>'; // after comment
675
  $data['csstidy']['predefined_templates']['highest_compression'][] = '';
676
 
677
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="at">';
678
+ $data['csstidy']['predefined_templates']['low_compression'][] = '</span> <span class="format">{</span>' . "\n";
679
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="selector">';
680
+ $data['csstidy']['predefined_templates']['low_compression'][] = '</span>' . "\n" . '<span class="format">{</span>' . "\n";
681
  $data['csstidy']['predefined_templates']['low_compression'][] = ' <span class="property">';
682
  $data['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="value">';
683
+ $data['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="format">;</span>' . "\n";
684
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="format">}</span>';
685
  $data['csstidy']['predefined_templates']['low_compression'][] = "\n\n";
686
+ $data['csstidy']['predefined_templates']['low_compression'][] = "\n" . '<span class="format">}</span>' . "\n\n";
687
  $data['csstidy']['predefined_templates']['low_compression'][] = ' ';
688
  $data['csstidy']['predefined_templates']['low_compression'][] = '<span class="comment">'; // before comment
689
+ $data['csstidy']['predefined_templates']['low_compression'][] = '</span>' . "\n"; // after comment
690
  $data['csstidy']['predefined_templates']['low_compression'][] = "\n";
691
 
692
  // Add TablePress specific modifications.
libraries/csv-parser.class.php CHANGED
@@ -160,6 +160,14 @@ class CSV_Parser {
160
  }
161
  }
162
  ksort( $potential_delimiters );
 
 
 
 
 
 
 
 
163
  // Return first array element, as that has the highest count.
164
  return array_shift( $potential_delimiters );
165
  }
@@ -202,7 +210,7 @@ class CSV_Parser {
202
  }
203
 
204
  // At this point, count is equal in all lines, so determine a string to sort priority.
205
- $match = ( $almost ) ? 2 : 1 ;
206
  $pref = strpos( $this->preferred_delimiter_chars, $char );
207
  $pref = ( false !== $pref ) ? str_pad( $pref, 3, '0', STR_PAD_LEFT ) : '999';
208
  return $pref . $match . '.' . ( 99999 - str_pad( $first, 5, '0', STR_PAD_LEFT ) );
@@ -247,9 +255,9 @@ class CSV_Parser {
247
  $error_column = $column + 1;
248
  if ( ! isset( $this->error_info[ "{$error_line}-{$error_column}" ] ) ) {
249
  $this->error_info[ "{$error_line}-{$error_column}" ] = array(
250
- 'type' => 2,
251
- 'info' => "Syntax error found in line {$error_line}. Non-enclosed fields can not contain double-quotes.",
252
- 'line' => $error_line,
253
  'column' => $error_column,
254
  );
255
  }
@@ -261,7 +269,9 @@ class CSV_Parser {
261
  $i++; // Skip next character
262
  } elseif ( $next_char !== $delimiter && "\r" !== $next_char && "\n" !== $next_char ) {
263
  // for-loop (instead of while-loop) that skips whitespace.
264
- for ( $x = ( $i + 1 ); isset( $data[ $x ] ) && '' === ltrim( $data[ $x ], $white_spaces ); $x++ ) {}
 
 
265
  if ( $data[ $x ] === $delimiter ) {
266
  $enclosed = false;
267
  $i = $x;
@@ -273,9 +283,9 @@ class CSV_Parser {
273
  $error_column = $column + 1;
274
  if ( ! isset( $this->error_info[ "{$error_line}-{$error_column}" ] ) ) {
275
  $this->error_info[ "{$error_line}-{$error_column}" ] = array(
276
- 'type' => 1,
277
- 'info' => "Syntax error found in line {$error_line}. A single double-quote was found within an enclosed string. Enclosed double-quotes must be escaped with a second double-quote.",
278
- 'line' => $error_line,
279
  'column' => $error_column,
280
  );
281
  }
160
  }
161
  }
162
  ksort( $potential_delimiters );
163
+
164
+ // If no valid delimiter was found, use the character that was found in most rows.
165
+ if ( empty( $potential_delimiters ) ) {
166
+ $delimiter_counts = array_map( 'count', $delimiter_count );
167
+ arsort( $delimiter_counts, SORT_NUMERIC );
168
+ $potential_delimiters = array_keys( $delimiter_counts );
169
+ }
170
+
171
  // Return first array element, as that has the highest count.
172
  return array_shift( $potential_delimiters );
173
  }
210
  }
211
 
212
  // At this point, count is equal in all lines, so determine a string to sort priority.
213
+ $match = ( $almost ) ? 2 : 1;
214
  $pref = strpos( $this->preferred_delimiter_chars, $char );
215
  $pref = ( false !== $pref ) ? str_pad( $pref, 3, '0', STR_PAD_LEFT ) : '999';
216
  return $pref . $match . '.' . ( 99999 - str_pad( $first, 5, '0', STR_PAD_LEFT ) );
255
  $error_column = $column + 1;
256
  if ( ! isset( $this->error_info[ "{$error_line}-{$error_column}" ] ) ) {
257
  $this->error_info[ "{$error_line}-{$error_column}" ] = array(
258
+ 'type' => 2,
259
+ 'info' => "Syntax error found in line {$error_line}. Non-enclosed fields can not contain double-quotes.",
260
+ 'line' => $error_line,
261
  'column' => $error_column,
262
  );
263
  }
269
  $i++; // Skip next character
270
  } elseif ( $next_char !== $delimiter && "\r" !== $next_char && "\n" !== $next_char ) {
271
  // for-loop (instead of while-loop) that skips whitespace.
272
+ for ( $x = ( $i + 1 ); isset( $data[ $x ] ) && '' === ltrim( $data[ $x ], $white_spaces ); $x++ ) {
273
+ // Action is in iterator check.
274
+ }
275
  if ( $data[ $x ] === $delimiter ) {
276
  $enclosed = false;
277
  $i = $x;
283
  $error_column = $column + 1;
284
  if ( ! isset( $this->error_info[ "{$error_line}-{$error_column}" ] ) ) {
285
  $this->error_info[ "{$error_line}-{$error_column}" ] = array(
286
+ 'type' => 1,
287
+ 'info' => "Syntax error found in line {$error_line}. A single double-quote was found within an enclosed string. Enclosed double-quotes must be escaped with a second double-quote.",
288
+ 'line' => $error_line,
289
  'column' => $error_column,
290
  );
291
  }
libraries/excel-reader.class.php CHANGED
@@ -29,22 +29,22 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
29
  * --------------------------------------------------------------------------
30
  */
31
 
32
- define( 'NUM_BIG_BLOCK_DEPOT_BLOCKS_POS', 0x2c );
33
- define( 'SMALL_BLOCK_DEPOT_BLOCK_POS', 0x3c );
34
- define( 'ROOT_START_BLOCK_POS', 0x30 );
35
- define( 'BIG_BLOCK_SIZE', 0x200 );
36
- define( 'SMALL_BLOCK_SIZE', 0x40 );
37
- define( 'EXTENSION_BLOCK_POS', 0x44 );
38
- define( 'NUM_EXTENSION_BLOCK_POS', 0x48 );
39
- define( 'PROPERTY_STORAGE_BLOCK_SIZE', 0x80 );
40
- define( 'BIG_BLOCK_DEPOT_BLOCKS_POS', 0x4c );
41
- define( 'SMALL_BLOCK_THRESHOLD', 0x1000 );
42
 
43
  // property storage offsets
44
  define( 'SIZE_OF_NAME_POS', 0x40 );
45
- define( 'TYPE_POS', 0x42 );
46
- define( 'START_BLOCK_POS', 0x74 );
47
- define( 'SIZE_POS', 0x78 );
48
 
49
  define( 'IDENTIFIER_OLE', pack( 'CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 ) );
50
 
@@ -185,7 +185,7 @@ class OLERead {
185
  $pos = ( $bigBlockDepotBlocks[ $i ] + 1 ) * BIG_BLOCK_SIZE;
186
  for ( $j = 0; $j < BIG_BLOCK_SIZE / 4; $j++ ) {
187
  $this->bigBlockChain[ $index ] = $this->_GetInt4d( $this->data, $pos );
188
- $pos += 4 ;
189
  $index++;
190
  }
191
  }
@@ -251,10 +251,10 @@ class OLERead {
251
  }
252
  $name = str_replace( "\x00", '', $name );
253
  $this->props[] = array(
254
- 'name' => $name,
255
- 'type' => $type,
256
  'startBlock' => $startBlock,
257
- 'size' => $size,
258
  );
259
  if ( 'workbook' === strtolower( $name ) || 'book' === strtolower( $name ) ) {
260
  $this->wrkbook = count( $this->props ) - 1;
@@ -323,51 +323,51 @@ class OLERead {
323
 
324
  } // class OLERead
325
 
326
- define( 'SPREADSHEET_EXCEL_READER_BIFF8', 0x600 );
327
- define( 'SPREADSHEET_EXCEL_READER_BIFF7', 0x500 );
328
- define( 'SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS', 0x5 );
329
- define( 'SPREADSHEET_EXCEL_READER_WORKSHEET', 0x10 );
330
- define( 'SPREADSHEET_EXCEL_READER_TYPE_BOF', 0x809 );
331
- define( 'SPREADSHEET_EXCEL_READER_TYPE_EOF', 0x0a );
332
- define( 'SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET', 0x85 );
333
- define( 'SPREADSHEET_EXCEL_READER_TYPE_DIMENSION', 0x200 );
334
- define( 'SPREADSHEET_EXCEL_READER_TYPE_ROW', 0x208 );
335
- define( 'SPREADSHEET_EXCEL_READER_TYPE_DBCELL', 0xd7 );
336
- define( 'SPREADSHEET_EXCEL_READER_TYPE_FILEPASS', 0x2f );
337
- define( 'SPREADSHEET_EXCEL_READER_TYPE_NOTE', 0x1c );
338
- define( 'SPREADSHEET_EXCEL_READER_TYPE_TXO', 0x1b6 );
339
- define( 'SPREADSHEET_EXCEL_READER_TYPE_RK', 0x7e );
340
- define( 'SPREADSHEET_EXCEL_READER_TYPE_RK2', 0x27e );
341
- define( 'SPREADSHEET_EXCEL_READER_TYPE_MULRK', 0xbd );
342
- define( 'SPREADSHEET_EXCEL_READER_TYPE_MULBLANK', 0xbe );
343
- define( 'SPREADSHEET_EXCEL_READER_TYPE_INDEX', 0x20b );
344
- define( 'SPREADSHEET_EXCEL_READER_TYPE_SST', 0xfc );
345
- define( 'SPREADSHEET_EXCEL_READER_TYPE_EXTSST', 0xff );
346
- define( 'SPREADSHEET_EXCEL_READER_TYPE_CONTINUE', 0x3c );
347
- define( 'SPREADSHEET_EXCEL_READER_TYPE_LABEL', 0x204 );
348
- define( 'SPREADSHEET_EXCEL_READER_TYPE_LABELSST', 0xfd );
349
- define( 'SPREADSHEET_EXCEL_READER_TYPE_NUMBER', 0x203 );
350
- define( 'SPREADSHEET_EXCEL_READER_TYPE_NAME', 0x18 );
351
- define( 'SPREADSHEET_EXCEL_READER_TYPE_ARRAY', 0x221 );
352
- define( 'SPREADSHEET_EXCEL_READER_TYPE_STRING', 0x207 );
353
- define( 'SPREADSHEET_EXCEL_READER_TYPE_FORMULA', 0x406 );
354
- define( 'SPREADSHEET_EXCEL_READER_TYPE_FORMULA2', 0x6 );
355
- define( 'SPREADSHEET_EXCEL_READER_TYPE_FORMAT', 0x41e );
356
- define( 'SPREADSHEET_EXCEL_READER_TYPE_XF', 0xe0 );
357
- define( 'SPREADSHEET_EXCEL_READER_TYPE_BOOLERR', 0x205 );
358
- define( 'SPREADSHEET_EXCEL_READER_TYPE_FONT', 0x0031 );
359
- define( 'SPREADSHEET_EXCEL_READER_TYPE_PALETTE', 0x0092 );
360
- define( 'SPREADSHEET_EXCEL_READER_TYPE_UNKNOWN', 0xffff );
361
- define( 'SPREADSHEET_EXCEL_READER_TYPE_NINETEENFOUR', 0x22 );
362
- define( 'SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS', 0xE5 );
363
- define( 'SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS', 25569 );
364
- define( 'SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904', 24107 );
365
- define( 'SPREADSHEET_EXCEL_READER_MSINADAY', 86400 );
366
- define( 'SPREADSHEET_EXCEL_READER_TYPE_HYPER', 0x01b8 );
367
- define( 'SPREADSHEET_EXCEL_READER_TYPE_COLINFO', 0x7d );
368
- define( 'SPREADSHEET_EXCEL_READER_TYPE_DEFCOLWIDTH', 0x55 );
369
- define( 'SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH', 0x99 );
370
- define( 'SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT', '%s' );
371
 
372
  /*
373
  * Main Class
@@ -1333,7 +1333,7 @@ class Spreadsheet_Excel_Reader {
1333
  0xa => '0.00%',
1334
  0xb => '0.00E+00',
1335
  0x25 => '#,##0;(#,##0)',
1336
- 0x26 => "#,##0;[Red](#,##0)",
1337
  0x27 => '#,##0.00;(#,##0.00)',
1338
  0x28 => '#,##0.00;[Red](#,##0.00)',
1339
  0x29 => '#,##0;(#,##0)', // Not exact
@@ -1455,18 +1455,18 @@ class Spreadsheet_Excel_Reader {
1455
  * @var array
1456
  */
1457
  protected $lineStylesCss = array(
1458
- 'Thin' => '1px solid',
1459
- 'Medium' => '2px solid',
1460
- 'Dashed' => '1px dashed',
1461
- 'Dotted' => '1px dotted',
1462
- 'Thick' => '3px solid',
1463
- 'Double' => 'double',
1464
- 'Hair' => '1px solid',
1465
- 'Medium dashed' => '2px dashed',
1466
- 'Thin dash-dotted' => '1px dashed',
1467
- 'Medium dash-dotted' => '2px dashed',
1468
- 'Thin dash-dot-dotted' => '1px dashed',
1469
- 'Medium dash-dot-dotted' => '2px dashed',
1470
  'Slanted medium dash-dotted' => '2px dashed',
1471
  );
1472
 
@@ -1502,7 +1502,10 @@ class Spreadsheet_Excel_Reader {
1502
  // 49 = TEXT format
1503
  // https://code.google.com/archive/p/php-excel-reader/issues/7
1504
  if ( ( ! $f && '%s' === $format ) || ( 49 === (int) $f ) || ( 'GENERAL' === $format ) ) {
1505
- return array( 'string' => $num, 'formatColor' => null );
 
 
 
1506
  }
1507
 
1508
  // Custom pattern can be POSITIVE;NEGATIVE;ZERO
@@ -1521,7 +1524,7 @@ class Spreadsheet_Excel_Reader {
1521
 
1522
  $color = '';
1523
  $matches = array();
1524
- $color_regex = "/^\[(BLACK|BLUE|CYAN|GREEN|MAGENTA|RED|WHITE|YELLOW)\]/i";
1525
  if ( preg_match( $color_regex, $pattern, $matches ) ) {
1526
  $color = strtolower( $matches[1] );
1527
  $pattern = preg_replace( $color_regex, '', $pattern );
@@ -1546,13 +1549,13 @@ class Spreadsheet_Excel_Reader {
1546
  }
1547
 
1548
  // Handle Percentages.
1549
- if ( preg_match( "/\d(\%)([^\%]|$)/", $pattern, $matches ) ) {
1550
  $num *= 100;
1551
- $pattern = preg_replace( "/(\d)(\%)([^\%]|$)/", "$1%$3", $pattern );
1552
  }
1553
 
1554
  // Handle the number itself.
1555
- $number_regex = "/(\d+)(\.?)(\d*)/";
1556
  if ( preg_match( $number_regex, $pattern, $matches ) ) {
1557
  //$left = $matches[1];
1558
  //$dec = $matches[2];
@@ -1567,7 +1570,7 @@ class Spreadsheet_Excel_Reader {
1567
  }
1568
 
1569
  return array(
1570
- 'string' => $pattern,
1571
  'formatColor' => $color,
1572
  );
1573
  }
@@ -1588,7 +1591,7 @@ class Spreadsheet_Excel_Reader {
1588
  $this->setOutputEncoding( $outputEncoding );
1589
  }
1590
  for ( $i = 1; $i < 245; $i++ ) {
1591
- $name = strtolower( ( ( ( $i - 1 ) / 26 >= 1 )?chr( ( $i - 1 ) / 26 + 64 ):'' ) . chr( ( $i - 1 ) % 26 + 65 ) );
1592
  $this->colnames[ $name ] = $i;
1593
  $this->colindexes[ $i ] = $name;
1594
  }
@@ -1738,7 +1741,7 @@ class Spreadsheet_Excel_Reader {
1738
  $spos += 2;
1739
  $optionFlags = ord( $data[ $spos ] );
1740
  $spos++;
1741
- $asciiEncoding = ( 0 === ( $optionFlags & 0x01 ) ) ;
1742
  $extendedString = ( 0 !== ( $optionFlags & 0x04 ) );
1743
 
1744
  // See if string contains formatting information.
@@ -1756,7 +1759,7 @@ class Spreadsheet_Excel_Reader {
1756
  $spos += 4;
1757
  }
1758
 
1759
- $len = ( $asciiEncoding )? $numChars : $numChars * 2;
1760
  if ( $spos + $len < $limitpos ) {
1761
  $retstr = substr( $data, $spos, $len );
1762
  $spos += $len;
@@ -1792,14 +1795,14 @@ class Spreadsheet_Excel_Reader {
1792
  // continuation it is in straightforward ASCII encoding
1793
  $len = min( $charsLeft, $limitpos - $spos ); // min( $charsLeft, $conlength );
1794
  for ( $j = 0; $j < $len; $j++ ) {
1795
- $retstr .= $data[ $spos + $j ].chr( 0 );
1796
  }
1797
  $charsLeft -= $len;
1798
  $asciiEncoding = false;
1799
  } else {
1800
  $newstr = '';
1801
  for ( $j = 0; $j < strlen( $retstr ); $j++ ) {
1802
- $newstr = $retstr[ $j ].chr( 0 );
1803
  }
1804
  $retstr = $newstr;
1805
  $len = min( $charsLeft * 2, $limitpos - $spos ); // min( $charsLeft, $conlength );
@@ -1904,10 +1907,10 @@ class Spreadsheet_Excel_Reader {
1904
  $xf['fillPattern'] = $fillPattern;
1905
 
1906
  $border = ord( $data[ $pos + 14 ] ) | ( ord( $data[ $pos + 15 ] ) << 8 ) | ( ord( $data[ $pos + 16 ] ) << 16 ) | ( ord( $data[ $pos + 17 ] ) << 24 );
1907
- $xf['borderLeft'] = $this->lineStyles[( $border & 0xF )];
1908
- $xf['borderRight'] = $this->lineStyles[( $border & 0xF0 ) >> 4];
1909
- $xf['borderTop'] = $this->lineStyles[( $border & 0xF00 ) >> 8];
1910
- $xf['borderBottom'] = $this->lineStyles[( $border & 0xF000 ) >> 12];
1911
 
1912
  $xf['borderLeftColor'] = ( $border & 0x7F0000 ) >> 16;
1913
  $xf['borderRightColor'] = ( $border & 0x3F800000 ) >> 23;
@@ -1920,24 +1923,24 @@ class Spreadsheet_Excel_Reader {
1920
  if ( '' === $align ) {
1921
  $xf['align'] = 'right';
1922
  }
1923
- }elseif ( array_key_exists( $indexCode, $this->numberFormats ) ) {
1924
  $xf['type'] = 'number';
1925
  $xf['format'] = $this->numberFormats[ $indexCode ];
1926
  if ( '' === $align ) {
1927
  $xf['align'] = 'right';
1928
  }
1929
- }else {
1930
- $isdate = FALSE;
1931
  $formatstr = '';
1932
  if ( $indexCode > 0 ) {
1933
  if ( isset( $this->formatRecords[ $indexCode ] ) ) {
1934
  $formatstr = $this->formatRecords[ $indexCode ];
1935
  }
1936
  if ( '' !== $formatstr ) {
1937
- $tmp = preg_replace( "/\;.*/", '', $formatstr );
1938
- $tmp = preg_replace( "/^\[[^\]]*\]/", '', $tmp );
1939
- if ( 0 === preg_match( "/[^hmsday\/\-:\s\\\,AMP]/i", $tmp ) ) { // found day and time format
1940
- $isdate = TRUE;
1941
  $formatstr = $tmp;
1942
  $formatstr = str_replace( array( 'AM/PM', 'mmmm', 'mmm' ), array( 'a', 'F', 'M' ), $formatstr );
1943
  // m/mm are used for both minutes and months - oh SNAP!
@@ -1946,12 +1949,12 @@ class Spreadsheet_Excel_Reader {
1946
  $formatstr = preg_replace( '/(h:?)mm?/', '$1i', $formatstr );
1947
  $formatstr = preg_replace( '/mm?(:?s)/', '1$1', $formatstr );
1948
  // A single 'm' = n in PHP
1949
- $formatstr = preg_replace( "/(^|[^m])m([^m]|$)/", '$1n$2', $formatstr );
1950
- $formatstr = preg_replace( "/(^|[^m])m([^m]|$)/", '$1n$2', $formatstr );
1951
  // else it's months
1952
  $formatstr = str_replace( 'mm', 'm', $formatstr );
1953
  // Convert single 'd' to 'j'
1954
- $formatstr = preg_replace( "/(^|[^d])d([^d]|$)/", '$1j$2', $formatstr );
1955
  $formatstr = str_replace( array( 'dddd', 'ddd', 'dd', 'yyyy', 'yy', 'hh', 'h' ), array( 'l', 'D', 'd', 'Y', 'y', 'H', 'g' ), $formatstr );
1956
  $formatstr = preg_replace( '/ss?/', 's', $formatstr );
1957
  }
@@ -1963,7 +1966,7 @@ class Spreadsheet_Excel_Reader {
1963
  if ( '' === $align ) {
1964
  $xf['align'] = 'right';
1965
  }
1966
- }else {
1967
  // If the format string has a 0 or # in it, we'll assume it's a number.
1968
  if ( preg_match( '/[0#]/', $formatstr ) ) {
1969
  $xf['type'] = 'number';
@@ -1998,7 +2001,10 @@ class Spreadsheet_Excel_Reader {
1998
  } elseif ( SPREADSHEET_EXCEL_READER_BIFF7 === $version ) {
1999
  $rec_name = substr( $data, $pos + 11, $rec_length );
2000
  }
2001
- $this->boundsheets[] = array( 'name' => $rec_name, 'offset' => $rec_offset );
 
 
 
2002
  break;
2003
  } // switch
2004
 
@@ -2111,7 +2117,7 @@ class Spreadsheet_Excel_Reader {
2111
  case SPREADSHEET_EXCEL_READER_TYPE_NUMBER:
2112
  $row = ord( $data[ $spos ] ) | ord( $data[ $spos + 1 ] ) << 8;
2113
  $column = ord( $data[ $spos + 2 ] ) | ord( $data[ $spos + 3 ] ) << 8;
2114
- $tmp = unpack( "ddouble", substr( $data, $spos + 6, 8 ) ); // It machine machine dependent
2115
  if ( $this->isDate( $spos ) ) {
2116
  $numValue = $tmp['double'];
2117
  } else {
@@ -2171,7 +2177,7 @@ class Spreadsheet_Excel_Reader {
2171
  $xpos += 2;
2172
  $optionFlags = ord( $data[ $xpos ] );
2173
  $xpos++;
2174
- $asciiEncoding = ( 0 === ( $optionFlags &0x01 ) ) ;
2175
  $extendedString = ( 0 !== ( $optionFlags & 0x04 ) );
2176
  // See if string contains formatting information
2177
  $richString = ( 0 !== ( $optionFlags & 0x08 ) );
@@ -2185,12 +2191,11 @@ class Spreadsheet_Excel_Reader {
2185
  // $extendedRunLength =$this->_GetInt4d( $this->data, $xpos );
2186
  $xpos += 4;
2187
  }
2188
- $len = ( $asciiEncoding )?$numChars : $numChars * 2;
2189
  $retstr = substr( $data, $xpos, $len );
2190
  $xpos += $len;
2191
- $retstr = ( $asciiEncoding )? $retstr : $this->_encodeUTF16( $retstr );
2192
- }
2193
- elseif ( SPREADSHEET_EXCEL_READER_BIFF7 === $version ) {
2194
  // Simple byte string
2195
  $xpos = $spos;
2196
  $numChars = ord( $data[ $xpos ] ) | ( ord( $data[ $xpos + 1 ] ) << 8 );
@@ -2208,7 +2213,10 @@ class Spreadsheet_Excel_Reader {
2208
  $rowHeight = $rowInfo & 0x7FFF;
2209
  }
2210
  $rowHidden = ( ord( $data[ $spos + 12 ] ) & 0x20 ) >> 5;
2211
- $this->rowInfo[ $this->sn ][ $row + 1 ] = array( 'height' => $rowHeight / 20, 'hidden' => $rowHidden );
 
 
 
2212
  break;
2213
  case SPREADSHEET_EXCEL_READER_TYPE_DBCELL:
2214
  break;
@@ -2266,7 +2274,7 @@ class Spreadsheet_Excel_Reader {
2266
  $this->defaultColWidth = ord( $data[ $spos + 4 ] ) | ord( $data[ $spos + 5 ] ) << 8;
2267
  break;
2268
  case SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH:
2269
- $this->standardColWidth = ord( $data[ $spos + 4 ] ) | ord( $data[ $spos + 5 ] ) << 8;
2270
  break;
2271
  case SPREADSHEET_EXCEL_READER_TYPE_COLINFO:
2272
  $colfrom = ord( $data[ $spos + 0 ] ) | ord( $data[ $spos + 1 ] ) << 8;
@@ -2275,7 +2283,12 @@ class Spreadsheet_Excel_Reader {
2275
  $cxf = ord( $data[ $spos + 6 ] ) | ord( $data[ $spos + 7 ] ) << 8;
2276
  $co = ord( $data[ $spos + 8 ] );
2277
  for ( $coli = $colfrom; $coli <= $colto; $coli++ ) {
2278
- $this->colInfo[ $this->sn ][ $coli + 1 ] = array( 'width' => $cw, 'xf' => $cxf, 'hidden' => ( $co & 0x01 ), 'collapsed' => ( $co & 0x1000 ) >> 12 );
 
 
 
 
 
2279
  }
2280
  break;
2281
  default:
@@ -2376,14 +2389,14 @@ class Spreadsheet_Excel_Reader {
2376
  }
2377
 
2378
  return array(
2379
- 'string' => $string,
2380
- 'raw' => $raw,
2381
- 'rectype' => $rectype,
2382
- 'format' => $format,
2383
  'formatIndex' => $formatIndex,
2384
- 'fontIndex' => $fontIndex,
2385
  'formatColor' => $formatColor,
2386
- 'xfIndex' => $xfindex,
2387
  );
2388
  }
2389
 
@@ -2403,11 +2416,11 @@ class Spreadsheet_Excel_Reader {
2403
  $mantissa = ( 0x100000 | ( $rknumhigh & 0x000fffff ) );
2404
  $mantissalow1 = ( $rknumlow & 0x80000000 ) >> 31;
2405
  $mantissalow2 = ( $rknumlow & 0x7fffffff );
2406
- $value = $mantissa / pow( 2 , ( 20- ( $exp - 1023 ) ) );
2407
  if ( 0 !== $mantissalow1 ) {
2408
- $value += 1 / pow( 2 , ( 21 - ( $exp - 1023 ) ) );
2409
  }
2410
- $value += $mantissalow2 / pow( 2 , ( 52 - ( $exp - 1023 ) ) );
2411
  if ( $sign ) {
2412
  $value *= -1;
2413
  }
@@ -2456,7 +2469,7 @@ class Spreadsheet_Excel_Reader {
2456
  $sign = ( $rknum & 0x80000000 ) >> 31;
2457
  $exp = ( $rknum & 0x7ff00000 ) >> 20;
2458
  $mantissa = ( 0x100000 | ( $rknum & 0x000ffffc ) );
2459
- $value = $mantissa / pow( 2 , ( 20- ( $exp - 1023 ) ) );
2460
  if ( $sign ) {
2461
  $value *= -1;
2462
  }
29
  * --------------------------------------------------------------------------
30
  */
31
 
32
+ define( 'NUM_BIG_BLOCK_DEPOT_BLOCKS_POS', 0x2c );
33
+ define( 'SMALL_BLOCK_DEPOT_BLOCK_POS', 0x3c );
34
+ define( 'ROOT_START_BLOCK_POS', 0x30 );
35
+ define( 'BIG_BLOCK_SIZE', 0x200 );
36
+ define( 'SMALL_BLOCK_SIZE', 0x40 );
37
+ define( 'EXTENSION_BLOCK_POS', 0x44 );
38
+ define( 'NUM_EXTENSION_BLOCK_POS', 0x48 );
39
+ define( 'PROPERTY_STORAGE_BLOCK_SIZE', 0x80 );
40
+ define( 'BIG_BLOCK_DEPOT_BLOCKS_POS', 0x4c );
41
+ define( 'SMALL_BLOCK_THRESHOLD', 0x1000 );
42
 
43
  // property storage offsets
44
  define( 'SIZE_OF_NAME_POS', 0x40 );
45
+ define( 'TYPE_POS', 0x42 );
46
+ define( 'START_BLOCK_POS', 0x74 );
47
+ define( 'SIZE_POS', 0x78 );
48
 
49
  define( 'IDENTIFIER_OLE', pack( 'CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 ) );
50
 
185
  $pos = ( $bigBlockDepotBlocks[ $i ] + 1 ) * BIG_BLOCK_SIZE;
186
  for ( $j = 0; $j < BIG_BLOCK_SIZE / 4; $j++ ) {
187
  $this->bigBlockChain[ $index ] = $this->_GetInt4d( $this->data, $pos );
188
+ $pos += 4;
189
  $index++;
190
  }
191
  }
251
  }
252
  $name = str_replace( "\x00", '', $name );
253
  $this->props[] = array(
254
+ 'name' => $name,
255
+ 'type' => $type,
256
  'startBlock' => $startBlock,
257
+ 'size' => $size,
258
  );
259
  if ( 'workbook' === strtolower( $name ) || 'book' === strtolower( $name ) ) {
260
  $this->wrkbook = count( $this->props ) - 1;
323
 
324
  } // class OLERead
325
 
326
+ define( 'SPREADSHEET_EXCEL_READER_BIFF8', 0x600 );
327
+ define( 'SPREADSHEET_EXCEL_READER_BIFF7', 0x500 );
328
+ define( 'SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS', 0x5 );
329
+ define( 'SPREADSHEET_EXCEL_READER_WORKSHEET', 0x10 );
330
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_BOF', 0x809 );
331
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_EOF', 0x0a );
332
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET', 0x85 );
333
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_DIMENSION', 0x200 );
334
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_ROW', 0x208 );
335
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_DBCELL', 0xd7 );
336
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_FILEPASS', 0x2f );
337
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_NOTE', 0x1c );
338
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_TXO', 0x1b6 );
339
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_RK', 0x7e );
340
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_RK2', 0x27e );
341
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_MULRK', 0xbd );
342
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_MULBLANK', 0xbe );
343
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_INDEX', 0x20b );
344
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_SST', 0xfc );
345
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_EXTSST', 0xff );
346
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_CONTINUE', 0x3c );
347
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_LABEL', 0x204 );
348
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_LABELSST', 0xfd );
349
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_NUMBER', 0x203 );
350
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_NAME', 0x18 );
351
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_ARRAY', 0x221 );
352
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_STRING', 0x207 );
353
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_FORMULA', 0x406 );
354
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_FORMULA2', 0x6 );
355
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_FORMAT', 0x41e );
356
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_XF', 0xe0 );
357
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_BOOLERR', 0x205 );
358
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_FONT', 0x0031 );
359
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_PALETTE', 0x0092 );
360
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_UNKNOWN', 0xffff );
361
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_NINETEENFOUR', 0x22 );
362
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS', 0xE5 );
363
+ define( 'SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS', 25569 );
364
+ define( 'SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904', 24107 );
365
+ define( 'SPREADSHEET_EXCEL_READER_MSINADAY', 86400 );
366
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_HYPER', 0x01b8 );
367
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_COLINFO', 0x7d );
368
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_DEFCOLWIDTH', 0x55 );
369
+ define( 'SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH', 0x99 );
370
+ define( 'SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT', '%s' );
371
 
372
  /*
373
  * Main Class
1333
  0xa => '0.00%',
1334
  0xb => '0.00E+00',
1335
  0x25 => '#,##0;(#,##0)',
1336
+ 0x26 => '#,##0;[Red](#,##0)',
1337
  0x27 => '#,##0.00;(#,##0.00)',
1338
  0x28 => '#,##0.00;[Red](#,##0.00)',
1339
  0x29 => '#,##0;(#,##0)', // Not exact
1455
  * @var array
1456
  */
1457
  protected $lineStylesCss = array(
1458
+ 'Thin' => '1px solid',
1459
+ 'Medium' => '2px solid',
1460
+ 'Dashed' => '1px dashed',
1461
+ 'Dotted' => '1px dotted',
1462
+ 'Thick' => '3px solid',
1463
+ 'Double' => 'double',
1464
+ 'Hair' => '1px solid',
1465
+ 'Medium dashed' => '2px dashed',
1466
+ 'Thin dash-dotted' => '1px dashed',
1467
+ 'Medium dash-dotted' => '2px dashed',
1468
+ 'Thin dash-dot-dotted' => '1px dashed',
1469
+ 'Medium dash-dot-dotted' => '2px dashed',
1470
  'Slanted medium dash-dotted' => '2px dashed',
1471
  );
1472
 
1502
  // 49 = TEXT format
1503
  // https://code.google.com/archive/p/php-excel-reader/issues/7
1504
  if ( ( ! $f && '%s' === $format ) || ( 49 === (int) $f ) || ( 'GENERAL' === $format ) ) {
1505
+ return array(
1506
+ 'string' => $num,
1507
+ 'formatColor' => null,
1508
+ );
1509
  }
1510
 
1511
  // Custom pattern can be POSITIVE;NEGATIVE;ZERO
1524
 
1525
  $color = '';
1526
  $matches = array();
1527
+ $color_regex = '/^\[(BLACK|BLUE|CYAN|GREEN|MAGENTA|RED|WHITE|YELLOW)\]/i';
1528
  if ( preg_match( $color_regex, $pattern, $matches ) ) {
1529
  $color = strtolower( $matches[1] );
1530
  $pattern = preg_replace( $color_regex, '', $pattern );
1549
  }
1550
 
1551
  // Handle Percentages.
1552
+ if ( preg_match( '/\d(\%)([^\%]|$)/', $pattern, $matches ) ) {
1553
  $num *= 100;
1554
+ $pattern = preg_replace( '/(\d)(\%)([^\%]|$)/', '$1%$3', $pattern );
1555
  }
1556
 
1557
  // Handle the number itself.
1558
+ $number_regex = '/(\d+)(\.?)(\d*)/';
1559
  if ( preg_match( $number_regex, $pattern, $matches ) ) {
1560
  //$left = $matches[1];
1561
  //$dec = $matches[2];
1570
  }
1571
 
1572
  return array(
1573
+ 'string' => $pattern,
1574
  'formatColor' => $color,
1575
  );
1576
  }
1591
  $this->setOutputEncoding( $outputEncoding );
1592
  }
1593
  for ( $i = 1; $i < 245; $i++ ) {
1594
+ $name = strtolower( ( ( ( $i - 1 ) / 26 >= 1 ) ? chr( ( $i - 1 ) / 26 + 64 ) : '' ) . chr( ( $i - 1 ) % 26 + 65 ) );
1595
  $this->colnames[ $name ] = $i;
1596
  $this->colindexes[ $i ] = $name;
1597
  }
1741
  $spos += 2;
1742
  $optionFlags = ord( $data[ $spos ] );
1743
  $spos++;
1744
+ $asciiEncoding = ( 0 === ( $optionFlags & 0x01 ) );
1745
  $extendedString = ( 0 !== ( $optionFlags & 0x04 ) );
1746
 
1747
  // See if string contains formatting information.
1759
  $spos += 4;
1760
  }
1761
 
1762
+ $len = ( $asciiEncoding ) ? $numChars : $numChars * 2;
1763
  if ( $spos + $len < $limitpos ) {
1764
  $retstr = substr( $data, $spos, $len );
1765
  $spos += $len;
1795
  // continuation it is in straightforward ASCII encoding
1796
  $len = min( $charsLeft, $limitpos - $spos ); // min( $charsLeft, $conlength );
1797
  for ( $j = 0; $j < $len; $j++ ) {
1798
+ $retstr .= $data[ $spos + $j ] . chr( 0 );
1799
  }
1800
  $charsLeft -= $len;
1801
  $asciiEncoding = false;
1802
  } else {
1803
  $newstr = '';
1804
  for ( $j = 0; $j < strlen( $retstr ); $j++ ) {
1805
+ $newstr = $retstr[ $j ] . chr( 0 );
1806
  }
1807
  $retstr = $newstr;
1808
  $len = min( $charsLeft * 2, $limitpos - $spos ); // min( $charsLeft, $conlength );
1907
  $xf['fillPattern'] = $fillPattern;
1908
 
1909
  $border = ord( $data[ $pos + 14 ] ) | ( ord( $data[ $pos + 15 ] ) << 8 ) | ( ord( $data[ $pos + 16 ] ) << 16 ) | ( ord( $data[ $pos + 17 ] ) << 24 );
1910
+ $xf['borderLeft'] = $this->lineStyles[ ( $border & 0xF ) ];
1911
+ $xf['borderRight'] = $this->lineStyles[ ( $border & 0xF0 ) >> 4 ];
1912
+ $xf['borderTop'] = $this->lineStyles[ ( $border & 0xF00 ) >> 8 ];
1913
+ $xf['borderBottom'] = $this->lineStyles[ ( $border & 0xF000 ) >> 12 ];
1914
 
1915
  $xf['borderLeftColor'] = ( $border & 0x7F0000 ) >> 16;
1916
  $xf['borderRightColor'] = ( $border & 0x3F800000 ) >> 23;
1923
  if ( '' === $align ) {
1924
  $xf['align'] = 'right';
1925
  }
1926
+ } elseif ( array_key_exists( $indexCode, $this->numberFormats ) ) {
1927
  $xf['type'] = 'number';
1928
  $xf['format'] = $this->numberFormats[ $indexCode ];
1929
  if ( '' === $align ) {
1930
  $xf['align'] = 'right';
1931
  }
1932
+ } else {
1933
+ $isdate = false;
1934
  $formatstr = '';
1935
  if ( $indexCode > 0 ) {
1936
  if ( isset( $this->formatRecords[ $indexCode ] ) ) {
1937
  $formatstr = $this->formatRecords[ $indexCode ];
1938
  }
1939
  if ( '' !== $formatstr ) {
1940
+ $tmp = preg_replace( '/\;.*/', '', $formatstr );
1941
+ $tmp = preg_replace( '/^\[[^\]]*\]/', '', $tmp );
1942
+ if ( 0 === preg_match( '/[^hmsday\/\-:\s\\\,AMP]/i', $tmp ) ) { // found day and time format
1943
+ $isdate = true;
1944
  $formatstr = $tmp;
1945
  $formatstr = str_replace( array( 'AM/PM', 'mmmm', 'mmm' ), array( 'a', 'F', 'M' ), $formatstr );
1946
  // m/mm are used for both minutes and months - oh SNAP!
1949
  $formatstr = preg_replace( '/(h:?)mm?/', '$1i', $formatstr );
1950
  $formatstr = preg_replace( '/mm?(:?s)/', '1$1', $formatstr );
1951
  // A single 'm' = n in PHP
1952
+ $formatstr = preg_replace( '/(^|[^m])m([^m]|$)/', '$1n$2', $formatstr );
1953
+ $formatstr = preg_replace( '/(^|[^m])m([^m]|$)/', '$1n$2', $formatstr );
1954
  // else it's months
1955
  $formatstr = str_replace( 'mm', 'm', $formatstr );
1956
  // Convert single 'd' to 'j'
1957
+ $formatstr = preg_replace( '/(^|[^d])d([^d]|$)/', '$1j$2', $formatstr );
1958
  $formatstr = str_replace( array( 'dddd', 'ddd', 'dd', 'yyyy', 'yy', 'hh', 'h' ), array( 'l', 'D', 'd', 'Y', 'y', 'H', 'g' ), $formatstr );
1959
  $formatstr = preg_replace( '/ss?/', 's', $formatstr );
1960
  }
1966
  if ( '' === $align ) {
1967
  $xf['align'] = 'right';
1968
  }
1969
+ } else {
1970
  // If the format string has a 0 or # in it, we'll assume it's a number.
1971
  if ( preg_match( '/[0#]/', $formatstr ) ) {
1972
  $xf['type'] = 'number';
2001
  } elseif ( SPREADSHEET_EXCEL_READER_BIFF7 === $version ) {
2002
  $rec_name = substr( $data, $pos + 11, $rec_length );
2003
  }
2004
+ $this->boundsheets[] = array(
2005
+ 'name' => $rec_name,
2006
+ 'offset' => $rec_offset,
2007
+ );
2008
  break;
2009
  } // switch
2010
 
2117
  case SPREADSHEET_EXCEL_READER_TYPE_NUMBER:
2118
  $row = ord( $data[ $spos ] ) | ord( $data[ $spos + 1 ] ) << 8;
2119
  $column = ord( $data[ $spos + 2 ] ) | ord( $data[ $spos + 3 ] ) << 8;
2120
+ $tmp = unpack( 'ddouble', substr( $data, $spos + 6, 8 ) ); // It machine machine dependent
2121
  if ( $this->isDate( $spos ) ) {
2122
  $numValue = $tmp['double'];
2123
  } else {
2177
  $xpos += 2;
2178
  $optionFlags = ord( $data[ $xpos ] );
2179
  $xpos++;
2180
+ $asciiEncoding = ( 0 === ( $optionFlags & 0x01 ) );
2181
  $extendedString = ( 0 !== ( $optionFlags & 0x04 ) );
2182
  // See if string contains formatting information
2183
  $richString = ( 0 !== ( $optionFlags & 0x08 ) );
2191
  // $extendedRunLength =$this->_GetInt4d( $this->data, $xpos );
2192
  $xpos += 4;
2193
  }
2194
+ $len = ( $asciiEncoding ) ? $numChars : $numChars * 2;
2195
  $retstr = substr( $data, $xpos, $len );
2196
  $xpos += $len;
2197
+ $retstr = ( $asciiEncoding ) ? $retstr : $this->_encodeUTF16( $retstr );
2198
+ } elseif ( SPREADSHEET_EXCEL_READER_BIFF7 === $version ) {
 
2199
  // Simple byte string
2200
  $xpos = $spos;
2201
  $numChars = ord( $data[ $xpos ] ) | ( ord( $data[ $xpos + 1 ] ) << 8 );
2213
  $rowHeight = $rowInfo & 0x7FFF;
2214
  }
2215
  $rowHidden = ( ord( $data[ $spos + 12 ] ) & 0x20 ) >> 5;
2216
+ $this->rowInfo[ $this->sn ][ $row + 1 ] = array(
2217
+ 'height' => $rowHeight / 20,
2218
+ 'hidden' => $rowHidden,
2219
+ );
2220
  break;
2221
  case SPREADSHEET_EXCEL_READER_TYPE_DBCELL:
2222
  break;
2274
  $this->defaultColWidth = ord( $data[ $spos + 4 ] ) | ord( $data[ $spos + 5 ] ) << 8;
2275
  break;
2276
  case SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH:
2277
+ $this->standardColWidth = ord( $data[ $spos + 4 ] ) | ord( $data[ $spos + 5 ] ) << 8;
2278
  break;
2279
  case SPREADSHEET_EXCEL_READER_TYPE_COLINFO:
2280
  $colfrom = ord( $data[ $spos + 0 ] ) | ord( $data[ $spos + 1 ] ) << 8;
2283
  $cxf = ord( $data[ $spos + 6 ] ) | ord( $data[ $spos + 7 ] ) << 8;
2284
  $co = ord( $data[ $spos + 8 ] );
2285
  for ( $coli = $colfrom; $coli <= $colto; $coli++ ) {
2286
+ $this->colInfo[ $this->sn ][ $coli + 1 ] = array(
2287
+ 'width' => $cw,
2288
+ 'xf' => $cxf,
2289
+ 'hidden' => ( $co & 0x01 ),
2290
+ 'collapsed' => ( $co & 0x1000 ) >> 12,
2291
+ );
2292
  }
2293
  break;
2294
  default:
2389
  }
2390
 
2391
  return array(
2392
+ 'string' => $string,
2393
+ 'raw' => $raw,
2394
+ 'rectype' => $rectype,
2395
+ 'format' => $format,
2396
  'formatIndex' => $formatIndex,
2397
+ 'fontIndex' => $fontIndex,
2398
  'formatColor' => $formatColor,
2399
+ 'xfIndex' => $xfindex,
2400
  );
2401
  }
2402
 
2416
  $mantissa = ( 0x100000 | ( $rknumhigh & 0x000fffff ) );
2417
  $mantissalow1 = ( $rknumlow & 0x80000000 ) >> 31;
2418
  $mantissalow2 = ( $rknumlow & 0x7fffffff );
2419
+ $value = $mantissa / pow( 2, ( 20 - ( $exp - 1023 ) ) );
2420
  if ( 0 !== $mantissalow1 ) {
2421
+ $value += 1 / pow( 2, ( 21 - ( $exp - 1023 ) ) );
2422
  }
2423
+ $value += $mantissalow2 / pow( 2, ( 52 - ( $exp - 1023 ) ) );
2424
  if ( $sign ) {
2425
  $value *= -1;
2426
  }
2469
  $sign = ( $rknum & 0x80000000 ) >> 31;
2470
  $exp = ( $rknum & 0x7ff00000 ) >> 20;
2471
  $mantissa = ( 0x100000 | ( $rknum & 0x000ffffc ) );
2472
+ $value = $mantissa / pow( 2, ( 20 - ( $exp - 1023 ) ) );
2473
  if ( $sign ) {
2474
  $value *= -1;
2475
  }
libraries/simplexlsx.class.php CHANGED
@@ -71,10 +71,10 @@ class SimpleXLSX {
71
  */
72
  protected $package = array(
73
  'filename' => '',
74
- 'mtime' => 0,
75
- 'size' => 0,
76
- 'comment' => '',
77
- 'entries' => array(),
78
  );
79
 
80
  /**
@@ -356,11 +356,11 @@ class SimpleXLSX {
356
  }
357
 
358
  $rows[ $current_row ][ $current_cell ] = array(
359
- 'type' => $t,
360
- 'name' => (string) $c['r'],
361
- 'value' => $this->value( $c, $format ),
362
- 'href' => $this->href( $c ),
363
- 'f' => (string) $c->f,
364
  'format' => $format,
365
  );
366
  }
@@ -371,12 +371,12 @@ class SimpleXLSX {
371
  }
372
 
373
  $rows[ $current_row ][ $i ] = array(
374
- 'type' => '',
375
  // 'name' => chr( $i + 65 ) . ( $current_row + 1 ),
376
- 'name' => $c . ( $current_row + 1 ),
377
- 'value' => '',
378
- 'href' => '',
379
- 'f' => '',
380
  'format' => '',
381
  );
382
  }
@@ -660,21 +660,23 @@ class SimpleXLSX {
660
  $aI['D'] = $vZ;
661
 
662
  // DOS to UNIX timestamp.
663
- $aI['T'] = mktime( ( $aP['FT'] & 0xf800 ) >> 11,
 
664
  ( $aP['FT'] & 0x07e0 ) >> 5,
665
  ( $aP['FT'] & 0x001f ) << 1,
666
  ( $aP['FD'] & 0x01e0 ) >> 5,
667
  ( $aP['FD'] & 0x001f ),
668
- ( ( $aP['FD'] & 0xfe00 ) >> 9 ) + 1980 );
 
669
 
670
  // $this->Entries[] = new SimpleUnzipEntry( $aI );
671
  $this->package['entries'][] = array(
672
- 'data' => $aI['D'],
673
- 'error' => $aI['E'],
674
  'error_msg' => $aI['EM'],
675
- 'name' => $aI['N'],
676
- 'path' => $aI['P'],
677
- 'time' => $aI['T'],
678
  );
679
 
680
  } // end foreach entries
71
  */
72
  protected $package = array(
73
  'filename' => '',
74
+ 'mtime' => 0,
75
+ 'size' => 0,
76
+ 'comment' => '',
77
+ 'entries' => array(),
78
  );
79
 
80
  /**
356
  }
357
 
358
  $rows[ $current_row ][ $current_cell ] = array(
359
+ 'type' => $t,
360
+ 'name' => (string) $c['r'],
361
+ 'value' => $this->value( $c, $format ),
362
+ 'href' => $this->href( $c ),
363
+ 'f' => (string) $c->f,
364
  'format' => $format,
365
  );
366
  }
371
  }
372
 
373
  $rows[ $current_row ][ $i ] = array(
374
+ 'type' => '',
375
  // 'name' => chr( $i + 65 ) . ( $current_row + 1 ),
376
+ 'name' => $c . ( $current_row + 1 ),
377
+ 'value' => '',
378
+ 'href' => '',
379
+ 'f' => '',
380
  'format' => '',
381
  );
382
  }
660
  $aI['D'] = $vZ;
661
 
662
  // DOS to UNIX timestamp.
663
+ $aI['T'] = mktime(
664
+ ( $aP['FT'] & 0xf800 ) >> 11,
665
  ( $aP['FT'] & 0x07e0 ) >> 5,
666
  ( $aP['FT'] & 0x001f ) << 1,
667
  ( $aP['FD'] & 0x01e0 ) >> 5,
668
  ( $aP['FD'] & 0x001f ),
669
+ ( ( $aP['FD'] & 0xfe00 ) >> 9 ) + 1980
670
+ );
671
 
672
  // $this->Entries[] = new SimpleUnzipEntry( $aI );
673
  $this->package['entries'][] = array(
674
+ 'data' => $aI['D'],
675
+ 'error' => $aI['E'],
676
  'error_msg' => $aI['EM'],
677
+ 'name' => $aI['N'],
678
+ 'path' => $aI['P'],
679
+ 'time' => $aI['T'],
680
  );
681
 
682
  } // end foreach entries
models/model-options.php CHANGED
@@ -28,17 +28,17 @@ class TablePress_Options_Model extends TablePress_Model {
28
  */
29
  protected $default_plugin_options = array(
30
  'plugin_options_db_version' => 0,
31
- 'table_scheme_db_version' => 0,
32
- 'prev_tablepress_version' => '0',
33
- 'tablepress_version' => TablePress::version,
34
- 'first_activation' => 0,
35
- 'message_plugin_update' => false,
36
- 'message_donation_nag' => true,
37
- 'use_custom_css' => true,
38
- 'use_custom_css_file' => true,
39
- 'custom_css' => '',
40
- 'custom_css_minified' => '',
41
- 'custom_css_version' => 0,
42
  );
43
 
44
  /**
@@ -49,8 +49,8 @@ class TablePress_Options_Model extends TablePress_Model {
49
  */
50
  protected $default_user_options = array(
51
  'user_options_db_version' => TablePress::db_version, // to prevent saving on first load
52
- 'admin_menu_parent_page' => 'middle',
53
- 'message_first_visit' => true,
54
  );
55
 
56
  /**
@@ -78,13 +78,13 @@ class TablePress_Options_Model extends TablePress_Model {
78
  parent::__construct();
79
 
80
  $params = array(
81
- 'option_name' => 'tablepress_plugin_options',
82
  'default_value' => $this->default_plugin_options,
83
  );
84
  $this->plugin_options = TablePress::load_class( 'TablePress_WP_Option', 'class-wp_option.php', 'classes', $params );
85
 
86
  $params = array(
87
- 'option_name' => 'tablepress_user_options',
88
  'default_value' => $this->default_user_options,
89
  );
90
  $this->user_options = TablePress::load_class( 'TablePress_WP_User_Option', 'class-wp_user_option.php', 'classes', $params );
28
  */
29
  protected $default_plugin_options = array(
30
  'plugin_options_db_version' => 0,
31
+ 'table_scheme_db_version' => 0,
32
+ 'prev_tablepress_version' => '0',
33
+ 'tablepress_version' => TablePress::version,
34
+ 'first_activation' => 0,
35
+ 'message_plugin_update' => false,
36
+ 'message_donation_nag' => true,
37
+ 'use_custom_css' => true,
38
+ 'use_custom_css_file' => true,
39
+ 'custom_css' => '',
40
+ 'custom_css_minified' => '',
41
+ 'custom_css_version' => 0,
42
  );
43
 
44
  /**
49
  */
50
  protected $default_user_options = array(
51
  'user_options_db_version' => TablePress::db_version, // to prevent saving on first load
52
+ 'admin_menu_parent_page' => 'middle',
53
+ 'message_first_visit' => true,
54
  );
55
 
56
  /**
78
  parent::__construct();
79
 
80
  $params = array(
81
+ 'option_name' => 'tablepress_plugin_options',
82
  'default_value' => $this->default_plugin_options,
83
  );
84
  $this->plugin_options = TablePress::load_class( 'TablePress_WP_Option', 'class-wp_option.php', 'classes', $params );
85
 
86
  $params = array(
87
+ 'option_name' => 'tablepress_user_options',
88
  'default_value' => $this->default_user_options,
89
  );
90
  $this->user_options = TablePress::load_class( 'TablePress_WP_User_Option', 'class-wp_user_option.php', 'classes', $params );
models/model-post.php CHANGED
@@ -53,17 +53,17 @@ class TablePress_Post_Model extends TablePress_Model {
53
  */
54
  $this->post_type = apply_filters( 'tablepress_post_type', $this->post_type );
55
  $post_type_args = array(
56
- 'labels' => array(
57
  'name' => 'TablePress Tables',
58
  ),
59
- 'public' => false,
60
- 'show_ui' => false,
61
- 'query_var' => false,
62
- 'rewrite' => false,
63
  'capability_type' => 'tablepress_table', // This ensures, that WP's regular CPT UI respects our capabilities.
64
- 'map_meta_cap' => false, // Integrated WP mapping does not fit our needs, therefore use our own in a filter.
65
- 'supports' => array( 'title', 'editor', 'excerpt', 'revisions' ),
66
- 'can_export' => true,
67
  );
68
  /**
69
  * Filter the arguments for the registration of the "Custom Post Type" that TablePress uses.
@@ -86,19 +86,19 @@ class TablePress_Post_Model extends TablePress_Model {
86
  */
87
  public function insert( array $post ) {
88
  $default_post = array(
89
- 'ID' => false, // false on new insert, but existing post ID on update
90
  'comment_status' => 'closed',
91
- 'ping_status' => 'closed',
92
- 'post_category' => false,
93
- 'post_content' => '',
94
- 'post_excerpt' => '',
95
- 'post_parent' => 0,
96
- 'post_password' => '',
97
- 'post_status' => 'publish',
98
- 'post_title' => '',
99
- 'post_type' => $this->post_type,
100
- 'tags_input' => '',
101
- 'to_ping' => '',
102
  );
103
  $post = array_merge( $default_post, $post );
104
  // WP expects everything to be slashed.
@@ -136,19 +136,19 @@ class TablePress_Post_Model extends TablePress_Model {
136
  */
137
  public function update( array $post ) {
138
  $default_post = array(
139
- 'ID' => false, // false on new insert, but existing post ID on update
140
  'comment_status' => 'closed',
141
- 'ping_status' => 'closed',
142
- 'post_category' => false,
143
- 'post_content' => '',
144
- 'post_excerpt' => '',
145
- 'post_parent' => 0,
146
- 'post_password' => '',
147
- 'post_status' => 'publish',
148
- 'post_title' => '',
149
- 'post_type' => $this->post_type,
150
- 'tags_input' => '',
151
- 'to_ping' => '',
152
  );
153
  $post = array_merge( $default_post, $post );
154
  // WP expects everything to be slashed.
53
  */
54
  $this->post_type = apply_filters( 'tablepress_post_type', $this->post_type );
55
  $post_type_args = array(
56
+ 'labels' => array(
57
  'name' => 'TablePress Tables',
58
  ),
59
+ 'public' => false,
60
+ 'show_ui' => false,
61
+ 'query_var' => false,
62
+ 'rewrite' => false,
63
  'capability_type' => 'tablepress_table', // This ensures, that WP's regular CPT UI respects our capabilities.
64
+ 'map_meta_cap' => false, // Integrated WP mapping does not fit our needs, therefore use our own in a filter.
65
+ 'supports' => array( 'title', 'editor', 'excerpt', 'revisions' ),
66
+ 'can_export' => true,
67
  );
68
  /**
69
  * Filter the arguments for the registration of the "Custom Post Type" that TablePress uses.
86
  */
87
  public function insert( array $post ) {
88
  $default_post = array(
89
+ 'ID' => false, // false on new insert, but existing post ID on update
90
  'comment_status' => 'closed',
91
+ 'ping_status' => 'closed',
92
+ 'post_category' => false,
93
+ 'post_content' => '',
94
+ 'post_excerpt' => '',
95
+ 'post_parent' => 0,
96
+ 'post_password' => '',
97
+ 'post_status' => 'publish',
98
+ 'post_title' => '',
99
+ 'post_type' => $this->post_type,
100
+ 'tags_input' => '',
101
+ 'to_ping' => '',
102
  );
103
  $post = array_merge( $default_post, $post );
104
  // WP expects everything to be slashed.
136
  */
137
  public function update( array $post ) {
138
  $default_post = array(
139
+ 'ID' => false, // false on new insert, but existing post ID on update
140
  'comment_status' => 'closed',
141
+ 'ping_status' => 'closed',
142
+ 'post_category' => false,
143
+ 'post_content' => '',
144
+ 'post_excerpt' => '',
145
+ 'post_parent' => 0,
146
+ 'post_password' => '',
147
+ 'post_status' => 'publish',
148
+ 'post_title' => '',
149
+ 'post_type' => $this->post_type,
150
+ 'tags_input' => '',
151
+ 'to_ping' => '',
152
  );
153
  $post = array_merge( $default_post, $post );
154
  // WP expects everything to be slashed.
models/model-table.php CHANGED
@@ -50,11 +50,11 @@ class TablePress_Table_Model extends TablePress_Model {
50
  * @since 1.0.0
51
  * @var array $args {
52
  * @type int $last_id Last table ID that was given to a new table.
53
- * @type array $table_post Connections between table ID and post ID (key: table ID, value: post ID).
54
- * }
55
  */
56
  protected $default_tables = array(
57
- 'last_id' => 0,
58
  'table_post' => array(),
59
  );
60
 
@@ -76,102 +76,102 @@ class TablePress_Table_Model extends TablePress_Model {
76
  * @var array
77
  * @link https://www.datatables.net/upgrade/1.10-convert
78
  */
79
- protected $datatables_parameter_mappings = array (
80
  'fnStateSaveParams' => 'stateSaveParams',
81
  'fnStateLoadParams' => 'stateLoadParams',
82
  'fnPreDrawCallback' => 'preDrawCallback',
83
- 'fnHeaderCallback' => 'headerCallback',
84
- 'fnFooterCallback' => 'footerCallback',
85
- 'sSortDescending' => 'sortDescending',
86
- 'sPaginationType' => 'pagingType',
87
- 'sLoadingRecords' => 'loadingRecords',
88
- 'sDefaultContent' => 'defaultContent',
89
- 'sContentPadding' => 'contentPadding',
90
- 'iCookieDuration' => 'stateDuration',
91
- 'bScrollCollapse' => 'scrollCollapse',
92
- 'asStripeClasses' => 'stripeClasses',
93
- 'sSortAscending' => 'sortAscending',
94
- 'sInfoThousands' => 'thousands',
95
- 'iDisplayLength' => 'pageLength',
96
- 'fnServerParams' => 'ajax',
97
- 'fnInitComplete' => 'initComplete',
98
- 'fnInfoCallback' => 'infoCallback',
99
- 'fnFormatNumber' => 'formatNumber',
100
- 'fnDrawCallback' => 'drawCallback',
101
- 'aaSortingFixed' => 'orderFixed',
102
- 'sSortDataType' => 'orderDataType',
103
- 'sServerMethod' => 'ajax',
104
- 'sScrollXInner' => 'scrollXInner',
105
- 'sInfoFiltered' => 'infoFiltered',
106
- 'sAjaxDataProp' => 'dataSrc',
107
- 'iDisplayStart' => 'displayStart',
108
- 'iDeferLoading' => 'deferLoading',
109
- 'fnStateLoaded' => 'stateLoaded',
110
- 'fnRowCallback' => 'rowCallback',
111
- 'fnCreatedCell' => 'createdCell',
112
- 'bSortCellsTop' => 'orderCellsTop',
113
- 'bLengthChange' => 'lengthChange',
114
- 'sZeroRecords' => 'zeroRecords',
115
- 'sInfoPostFix' => 'infoPostFix',
116
- 'fnServerData' => 'ajax',
117
- 'fnCreatedRow' => 'createdRow',
118
- 'bSortClasses' => 'orderClasses',
119
- 'bDeferRender' => 'deferRender',
120
- 'aoSearchCols' => 'searchCols',
121
- 'aoColumnDefs' => 'columnDefs',
122
- 'sProcessing' => 'processing',
123
- 'sLengthMenu' => 'lengthMenu',
124
- 'sEmptyTable' => 'emptyTable',
125
- 'sAjaxSource' => 'ajax',
126
- 'fnStateSave' => 'stateSaveCallback',
127
- 'fnStateLoad' => 'stateLoadCallback',
128
- 'bServerSide' => 'serverSide',
129
- 'bSearchable' => 'searchable',
130
- 'bProcessing' => 'processing',
131
- 'aLengthMenu' => 'lengthMenu',
132
- 'sInfoEmpty' => 'infoEmpty',
133
- 'bStateSave' => 'stateSave',
134
- 'bAutoWidth' => 'autoWidth',
135
- 'className' => 'className', // Replace "className" with itself, to avoid that the replacement for "sName" breaks it.
136
- 'sPrevious' => 'previous',
137
- 'sCellType' => 'cellType',
138
- 'oPaginate' => 'paginate',
139
- 'oLanguage' => 'language',
140
- 'iTabIndex' => 'tabIndex',
141
- 'iDataSort' => 'orderData',
142
- 'bSortable' => 'orderable',
143
- 'bRetrieve' => 'retrieve',
144
- 'bPaginate' => 'paging',
145
- 'bJQueryUI' => 'jQueryUI',
146
- 'asSorting' => 'orderSequence',
147
- 'aoColumns' => 'columns',
148
- 'aaSorting' => 'order',
149
- 'aDataSort' => 'orderData',
150
- 'sScrollY' => 'scrollY',
151
- 'sScrollX' => 'scrollX',
152
- 'bVisible' => 'visible',
153
- 'bDestroy' => 'destroy',
154
- 'aTargets' => 'targets',
155
- 'sSearch' => 'search',
156
- 'oSearch' => 'search',
157
- 'mRender' => 'render',
158
- 'bFilter' => 'searching',
159
- 'sWidth' => 'width',
160
- 'sTitle' => 'title',
161
- 'sFirst' => 'first',
162
- 'sClass' => 'className',
163
- 'aaData' => 'data',
164
- 'sType' => 'type',
165
- 'sNext' => 'next',
166
- 'sName' => 'name',
167
- 'sLast' => 'last',
168
- 'sInfo' => 'info',
169
- 'oAria' => 'aria',
170
- 'mData' => 'data',
171
- 'bSort' => 'ordering',
172
- 'bInfo' => 'info',
173
- 'sUrl' => 'url',
174
- 'sDom' => 'dom',
175
  );
176
 
177
  /**
@@ -184,7 +184,7 @@ class TablePress_Table_Model extends TablePress_Model {
184
  $this->model_post = TablePress::load_model( 'post' );
185
 
186
  $params = array(
187
- 'option_name' => 'tablepress_tables',
188
  'default_value' => $this->default_tables,
189
  );
190
  $this->tables = TablePress::load_class( 'TablePress_WP_Option', 'class-wp_option.php', 'classes', $params );
@@ -233,11 +233,11 @@ class TablePress_Table_Model extends TablePress_Model {
233
  }
234
 
235
  $post = array(
236
- 'ID' => $post_id,
237
- 'post_title' => $table['name'],
238
  // 'post_author' => $table['author'],
239
- 'post_excerpt' => $table['description'],
240
- 'post_content' => wp_json_encode( $table['data'] ),
241
  'post_mime_type' => 'application/json',
242
  );
243
 
@@ -256,10 +256,10 @@ class TablePress_Table_Model extends TablePress_Model {
256
  */
257
  protected function _post_to_table( $post, $table_id, $load_data ) {
258
  $table = array(
259
- 'id' => $table_id,
260
- 'name' => $post->post_title,
261
- 'description' => $post->post_excerpt,
262
- 'author' => $post->post_author,
263
  // 'created' => $post->post_date,
264
  'last_modified' => $post->post_modified,
265
  );
@@ -649,7 +649,10 @@ class TablePress_Table_Model extends TablePress_Model {
649
  }
650
 
651
  $count_db = $this->model_post->count_posts();
652
- return array( 'list' => $count_list, 'db' => $count_db );
 
 
 
653
  }
654
 
655
  /**
@@ -823,37 +826,37 @@ class TablePress_Table_Model extends TablePress_Model {
823
  public function get_table_template() {
824
  // Attention: Array keys have to be lowercase, to make it possible to match them with Shortcode attributes!
825
  $table = array(
826
- 'id' => false,
827
- 'name' => '',
828
- 'description' => '',
829
- 'data' => array( array( '' ) ), // one empty cell
830
  // 'created' => current_time( 'mysql' ),
831
  'last_modified' => current_time( 'mysql' ),
832
- 'author' => get_current_user_id(),
833
- 'options' => array(
834
- 'last_editor' => get_current_user_id(),
835
- 'table_head' => true,
836
- 'table_foot' => false,
837
- 'alternating_row_colors' => true,
838
- 'row_hover' => true,
839
- 'print_name' => false,
840
- 'print_name_position' => 'above',
841
- 'print_description' => false,
842
- 'print_description_position' => 'below',
843
- 'extra_css_classes' => '',
844
  // DataTables JavaScript library
845
- 'use_datatables' => true,
846
- 'datatables_sort' => true,
847
- 'datatables_filter' => true,
848
- 'datatables_paginate' => true,
849
- 'datatables_lengthchange' => true,
850
  'datatables_paginate_entries' => 10,
851
- 'datatables_info' => true,
852
- 'datatables_scrollx' => false,
853
- 'datatables_custom_commands' => '',
854
  ),
855
- 'visibility' => array(
856
- 'rows' => array( 1 ), // one visbile row
857
  'columns' => array( 1 ), // one visible column
858
  ),
859
  );
@@ -917,13 +920,13 @@ class TablePress_Table_Model extends TablePress_Model {
917
  $new_table['number']['columns'] = intval( $new_table['number']['columns'] );
918
  if ( 0 === $new_table['number']['rows']
919
  || 0 === $new_table['number']['columns']
920
- || $new_table['number']['rows'] !== count( $new_table['data'] )
921
- || $new_table['number']['columns'] !== count( $new_table['data'][0] ) ) {
922
  return new WP_Error( 'table_prepare_size_check_numbers_dont_match' );
923
  }
924
  // Visibility also needs to have correct dimensions.
925
- if ( $new_table['number']['rows'] !== count( $new_table['visibility']['rows'] )
926
- || $new_table['number']['columns'] !== count( $new_table['visibility']['columns'] ) ) {
927
  return new WP_Error( 'table_prepare_size_check_visibility_doesnt_match' );
928
  }
929
 
50
  * @since 1.0.0
51
  * @var array $args {
52
  * @type int $last_id Last table ID that was given to a new table.
53
+ * @type array $table_post Connections between table ID and post ID (key: table ID, value: post ID).
54
+ * }
55
  */
56
  protected $default_tables = array(
57
+ 'last_id' => 0,
58
  'table_post' => array(),
59
  );
60
 
76
  * @var array
77
  * @link https://www.datatables.net/upgrade/1.10-convert
78
  */
79
+ protected $datatables_parameter_mappings = array(
80
  'fnStateSaveParams' => 'stateSaveParams',
81
  'fnStateLoadParams' => 'stateLoadParams',
82
  'fnPreDrawCallback' => 'preDrawCallback',
83
+ 'fnHeaderCallback' => 'headerCallback',
84
+ 'fnFooterCallback' => 'footerCallback',
85
+ 'sSortDescending' => 'sortDescending',
86
+ 'sPaginationType' => 'pagingType',
87
+ 'sLoadingRecords' => 'loadingRecords',
88
+ 'sDefaultContent' => 'defaultContent',
89
+ 'sContentPadding' => 'contentPadding',
90
+ 'iCookieDuration' => 'stateDuration',
91
+ 'bScrollCollapse' => 'scrollCollapse',
92
+ 'asStripeClasses' => 'stripeClasses',
93
+ 'sSortAscending' => 'sortAscending',
94
+ 'sInfoThousands' => 'thousands',
95
+ 'iDisplayLength' => 'pageLength',
96
+ 'fnServerParams' => 'ajax',
97
+ 'fnInitComplete' => 'initComplete',
98
+ 'fnInfoCallback' => 'infoCallback',
99
+ 'fnFormatNumber' => 'formatNumber',
100
+ 'fnDrawCallback' => 'drawCallback',
101
+ 'aaSortingFixed' => 'orderFixed',
102
+ 'sSortDataType' => 'orderDataType',
103
+ 'sServerMethod' => 'ajax',
104
+ 'sScrollXInner' => 'scrollXInner',
105
+ 'sInfoFiltered' => 'infoFiltered',
106
+ 'sAjaxDataProp' => 'dataSrc',
107
+ 'iDisplayStart' => 'displayStart',
108
+ 'iDeferLoading' => 'deferLoading',
109
+ 'fnStateLoaded' => 'stateLoaded',
110
+ 'fnRowCallback' => 'rowCallback',
111
+ 'fnCreatedCell' => 'createdCell',
112
+ 'bSortCellsTop' => 'orderCellsTop',
113
+ 'bLengthChange' => 'lengthChange',
114
+ 'sZeroRecords' => 'zeroRecords',
115
+ 'sInfoPostFix' => 'infoPostFix',
116
+ 'fnServerData' => 'ajax',
117
+ 'fnCreatedRow' => 'createdRow',
118
+ 'bSortClasses' => 'orderClasses',
119
+ 'bDeferRender' => 'deferRender',
120
+ 'aoSearchCols' => 'searchCols',
121
+ 'aoColumnDefs' => 'columnDefs',
122
+ 'sProcessing' => 'processing',
123
+ 'sLengthMenu' => 'lengthMenu',
124
+ 'sEmptyTable' => 'emptyTable',
125
+ 'sAjaxSource' => 'ajax',
126
+ 'fnStateSave' => 'stateSaveCallback',
127
+ 'fnStateLoad' => 'stateLoadCallback',
128
+ 'bServerSide' => 'serverSide',
129
+ 'bSearchable' => 'searchable',
130
+ 'bProcessing' => 'processing',
131
+ 'aLengthMenu' => 'lengthMenu',
132
+ 'sInfoEmpty' => 'infoEmpty',
133
+ 'bStateSave' => 'stateSave',
134
+ 'bAutoWidth' => 'autoWidth',
135
+ 'className' => 'className', // Replace "className" with itself, to avoid that the replacement for "sName" breaks it.
136
+ 'sPrevious' => 'previous',
137
+ 'sCellType' => 'cellType',
138
+ 'oPaginate' => 'paginate',
139
+ 'oLanguage' => 'language',
140
+ 'iTabIndex' => 'tabIndex',
141
+ 'iDataSort' => 'orderData',
142
+ 'bSortable' => 'orderable',
143
+ 'bRetrieve' => 'retrieve',
144
+ 'bPaginate' => 'paging',
145
+ 'bJQueryUI' => 'jQueryUI',
146
+ 'asSorting' => 'orderSequence',
147
+ 'aoColumns' => 'columns',
148
+ 'aaSorting' => 'order',
149
+ 'aDataSort' => 'orderData',
150
+ 'sScrollY' => 'scrollY',
151
+ 'sScrollX' => 'scrollX',
152
+ 'bVisible' => 'visible',
153
+ 'bDestroy' => 'destroy',
154
+ 'aTargets' => 'targets',
155
+ 'sSearch' => 'search',
156
+ 'oSearch' => 'search',
157
+ 'mRender' => 'render',
158
+ 'bFilter' => 'searching',
159
+ 'sWidth' => 'width',
160
+ 'sTitle' => 'title',
161
+ 'sFirst' => 'first',
162
+ 'sClass' => 'className',
163
+ 'aaData' => 'data',
164
+ 'sType' => 'type',
165
+ 'sNext' => 'next',
166
+ 'sName' => 'name',
167
+ 'sLast' => 'last',
168
+ 'sInfo' => 'info',
169
+ 'oAria' => 'aria',
170
+ 'mData' => 'data',
171
+ 'bSort' => 'ordering',
172
+ 'bInfo' => 'info',
173
+ 'sUrl' => 'url',
174
+ 'sDom' => 'dom',
175
  );
176
 
177
  /**
184
  $this->model_post = TablePress::load_model( 'post' );
185
 
186
  $params = array(
187
+ 'option_name' => 'tablepress_tables',
188
  'default_value' => $this->default_tables,
189
  );
190
  $this->tables = TablePress::load_class( 'TablePress_WP_Option', 'class-wp_option.php', 'classes', $params );
233
  }
234
 
235
  $post = array(
236
+ 'ID' => $post_id,
237
+ 'post_title' => $table['name'],
238
  // 'post_author' => $table['author'],
239
+ 'post_excerpt' => $table['description'],
240
+ 'post_content' => wp_json_encode( $table['data'] ),
241
  'post_mime_type' => 'application/json',
242
  );
243
 
256
  */
257
  protected function _post_to_table( $post, $table_id, $load_data ) {
258
  $table = array(
259
+ 'id' => $table_id,
260
+ 'name' => $post->post_title,
261
+ 'description' => $post->post_excerpt,
262
+ 'author' => $post->post_author,
263
  // 'created' => $post->post_date,
264
  'last_modified' => $post->post_modified,
265
  );
649
  }
650
 
651
  $count_db = $this->model_post->count_posts();
652
+ return array(
653
+ 'list' => $count_list,
654
+ 'db' => $count_db,
655
+ );
656
  }
657
 
658
  /**
826
  public function get_table_template() {
827
  // Attention: Array keys have to be lowercase, to make it possible to match them with Shortcode attributes!
828
  $table = array(
829
+ 'id' => false,
830
+ 'name' => '',
831
+ 'description' => '',
832
+ 'data' => array( array( '' ) ), // one empty cell
833
  // 'created' => current_time( 'mysql' ),
834
  'last_modified' => current_time( 'mysql' ),
835
+ 'author' => get_current_user_id(),
836
+ 'options' => array(
837
+ 'last_editor' => get_current_user_id(),
838
+ 'table_head' => true,
839
+ 'table_foot' => false,
840
+ 'alternating_row_colors' => true,
841
+ 'row_hover' => true,
842
+ 'print_name' => false,
843
+ 'print_name_position' => 'above',
844
+ 'print_description' => false,
845
+ 'print_description_position' => 'below',
846
+ 'extra_css_classes' => '',
847
  // DataTables JavaScript library
848
+ 'use_datatables' => true,
849
+ 'datatables_sort' => true,
850
+ 'datatables_filter' => true,
851
+ 'datatables_paginate' => true,
852
+ 'datatables_lengthchange' => true,
853
  'datatables_paginate_entries' => 10,
854
+ 'datatables_info' => true,
855
+ 'datatables_scrollx' => false,
856
+ 'datatables_custom_commands' => '',
857
  ),
858
+ 'visibility' => array(
859
+ 'rows' => array( 1 ), // one visbile row
860
  'columns' => array( 1 ), // one visible column
861
  ),
862
  );
920
  $new_table['number']['columns'] = intval( $new_table['number']['columns'] );
921
  if ( 0 === $new_table['number']['rows']
922
  || 0 === $new_table['number']['columns']
923
+ || count( $new_table['data'] ) !== $new_table['number']['rows']
924
+ || count( $new_table['data'][0] ) !== $new_table['number']['columns'] ) {
925
  return new WP_Error( 'table_prepare_size_check_numbers_dont_match' );
926
  }
927
  // Visibility also needs to have correct dimensions.
928
+ if ( count( $new_table['visibility']['rows'] ) !== $new_table['number']['rows']
929
+ || count( $new_table['visibility']['columns'] ) !== $new_table['number']['columns'] ) {
930
  return new WP_Error( 'table_prepare_size_check_visibility_doesnt_match' );
931
  }
932
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: TobiasBg
3
  Donate link: https://tablepress.org/donate/
4
  Tags: table,data,html,csv,excel
5
- Requires at least: 4.7
6
- Tested up to: 4.9
7
- Stable tag: 1.8.1
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -18,7 +18,7 @@ TablePress allows you to easily create and manage beautiful tables. You can embe
18
  Please visit the plugin website at https://tablepress.org/ for more information or a [demo](https://tablepress.org/demo/)).
19
 
20
  = Supporting future development =
21
- If you like TablePress, please rate and review it here in the WordPress Plugin Directory, support it with your [donation](https://tablepress.org/donate/), or [flattr it](https://flattr.com/thing/783658/TablePress). Thank you!
22
 
23
  = TablePress Extensions =
24
  Additional features and useful enhancements are available as separate plugins, called [TablePress Extensions](https://tablepress.org/extensions/), on the plugin website.
@@ -53,10 +53,10 @@ Manual installation works just as for other WordPress plugins:
53
  Many questions, regarding different features or styling, have been answered on the [FAQ page](https://tablepress.org/faq/) on the plugin website.
54
 
55
  = Support? =
56
- For support questions, bug reports, or feature requests, please use the [WordPress Support Forums](https://wordpress.org/support/plugin/tablepress). Please [search](https://wordpress.org/support/) through the forums first, and only [open a new thread](https://wordpress.org/support/plugin/tablepress) if you don't find an existing answer. Thank you!
57
 
58
  = Requirements? =
59
- In short: WordPress 4.7 or higher, while the latest version of WordPress is always recommended.
60
 
61
  = Languages and Localization? =
62
  TablePress supports the ["Translate WordPress" platform](https://translate.wordpress.org/). With that, translating is possible on a website from which so-called Language Packs are automatically generated and shipped to plugin users. For a list of existing Language Packs, please see the sidebar on the TablePress page in the [WordPress Plugin Directory](https://wordpress.org/plugins/tablepress/).
@@ -99,6 +99,17 @@ You may use it free of charge for any purpose.
99
 
100
  == Changelog ==
101
 
 
 
 
 
 
 
 
 
 
 
 
102
  = Version 1.8.1 =
103
  * Enhancement: Make HTML import more robust and faster.
104
  * Enhancement: The HTML import can now import merged cells in a row.
@@ -245,6 +256,9 @@ Initial version where most features are ready and pretty stable.
245
 
246
  == Upgrade Notice ==
247
 
 
 
 
248
  = 1.8.1 =
249
  This update is a stability, security, and maintenance release. Updating is highly recommended.
250
 
2
  Contributors: TobiasBg
3
  Donate link: https://tablepress.org/donate/
4
  Tags: table,data,html,csv,excel
5
+ Requires at least: 4.9.1
6
+ Tested up to: 4.9.1
7
+ Stable tag: 1.9
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
18
  Please visit the plugin website at https://tablepress.org/ for more information or a [demo](https://tablepress.org/demo/)).
19
 
20
  = Supporting future development =
21
+ If you like TablePress, please rate and review it here in the WordPress Plugin Directory or support it with your [donation](https://tablepress.org/donate/). Thank you!
22
 
23
  = TablePress Extensions =
24
  Additional features and useful enhancements are available as separate plugins, called [TablePress Extensions](https://tablepress.org/extensions/), on the plugin website.
53
  Many questions, regarding different features or styling, have been answered on the [FAQ page](https://tablepress.org/faq/) on the plugin website.
54
 
55
  = Support? =
56
+ For support questions, bug reports, or feature requests, please use the [WordPress Support Forums](https://wordpress.org/support/plugin/tablepress). Please search through the forums first, and only [create a new topic](https://wordpress.org/support/plugin/tablepress#new-post) if you don't find an existing answer. Thank you!
57
 
58
  = Requirements? =
59
+ In short: WordPress 4.9.1 or higher, while the latest version of WordPress is always recommended.
60
 
61
  = Languages and Localization? =
62
  TablePress supports the ["Translate WordPress" platform](https://translate.wordpress.org/). With that, translating is possible on a website from which so-called Language Packs are automatically generated and shipped to plugin users. For a list of existing Language Packs, please see the sidebar on the TablePress page in the [WordPress Plugin Directory](https://wordpress.org/plugins/tablepress/).
99
 
100
  == Changelog ==
101
 
102
+ = Version 1.9 =
103
+ * Full compatibility with WordPress 4.9
104
+ * Feature: The "Custom CSS" text field highlights and notifies about CSS code syntax errors.
105
+ * Enhancement: Update list of allowed CSS properties in "Custom CSS".
106
+ * Enhancement: Make the CSV import more robust against malformed input.
107
+ * Bugfix: The integration into the WordPress search was broken since a WordPress core change.
108
+ * Bugfix: The HTML import was broken on certain server configurations.
109
+ * Updated external libraries (Build tools).
110
+ * Some internal changes and fixes for better stability, cleaner code, translations, and documentation.
111
+ * TablePress 1.9 requires WordPress 4.9.1!
112
+
113
  = Version 1.8.1 =
114
  * Enhancement: Make HTML import more robust and faster.
115
  * Enhancement: The HTML import can now import merged cells in a row.
256
 
257
  == Upgrade Notice ==
258
 
259
+ = 1.9 =
260
+ This update includes several new features, enhancements, and bugfixes. Updating is recommended.
261
+
262
  = 1.8.1 =
263
  This update is a stability, security, and maintenance release. Updating is highly recommended.
264
 
tablepress.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * @package TablePress
6
  * @author Tobias Bäthge
7
- * @version 1.8.1
8
  */
9
 
10
  /*
11
  Plugin Name: TablePress
12
  Plugin URI: https://tablepress.org/
13
  Description: Embed beautiful and feature-rich tables into your posts and pages, without having to write code.
14
- Version: 1.8.1
15
  Author: Tobias Bäthge
16
  Author URI: https://tobias.baethge.com/
17
  Author email: wordpress@tobias.baethge.com
4
  *
5
  * @package TablePress
6
  * @author Tobias Bäthge
7
+ * @version 1.9
8
  */
9
 
10
  /*
11
  Plugin Name: TablePress
12
  Plugin URI: https://tablepress.org/
13
  Description: Embed beautiful and feature-rich tables into your posts and pages, without having to write code.
14
+ Version: 1.9
15
  Author: Tobias Bäthge
16
  Author URI: https://tobias.baethge.com/
17
  Author email: wordpress@tobias.baethge.com
views/view-about.php CHANGED
@@ -149,7 +149,7 @@ class TablePress_About_View extends TablePress_View {
149
  public function postbox_help_support( array $data, array $box ) {
150
  ?>
151
  <p>
152
- <?php printf( __( '<a href="%s">Support</a> is provided through the <a href="%s">WordPress Support Forums</a>.', 'tablepress' ), 'https://tablepress.org/support/', 'https://wordpress.org/support/plugin/tablepress' ); ?>
153
  <?php printf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a>, where you will find answers to the most common questions, and search through the forums.', 'tablepress' ), 'https://tablepress.org/faq/' ); ?>
154
  </p>
155
  <p>
149
  public function postbox_help_support( array $data, array $box ) {
150
  ?>
151
  <p>
152
+ <?php printf( __( '<a href="%1$s">Support</a> is provided through the <a href="%2$s">WordPress Support Forums</a>.', 'tablepress' ), 'https://tablepress.org/support/', 'https://wordpress.org/support/plugin/tablepress' ); ?>
153
  <?php printf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a>, where you will find answers to the most common questions, and search through the forums.', 'tablepress' ), 'https://tablepress.org/faq/' ); ?>
154
  </p>
155
  <p>
views/view-edit.php CHANGED
@@ -45,19 +45,19 @@ class TablePress_Edit_View extends TablePress_View {
45
  };
46
 
47
  $action_messages = array(
48
- 'success_save' => __( 'The table was saved successfully.', 'tablepress' ),
49
- 'success_add' => __( 'The table was added successfully.', 'tablepress' ),
50
- 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ' ' . sprintf( __( 'You are now seeing the copied table, which has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table']['id'] ) ),
51
- 'success_import' => __( 'The table was imported successfully.', 'tablepress' ),
52
  'success_import_wp_table_reloaded' => __( 'The table was imported successfully from WP-Table Reloaded.', 'tablepress' ),
53
- 'error_save' => __( 'Error: The table could not be saved.', 'tablepress' ),
54
- 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
55
- 'success_save_success_id_change' => __( 'The table was saved successfully, and the table ID was changed.', 'tablepress' ),
56
- 'success_save_error_id_change' => __( 'The table was saved successfully, but the table ID could not be changed!', 'tablepress' ),
57
  );
58
  // Custom handling instead of $this->process_action_messages(). Also, $action_messages is used below.
59
  if ( $data['message'] && isset( $action_messages[ $data['message'] ] ) ) {
60
- $class = ( 'error' === substr( $data['message'], 0, 5 ) || in_array( $data['message'], array( 'success_save_error_id_change' ), true ) ) ? 'notice-error' : 'notice-success' ;
61
  $this->add_header_message( "<strong>{$action_messages[ $data['message'] ]}</strong>", $class );
62
  }
63
 
@@ -85,7 +85,7 @@ class TablePress_Edit_View extends TablePress_View {
85
  *
86
  * @param bool $print Whether debug output shall be printed.
87
  */
88
- 'print_debug_output' => apply_filters( 'tablepress_print_debug_output', isset( $_GET['debug'] ) ? ( 'true' === $_GET['debug'] ) : WP_DEBUG ),
89
  /**
90
  * Filter whether the "Advanced Editor" button shall be enabled.
91
  *
@@ -101,51 +101,51 @@ class TablePress_Edit_View extends TablePress_View {
101
  *
102
  * @param bool $auto_grow Whether the size of the cell textareas shall increase. Default true.
103
  */
104
- 'cells_auto_grow' => apply_filters( 'tablepress_edit_cells_auto_grow', true ),
105
- 'shortcode' => esc_js( TablePress::$shortcode ),
106
  ),
107
  'strings' => array_merge( array(
108
- 'no_remove_all_rows' => __( 'You can not delete all table rows!', 'tablepress' ),
109
- 'no_remove_all_columns' => __( 'You can not delete all table columns!', 'tablepress' ),
110
- 'no_rows_selected' => __( 'You did not select any rows!', 'tablepress' ),
111
- 'no_columns_selected' => __( 'You did not select any columns!', 'tablepress' ),
112
- 'append_num_rows_invalid' => __( 'The value for the number of rows is invalid!', 'tablepress' ),
113
- 'append_num_columns_invalid' => __( 'The value for the number of columns is invalid!', 'tablepress' ),
114
- 'ays_remove_rows_singular' => _n( 'Do you really want to delete the selected row?', 'Do you really want to delete the selected rows?', 1, 'tablepress' ),
115
- 'ays_remove_rows_plural' => _n( 'Do you really want to delete the selected row?', 'Do you really want to delete the selected rows?', 2, 'tablepress' ),
116
- 'ays_remove_columns_singular' => _n( 'Do you really want to delete the selected column?', 'Do you really want to delete the selected columns?', 1, 'tablepress' ),
117
- 'ays_remove_columns_plural' => _n( 'Do you really want to delete the selected column?', 'Do you really want to delete the selected columns?', 2, 'tablepress' ),
118
- 'advanced_editor_open' => __( 'Please click into the cell that you want to edit using the &#8220;Advanced Editor&#8221;.', 'tablepress' ),
119
- 'rowspan_add' => __( 'To combine cells within a column, click into the cell below the cell that has the content the combined cells shall have.', 'tablepress' ),
120
- 'colspan_add' => __( 'To combine cells within a row, click into the cell to the right of the cell that has the content the combined cells shall have.', 'tablepress' ),
121
- 'span_add_datatables_warning' => __( 'Attention: You have enabled the usage of the DataTables JavaScript library for features like sorting, search, or pagination.', 'tablepress' ) . "\n" .
122
  __( 'Unfortunately, these can not be used in tables with combined cells.', 'tablepress' ) . "\n" .
123
  __( 'Do you want to proceed and automatically turn off the usage of DataTables for this table?', 'tablepress' ),
124
- 'link_add' => __( 'Please click into the cell that you want to add a link to.', 'tablepress' ) . "\n" .
125
  __( 'You can then enter the Link URL and Text or choose an existing page or post.', 'tablepress' ),
126
- 'image_add' => __( 'Please click into the cell that you want to add an image to.', 'tablepress' ) . "\n" .
127
  __( 'The Media Library will open, where you can select or upload the desired image or enter the image URL.', 'tablepress' ) . "\n" .
128
  sprintf( __( 'Click the &#8220;%s&#8221; button to insert the image.', 'tablepress' ), __( 'Insert into Table', 'tablepress' ) ),
129
- 'unsaved_changes_unload' => __( 'The changes to this table were not saved yet and will be lost if you navigate away from this page.', 'tablepress' ),
130
- 'preparing_preview' => __( 'The Table Preview is being loaded...', 'tablepress' ),
131
- 'preview_error' => __( 'The Table Preview could not be loaded.', 'tablepress' ),
132
- 'save_changes_success' => __( 'Saving successful', 'tablepress' ),
133
- 'save_changes_error' => __( 'Saving failed', 'tablepress' ),
134
- 'saving_changes' => __( 'Changes are being saved...', 'tablepress' ),
135
- 'table_id_not_empty' => __( 'The Table ID field can not be empty. Please enter a Table ID!', 'tablepress' ),
136
- 'table_id_not_zero' => __( 'The Table ID &#8220;0&#8221; is not supported. Please enter a different Table ID!', 'tablepress' ),
137
- 'ays_change_table_id' => __( 'Do you really want to change the Table ID? All Shortcodes for this table in your pages and posts will have to be adjusted!', 'tablepress' ),
138
- 'extra_css_classes_invalid' => __( 'The entered value in the field &#8220;Extra CSS classes&#8221; is invalid.', 'tablepress' ),
139
  'num_pagination_entries_invalid' => __( 'The entered value in the field &#8220;Pagination Entries&#8221; is not a number.', 'tablepress' ),
140
- 'sort_asc' => __( 'Sort ascending', 'tablepress' ),
141
- 'sort_desc' => __( 'Sort descending', 'tablepress' ),
142
- 'no_rowspan_first_row' => __( 'You can not add rowspan to the first row!', 'tablepress' ),
143
- 'no_colspan_first_col' => __( 'You can not add colspan to the first column!', 'tablepress' ),
144
- 'no_rowspan_table_head' => __( 'You can not connect cells into the table head row!', 'tablepress' ),
145
- 'no_rowspan_table_foot' => __( 'You can not connect cells out of the table foot row!', 'tablepress' ),
146
  ),
147
  // Merge this to have messages available for AJAX after save dialog.
148
- $action_messages ),
149
  ) );
150
 
151
  $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
@@ -193,7 +193,8 @@ class TablePress_Edit_View extends TablePress_View {
193
  */
194
  protected function action_nonce_field( array $data, array $box ) {
195
  // use custom nonce field here, that includes the table ID
196
- wp_nonce_field( TablePress::nonce( $this->action, $data['table']['id'] ), 'nonce-edit-table' ); echo "\n";
 
197
  wp_nonce_field( TablePress::nonce( 'preview_table', $data['table']['id'] ), 'nonce-preview-table', false, true );
198
  }
199
 
@@ -282,7 +283,7 @@ class TablePress_Edit_View extends TablePress_View {
282
  $column_class = ' column-hidden';
283
  }
284
  $column = TablePress::number_to_letter( $col_idx + 1 );
285
- echo "\t\t\t<th class=\"head{$column_class}\"><span class=\"sort-control sort-desc hide-if-no-js\" title=\"" . esc_attr__( 'Sort descending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"sort-control sort-asc hide-if-no-js\" title=\"" . esc_attr__( 'Sort ascending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"move-handle\">{$column}</span></th>\n";
286
  }
287
  ?>
288
  <th></th>
@@ -361,7 +362,7 @@ class TablePress_Edit_View extends TablePress_View {
361
  <tr class="bottom-border">
362
  <td class="column-1">
363
  <input type="button" class="button" id="link-add" value="<?php esc_attr_e( 'Insert Link', 'tablepress' ); ?>" />
364
- <input type="button" class="button" id="image-add" value="<?php esc_attr_e( 'Insert Image', 'tablepress' ); ?>" />
365
  <input type="button" class="button" id="advanced-editor-open" value="<?php esc_attr_e( 'Advanced Editor', 'tablepress' ); ?>" />
366
  </td>
367
  <td class="column-2">
@@ -369,7 +370,8 @@ class TablePress_Edit_View extends TablePress_View {
369
  <input type="button" class="button" id="span-add-rowspan" value="<?php esc_attr_e( 'in a column (rowspan)', 'tablepress' ); ?>" />
370
  <input type="button" class="button" id="span-add-colspan" value="<?php esc_attr_e( 'in a row (colspan)', 'tablepress' ); ?>" />
371
  <input type="button" class="button show-help-box" value="<?php esc_attr_e( '?', 'tablepress' ); ?>" title="<?php esc_attr_e( 'Help on combining cells', 'tablepress' ); ?>" />
372
- <div class="hidden-container hidden-help-box-container"><?php
 
373
  echo '<p>' . __( 'Table cells can span across more than one column or row.', 'tablepress' ) . '</p>';
374
  echo '<p>' . __( 'Combining consecutive cells within the same row is called &#8220;colspanning&#8221;.', 'tablepress' )
375
  . ' ' . __( 'Combining consecutive cells within the same column is called &#8220;rowspanning&#8221;.', 'tablepress' ) . '</p>';
@@ -377,7 +379,8 @@ class TablePress_Edit_View extends TablePress_View {
377
  . ' ' . __( 'To combine adjacent cells in a column, add the keyword <code>#rowspan#</code> to the cell below the one with the content for the combined cell by using the corresponding button.', 'tablepress' ) . '</p>';
378
  echo '<p>' . __( 'Repeat this to add the keyword to all cells that shall be connected.', 'tablepress' ) . '</p>';
379
  echo '<p><strong>' . __( 'Be aware that the functions of the DataTables JavaScript library will not work on tables which have combined cells.', 'tablepress' ) . '</strong></p>';
380
- ?></div>
 
381
  </td>
382
  </tr>
383
  <tr class="top-border">
@@ -487,8 +490,8 @@ class TablePress_Edit_View extends TablePress_View {
487
  <?php
488
  $wp_editor_options = array(
489
  'textarea_rows' => 10,
490
- 'tinymce' => false,
491
- 'quicktags' => array(
492
  'buttons' => 'strong,em,link,del,ins,img,code,spell,close',
493
  ),
494
  );
45
  };
46
 
47
  $action_messages = array(
48
+ 'success_save' => __( 'The table was saved successfully.', 'tablepress' ),
49
+ 'success_add' => __( 'The table was added successfully.', 'tablepress' ),
50
+ 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ' ' . sprintf( __( 'You are now seeing the copied table, which has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table']['id'] ) ),
51
+ 'success_import' => __( 'The table was imported successfully.', 'tablepress' ),
52
  'success_import_wp_table_reloaded' => __( 'The table was imported successfully from WP-Table Reloaded.', 'tablepress' ),
53
+ 'error_save' => __( 'Error: The table could not be saved.', 'tablepress' ),
54
+ 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
55
+ 'success_save_success_id_change' => __( 'The table was saved successfully, and the table ID was changed.', 'tablepress' ),
56
+ 'success_save_error_id_change' => __( 'The table was saved successfully, but the table ID could not be changed!', 'tablepress' ),
57
  );
58
  // Custom handling instead of $this->process_action_messages(). Also, $action_messages is used below.
59
  if ( $data['message'] && isset( $action_messages[ $data['message'] ] ) ) {
60
+ $class = ( 'error' === substr( $data['message'], 0, 5 ) || in_array( $data['message'], array( 'success_save_error_id_change' ), true ) ) ? 'notice-error' : 'notice-success';
61
  $this->add_header_message( "<strong>{$action_messages[ $data['message'] ]}</strong>", $class );
62
  }
63
 
85
  *
86
  * @param bool $print Whether debug output shall be printed.
87
  */
88
+ 'print_debug_output' => apply_filters( 'tablepress_print_debug_output', isset( $_GET['debug'] ) ? ( 'true' === $_GET['debug'] ) : WP_DEBUG ),
89
  /**
90
  * Filter whether the "Advanced Editor" button shall be enabled.
91
  *
101
  *
102
  * @param bool $auto_grow Whether the size of the cell textareas shall increase. Default true.
103
  */
104
+ 'cells_auto_grow' => apply_filters( 'tablepress_edit_cells_auto_grow', true ),
105
+ 'shortcode' => esc_js( TablePress::$shortcode ),
106
  ),
107
  'strings' => array_merge( array(
108
+ 'no_remove_all_rows' => __( 'You can not delete all table rows!', 'tablepress' ),
109
+ 'no_remove_all_columns' => __( 'You can not delete all table columns!', 'tablepress' ),
110
+ 'no_rows_selected' => __( 'You did not select any rows!', 'tablepress' ),
111
+ 'no_columns_selected' => __( 'You did not select any columns!', 'tablepress' ),
112
+ 'append_num_rows_invalid' => __( 'The value for the number of rows is invalid!', 'tablepress' ),
113
+ 'append_num_columns_invalid' => __( 'The value for the number of columns is invalid!', 'tablepress' ),
114
+ 'ays_remove_rows_singular' => _n( 'Do you really want to delete the selected row?', 'Do you really want to delete the selected rows?', 1, 'tablepress' ),
115
+ 'ays_remove_rows_plural' => _n( 'Do you really want to delete the selected row?', 'Do you really want to delete the selected rows?', 2, 'tablepress' ),
116
+ 'ays_remove_columns_singular' => _n( 'Do you really want to delete the selected column?', 'Do you really want to delete the selected columns?', 1, 'tablepress' ),
117
+ 'ays_remove_columns_plural' => _n( 'Do you really want to delete the selected column?', 'Do you really want to delete the selected columns?', 2, 'tablepress' ),
118
+ 'advanced_editor_open' => __( 'Please click into the cell that you want to edit using the &#8220;Advanced Editor&#8221;.', 'tablepress' ),
119
+ 'rowspan_add' => __( 'To combine cells within a column, click into the cell below the cell that has the content the combined cells shall have.', 'tablepress' ),
120
+ 'colspan_add' => __( 'To combine cells within a row, click into the cell to the right of the cell that has the content the combined cells shall have.', 'tablepress' ),
121
+ 'span_add_datatables_warning' => __( 'Attention: You have enabled the usage of the DataTables JavaScript library for features like sorting, search, or pagination.', 'tablepress' ) . "\n" .
122
  __( 'Unfortunately, these can not be used in tables with combined cells.', 'tablepress' ) . "\n" .
123
  __( 'Do you want to proceed and automatically turn off the usage of DataTables for this table?', 'tablepress' ),
124
+ 'link_add' => __( 'Please click into the cell that you want to add a link to.', 'tablepress' ) . "\n" .
125
  __( 'You can then enter the Link URL and Text or choose an existing page or post.', 'tablepress' ),
126
+ 'image_add' => __( 'Please click into the cell that you want to add an image to.', 'tablepress' ) . "\n" .
127
  __( 'The Media Library will open, where you can select or upload the desired image or enter the image URL.', 'tablepress' ) . "\n" .
128
  sprintf( __( 'Click the &#8220;%s&#8221; button to insert the image.', 'tablepress' ), __( 'Insert into Table', 'tablepress' ) ),
129
+ 'unsaved_changes_unload' => __( 'The changes to this table were not saved yet and will be lost if you navigate away from this page.', 'tablepress' ),
130
+ 'preparing_preview' => __( 'The Table Preview is being loaded...', 'tablepress' ),
131
+ 'preview_error' => __( 'The Table Preview could not be loaded.', 'tablepress' ),
132
+ 'save_changes_success' => __( 'Saving successful', 'tablepress' ),
133
+ 'save_changes_error' => __( 'Saving failed', 'tablepress' ),
134
+ 'saving_changes' => __( 'Changes are being saved...', 'tablepress' ),
135
+ 'table_id_not_empty' => __( 'The Table ID field can not be empty. Please enter a Table ID!', 'tablepress' ),
136
+ 'table_id_not_zero' => __( 'The Table ID &#8220;0&#8221; is not supported. Please enter a different Table ID!', 'tablepress' ),
137
+ 'ays_change_table_id' => __( 'Do you really want to change the Table ID? All Shortcodes for this table in your pages and posts will have to be adjusted!', 'tablepress' ),
138
+ 'extra_css_classes_invalid' => __( 'The entered value in the field &#8220;Extra CSS classes&#8221; is invalid.', 'tablepress' ),
139
  'num_pagination_entries_invalid' => __( 'The entered value in the field &#8220;Pagination Entries&#8221; is not a number.', 'tablepress' ),
140
+ 'sort_asc' => __( 'Sort ascending', 'tablepress' ),
141
+ 'sort_desc' => __( 'Sort descending', 'tablepress' ),
142
+ 'no_rowspan_first_row' => __( 'You can not add rowspan to the first row!', 'tablepress' ),
143
+ 'no_colspan_first_col' => __( 'You can not add colspan to the first column!', 'tablepress' ),
144
+ 'no_rowspan_table_head' => __( 'You can not connect cells into the table head row!', 'tablepress' ),
145
+ 'no_rowspan_table_foot' => __( 'You can not connect cells out of the table foot row!', 'tablepress' ),
146
  ),
147
  // Merge this to have messages available for AJAX after save dialog.
148
+ $action_messages )
149
  ) );
150
 
151
  $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
193
  */
194
  protected function action_nonce_field( array $data, array $box ) {
195
  // use custom nonce field here, that includes the table ID
196
+ wp_nonce_field( TablePress::nonce( $this->action, $data['table']['id'] ), 'nonce-edit-table' );
197
+ echo "\n";
198
  wp_nonce_field( TablePress::nonce( 'preview_table', $data['table']['id'] ), 'nonce-preview-table', false, true );
199
  }
200
 
283
  $column_class = ' column-hidden';
284
  }
285
  $column = TablePress::number_to_letter( $col_idx + 1 );
286
+ echo "\t\t\t<th class=\"head{$column_class}\"><span class=\"sort-control sort-desc hide-if-no-js\" title=\"" . esc_attr__( 'Sort descending', 'tablepress' ) . '"><span class="sorting-indicator"></span></span><span class="sort-control sort-asc hide-if-no-js" title="' . esc_attr__( 'Sort ascending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"move-handle\">{$column}</span></th>\n";
287
  }
288
  ?>
289
  <th></th>
362
  <tr class="bottom-border">
363
  <td class="column-1">
364
  <input type="button" class="button" id="link-add" value="<?php esc_attr_e( 'Insert Link', 'tablepress' ); ?>" />
365
+ <input type="button" class="button" id="image-add" value="<?php esc_attr_e( 'Insert Image', 'tablepress' ); ?>" />
366
  <input type="button" class="button" id="advanced-editor-open" value="<?php esc_attr_e( 'Advanced Editor', 'tablepress' ); ?>" />
367
  </td>
368
  <td class="column-2">
370
  <input type="button" class="button" id="span-add-rowspan" value="<?php esc_attr_e( 'in a column (rowspan)', 'tablepress' ); ?>" />
371
  <input type="button" class="button" id="span-add-colspan" value="<?php esc_attr_e( 'in a row (colspan)', 'tablepress' ); ?>" />
372
  <input type="button" class="button show-help-box" value="<?php esc_attr_e( '?', 'tablepress' ); ?>" title="<?php esc_attr_e( 'Help on combining cells', 'tablepress' ); ?>" />
373
+ <div class="hidden-container hidden-help-box-container">
374
+ <?php
375
  echo '<p>' . __( 'Table cells can span across more than one column or row.', 'tablepress' ) . '</p>';
376
  echo '<p>' . __( 'Combining consecutive cells within the same row is called &#8220;colspanning&#8221;.', 'tablepress' )
377
  . ' ' . __( 'Combining consecutive cells within the same column is called &#8220;rowspanning&#8221;.', 'tablepress' ) . '</p>';
379
  . ' ' . __( 'To combine adjacent cells in a column, add the keyword <code>#rowspan#</code> to the cell below the one with the content for the combined cell by using the corresponding button.', 'tablepress' ) . '</p>';
380
  echo '<p>' . __( 'Repeat this to add the keyword to all cells that shall be connected.', 'tablepress' ) . '</p>';
381
  echo '<p><strong>' . __( 'Be aware that the functions of the DataTables JavaScript library will not work on tables which have combined cells.', 'tablepress' ) . '</strong></p>';
382
+ ?>
383
+ </div>
384
  </td>
385
  </tr>
386
  <tr class="top-border">
490
  <?php
491
  $wp_editor_options = array(
492
  'textarea_rows' => 10,
493
+ 'tinymce' => false,
494
+ 'quicktags' => array(
495
  'buttons' => 'strong,em,link,del,ins,img,code,spell,close',
496
  ),
497
  );
views/view-editor_button_thickbox.php CHANGED
@@ -185,8 +185,10 @@ body.rtl {
185
  ?>
186
  <form method="get" action="">
187
  <input type="hidden" name="action" value="tablepress_<?php echo $this->action; ?>" />
188
- <?php wp_nonce_field( TablePress::nonce( $this->action ), '_wpnonce', false ); echo "\n"; ?>
189
- <?php $this->wp_list_table->search_box( __( 'Search Tables', 'tablepress' ), 'tables_search' ); ?>
 
 
190
  </form>
191
  <?php $this->wp_list_table->display(); ?>
192
  </div>
@@ -236,10 +238,10 @@ class TablePress_Editor_Button_Thickbox_List_Table extends WP_List_Table {
236
  */
237
  public function __construct() {
238
  parent::__construct( array(
239
- 'singular' => 'tablepress-table', // Singular name of the listed records.
240
- 'plural' => 'tablepress-editor-button-list', // Plural name of the listed records.
241
- 'ajax' => false, // Does this list table support AJAX?
242
- 'screen' => get_current_screen(), // WP_Screen object.
243
  ) );
244
  }
245
 
@@ -279,10 +281,10 @@ class TablePress_Editor_Button_Thickbox_List_Table extends WP_List_Table {
279
  public function get_columns() {
280
  $columns = array(
281
  // "name" is special in WP, which is why we prefix every entry here, to be safe!
282
- 'table_id' => __( 'ID', 'tablepress' ),
283
- 'table_name' => __( 'Table Name', 'tablepress' ),
284
  'table_description' => __( 'Description', 'tablepress' ),
285
- 'table_action' => __( 'Action', 'tablepress' ),
286
  );
287
  return $columns;
288
  }
@@ -303,8 +305,8 @@ class TablePress_Editor_Button_Thickbox_List_Table extends WP_List_Table {
303
  }
304
 
305
  $sortable_columns = array(
306
- 'table_id' => array( 'id', true ), // true means its already sorted
307
- 'table_name' => array( 'name', false ),
308
  'table_description' => array( 'description', false ),
309
  );
310
  return $sortable_columns;
@@ -495,7 +497,7 @@ class TablePress_Editor_Button_Thickbox_List_Table extends WP_List_Table {
495
 
496
  // Maybe sort the items.
497
  $_sortable_columns = $this->get_sortable_columns();
498
- if ( $orderby && ! empty( $this->items ) && isset( $_sortable_columns["table_{$orderby}"] ) ) {
499
  usort( $this->items, array( $this, '_order_callback' ) );
500
  }
501
 
@@ -512,7 +514,7 @@ class TablePress_Editor_Button_Thickbox_List_Table extends WP_List_Table {
512
  // Register pagination options and calculation results.
513
  $this->set_pagination_args( array(
514
  'total_items' => $total_items, // Total number of records/items
515
- 'per_page' => $per_page, // Number of items per page
516
  'total_pages' => ceil( $total_items / $per_page ), // Total number of pages
517
  ) );
518
  }
185
  ?>
186
  <form method="get" action="">
187
  <input type="hidden" name="action" value="tablepress_<?php echo $this->action; ?>" />
188
+ <?php
189
+ wp_nonce_field( TablePress::nonce( $this->action ), '_wpnonce', false );
190
+ $this->wp_list_table->search_box( __( 'Search Tables', 'tablepress' ), 'tables_search' );
191
+ ?>
192
  </form>
193
  <?php $this->wp_list_table->display(); ?>
194
  </div>
238
  */
239
  public function __construct() {
240
  parent::__construct( array(
241
+ 'singular' => 'tablepress-table', // Singular name of the listed records.
242
+ 'plural' => 'tablepress-editor-button-list', // Plural name of the listed records.
243
+ 'ajax' => false, // Does this list table support AJAX?
244
+ 'screen' => get_current_screen(), // WP_Screen object.
245
  ) );
246
  }
247
 
281
  public function get_columns() {
282
  $columns = array(
283
  // "name" is special in WP, which is why we prefix every entry here, to be safe!
284
+ 'table_id' => __( 'ID', 'tablepress' ),
285
+ 'table_name' => __( 'Table Name', 'tablepress' ),
286
  'table_description' => __( 'Description', 'tablepress' ),
287
+ 'table_action' => __( 'Action', 'tablepress' ),
288
  );
289
  return $columns;
290
  }
305
  }
306
 
307
  $sortable_columns = array(
308
+ 'table_id' => array( 'id', true ), // true means its already sorted
309
+ 'table_name' => array( 'name', false ),
310
  'table_description' => array( 'description', false ),
311
  );
312
  return $sortable_columns;
497
 
498
  // Maybe sort the items.
499
  $_sortable_columns = $this->get_sortable_columns();
500
+ if ( $orderby && ! empty( $this->items ) && isset( $_sortable_columns[ "table_{$orderby}" ] ) ) {
501
  usort( $this->items, array( $this, '_order_callback' ) );
502
  }
503
 
514
  // Register pagination options and calculation results.
515
  $this->set_pagination_args( array(
516
  'total_items' => $total_items, // Total number of records/items
517
+ 'per_page' => $per_page, // Number of items per page
518
  'total_pages' => ceil( $total_items / $per_page ), // Total number of pages
519
  ) );
520
  }
views/view-export.php CHANGED
@@ -32,8 +32,8 @@ class TablePress_Export_View extends TablePress_View {
32
  parent::setup( $action, $data );
33
 
34
  $this->process_action_messages( array(
35
- 'error_export' => __( 'Error: The export failed.', 'tablepress' ),
36
- 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ),
37
  'error_table_corrupted' => __( 'Error: The internal data of this table is corrupted!', 'tablepress' ),
38
  'error_create_zip_file' => __( 'Error: The ZIP file could not be created.', 'tablepress' ),
39
  ) );
@@ -86,7 +86,7 @@ class TablePress_Export_View extends TablePress_View {
86
  $import_url = TablePress::url( array( 'action' => 'import' ) );
87
  ?>
88
  <p><?php _e( 'No tables found.', 'tablepress' ); ?></p>
89
- <p><?php printf( __( 'You should <a href="%s">add</a> or <a href="%s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url ); ?></p>
90
  <?php
91
  }
92
 
@@ -106,9 +106,9 @@ class TablePress_Export_View extends TablePress_View {
106
  <th class="column-1 top-align" scope="row">
107
  <label for="tables-export"><?php _e( 'Tables to Export', 'tablepress' ); ?>:</label>
108
  <?php
109
- if ( $data['zip_support_available'] ) {
110
- echo '<br /><br /><label for="tables-export-select-all"><input type="checkbox" id="tables-export-select-all"> ' . __( 'Select all', 'tablepress' ) . '</label>';
111
- }
112
  ?>
113
  </th>
114
  <td class="column-2">
@@ -121,25 +121,25 @@ class TablePress_Export_View extends TablePress_View {
121
  ?>
122
  <select id="tables-export" name="export[tables][]"<?php echo $size_multiple; ?>>
123
  <?php
124
- foreach ( $data['table_ids'] as $table_id ) {
125
- // Load table, without table data, options, and visibility settings.
126
- $table = TablePress::$model_table->load( $table_id, false, false );
127
- if ( ! current_user_can( 'tablepress_export_table', $table['id'] ) ) {
128
- continue;
129
- }
130
- if ( '' === trim( $table['name'] ) ) {
131
- $table['name'] = __( '(no name)', 'tablepress' );
132
- }
133
- $text = esc_html( sprintf( __( 'ID %1$s: %2$s', 'tablepress' ), $table['id'], $table['name'] ) );
134
- $selected = selected( true, in_array( $table['id'], $data['export_ids'], true ), false );
135
- echo "<option{$selected} value=\"{$table['id']}\">{$text}</option>";
136
  }
 
 
 
 
137
  ?>
138
  </select>
139
  <?php
140
- if ( $data['zip_support_available'] ) {
141
- echo '<br /><span class="description">' . __( 'You can select multiple tables by holding down the &#8220;Ctrl&#8221; key (Windows) or the &#8220;Command&#8221; key (Mac).', 'tablepress' ) . '</span>';
142
- }
143
  ?>
144
  </td>
145
  </tr>
@@ -148,10 +148,10 @@ class TablePress_Export_View extends TablePress_View {
148
  <td class="column-2">
149
  <select id="tables-export-format" name="export[format]">
150
  <?php
151
- foreach ( $data['export_formats'] as $format => $name ) {
152
- $selected = selected( $format, $data['export_format'], false );
153
- echo "<option{$selected} value=\"{$format}\">{$name}</option>";
154
- }
155
  ?>
156
  </select>
157
  </td>
@@ -161,10 +161,10 @@ class TablePress_Export_View extends TablePress_View {
161
  <td class="column-2">
162
  <select id="tables-export-csv-delimiter" name="export[csv_delimiter]">
163
  <?php
164
- foreach ( $data['csv_delimiters'] as $delimiter => $name ) {
165
- $selected = selected( $delimiter, $data['csv_delimiter'], false );
166
- echo "<option{$selected} value=\"{$delimiter}\">{$name}</option>";
167
- }
168
  ?>
169
  </select> <span id="tables-export-csv-delimiter-description" class="description hide-if-js"><?php _e( '(Only needed for CSV export.)', 'tablepress' ); ?></span>
170
  </td>
@@ -173,14 +173,14 @@ class TablePress_Export_View extends TablePress_View {
173
  <th class="column-1" scope="row"><?php _e( 'ZIP file', 'tablepress' ); ?>:</th>
174
  <td class="column-2">
175
  <?php
176
- if ( $data['zip_support_available'] ) {
177
  ?>
178
- <input type="checkbox" id="tables-export-zip-file" name="export[zip_file]" value="true" />
179
- <label for="tables-export-zip-file"><?php _e( 'Create a ZIP archive.', 'tablepress' ); ?> <span id="tables-export-zip-file-description" class="description hide-if-js"><?php _e( '(Mandatory if more than one table is selected.)', 'tablepress' ); ?></span></label>
180
  <?php
181
- } else {
182
- _e( 'Note: Support for ZIP file creation seems not to be available on this server.', 'tablepress' );
183
- }
184
  ?>
185
  </td>
186
  </tr>
32
  parent::setup( $action, $data );
33
 
34
  $this->process_action_messages( array(
35
+ 'error_export' => __( 'Error: The export failed.', 'tablepress' ),
36
+ 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ),
37
  'error_table_corrupted' => __( 'Error: The internal data of this table is corrupted!', 'tablepress' ),
38
  'error_create_zip_file' => __( 'Error: The ZIP file could not be created.', 'tablepress' ),
39
  ) );
86
  $import_url = TablePress::url( array( 'action' => 'import' ) );
87
  ?>
88
  <p><?php _e( 'No tables found.', 'tablepress' ); ?></p>
89
+ <p><?php printf( __( 'You should <a href="%1$s">add</a> or <a href="%2$s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url ); ?></p>
90
  <?php
91
  }
92
 
106
  <th class="column-1 top-align" scope="row">
107
  <label for="tables-export"><?php _e( 'Tables to Export', 'tablepress' ); ?>:</label>
108
  <?php
109
+ if ( $data['zip_support_available'] ) {
110
+ echo '<br /><br /><label for="tables-export-select-all"><input type="checkbox" id="tables-export-select-all"> ' . __( 'Select all', 'tablepress' ) . '</label>';
111
+ }
112
  ?>
113
  </th>
114
  <td class="column-2">
121
  ?>
122
  <select id="tables-export" name="export[tables][]"<?php echo $size_multiple; ?>>
123
  <?php
124
+ foreach ( $data['table_ids'] as $table_id ) {
125
+ // Load table, without table data, options, and visibility settings.
126
+ $table = TablePress::$model_table->load( $table_id, false, false );
127
+ if ( ! current_user_can( 'tablepress_export_table', $table['id'] ) ) {
128
+ continue;
129
+ }
130
+ if ( '' === trim( $table['name'] ) ) {
131
+ $table['name'] = __( '(no name)', 'tablepress' );
 
 
 
 
132
  }
133
+ $text = esc_html( sprintf( __( 'ID %1$s: %2$s', 'tablepress' ), $table['id'], $table['name'] ) );
134
+ $selected = selected( true, in_array( $table['id'], $data['export_ids'], true ), false );
135
+ echo "<option{$selected} value=\"{$table['id']}\">{$text}</option>";
136
+ }
137
  ?>
138
  </select>
139
  <?php
140
+ if ( $data['zip_support_available'] ) {
141
+ echo '<br /><span class="description">' . __( 'You can select multiple tables by holding down the &#8220;Ctrl&#8221; key (Windows) or the &#8220;Command&#8221; key (Mac).', 'tablepress' ) . '</span>';
142
+ }
143
  ?>
144
  </td>
145
  </tr>
148
  <td class="column-2">
149
  <select id="tables-export-format" name="export[format]">
150
  <?php
151
+ foreach ( $data['export_formats'] as $format => $name ) {
152
+ $selected = selected( $format, $data['export_format'], false );
153
+ echo "<option{$selected} value=\"{$format}\">{$name}</option>";
154
+ }
155
  ?>
156
  </select>
157
  </td>
161
  <td class="column-2">
162
  <select id="tables-export-csv-delimiter" name="export[csv_delimiter]">
163
  <?php
164
+ foreach ( $data['csv_delimiters'] as $delimiter => $name ) {
165
+ $selected = selected( $delimiter, $data['csv_delimiter'], false );
166
+ echo "<option{$selected} value=\"{$delimiter}\">{$name}</option>";
167
+ }
168
  ?>
169
  </select> <span id="tables-export-csv-delimiter-description" class="description hide-if-js"><?php _e( '(Only needed for CSV export.)', 'tablepress' ); ?></span>
170
  </td>
173
  <th class="column-1" scope="row"><?php _e( 'ZIP file', 'tablepress' ); ?>:</th>
174
  <td class="column-2">
175
  <?php
176
+ if ( $data['zip_support_available'] ) {
177
  ?>
178
+ <input type="checkbox" id="tables-export-zip-file" name="export[zip_file]" value="true" />
179
+ <label for="tables-export-zip-file"><?php _e( 'Create a ZIP archive.', 'tablepress' ); ?> <span id="tables-export-zip-file-description" class="description hide-if-js"><?php _e( '(Mandatory if more than one table is selected.)', 'tablepress' ); ?></span></label>
180
  <?php
181
+ } else {
182
+ _e( 'Note: Support for ZIP file creation seems not to be available on this server.', 'tablepress' );
183
+ }
184
  ?>
185
  </td>
186
  </tr>
views/view-import.php CHANGED
@@ -46,17 +46,17 @@ class TablePress_Import_View extends TablePress_View {
46
  ) );
47
 
48
  $this->process_action_messages( array(
49
- 'error_import' => __( 'Error: The import failed.', 'tablepress' ),
50
- 'error_no_zip_import' => __( 'Error: Import of ZIP files is not available on this server.', 'tablepress' ),
51
- 'error_import_zip_open' => __( 'Error: The ZIP file could not be opened.', 'tablepress' ),
52
- 'error_import_zip_content' => __( 'Error: The data in the ZIP file is invalid.', 'tablepress' ),
53
- 'error_import_no_existing_id' => __( 'Error: You selected to replace or append to an existing table, but did not select a table.', 'tablepress' ),
54
- 'error_import_source_invalid' => __( 'Error: The source for the import is invalid or could not be accessed.', 'tablepress' ),
55
- 'error_import_data' => __( 'Error: The data for the import is invalid.', 'tablepress' ),
56
  'error_wp_table_reloaded_nothing_selected' => __( 'Error: You did not select what to import from WP-Table Reloaded!', 'tablepress' ),
57
- 'error_wp_table_reloaded_not_installed' => __( 'Error: Existing WP-Table Reloaded tables were not found in the database.', 'tablepress' ),
58
- 'error_import_wp_table_reloaded' => __( 'Error: The tables from WP-Table Reloaded could not be imported.', 'tablepress' ),
59
- 'error_wp_table_reloaded_dump_file' => __( 'Error: The WP-Table Reloaded Dump File could not be imported!', 'tablepress' ),
60
  ) );
61
 
62
  $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
@@ -78,7 +78,7 @@ class TablePress_Import_View extends TablePress_View {
78
  return $hidden;
79
  }
80
  if ( ! $this->data['wp_table_reloaded_installed'] ) {
81
- $hidden[] = 'tablepress_import-import-wp-table-reloaded' ;
82
  }
83
  return $hidden;
84
  }
@@ -100,10 +100,10 @@ class TablePress_Import_View extends TablePress_View {
100
  <p>
101
  <?php
102
  _e( 'To import a table, select and enter the import source in the following form.', 'tablepress' );
103
- if ( 0 < $data['tables_count'] ) {
104
- echo ' ';
105
- _e( 'You can also choose to import it as a new table, to replace an existing table, or to append the rows to an existing table.', 'tablepress' );
106
- }
107
 
108
  ?>
109
  </p>
@@ -127,7 +127,9 @@ class TablePress_Import_View extends TablePress_View {
127
  <td class="column-2">
128
  <label for="tables-import-source-file-upload"><input name="import[source]" id="tables-import-source-file-upload" type="radio" value="file-upload"<?php checked( $data['import_source'], 'file-upload', true ); ?> /> <?php _e( 'File Upload', 'tablepress' ); ?></label>
129
  <label for="tables-import-source-url"><input name="import[source]" id="tables-import-source-url" type="radio" value="url"<?php checked( $data['import_source'], 'url', true ); ?> /> <?php _e( 'URL', 'tablepress' ); ?></label>
 
130
  <label for="tables-import-source-server"><input name="import[source]" id="tables-import-source-server" type="radio" value="server"<?php checked( $data['import_source'], 'server', true ); ?> /> <?php _e( 'File on server', 'tablepress' ); ?></label>
 
131
  <label for="tables-import-source-form-field"><input name="import[source]" id="tables-import-source-form-field" type="radio" value="form-field"<?php checked( $data['import_source'], 'form-field', true ); ?> /> <?php _e( 'Manual Input', 'tablepress' ); ?></label>
132
  </td>
133
  </tr>
@@ -136,9 +138,9 @@ class TablePress_Import_View extends TablePress_View {
136
  <td class="column-2">
137
  <input name="import_file_upload" id="tables-import-file-upload" type="file" class="large-text" style="box-sizing: border-box;" />
138
  <?php
139
- if ( $data['zip_support_available'] ) {
140
- echo '<br /><span class="description">' . __( 'You can import multiple tables by placing them in a ZIP file.', 'tablepress' ) . '</span>';
141
- }
142
  ?>
143
  </td>
144
  </tr>
@@ -147,23 +149,25 @@ class TablePress_Import_View extends TablePress_View {
147
  <td class="column-2">
148
  <input type="text" name="import[url]" id="tables-import-url" class="large-text" value="<?php echo esc_attr( $data['import_url'] ); ?>" />
149
  <?php
150
- if ( $data['zip_support_available'] ) {
151
- echo '<br /><span class="description">' . __( 'You can import multiple tables by placing them in a ZIP file.', 'tablepress' ) . '</span>';
152
- }
153
  ?>
154
  </td>
155
  </tr>
 
156
  <tr id="row-import-source-server" class="bottom-border">
157
  <th class="column-1 top-align" scope="row"><label for="tables-import-server"><?php _e( 'Server Path to file', 'tablepress' ); ?>:</label></th>
158
  <td class="column-2">
159
  <input type="text" name="import[server]" id="tables-import-server" class="large-text" value="<?php echo esc_attr( $data['import_server'] ); ?>" />
160
  <?php
161
- if ( $data['zip_support_available'] ) {
162
- echo '<br /><span class="description">' . __( 'You can import multiple tables by placing them in a ZIP file.', 'tablepress' ) . '</span>';
163
- }
164
  ?>
165
  </td>
166
  </tr>
 
167
  <tr id="row-import-source-form-field" class="bottom-border">
168
  <th class="column-1 top-align" scope="row"><label for="tables-import-form-field"><?php _e( 'Import data', 'tablepress' ); ?>:</label></th>
169
  <td class="column-2">
@@ -175,16 +179,16 @@ class TablePress_Import_View extends TablePress_View {
175
  <td class="column-2">
176
  <select id="tables-import-format" name="import[format]">
177
  <?php
178
- foreach ( $data['import_formats'] as $format => $name ) {
179
- $selected = selected( $format, $data['import_format'], false );
180
- echo "<option{$selected} value=\"{$format}\">{$name}</option>";
181
- }
182
  ?>
183
  </select>
184
  <?php
185
- if ( ! $data['html_import_support_available'] ) {
186
- echo '<br /><span class="description">' . __( 'Import of HTML files is not available on your server.', 'tablepress' ) . '</span>';
187
- }
188
  ?>
189
  </td>
190
  </tr>
@@ -202,18 +206,18 @@ class TablePress_Import_View extends TablePress_View {
202
  <select id="tables-import-existing-table" name="import[existing_table]"<?php disabled( $data['tables_count'] > 0, false, true ); ?>>
203
  <option value=""><?php _e( '&mdash; Select &mdash;', 'tablepress' ); ?></option>
204
  <?php
205
- foreach ( $data['table_ids'] as $table_id ) {
206
- $table = TablePress::$model_table->load( $table_id, false, false ); // Load table, without table data, options, and visibility settings
207
- if ( ! current_user_can( 'tablepress_edit_table', $table['id'] ) ) {
208
- continue;
209
- }
210
- if ( '' === trim( $table['name'] ) ) {
211
- $table['name'] = __( '(no name)', 'tablepress' );
212
- }
213
- $text = esc_html( sprintf( __( 'ID %1$s: %2$s', 'tablepress' ), $table['id'], $table['name'] ) );
214
- $selected = selected( $table['id'], $data['import_existing_table'], false );
215
- echo "<option{$selected} value=\"{$table['id']}\">{$text}</option>";
216
  }
 
 
 
 
217
  ?>
218
  </select>
219
  </td>
@@ -250,7 +254,10 @@ class TablePress_Import_View extends TablePress_View {
250
  <tr id="row-import-wp-table-reloaded-source">
251
  <th class="column-1" scope="row"><?php _e( 'Import Source', 'tablepress' ); ?>:</th>
252
  <td class="column-2">
253
- <label for="import-wp-table-reloaded-source-db"><input name="import[wp_table_reloaded][source]" id="import-wp-table-reloaded-source-db" type="radio" value="db"<?php checked( $data['import_wp_table_reloaded_source'], 'db', true ); disabled( $data['wp_table_reloaded_installed'], false, true ); ?> /> <?php _e( 'WordPress database', 'tablepress' ); ?></label>
 
 
 
254
  <label for="import-wp-table-reloaded-source-dump-file"><input name="import[wp_table_reloaded][source]" id="import-wp-table-reloaded-source-dump-file" type="radio" value="dump-file"<?php checked( $data['import_wp_table_reloaded_source'], 'dump-file', true ); ?> /> <?php _e( 'WP-Table Reloaded Dump File', 'tablepress' ); ?></label>
255
  </td>
256
  </tr>
46
  ) );
47
 
48
  $this->process_action_messages( array(
49
+ 'error_import' => __( 'Error: The import failed.', 'tablepress' ),
50
+ 'error_no_zip_import' => __( 'Error: Import of ZIP files is not available on this server.', 'tablepress' ),
51
+ 'error_import_zip_open' => __( 'Error: The ZIP file could not be opened.', 'tablepress' ),
52
+ 'error_import_zip_content' => __( 'Error: The data in the ZIP file is invalid.', 'tablepress' ),
53
+ 'error_import_no_existing_id' => __( 'Error: You selected to replace or append to an existing table, but did not select a table.', 'tablepress' ),
54
+ 'error_import_source_invalid' => __( 'Error: The source for the import is invalid or could not be accessed.', 'tablepress' ),
55
+ 'error_import_data' => __( 'Error: The data for the import is invalid.', 'tablepress' ),
56
  'error_wp_table_reloaded_nothing_selected' => __( 'Error: You did not select what to import from WP-Table Reloaded!', 'tablepress' ),
57
+ 'error_wp_table_reloaded_not_installed' => __( 'Error: Existing WP-Table Reloaded tables were not found in the database.', 'tablepress' ),
58
+ 'error_import_wp_table_reloaded' => __( 'Error: The tables from WP-Table Reloaded could not be imported.', 'tablepress' ),
59
+ 'error_wp_table_reloaded_dump_file' => __( 'Error: The WP-Table Reloaded Dump File could not be imported!', 'tablepress' ),
60
  ) );
61
 
62
  $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
78
  return $hidden;
79
  }
80
  if ( ! $this->data['wp_table_reloaded_installed'] ) {
81
+ $hidden[] = 'tablepress_import-import-wp-table-reloaded';
82
  }
83
  return $hidden;
84
  }
100
  <p>
101
  <?php
102
  _e( 'To import a table, select and enter the import source in the following form.', 'tablepress' );
103
+ if ( 0 < $data['tables_count'] ) {
104
+ echo ' ';
105
+ _e( 'You can also choose to import it as a new table, to replace an existing table, or to append the rows to an existing table.', 'tablepress' );
106
+ }
107
 
108
  ?>
109
  </p>
127
  <td class="column-2">
128
  <label for="tables-import-source-file-upload"><input name="import[source]" id="tables-import-source-file-upload" type="radio" value="file-upload"<?php checked( $data['import_source'], 'file-upload', true ); ?> /> <?php _e( 'File Upload', 'tablepress' ); ?></label>
129
  <label for="tables-import-source-url"><input name="import[source]" id="tables-import-source-url" type="radio" value="url"<?php checked( $data['import_source'], 'url', true ); ?> /> <?php _e( 'URL', 'tablepress' ); ?></label>
130
+ <?php if ( ( ! is_multisite() && current_user_can( 'manage_options' ) ) || is_super_admin() ) { ?>
131
  <label for="tables-import-source-server"><input name="import[source]" id="tables-import-source-server" type="radio" value="server"<?php checked( $data['import_source'], 'server', true ); ?> /> <?php _e( 'File on server', 'tablepress' ); ?></label>
132
+ <?php } ?>
133
  <label for="tables-import-source-form-field"><input name="import[source]" id="tables-import-source-form-field" type="radio" value="form-field"<?php checked( $data['import_source'], 'form-field', true ); ?> /> <?php _e( 'Manual Input', 'tablepress' ); ?></label>
134
  </td>
135
  </tr>
138
  <td class="column-2">
139
  <input name="import_file_upload" id="tables-import-file-upload" type="file" class="large-text" style="box-sizing: border-box;" />
140
  <?php
141
+ if ( $data['zip_support_available'] ) {
142
+ echo '<br /><span class="description">' . __( 'You can import multiple tables by placing them in a ZIP file.', 'tablepress' ) . '</span>';
143
+ }
144
  ?>
145
  </td>
146
  </tr>
149
  <td class="column-2">
150
  <input type="text" name="import[url]" id="tables-import-url" class="large-text" value="<?php echo esc_attr( $data['import_url'] ); ?>" />
151
  <?php
152
+ if ( $data['zip_support_available'] ) {
153
+ echo '<br /><span class="description">' . __( 'You can import multiple tables by placing them in a ZIP file.', 'tablepress' ) . '</span>';
154
+ }
155
  ?>
156
  </td>
157
  </tr>
158
+ <?php if ( ( ! is_multisite() && current_user_can( 'manage_options' ) ) || is_super_admin() ) { ?>
159
  <tr id="row-import-source-server" class="bottom-border">
160
  <th class="column-1 top-align" scope="row"><label for="tables-import-server"><?php _e( 'Server Path to file', 'tablepress' ); ?>:</label></th>
161
  <td class="column-2">
162
  <input type="text" name="import[server]" id="tables-import-server" class="large-text" value="<?php echo esc_attr( $data['import_server'] ); ?>" />
163
  <?php
164
+ if ( $data['zip_support_available'] ) {
165
+ echo '<br /><span class="description">' . __( 'You can import multiple tables by placing them in a ZIP file.', 'tablepress' ) . '</span>';
166
+ }
167
  ?>
168
  </td>
169
  </tr>
170
+ <?php } ?>
171
  <tr id="row-import-source-form-field" class="bottom-border">
172
  <th class="column-1 top-align" scope="row"><label for="tables-import-form-field"><?php _e( 'Import data', 'tablepress' ); ?>:</label></th>
173
  <td class="column-2">
179
  <td class="column-2">
180
  <select id="tables-import-format" name="import[format]">
181
  <?php
182
+ foreach ( $data['import_formats'] as $format => $name ) {
183
+ $selected = selected( $format, $data['import_format'], false );
184
+ echo "<option{$selected} value=\"{$format}\">{$name}</option>";
185
+ }
186
  ?>
187
  </select>
188
  <?php
189
+ if ( ! $data['html_import_support_available'] ) {
190
+ echo '<br /><span class="description">' . __( 'Import of HTML files is not available on your server.', 'tablepress' ) . '</span>';
191
+ }
192
  ?>
193
  </td>
194
  </tr>
206
  <select id="tables-import-existing-table" name="import[existing_table]"<?php disabled( $data['tables_count'] > 0, false, true ); ?>>
207
  <option value=""><?php _e( '&mdash; Select &mdash;', 'tablepress' ); ?></option>
208
  <?php
209
+ foreach ( $data['table_ids'] as $table_id ) {
210
+ $table = TablePress::$model_table->load( $table_id, false, false ); // Load table, without table data, options, and visibility settings
211
+ if ( ! current_user_can( 'tablepress_edit_table', $table['id'] ) ) {
212
+ continue;
213
+ }
214
+ if ( '' === trim( $table['name'] ) ) {
215
+ $table['name'] = __( '(no name)', 'tablepress' );
 
 
 
 
216
  }
217
+ $text = esc_html( sprintf( __( 'ID %1$s: %2$s', 'tablepress' ), $table['id'], $table['name'] ) );
218
+ $selected = selected( $table['id'], $data['import_existing_table'], false );
219
+ echo "<option{$selected} value=\"{$table['id']}\">{$text}</option>";
220
+ }
221
  ?>
222
  </select>
223
  </td>
254
  <tr id="row-import-wp-table-reloaded-source">
255
  <th class="column-1" scope="row"><?php _e( 'Import Source', 'tablepress' ); ?>:</th>
256
  <td class="column-2">
257
+ <label for="import-wp-table-reloaded-source-db"><input name="import[wp_table_reloaded][source]" id="import-wp-table-reloaded-source-db" type="radio" value="db" <?php
258
+ checked( $data['import_wp_table_reloaded_source'], 'db', true );
259
+ disabled( $data['wp_table_reloaded_installed'], false, true );
260
+ ?> /> <?php _e( 'WordPress database', 'tablepress' ); ?></label>
261
  <label for="import-wp-table-reloaded-source-dump-file"><input name="import[wp_table_reloaded][source]" id="import-wp-table-reloaded-source-dump-file" type="radio" value="dump-file"<?php checked( $data['import_wp_table_reloaded_source'], 'dump-file', true ); ?> /> <?php _e( 'WP-Table Reloaded Dump File', 'tablepress' ); ?></label>
262
  </td>
263
  </tr>
views/view-list.php CHANGED
@@ -42,9 +42,9 @@ class TablePress_List_View extends TablePress_View {
42
  add_thickbox();
43
  $this->admin_page->enqueue_script( 'list', array( 'jquery-core' ), array(
44
  'list' => array(
45
- 'shortcode_popup' => __( 'To embed this table into a post or page, use this Shortcode:', 'tablepress' ),
46
  'donation-message-already-donated' => __( 'Thank you very much! Your donation is highly appreciated. You just contributed to the further development of TablePress!', 'tablepress' ),
47
- 'donation-message-maybe-later' => sprintf( __( 'No problem! I still hope you enjoy the benefits that TablePress adds to your site. If you should change your mind, you&#8217;ll always find the &#8220;Donate&#8221; button on the <a href="%s">TablePress website</a>.', 'tablepress' ), 'https://tablepress.org/' ),
48
  ),
49
  ) );
50
 
@@ -91,24 +91,25 @@ class TablePress_List_View extends TablePress_View {
91
  . sprintf( __( 'If you like the new features and enhancements, <a href="%s">giving a donation</a> towards the further support and development of TablePress is recommended. Thank you!', 'tablepress' ), 'https://tablepress.org/donate/' )
92
  . '<br /><br />'
93
  . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ),
94
- 'notice-info not-dismissible' );
 
95
  }
96
 
97
  $this->process_action_messages( array(
98
- 'success_delete' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress' ),
99
- 'success_delete_plural' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 2, 'tablepress' ),
100
- 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
101
- 'error_save' => __( 'Error: The table could not be saved.', 'tablepress' ),
102
- 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ( ( false !== $data['table_id'] ) ? ' ' . sprintf( __( 'The copied table has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table_id'] ) ) : '' ),
103
- 'success_copy_plural' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress' ),
104
- 'error_copy' => __( 'Error: The table could not be copied.', 'tablepress' ),
105
- 'error_no_table' => __( 'Error: You did not specify a valid table ID.', 'tablepress' ),
106
- 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ),
107
- 'error_bulk_action_invalid' => __( 'Error: This bulk action is invalid!', 'tablepress' ),
108
- 'error_no_selection' => __( 'Error: You did not select any tables!', 'tablepress' ),
109
- 'error_delete_not_all_tables' => __( 'Notice: Not all selected tables could be deleted!', 'tablepress' ),
110
- 'error_copy_not_all_tables' => __( 'Notice: Not all selected tables could be copied!', 'tablepress' ),
111
- 'success_import' => __( 'The tables were imported successfully.', 'tablepress' ),
112
  'success_import_wp_table_reloaded' => __( 'The tables were imported successfully from WP-Table Reloaded.', 'tablepress' ),
113
  ) );
114
 
@@ -210,7 +211,8 @@ class TablePress_List_View extends TablePress_View {
210
  if ( isset( $_GET['page'] ) ) {
211
  echo '<input type="hidden" name="page" value="' . esc_attr( $_GET['page'] ) . '" />' . "\n";
212
  }
213
- $this->wp_list_table->search_box( __( 'Search Tables', 'tablepress' ), 'tables_search' ); ?>
 
214
  </form>
215
  <form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
216
  <?php
@@ -273,10 +275,10 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
273
  }
274
 
275
  parent::__construct( array(
276
- 'singular' => 'tablepress-table', // Singular name of the listed records.
277
- 'plural' => 'tablepress-all-tables', // Plural name of the listed records.
278
- 'ajax' => false, // Does this list table support AJAX?
279
- 'screen' => $screen, // WP_Screen object.
280
  ) );
281
  }
282
 
@@ -315,14 +317,14 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
315
  */
316
  public function get_columns() {
317
  $columns = array(
318
- 'cb' => $this->has_items() ? '<input type="checkbox" />' : '', // Checkbox for "Select all", but only if there are items in the table.
319
  // "name" is special in WP, which is why we prefix every entry here, to be safe!
320
- 'table_id' => __( 'ID', 'tablepress' ),
321
- 'table_name' => __( 'Table Name', 'tablepress' ),
322
- 'table_description' => __( 'Description', 'tablepress' ),
323
- 'table_author' => __( 'Author', 'tablepress' ),
324
  'table_last_modified_by' => __( 'Last Modified By', 'tablepress' ),
325
- 'table_last_modified' => __( 'Last Modified', 'tablepress' ),
326
  );
327
  return $columns;
328
  }
@@ -343,12 +345,12 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
343
  }
344
 
345
  $sortable_columns = array(
346
- 'table_id' => array( 'id', true ), // true means its already sorted
347
- 'table_name' => array( 'name', false ),
348
- 'table_description' => array( 'description', false ),
349
- 'table_author' => array( 'author', false ),
350
  'table_last_modified_by' => array( 'last_modified_by', false ),
351
- 'table_last_modified' => array( 'last_modified', false ),
352
  );
353
  return $sortable_columns;
354
  }
@@ -605,7 +607,7 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
605
  $import_url = TablePress::url( array( 'action' => 'import' ) );
606
 
607
  if ( $user_can_add_tables && $user_can_import_tables ) {
608
- echo ' ' . sprintf( __( 'You should <a href="%s">add</a> or <a href="%s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url );
609
  } elseif ( $user_can_add_tables ) {
610
  echo ' ' . sprintf( __( 'You should <a href="%s">add</a> a table to get started!', 'tablepress' ), $add_url );
611
  } elseif ( $user_can_import_tables ) {
@@ -752,7 +754,7 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
752
 
753
  // Maybe sort the items.
754
  $_sortable_columns = $this->get_sortable_columns();
755
- if ( $orderby && ! empty( $this->items ) && isset( $_sortable_columns["table_{$orderby}"] ) ) {
756
  usort( $this->items, array( $this, '_order_callback' ) );
757
  }
758
 
@@ -769,7 +771,7 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
769
  // Register pagination options and calculation results.
770
  $this->set_pagination_args( array(
771
  'total_items' => $total_items, // Total number of records/items
772
- 'per_page' => $per_page, // Number of items per page
773
  'total_pages' => ceil( $total_items / $per_page ), // Total number of pages
774
  ) );
775
  }
42
  add_thickbox();
43
  $this->admin_page->enqueue_script( 'list', array( 'jquery-core' ), array(
44
  'list' => array(
45
+ 'shortcode_popup' => __( 'To embed this table into a post or page, use this Shortcode:', 'tablepress' ),
46
  'donation-message-already-donated' => __( 'Thank you very much! Your donation is highly appreciated. You just contributed to the further development of TablePress!', 'tablepress' ),
47
+ 'donation-message-maybe-later' => sprintf( __( 'No problem! I still hope you enjoy the benefits that TablePress adds to your site. If you should change your mind, you&#8217;ll always find the &#8220;Donate&#8221; button on the <a href="%s">TablePress website</a>.', 'tablepress' ), 'https://tablepress.org/' ),
48
  ),
49
  ) );
50
 
91
  . sprintf( __( 'If you like the new features and enhancements, <a href="%s">giving a donation</a> towards the further support and development of TablePress is recommended. Thank you!', 'tablepress' ), 'https://tablepress.org/donate/' )
92
  . '<br /><br />'
93
  . $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ),
94
+ 'notice-info not-dismissible'
95
+ );
96
  }
97
 
98
  $this->process_action_messages( array(
99
+ 'success_delete' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress' ),
100
+ 'success_delete_plural' => _n( 'The table was deleted successfully.', 'The tables were deleted successfully.', 2, 'tablepress' ),
101
+ 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
102
+ 'error_save' => __( 'Error: The table could not be saved.', 'tablepress' ),
103
+ 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ( ( false !== $data['table_id'] ) ? ' ' . sprintf( __( 'The copied table has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table_id'] ) ) : '' ),
104
+ 'success_copy_plural' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress' ),
105
+ 'error_copy' => __( 'Error: The table could not be copied.', 'tablepress' ),
106
+ 'error_no_table' => __( 'Error: You did not specify a valid table ID.', 'tablepress' ),
107
+ 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ),
108
+ 'error_bulk_action_invalid' => __( 'Error: This bulk action is invalid!', 'tablepress' ),
109
+ 'error_no_selection' => __( 'Error: You did not select any tables!', 'tablepress' ),
110
+ 'error_delete_not_all_tables' => __( 'Notice: Not all selected tables could be deleted!', 'tablepress' ),
111
+ 'error_copy_not_all_tables' => __( 'Notice: Not all selected tables could be copied!', 'tablepress' ),
112
+ 'success_import' => __( 'The tables were imported successfully.', 'tablepress' ),
113
  'success_import_wp_table_reloaded' => __( 'The tables were imported successfully from WP-Table Reloaded.', 'tablepress' ),
114
  ) );
115
 
211
  if ( isset( $_GET['page'] ) ) {
212
  echo '<input type="hidden" name="page" value="' . esc_attr( $_GET['page'] ) . '" />' . "\n";
213
  }
214
+ $this->wp_list_table->search_box( __( 'Search Tables', 'tablepress' ), 'tables_search' );
215
+ ?>
216
  </form>
217
  <form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="post">
218
  <?php
275
  }
276
 
277
  parent::__construct( array(
278
+ 'singular' => 'tablepress-table', // Singular name of the listed records.
279
+ 'plural' => 'tablepress-all-tables', // Plural name of the listed records.
280
+ 'ajax' => false, // Does this list table support AJAX?
281
+ 'screen' => $screen, // WP_Screen object.
282
  ) );
283
  }
284
 
317
  */
318
  public function get_columns() {
319
  $columns = array(
320
+ 'cb' => $this->has_items() ? '<input type="checkbox" />' : '', // Checkbox for "Select all", but only if there are items in the table.
321
  // "name" is special in WP, which is why we prefix every entry here, to be safe!
322
+ 'table_id' => __( 'ID', 'tablepress' ),
323
+ 'table_name' => __( 'Table Name', 'tablepress' ),
324
+ 'table_description' => __( 'Description', 'tablepress' ),
325
+ 'table_author' => __( 'Author', 'tablepress' ),
326
  'table_last_modified_by' => __( 'Last Modified By', 'tablepress' ),
327
+ 'table_last_modified' => __( 'Last Modified', 'tablepress' ),
328
  );
329
  return $columns;
330
  }
345
  }
346
 
347
  $sortable_columns = array(
348
+ 'table_id' => array( 'id', true ), // true means its already sorted
349
+ 'table_name' => array( 'name', false ),
350
+ 'table_description' => array( 'description', false ),
351
+ 'table_author' => array( 'author', false ),
352
  'table_last_modified_by' => array( 'last_modified_by', false ),
353
+ 'table_last_modified' => array( 'last_modified', false ),
354
  );
355
  return $sortable_columns;
356
  }
607
  $import_url = TablePress::url( array( 'action' => 'import' ) );
608
 
609
  if ( $user_can_add_tables && $user_can_import_tables ) {
610
+ echo ' ' . sprintf( __( 'You should <a href="%1$s">add</a> or <a href="%2$s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url );
611
  } elseif ( $user_can_add_tables ) {
612
  echo ' ' . sprintf( __( 'You should <a href="%s">add</a> a table to get started!', 'tablepress' ), $add_url );
613
  } elseif ( $user_can_import_tables ) {
754
 
755
  // Maybe sort the items.
756
  $_sortable_columns = $this->get_sortable_columns();
757
+ if ( $orderby && ! empty( $this->items ) && isset( $_sortable_columns[ "table_{$orderby}" ] ) ) {
758
  usort( $this->items, array( $this, '_order_callback' ) );
759
  }
760
 
771
  // Register pagination options and calculation results.
772
  $this->set_pagination_args( array(
773
  'total_items' => $total_items, // Total number of records/items
774
+ 'per_page' => $per_page, // Number of items per page
775
  'total_pages' => ceil( $total_items / $per_page ), // Total number of pages
776
  ) );
777
  }
views/view-options.php CHANGED
@@ -31,19 +31,27 @@ class TablePress_Options_View extends TablePress_View {
31
  public function setup( $action, array $data ) {
32
  parent::setup( $action, $data );
33
 
34
- $this->admin_page->enqueue_style( 'codemirror' );
35
- $this->admin_page->enqueue_script( 'codemirror', array(), array(), true );
36
- $this->admin_page->enqueue_script( 'options', array( 'jquery-core', 'tablepress-codemirror', 'jquery-ui-resizable' ), array(
 
 
 
 
 
 
 
 
37
  'strings' => array(
38
  'uninstall_warning_1' => __( 'Do you really want to uninstall TablePress and delete ALL data?', 'tablepress' ),
39
  'uninstall_warning_2' => __( 'Are you really sure?', 'tablepress' ),
40
- ),
41
  ) );
42
 
43
  $this->process_action_messages( array(
44
- 'success_save' => __( 'Options saved successfully.', 'tablepress' ),
45
- 'success_save_error_custom_css' => __( 'Options saved successfully, but &#8220;Custom CSS&#8221; was not saved to file.', 'tablepress' ),
46
- 'error_save' => __( 'Error: Options could not be saved.', 'tablepress' ),
47
  'success_import_wp_table_reloaded' => __( 'The WP-Table Reloaded &#8220;Custom CSS&#8221; was imported successfully.', 'tablepress' ),
48
  ) );
49
 
@@ -54,7 +62,7 @@ class TablePress_Options_View extends TablePress_View {
54
  $this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( $this, 'postbox_user_options' ), 'normal' );
55
  $this->data['submit_button_caption'] = __( 'Save Changes', 'tablepress' );
56
  $this->add_text_box( 'submit', array( $this, 'textbox_submit_button' ), 'submit' );
57
- if ( current_user_can( 'activate_plugins' ) && current_user_can( 'tablepress_edit_options' ) && current_user_can( 'tablepress_delete_tables' ) && ! is_plugin_active_for_network( TABLEPRESS_BASENAME ) ) {
58
  $this->add_text_box( 'uninstall-tablepress', array( $this, 'textbox_uninstall_tablepress' ), 'submit' );
59
  }
60
  }
@@ -105,7 +113,8 @@ class TablePress_Options_View extends TablePress_View {
105
  <th class="column-1" scope="row"></th>
106
  <td class="column-2">
107
  <textarea name="options[custom_css]" id="option-custom-css" class="large-text" rows="8"><?php echo esc_textarea( $data['frontend_options']['custom_css'] ); ?></textarea>
108
- <p class="description"><?php
 
109
  printf( __( '&#8220;Custom CSS&#8221; (<a href="%s">Cascading Style Sheets</a>) can be used to change the styling or layout of a table.', 'tablepress' ), 'https://www.htmldog.com/guides/css/beginner/' );
110
  echo ' ';
111
  printf( __( 'You can get styling examples from the <a href="%s">FAQ</a>.', 'tablepress' ), 'https://tablepress.org/faq/' );
@@ -113,7 +122,8 @@ class TablePress_Options_View extends TablePress_View {
113
  printf( __( 'Information on available CSS selectors can be found in the <a href="%s">documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' );
114
  echo ' ';
115
  _e( 'Please note that invalid CSS code will be stripped, if it can not be corrected automatically.', 'tablepress' );
116
- ?></p>
 
117
  </td>
118
  </tr>
119
  </tbody>
@@ -158,7 +168,7 @@ class TablePress_Options_View extends TablePress_View {
158
 
159
  $select_box = '<select id="option-admin-menu-parent-page" name="options[admin_menu_parent_page]">' . "\n";
160
  foreach ( $entries as $page => $entry ) {
161
- $select_box .= '<option' . selected( $page, $data['user_options']['parent_page'], false ) . disabled( $page, '-', false ) .' value="' . $page . '">' . $entry . "</option>\n";
162
  }
163
  $select_box .= "</select>\n";
164
  ?>
@@ -182,12 +192,14 @@ class TablePress_Options_View extends TablePress_View {
182
  public function textbox_uninstall_tablepress( array $data, array $box ) {
183
  ?>
184
  <h1 style="margin-top:40px;"><?php _e( 'Uninstall TablePress', 'tablepress' ); ?></h1>
185
- <p><?php
 
186
  echo __( 'Uninstalling <strong>will permanently delete</strong> all TablePress tables and options from the database.', 'tablepress' ) . '<br />'
187
  . __( 'It is recommended that you create a backup of the tables (by exporting the tables in the JSON format), in case you later change your mind.', 'tablepress' ) . '<br />'
188
  . __( 'You will manually need to remove the plugin&#8217;s files from the plugin folder afterwards.', 'tablepress' ) . '<br />'
189
  . __( 'Be very careful with this and only click the button if you know what you are doing!', 'tablepress' );
190
- ?></p>
 
191
  <p><a href="<?php echo TablePress::url( array( 'action' => 'uninstall_tablepress' ), true, 'admin-post.php' ); ?>" id="uninstall-tablepress" class="button"><?php _e( 'Uninstall TablePress', 'tablepress' ); ?></a></p>
192
  <?php
193
  }
31
  public function setup( $action, array $data ) {
32
  parent::setup( $action, $data );
33
 
34
+ // Enqueue WordPress copy of CodeMirror, with CSS linting, etc.
35
+ $codemirror_settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
36
+ if ( ! empty( $codemirror_settings ) ) {
37
+ // Load CSS adjustments for CodeMirror and the added vertical resizing.
38
+ $this->admin_page->enqueue_style( 'codemirror', array( 'code-editor' ) );
39
+ $this->admin_page->enqueue_script( 'codemirror', array( 'jquery-core', 'jquery-ui-resizable' ), array(
40
+ 'codemirror_settings' => $codemirror_settings,
41
+ ) );
42
+ }
43
+
44
+ $this->admin_page->enqueue_script( 'options', array( 'jquery-core' ), array(
45
  'strings' => array(
46
  'uninstall_warning_1' => __( 'Do you really want to uninstall TablePress and delete ALL data?', 'tablepress' ),
47
  'uninstall_warning_2' => __( 'Are you really sure?', 'tablepress' ),
48
+ )
49
  ) );
50
 
51
  $this->process_action_messages( array(
52
+ 'success_save' => __( 'Options saved successfully.', 'tablepress' ),
53
+ 'success_save_error_custom_css' => __( 'Options saved successfully, but &#8220;Custom CSS&#8221; was not saved to file.', 'tablepress' ),
54
+ 'error_save' => __( 'Error: Options could not be saved.', 'tablepress' ),
55
  'success_import_wp_table_reloaded' => __( 'The WP-Table Reloaded &#8220;Custom CSS&#8221; was imported successfully.', 'tablepress' ),
56
  ) );
57
 
62
  $this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( $this, 'postbox_user_options' ), 'normal' );
63
  $this->data['submit_button_caption'] = __( 'Save Changes', 'tablepress' );
64
  $this->add_text_box( 'submit', array( $this, 'textbox_submit_button' ), 'submit' );
65
+ if ( current_user_can( 'deactivate_plugin', TABLEPRESS_BASENAME ) && current_user_can( 'tablepress_edit_options' ) && current_user_can( 'tablepress_delete_tables' ) && ! is_plugin_active_for_network( TABLEPRESS_BASENAME ) ) {
66
  $this->add_text_box( 'uninstall-tablepress', array( $this, 'textbox_uninstall_tablepress' ), 'submit' );
67
  }
68
  }
113
  <th class="column-1" scope="row"></th>
114
  <td class="column-2">
115
  <textarea name="options[custom_css]" id="option-custom-css" class="large-text" rows="8"><?php echo esc_textarea( $data['frontend_options']['custom_css'] ); ?></textarea>
116
+ <p class="description">
117
+ <?php
118
  printf( __( '&#8220;Custom CSS&#8221; (<a href="%s">Cascading Style Sheets</a>) can be used to change the styling or layout of a table.', 'tablepress' ), 'https://www.htmldog.com/guides/css/beginner/' );
119
  echo ' ';
120
  printf( __( 'You can get styling examples from the <a href="%s">FAQ</a>.', 'tablepress' ), 'https://tablepress.org/faq/' );
122
  printf( __( 'Information on available CSS selectors can be found in the <a href="%s">documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' );
123
  echo ' ';
124
  _e( 'Please note that invalid CSS code will be stripped, if it can not be corrected automatically.', 'tablepress' );
125
+ ?>
126
+ </p>
127
  </td>
128
  </tr>
129
  </tbody>
168
 
169
  $select_box = '<select id="option-admin-menu-parent-page" name="options[admin_menu_parent_page]">' . "\n";
170
  foreach ( $entries as $page => $entry ) {
171
+ $select_box .= '<option' . selected( $page, $data['user_options']['parent_page'], false ) . disabled( $page, '-', false ) . ' value="' . $page . '">' . $entry . "</option>\n";
172
  }
173
  $select_box .= "</select>\n";
174
  ?>
192
  public function textbox_uninstall_tablepress( array $data, array $box ) {
193
  ?>
194
  <h1 style="margin-top:40px;"><?php _e( 'Uninstall TablePress', 'tablepress' ); ?></h1>
195
+ <p>
196
+ <?php
197
  echo __( 'Uninstalling <strong>will permanently delete</strong> all TablePress tables and options from the database.', 'tablepress' ) . '<br />'
198
  . __( 'It is recommended that you create a backup of the tables (by exporting the tables in the JSON format), in case you later change your mind.', 'tablepress' ) . '<br />'
199
  . __( 'You will manually need to remove the plugin&#8217;s files from the plugin folder afterwards.', 'tablepress' ) . '<br />'
200
  . __( 'Be very careful with this and only click the button if you know what you are doing!', 'tablepress' );
201
+ ?>
202
+ </p>
203
  <p><a href="<?php echo TablePress::url( array( 'action' => 'uninstall_tablepress' ), true, 'admin-post.php' ); ?>" id="uninstall-tablepress" class="button"><?php _e( 'Uninstall TablePress', 'tablepress' ); ?></a></p>
204
  <?php
205
  }
views/view-options_custom_css.php CHANGED
@@ -133,7 +133,7 @@ class TablePress_Options_Custom_CSS_View extends TablePress_View {
133
  */
134
  public function textbox_proceed_no_file_saving( array $data, array $box ) {
135
  ?>
136
- <h2><?php _e( 'Proceed without saving a file', 'tablepress' ) ?></h2>
137
  <p>
138
  <?php _e( 'To proceed without trying to save the &#8220;Custom CSS&#8221; to a file, click the button below.', 'tablepress' ); ?>
139
  <?php _e( 'Your &#8220;Custom CSS&#8221; will then be loaded inline.', 'tablepress' ); ?>
133
  */
134
  public function textbox_proceed_no_file_saving( array $data, array $box ) {
135
  ?>
136
+ <h2><?php _e( 'Proceed without saving a file', 'tablepress' ); ?></h2>
137
  <p>
138
  <?php _e( 'To proceed without trying to save the &#8220;Custom CSS&#8221; to a file, click the button below.', 'tablepress' ); ?>
139
  <?php _e( 'Your &#8220;Custom CSS&#8221; will then be loaded inline.', 'tablepress' ); ?>