WP-Table Reloaded - Version 1.9.3

Version Description

This upgrade includes several bugfixes and a few enhancements, and is a recommended maintenance release.

Download this release

Release Info

Developer TobiasBg
Plugin Icon wp plugin WP-Table Reloaded
Version 1.9.3
Comparing to
See all releases

Code changes from version 1.9.2 to 1.9.3

admin/admin-script.dev.js CHANGED
@@ -17,7 +17,7 @@ jQuery(document).ready( function( $ ) {
17
set_table_data_changed();
18
}
19
return false;
20
- });
21
$( '#a-unhide-rows' ).click( function() {
22
var rows_selected = $( '#table_contents tr:not(".table-foot") :checked' ).length;
23
if ( rows_selected == 0 ) {
@@ -27,7 +27,7 @@ jQuery(document).ready( function( $ ) {
27
set_table_data_changed();
28
}
29
return false;
30
- });
31
32
$( '#a-hide-columns' ).click( function() {
33
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
@@ -35,24 +35,24 @@ jQuery(document).ready( function( $ ) {
35
alert( WP_Table_Reloaded_Admin.str_UnHideColsNoSelection );
36
} else {
37
$( '#table_contents .table-foot :checked' ).removeAttr( 'checked' ).next().val( true ).each( function() {
38
- $( '#table_contents .' + $(this).attr('id') ).addClass( 'column-hidden' );
39
} );
40
set_table_data_changed();
41
}
42
return false;
43
- });
44
$( '#a-unhide-columns' ).click( function() {
45
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
46
if ( cols_selected == 0 ) {
47
alert( WP_Table_Reloaded_Admin.str_UnHideColsNoSelection );
48
} else {
49
$( '#table_contents .table-foot :checked' ).removeAttr( 'checked' ).next().val( false ).each( function() {
50
- $( '#table_contents .' + $(this).attr('id') ).removeClass( 'column-hidden' );
51
} );
52
set_table_data_changed();
53
}
54
return false;
55
- });
56
57
$( '#button-insert-rows' ).click( function() {
58
var rows_selected = $( '#table_contents tr:not(".table-foot") :checked' ).length;
@@ -62,7 +62,7 @@ jQuery(document).ready( function( $ ) {
62
} else {
63
return true;
64
}
65
- });
66
67
$( '#button-insert-columns' ).click( function() {
68
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
@@ -72,57 +72,51 @@ jQuery(document).ready( function( $ ) {
72
} else {
73
return true;
74
}
75
- });
76
77
- var span_type = '';
78
- function add_span() {
79
- $(this).val( span_type );
80
- $( '#table_contents textarea' ).unbind( 'click', add_span );
81
set_table_data_changed();
82
}
83
-
84
- // function to add rowspan / colspan to cells
85
$( '#a-add-colspan' ).click( function() {
86
- span_type = '#colspan#';
87
if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationAddColspan ) )
88
- $("#table_contents textarea").bind( 'click', add_span );
89
return false;
90
- });
91
$( '#a-add-rowspan' ).click( function() {
92
- span_type = '#rowspan#';
93
if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationAddRowspan ) )
94
- $("#table_contents textarea").bind( 'click', add_span );
95
return false;
96
- });
97
98
// functions to make focussed textareas bigger (if backend option is enabled)
99
- var focussed = null;
100
if ( WP_Table_Reloaded_Admin.option_growing_textareas ) {
101
- $( '#table_contents textarea' ).focus( function() {
102
- $(focussed).removeClass('focus');
103
- focussed = $(this).parents('tr').find('textarea');
104
- $(focussed).addClass('focus');
105
} );
106
}
107
108
- // custom css textarea grows on focus
109
- function css_textarea_focus() {
110
- $( '#options_custom_css' ).addClass('focus');
111
- }
112
- $( '#options_custom_css' ).one( 'focus', css_textarea_focus );
113
114
// show export delimiter dropdown box only if export format is csv
115
- $( '#export_format' ).change( function () {
116
if ( 'csv' == $(this).val() )
117
$('.tr-export-delimiter').show();
118
else
119
$('.tr-export-delimiter').hide();
120
- })
121
.change();
122
123
// confirm change of table ID
124
var table_id = $( '.wp-table-reloaded-table-information #table_id' ).val();
125
- $( '.wp-table-reloaded-table-information #table_id' ).change( function () {
126
if ( table_id != $(this).val() ) {
127
if ( confirm( WP_Table_Reloaded_Admin.str_ChangeTableID ) ) {
128
table_id = $(this).val();
@@ -134,7 +128,7 @@ jQuery(document).ready( function( $ ) {
134
} );
135
136
// show select box for table to replace only if needed
137
- $( '.tr-import-addreplace input' ).click( function () {
138
if( 'replace' == $( '.tr-import-addreplace input:checked' ).val() )
139
$( '.tr-import-addreplace-table' ).show();
140
else
@@ -143,23 +137,23 @@ jQuery(document).ready( function( $ ) {
143
$( '.tr-import-addreplace input:checked' ).click();
144
145
// show only checked import fields depending on radio button
146
- $( '.tr-import-from input' ).click( function () {
147
$('.tr-import-file-upload, .tr-import-url, .tr-import-form-field, .tr-import-server').hide();
148
$( '.tr-import-' + $( '.tr-import-from input:checked' ).val() ).show();
149
} );
150
$('.tr-import-from input:checked').click();
151
152
// enable/disable custom css textarea according to state of checkbox
153
- $( '#options_use_custom_css' ).change( function () {
154
- if( $(this).attr('checked') )
155
$( '#options_custom_css' ).removeAttr( 'disabled' );
156
else
157
$( '#options_custom_css' ).attr( 'disabled', 'disabled' );
158
} );
159
160
// tablesorter selection dropdown according to state of checkbox
161
- $( '#options_enable_tablesorter' ).change( function () {
162
- if( $(this).attr('checked') )
163
$( '#options_tablesorter_script' ).removeAttr( 'disabled' );
164
else
165
$( '#options_tablesorter_script' ).attr( 'disabled' , 'disabled' );
@@ -167,14 +161,10 @@ jQuery(document).ready( function( $ ) {
167
168
// enable/disable "use tableheadline" according to state of checkbox
169
if ( WP_Table_Reloaded_Admin.option_tablesorter_enabled && WP_Table_Reloaded_Admin.option_datatables_active ) {
170
- $( '#table_options_first_row_th' ).change( function () {
171
- if( $(this).attr('checked') ) {
172
- $( '#table_options_use_tablesorter' ).removeAttr( 'disabled' );
173
- if ( $( '#table_options_use_tablesorter' ).attr('checked') ) {
174
- $( '.wp-table-reloaded-datatables-options input' ).removeAttr( 'disabled' );
175
- if ( !WP_Table_Reloaded_Admin.option_tabletools_active )
176
- $( '#table_options_datatables_tabletools' ).attr( 'disabled', 'disabled' );
177
- }
178
} else {
179
$( '#table_options_use_tablesorter' ).attr( 'disabled', 'disabled' );
180
$( '.wp-table-reloaded-datatables-options input' ).attr( 'disabled', 'disabled' );
@@ -182,20 +172,19 @@ jQuery(document).ready( function( $ ) {
182
} );
183
184
// enable/disable DataTables options according to checkbox state
185
- $( '#table_options_use_tablesorter' ).change( function () {
186
- if( $(this).attr('checked') ) {
187
$( '.wp-table-reloaded-datatables-options input' ).removeAttr( 'disabled' );
188
if ( !WP_Table_Reloaded_Admin.option_tabletools_active )
189
$( '#table_options_datatables_tabletools' ).attr( 'disabled', 'disabled' );
190
- if ( !$( '#table_options_datatables_paginate' ).attr('checked') )
191
- $( '#table_options_datatables_paginate_entries' ).attr( 'disabled', 'disabled' );
192
} else {
193
$( '.wp-table-reloaded-datatables-options input' ).attr( 'disabled', 'disabled' );
194
}
195
} );
196
197
- $( '#table_options_datatables_paginate' ).change( function () {
198
- if( $(this).attr('checked') ) {
199
$( '#table_options_datatables_paginate_entries' ).removeAttr( 'disabled' );
200
} else {
201
$( '#table_options_datatables_paginate_entries' ).attr( 'disabled', 'disabled' );
@@ -203,56 +192,46 @@ jQuery(document).ready( function( $ ) {
203
} );
204
205
} else if ( WP_Table_Reloaded_Admin.option_tablesorter_enabled ) {
206
- $( '#table_options_first_row_th' ).change( function () {
207
- if( $(this).attr('checked') )
208
$( '#table_options_use_tablesorter' ).removeAttr( 'disabled' );
209
else
210
$( '#table_options_use_tablesorter' ).attr( 'disabled', 'disabled' );
211
} );
212
}
213
214
- $( '#table_options_print_name' ).change( function () {
215
- if( $(this).attr('checked') )
216
- $( '#table_options_print_name_position' ).removeAttr( 'disabled' );
217
else
218
- $( '#table_options_print_name_position' ).attr( 'disabled', 'disabled' );
219
- } );
220
-
221
- $( '#table_options_print_description' ).change( function () {
222
- if( $(this).attr('checked') )
223
- $( '#table_options_print_description_position' ).removeAttr( 'disabled' );
224
- else
225
- $( '#table_options_print_description_position' ).attr( 'disabled', 'disabled' );
226
} );
227
228
// confirm uninstall setting
229
- $( '#options_uninstall_upon_deactivation').click( function () {
230
- if( $(this).attr('checked') )
231
return confirm( WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation );
232
} );
233
234
-
235
// insert link functions
236
- var insert_html = '';
237
- function add_html() {
238
- $(this).val( $(this).val() + insert_html );
239
- $( '#table_contents textarea' ).unbind( 'click', add_html );
240
set_table_data_changed();
241
}
242
243
- $( '#a-insert-link' ).click( function () {
244
- var target = '';
245
- if ( WP_Table_Reloaded_Admin.option_add_target_blank_to_links )
246
- target = ' target="_blank"';
247
var link_url = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL + ':', 'http://' );
248
if ( link_url ) {
249
var link_text = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText + ':', WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText );
250
if ( link_text ) {
251
- insert_html = '<a href="' + link_url + '"' + target + '>' + link_text + '</a>';
252
- insert_html = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain, insert_html )
253
- if ( insert_html ) {
254
- $("#table_contents textarea").bind('click', add_html);
255
- }
256
}
257
}
258
return false;
@@ -261,63 +240,62 @@ jQuery(document).ready( function( $ ) {
261
// insert image functions
262
function call_media_library_thickbox() {
263
edCanvas = this;
264
- $( '#table_contents textarea' ).unbind( 'click', call_media_library_thickbox );
265
- var link = $( '#a-insert-image' );
266
- tb_show( link.attr('title'), link.attr('href'), link.attr('rel') );
267
tb_my_position();
268
$(this).blur();
269
set_table_data_changed();
270
}
271
272
- function add_image() {
273
if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox ) )
274
- $("#table_contents textarea").bind( 'click', call_media_library_thickbox );
275
return false;
276
- }
277
- $( '#a-insert-image' ).bind('click', add_image);
278
279
// not all characters allowed for name of Custom Data Field
280
- $( '#insert_custom_field_name' ).keyup( function () {
281
$(this).val( $(this).val().toLowerCase().replace(/[^a-z0-9_-]/g, '') );
282
} );
283
284
// remove/add title on focus/blur
285
- $( '.focus-blur-change' ).focus( function () {
286
if ( $(this).attr('title') == $(this).val() )
287
$(this).val( '' );
288
} )
289
- .blur( function () {
290
if ( '' == $(this).val() )
291
$(this).val( $(this).attr('title') );
292
} );
293
294
- $( '#table_custom_fields textarea' ).focus( function() {
295
$( '#table_custom_fields .focus' ).removeClass('focus');
296
$(this).addClass('focus');
297
} );
298
299
// confirmation of certain actions
300
- $( 'input.bulk_copy_tables' ).click( function () {
301
return confirm( WP_Table_Reloaded_Admin.str_BulkCopyTablesLink );
302
} );
303
304
- $( 'input.bulk_delete_tables' ).click( function () {
305
return confirm( WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink );
306
} );
307
308
- $( 'input.bulk_wp_table_import_tables' ).click( function () {
309
return confirm( WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink );
310
} );
311
312
- $( 'a.copy_table_link' ).click( function () {
313
return confirm( WP_Table_Reloaded_Admin.str_CopyTableLink );
314
} );
315
316
- $( '#wp-table-reloaded-list a.delete_table_link' ).click( function () {
317
return confirm( WP_Table_Reloaded_Admin.str_DeleteTableLink );
318
} );
319
320
- $( '#button-delete-rows' ).click( function () {
321
var rows_cb = $( '#table_contents tr:not(".table-foot") :checkbox' ).length - 1; // -1 because of invisible checkbox in .table-head
322
var rows_selected = $( '#table_contents tr:not(".table-foot") :checked' ).length;
323
@@ -329,12 +307,12 @@ jQuery(document).ready( function( $ ) {
329
alert( WP_Table_Reloaded_Admin.str_DeleteRowsFailedNotAll );
330
return false;
331
} else {
332
- return confirm( WP_Table_Reloaded_Admin.str_DeleteRowsConfirm );
333
}
334
}
335
} );
336
337
- $( '#button-delete-columns' ).click( function () {
338
var cols_cb = $( '#table_contents .table-foot :checkbox' ).length;
339
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
340
@@ -346,32 +324,32 @@ jQuery(document).ready( function( $ ) {
346
alert( WP_Table_Reloaded_Admin.str_DeleteColsFailedNotAll );
347
return false;
348
} else {
349
- return confirm( WP_Table_Reloaded_Admin.str_DeleteColsConfirm );
350
}
351
}
352
} );
353
354
- $( 'a.import_wptable_link' ).click( function () {
355
return confirm( WP_Table_Reloaded_Admin.str_ImportwpTableLink );
356
} );
357
358
- $( '#import_wp_table_reloaded_dump_file' ).click( function () {
359
return confirm( WP_Table_Reloaded_Admin.str_ImportDumpFile );
360
} );
361
362
- $( '#uninstall_plugin_link' ).click( function () {
363
if ( confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_1 ) )
364
return confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_2 );
365
else
366
return false;
367
} );
368
369
- $( 'a.cf_shortcode_link' ).click( function () {
370
var dummy = prompt( WP_Table_Reloaded_Admin.str_CFShortcodeMessage, $(this).attr('title') );
371
return false;
372
} );
373
374
- $( 'a.table_shortcode_link' ).click( function () {
375
var dummy = prompt( WP_Table_Reloaded_Admin.str_TableShortcodeMessage, $(this).attr('title') );
376
return false;
377
} );
@@ -382,29 +360,28 @@ jQuery(document).ready( function( $ ) {
382
} );
383
384
// exit message, if table content was changed but not yet saved
385
- var table_data_changed = false;
386
-
387
- function set_table_data_changed() {
388
- table_data_changed = true;
389
- $( '#wp_table_reloaded_edit_table' ).find( '#table_name, textarea' ).unbind( 'change', set_table_data_changed );
390
- $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select' ).unbind( 'change', set_table_data_changed );
391
- }
392
393
if ( WP_Table_Reloaded_Admin.option_show_exit_warning ) {
394
- window.onbeforeunload = function(){
395
- if ( table_data_changed )
396
- return WP_Table_Reloaded_Admin.str_saveAlert;
397
- };
398
-
399
- $("#wp_table_reloaded_edit_table input[name='submit[update]'], #wp_table_reloaded_edit_table input[name='submit[save_back]']").click(function(){
400
- $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select' ).removeAttr( 'disabled' );
401
window.onbeforeunload = null;
402
} );
403
-
404
- $( '#wp_table_reloaded_edit_table' ).find( '#table_name, textarea' ).bind( 'change', set_table_data_changed ); // see also ID change function above
405
- $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select' ).bind( 'change', set_table_data_changed );
406
}
407
-
408
tb_init( 'a.help-link' );
409
tb_init( 'a.preview-link' );
410
tb_my_position();
@@ -427,8 +404,8 @@ var tb_my_position;
427
tb_my_position = function() {
428
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0;
429
430
- if ( $('body.admin-bar').length )
431
- adminbar_height = 28;
432
433
if ( tbWindow.size() ) {
434
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
17
set_table_data_changed();
18
}
19
return false;
20
+ } );
21
$( '#a-unhide-rows' ).click( function() {
22
var rows_selected = $( '#table_contents tr:not(".table-foot") :checked' ).length;
23
if ( rows_selected == 0 ) {
27
set_table_data_changed();
28
}
29
return false;
30
+ } );
31
32
$( '#a-hide-columns' ).click( function() {
33
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
35
alert( WP_Table_Reloaded_Admin.str_UnHideColsNoSelection );
36
} else {
37
$( '#table_contents .table-foot :checked' ).removeAttr( 'checked' ).next().val( true ).each( function() {
38
+ $( '#table_contents .' + this.id ).addClass( 'column-hidden' );
39
} );
40
set_table_data_changed();
41
}
42
return false;
43
+ } );
44
$( '#a-unhide-columns' ).click( function() {
45
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
46
if ( cols_selected == 0 ) {
47
alert( WP_Table_Reloaded_Admin.str_UnHideColsNoSelection );
48
} else {
49
$( '#table_contents .table-foot :checked' ).removeAttr( 'checked' ).next().val( false ).each( function() {
50
+ $( '#table_contents .' + this.id ).removeClass( 'column-hidden' );
51
} );
52
set_table_data_changed();
53
}
54
return false;
55
+ } );
56
57
$( '#button-insert-rows' ).click( function() {
58
var rows_selected = $( '#table_contents tr:not(".table-foot") :checked' ).length;
62
} else {
63
return true;
64
}
65
+ } );
66
67
$( '#button-insert-columns' ).click( function() {
68
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
72
} else {
73
return true;
74
}
75
+ } );
76
77
+ // function to add rowspan / colspan to cells
78
+ function add_span( event ) {
79
+ $(this).val( event.data.span_type );
80
+ $( '#table_contents' ).undelegate( 'textarea', 'click', add_span );
81
set_table_data_changed();
82
}
83
$( '#a-add-colspan' ).click( function() {
84
if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationAddColspan ) )
85
+ $( '#table_contents' ).delegate( 'textarea', 'click', { span_type: '#colspan#' }, add_span );
86
return false;
87
+ } );
88
$( '#a-add-rowspan' ).click( function() {
89
if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationAddRowspan ) )
90
+ $( '#table_contents' ).delegate( 'textarea', 'click', { span_type: '#rowspan#' }, add_span );
91
return false;
92
+ } );
93
94
// functions to make focussed textareas bigger (if backend option is enabled)
95
+ var $focussed = $(null);
96
if ( WP_Table_Reloaded_Admin.option_growing_textareas ) {
97
+ $( '#table_contents' ).delegate( 'textarea', 'focus', function() {
98
+ $focussed.removeClass( 'focus' );
99
+ $focussed = $(this).closest( 'tr' ).addClass( 'focus' );
100
} );
101
}
102
103
+ // "Custom CSS" textarea grows on focus, once
104
+ $( '#options_custom_css' ).one( 'focus', function() {
105
+ $(this).addClass( 'focus' );
106
+ } );
107
108
// show export delimiter dropdown box only if export format is csv
109
+ $( '#export_format' ).change( function() {
110
if ( 'csv' == $(this).val() )
111
$('.tr-export-delimiter').show();
112
else
113
$('.tr-export-delimiter').hide();
114
+ } )
115
.change();
116
117
// confirm change of table ID
118
var table_id = $( '.wp-table-reloaded-table-information #table_id' ).val();
119
+ $( '.wp-table-reloaded-table-information #table_id' ).change( function() {
120
if ( table_id != $(this).val() ) {
121
if ( confirm( WP_Table_Reloaded_Admin.str_ChangeTableID ) ) {
122
table_id = $(this).val();
128
} );
129
130
// show select box for table to replace only if needed
131
+ $( '.tr-import-addreplace input' ).click( function() {
132
if( 'replace' == $( '.tr-import-addreplace input:checked' ).val() )
133
$( '.tr-import-addreplace-table' ).show();
134
else
137
$( '.tr-import-addreplace input:checked' ).click();
138
139
// show only checked import fields depending on radio button
140
+ $( '.tr-import-from input' ).click( function() {
141
$('.tr-import-file-upload, .tr-import-url, .tr-import-form-field, .tr-import-server').hide();
142
$( '.tr-import-' + $( '.tr-import-from input:checked' ).val() ).show();
143
} );
144
$('.tr-import-from input:checked').click();
145
146
// enable/disable custom css textarea according to state of checkbox
147
+ $( '#options_use_custom_css' ).change( function() {
148
+ if( this.checked )
149
$( '#options_custom_css' ).removeAttr( 'disabled' );
150
else
151
$( '#options_custom_css' ).attr( 'disabled', 'disabled' );
152
} );
153
154
// tablesorter selection dropdown according to state of checkbox
155
+ $( '#options_enable_tablesorter' ).change( function() {
156
+ if( this.checked )
157
$( '#options_tablesorter_script' ).removeAttr( 'disabled' );
158
else
159
$( '#options_tablesorter_script' ).attr( 'disabled' , 'disabled' );
161
162
// enable/disable "use tableheadline" according to state of checkbox
163
if ( WP_Table_Reloaded_Admin.option_tablesorter_enabled && WP_Table_Reloaded_Admin.option_datatables_active ) {
164
+ $( '#table_options_first_row_th' ).change( function() {
165
+ if( this.checked ) {
166
+ $( '#table_options_use_tablesorter' ).removeAttr( 'disabled' )
167
+ .change();
168
} else {
169
$( '#table_options_use_tablesorter' ).attr( 'disabled', 'disabled' );
170
$( '.wp-table-reloaded-datatables-options input' ).attr( 'disabled', 'disabled' );
172
} );
173
174
// enable/disable DataTables options according to checkbox state
175
+ $( '#table_options_use_tablesorter' ).change( function() {
176
+ if( this.checked ) {
177
$( '.wp-table-reloaded-datatables-options input' ).removeAttr( 'disabled' );
178
if ( !WP_Table_Reloaded_Admin.option_tabletools_active )
179
$( '#table_options_datatables_tabletools' ).attr( 'disabled', 'disabled' );
180
+ $( '#table_options_datatables_paginate' ).change();
181
} else {
182
$( '.wp-table-reloaded-datatables-options input' ).attr( 'disabled', 'disabled' );
183
}
184
} );
185
186
+ $( '#table_options_datatables_paginate' ).change( function() {
187
+ if( this.checked ) {
188
$( '#table_options_datatables_paginate_entries' ).removeAttr( 'disabled' );
189
} else {
190
$( '#table_options_datatables_paginate_entries' ).attr( 'disabled', 'disabled' );
192
} );
193
194
} else if ( WP_Table_Reloaded_Admin.option_tablesorter_enabled ) {
195
+ $( '#table_options_first_row_th' ).change( function() {
196
+ if( this.checked )
197
$( '#table_options_use_tablesorter' ).removeAttr( 'disabled' );
198
else
199
$( '#table_options_use_tablesorter' ).attr( 'disabled', 'disabled' );
200
} );
201
}
202
203
+ $( '#table_options_print_name, #table_options_print_description' ).change( function() {
204
+ if( this.checked )
205
+ $( '#' + this.id + '_position' ).removeAttr( 'disabled' );
206
else
207
+ $( '#' + this.id + '_position' ).attr( 'disabled', 'disabled' );
208
} );
209
210
// confirm uninstall setting
211
+ $( '#options_uninstall_upon_deactivation').click( function() {
212
+ if( this.checked )
213
return confirm( WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation );
214
} );
215
216
// insert link functions
217
+ function add_html( event ) {
218
+ $(this).val( $(this).val() + event.data.html );
219
+ $( '#table_contents' ).undelegate( 'textarea', 'click', add_html );
220
set_table_data_changed();
221
}
222
223
+ $( '#a-insert-link' ).click( function() {
224
var link_url = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL + ':', 'http://' );
225
if ( link_url ) {
226
var link_text = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText + ':', WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText );
227
if ( link_text ) {
228
+ var target = '';
229
+ if ( WP_Table_Reloaded_Admin.option_add_target_blank_to_links )
230
+ target = ' target="_blank"';
231
+ var insert_html = '<a href="' + link_url + '"' + target + '>' + link_text + '</a>';
232
+ insert_html = prompt( WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain, insert_html );
233
+ if ( insert_html )
234
+ $( '#table_contents' ).delegate( 'textarea', 'click', { html: insert_html }, add_html );
235
}
236
}
237
return false;
240
// insert image functions
241
function call_media_library_thickbox() {
242
edCanvas = this;
243
+ $( '#table_contents' ).undelegate( 'textarea', 'click', call_media_library_thickbox );
244
+ var $link = $( '#a-insert-image' );
245
+ tb_show( $link.attr('title'), $link.attr('href'), false );
246
tb_my_position();
247
$(this).blur();
248
set_table_data_changed();
249
}
250
251
+ $( '#a-insert-image' ).click( function() {
252
if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox ) )
253
+ $( '#table_contents' ).delegate( 'textarea', 'click', call_media_library_thickbox );
254
return false;
255
+ } );
256
257
// not all characters allowed for name of Custom Data Field
258
+ $( '#insert_custom_field_name' ).keyup( function() {
259
$(this).val( $(this).val().toLowerCase().replace(/[^a-z0-9_-]/g, '') );
260
} );
261
262
// remove/add title on focus/blur
263
+ $( '.focus-blur-change' ).focus( function() {
264
if ( $(this).attr('title') == $(this).val() )
265
$(this).val( '' );
266
} )
267
+ .blur( function() {
268
if ( '' == $(this).val() )
269
$(this).val( $(this).attr('title') );
270
} );
271
272
+ $( '#table_custom_fields' ).delegate( 'textarea', 'focus', function() {
273
$( '#table_custom_fields .focus' ).removeClass('focus');
274
$(this).addClass('focus');
275
} );
276
277
// confirmation of certain actions
278
+ $( 'input.bulk_copy_tables' ).click( function() {
279
return confirm( WP_Table_Reloaded_Admin.str_BulkCopyTablesLink );
280
} );
281
282
+ $( 'input.bulk_delete_tables' ).click( function() {
283
return confirm( WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink );
284
} );
285
286
+ $( 'input.bulk_wp_table_import_tables' ).click( function() {
287
return confirm( WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink );
288
} );
289
290
+ $( 'a.copy_table_link' ).click( function() {
291
return confirm( WP_Table_Reloaded_Admin.str_CopyTableLink );
292
} );
293
294
+ $( '#wp-table-reloaded-list a.delete_table_link' ).click( function() {
295
return confirm( WP_Table_Reloaded_Admin.str_DeleteTableLink );
296
} );
297
298
+ $( '#button-delete-rows' ).click( function() {
299
var rows_cb = $( '#table_contents tr:not(".table-foot") :checkbox' ).length - 1; // -1 because of invisible checkbox in .table-head
300
var rows_selected = $( '#table_contents tr:not(".table-foot") :checked' ).length;
301
307
alert( WP_Table_Reloaded_Admin.str_DeleteRowsFailedNotAll );
308
return false;
309
} else {
310
+ return confirm( WP_Table_Reloaded_Admin.str_DeleteRowsConfirm );
311
}
312
}
313
} );
314
315
+ $( '#button-delete-columns' ).click( function() {
316
var cols_cb = $( '#table_contents .table-foot :checkbox' ).length;
317
var cols_selected = $( '#table_contents .table-foot :checked' ).length;
318
324
alert( WP_Table_Reloaded_Admin.str_DeleteColsFailedNotAll );
325
return false;
326
} else {
327
+ return confirm( WP_Table_Reloaded_Admin.str_DeleteColsConfirm );
328
}
329
}
330
} );
331
332
+ $( 'a.import_wptable_link' ).click( function() {
333
return confirm( WP_Table_Reloaded_Admin.str_ImportwpTableLink );
334
} );
335
336
+ $( '#import_wp_table_reloaded_dump_file' ).click( function() {
337
return confirm( WP_Table_Reloaded_Admin.str_ImportDumpFile );
338
} );
339
340
+ $( '#uninstall_plugin_link' ).click( function() {
341
if ( confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_1 ) )
342
return confirm( WP_Table_Reloaded_Admin.str_UninstallPluginLink_2 );
343
else
344
return false;
345
} );
346
347
+ $( 'a.cf_shortcode_link' ).click( function() {
348
var dummy = prompt( WP_Table_Reloaded_Admin.str_CFShortcodeMessage, $(this).attr('title') );
349
return false;
350
} );
351
352
+ $( 'a.table_shortcode_link' ).click( function() {
353
var dummy = prompt( WP_Table_Reloaded_Admin.str_TableShortcodeMessage, $(this).attr('title') );
354
return false;
355
} );
360
} );
361
362
// exit message, if table content was changed but not yet saved
363
+ function set_table_data_changed() {
364
+ if ( ! WP_Table_Reloaded_Admin.option_show_exit_warning )
365
+ return;
366
+
367
+ window.onbeforeunload = function() {
368
+ return WP_Table_Reloaded_Admin.str_saveAlert;
369
+ };
370
+ $( '#wp_table_reloaded_edit_table' ).undelegate( '#table_name, textarea, .wp-table-reloaded-options input, .wp-table-reloaded-options select', 'change', set_table_data_changed ); // see also ID change function above
371
+ }
372
373
if ( WP_Table_Reloaded_Admin.option_show_exit_warning ) {
374
+ $( '#wp_table_reloaded_edit_table' ).delegate( '#table_name, textarea, .wp-table-reloaded-options input, .wp-table-reloaded-options select', 'change', set_table_data_changed ); // see also ID change function above
375
+ $( '#wp_table_reloaded_edit_table' ).find( 'input[name="submit[update]"], input[name="submit[save_back]"]' ).click(function(){
376
window.onbeforeunload = null;
377
} );
378
}
379
+
380
+ // enable disabled fields, so that they are transmitted in the POST request
381
+ $( '#wp_table_reloaded_edit_table' ).find( 'input[name="submit[update]"], input[name="submit[save_back]"]' ).click(function(){
382
+ $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options' ).find( 'input, select' ).removeAttr( 'disabled' );
383
+ } );
384
+
385
tb_init( 'a.help-link' );
386
tb_init( 'a.preview-link' );
387
tb_my_position();
404
tb_my_position = function() {
405
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0;
406
407
+ if ( $('body.admin-bar').length )
408
+ adminbar_height = 28;
409
410
if ( tbWindow.size() ) {
411
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height );
admin/admin-script.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(d){d("#a-hide-rows").click(function(){var m=d('#table_contents tr:not(".table-foot") :checked').length;if(m==0){alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection)}else{d('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(true).parents("tr").addClass("row-hidden");e()}return false});d("#a-unhide-rows").click(function(){var m=d('#table_contents tr:not(".table-foot") :checked').length;if(m==0){alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection)}else{d('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(false).parents("tr").removeClass("row-hidden");e()}return false});d("#a-hide-columns").click(function(){var m=d("#table_contents .table-foot :checked").length;if(m==0){alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection)}else{d("#table_contents .table-foot :checked").removeAttr("checked").next().val(true).each(function(){d("#table_contents ."+d(this).attr("id")).addClass("column-hidden")});e()}return false});d("#a-unhide-columns").click(function(){var m=d("#table_contents .table-foot :checked").length;if(m==0){alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection)}else{d("#table_contents .table-foot :checked").removeAttr("checked").next().val(false).each(function(){d("#table_contents ."+d(this).attr("id")).removeClass("column-hidden")});e()}return false});d("#button-insert-rows").click(function(){var m=d('#table_contents tr:not(".table-foot") :checked').length;if(m==0){alert(WP_Table_Reloaded_Admin.str_InsertRowsNoSelection);return false}else{return true}});d("#button-insert-columns").click(function(){var m=d("#table_contents .table-foot :checked").length;if(m==0){alert(WP_Table_Reloaded_Admin.str_InsertColsNoSelection);return false}else{return true}});var c="";function a(){d(this).val(c);d("#table_contents textarea").unbind("click",a);e()}d("#a-add-colspan").click(function(){c="#colspan#";if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationAddColspan)){d("#table_contents textarea").bind("click",a)}return false});d("#a-add-rowspan").click(function(){c="#rowspan#";if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationAddRowspan)){d("#table_contents textarea").bind("click",a)}return false});var g=null;if(WP_Table_Reloaded_Admin.option_growing_textareas){d("#table_contents textarea").focus(function(){d(g).removeClass("focus");g=d(this).parents("tr").find("textarea");d(g).addClass("focus")})}function i(){d("#options_custom_css").addClass("focus")}d("#options_custom_css").one("focus",i);d("#export_format").change(function(){if("csv"==d(this).val()){d(".tr-export-delimiter").show()}else{d(".tr-export-delimiter").hide()}}).change();var j=d(".wp-table-reloaded-table-information #table_id").val();d(".wp-table-reloaded-table-information #table_id").change(function(){if(j!=d(this).val()){if(confirm(WP_Table_Reloaded_Admin.str_ChangeTableID)){j=d(this).val();e()}else{d(this).val(j)}}});d(".tr-import-addreplace input").click(function(){if("replace"==d(".tr-import-addreplace input:checked").val()){d(".tr-import-addreplace-table").show()}else{d(".tr-import-addreplace-table").hide()}});d(".tr-import-addreplace input:checked").click();d(".tr-import-from input").click(function(){d(".tr-import-file-upload, .tr-import-url, .tr-import-form-field, .tr-import-server").hide();d(".tr-import-"+d(".tr-import-from input:checked").val()).show()});d(".tr-import-from input:checked").click();d("#options_use_custom_css").change(function(){if(d(this).attr("checked")){d("#options_custom_css").removeAttr("disabled")}else{d("#options_custom_css").attr("disabled","disabled")}});d("#options_enable_tablesorter").change(function(){if(d(this).attr("checked")){d("#options_tablesorter_script").removeAttr("disabled")}else{d("#options_tablesorter_script").attr("disabled","disabled")}});if(WP_Table_Reloaded_Admin.option_tablesorter_enabled&&WP_Table_Reloaded_Admin.option_datatables_active){d("#table_options_first_row_th").change(function(){if(d(this).attr("checked")){d("#table_options_use_tablesorter").removeAttr("disabled");if(d("#table_options_use_tablesorter").attr("checked")){d(".wp-table-reloaded-datatables-options input").removeAttr("disabled");if(!WP_Table_Reloaded_Admin.option_tabletools_active){d("#table_options_datatables_tabletools").attr("disabled","disabled")}}}else{d("#table_options_use_tablesorter").attr("disabled","disabled");d(".wp-table-reloaded-datatables-options input").attr("disabled","disabled")}});d("#table_options_use_tablesorter").change(function(){if(d(this).attr("checked")){d(".wp-table-reloaded-datatables-options input").removeAttr("disabled");if(!WP_Table_Reloaded_Admin.option_tabletools_active){d("#table_options_datatables_tabletools").attr("disabled","disabled")}if(!d("#table_options_datatables_paginate").attr("checked")){d("#table_options_datatables_paginate_entries").attr("disabled","disabled")}}else{d(".wp-table-reloaded-datatables-options input").attr("disabled","disabled")}});d("#table_options_datatables_paginate").change(function(){if(d(this).attr("checked")){d("#table_options_datatables_paginate_entries").removeAttr("disabled")}else{d("#table_options_datatables_paginate_entries").attr("disabled","disabled")}})}else{if(WP_Table_Reloaded_Admin.option_tablesorter_enabled){d("#table_options_first_row_th").change(function(){if(d(this).attr("checked")){d("#table_options_use_tablesorter").removeAttr("disabled")}else{d("#table_options_use_tablesorter").attr("disabled","disabled")}})}}d("#table_options_print_name").change(function(){if(d(this).attr("checked")){d("#table_options_print_name_position").removeAttr("disabled")}else{d("#table_options_print_name_position").attr("disabled","disabled")}});d("#table_options_print_description").change(function(){if(d(this).attr("checked")){d("#table_options_print_description_position").removeAttr("disabled")}else{d("#table_options_print_description_position").attr("disabled","disabled")}});d("#options_uninstall_upon_deactivation").click(function(){if(d(this).attr("checked")){return confirm(WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation)}});var k="";function f(){d(this).val(d(this).val()+k);d("#table_contents textarea").unbind("click",f);e()}d("#a-insert-link").click(function(){var o="";if(WP_Table_Reloaded_Admin.option_add_target_blank_to_links){o=' target="_blank"'}var n=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL+":","http://");if(n){var m=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText+":",WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText);if(m){k='<a href="'+n+'"'+o+">"+m+"</a>";k=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain,k);if(k){d("#table_contents textarea").bind("click",f)}}}return false});function b(){edCanvas=this;d("#table_contents textarea").unbind("click",b);var m=d("#a-insert-image");tb_show(m.attr("title"),m.attr("href"),m.attr("rel"));tb_my_position();d(this).blur();e()}function h(){if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox)){d("#table_contents textarea").bind("click",b)}return false}d("#a-insert-image").bind("click",h);d("#insert_custom_field_name").keyup(function(){d(this).val(d(this).val().toLowerCase().replace(/[^a-z0-9_-]/g,""))});d(".focus-blur-change").focus(function(){if(d(this).attr("title")==d(this).val()){d(this).val("")}}).blur(function(){if(""==d(this).val()){d(this).val(d(this).attr("title"))}});d("#table_custom_fields textarea").focus(function(){d("#table_custom_fields .focus").removeClass("focus");d(this).addClass("focus")});d("input.bulk_copy_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkCopyTablesLink)});d("input.bulk_delete_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink)});d("input.bulk_wp_table_import_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink)});d("a.copy_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_CopyTableLink)});d('#wp-table-reloaded-list a.delete_table_link').click(function(){return confirm(WP_Table_Reloaded_Admin.str_DeleteTableLink);});d("#button-delete-rows").click(function(){var n=d('#table_contents tr:not(".table-foot") :checkbox').length-1;var m=d('#table_contents tr:not(".table-foot") :checked').length;if(m==0){alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNoSelection);return false}else{if(n==m){alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNotAll);return false}else{return confirm(WP_Table_Reloaded_Admin.str_DeleteRowsConfirm)}}});d("#button-delete-columns").click(function(){var m=d("#table_contents .table-foot :checkbox").length;var n=d("#table_contents .table-foot :checked").length;if(n==0){alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNoSelection);return false}else{if(m==n){alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNotAll);return false}else{return confirm(WP_Table_Reloaded_Admin.str_DeleteColsConfirm)}}});d("a.import_wptable_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportwpTableLink)});d("#import_wp_table_reloaded_dump_file").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportDumpFile)});d("#uninstall_plugin_link").click(function(){if(confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_1)){return confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_2)}else{return false}});d("a.cf_shortcode_link").click(function(){var m=prompt(WP_Table_Reloaded_Admin.str_CFShortcodeMessage,d(this).attr("title"));return false});d("a.table_shortcode_link").click(function(){var m=prompt(WP_Table_Reloaded_Admin.str_TableShortcodeMessage,d(this).attr("title"));return false});d(".postbox h3, .postbox .handlediv").click(function(){d(d(this).parent().get(0)).toggleClass("closed")});var l=false;function e(){l=true;d("#wp_table_reloaded_edit_table").find("#table_name, textarea").unbind("change",e);d("#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select").unbind("change",e)}if(WP_Table_Reloaded_Admin.option_show_exit_warning){window.onbeforeunload=function(){if(l){return WP_Table_Reloaded_Admin.str_saveAlert}};d("#wp_table_reloaded_edit_table input[name='submit[update]'], #wp_table_reloaded_edit_table input[name='submit[save_back]']").click(function(){d("#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select").removeAttr("disabled");window.onbeforeunload=null});d("#wp_table_reloaded_edit_table").find("#table_name, textarea").bind("change",e);d("#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select").bind("change",e)}tb_init("a.help-link");tb_init("a.preview-link");tb_my_position()});function send_to_editor(a){jQuery(edCanvas).val(jQuery(edCanvas).val()+a);tb_remove()}var tb_my_position;(function(a){tb_my_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.preview-link").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_my_position()})})(jQuery);
1
+ jQuery(document).ready(function(c){c("#a-hide-rows").click(function(){var h=c('#table_contents tr:not(".table-foot") :checked').length;if(h==0){alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection)}else{c('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(true).parents("tr").addClass("row-hidden");a()}return false});c("#a-unhide-rows").click(function(){var h=c('#table_contents tr:not(".table-foot") :checked').length;if(h==0){alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection)}else{c('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(false).parents("tr").removeClass("row-hidden");a()}return false});c("#a-hide-columns").click(function(){var h=c("#table_contents .table-foot :checked").length;if(h==0){alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection)}else{c("#table_contents .table-foot :checked").removeAttr("checked").next().val(true).each(function(){c("#table_contents ."+this.id).addClass("column-hidden")});a()}return false});c("#a-unhide-columns").click(function(){var h=c("#table_contents .table-foot :checked").length;if(h==0){alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection)}else{c("#table_contents .table-foot :checked").removeAttr("checked").next().val(false).each(function(){c("#table_contents ."+c(this).attr("id")).removeClass("column-hidden")});a()}return false});c("#button-insert-rows").click(function(){var h=c('#table_contents tr:not(".table-foot") :checked').length;if(h==0){alert(WP_Table_Reloaded_Admin.str_InsertRowsNoSelection);return false}else{return true}});c("#button-insert-columns").click(function(){var h=c("#table_contents .table-foot :checked").length;if(h==0){alert(WP_Table_Reloaded_Admin.str_InsertColsNoSelection);return false}else{return true}});function e(h){c(this).val(h.data.span_type);c("#table_contents").undelegate("textarea","click",e);a()}c("#a-add-colspan").click(function(){if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationAddColspan)){c("#table_contents").delegate("textarea","click",{span_type:"#colspan#"},e)}return false});c("#a-add-rowspan").click(function(){if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationAddRowspan)){c("#table_contents").delegate("textarea","click",{span_type:"#rowspan#"},e)}return false});var d=c(null);if(WP_Table_Reloaded_Admin.option_growing_textareas){c("#table_contents").delegate("textarea","focus",function(){d.removeClass("focus");d=c(this).closest("tr").addClass("focus")})}c("#options_custom_css").one("focus",function(){c(this).addClass("focus")});c("#export_format").change(function(){if("csv"==c(this).val()){c(".tr-export-delimiter").show()}else{c(".tr-export-delimiter").hide()}}).change();var g=c(".wp-table-reloaded-table-information #table_id").val();c(".wp-table-reloaded-table-information #table_id").change(function(){if(g!=c(this).val()){if(confirm(WP_Table_Reloaded_Admin.str_ChangeTableID)){g=c(this).val();a()}else{c(this).val(g)}}});c(".tr-import-addreplace input").click(function(){if("replace"==c(".tr-import-addreplace input:checked").val()){c(".tr-import-addreplace-table").show()}else{c(".tr-import-addreplace-table").hide()}});c(".tr-import-addreplace input:checked").click();c(".tr-import-from input").click(function(){c(".tr-import-file-upload, .tr-import-url, .tr-import-form-field, .tr-import-server").hide();c(".tr-import-"+c(".tr-import-from input:checked").val()).show()});c(".tr-import-from input:checked").click();c("#options_use_custom_css").change(function(){if(c(this).attr("checked")){c("#options_custom_css").removeAttr("disabled")}else{c("#options_custom_css").attr("disabled","disabled")}});c("#options_enable_tablesorter").change(function(){if(c(this).attr("checked")){c("#options_tablesorter_script").removeAttr("disabled")}else{c("#options_tablesorter_script").attr("disabled","disabled")}});if(WP_Table_Reloaded_Admin.option_tablesorter_enabled&&WP_Table_Reloaded_Admin.option_datatables_active){c("#table_options_first_row_th").change(function(){if(c(this).attr("checked")){c("#table_options_use_tablesorter").removeAttr("disabled").change()}else{c("#table_options_use_tablesorter").attr("disabled","disabled");c(".wp-table-reloaded-datatables-options input").attr("disabled","disabled")}});c("#table_options_use_tablesorter").change(function(){if(c(this).attr("checked")){c(".wp-table-reloaded-datatables-options input").removeAttr("disabled");if(!WP_Table_Reloaded_Admin.option_tabletools_active){c("#table_options_datatables_tabletools").attr("disabled","disabled")}c("#table_options_datatables_paginate").change()}else{c(".wp-table-reloaded-datatables-options input").attr("disabled","disabled")}});c("#table_options_datatables_paginate").change(function(){if(c(this).attr("checked")){c("#table_options_datatables_paginate_entries").removeAttr("disabled")}else{c("#table_options_datatables_paginate_entries").attr("disabled","disabled")}})}else{if(WP_Table_Reloaded_Admin.option_tablesorter_enabled){c("#table_options_first_row_th").change(function(){if(c(this).attr("checked")){c("#table_options_use_tablesorter").removeAttr("disabled")}else{c("#table_options_use_tablesorter").attr("disabled","disabled")}})}}c("#table_options_print_name, #table_options_print_description").change(function(){if(c(this).attr("checked")){c("#"+this.id+"_position").removeAttr("disabled")}else{c("#"+this.id+"_position").attr("disabled","disabled")}});c("#options_uninstall_upon_deactivation").click(function(){if(c(this).attr("checked")){return confirm(WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation)}});function b(h){c(this).val(c(this).val()+h.data.html);c("#table_contents").undelegate("textarea","click",b);a()}c("#a-insert-link").click(function(){var i=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL+":","http://");if(i){var h=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText+":",WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText);if(h){var k="";if(WP_Table_Reloaded_Admin.option_add_target_blank_to_links){k=' target="_blank"'}var j='<a href="'+i+'"'+k+">"+h+"</a>";j=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain,j);if(j){c("#table_contents").delegate("textarea","click",{html:j},b)}}}return false});function f(){edCanvas=this;c("#table_contents").undelegate("textarea","click",f);var h=c("#a-insert-image");tb_show(h.attr("title"),h.attr("href"),false);tb_my_position();c(this).blur();a()}c("#a-insert-image").click(function(){if(confirm(WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox)){c("#table_contents").delegate("textarea","click",f)}return false});c("#insert_custom_field_name").keyup(function(){c(this).val(c(this).val().toLowerCase().replace(/[^a-z0-9_-]/g,""))});c(".focus-blur-change").focus(function(){if(c(this).attr("title")==c(this).val()){c(this).val("")}}).blur(function(){if(""==c(this).val()){c(this).val(c(this).attr("title"))}});c("#table_custom_fields").delegate("textarea","focus",function(){c("#table_custom_fields .focus").removeClass("focus");c(this).addClass("focus")});c("input.bulk_copy_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkCopyTablesLink)});c("input.bulk_delete_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink)});c("input.bulk_wp_table_import_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink)});c("a.copy_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_CopyTableLink)});c("#wp-table-reloaded-list a.delete_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_DeleteTableLink)});c("#button-delete-rows").click(function(){var i=c('#table_contents tr:not(".table-foot") :checkbox').length-1;var h=c('#table_contents tr:not(".table-foot") :checked').length;if(h==0){alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNoSelection);return false}else{if(i==h){alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNotAll);return false}else{return confirm(WP_Table_Reloaded_Admin.str_DeleteRowsConfirm)}}});c("#button-delete-columns").click(function(){var h=c("#table_contents .table-foot :checkbox").length;var i=c("#table_contents .table-foot :checked").length;if(i==0){alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNoSelection);return false}else{if(h==i){alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNotAll);return false}else{return confirm(WP_Table_Reloaded_Admin.str_DeleteColsConfirm)}}});c("a.import_wptable_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportwpTableLink)});c("#import_wp_table_reloaded_dump_file").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportDumpFile)});c("#uninstall_plugin_link").click(function(){if(confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_1)){return confirm(WP_Table_Reloaded_Admin.str_UninstallPluginLink_2)}else{return false}});c("a.cf_shortcode_link").click(function(){var h=prompt(WP_Table_Reloaded_Admin.str_CFShortcodeMessage,c(this).attr("title"));return false});c("a.table_shortcode_link").click(function(){var h=prompt(WP_Table_Reloaded_Admin.str_TableShortcodeMessage,c(this).attr("title"));return false});c(".postbox h3, .postbox .handlediv").click(function(){c(c(this).parent().get(0)).toggleClass("closed")});function a(){if(!WP_Table_Reloaded_Admin.option_show_exit_warning){return}window.onbeforeunload=function(){return WP_Table_Reloaded_Admin.str_saveAlert};c("#wp_table_reloaded_edit_table").undelegate("#table_name, textarea, .wp-table-reloaded-options input, .wp-table-reloaded-options select","change",a)}if(WP_Table_Reloaded_Admin.option_show_exit_warning){c("#wp_table_reloaded_edit_table").delegate("#table_name, textarea, .wp-table-reloaded-options input, .wp-table-reloaded-options select","change",a);c("#wp_table_reloaded_edit_table").find('input[name="submit[update]"], input[name="submit[save_back]"]').click(function(){window.onbeforeunload=null})}c("#wp_table_reloaded_edit_table").find('input[name="submit[update]"], input[name="submit[save_back]"]').click(function(){c("#wp_table_reloaded_edit_table .wp-table-reloaded-options").find("input, select").removeAttr("disabled")});tb_init("a.help-link");tb_init("a.preview-link");tb_my_position()});function send_to_editor(a){jQuery(edCanvas).val(jQuery(edCanvas).val()+a);tb_remove()}var tb_my_position;(function(a){tb_my_position=function(){var f=a("#TB_window"),e=a(window).width(),d=a(window).height(),c=(720<e)?720:e,b=0;if(a("body.admin-bar").length){b=28}if(f.size()){f.width(c-50).height(d-45-b);a("#TB_iframeContent").width(c-50).height(d-75-b);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:20+b+"px","margin-top":"0"})}}return a("a.preview-link").each(function(){var g=a(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");a(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85-b))})};a(window).resize(function(){tb_my_position()})})(jQuery);
admin/admin-style.css CHANGED
@@ -1 +1 @@
1
- #icon-wp-table-reloaded{background:transparent url('plugin-icon.png') no-repeat;}#wp-table-reloaded-list .table-id{font-size:12px;font-weight:bold;text-shadow:rgba(255,255,255,0.8) 0 1px 0;}#wp-table-reloaded-list .sorting,#wp-table-reloaded-list .sorting_asc,#wp-table-reloaded-list .sorting_desc{cursor:pointer;white-space:nowrap;}#wp-table-reloaded-list .sorting span{background-repeat:no-repeat;background-position:center;background-image:url('../img/bg.gif');margin-right:-5px;}#wp-table-reloaded-list .sorting_asc span{background-repeat:no-repeat;background-position:center;background-image:url('../img/asc.gif');}#wp-table-reloaded-list .sorting_desc span{background-repeat:no-repeat;background-position:center;background-image:url('../img/desc.gif');}#wp-table-reloaded-list .check-column{width:24px!important;padding:7px 7px 8px 0!important;text-align:right;}#wp-table-reloaded-list{margin-top:10px;margin-bottom:10px;}#table_contents .row-hidden td,#table_contents .row-hidden th,#table_contents .row-hidden textarea,#table_contents .column-hidden,#table_contents .column-hidden textarea{background-color:#FFE0E0;}#table_contents .focus{height:84px;}#options_custom_css{width:600px;height:100px;}#options_custom_css.focus{height:300px;}.wp-table-reloaded-table-information td{padding:5px 0 5px 0;width:90%;}.wp-table-reloaded-newtable td{padding:5px 0 5px 0;width:85%;}.wp-table-reloaded-table-information th{font-weight:normal;text-align:left;padding:5px 10px 5px 0;vertical-align:middle;width:10%;min-width:130px;}.wp-table-reloaded-newtable,.wp-table-reloaded-table-information,.wp-table-reloaded-table-information input,.wp-table-reloaded-table-information textarea{width:100%;}.wp-table-reloaded-options td{padding:5px 0 5px 0;}.wp-table-reloaded-options th{font-weight:normal;text-align:left;padding:5px 10px 5px 0;vertical-align:middle;}.wp-table-reloaded-data-manipulation{width:100%;}.wp-table-reloaded-data-manipulation td{padding-top:7px!important;padding-bottom:7px!important;line-height:2.2em;}.widefat td{vertical-align:baseline!important;}.postbox .inside p{line-height:1.2!important;}#table_custom_fields td{vertical-align:middle!important;}#table_contents td{white-space:nowrap;vertical-align:middle!important;}#table_contents th{white-space:nowrap;vertical-align:middle!important;text-align:center;font-family:sans-serif;font-weight:bold;font-size:12px;color:#555;}#table_contents textarea{min-width:180px;width:100%;}#table_contents .table-head td,#table_contents .table-foot td{padding:7px 7px 8px;line-height:1.3em;text-align:center;text-shadow:rgba(255,255,255,0.8) 0 1px 0;font-weight:bold;}#table_contents .check-column{font-weight:bold;padding:0px 5px!important;text-align:right;}#table_contents .table-foot .check-column{width: auto!important;}.no-wrap{white-space:nowrap;}.hide_link,.expand_link{position:absolute;right:10px;font-weight:normal;cursor:pointer;padding:0!important;}#uninstall_plugin_link{color:#BC0B0B;}.postbox h3.hndle{cursor:pointer!important;}div.postbox .expand_link{display:none;}div.closed .expand_link{display:inline!important;}div.closed .hide_link{display:none;}#TB_ajaxContent .wp-table-reloaded{border-collapse:separate;border-spacing:1px;background-color:#CDCDCD;margin:10px 0 15px 0;font-size:8pt;width:100%;text-align:left;}#TB_ajaxContent .wp-table-reloaded th{background-color:#E6EEEE;border:1px solid #FFF;padding:4px;}#TB_ajaxContent .wp-table-reloaded td{color:#3D3D3D;padding:4px;background-color:#FFF;vertical-align:top;}#TB_ajaxContent .wp-table-reloaded .even td{background-color:#FFF;}#TB_ajaxContent .wp-table-reloaded .odd td{background-color:#F0F0F6;}#TB_ajaxContent .wp-table-reloaded .row-hover tr:hover td{background-color:#D0D0D6;}.dataTables_wrapper{clear:both;position:relative;zoom:1;}.dataTables_processing{position:absolute;top:0;left:50%;width:250px;margin-left:-125px;border:1px solid #ddd;text-align:center;color:#999;font-size:11px;padding:2px 0;}.dataTables_length{width:50%;float:left;}.dataTables_filter{width:45%;float:right;text-align:right;}.dataTables_info{width:60%;float:left;}.dataTables_paginate{width:44px;* width:50px;float:right;text-align:right;}.paging_full_numbers{width:400px;height:22px;line-height:22px;}.paging_full_numbers span.paginate_button,.paging_full_numbers span.paginate_active{border:1px solid #aaa;-webkit-border-radius:5px;-moz-border-radius:5px;padding:2px 5px;margin:0 3px;cursor:pointer;*cursor:hand;}.paging_full_numbers span.paginate_button{background-color:#ddd;}.paging_full_numbers span.paginate_button:hover{background-color:#ccc;}.paging_full_numbers span.paginate_active{background-color:#99B3FF;}
1
+ #icon-wp-table-reloaded{background:transparent url('plugin-icon.png') no-repeat;}#wp-table-reloaded-list .table-id{font-size:12px;font-weight:bold;text-shadow:rgba(255,255,255,0.8) 0 1px 0;}#wp-table-reloaded-list .sorting,#wp-table-reloaded-list .sorting_asc,#wp-table-reloaded-list .sorting_desc{cursor:pointer;white-space:nowrap;}#wp-table-reloaded-list .sorting span{background-repeat:no-repeat;background-position:center;background-image:url('../img/bg.gif');margin-right:-5px;}#wp-table-reloaded-list .sorting_asc span{background-repeat:no-repeat;background-position:center;background-image:url('../img/asc.gif');}#wp-table-reloaded-list .sorting_desc span{background-repeat:no-repeat;background-position:center;background-image:url('../img/desc.gif');}#wp-table-reloaded-list .check-column{width:24px!important;padding:7px 7px 8px 0!important;text-align:right;}#wp-table-reloaded-list{margin-top:10px;margin-bottom:10px;}#table_contents .row-hidden td,#table_contents .row-hidden th,#table_contents .row-hidden textarea,#table_contents .column-hidden,#table_contents .column-hidden textarea{background-color:#FFE0E0;}#table_contents .focus textarea{min-height:84px;}#table_custom_fields .focus{min-height:54px;}#options_custom_css{width:600px;height:100px;}#options_custom_css.focus{height:300px;}.wp-table-reloaded-table-information td{padding:5px 0 5px 0;width:90%;}.wp-table-reloaded-newtable td{padding:5px 0 5px 0;width:85%;}.wp-table-reloaded-table-information th{font-weight:normal;text-align:left;padding:5px 10px 5px 0;vertical-align:middle;width:10%;min-width:130px;}.wp-table-reloaded-newtable,.wp-table-reloaded-table-information,.wp-table-reloaded-table-information input,.wp-table-reloaded-table-information textarea{width:100%;}.wp-table-reloaded-options td{padding:5px 0 5px 0;}.wp-table-reloaded-options th{font-weight:normal;text-align:left;padding:5px 10px 5px 0;vertical-align:middle;}.wp-table-reloaded-data-manipulation{width:100%;}.wp-table-reloaded-data-manipulation td{padding-top:7px!important;padding-bottom:7px!important;line-height:2.2em;}.widefat td{vertical-align:baseline!important;}.postbox .inside p{line-height:1.2!important;}#table_custom_fields td{vertical-align:middle!important;}#table_contents td{white-space:nowrap;vertical-align:middle!important;}#table_contents th{white-space:nowrap;vertical-align:middle!important;text-align:center;font-family:sans-serif;font-weight:bold;font-size:12px;color:#555;}#table_contents textarea{min-width:180px;min-height:24px;width:100%;height:100%;}#table_contents .table-head td,#table_contents .table-foot td{padding:7px 7px 8px;line-height:1.3em;text-align:center;text-shadow:rgba(255,255,255,0.8) 0 1px 0;font-weight:bold;}#table_contents .check-column{font-weight:bold;padding:0px 5px!important;text-align:right;}#table_contents .table-foot .check-column{width: auto!important;}.no-wrap{white-space:nowrap;}.hide_link,.expand_link{position:absolute;right:10px;font-weight:normal;cursor:pointer;padding:0!important;}#uninstall_plugin_link{color:#BC0B0B;}.postbox h3.hndle{cursor:pointer!important;}div.postbox .expand_link{display:none;}div.closed .expand_link{display:inline!important;}div.closed .hide_link{display:none;}#TB_ajaxContent .wp-table-reloaded{border-collapse:separate;border-spacing:1px;background-color:#CDCDCD;margin:10px 0 15px 0;font-size:8pt;width:100%;text-align:left;}#TB_ajaxContent .wp-table-reloaded th{background-color:#E6EEEE;border:1px solid #FFF;padding:4px;}#TB_ajaxContent .wp-table-reloaded td{color:#3D3D3D;padding:4px;background-color:#FFF;vertical-align:top;}#TB_ajaxContent .wp-table-reloaded .even td{background-color:#FFF;}#TB_ajaxContent .wp-table-reloaded .odd td{background-color:#F0F0F6;}#TB_ajaxContent .wp-table-reloaded .row-hover tr:hover td{background-color:#D0D0D6;}.dataTables_wrapper{clear:both;position:relative;zoom:1;}.dataTables_processing{position:absolute;top:0;left:50%;width:250px;margin-left:-125px;border:1px solid #ddd;text-align:center;color:#999;font-size:11px;padding:2px 0;}.dataTables_length{width:50%;float:left;}.dataTables_filter{width:45%;float:right;text-align:right;}.dataTables_info{width:60%;float:left;}.dataTables_paginate{width:44px;* width:50px;float:right;text-align:right;}.paging_full_numbers{width:400px;height:22px;line-height:22px;}.paging_full_numbers span.paginate_button,.paging_full_numbers span.paginate_active{border:1px solid #aaa;-webkit-border-radius:5px;-moz-border-radius:5px;padding:2px 5px;margin:0 3px;cursor:pointer;*cursor:hand;}.paging_full_numbers span.paginate_button{background-color:#ddd;}.paging_full_numbers span.paginate_button:hover{background-color:#ccc;}.paging_full_numbers span.paginate_active{background-color:#99B3FF;}
admin/admin-style.dev.css CHANGED
@@ -51,8 +51,12 @@
51
background-color:#FFE0E0;
52
}
53
54
- #table_contents .focus {
55
- height:84px;
56
}
57
58
#options_custom_css {
@@ -136,7 +140,9 @@
136
137
#table_contents textarea {
138
min-width:180px;
139
width:100%;
140
}
141
142
#table_contents .table-head td, #table_contents .table-foot td {
51
background-color:#FFE0E0;
52
}
53
54
+ #table_contents .focus textarea {
55
+ min-height:84px;
56
+ }
57
+
58
+ #table_custom_fields .focus {
59
+ min-height:54px;
60
}
61
62
#options_custom_css {
140
141
#table_contents textarea {
142
min-width:180px;
143
+ min-height:24px;
144
width:100%;
145
+ height:100%;
146
}
147
148
#table_contents .table-head td, #table_contents .table-foot td {
classes/export.class.php CHANGED
@@ -7,14 +7,14 @@
7
* @author Tobias B&auml;thge
8
* @since 0.9.2
9
*/
10
-
11
// should be included by WP_Table_Reloaded_Controller_Admin!
12
class WP_Table_Reloaded_Export {
13
14
// ###################################################################################################################
15
var $export_formats = array();
16
var $delimiters = array();
17
-
18
var $export_format = '';
19
var $delimiter = ';';
20
var $table_to_export = array();
@@ -41,12 +41,13 @@ class WP_Table_Reloaded_Export {
41
// ###################################################################################################################
42
function export_table() {
43
$output = '';
44
-
45
$data = $this->table_to_export['data'];
46
-
47
$rows = count( $data );
48
$cols = (0 < $rows) ? count( $data[0] ) : 0;
49
-
50
switch( $this->export_format ) {
51
case 'csv':
52
if ( 0 < $rows && 0 < $cols) {
@@ -88,7 +89,6 @@ class WP_Table_Reloaded_Export {
88
89
// ###################################################################################################################
90
function xml_wrap_and_escape( $string ) {
91
- $string = stripslashes( $string );
92
if ( $string != htmlspecialchars( $string ) )
93
$string = "<![CDATA[{$string}]]>";
94
return "\t\t<col>" . $string . "</col>\n";
@@ -96,7 +96,6 @@ class WP_Table_Reloaded_Export {
96
97
// ###################################################################################################################
98
function html_wrap_and_escape( $string ) {
99
- $string = stripslashes( $string );
100
return "\t\t<td>" . $string . "</td>\n";
101
}
102
7
* @author Tobias B&auml;thge
8
* @since 0.9.2
9
*/
10
+
11
// should be included by WP_Table_Reloaded_Controller_Admin!
12
class WP_Table_Reloaded_Export {
13
14
// ###################################################################################################################
15
var $export_formats = array();
16
var $delimiters = array();
17
+
18
var $export_format = '';
19
var $delimiter = ';';
20
var $table_to_export = array();
41
// ###################################################################################################################
42
function export_table() {
43
$output = '';
44
+
45
$data = $this->table_to_export['data'];
46
+ $data = stripslashes_deep( $data );
47
+
48
$rows = count( $data );
49
$cols = (0 < $rows) ? count( $data[0] ) : 0;
50
+
51
switch( $this->export_format ) {
52
case 'csv':
53
if ( 0 < $rows && 0 < $cols) {
89
90
// ###################################################################################################################
91
function xml_wrap_and_escape( $string ) {
92
if ( $string != htmlspecialchars( $string ) )
93
$string = "<![CDATA[{$string}]]>";
94
return "\t\t<col>" . $string . "</col>\n";
96
97
// ###################################################################################################################
98
function html_wrap_and_escape( $string ) {
99
return "\t\t<td>" . $string . "</td>\n";
100
}
101
classes/helper.class.php CHANGED
@@ -37,11 +37,11 @@ class WP_Table_Reloaded_Helper {
37
}
38
// ###################################################################################################################
39
function get_contextual_help_string() {
40
- $help = sprintf( __( 'More information about WP-Table Reloaded can be found on the <a href="%s">plugin\'s website</a> or on its page in the <a href="%s">WordPress Plugin Directory</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/website/', 'http://wordpress.org/extend/plugins/wp-table-reloaded/' );
41
$help .= ' ' . sprintf( __( 'For technical information, see the <a href="%s">documentation</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/documentation/' );
42
$help .= '<br/>' . sprintf( __( '<a href="%s">Support</a> is provided through the <a href="%s">WordPress Support Forums</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/support/', 'http://www.wordpress.org/support/' );
43
$help .= ' ' . sprintf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a> where you will find answered to the most common questions, and search through the forums.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/faq/' );
44
- $help .= '<br/>' . sprintf( __( 'If you like the plugin, <a href="%s"><strong>a donation</strong></a> is recommended.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/donate/' );
45
return $help;
46
}
47
37
}
38
// ###################################################################################################################
39
function get_contextual_help_string() {
40
+ $help = '<p>' . sprintf( __( 'More information about WP-Table Reloaded can be found on the <a href="%s">plugin\'s website</a> or on its page in the <a href="%s">WordPress Plugin Directory</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/website/', 'http://wordpress.org/extend/plugins/wp-table-reloaded/' );
41
$help .= ' ' . sprintf( __( 'For technical information, see the <a href="%s">documentation</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/documentation/' );
42
$help .= '<br/>' . sprintf( __( '<a href="%s">Support</a> is provided through the <a href="%s">WordPress Support Forums</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/support/', 'http://www.wordpress.org/support/' );
43
$help .= ' ' . sprintf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a> where you will find answered to the most common questions, and search through the forums.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/faq/' );
44
+ $help .= '<br/>' . sprintf( __( 'If you like the plugin, <a href="%s"><strong>a donation</strong></a> is recommended.', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/donate/' ) . '</p>';
45
return $help;
46
}
47
classes/render.class.php CHANGED
@@ -136,11 +136,20 @@ class WP_Table_Reloaded_Render {
136
137
$tbody_class = ( $this->output_options['row_hover'] ) ? ' class="row-hover"' : '';
138
139
- $caption = '';
140
- if ( !empty( $this->output_options['edit_table_url'] ) ) {
141
- $edit_table_link = "<a href=\"{$this->output_options['edit_table_url']}\" title=\"" . __( 'Edit', 'default' ) . "\">" . __( 'Edit', 'default' ) . "</a>";
142
- $caption = "<caption style=\"caption-side: bottom; text-align: left; border:none; background: none;\">{$edit_table_link}</caption>\n";
143
- }
144
145
$colgroup = ( !empty( $colgroup ) ) ? "<colgroup>\n{$colgroup}</colgroup>\n" : '';
146
$thead = ( !empty( $thead ) ) ? "<thead>\n{$thead}</thead>\n" : '';
136
137
$tbody_class = ( $this->output_options['row_hover'] ) ? ' class="row-hover"' : '';
138
139
+ // <caption> tag
140
+ $caption = apply_filters( 'wp_table_reloaded_table_caption_arg', '', $table );
141
+ $caption_style = $caption_class = '';
142
+ if ( ! empty( $caption ) )
143
+ $caption_class = "wp-table-reloaded-table-caption wp-table-reloaded-table-caption-id-{$table['id']}";
144
+ if ( ! empty( $this->output_options['edit_table_url'] ) ) {
145
+ if ( ! empty( $caption ) )
146
+ $caption .= '<br/>';
147
+ else
148
+ $caption_style = ' style="caption-side:bottom;text-align:left;border:none;background:none;"';
149
+ $caption .= "<a href=\"{$this->output_options['edit_table_url']}\" title=\"" . __( 'Edit', 'default' ) . "\">" . __( 'Edit', 'default' ) . "</a>";
150
+ }
151
+ if ( ! empty( $caption ) )
152
+ $caption = "<caption{$caption_class}{$caption_style}>\n{$caption}</caption>\n";
153
154
$colgroup = ( !empty( $colgroup ) ) ? "<colgroup>\n{$colgroup}</colgroup>\n" : '';
155
$thead = ( !empty( $thead ) ) ? "<thead>\n{$thead}</thead>\n" : '';
controllers/controller-admin.php CHANGED
@@ -76,7 +76,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
76
'update_message' => array(),
77
'last_id' => 0
78
);
79
-
80
/**
81
* Default list of tables (empty, because there are no tables right after installation)
82
* @var array
@@ -94,7 +94,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
94
* @var object
95
*/
96
var $export_instance;
97
-
98
/**
99
* Instance of the WP_Table_Reloaded_Import class
100
* @var object
@@ -194,7 +194,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
194
);
195
$min_capability = isset( $capabilities[ $user_group ] ) ? $capabilities[ $user_group ] : 'manage_options';
196
$min_capability = apply_filters( 'wp_table_reloaded_min_needed_capability', $min_capability ); // plugins may filter/change this though
197
-
198
$display_name = 'WP-Table Reloaded'; // the name that is displayed in the admin menu on the left
199
$display_name = apply_filters( 'wp_table_reloaded_plugin_display_name', $display_name ); // can be filtered to something shorter maybe
200
@@ -243,7 +243,10 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
243
$this->add_manage_page_css(); // needs to be added to the header
244
245
// done after determining the action, because needs action parameter to load correct help string
246
- add_contextual_help( $this->hook, $this->helper->get_contextual_help_string() );
247
}
248
249
/**
@@ -254,6 +257,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
254
$this->available_plugin_languages = array(
255
'ar' => __( 'Arabic', WP_TABLE_RELOADED_TEXTDOMAIN ),
256
'be_BY' => __( 'Belarusian', WP_TABLE_RELOADED_TEXTDOMAIN ),
257
'cs_CZ' => __( 'Czech', WP_TABLE_RELOADED_TEXTDOMAIN ),
258
'de_DE' => __( 'German', WP_TABLE_RELOADED_TEXTDOMAIN ),
259
'en_US' => __( 'English', WP_TABLE_RELOADED_TEXTDOMAIN ),
@@ -262,6 +266,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
262
'fr_FR' => __( 'French', WP_TABLE_RELOADED_TEXTDOMAIN ),
263
'he_IL' => __( 'Hebrew', WP_TABLE_RELOADED_TEXTDOMAIN ),
264
'hi_IN' => __( 'Hindi', WP_TABLE_RELOADED_TEXTDOMAIN ),
265
'id_ID' => __( 'Indonesian', WP_TABLE_RELOADED_TEXTDOMAIN ),
266
'it_IT' => __( 'Italian', WP_TABLE_RELOADED_TEXTDOMAIN ),
267
'ja' => __( 'Japanese', WP_TABLE_RELOADED_TEXTDOMAIN ),
@@ -285,12 +290,12 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
285
$overwrite = apply_filters( 'wp_table_reloaded_action_pre_' . $this->action, false );
286
if ( $overwrite )
287
return;
288
-
289
// call appropriate action, $this->action is populated in load_manage_page
290
if ( is_callable( array( &$this, 'do_action_' . $this->action ) ) )
291
call_user_func( array( &$this, 'do_action_' . $this->action ) );
292
}
293
-
294
// ###################################################################################################################
295
// ########################################## ######################################################
296
// ########################################## ACTIONS ######################################################
@@ -327,7 +332,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
327
328
$this->load_view( 'list' );
329
}
330
-
331
/**
332
* "Add new Table" action handler
333
*/
@@ -363,10 +368,10 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
363
function do_action_edit() {
364
if ( isset( $_POST['submit'] ) && isset( $_POST['table'] ) ) {
365
check_admin_referer( $this->get_nonce( 'edit' ) );
366
-
367
$subactions = array_keys( $_POST['submit'] );
368
$subaction = $subactions[0];
369
-
370
switch( $subaction ) {
371
case 'update':
372
case 'save_back':
@@ -607,7 +612,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
607
array_splice( $table['visibility']['rows'], $row_id, 0, false );
608
$row_change++;
609
}
610
-
611
$this->save_table( $table );
612
$message = _n( 'Row inserted successfully.', 'Rows inserted successfully.', count( $insert_rows ), WP_TABLE_RELOADED_TEXTDOMAIN );
613
break;
@@ -753,14 +758,14 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
753
$this->import_instance->import_table();
754
$imported_table = $this->import_instance->imported_table;
755
$table = array_merge( $this->default_table, $imported_table );
756
-
757
$rows = count( $table['data'] );
758
$cols = (0 < $rows) ? count( $table['data'][0] ) : 0;
759
$rows = ( 0 < $rows ) ? $rows : 1;
760
$cols = ( 0 < $cols ) ? $cols : 1;
761
$table['visibility']['rows'] = array_fill( 0, $rows, false );
762
$table['visibility']['columns'] = array_fill( 0, $cols, false );
763
-
764
$table['id'] = $this->get_new_table_id();
765
$this->save_table( $table );
766
}
@@ -902,7 +907,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
902
$this->load_view( 'import' );
903
return;
904
}
905
-
906
// do import with the config set above
907
$this->import_instance->import_format = $_POST['import_format'];
908
$this->import_instance->import_table();
@@ -962,14 +967,14 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
962
$this->load_view( 'edit', compact( 'table_id' ) );
963
} elseif ( isset( $_POST['import_wp_table_reloaded_dump_file'] ) ) {
964
check_admin_referer( $this->get_nonce( 'import_dump' ), $this->get_nonce( 'import_dump' ) );
965
-
966
// check if user is admin
967
if ( !current_user_can( 'manage_options' ) ) {
968
$this->helper->print_header_message( __( 'You do not have sufficient rights to perform this action.', WP_TABLE_RELOADED_TEXTDOMAIN ) );
969
$this->load_view( 'options' );
970
return;
971
}
972
-
973
// check if file was uploaded
974
if ( empty( $_FILES['dump_file']['tmp_name'] ) ) {
975
$this->helper->print_header_message( __( 'You did not upload a WP-Table Reloaded dump file.', WP_TABLE_RELOADED_TEXTDOMAIN ) );
@@ -1025,7 +1030,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1025
check_admin_referer( $this->get_nonce( 'export' ) );
1026
1027
$table_to_export = $this->load_table( $_POST['table_id'] );
1028
-
1029
$this->export_instance->table_to_export = $table_to_export;
1030
$this->export_instance->export_format = $_POST['export_format'];
1031
$this->export_instance->delimiter = $_POST['delimiter'];
@@ -1048,7 +1053,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1048
$this->load_view( 'export', compact( 'table_id' ) );
1049
}
1050
}
1051
-
1052
/**
1053
* "Export" action handler, for Dump Files, stores all plugin data, like tables, options, etc. in a single array,
1054
* serializes it and offers the resulting string for download in a Dump File
@@ -1064,7 +1069,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1064
$export['tables'][ $table_id ] = $dump_table;
1065
}
1066
$export['options'] = $this->options;
1067
-
1068
$export_dump = serialize( $export );
1069
1070
$filename = 'wp-table-reloaded-export-' . date( 'Y-m-d' ) . '.dump';
@@ -1089,7 +1094,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1089
}
1090
1091
$new_options = $_POST['options'];
1092
-
1093
// checkboxes: option value is defined by whether option isset (e.g. was checked) or not
1094
$this->options['show_exit_warning'] = isset( $new_options['show_exit_warning'] );
1095
$this->options['growing_textareas'] = isset( $new_options['growing_textareas'] );
@@ -1098,7 +1103,9 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1098
$this->options['use_default_css'] = isset( $new_options['use_default_css'] );
1099
$this->options['use_custom_css'] = isset( $new_options['use_custom_css'] );
1100
$this->options['add_target_blank_to_links'] = isset( $new_options['add_target_blank_to_links'] );
1101
- $this->options['tablesorter_script'] = $new_options['tablesorter_script'];
1102
1103
// only save these settings, if user is administrator, as they are admin options
1104
if ( current_user_can( 'manage_options' ) ) {
@@ -1149,7 +1156,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1149
}
1150
$this->load_view( 'options' );
1151
}
1152
-
1153
/**
1154
* "Plugin Uninstall" action handler, checks if an admin is performing it, sets uninstall to true and deactivates the plugin
1155
* (which executes the plugin_deactivation_hook() which then deletes all options from the DB
@@ -1174,7 +1181,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1174
1175
$this->load_view( 'uninstall', array(), false );
1176
}
1177
-
1178
/**
1179
* "About" action handler, only calls the view
1180
*/
@@ -1193,7 +1200,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1193
1194
exit; // necessary to stop page building here!
1195
}
1196
-
1197
/**
1198
* "AJAX Table Preview" action handler
1199
*/
@@ -1224,7 +1231,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1224
$this->update_options();
1225
$this->do_action_list();
1226
}
1227
-
1228
/**
1229
* "Hide Donate Message" action handler
1230
*/
@@ -1239,10 +1246,10 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1239
} else {
1240
$this->helper->print_header_message( sprintf( __( 'No problem! I still hope you enjoy the benefits that WP-Table Reloaded brings to you. If you should want to change your mind, you\'ll always find the &quot;%s&quot; button on the <a href="%s">WP-Table Reloaded website</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), __( 'Donate', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/website/' ) );
1241
}
1242
-
1243
$this->do_action_list();
1244
}
1245
-
1246
// ###################################################################################################################
1247
// ########################################## ####################################################
1248
// ########################################## Page Generation ####################################################
@@ -1334,7 +1341,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1334
<br class="clear" />
1335
<?php
1336
}
1337
-
1338
/**
1339
* Decide whether a donate message can be shown on the "List Tables" screen, depending on passed days since installation and whether it was shown before
1340
*
@@ -1378,7 +1385,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1378
$options_updated = apply_filters( 'wp_table_reloaded_update_options', false, $this->options );
1379
if ( $options_updated )
1380
return;
1381
-
1382
update_option( $this->optionname['options'], $this->options );
1383
}
1384
@@ -1387,12 +1394,12 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1387
*/
1388
function update_tables() {
1389
ksort( $this->tables, SORT_NUMERIC ); // sort for table IDs, as one with a small ID might have been appended
1390
-
1391
// possibility to overwrite tables updating (i.e. to update them in own DB table)
1392
$tables_updated = apply_filters( 'wp_table_reloaded_update_tables', false, $this->tables );
1393
if ( $tables_updated )
1394
return;
1395
-
1396
update_option( $this->optionname['tables'], $this->tables );
1397
}
1398
@@ -1419,7 +1426,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1419
// delete the transient that caches the table output
1420
$cache_name = "wp_table_reloaded_table_output_{$table['id']}";
1421
delete_transient( $cache_name );
1422
-
1423
$this->tables[ $table['id'] ] = ( isset( $this->tables[ $table['id'] ] ) ) ? $this->tables[ $table['id'] ] : $this->optionname['table'] . '_' . $table['id'];
1424
update_option( $this->tables[ $table['id'] ], $table );
1425
$this->update_tables();
@@ -1447,7 +1454,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1447
// ######################################### URL Support ####################################################
1448
// ######################################### ####################################################
1449
// ###################################################################################################################
1450
-
1451
/**
1452
* Generate the complete nonce string, from the nonce base, the action and an item, e.g. wp-table-reloaded-nonce_delete_table
1453
*
@@ -1480,7 +1487,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1480
$action_url = esc_url( $action_url );
1481
return $action_url;
1482
}
1483
-
1484
// ###################################################################################################################
1485
// ####################################### ###################################################
1486
// ####################################### Plugin Management ###################################################
@@ -1584,7 +1591,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1584
$new_options['installed_version'] = WP_TABLE_RELOADED_PLUGIN_VERSION;
1585
$new_options['update_message'] = array();
1586
$new_options['show_welcome_message'] = 2; // 2 = update message
1587
-
1588
// 4. step: save the new options
1589
$this->options = $new_options;
1590
$this->update_options();
@@ -1593,15 +1600,15 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1593
$this->tables = $this->load_tables();
1594
foreach ( $this->tables as $id => $tableoptionname ) {
1595
$table = $this->load_table( $id );
1596
-
1597
$temp_table = $this->default_table;
1598
-
1599
// if table doesn't have visibility information, add them
1600
$rows = count( $table['data'] );
1601
$cols = (0 < $rows) ? count( $table['data'][0] ) : 0;
1602
$temp_table['visibility']['rows'] = array_fill( 0, $rows, false );
1603
$temp_table['visibility']['columns'] = array_fill( 0, $cols, false );
1604
-
1605
foreach ( $temp_table as $key => $value )
1606
$new_table[ $key ] = ( isset( $table[ $key ] ) ) ? $table[ $key ] : $temp_table[ $key ] ;
1607
@@ -1631,7 +1638,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1631
$has_access = apply_filters( 'wp_table_reloaded_user_access_' . $screen, $has_access, $this->options['user_access_plugin_options'] );
1632
return $has_access;
1633
}
1634
-
1635
/**
1636
* Get the plugin update message from the remote server, if there is an update available
1637
*
@@ -1671,7 +1678,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1671
function add_plugin_row_meta( $links, $file ) {
1672
if ( WP_TABLE_RELOADED_BASENAME != $file )
1673
return $links;
1674
-
1675
$links[] = '<a href="' . $this->get_action_url() . '" title="' . __( 'WP-Table Reloaded Plugin Page', WP_TABLE_RELOADED_TEXTDOMAIN ) . '">' . __( 'Plugin Page', WP_TABLE_RELOADED_TEXTDOMAIN ) . '</a>';
1676
$links[] = '<a href="http://tobias.baethge.com/go/wp-table-reloaded/faq/" title="' . __( 'Frequently Asked Questions', WP_TABLE_RELOADED_TEXTDOMAIN ) . '">' . __( 'FAQ', WP_TABLE_RELOADED_TEXTDOMAIN ) . '</a>';
1677
$links[] = '<a href="http://tobias.baethge.com/go/wp-table-reloaded/support/" title="' . __( 'Support', WP_TABLE_RELOADED_TEXTDOMAIN ) . '">' . __( 'Support', WP_TABLE_RELOADED_TEXTDOMAIN ) . '</a>';
@@ -1690,7 +1697,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1690
load_plugin_textdomain( WP_TABLE_RELOADED_TEXTDOMAIN, false, $language_directory );
1691
remove_filter( 'locale', array( &$this, 'get_plugin_locale' ) );
1692
}
1693
-
1694
/**
1695
* Retrieve the locale the plugin shall be shown in, applied as a filter in get_locale()
1696
*/
@@ -1701,7 +1708,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1701
else
1702
return $locale;
1703
}
1704
-
1705
$locale = ( !empty( $this->options['plugin_language'] ) && 'auto' != $this->options['plugin_language'] ) ? $this->options['plugin_language'] : $locale;
1706
return $locale;
1707
}
@@ -1776,7 +1783,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1776
function add_editor_button() {
1777
if ( 0 == count( $this->tables ) )
1778
return;
1779
-
1780
$this->init_language_support();
1781
add_thickbox(); // we need thickbox to show the list
1782
@@ -1804,7 +1811,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1804
add_filter( 'mce_external_plugins', array( &$this, 'add_tinymce_plugin' ) );
1805
add_filter( 'mce_buttons', array( &$this, 'add_tinymce_button' ) );
1806
}
1807
-
1808
add_action( 'admin_print_footer_scripts', array( &$this, '_print_editor_button' ), 100 );
1809
}
1810
@@ -1902,7 +1909,7 @@ class WP_Table_Reloaded_Controller_Admin extends WP_Table_Reloaded_Controller_Ba
1902
.find('.sorting').append('&nbsp;<span>&nbsp;&nbsp;&nbsp;</span>');\n
1903
DATATABLES;
1904
}
1905
-
1906
echo <<<JSSCRIPT
1907
<script type="text/javascript">
1908
/* <![CDATA[ */
76
'update_message' => array(),
77
'last_id' => 0
78
);
79
+
80
/**
81
* Default list of tables (empty, because there are no tables right after installation)
82
* @var array
94
* @var object
95
*/
96
var $export_instance;
97
+
98
/**
99
* Instance of the WP_Table_Reloaded_Import class
100
* @var object
194
);
195
$min_capability = isset( $capabilities[ $user_group ] ) ? $capabilities[ $user_group ] : 'manage_options';
196
$min_capability = apply_filters( 'wp_table_reloaded_min_needed_capability', $min_capability ); // plugins may filter/change this though
197
+
198
$display_name = 'WP-Table Reloaded'; // the name that is displayed in the admin menu on the left
199
$display_name = apply_filters( 'wp_table_reloaded_plugin_display_name', $display_name ); // can be filtered to something shorter maybe
200
243
$this->add_manage_page_css(); // needs to be added to the header
244
245
// done after determining the action, because needs action parameter to load correct help string
246
+ if ( version_compare( $GLOBALS['wp_version'] , '3.3', '>' ) )
247
+ WP_Screen::add_old_compat_help( convert_to_screen( $this->hook ), $this->helper->get_contextual_help_string() );
248
+ else
249
+ add_contextual_help( $this->hook, $this->helper->get_contextual_help_string() );
250
}
251
252
/**
257
$this->available_plugin_languages = array(
258
'ar' => __( 'Arabic', WP_TABLE_RELOADED_TEXTDOMAIN ),
259
'be_BY' => __( 'Belarusian', WP_TABLE_RELOADED_TEXTDOMAIN ),
260
+ 'bg_BG' => __( 'Bulgarian', WP_TABLE_RELOADED_TEXTDOMAIN ),
261
'cs_CZ' => __( 'Czech', WP_TABLE_RELOADED_TEXTDOMAIN ),
262
'de_DE' => __( 'German', WP_TABLE_RELOADED_TEXTDOMAIN ),
263
'en_US' => __( 'English', WP_TABLE_RELOADED_TEXTDOMAIN ),
266
'fr_FR' => __( 'French', WP_TABLE_RELOADED_TEXTDOMAIN ),
267
'he_IL' => __( 'Hebrew', WP_TABLE_RELOADED_TEXTDOMAIN ),
268
'hi_IN' => __( 'Hindi', WP_TABLE_RELOADED_TEXTDOMAIN ),
269
+ 'hr' => __( 'Croatian', WP_TABLE_RELOADED_TEXTDOMAIN ),
270
'id_ID' => __( 'Indonesian', WP_TABLE_RELOADED_TEXTDOMAIN ),
271
'it_IT' => __( 'Italian', WP_TABLE_RELOADED_TEXTDOMAIN ),
272
'ja' => __( 'Japanese', WP_TABLE_RELOADED_TEXTDOMAIN ),
290
$overwrite = apply_filters( 'wp_table_reloaded_action_pre_' . $this->action, false );
291
if ( $overwrite )
292
return;
293
+
294
// call appropriate action, $this->action is populated in load_manage_page
295
if ( is_callable( array( &$this, 'do_action_' . $this->action ) ) )
296
call_user_func( array( &$this, 'do_action_' . $this->action ) );
297
}
298
+
299
// ###################################################################################################################
300
// ########################################## ######################################################
301
// ########################################## ACTIONS ######################################################
332
333
$this->load_view( 'list' );
334
}
335
+
336
/**
337
* "Add new Table" action handler
338
*/
368
function do_action_edit() {
369
if ( isset( $_POST['submit'] ) && isset( $_POST['table'] ) ) {
370
check_admin_referer( $this->get_nonce( 'edit' ) );
371
+
372
$subactions = array_keys( $_POST['submit'] );
373
$subaction = $subactions[0];
374
+
375
switch( $subaction ) {
376
case 'update':
377
case 'save_back':
612
array_splice( $table['visibility']['rows'], $row_id, 0, false );
613
$row_change++;
614
}
615
+
616
$this->save_table( $table );
617
$message = _n( 'Row inserted successfully.', 'Rows inserted successfully.', count( $insert_rows ), WP_TABLE_RELOADED_TEXTDOMAIN );
618
break;
758
$this->import_instance->import_table();
759
$imported_table = $this->import_instance->imported_table;
760
$table = array_merge( $this->default_table, $imported_table );
761
+
762
$rows = count( $table['data'] );
763
$cols = (0 < $rows) ? count( $table['data'][0] ) : 0;
764
$rows = ( 0 < $rows ) ? $rows : 1;
765
$cols = ( 0 < $cols ) ? $cols : 1;
766
$table['visibility']['rows'] = array_fill( 0, $rows, false );
767
$table['visibility']['columns'] = array_fill( 0, $cols, false );
768
+
769
$table['id'] = $this->get_new_table_id();
770
$this->save_table( $table );
771
}
907
$this->load_view( 'import' );
908
return;
909
}
910
+
911
// do import with the config set above
912
$this->import_instance->import_format = $_POST['import_format'];
913
$this->import_instance->import_table();
967
$this->load_view( 'edit', compact( 'table_id' ) );
968
} elseif ( isset( $_POST['import_wp_table_reloaded_dump_file'] ) ) {
969
check_admin_referer( $this->get_nonce( 'import_dump' ), $this->get_nonce( 'import_dump' ) );
970
+
971
// check if user is admin
972
if ( !current_user_can( 'manage_options' ) ) {
973
$this->helper->print_header_message( __( 'You do not have sufficient rights to perform this action.', WP_TABLE_RELOADED_TEXTDOMAIN ) );
974
$this->load_view( 'options' );
975
return;
976
}
977
+
978
// check if file was uploaded
979
if ( empty( $_FILES['dump_file']['tmp_name'] ) ) {
980
$this->helper->print_header_message( __( 'You did not upload a WP-Table Reloaded dump file.', WP_TABLE_RELOADED_TEXTDOMAIN ) );
1030
check_admin_referer( $this->get_nonce( 'export' ) );
1031
1032
$table_to_export = $this->load_table( $_POST['table_id'] );
1033
+
1034
$this->export_instance->table_to_export = $table_to_export;
1035
$this->export_instance->export_format = $_POST['export_format'];
1036
$this->export_instance->delimiter = $_POST['delimiter'];
1053
$this->load_view( 'export', compact( 'table_id' ) );
1054
}
1055
}
1056
+
1057
/**
1058
* "Export" action handler, for Dump Files, stores all plugin data, like tables, options, etc. in a single array,
1059
* serializes it and offers the resulting string for download in a Dump File
1069
$export['tables'][ $table_id ] = $dump_table;
1070
}
1071
$export['options'] = $this->options;
1072
+
1073
$export_dump = serialize( $export );
1074
1075
$filename = 'wp-table-reloaded-export-' . date( 'Y-m-d' ) . '.dump';
1094
}
1095
1096
$new_options = $_POST['options'];
1097
+
1098
// checkboxes: option value is defined by whether option isset (e.g. was checked) or not
1099
$this->options['show_exit_warning'] = isset( $new_options['show_exit_warning'] );
1100
$this->options['growing_textareas'] = isset( $new_options['growing_textareas'] );
1103
$this->options['use_default_css'] = isset( $new_options['use_default_css'] );
1104
$this->options['use_custom_css'] = isset( $new_options['use_custom_css'] );
1105
$this->options['add_target_blank_to_links'] = isset( $new_options['add_target_blank_to_links'] );
1106
+ // drop down: only set when not disabled (by JavaScript)
1107
+ if ( isset( $new_options['tablesorter_script'] ) )
1108
+ $this->options['tablesorter_script'] = $new_options['tablesorter_script'];
1109
1110
// only save these settings, if user is administrator, as they are admin options
1111
if ( current_user_can( 'manage_options' ) ) {
1156
}
1157
$this->load_view( 'options' );
1158
}
1159
+
1160
/**
1161
* "Plugin Uninstall" action handler, checks if an admin is performing it, sets uninstall to true and deactivates the plugin
1162
* (which executes the plugin_deactivation_hook() which then deletes all options from the DB
1181
1182
$this->load_view( 'uninstall', array(), false );
1183
}
1184
+
1185
/**
1186
* "About" action handler, only calls the view
1187
*/
1200
1201
exit; // necessary to stop page building here!
1202
}
1203
+
1204
/**
1205
* "AJAX Table Preview" action handler
1206
*/
1231
$this->update_options();
1232
$this->do_action_list();
1233
}
1234
+
1235
/**
1236
* "Hide Donate Message" action handler
1237
*/
1246
} else {
1247
$this->helper->print_header_message( sprintf( __( 'No problem! I still hope you enjoy the benefits that WP-Table Reloaded brings to you. If you should want to change your mind, you\'ll always find the &quot;%s&quot; button on the <a href="%s">WP-Table Reloaded website</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ), __( 'Donate', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/go/wp-table-reloaded/website/' ) );
1248
}
1249
+
1250
$this->do_action_list();
1251
}
1252
+
1253
// ###################################################################################################################
1254
// ########################################## ####################################################
1255
// ########################################## Page Generation ####################################################
1341
<br class="clear" />
1342
<?php
1343
}
1344
+
1345
/**
1346
* Decide whether a donate message can be shown on the "List Tables" screen, depending on passed days since installation and whether it was shown before
1347
*
1385
$options_updated = apply_filters( 'wp_table_reloaded_update_options', false, $this->options );
1386
if ( $options_updated )
1387
return;
1388
+
1389
update_option( $this->optionname['options'], $this->options );
1390
}
1391
1394
*/
1395
function update_tables() {
1396
ksort( $this->tables, SORT_NUMERIC ); // sort for table IDs, as one with a small ID might have been appended
1397
+
1398
// possibility to overwrite tables updating (i.e. to update them in own DB table)
1399
$tables_updated = apply_filters( 'wp_table_reloaded_update_tables', false, $this->tables );
1400
if ( $tables_updated )
1401
return;
1402
+
1403
update_option( $this->optionname['tables'], $this->tables );
1404
}
1405
1426
// delete the transient that caches the table output
1427
$cache_name = "wp_table_reloaded_table_output_{$table['id']}";
1428
delete_transient( $cache_name );
1429
+
1430
$this->tables[ $table['id'] ] = ( isset( $this->tables[ $table['id'] ] ) ) ? $this->tables[ $table['id'] ] : $this->optionname['table'] . '_' . $table['id'];
1431
update_option( $this->tables[ $table['id'] ], $table );
1432
$this->update_tables();
1454
// ######################################### URL Support ####################################################
1455
// ######################################### ####################################################
1456
// ###################################################################################################################
1457
+
1458
/**
1459
* Generate the complete nonce string, from the nonce base, the action and an item, e.g. wp-table-reloaded-nonce_delete_table
1460
*
1487
$action_url = esc_url( $action_url );
1488
return $action_url;
1489
}
1490
+
1491
// ###################################################################################################################
1492
// ####################################### ###################################################
1493
// ####################################### Plugin Management ###################################################
1591
$new_options['installed_version'] = WP_TABLE_RELOADED_PLUGIN_VERSION;
1592
$new_options['update_message'] = array();
1593
$new_options['show_welcome_message'] = 2; // 2 = update message
1594
+
1595
// 4. step: save the new options
1596
$this->options = $new_options;
1597
$this->update_options();
1600
$this->tables = $this->load_tables();
1601
foreach ( $this->tables as $id => $tableoptionname ) {
1602
$table = $this->load_table( $id );
1603
+
1604
$temp_table = $this->default_table;
1605
+
1606
// if table doesn't have visibility information, add them
1607
$rows = count( $table['data'] );
1608
$cols = (0 < $rows) ? count( $table['data'][0] ) : 0;
1609
$temp_table['visibility']['rows'] = array_fill( 0, $rows, false );
1610
$temp_table['visibility']['columns'] = array_fill( 0, $cols, false );
1611
+
1612
foreach ( $temp_table as $key => $value )
1613
$new_table[ $key ] = ( isset( $table[ $key ] ) ) ? $table[ $key ] : $temp_table[ $key ] ;
1614
1638
$has_access = apply_filters( 'wp_table_reloaded_user_access_' . $screen, $has_access, $this->options['user_access_plugin_options'] );
1639
return $has_access;
1640
}
1641
+
1642
/**
1643
* Get the plugin update message from the remote server, if there is an update available
1644
*
1678
function add_plugin_row_meta( $links, $file ) {
1679
if ( WP_TABLE_RELOADED_BASENAME != $file )
1680
return $links;
1681
+
1682
$links[] = '<a href="' . $this->get_action_url() . '" title="' . __( 'WP-Table Reloaded Plugin Page', WP_TABLE_RELOADED_TEXTDOMAIN ) . '">' . __( 'Plugin Page', WP_TABLE_RELOADED_TEXTDOMAIN ) . '</a>';
1683
$links[] = '<a href="http://tobias.baethge.com/go/wp-table-reloaded/faq/" title="' . __( 'Frequently Asked Questions', WP_TABLE_RELOADED_TEXTDOMAIN ) . '">' . __( 'FAQ', WP_TABLE_RELOADED_TEXTDOMAIN ) . '</a>';
1684
$links[] = '<a href="http://tobias.baethge.com/go/wp-table-reloaded/support/" title="' . __( 'Support', WP_TABLE_RELOADED_TEXTDOMAIN ) . '">' . __( 'Support', WP_TABLE_RELOADED_TEXTDOMAIN ) . '</a>';
1697
load_plugin_textdomain( WP_TABLE_RELOADED_TEXTDOMAIN, false, $language_directory );
1698
remove_filter( 'locale', array( &$this, 'get_plugin_locale' ) );
1699
}
1700
+
1701
/**
1702
* Retrieve the locale the plugin shall be shown in, applied as a filter in get_locale()
1703
*/
1708
else
1709
return $locale;
1710
}
1711
+
1712
$locale = ( !empty( $this->options['plugin_language'] ) && 'auto' != $this->options['plugin_language'] ) ? $this->options['plugin_language'] : $locale;
1713
return $locale;
1714
}
1783
function add_editor_button() {
1784
if ( 0 == count( $this->tables ) )
1785
return;
1786
+
1787
$this->init_language_support();
1788
add_thickbox(); // we need thickbox to show the list
1789
1811
add_filter( 'mce_external_plugins', array( &$this, 'add_tinymce_plugin' ) );
1812
add_filter( 'mce_buttons', array( &$this, 'add_tinymce_button' ) );
1813
}
1814
+
1815
add_action( 'admin_print_footer_scripts', array( &$this, '_print_editor_button' ), 100 );
1816
}
1817
1909
.find('.sorting').append('&nbsp;<span>&nbsp;&nbsp;&nbsp;</span>');\n
1910
DATATABLES;
1911
}
1912
+ $datatables = apply_filters( 'wp_table_reloaded_admin_datatables_js', $datatables );
1913
echo <<<JSSCRIPT
1914
<script type="text/javascript">
1915
/* <![CDATA[ */
controllers/controller-frontend.php CHANGED
@@ -76,7 +76,7 @@ class WP_Table_Reloaded_Controller_Frontend extends WP_Table_Reloaded_Controller
76
77
// extend WordPress Search to also find posts/pages that have a table with the one of the search terms in them
78
if ( $this->options['enable_search'] )
79
- add_filter( 'posts_where', array( &$this, 'handle_posts_where_filter' ) );
80
81
// if a JavaScript library is (globally) enabled, include respective files
82
if ( $this->options['enable_tablesorter'] ) {
@@ -145,6 +145,8 @@ class WP_Table_Reloaded_Controller_Frontend extends WP_Table_Reloaded_Controller
145
}
146
}
147
148
return $output;
149
}
150
@@ -363,13 +365,13 @@ class WP_Table_Reloaded_Controller_Frontend extends WP_Table_Reloaded_Controller
363
* saving all tables's IDs that have a search term and then expanding the WP query to search for posts or pages that have the
364
* Shortcode for one of these tables in their content.
365
*
366
- * @param string $where Current "WHERE" clause of the SQL statement used to get posts/pages from the WP database
367
* @uses $wpdb
368
* @return string Eventually extended SQL "WHERE" clause, to also find posts/pages with Shortcodes in them
369
*/
370
- function handle_posts_where_filter( $where ) {
371
if ( !is_search() )
372
- return $where;
373
374
global $wpdb;
375
@@ -432,15 +434,14 @@ class WP_Table_Reloaded_Controller_Frontend extends WP_Table_Reloaded_Controller
432
$exact = get_query_var( 'exact' ); // if $_GET['exact'] is set, WordPress doesn't use % in SQL LIKE clauses
433
$n = ( !empty( $exact ) ) ? '' : '%';
434
foreach ( $query_result as $search_term => $tables ) {
435
- foreach ( $tables as $table_id ) {
436
- $old_or = "OR ({$wpdb->posts}.post_content LIKE '{$n}{$search_term}{$n}')";
437
- $shortcode = "[table id={$table_id} "; // only the beginning, as there might be more Shortcode atts coming, does not find [table id="<ID>" though, might need another loop? The space at the end is necessary to make sure that no table IDs with the same beginning are found.
438
- $new_or = $old_or. " OR ({$wpdb->posts}.post_content LIKE '%{$shortcode}%')";
439
- $where = str_replace( $old_or, $new_or, $where );
440
- }
441
}
442
443
- return $where;
444
}
445
446
/**
76
77
// extend WordPress Search to also find posts/pages that have a table with the one of the search terms in them
78
if ( $this->options['enable_search'] )
79
+ add_filter( 'posts_search', array( &$this, 'handle_posts_search_filter' ) );
80
81
// if a JavaScript library is (globally) enabled, include respective files
82
if ( $this->options['enable_tablesorter'] ) {
145
}
146
}
147
148
+ $output = apply_filters( 'wp_table_reloaded_shortcode_table_info_output', $output, $atts );
149
+
150
return $output;
151
}
152
365
* saving all tables's IDs that have a search term and then expanding the WP query to search for posts or pages that have the
366
* Shortcode for one of these tables in their content.
367
*
368
+ * @param string $search Current part of the "WHERE" clause of the SQL statement used to get posts/pages from the WP database that is related to searching
369
* @uses $wpdb
370
* @return string Eventually extended SQL "WHERE" clause, to also find posts/pages with Shortcodes in them
371
*/
372
+ function handle_posts_search_filter( $search_sql ) {
373
if ( !is_search() )
374
+ return $search_sql;
375
376
global $wpdb;
377
434
$exact = get_query_var( 'exact' ); // if $_GET['exact'] is set, WordPress doesn't use % in SQL LIKE clauses
435
$n = ( !empty( $exact ) ) ? '' : '%';
436
foreach ( $query_result as $search_term => $tables ) {
437
+ $old_or = "OR ({$wpdb->posts}.post_content LIKE '{$n}{$search_term}{$n}')";
438
+ $table_ids = implode( '|', $tables );
439
+ $regexp = '\\\\[table id=(["\\\']?)(' . $table_ids . ')(["\\\' ])'; // ' needs to be single escaped, [ double escaped (with \\) in mySQL
440
+ $new_or = $old_or . " OR ({$wpdb->posts}.post_content REGEXP '{$regexp}')";
441
+ $search_sql = str_replace( $old_or, $new_or, $search_sql );
442
}
443
444
+ return $search_sql;
445
}
446
447
/**
css/datatables.css CHANGED
@@ -19,8 +19,6 @@
19
.dataTables_wrapper {
20
position: relative;
21
zoom: 1;
22
- min-height: 302px;
23
- _height: 302px;
24
clear: both;
25
}
26
19
.dataTables_wrapper {
20
position: relative;
21
zoom: 1;
22
clear: both;
23
}
24
css/plugin.rtl.css CHANGED
@@ -7,4 +7,10 @@
7
.wp-table-reloaded {
8
direction: rtl;
9
text-align: right;
10
}
7
.wp-table-reloaded {
8
direction: rtl;
9
text-align: right;
10
+ }
11
+
12
+ .wp-table-reloaded .sorting,
13
+ .wp-table-reloaded .sorting_asc,
14
+ .wp-table-reloaded .sorting_desc {
15
+ background-position: left!important;
16
}
img/asc.gif CHANGED
Binary file
img/desc.gif CHANGED
Binary file
languages/datatables/lang-hr.txt ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "sProcessing": "Pričekajte...",
3
+ "sLengthMenu": "Prikaži _MENU_ unose",
4
+ "sZeroRecords": "Nema nikakvih rezultata.",
5
+ "sInfo": "Prikazujem _TOTAL_ od (_START_-_END_) unosa",
6
+ "sInfoEmpty": "Prikazujem 0 do 0 od 0 unosa",
7
+ "sInfoFiltered": "(filtrirano od _MAX_ ukupnih unosa)",
8
+ "sInfoPostFix": "",
9
+ "sSearch": "Pretraga:",
10
+ "oPaginate": {
11
+ "sFirst": "Prvi",
12
+ "sPrevious": "Prijašnji",
13
+ "sNext": "Sljedeći",
14
+ "sLast": "Posljednji"
15
+ }
16
+ }
languages/wp-table-reloaded-bg_BG.mo ADDED
Binary file
languages/wp-table-reloaded-bg_BG.po ADDED
@@ -0,0 +1,2112 @@