WP-Table Reloaded - Version 1.6

Version Description

This upgrade adds features like "colspan"/"rowspan" support, support for the WP Search, and more. WordPress 2.8 or higher is now required!

Download this release

Release Info

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

Code changes from version 1.5 to 1.6

Files changed (55) hide show
  1. admin/admin-script.dev.js +113 -36
  2. admin/admin-script.js +1 -1
  3. admin/admin-style.css +1 -5
  4. admin/admin-style.dev.css +21 -19
  5. {php → classes}/arraysort.class.php +9 -9
  6. php/wp-table-reloaded-export.class.php → classes/export.class.php +16 -20
  7. classes/helper.class.php +127 -0
  8. php/wp-table-reloaded-import.class.php → classes/import.class.php +14 -17
  9. {php → classes}/index.php +0 -0
  10. {php → classes}/parsecsv.class.php +22 -15
  11. classes/render.class.php +308 -0
  12. {php → classes}/simplexml.class.php +41 -35
  13. controllers/controller-admin.php +1859 -0
  14. controllers/controller-base.php +160 -0
  15. controllers/controller-frontend.php +601 -0
  16. controllers/index.php +3 -0
  17. css/datatables.css +1 -2
  18. css/plugin.css +6 -1
  19. languages/datatables/lang-hi_IN.txt +17 -0
  20. languages/datatables/lang-ja.txt +11 -11
  21. languages/wp-table-reloaded-cs_CZ.mo +0 -0
  22. languages/wp-table-reloaded-cs_CZ.po +1217 -1110
  23. languages/wp-table-reloaded-de_DE.mo +0 -0
  24. languages/wp-table-reloaded-de_DE.po +1995 -1885
  25. languages/wp-table-reloaded-es_ES.mo +0 -0
  26. languages/wp-table-reloaded-es_ES.po +2442 -0
  27. languages/wp-table-reloaded-fi_FI.mo +0 -0
  28. languages/wp-table-reloaded-fi_FI.po +2266 -0
  29. languages/wp-table-reloaded-hi_IN.mo +0 -0
  30. languages/wp-table-reloaded-hi_IN.po +2092 -0
  31. languages/wp-table-reloaded-it_IT.mo +0 -0
  32. languages/wp-table-reloaded-it_IT.po +2431 -0
  33. languages/wp-table-reloaded-ja.mo +0 -0
  34. languages/wp-table-reloaded-ja.po +1156 -1092
  35. languages/wp-table-reloaded-sk_SK.mo +0 -0
  36. languages/wp-table-reloaded-sk_SK.po +786 -695
  37. languages/wp-table-reloaded-sv_SE.mo +0 -0
  38. languages/wp-table-reloaded-sv_SE.po +1312 -1039
  39. languages/wp-table-reloaded.pot +1110 -1055
  40. php/wp-table-reloaded-helper.class.php +0 -186
  41. readme.txt +31 -15
  42. views/index.php +3 -0
  43. views/view-about.php +100 -0
  44. views/view-add.php +36 -0
  45. views/view-ajax_list.php +55 -0
  46. views/view-ajax_preview.php +14 -0
  47. views/view-edit.php +460 -0
  48. views/view-export.php +73 -0
  49. views/view-import.php +153 -0
  50. views/view-list.php +94 -0
  51. views/view-options.php +227 -0
  52. views/view-uninstall.php +5 -0
  53. wp-table-reloaded-admin.php +0 -2994
  54. wp-table-reloaded-frontend.php +0 -676
  55. wp-table-reloaded.php +46 -17
admin/admin-script.dev.js CHANGED
@@ -74,6 +74,27 @@ jQuery(document).ready( function( $ ) {
74
}
75
});
76
77
// functions to make focussed textareas bigger (if backend option is enabled)
78
var focussed = null;
79
if ( WP_Table_Reloaded_Admin.option_growing_textareas ) {
@@ -86,10 +107,9 @@ jQuery(document).ready( function( $ ) {
86
87
// custom css textarea grows on focus
88
function css_textarea_focus() {
89
- $( '#options_custom_css' ).addClass('focus')
90
- .unbind( 'focus', css_textarea_focus );
91
}
92
- $( '#options_custom_css' ).bind( 'focus', css_textarea_focus );
93
94
// show export delimiter dropdown box only if export format is csv
95
$( '#export_format' ).change( function () {
@@ -146,34 +166,52 @@ jQuery(document).ready( function( $ ) {
146
} );
147
148
// enable/disable "use tableheadline" according to state of checkbox
149
- $( '#table_options_first_row_th' ).change( function () {
150
- if( WP_Table_Reloaded_Admin.option_datatables_active ) {
151
- if( $(this).attr('checked') && $( '#table_options_use_tablesorter' ).attr('checked') ) {
152
- $( '#table_options_datatables_sort' ).removeAttr( 'disabled' );
153
- } else {
154
- $( '#table_options_datatables_sort' ).attr( 'disabled', 'disabled' );
155
- }
156
- } else if( WP_Table_Reloaded_Admin.option_tablesorter_enabled ) {
157
if( $(this).attr('checked') ) {
158
$( '#table_options_use_tablesorter' ).removeAttr( 'disabled' );
159
} else {
160
$( '#table_options_use_tablesorter' ).attr( 'disabled', 'disabled' );
161
}
162
- }
163
- } );
164
165
- // enable/disable DataTables options according to checkbox state
166
- $( '#table_options_use_tablesorter' ).change( function () {
167
- if( WP_Table_Reloaded_Admin.option_datatables_active && $(this).attr('checked') ) {
168
- $( '.wp-table-reloaded-datatables-options input' ).removeAttr( 'disabled' );
169
- if ( !$( '#table_options_first_row_th' ).attr('checked') )
170
- $( '#table_options_datatables_sort' ).attr( 'disabled', 'disabled' );
171
- if ( !WP_Table_Reloaded_Admin.option_tabletools_active )
172
- $( '#table_options_datatables_tabletools' ).attr( 'disabled', 'disabled' );
173
174
- } else {
175
- $( '.wp-table-reloaded-datatables-options input' ).attr( 'disabled', 'disabled' );
176
- }
177
} );
178
179
// confirm uninstall setting
@@ -186,8 +224,7 @@ jQuery(document).ready( function( $ ) {
186
// insert link functions
187
var insert_html = '';
188
function add_html() {
189
- var current_content = $(this).val();
190
- $(this).val( current_content + insert_html );
191
$( '#table_contents textarea' ).unbind( 'click', add_html );
192
set_table_data_changed();
193
}
@@ -216,18 +253,17 @@ jQuery(document).ready( function( $ ) {
216
$( '#table_contents textarea' ).unbind( 'click', call_media_library_thickbox );
217
var link = $( '#a-insert-image' );
218
tb_show( link.attr('title'), link.attr('href'), link.attr('rel') );
219
$(this).blur();
220
set_table_data_changed();
221
}
222
223
function add_image() {
224
- $(this).unbind( 'click' ); // this unbind is for WP 2.8, where our script is added before thickbox.js
225
- $(this).bind('click', add_image);
226
- if ( true == confirm( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox ) )
227
$("#table_contents textarea").bind( 'click', call_media_library_thickbox );
228
return false;
229
}
230
- $( '#a-insert-image' ).unbind( 'click' ).bind('click', add_image); // this unbind is for WP < 2.8, where our script is added after thickbox.js
231
232
// not all characters allowed for name of Custom Data Field
233
$( '#insert_custom_field_name' ).keyup( function () {
@@ -342,7 +378,8 @@ jQuery(document).ready( function( $ ) {
342
343
function set_table_data_changed() {
344
table_data_changed = true;
345
- $( '#wp_table_reloaded_edit_table' ).find( '#table_id, #table_name, textarea' ).unbind( 'click', set_table_data_changed );
346
}
347
348
if ( WP_Table_Reloaded_Admin.option_show_exit_warning ) {
@@ -352,13 +389,53 @@ jQuery(document).ready( function( $ ) {
352
};
353
354
$("#wp_table_reloaded_edit_table input[name='submit[update]'], #wp_table_reloaded_edit_table input[name='submit[save_back]']").click(function(){
355
- $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options input' ).removeAttr( 'disabled' );
356
window.onbeforeunload = null;
357
} );
358
359
$( '#wp_table_reloaded_edit_table' ).find( '#table_name, textarea' ).bind( 'change', set_table_data_changed ); // see also ID change function above
360
-
361
- $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options :checkbox' ).bind( 'change', set_table_data_changed );
362
}
363
-
364
- } );
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 ) {
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 () {
166
} );
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' );
181
}
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
+ } else {
191
+ $( '.wp-table-reloaded-datatables-options input' ).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).attr('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' ).change( function () {
204
+ if( $(this).attr('checked') )
205
+ $( '#table_options_print_name_position' ).removeAttr( 'disabled' );
206
+ else
207
+ $( '#table_options_print_name_position' ).attr( 'disabled', 'disabled' );
208
+ } );
209
210
+ $( '#table_options_print_description' ).change( function () {
211
+ if( $(this).attr('checked') )
212
+ $( '#table_options_print_description_position' ).removeAttr( 'disabled' );
213
+ else
214
+ $( '#table_options_print_description_position' ).attr( 'disabled', 'disabled' );
215
} );
216
217
// confirm uninstall setting
224
// insert link functions
225
var insert_html = '';
226
function add_html() {
227
+ $(this).val( $(this).val() + insert_html );
228
$( '#table_contents textarea' ).unbind( 'click', add_html );
229
set_table_data_changed();
230
}
253
$( '#table_contents textarea' ).unbind( 'click', call_media_library_thickbox );
254
var link = $( '#a-insert-image' );
255
tb_show( link.attr('title'), link.attr('href'), link.attr('rel') );
256
+ tb_my_position();
257
$(this).blur();
258
set_table_data_changed();
259
}
260
261
function add_image() {
262
+ if ( confirm( WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox ) )
263
$("#table_contents textarea").bind( 'click', call_media_library_thickbox );
264
return false;
265
}
266
+ $( '#a-insert-image' ).bind('click', add_image);
267
268
// not all characters allowed for name of Custom Data Field
269
$( '#insert_custom_field_name' ).keyup( function () {
378
379
function set_table_data_changed() {
380
table_data_changed = true;
381
+ $( '#wp_table_reloaded_edit_table' ).find( '#table_name, textarea' ).unbind( 'change', set_table_data_changed );
382
+ $( '#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 );
383
}
384
385
if ( WP_Table_Reloaded_Admin.option_show_exit_warning ) {
389
};
390
391
$("#wp_table_reloaded_edit_table input[name='submit[update]'], #wp_table_reloaded_edit_table input[name='submit[save_back]']").click(function(){
392
+ $( '#wp_table_reloaded_edit_table .wp-table-reloaded-options input, #wp_table_reloaded_edit_table .wp-table-reloaded-options select' ).removeAttr( 'disabled' );
393
window.onbeforeunload = null;
394
} );
395
396
$( '#wp_table_reloaded_edit_table' ).find( '#table_name, textarea' ).bind( 'change', set_table_data_changed ); // see also ID change function above
397
+ $( '#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 );
398
}
399
+
400
+ tb_init( 'a.help-link' );
401
+ tb_init( 'a.preview-link' );
402
+ tb_my_position();
403
+
404
+ } );
405
+
406
+ /**
407
+ * Add contents of media-upload.js here, but modified so that not all windows get resized
408
+ */
409
+
410
+ // send html to the post editor
411
+ function send_to_editor(h) {
412
+ jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
413
+ tb_remove();
414
+ }
415
+
416
+ // thickbox settings
417
+ var tb_my_position;
418
+ (function($) {
419
+ tb_my_position = function() {
420
+ var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width;
421
+
422
+ if ( tbWindow.size() ) {
423
+ tbWindow.width( W - 50 ).height( H - 45 );
424
+ $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
425
+ tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
426
+ if ( typeof document.body.style.maxWidth != 'undefined' )
427
+ tbWindow.css({'top':'20px','margin-top':'0'});
428
+ };
429
+
430
+ return $('a.preview-link').each( function() {
431
+ var href = $(this).attr('href');
432
+ if ( ! href ) return;
433
+ href = href.replace(/&width=[0-9]+/g, '');
434
+ href = href.replace(/&height=[0-9]+/g, '');
435
+ $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
436
+ });
437
+ };
438
+
439
+ $(window).resize(function(){ tb_my_position(); });
440
+
441
+ })(jQuery);
admin/admin-script.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(b){b("#a-hide-rows").click(function(){var k=b('#table_contents tr:not(".table-foot") :checked').length;if(k==0){alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection)}else{b('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(true).parents("tr").addClass("row-hidden");c()}return false});b("#a-unhide-rows").click(function(){var k=b('#table_contents tr:not(".table-foot") :checked').length;if(k==0){alert(WP_Table_Reloaded_Admin.str_UnHideRowsNoSelection)}else{b('#table_contents tr:not(".table-foot") :checked').removeAttr("checked").next().val(false).parents("tr").removeClass("row-hidden");c()}return false});b("#a-hide-columns").click(function(){var k=b("#table_contents .table-foot :checked").length;if(k==0){alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection)}else{b("#table_contents .table-foot :checked").removeAttr("checked").next().val(true).each(function(){b("#table_contents ."+b(this).attr("id")).addClass("column-hidden")});c()}return false});b("#a-unhide-columns").click(function(){var k=b("#table_contents .table-foot :checked").length;if(k==0){alert(WP_Table_Reloaded_Admin.str_UnHideColsNoSelection)}else{b("#table_contents .table-foot :checked").removeAttr("checked").next().val(false).each(function(){b("#table_contents ."+b(this).attr("id")).removeClass("column-hidden")});c()}return false});b("#button-insert-rows").click(function(){var k=b('#table_contents tr:not(".table-foot") :checked').length;if(k==0){alert(WP_Table_Reloaded_Admin.str_InsertRowsNoSelection);return false}else{return true}});b("#button-insert-columns").click(function(){var k=b("#table_contents .table-foot :checked").length;if(k==0){alert(WP_Table_Reloaded_Admin.str_InsertColsNoSelection);return false}else{return true}});var e=null;if(WP_Table_Reloaded_Admin.option_growing_textareas){b("#table_contents textarea").focus(function(){b(e).removeClass("focus");e=b(this).parents("tr").find("textarea");b(e).addClass("focus")})}function g(){b("#options_custom_css").addClass("focus").unbind("focus",g)}b("#options_custom_css").bind("focus",g);b("#export_format").change(function(){if("csv"==b(this).val()){b(".tr-export-delimiter").show()}else{b(".tr-export-delimiter").hide()}}).change();var h=b(".wp-table-reloaded-table-information #table_id").val();b(".wp-table-reloaded-table-information #table_id").change(function(){if(h!=b(this).val()){if(confirm(WP_Table_Reloaded_Admin.str_ChangeTableID)){h=b(this).val();c()}else{b(this).val(h)}}});b(".tr-import-addreplace input").click(function(){if("replace"==b(".tr-import-addreplace input:checked").val()){b(".tr-import-addreplace-table").show()}else{b(".tr-import-addreplace-table").hide()}});b(".tr-import-addreplace input:checked").click();b(".tr-import-from input").click(function(){b(".tr-import-file-upload, .tr-import-url, .tr-import-form-field, .tr-import-server").hide();b(".tr-import-"+b(".tr-import-from input:checked").val()).show()});b(".tr-import-from input:checked").click();b("#options_use_custom_css").change(function(){if(b(this).attr("checked")){b("#options_custom_css").removeAttr("disabled")}else{b("#options_custom_css").attr("disabled","disabled")}});b("#options_enable_tablesorter").change(function(){if(b(this).attr("checked")){b("#options_tablesorter_script").removeAttr("disabled")}else{b("#options_tablesorter_script").attr("disabled","disabled")}});b("#table_options_first_row_th").change(function(){if(WP_Table_Reloaded_Admin.option_datatables_active){if(b(this).attr("checked")&&b("#table_options_use_tablesorter").attr("checked")){b("#table_options_datatables_sort").removeAttr("disabled")}else{b("#table_options_datatables_sort").attr("disabled","disabled")}}else{if(WP_Table_Reloaded_Admin.option_tablesorter_enabled){if(b(this).attr("checked")){b("#table_options_use_tablesorter").removeAttr("disabled")}else{b("#table_options_use_tablesorter").attr("disabled","disabled")}}}});b("#table_options_use_tablesorter").change(function(){if(WP_Table_Reloaded_Admin.option_datatables_active&&b(this).attr("checked")){b(".wp-table-reloaded-datatables-options input").removeAttr("disabled");if(!b("#table_options_first_row_th").attr("checked")){b("#table_options_datatables_sort").attr("disabled","disabled")}if(!WP_Table_Reloaded_Admin.option_tabletools_active){b("#table_options_datatables_tabletools").attr("disabled","disabled")}}else{b(".wp-table-reloaded-datatables-options input").attr("disabled","disabled")}});b("#options_uninstall_upon_deactivation").click(function(){if(b(this).attr("checked")){return confirm(WP_Table_Reloaded_Admin.str_UninstallCheckboxActivation)}});var i="";function d(){var k=b(this).val();b(this).val(k+i);b("#table_contents textarea").unbind("click",d);c()}b("#a-insert-link").click(function(){var m="";if(WP_Table_Reloaded_Admin.option_add_target_blank_to_links){m=' target="_blank"'}var l=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertURL+":","http://");if(l){var k=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText+":",WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertText);if(k){i='<a href="'+l+'"'+m+">"+k+"</a>";i=prompt(WP_Table_Reloaded_Admin.str_DataManipulationLinkInsertExplain,i);if(i){b("#table_contents textarea").bind("click",d)}}}return false});function a(){edCanvas=this;b("#table_contents textarea").unbind("click",a);var k=b("#a-insert-image");tb_show(k.attr("title"),k.attr("href"),k.attr("rel"));b(this).blur();c()}function f(){b(this).unbind("click");b(this).bind("click",f);if(true==confirm(WP_Table_Reloaded_Admin.str_DataManipulationImageInsertThickbox)){b("#table_contents textarea").bind("click",a)}return false}b("#a-insert-image").unbind("click").bind("click",f);b("#insert_custom_field_name").keyup(function(){b(this).val(b(this).val().toLowerCase().replace(/[^a-z0-9_-]/g,""))});b(".focus-blur-change").focus(function(){if(b(this).attr("title")==b(this).val()){b(this).val("")}}).blur(function(){if(""==b(this).val()){b(this).val(b(this).attr("title"))}});b("#table_custom_fields textarea").focus(function(){b("#table_custom_fields .focus").removeClass("focus");b(this).addClass("focus")});b("input.bulk_copy_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkCopyTablesLink)});b("input.bulk_delete_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkDeleteTablesLink)});b("input.bulk_wp_table_import_tables").click(function(){return confirm(WP_Table_Reloaded_Admin.str_BulkImportwpTableTablesLink)});b("a.copy_table_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_CopyTableLink)});b("#button-delete-rows").click(function(){var l=b('#table_contents tr:not(".table-foot") :checkbox').length-1;var k=b('#table_contents tr:not(".table-foot") :checked').length;if(k==0){alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNoSelection);return false}else{if(l==k){alert(WP_Table_Reloaded_Admin.str_DeleteRowsFailedNotAll);return false}else{return confirm(WP_Table_Reloaded_Admin.str_DeleteRowsConfirm)}}});b("#button-delete-columns").click(function(){var k=b("#table_contents .table-foot :checkbox").length;var l=b("#table_contents .table-foot :checked").length;if(l==0){alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNoSelection);return false}else{if(k==l){alert(WP_Table_Reloaded_Admin.str_DeleteColsFailedNotAll);return false}else{return confirm(WP_Table_Reloaded_Admin.str_DeleteColsConfirm)}}});b("a.import_wptable_link").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportwpTableLink)});b("#import_wp_table_reloaded_dump_file").click(function(){return confirm(WP_Table_Reloaded_Admin.str_ImportDumpFile)});b("#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}});b("a.cf_shortcode_link").click(function(){var k=prompt(WP_Table_Reloaded_Admin.str_CFShortcodeMessage,b(this).attr("title"));return false});b("a.table_shortcode_link").click(function(){var k=prompt(WP_Table_Reloaded_Admin.str_TableShortcodeMessage,b(this).attr("title"));return false});b(".postbox h3, .postbox .handlediv").click(function(){b(b(this).parent().get(0)).toggleClass("closed")});var j=false;function c(){j=true;b("#wp_table_reloaded_edit_table").find("#table_id, #table_name, textarea").unbind("click",c)}if(WP_Table_Reloaded_Admin.option_show_exit_warning){window.onbeforeunload=function(){if(j){return WP_Table_Reloaded_Admin.str_saveAlert}};b("#wp_table_reloaded_edit_table input[name='submit[update]'], #wp_table_reloaded_edit_table input[name='submit[save_back]']").click(function(){b("#wp_table_reloaded_edit_table .wp-table-reloaded-options input").removeAttr("disabled");window.onbeforeunload=null});b("#wp_table_reloaded_edit_table").find("#table_name, textarea").bind("change",c);b("#wp_table_reloaded_edit_table .wp-table-reloaded-options :checkbox").bind("change",c)}});
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")}}else{d(".wp-table-reloaded-datatables-options input").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("#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 e=a("#TB_window"),d=a(window).width(),c=a(window).height(),b=(720<d)?720:d;if(e.size()){e.width(b-50).height(c-45);a("#TB_iframeContent").width(b-50).height(c-75);e.css({"margin-left":"-"+parseInt(((b-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"20px","margin-top":"0"})}}return a("a.preview-link").each(function(){var f=a(this).attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");a(this).attr("href",f+"&width="+(b-80)+"&height="+(c-85))})};a(window).resize(function(){tb_my_position()})})(jQuery);
admin/admin-style.css CHANGED
@@ -1,5 +1 @@
1
- /****************************************************************
2
- * This CSS file belongs to the Admin part of WP-Table Reloaded! *
3
- * PLEASE DO NOT make any changes here! Thank you! *
4
- ****************************************************************/
5
- #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 .even{background-color:#F9F9F9;}#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;}.widefat td{vertical-align:baseline!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;}#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-left:5px;padding-right:5px;}.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{width:auto!important;height:94.5%!important;}#TB_ajaxContent .wrap{margin:0 7px 0 5px;}#TB_ajaxContent .wp-table-reloaded{background-color:#CDCDCD;width:100%;}#TB_ajaxContent .wp-table-reloaded th{border:1px solid #FFF;padding:4px;}#TB_ajaxContent .wp-table-reloaded td{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;}.dataTables_wrapper{clear:both;}.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
+ #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 .even{background-color:#F9F9F9;}#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;}#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;}#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-left:5px;padding-right:5px;}.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;}.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
@@ -104,6 +104,7 @@
104
.wp-table-reloaded-data-manipulation td {
105
padding-top:7px!important;
106
padding-bottom:7px!important;
107
}
108
109
.widefat td {
@@ -170,39 +171,40 @@ div.closed .hide_link { display: none; }
170
171
/* table styles for the table preview */
172
173
- /* Inner content div of thickbox needs to grow with outer div */
174
- #TB_ajaxContent {
175
- width:auto!important;
176
- height:94.5%!important;
177
- }
178
-
179
- #TB_ajaxContent .wrap {
180
- margin:0 7px 0 5px;
181
- }
182
-
183
#TB_ajaxContent .wp-table-reloaded {
184
- background-color:#CDCDCD;
185
- width:100%;
186
}
187
188
/* Styles for the tablehead (<th>) (if enabled) */
189
#TB_ajaxContent .wp-table-reloaded th {
190
- border:1px solid #FFF;
191
- padding:4px;
192
}
193
194
#TB_ajaxContent .wp-table-reloaded td {
195
- padding:4px;
196
- background-color:#FFF;
197
- vertical-align:top;
198
}
199
200
/* Styles for alternating row colors (if enabled) */
201
#TB_ajaxContent .wp-table-reloaded .even td {
202
- background-color:#FFF;
203
}
204
#TB_ajaxContent .wp-table-reloaded .odd td {
205
- background-color:#F0F0F6;
206
}
207
208
.dataTables_wrapper {
104
.wp-table-reloaded-data-manipulation td {
105
padding-top:7px!important;
106
padding-bottom:7px!important;
107
+ line-height: 2.2em;
108
}
109
110
.widefat td {
171
172
/* table styles for the table preview */
173
174
#TB_ajaxContent .wp-table-reloaded {
175
+ border-collapse: separate;
176
+ border-spacing: 1px;
177
+ background-color: #CDCDCD;
178
+ margin: 10px 0px 15px 0px;
179
+ font-size: 8pt;
180
+ width: 100%;
181
+ text-align: left;
182
}
183
184
/* Styles for the tablehead (<th>) (if enabled) */
185
#TB_ajaxContent .wp-table-reloaded th {
186
+ background-color: #E6EEEE;
187
+ border: 1px solid #FFFFFF;
188
+ padding: 4px;
189
}
190
191
#TB_ajaxContent .wp-table-reloaded td {
192
+ color: #3D3D3D;
193
+ padding: 4px;
194
+ background-color: #FFFFFF;
195
+ vertical-align: top;
196
}
197
198
/* Styles for alternating row colors (if enabled) */
199
#TB_ajaxContent .wp-table-reloaded .even td {
200
+ background-color: #FFFFFF;
201
}
202
#TB_ajaxContent .wp-table-reloaded .odd td {
203
+ background-color: #F0F0F6;
204
+ }
205
+
206
+ #TB_ajaxContent .wp-table-reloaded .row-hover tr:hover td {
207
+ background-color: #D0D0D6;
208
}
209
210
.dataTables_wrapper {
{php → classes}/arraysort.class.php RENAMED
@@ -1,14 +1,14 @@
1
<?php
2
- /*
3
- File Name: WP-Table Reloaded - array sort Class (see main file wp-table-reloaded.php)
4
- Plugin URI: http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/
5
- Description: This plugin allows you to create and manage tables in the admin-area of WordPress. You can then show them in your posts or on your pages by using a shortcode. The plugin is greatly influenced by the plugin "wp-Table" by Alex Rabe, but was completely rewritten and uses the state-of-the-art WordPress techniques which makes it faster and lighter than the original plugin.
6
- Version: 1.5
7
- Author: Tobias B&auml;thge
8
- Author URI: http://tobias.baethge.com/
9
- */
10
11
- // should be included by WP_Table_Reloaded_Admin!
12
class arraysort {
13
14
var $input_array = array();
1
<?php
2
+ /**
3
+ * Array Sort Class for WP-Table Reloaded, used to sort tables on the "Edit Table" screen
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
7
+ * @author Tobias B&auml;thge
8
+ * @since 1.2
9
+ */
10
11
+ // should be included by WP_Table_Reloaded_Controller_Admin!
12
class arraysort {
13
14
var $input_array = array();
php/wp-table-reloaded-export.class.php → classes/export.class.php RENAMED
@@ -1,19 +1,17 @@
1
<?php
2
- /*
3
- File Name: WP-Table Reloaded - Export Class (see main file wp-table-reloaded.php)
4
- Plugin URI: http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/
5
- Description: This plugin allows you to create and manage tables in the admin-area of WordPress. You can then show them in your posts or on your pages by using a shortcode. The plugin is greatly influenced by the plugin "wp-Table" by Alex Rabe, but was completely rewritten and uses the state-of-the-art WordPress techniques which makes it faster and lighter than the original plugin.
6
- Version: 1.5
7
- Author: Tobias B&auml;thge
8
- Author URI: http://tobias.baethge.com/
9
- */
10
-
11
- // should be included by WP_Table_Reloaded_Admin!
12
class WP_Table_Reloaded_Export {
13
14
// ###################################################################################################################
15
- var $export_class_version = '1.5';
16
-
17
var $export_formats = array();
18
var $delimiters = array();
19
@@ -101,16 +99,14 @@ class WP_Table_Reloaded_Export {
101
$string = stripslashes( $string );
102
return "\t\t<td>" . $string . "</td>\n";
103
}
104
-
105
// ###################################################################################################################
106
- function create_class_instance( $class, $file) {
107
- if ( !class_exists( $class ) ) {
108
- include_once ( WP_TABLE_RELOADED_ABSPATH . 'php/' . $file );
109
- if ( class_exists( $class ) )
110
- return new $class;
111
- }
112
}
113
-
114
} // class WP_Table_Reloaded_Export
115
116
?>
1
<?php
2
+ /**
3
+ * Export Class for WP-Table Reloaded, used to export single tables on the "Export Table" screen
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
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
99
$string = stripslashes( $string );
100
return "\t\t<td>" . $string . "</td>\n";
101
}
102
+
103
// ###################################################################################################################
104
+ function create_class_instance( $class, $file, $folder = 'classes' ) {
105
+ if ( !class_exists( $class ) )
106
+ include_once ( WP_TABLE_RELOADED_ABSPATH . $folder . '/' . $file );
107
+ return new $class;
108
}
109
+
110
} // class WP_Table_Reloaded_Export
111
112
?>
classes/helper.class.php ADDED
@@ -0,0 +1,127 @@
1
+ <?php
2
+ /**
3
+ * Helper Class for WP-Table Reloaded, with additional functions for the admin controller
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
7
+ * @author Tobias B&auml;thge
8
+ * @since 1.5
9
+ */
10
+
11
+ // should be included by WP_Table_Reloaded_Controller_Admin!
12
+ class WP_Table_Reloaded_Helper {
13
+
14
+ // ###################################################################################################################
15
+ // constructor class
16
+ function WP_Table_Reloaded_Helper() {
17
+ // nothing to init here
18
+ }
19
+
20
+ // ###################################################################################################################
21
+ function print_header_message( $text ) {
22
+ echo "<div id='message' class='updated fade'><p style='line-height:1.2;'><strong>{$text}</strong></p></div>";
23
+ }
24
+
25
+ // ###################################################################################################################
26
+ function print_page_header( $text = 'WP-Table Reloaded' ) {
27
+ echo <<<TEXT
28
+ <div class="wrap">
29
+ <h2>{$text}</h2>
30
+ <div id="poststuff">
31
+ TEXT;
32
+ }
33
+
34
+ // ###################################################################################################################
35
+ function print_page_footer() {
36
+ echo "</div></div>";
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
+
48
+ // ###################################################################################################################
49
+ function safe_output( $string ) {
50
+ $string = stripslashes( $string ); // because $string is add_slashed before WP stores it in DB
51
+ return wp_specialchars( $string, ENT_QUOTES, false, true );
52
+ }
53
+
54
+ // ###################################################################################################################
55
+ // create new two-dimensional array with $num_rows rows and $num_cols columns, each cell filled with $default_cell_content
56
+ function create_empty_table( $num_rows = 1, $num_cols = 1, $default_cell_content = '' ) {
57
+ return array_fill( 0, $num_rows, array_fill( 0, $num_cols, $default_cell_content ) );
58
+ }
59
+
60
+ // ###################################################################################################################
61
+ // need to clean this up and find out what's really necessary
62
+ function prepare_download( $filename, $filesize, $filetype ) {
63
+ @ob_end_clean();
64
+ //header( 'Content-Description: File Transfer' );
65
+ header( 'Content-Type: application/octet-stream' );
66
+ header( 'Content-Disposition: attachment; filename="' . $filename . '"');
67
+ header( 'Content-Length: ' . $filesize );
68
+ //header( 'Content-type: ' . $filetype. '; charset=' . get_option('blog_charset') );
69
+ }
70
+
71
+ // ###################################################################################################################
72
+ // add admin footer text
73
+ function add_admin_footer_text( $content ) {
74
+ $content .= ' | ' . __( 'Thank you for using <a href="http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/">WP-Table Reloaded</a>.', WP_TABLE_RELOADED_TEXTDOMAIN ) . ' ' . sprintf( __( 'Support the plugin with your <a href="%s">donation</a>!', WP_TABLE_RELOADED_TEXTDOMAIN ), 'http://tobias.baethge.com/donate-message/' );
75
+ return $content;
76
+ }
77
+
78
+ // ###################################################################################################################
79
+ // state of the postbox, can be filtered
80
+ function postbox_closed( $postbox_name, $postbox_closed ) {
81
+ $postbox_closed = apply_filters( 'wp_table_reloaded_admin_postbox_closed', $postbox_closed, $postbox_name );
82
+ $output = ( $postbox_closed ) ? ' closed' : '';
83
+ return $output;
84
+ }
85
+
86
+ // ###################################################################################################################
87
+ // retrieve the update message from the development server to notify user of what changes there are in this update, in his language
88
+ function retrieve_plugin_update_message( $current_version, $new_version ) {
89
+ $message = '';
90
+ $wp_locale = get_locale();
91
+ $update_message = wp_remote_fopen( "http://dev.tobias.baethge.com/plugin/update/wp-table-reloaded/{$current_version}/{$new_version}/{$wp_locale}/" );
92
+ if ( false !== $update_message ) {
93
+ if ( 1 == preg_match( '/<info>(.*?)<\/info>/is', $update_message, $matches ) )
94
+ $message = $matches[1];
95
+ }
96
+ return $message;
97
+ }
98
+
99
+ // ###################################################################################################################
100
+ // help buttons
101
+ function help_button( $id ) {
102
+ $help = array(
103
+ 'colspan' => array(
104
+ 'text' => __( 'Table cells can span across more than one column or row.', WP_TABLE_RELOADED_TEXTDOMAIN ) . '<br/><br/>' . __( 'Combining consecutive cells within the same row is called "colspanning".', WP_TABLE_RELOADED_TEXTDOMAIN ) . '<br/><br/>' . __( 'To combine cells, add the keyword #colspan# to the cell to the right of the one with the content for the combined cell by using the corresponding button.', WP_TABLE_RELOADED_TEXTDOMAIN ) . '<br/><br/>' . __( 'Repeat this to add the keyword to all cells that shall be connected.', WP_TABLE_RELOADED_TEXTDOMAIN ),
105
+ 'height' => 200,
106
+ 'width' => 300
107
+ ),
108
+ 'rowspan' => array(
109
+ 'text' => __( 'Table cells can span across more than one column or row.', WP_TABLE_RELOADED_TEXTDOMAIN ) . '<br/><br/>' . __( 'Combining consecutive cells within the same column is called "rowspanning".', WP_TABLE_RELOADED_TEXTDOMAIN ) . '<br/><br/>' . __( 'To combine cells, add the keyword #rowspan# to the cell below the one with the content for the combined cell by using the corresponding button.', WP_TABLE_RELOADED_TEXTDOMAIN ) . '<br/><br/>' . __( 'Repeat this to add the keyword to all cells that shall be connected.', WP_TABLE_RELOADED_TEXTDOMAIN ),
110
+ 'height' => 200,
111
+ 'width' => 300
112
+ )
113
+ );
114
+
115
+ if ( !isset( $help[ $id ] ) )
116
+ return '';
117
+
118
+ $title = __( 'Help', WP_TABLE_RELOADED_TEXTDOMAIN );
119
+ $text = $help[ $id ]['text'];
120
+ $height = $help[ $id ]['height'];
121
+ $width = $help[ $id ]['width'];
122
+ return "<a href=\"#TB_inline?height={$height}&width={$width}&inlineId=help-{$id}\" class=\"help-link button-secondary\" title=\"{$title}\">?</a><div id=\"help-{$id}\" style=\"display:none;\"><p>{$text}</p></div>";
123
+ }
124
+
125
+ } // class WP_Table_Reloaded_Helper
126
+
127
+ ?>
php/wp-table-reloaded-import.class.php → classes/import.class.php RENAMED
@@ -1,19 +1,17 @@
1
<?php
2
- /*
3
- File Name: WP-Table Reloaded - Import Class (see main file wp-table-reloaded.php)
4
- Plugin URI: http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/
5
- Description: This plugin allows you to create and manage tables in the admin-area of WordPress. You can then show them in your posts or on your pages by using a shortcode. The plugin is greatly influenced by the plugin "wp-Table" by Alex Rabe, but was completely rewritten and uses the state-of-the-art WordPress techniques which makes it faster and lighter than the original plugin.
6
- Version: 1.5
7
- Author: Tobias B&auml;thge
8
- Author URI: http://tobias.baethge.com/
9
- */
10
-
11
- // should be included by WP_Table_Reloaded_Admin!
12
class WP_Table_Reloaded_Import {
13
14
// ###################################################################################################################
15
- var $import_class_version = '1.5';
16
-
17
// possible import formats
18
var $import_formats = array();
19
@@ -308,11 +306,10 @@ class WP_Table_Reloaded_Import {
308
}
309
310
// ###################################################################################################################
311
- function create_class_instance( $class, $file) {
312
- if ( !class_exists( $class ) ) {
313
- include_once ( WP_TABLE_RELOADED_ABSPATH . 'php/' . $file );
314
- return new $class;
315
- }
316
}
317
318
// ###################################################################################################################
1
<?php
2
+ /**
3
+ * Import Class for WP-Table Reloaded, used to import single tables on the "Import Table" screen
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
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_Import {
13
14
// ###################################################################################################################
15
// possible import formats
16
var $import_formats = array();
17
306
}
307
308
// ###################################################################################################################
309
+ function create_class_instance( $class, $file, $folder = 'classes' ) {
310
+ if ( !class_exists( $class ) )
311
+ include_once ( WP_TABLE_RELOADED_ABSPATH . $folder . '/' . $file );
312
+ return new $class;
313
}
314
315
// ###################################################################################################################
{php → classes}/index.php RENAMED
File without changes
{php → classes}/parsecsv.class.php RENAMED
@@ -1,4 +1,11 @@
1
<?php
2
3
class parseCSV {
4
@@ -207,7 +214,7 @@ class parseCSV {
207
* @param fields field names
208
* @return true or false
209
*/
210
- function save ($file = null, $data = array(), $append = false, $fields = array()) {
211
if ( empty($file) ) $file = &$this->file;
212
$mode = ( $append ) ? 'at' : 'wt' ;
213
$is_php = ( preg_match('/\.php#x2F;i', $file) ) ? true : false ;
@@ -317,7 +324,7 @@ class parseCSV {
317
// filtering
318
$depth = ( $to_end ) ? $n-1 : $n ;
319
$filtered = array();
320
- foreach( $chars as $char => $value ) {
321
if ( $match = $this->_check_count($char, $value, $depth, $preferred) ) {
322
$filtered[$match] = $char;
323
}
@@ -397,7 +404,7 @@ class parseCSV {
397
'info' => 'Syntax error found on row '.$error_row.'. Non-enclosed fields can not contain double-quotes.',
398
'row' => $error_row,
399
'field' => $error_col,
400
- 'field_name' => (!empty($head[$col])) ? $head[$col] : null,
401
);
402
}
403
$current .= $ch;
@@ -425,7 +432,7 @@ class parseCSV {
425
'Enclosed double-quotes must be escaped with a second double-quote.',
426
'row' => count($rows) + 1,
427
'field' => $col + 1,
428
- 'field_name' => (!empty($head[$col])) ? $head[$col] : null,
429
);
430
}
431
$current .= $ch;
@@ -448,7 +455,7 @@ class parseCSV {
448
if ( $this->_validate_offset($row_count) && $this->_validate_row_conditions($row, $this->conditions) ) {
449
if ( $this->heading && empty($head) ) {
450
$head = $row;
451
- } elseif ( empty($this->fields) || (!empty($this->fields) && (($this->heading && $row_count > 0) || !$this->heading)) ) {
452
if ( !empty($this->sort_by) && !empty($row[$this->sort_by]) ) {
453
if ( isset($rows[$row[$this->sort_by]]) ) {
454
$rows[$row[$this->sort_by].'_0'] = &$rows[$row[$this->sort_by]];
@@ -512,7 +519,7 @@ class parseCSV {
512
513
// create heading
514
if ( $this->heading && !$append && !empty($fields) ) {
515
- foreach( $fields as $key => $value ) {
516
$entry[] = $this->_enclose_value($value);
517
}
518
$string .= implode($delimiter, $entry).$this->linefeed;
@@ -520,8 +527,8 @@ class parseCSV {
520
}
521
522
// create data
523
- foreach( $data as $key => $row ) {
524
- foreach( $row as $field => $value ) {
525
$entry[] = $this->_enclose_value($value);
526
}
527
$string .= implode($delimiter, $entry).$this->linefeed;
@@ -577,11 +584,11 @@ class parseCSV {
577
if ( !empty($conditions) ) {
578
$conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : array($conditions) ;
579
$or = '';
580
- foreach( $conditions as $key => $value ) {
581
if ( strpos($value, ' AND ') !== false ) {
582
$value = explode(' AND ', $value);
583
$and = '';
584
- foreach( $value as $k => $v ) {
585
$and .= $this->_validate_row_condition($row, $v);
586
}
587
$or .= (strpos($and, '0') !== false) ? '0' : '1' ;
@@ -614,7 +621,7 @@ class parseCSV {
614
'does not contain',
615
);
616
$operators_regex = array();
617
- foreach( $operators as $value ) {
618
$operators_regex[] = preg_quote($value, '/');
619
}
620
$operators_regex = implode('|', $operators_regex);
@@ -708,7 +715,7 @@ class parseCSV {
708
$first = null;
709
$equal = null;
710
$almost = false;
711
- foreach( $array as $key => $value ) {
712
if ( $first == null ) {
713
$first = $value;
714
} elseif ( $value == $first && $equal !== false) {
@@ -725,7 +732,7 @@ class parseCSV {
725
$match = ( $almost ) ? 2 : 1 ;
726
$pref = strpos($preferred, $char);
727
$pref = ( $pref !== false ) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999' ;
728
- return $pref.$match.'.'.(99999 - str_pad($first, 5, '0', STR_PAD_LEFT));
729
} else return false;
730
}
731
}
@@ -737,8 +744,8 @@ class parseCSV {
737
*/
738
function _rfile ($file = null) {
739
if ( is_readable($file) ) {
740
- if ( !($fh = fopen($file, 'r')) ) return false;
741
- $data = fread($fh, filesize($file));
742
fclose($fh);
743
return $data;
744
}
1
<?php
2
+ /**
3
+ * CSV Parsing Class for WP-Table Reloaded, used for import and export
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
7
+ * @since 1.2
8
+ */
9
10
class parseCSV {
11
214
* @param fields field names
215
* @return true or false
216
*/
217
+ function save ($file = null, $data = array(), $append = false, $fields = array() ) {
218
if ( empty($file) ) $file = &$this->file;
219
$mode = ( $append ) ? 'at' : 'wt' ;
220
$is_php = ( preg_match('/\.php#x2F;i', $file) ) ? true : false ;
324
// filtering
325
$depth = ( $to_end ) ? $n-1 : $n ;
326
$filtered = array();
327
+ foreach ( $chars as $char => $value ) {
328
if ( $match = $this->_check_count($char, $value, $depth, $preferred) ) {
329
$filtered[$match] = $char;
330
}
404
'info' => 'Syntax error found on row '.$error_row.'. Non-enclosed fields can not contain double-quotes.',
405
'row' => $error_row,
406
'field' => $error_col,
407
+ 'field_name' => (!empty($head[$col]) ) ? $head[$col] : null,
408
);
409
}
410
$current .= $ch;
432
'Enclosed double-quotes must be escaped with a second double-quote.',
433
'row' => count($rows) + 1,
434
'field' => $col + 1,
435
+ 'field_name' => (!empty($head[$col]) ) ? $head[$col] : null,
436
);
437
}
438
$current .= $ch;
455
if ( $this->_validate_offset($row_count) && $this->_validate_row_conditions($row, $this->conditions) ) {
456
if ( $this->heading && empty($head) ) {
457
$head = $row;
458
+ } elseif ( empty($this->fields) || (!empty($this->fields) && ( ($this->heading && $row_count > 0) || !$this->heading) ) ) {
459
if ( !empty($this->sort_by) && !empty($row[$this->sort_by]) ) {
460
if ( isset($rows[$row[$this->sort_by]]) ) {
461
$rows[$row[$this->sort_by].'_0'] = &$rows[$row[$this->sort_by]];
519
520
// create heading
521
if ( $this->heading && !$append && !empty($fields) ) {
522
+ foreach ( $fields as $key => $value ) {
523
$entry[] = $this->_enclose_value($value);
524
}
525
$string .= implode($delimiter, $entry).$this->linefeed;
527
}
528
529
// create data
530
+ foreach ( $data as $key => $row ) {
531
+ foreach ( $row as $field => $value ) {
532
$entry[] = $this->_enclose_value($value);
533
}
534
$string .= implode($delimiter, $entry).$this->linefeed;
584
if ( !empty($conditions) ) {
585
$conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : array($conditions) ;
586
$or = '';
587
+ foreach ( $conditions as $key => $value ) {
588
if ( strpos($value, ' AND ') !== false ) {
589
$value = explode(' AND ', $value);
590
$and = '';
591
+ foreach ( $value as $k => $v ) {
592
$and .= $this->_validate_row_condition($row, $v);
593
}
594
$or .= (strpos($and, '0') !== false) ? '0' : '1' ;
621
'does not contain',
622
);
623
$operators_regex = array();
624
+ foreach ( $operators as $value ) {
625
$operators_regex[] = preg_quote($value, '/');
626
}
627
$operators_regex = implode('|', $operators_regex);
715
$first = null;
716
$equal = null;
717
$almost = false;
718
+ foreach ( $array as $key => $value ) {
719
if ( $first == null ) {
720
$first = $value;
721
} elseif ( $value == $first && $equal !== false) {
732
$match = ( $almost ) ? 2 : 1 ;
733
$pref = strpos($preferred, $char);
734
$pref = ( $pref !== false ) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999' ;
735
+ return $pref.$match.'.'.(99999 - str_pad($first, 5, '0', STR_PAD_LEFT) );
736
} else return false;
737
}
738
}
744
*/
745
function _rfile ($file = null) {
746
if ( is_readable($file) ) {
747
+ if ( !($fh = fopen($file, 'r') ) ) return false;
748
+ $data = fread($fh, filesize($file) );
749
fclose($fh);
750
return $data;
751
}
classes/render.class.php ADDED
@@ -0,0 +1,308 @@
1
+ <?php
2
+ /**
3
+ * Table Rendering Class for WP-Table Reloaded, used to generate HTML output for tables on the frontend
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
7
+ * @author Tobias B&auml;thge
8
+ * @since 1.6
9
+ */
10
+
11
+ /**
12
+ * Table Rendering class
13
+ */
14
+ class WP_Table_Reloaded_Render {
15
+
16
+ /**
17
+ * Stores the table and the output options
18
+ * @var array
19
+ */
20
+ var $table = array();
21
+ var $output_options = array();
22
+
23
+ /**
24
+ * Trigger words for colspan, rowspan, or the combination of both
25
+ * @var string
26
+ */
27
+ var $colspan_trigger = '#colspan#';
28
+ var $rowspan_trigger = '#rowspan#';
29
+ var $bothspan_trigger = '#span#';
30
+
31
+ /**
32
+ * Variables to temporarily store the counts of colspan/rowspan per column/row, initialized in render_table()
33
+ * @var array
34
+ */
35
+ var $rowspan = array();
36
+ var $colspan = array();
37
+
38
+ /**
39
+ * PHP4 class constructor
40
+ */
41
+ function WP_Table_Reloaded_Render() {
42
+ // nothing to init here
43
+ }
44
+
45
+ /**
46
+ * Returns the rendered HTML of a table
47
+ */
48
+ function render_table() {
49
+
50
+ // get only relevant data to render
51
+ $table = $this->get_render_data();
52
+
53
+ // allow overwriting the colspan and rowspan trigger keywords, by table ID
54
+ $this->colspan_trigger = apply_filters( 'wp_table_reloaded_colspan_trigger', $this->colspan_trigger, $table['id'] );
55
+ $this->rowspan_trigger = apply_filters( 'wp_table_reloaded_rowspan_trigger', $this->rowspan_trigger, $table['id'] );
56
+ $this->bothspan_trigger = apply_filters( 'wp_table_reloaded_bothspan_trigger', $this->bothspan_trigger, $table['id'] );
57
+
58
+ // classes that will be added to <table class=...>, can be used for CSS styling
59
+ $cssclasses = array( 'wp-table-reloaded', "wp-table-reloaded-id-{$table['id']}" );
60
+ $cssclasses = apply_filters( 'wp_table_reloaded_table_css_class', $cssclasses, $table['id'] );
61
+ $cssclasses = implode( ' ', $cssclasses );
62
+
63
+ $rows = count( $table['data'] );
64
+ $cols = (0 < $rows) ? count( $table['data'][0] ) : 0;
65
+
66
+ // make array $shortcode_atts['column_widths'] have $cols entries
67
+ $this->output_options['column_widths'] = array_pad( $this->output_options['column_widths'], $cols, '' );
68
+
69
+ $output = '';
70
+
71
+ if ( 0 < $rows && 0 < $cols ) {
72
+
73
+ if ( $this->output_options['print_name'] ) {
74
+ $print_name_html_tag = apply_filters( 'wp_table_reloaded_print_name_html_tag', 'h2', $table['id'] );
75
+ $print_name_css_class = apply_filters( 'wp_table_reloaded_print_name_css_class', 'wp-table-reloaded-table-name', $table['id'] );
76
+ $name_html = "<{$print_name_html_tag} class=\"{$print_name_css_class}\">" . $this->safe_output( $table['name'] ) . "</{$print_name_html_tag}>\n";
77
+ $print_name_position = $this->output_options['print_name_position'];
78
+ $print_name_position = apply_filters( 'wp_table_reloaded_print_name_position', $print_name_position, $table['id'] );
79
+
80
+ if ( 'above' == $print_name_position )
81
+ $output .= $name_html;
82
+ }
83
+
84
+ if ( $this->output_options['print_description'] ) {
85
+ $print_description_html_tag = apply_filters( 'wp_table_reloaded_print_description_html_tag', 'span', $table['id'] );
86
+ $print_description_css_class = apply_filters( 'wp_table_reloaded_print_description_css_class', 'wp-table-reloaded-table-description', $table['id'] );
87
+ $description_html = "<{$print_description_html_tag} class=\"{$print_description_css_class}\">" . $this->safe_output( $table['description'] ) . "</{$print_description_html_tag}>\n";
88
+ $print_description_position = $this->output_options['print_description_position'];
89
+ $print_description_position = apply_filters( 'wp_table_reloaded_print_description_position', $print_description_position, $table['id'] );
90
+
91
+ if ( 'above' == $print_description_position )
92
+ $output .= $description_html;
93
+ }
94
+
95
+ $output = apply_filters( 'wp_table_reloaded_pre_output_table', $output, $table['id'] );
96
+ $output = apply_filters( 'wp_table_reloaded_pre_output_table_id-' . $table['id'], $output );
97
+
98
+ $print_colgroup_tag = apply_filters( 'wp_table_reloaded_print_colgroup_tag', false, $table['id'] );
99
+ $colgroup = '';
100
+ if ( $print_colgroup_tag ) {
101
+ for ( $col = 1; $col <= $cols; $col++ ) {
102
+ $attributes = "class=\"colgroup-col-{$col}\" ";
103
+ $attributes = apply_filters( 'wp_table_reloaded_colgroup_tag_attributes', $attributes, $table['id'], $col );
104
+ $colgroup .= "\t<col {$attributes}/>\n";
105
+ }
106
+ }
107
+
108
+ $thead = '';
109
+ $tbody = array();
110
+ $tfoot = '';
111
+
112
+ // span counters for rows and columns, init to 1 for each row and column
113
+ $this->rowspan = array_fill( 0, $cols, 1 );
114
+ $this->colspan = array_fill( 0, $rows, 1 );
115
+
116
+ $last_row_idx = $rows - 1; // index of the last row
117
+ // go through rows in reversed order, to search for rowspan
118
+ for ( $row_idx = $last_row_idx; $row_idx >= 0; $row_idx-- ) {
119
+ $row = $table['data'][ $row_idx ];
120
+
121
+ // last row, need to check for footer
122
+ if ( $last_row_idx == $row_idx && $this->output_options['table_footer'] ) {
123
+ $tfoot = $this->render_row( $row, $row_idx, 'th' );
124
+ continue;
125
+ }
126
+
127
+ // first row, need to check for head
128
+ if ( 0 == $row_idx && $this->output_options['first_row_th'] ) {
129
+ $thead = $this->render_row( $row, $row_idx, 'th' );
130
+ continue;
131
+ }
132
+
133
+ // neither first nor last row (with respective head/foot enabled)
134
+ $tbody[] = $this->render_row( $row, $row_idx, 'td' );
135
+ }
136
+
137
+ $tbody_class = ( $this->output_options['row_hover'] ) ? ' class="row-hover"' : '';
138
+
139
+ if ( !empty( $this->output_options['edit_table_url'] ) ) {
140
+ $edit_table_link = "<a href=\"{$this->output_options['edit_table_url']}\" title=\"" . __( 'Edit' ) . "\">" . __( 'Edit' ) . "</a>";
141
+ $caption = "<caption style=\"caption-side: bottom; text-align: left; border:none; background: none;\">{$edit_table_link}</caption>\n";
142
+ }
143
+
144
+ $colgroup = ( !empty( $colgroup ) ) ? "<colgroup>\n{$colgroup}</colgroup>\n" : '';
145
+ $thead = ( !empty( $thead ) ) ? "<thead>\n{$thead}</thead>\n" : '';
146
+ $tbody = array_reverse( $tbody ); // because we handle the rows in reversed order
147
+ $tbody = "<tbody{$tbody_class}>\n" . implode( '', $tbody ) . "</tbody>\n";
148
+ $tfoot = ( !empty( $tfoot ) ) ? "<tfoot>\n{$tfoot}</tfoot>\n" : '';
149
+
150
+ $cellspacing = ( false !== $this->output_options['cellspacing'] ) ? " cellspacing=\"{$this->output_options['cellspacing']}\"" : '';
151
+ $cellpadding = ( false !== $this->output_options['cellpadding'] ) ? " cellpadding=\"{$this->output_options['cellpadding']}\"" : '';
152
+ $border = ( false !== $this->output_options['border'] ) ? " border=\"{$this->output_options['border']}\"" : '';
153
+
154
+ $output .= "\n<table id=\"{$this->output_options['html_id']}\" class=\"{$cssclasses}\"{$cellspacing}{$cellpadding}{$border}>\n";
155
+ $output .= $caption . $colgroup . $thead . $tfoot . $tbody;
156
+ $output .= "</table>\n";
157
+
158
+ $output = apply_filters( 'wp_table_reloaded_post_output_table', $output, $table['id'] );
159
+ $output = apply_filters( 'wp_table_reloaded_post_output_table_id-' . $table['id'], $output );
160
+
161
+ // name/description below table (HTML already generated above
162
+ if ( $this->output_options['print_name'] && 'below' == $print_name_position )
163
+ $output .= $name_html;
164
+ if ( $this->output_options['print_description'] && 'below' == $print_description_position )
165
+ $output .= $description_html;
166
+
167
+ } // endif rows and cols exist
168
+
169
+ $output = apply_filters( 'wp_table_reloaded_output_table', $output , $table['id'] );
170
+ $output = apply_filters( 'wp_table_reloaded_output_table_id-' . $table['id'], $output );
171
+
172
+ return $output;
173
+ }
174
+
175
+ /**
176
+ * Returns the rendered HTML of a row
177
+ */
178
+ function render_row( $row, $row_idx, $tag ) {
179
+ $table_id = $this->table['id'];
180
+
181
+ $row_cells = array();
182
+ $last_col_idx = count( $row ) - 1;
183
+ // go through cells in reversed order, to search for colspan
184
+ for ( $col_idx = $last_col_idx; $col_idx >= 0; $col_idx-- ) {
185
+ $cell_content = $row[ $col_idx ];
186
+
187
+ $cell_content = do_shortcode( $this->safe_output( $cell_content ) );
188
+ $cell_content = apply_filters( 'wp_table_reloaded_cell_content', $cell_content, $table_id, $row_idx + 1, $col_idx + 1 );
189
+
190
+ if ( $this->bothspan_trigger == $cell_content ) { // there will be a combined col- and rowspan
191
+ // check for #span# in first column or first row, which doesn't make sense
192
+ if ( 0 != $col_idx && 0 != $row_idx ) {
193
+ continue;
194
+ }
195
+ $cell_content = '&nbsp;'; // in that case we set the cell content from '#span#' to a space
196
+ } elseif ( $this->colspan_trigger == $cell_content ) { // there will be a colspan
197
+ // check for #colspan# in first column, which doesn't make sense
198
+ if ( 0 != $col_idx ) {
199
+ $this->colspan[ $row_idx ]++; // increase counter for colspan in this row
200
+ $this->rowspan[ $col_idx ] = 1; // reset counter for rowspan in this column, combined col- and rowspan might be happening
201
+ continue;
202
+ }
203
+ $cell_content = '&nbsp;'; // in that case we set the cell content from '#colspan#' to a space
204
+ } elseif ( $this->rowspan_trigger == $cell_content ) { // there will be a rowspan
205
+ // check for #rowspan# in first row, which doesn't make sense
206
+ if ( 0 != $row_idx ) {
207
+ $this->rowspan[ $col_idx ]++; // increase counter for rowspan in this column
208
+ $this->colspan[ $row_idx ] = 1; // reset counter for colspan in this row, combined col- and rowspan might be happening
209
+ continue;
210
+ }
211
+ $cell_content = '&nbsp;'; // in that case we set the cell content from '#rowspan#' to a space
212
+ }
213
+
214
+ $span_attr = '';
215
+ $col_class = 'column-' . ( $col_idx + 1 );
216
+ if ( 1 < $this->colspan[ $row_idx ] ) { // we have colspaned columns
217
+ $span_attr .= " colspan=\"{$this->colspan[ $row_idx ]}\"";
218
+ $col_class .= " colspan-{$this->colspan[ $row_idx ]}";
219
+ }
220
+ if ( 1 < $this->rowspan[ $col_idx ] ) { // we have colspaned columns
221
+ $span_attr .= " rowspan=\"{$this->rowspan[ $col_idx ]}\"";
222
+ $col_class .= " rowspan-{$this->rowspan[ $col_idx ]}";
223
+ }
224
+
225
+ $col_class = apply_filters( 'wp_table_reloaded_cell_css_class', $col_class, $table_id, $row_idx + 1, $col_idx + 1, $this->colspan[ $row_idx ], $this->rowspan[ $col_idx ] );
226
+ $class_attr = ( !empty( $col_class ) ) ? " class=\"{$col_class}\"" : '';
227
+ $style_attr = ( ( 0 == $row_idx ) && !empty( $this->output_options['column_widths'][$col_idx] ) ) ? " style=\"width:{$this->output_options['column_widths'][$col_idx]};\"" : '';
228
+
229
+ if ( $this->output_options['first_column_th'] && 0 == $col_idx )
230
+ $tag = 'th';
231
+
232
+ $row_cells[] = "<{$tag}{$span_attr}{$class_attr}{$style_attr}>{$cell_content}</${tag}>";
233
+ $this->colspan[ $row_idx ] = 1; // reset
234
+ $this->rowspan[ $col_idx ] = 1; // reset
235
+ }
236
+
237
+ $row_class = 'row-' . ( $row_idx + 1 ) ;
238
+ if ( $this->output_options['alternating_row_colors'] )
239
+ $row_class = ( 1 == ($row_idx % 2) ) ? $row_class . ' even' : $row_class . ' odd';
240
+ $row_class = apply_filters( 'wp_table_reloaded_row_css_class', $row_class, $table_id, $row_idx + 1 );
241
+ if ( !empty( $row_class ) )
242
+ $row_class = " class=\"{$row_class}\"";
243
+
244
+ $row_cells = array_reverse( $row_cells ); // because we handle the cells in reversed order
245
+ $row_cells = implode( '', $row_cells );
246
+
247
+ $row_html = "\t<tr{$row_class}>\n\t\t{$row_cells}\n\t</tr>\n";
248
+ return $row_html;
249
+ }
250
+
251
+ /**
252
+ * Remove all cells that shall not be rendered, because they are hidden, from the data set
253
+ */
254
+ function get_render_data() {
255
+ $table = $this->table;
256
+
257
+ // if row_offset or row_count were given, we cut that part from the table and show just that
258
+ // ATTENTION: MIGHT BE DROPPED IN FUTURE VERSIONS!
259
+ if ( null === $this->output_options['row_count'] )
260
+ $table['data'] = array_slice( $table['data'], $this->output_options['row_offset'] - 1 ); // -1 because we start from 1
261
+ else
262
+ $table['data'] = array_slice( $table['data'], $this->output_options['row_offset'] - 1, $this->output_options['row_count'] ); // -1 because we start from 1
263
+
264
+ // load information about hidden rows and columns
265
+ $hidden_rows = isset( $table['visibility']['rows'] ) ? array_keys( $table['visibility']['rows'], true ) : array();
266
+ $hidden_rows = array_merge( $hidden_rows, $this->output_options['hide_rows'] );
267
+ $hidden_rows = array_diff( $hidden_rows, $this->output_options['show_rows'] );
268
+ $hidden_columns = isset( $table['visibility']['columns'] ) ? array_keys( $table['visibility']['columns'], true ) : array();
269
+ $hidden_columns = array_merge( $hidden_columns, $this->output_options['hide_columns'] );
270
+ $hidden_columns = array_merge( array_diff( $hidden_columns, $this->output_options['show_columns'] ) );
271
+
272
+ // remove hidden rows and re-index
273
+ foreach ( $hidden_rows as $row_idx ) {
274
+ unset( $table['data'][$row_idx] );
275
+ }
276
+ $table['data'] = array_merge( $table['data'] );
277
+ // remove hidden columns and re-index
278
+ foreach ( $table['data'] as $row_idx => $row ) {
279
+ foreach ( $hidden_columns as $col_idx ) {
280
+ unset( $row[$col_idx] );
281
+ }
282
+ $table['data'][$row_idx] = array_merge( $row );
283
+ }
284
+ return $table;
285
+ }
286
+
287
+ /**
288
+ * Possibly escape the string, replace certain entities, replace newlines with HTML newlines
289
+ *
290
+ * @param string $string The string to escape
291
+ * @return string The escaped string
292
+ */
293
+ function safe_output( $string ) {
294
+ // replace any & with &amp; that is not already an encoded entity (from function htmlentities2 in WP 2.8)
295
+ // complete htmlentities2() or htmlspecialchars() would encode <HTML> tags, which we don't want
296
+ $string = preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/", "&amp;", $string );
297
+ // remove slashes, as strings are stored with slashes in DB
298
+ $string = stripslashes( $string );
299
+ // change line breaks, nl2br can be overwritten to false, if not wanted
300
+ $apply_nl2br = apply_filters( 'wp_table_reloaded_apply_nl2br', true );
301
+ if ( $apply_nl2br )
302
+ $string = nl2br( $string );
303
+ return $string;
304
+ }
305
+
306
+ } // class WP_Table_Reloaded_Render
307
+
308
+ ?>
{php → classes}/simplexml.class.php RENAMED
@@ -1,10 +1,16 @@
1
<?php
2
3
/**
4
* If the result will be an object, this container class is used.
5
*
6
*/
7
-
8
class SimpleXMLObject{
9
function attributes(){
10
$container = get_object_vars($this);
@@ -40,8 +46,8 @@ class simplexml {
40
{
41
$temp = '';
42
for ($c = $this->ignore_level + 1; $c < $level + 1; $c++) {
43
- if (isset($tags[$c]) && (is_numeric(trim($tags[$c])) || trim($tags[$c]))) {
44
- if (is_numeric($tags[$c])) {
45
$temp .= '[' . $tags[$c] . ']';
46
} else {
47
$temp .= '["' . $tags[$c] . '"]';
@@ -63,11 +69,11 @@ class simplexml {
63
$repeats_count = array();
64
$repeats = array();
65
66
- if (is_array($array)) {
67
$n = count($array) - 1;
68
for ($i = 0; $i < $n; $i++) {
69
$idn = $array[$i]['tag'].$array[$i]['level'];
70
- if(in_array($idn,$repeats_temp)){
71
$repeats_count[array_search($idn,$repeats_temp)]+=1;
72
}else{
73
array_push($repeats_temp,$idn);
@@ -77,7 +83,7 @@ class simplexml {
77
}
78
$n = count($repeats_count);
79
for($i=0;$i<$n;$i++){
80
- if($repeats_count[$i]>1){
81
array_push($repeats,$repeats_temp[$i]);
82
}
83
}
@@ -96,26 +102,26 @@ class simplexml {
96
function array2object ($arg_array)
97
{
98
99
- if (is_array($arg_array)) {
100
$keys = array_keys($arg_array);
101
- if(!is_numeric($keys[0])) $tmp = new SimpleXMLObject;
102
foreach ($keys as $key) {
103
- if (is_numeric($key)) $has_number = true;
104
- if (is_string($key)) $has_string = true;
105
}
106
- if (isset($has_number) and !isset($has_string)) {
107
foreach ($arg_array as $key => $value) {
108
$tmp[] = $this->array2object($value);
109
}
110
- } elseif (isset($has_string)) {
111
foreach ($arg_array as $key => $value) {
112
- if (is_string($key))
113
$tmp->$key = $this->array2object($value);
114
}
115
}
116
- } elseif (is_object($arg_array)) {
117
foreach ($arg_array as $key => $value) {
118
- if (is_array($value) or is_object($value))
119
$tmp->$key = $this->array2object($value);
120
else
121
$tmp->$key = $value;
@@ -134,13 +140,13 @@ class simplexml {
134
*/
135
function array_reindex($array)
136
{
137
- if (is_array($array)) {
138
- foreach($array as $keys => $items) {
139
- if (is_array($items)) {
140
- if (is_numeric($keys)) {
141
$array[$keys] = $this->array_reindex($items);
142
} else {
143
- $array[$keys] = $this->array_reindex(array_merge(array(), $items));
144
}
145
}
146
}
@@ -168,20 +174,20 @@ class simplexml {
168
switch ($array[$i]['type']) {
169
case 'open':
170
array_push($tags, $array[$i]['tag']);
171
- if ($i > 0 && ($array[$i]['tag'] == $array[$i-1]['tag']) && ($array[$i-1]['type'] == 'close'))
172
$k++;
173
- if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values)) {
174
array_push($tags, '@content');
175
$this->array_insert(count($tags), $tags, $array[$i]['value'], "open");
176
array_pop($tags);
177
}
178
179
- if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
180
- if (($repeatedone == $array[$i]['tag'] . $array[$i]['level']) && ($repeatedone)) {
181
- array_push($tags, strval($k++));
182
} else {
183
$repeatedone = $array[$i]['tag'] . $array[$i]['level'];
184
- array_push($tags, strval($k));
185
}
186
}
187
@@ -198,7 +204,7 @@ class simplexml {
198
199
case 'close':
200
array_pop($tags);
201
- if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
202
if ($repeatedone == $array[$i]['tag'] . $array[$i]['level']) {
203
array_pop($tags);
204
} else {
@@ -210,16 +216,16 @@ class simplexml {
210
211
case 'complete':
212
array_push($tags, $array[$i]['tag']);
213
- if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
214
if ($repeatedone == $array[$i]['tag'] . $array[$i]['level'] && $repeatedone) {
215
- array_push($tags, strval($k));
216
} else {
217
$repeatedone = $array[$i]['tag'] . $array[$i]['level'];
218
- array_push($tags, strval($k));
219
}
220
}
221
222
- if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values)) {
223
if (isset($array[$i]['attributes']) && $array[$i]['attributes']) {
224
array_push($tags, '@content');
225
$this->array_insert(count($tags), $tags, $array[$i]['value'], "complete");
@@ -239,7 +245,7 @@ class simplexml {
239
array_pop($tags);
240
}
241
242
- if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {
243
array_pop($tags);
244
$k++;
245
}
@@ -297,10 +303,10 @@ class simplexml {
297
if (!$ok) {
298
$errmsg = sprintf("XML parse error %d '%s' at line %d, column %d (byte index %d)",
299
xml_get_error_code($parser),
300
- xml_error_string(xml_get_error_code($parser)),
301
xml_get_current_line_number($parser),
302
xml_get_current_column_number($parser),
303
- xml_get_current_byte_index($parser));
304
}
305
306
xml_parser_free($parser);
@@ -309,7 +315,7 @@ class simplexml {
309
if ($resulttype == 'array')
310
return $this->xml_reorganize($values);
311
// default $resulttype is 'object'
312
- return $this->array2object($this->xml_reorganize($values));
313
}
314
}
315
1
<?php
2
+ /**
3
+ * XML Parsing Class for WP-Table Reloaded, used for import and export
4
+ *
5
+ * @package WP-Table Reloaded
6
+ * @subpackage Classes
7
+ * @since 1.0
8
+ */
9
10
/**
11
* If the result will be an object, this container class is used.
12
*
13
*/
14
class SimpleXMLObject{
15
function attributes(){
16
$container = get_object_vars($this);
46
{
47
$temp = '';
48
for ($c = $this->ignore_level + 1; $c < $level + 1; $c++) {
49
+ if (isset($tags[$c]) && (is_numeric(trim($tags[$c]) ) || trim($tags[$c]) ) ) {
50
+ if (is_numeric($tags[$c]) ) {
51
$temp .= '[' . $tags[$c] . ']';
52
} else {
53
$temp .= '["' . $tags[$c] . '"]';
69
$repeats_count = array();
70
$repeats = array();
71
72
+ if (is_array($array) ) {
73
$n = count($array) - 1;
74
for ($i = 0; $i < $n; $i++) {
75
$idn = $array[$i]['tag'].$array[$i]['level'];
76
+ if (in_array($idn,$repeats_temp) ){
77
$repeats_count[array_search($idn,$repeats_temp)]+=1;
78
}else{
79
array_push($repeats_temp,$idn);
83
}
84
$n = count($repeats_count);
85
for($i=0;$i<$n;$i++){
86
+ if ($repeats_count[$i]>1){
87
array_push($repeats,$repeats_temp[$i]);
88
}
89
}
102
function array2object ($arg_array)
103
{
104
105
+ if (is_array($arg_array) ) {
106
$keys = array_keys($arg_array);
107
+ if (!is_numeric($keys[0]) ) $tmp = new SimpleXMLObject;
108
foreach ($keys as $key) {
109
+ if (is_numeric($key) ) $has_number = true;
110
+ if (is_string($key) ) $has_string = true;
111
}
112
+ if (isset($has_number) and !isset($has_string) ) {
113
foreach ($arg_array as $key => $value) {
114
$tmp[] = $this->array2object($value);
115
}
116
+ } elseif (isset($has_string) ) {
117
foreach ($arg_array as $key => $value) {
118
+ if (is_string($key) )
119
$tmp->$key = $this->array2object($value);
120
}
121
}
122
+ } elseif (is_object($arg_array) ) {
123
foreach ($arg_array as $key => $value) {
124
+ if (is_array($value) or is_object($value) )
125
$tmp->$key = $this->array2object($value);
126
else
127
$tmp->$key = $value;
140
*/
141
function array_reindex($array)
142
{
143
+ if (is_array($array) ) {
144
+ foreach ($array as $keys => $items) {
145
+ if (is_array($items) ) {
146
+ if (is_numeric($keys) ) {
147
$array[$keys] = $this->array_reindex($items);
148
} else {
149
+ $array[$keys] = $this->array_reindex(array_merge(array(), $items) );
150
}
151
}
152
}
174
switch ($array[$i]['type']) {
175
case 'open':
176
array_push($tags, $array[$i]['tag']);
177
+ if ($i > 0 && ($array[$i]['tag'] == $array[$i-1]['tag']) && ($array[$i-1]['type'] == 'close') )
178
$k++;
179
+ if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values) ) {
180
array_push($tags, '@content');
181
$this->array_insert(count($tags), $tags, $array[$i]['value'], "open");
182
array_pop($tags);
183
}
184
185
+ if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat) ) {
186
+ if ( ($repeatedone == $array[$i]['tag'] . $array[$i]['level']) && ($repeatedone) ) {
187
+ array_push($tags, strval($k++) );
188
} else {
189
$repeatedone = $array[$i]['tag'] . $array[$i]['level'];
190
+ array_push($tags, strval($k) );
191
}
192
}
193
204
205
case 'close':
206
array_pop($tags);
207
+ if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat) ) {
208
if ($repeatedone == $array[$i]['tag'] . $array[$i]['level']) {
209
array_pop($tags);
210
} else {
216
217
case 'complete':
218
array_push($tags, $array[$i]['tag']);
219
+ if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat) ) {
220
if ($repeatedone == $array[$i]['tag'] . $array[$i]['level'] && $repeatedone) {
221
+ array_push($tags, strval($k) );
222
} else {
223
$repeatedone = $array[$i]['tag'] . $array[$i]['level'];
224
+ array_push($tags, strval($k) );
225
}
226
}
227
228
+ if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values) ) {
229
if (isset($array[$i]['attributes']) && $array[$i]['attributes']) {
230
array_push($tags, '@content');
231
$this->array_insert(count($tags), $tags, $array[$i]['value'], "complete");
245
array_pop($tags);
246
}
247
248
+ if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat) ) {
249
array_pop($tags);
250
$k++;
251
}
303
if (!$ok) {
304
$errmsg = sprintf("XML parse error %d '%s' at line %d, column %d (byte index %d)",
305
xml_get_error_code($parser),
306
+ xml_error_string(xml_get_error_code($parser) ),
307
xml_get_current_line_number($parser),
308
xml_get_current_column_number($parser),
309
+ xml_get_current_byte_index($parser) );
310
}
311
312
xml_parser_free($parser);
315
if ($resulttype == 'array')
316
return $this->xml_reorganize($values);
317
// default $resulttype is 'object'
318
+ return $this->array2object($this->xml_reorganize($values) );
319
}
320
}
321
controllers/controller-admin.php ADDED
@@ -0,0 +1,1859 @@