Easy Table - Version 0.1

Version Description

No

Download this release

Release Info

Developer takien
Plugin Icon wp plugin Easy Table
Version 0.1
Comparing to
See all releases

Version 0.1

easy-table-style.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Bootstrap v2.0.3
3
+ *
4
+ * Copyright 2012 Twitter, Inc
5
+ * Licensed under the Apache License v2.0
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Designed and built with all the love in the world @twitter by @mdo and @fat.
9
+ */
10
+ .clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";}
11
+ .clearfix:after{clear:both;}
12
+ .hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;}
13
+ .input-block-level{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;}
14
+ table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0;}
15
+ .table{width:100%;margin-bottom:18px;}.table th,.table td{padding:8px;line-height:18px;text-align:left;vertical-align:top;border-top:1px solid #dddddd;}
16
+ .table th{font-weight:bold;}
17
+ .table thead th{vertical-align:bottom;}
18
+ .table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0;}
19
+ .table tbody+tbody{border-top:2px solid #dddddd;}
20
+ .table-condensed th,.table-condensed td{padding:4px 5px;}
21
+ .table-bordered{border:1px solid #dddddd;border-collapse:separate;*border-collapse:collapsed;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.table-bordered th,.table-bordered td{border-left:1px solid #dddddd;}
22
+ .table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0;}
23
+ .table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px;}
24
+ .table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px;}
25
+ .table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;}
26
+ .table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;}
27
+ .table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9;}
28
+ .table tbody tr:hover td,.table tbody tr:hover th{background-color:#f5f5f5;}
29
+ table caption{
30
+ font-weight:bold;
31
+ margin-bottom:10px;
32
+ }
33
+ table.tablesorter thead tr .header {
34
+ background-image: url(images/bg.gif);
35
+ background-repeat: no-repeat;
36
+ background-position: center right;
37
+ cursor: pointer;
38
+ }
39
+ table.tablesorter thead tr .headerSortUp {
40
+ background-image: url(images/asc.gif);
41
+ }
42
+ table.tablesorter thead tr .headerSortDown {
43
+ background-image: url(images/desc.gif);
44
+ }
easy-table.php ADDED
@@ -0,0 +1,502 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Easy Table
4
+ Plugin URI: http://takien.com/
5
+ Description: Create table in post, page, or widget in easy way.
6
+ Author: Takien
7
+ Version: 0.1
8
+ Author URI: http://takien.com/
9
+ */
10
+
11
+ /* Copyright 2012 takien.com
12
+
13
+ This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License as published by
15
+ the Free Software Foundation; either version 2 of the License, or
16
+ (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ For a copy of the GNU General Public License, write to the Free Software
24
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
+ */
26
+
27
+ if(!defined('ABSPATH')) die();
28
+
29
+ if (!class_exists('EasyTable')) {
30
+ class EasyTable {
31
+
32
+
33
+ /**
34
+ * Default settings
35
+ * Plugin will use this setting if user not made custom setting via settings page or tag.
36
+ */
37
+ var $settings = Array(
38
+ 'shortcodetag' => 'table',
39
+ 'tablewidget' => false,
40
+ 'class' => 'table-striped',
41
+ 'caption' => false,
42
+ 'width' => '100%',
43
+ 'align' => 'left',
44
+ 'th' => true,
45
+ 'border' => 0,
46
+ 'id' => false,
47
+ 'tablesorter' => false,
48
+ 'loadcss' => true,
49
+ 'delimiter' => ',',
50
+ 'file' => false,
51
+ 'enclosure' => '&quot;',
52
+ 'escape' => '\\',
53
+ 'csvfile' => false
54
+ );
55
+
56
+
57
+ function EasyTable(){
58
+ $this->__construct();
59
+ }
60
+
61
+ function __construct(){
62
+ $plugin = plugin_basename(__FILE__);
63
+ add_filter("plugin_action_links_$plugin", array(&$this,'easy_table_settings_link' ));
64
+
65
+ load_plugin_textdomain('easy-table', false, basename( dirname( __FILE__ ) ) . '/languages' );
66
+
67
+ add_action('admin_init', array(&$this,'easy_table_register_setting'));
68
+ add_action('admin_head', array(&$this,'easy_table_admin_script'));
69
+ add_action('wp_enqueue_scripts', array(&$this,'easy_table_script'));
70
+ add_action('wp_enqueue_scripts', array(&$this,'easy_table_style'));
71
+ add_action('admin_menu', array(&$this,'easy_table_add_page'));
72
+ add_action('contextual_help', array(&$this,'easy_table_help'));
73
+ add_shortcode($this->get_easy_table_option('shortcodetag'), array(&$this,'easy_table_short_code'));
74
+ if($this->get_easy_table_option('tablewidget')){
75
+ add_filter('widget_text', 'do_shortcode');
76
+ }
77
+ }
78
+
79
+
80
+ private function easy_table_base($return){
81
+ $easy_table_base = Array(
82
+ 'name' => 'Easy Table',
83
+ 'version' => '0.1',
84
+ 'plugin-domain' => 'easy-table'
85
+ );
86
+ return $easy_table_base[$return];
87
+ }
88
+ function easy_table_short_code($atts, $content="") {
89
+ $shortcode_atts = shortcode_atts(array(
90
+ 'class' => $this->get_easy_table_option('class'),
91
+ 'caption' => $this->get_easy_table_option('caption'),
92
+ 'width' => $this->get_easy_table_option('width'),
93
+ 'align' => $this->get_easy_table_option('align'),
94
+ 'th' => $this->get_easy_table_option('th'),
95
+ 'border' => $this->get_easy_table_option('border'),
96
+ 'id' => $this->get_easy_table_option('id'),
97
+ 'tablesorter' => $this->get_easy_table_option('tablesorter'),
98
+ 'delimiter' => $this->get_easy_table_option('delimiter'),
99
+ 'enclosure' => $this->get_easy_table_option('enclosure'),
100
+ 'escape' => $this->get_easy_table_option('escape'),
101
+ 'file' => $this->get_easy_table_option('file')
102
+ ), $atts);
103
+
104
+ $content = clean_pre($content);
105
+ $content = str_replace('&nbsp;','',$content);
106
+ $char_codes = array( '&#8216;', '&#8217;', '&#8220;', '&#8221;', '&#8242;', '&#8243;' );
107
+ $replacements = array( "'", "'", '"', '"', "'", '"' );
108
+ $content = str_replace( $char_codes, $replacements, $content );
109
+
110
+ return $this->csv_to_table($content,$shortcode_atts);
111
+ }
112
+
113
+ /**
114
+ * Convert CSV to table
115
+ * @param array|string $data could be CSV string or array
116
+ * @param array @args
117
+ * @return string
118
+ */
119
+ private function csv_to_table($data,$args){
120
+ extract($args);
121
+
122
+ if($file){
123
+ $data = @file_get_contents($file);
124
+ }
125
+
126
+ if(empty($data)) return false;
127
+
128
+ if(!is_array($data)){
129
+ $data = $this->csv_to_array(trim($data), $delimiter, html_entity_decode($enclosure), $escape);
130
+ }
131
+ $max_cols = count(max($data));
132
+ $i=0;
133
+ $output = '<table '.($id ? 'id="'.$id.'"':'').' width="'.$width.'" align="'.$align.'" class="'.($tablesorter ? 'tablesorter table ':'').$class.'" '.(($border !=='0') ? 'border="'.$border.'"' : '').'>';
134
+ $output .= ($caption !=='') ? '<caption>'.$caption.'</caption>' : '';
135
+ $output .= $th ? '<thead>' : '<tbody>';
136
+ foreach($data as $k=>$v){ $i++;
137
+ $v = array_pad($v,$max_cols,'');
138
+ $output .= "\r\n".'<tr>';
139
+ if($i==1){
140
+ $thtd = $th ? 'th' : 'td';
141
+ $output .= "<$thtd>".implode("</$thtd><$thtd>",array_values($v))."</$thtd>";
142
+ }
143
+ else{
144
+ $output .= '<td>'.implode("</td><td>",array_values($v)).'</td>';
145
+ }
146
+ $output .= '</tr>';
147
+ $output .= (($i==1) AND $th) ? '</thead><tbody>' : '';
148
+ }
149
+ $output .= $th ? '</tbody>' : '';
150
+ $output .= '</table>';
151
+ return $output;
152
+ }
153
+
154
+ /**
155
+ * Convert CSV to array
156
+ */
157
+ private function csv_to_array($csv, $delimiter = ',', $enclosure = '"', $escape = '\\', $terminator = "\n") {
158
+ $r = array();
159
+
160
+ $rows = str_getcsv($csv, $terminator,$enclosure,$escape);
161
+ $rows = array_diff($rows,Array(''));
162
+
163
+ foreach($rows as &$row) {
164
+ $row = str_getcsv($row, $delimiter,$enclosure,$escape);
165
+ $r[] = $row;
166
+ }
167
+ return $r;
168
+ }
169
+
170
+ /**
171
+ * Retrieve options from database if any, or use default options instead.
172
+ */
173
+ function get_easy_table_option($return=''){
174
+ $option = get_option('easy_table_plugin_option');
175
+ if($return){
176
+ return ($option[$return] !== '') ? $option[$return] : $this->settings[$return];
177
+ }
178
+ else{
179
+ return $option;
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Register plugin setting
185
+ */
186
+ function easy_table_register_setting() {
187
+ register_setting('easy_table_option_field', 'easy_table_plugin_option');
188
+ }
189
+
190
+ /**
191
+ * Render form
192
+ * @param array
193
+ */
194
+ function render_form($fields){
195
+ $output ='<table class="form-table">';
196
+ foreach($fields as $field){
197
+ if($field['type']=='text'){
198
+ $output .= '<tr><th><label for="'.$field['name'].'">'.$field['label'].'</label></th>';
199
+ $output .= '<td><input type="text" id="'.$field['name'].'" name="'.$field['name'].'" value="'.$field['value'].'" />';
200
+ $output .= ' <span class="description">'.$field['description'].'</span></td></tr>';
201
+ }
202
+ if($field['type']=='checkbox'){
203
+ $output .= '<tr><th><label for="'.$field['name'].'">'.$field['label'].'</label></th>';
204
+ $output .= '<td><input type="checkbox" id="'.$field['name'].'" name="'.$field['name'].'" value="'.$field['value'].'" '.$field['attr'].' />';
205
+ $output .= ' <span class="description">'.$field['description'].'</span></td></tr>';
206
+ }
207
+ }
208
+ $output .= '</table>';
209
+ return $output;
210
+ }
211
+
212
+ /**
213
+ * Register javascript
214
+ */
215
+ function easy_table_script() {
216
+ if($this->get_easy_table_option('tablesorter')) {
217
+ wp_enqueue_script('jquery');
218
+ wp_register_script('easy_table_script',plugins_url( 'jquery.tablesorter.min.js' , __FILE__ ),'jquery');
219
+ wp_enqueue_script('easy_table_script');
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Register stylesheet
225
+ */
226
+ function easy_table_style() {
227
+ if($this->get_easy_table_option('loadcss')) {
228
+ wp_register_style('easy_table_style', plugins_url('easy-table-style.css', __FILE__),false,$this->easy_table_base('version'));
229
+ wp_enqueue_style( 'easy_table_style');
230
+ }
231
+ }
232
+
233
+
234
+
235
+
236
+ function easy_table_admin_script(){
237
+ $page = isset($_GET['page']) ? $_GET['page'] : '';
238
+ if($page == $this->easy_table_base('plugin-domain')) {
239
+ if($this->get_easy_table_option('tablesorter')) { ?>
240
+ <script src="<?php echo plugins_url( 'jquery.tablesorter.min.js' , __FILE__);?>"></script>
241
+ <?php }
242
+ if($this->get_easy_table_option('loadcss')) { ?>
243
+ <link rel="stylesheet" href="<?php echo plugins_url('easy-table-style.css', __FILE__);?> " />
244
+ <?php } ?>
245
+ <style type="text/css">
246
+ .left,
247
+ .right{
248
+ float:left;
249
+ width:49%
250
+ }
251
+ .toggledesc{
252
+ float:right;
253
+ margin-right:20px;
254
+ }
255
+ </style>
256
+ <script type="text/javascript">
257
+ //<![CDATA[
258
+ jQuery(document).ready(function($){
259
+ $('.toggledesc a').click(function(e){
260
+ $('span.description').toggle();
261
+ e.preventDefault();
262
+ });
263
+ });
264
+ //]]>
265
+ </script>
266
+ <?php
267
+ }
268
+ } /* end easy_table_admin_script*/
269
+
270
+ /**
271
+ * Add action link to plugins page
272
+ * from plugins listing.
273
+ */
274
+ function easy_table_settings_link($links) {
275
+ $settings_link = '<a href="options-general.php?page='.$this->easy_table_base('plugin-domain').'">'.__('Settings','easy-table').'</a>';
276
+ array_unshift($links, $settings_link);
277
+ return $links;
278
+ }
279
+
280
+ /**
281
+ * Contextual help
282
+ */
283
+ function easy_table_help($help) {
284
+ $page = isset($_GET['page']) ? $_GET['page'] : '';
285
+ if($page == $this->easy_table_base('plugin-domain')) {
286
+ $help = '<h2>'.$this->easy_table_base('name').' '.$this->easy_table_base('version').'</h2>';
287
+ $help .= '<h5>'.__('Instruction','easy-table').':</h5>
288
+ <ol><li>'.__('Once plugin installed, go to plugin options page to configure some options','easy-table').'</li>';
289
+ $help .= '<li>'.__('You are ready to write a table in post or page.','easy-table').'</li>';
290
+ $help .= '<li>'.__('To be able write table in widget you have to check <em>Enable render table in widget</em> option in the option page.','easy-table').'</li></ol>';
291
+
292
+ return $help;
293
+ }
294
+ }
295
+
296
+ /**
297
+ * Add plugin page
298
+ */
299
+ function easy_table_add_page() {
300
+ add_options_page($this->easy_table_base('name'), $this->easy_table_base('name'), 'administrator', $this->easy_table_base('plugin-domain'), array(&$this,'easy_table_page'));
301
+ }
302
+
303
+ /**
304
+ * Plugin option page
305
+ */
306
+ function easy_table_page() { ?>
307
+ <div class="wrap">
308
+ <h2><?php printf(__('%s Option','easy-table'), $this->easy_table_base('name'));?></h2>
309
+ <div class="left">
310
+ <form method="post" action="options.php">
311
+ <?php
312
+ wp_nonce_field('update-options');
313
+ settings_fields('easy_table_option_field');
314
+
315
+ ?>
316
+ <span class="toggledesc"><em><a href="#"><?php _e('Show/hide description');?></a></em></span>
317
+ <h3><?php _e('General options','easy-table');?></h3>
318
+ <?php
319
+ $fields = Array(
320
+ Array(
321
+ 'name' => 'easy_table_plugin_option[shortcodetag]',
322
+ 'label' => __('Short code tag','easy-table'),
323
+ 'type' => 'text',
324
+ 'description' => __('Shortcode tag, type "table" if you want to use [table] short tag.','easy-table'),
325
+ 'value' => $this->get_easy_table_option('shortcodetag')
326
+ )
327
+ ,Array(
328
+ 'name' => 'easy_table_plugin_option[tablewidget]',
329
+ 'label' => __('Also render table in widget?','easy-table'),
330
+ 'type' => 'checkbox',
331
+ 'description' => __('Check this if you want the table could be rendered in widget.','easy-table'),
332
+ 'value' => 1,
333
+ 'attr' => $this->get_easy_table_option('tablewidget') ? 'checked="checked"' : '')
334
+ );
335
+ echo $this->render_form($fields);
336
+
337
+ $fields = Array(
338
+ Array(
339
+ 'name' => 'easy_table_plugin_option[tablesorter]',
340
+ 'label' => __('Use tablesorter?','easy-table'),
341
+ 'type' => 'checkbox',
342
+ 'value' => 1,
343
+ 'description' => __('Check this to use tablesorter jQuery plugin','easy-table'),
344
+ 'attr' => $this->get_easy_table_option('tablesorter') ? 'checked="checked"':'')
345
+ ,Array(
346
+ 'name' => 'easy_table_plugin_option[th]',
347
+ 'label' => __('Use TH for the first row?','easy-table'),
348
+ 'type' => 'checkbox',
349
+ 'value' => 1,
350
+ 'description' => __('Check this if you want to use first row as table head (required by tablesorter)','easy-table'),
351
+ 'attr' => $this->get_easy_table_option('th') ? 'checked="checked"' : '')
352
+ ,Array(
353
+ 'name' => 'easy_table_plugin_option[loadcss]',
354
+ 'label' => __('Load CSS?','easy-table'),
355
+ 'type' => 'checkbox',
356
+ 'value' => 1,
357
+ 'description' => __('Check this to use CSS included in this plugin to styling table, you may unceck if you want to write your own style.','easy-table'),
358
+ 'attr' => $this->get_easy_table_option('loadcss') ? 'checked="checked"':'')
359
+ ,Array(
360
+ 'name' => 'easy_table_plugin_option[class]',
361
+ 'label' => __('Table class','easy-table'),
362
+ 'type' => 'text',
363
+ 'description' => __('Table class attribute, if you use bootstrap CSS, you should add at least "table" class.','easy-table'),
364
+ 'value' => $this->get_easy_table_option('class'))
365
+ ,Array(
366
+ 'name' => 'easy_table_plugin_option[width]',
367
+ 'label' => __('Table width','easy-table'),
368
+ 'type' => 'text',
369
+ 'description' => __('Table width, in pixel or percent (may be overriden by CSS)','easy-table'),
370
+ 'value' => $this->get_easy_table_option('width'))
371
+ ,Array(
372
+ 'name' => 'easy_table_plugin_option[align]',
373
+ 'label' => __('Table align','easy-table'),
374
+ 'type' => 'text',
375
+ 'description' => __('Table align, left/right/center (may be overriden by CSS)','easy-table'),
376
+ 'value' => $this->get_easy_table_option('align'))
377
+ ,Array(
378
+ 'name' =>'easy_table_plugin_option[border]',
379
+ 'label' => __('Table border','easy-table'),
380
+ 'type' => 'text',
381
+ 'description' => __('Table border (may be overriden by CSS)','easy-table'),
382
+ 'value' => $this->get_easy_table_option('border'))
383
+ );
384
+ ?>
385
+
386
+ <h3><?php _e('Table options','easy-table');?></h3>
387
+ <?php
388
+ echo $this->render_form($fields);
389
+ ?>
390
+
391
+ <h3><?php _e('Parser Option','easy-table');?></h3>
392
+ <p><em><?php _e('Do not change this unless you know what you\'re doing','easy-table');?></em>
393
+ </p>
394
+ <?php
395
+ $fields = Array(
396
+ Array(
397
+ 'name' => 'easy_table_plugin_option[delimiter]',
398
+ 'label' => __('Delimiter','easy-table'),
399
+ 'type' => 'text',
400
+ 'value' => $this->get_easy_table_option('delimiter'),
401
+ 'description' => __('CSV delimiter (default is comma)','easy-table'))
402
+ ,Array(
403
+ 'name' => 'easy_table_plugin_option[enclosure]',
404
+ 'label' => __('Enclosure','easy-table'),
405
+ 'type' => 'text',
406
+ 'value' => htmlentities($this->get_easy_table_option('enclosure')),
407
+ 'description' => __('CSV enclosure (default is double quote)','easy-table'))
408
+ ,Array(
409
+ 'name' => 'easy_table_plugin_option[escape]',
410
+ 'label' => __('Escape','easy-table'),
411
+ 'type' => 'text',
412
+ 'value' => $this->get_easy_table_option('escape'),
413
+ 'description' =>__('CSV escape (default is backslash)','easy-table'))
414
+ ,Array(
415
+ 'name' => 'easy_table_plugin_option[csvfile]',
416
+ 'label' => __('Allow read CSV from file?','easy-table'),
417
+ 'type' => 'checkbox',
418
+ 'value' => 1,
419
+ 'description' => __('Check this if you also want to convert CSV file to table','easy-table'),
420
+ 'attr' => $this->get_easy_table_option('csvfile') ? 'checked="checked"' : '')
421
+ );
422
+ echo $this->render_form($fields);
423
+ ?>
424
+
425
+ <input type="hidden" name="action" value="update" />
426
+ <input type="hidden" name="easy_table_option_field" value="easy_table_plugin_option" />
427
+ <p><input type="submit" class="button-primary" value="<?php _e('Save','easy-table');?>" /> </p>
428
+ </form>
429
+ </div>
430
+ <div class="right">
431
+ <?php
432
+ $defaulttableexample = '[table caption="Just test table"]
433
+ row1col1,row1col2,row1col3
434
+ row2col1,row2col2,row2col3
435
+ row3col1,row3col2,row3col3
436
+ [/table]';
437
+ $tableexample = $defaulttableexample;
438
+ if(isset($_POST['test-easy-table'])){
439
+ $tableexample = $_POST['easy-table-test-area'];
440
+ }
441
+
442
+ if(isset($_POST['test-easy-table-reset'])){
443
+ $tableexample = $defaulttableexample;
444
+ }
445
+ ?>
446
+ <h3><?php _e('Possible parameter','easy-table');?></h3>
447
+ <p><?php _e('These parameters commonly can override global options in the left side of this page. Example usage:','easy-table');?></p><p> <code>[table param1="param-value1" param2="param-value2"]table data[/table]</code></p>
448
+ <ol>
449
+ <li><strong>class</strong>, <?php _e('default value','easy-table');?> <em>'table-striped'</em>, <?php _e('another value','easy-table');?> <em>table-bordered, table-striped, table-condensed</em></li>
450
+ <li><strong>caption</strong>,<?php _e('default value','easy-table');?> <em>''</em></li>
451
+ <li><strong>width</strong>, <?php _e('default value','easy-table');?> <em>'100%'</em></li>
452
+ <li><strong>align</strong>, <?php _e('default value','easy-table');?> <em>'left'</em></li>
453
+ <li><strong>th</strong>, <?php _e('default value','easy-table');?> <em>'true'</em></li>
454
+ <li><strong>border</strong>, <?php _e('default value','easy-table');?> <em>'0'</em></li>
455
+ <li><strong>id</strong>, <?php _e('default value','easy-table');?> <em>'false'</em></li>
456
+ <li><strong>tablesorter</strong>, <?php _e('default value','easy-table');?> <em>'false'</em></li>
457
+ <li><strong>file</strong>, <?php _e('default value','easy-table');?> <em>'false'</em></li>
458
+ </ol>
459
+ <h3><?php _e('Test area:','easy-table');?></h3>
460
+ <form action="" method="post">
461
+ <textarea name="easy-table-test-area" style="width:500px;height:200px;border:1px solid #ccc"><?php echo trim(htmlentities(stripslashes($tableexample)));?>
462
+ </textarea>
463
+ <input type="hidden" name="test-easy-table" value="1" />
464
+ <p><input class="button" type="submit" name="test-easy-table-reset" value="<?php _e('Reset','easy-table');?>" />
465
+ <input class="button-primary" type="submit" value="<?php _e('Update preview','easy-table');?>' &raquo;" /></p></form>
466
+ <div>
467
+ <h3><?php _e('Preview','easy-table');?></h3>
468
+ <?php echo do_shortcode(stripslashes($tableexample));?>
469
+ </div>
470
+
471
+ </div>
472
+ <div class="clear"></div>
473
+ <p><a href="http://takien.com/plugins/easy-table"><?php _e('Any question or suggestion? Click here!','easy-table');?></a></p>
474
+ </div><!--wrap-->
475
+ <?php
476
+ }
477
+
478
+ } /* end class */
479
+ }
480
+ add_action('init', 'easy_table_init');
481
+ function easy_table_init() {
482
+ if (class_exists('EasyTable')) {
483
+ new EasyTable();
484
+ }
485
+ }
486
+
487
+ /**
488
+ * Create function str_getcsv if not exists in server
489
+ */
490
+ if (!function_exists('str_getcsv')) {
491
+ function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") {
492
+ $fiveMBs = 5 * 1024 * 1024;
493
+ $fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+');
494
+ fputs($fp, $input);
495
+ rewind($fp);
496
+
497
+ $data = fgetcsv($fp, 1000, $delimiter, $enclosure); // $escape only got added in 5.3.0
498
+
499
+ fclose($fp);
500
+ return $data;
501
+ }
502
+ }
images/asc.gif ADDED
Binary file
images/bg.gif ADDED
Binary file
images/desc.gif ADDED
Binary file
images/index.html ADDED
File without changes
index.html ADDED
File without changes
jquery.tablesorter.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ (function($){$.extend({tablesorter:new
2
+ function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
3
+ var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
4
+ jQuery(document).ready(function($) {
5
+ $("table.tablesorter").tablesorter()
6
+ });
languages/easy-table-id_ID.mo ADDED
Binary file
languages/easy-table-id_ID.po ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: easy-table 0.1\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-05-21 02:59+0700\n"
6
+ "PO-Revision-Date: 2012-05-21 02:59+0700\n"
7
+ "Last-Translator: takien <contact@takien.com>\n"
8
+ "Language-Team: takien.com <contact@takien.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-Language: Indonesian\n"
15
+ "X-Poedit-Country: INDONESIA\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: easy-table.php:275
20
+ msgid "Settings"
21
+ msgstr "Pengaturan"
22
+
23
+ #: easy-table.php:287
24
+ msgid "Instruction"
25
+ msgstr "Petunjuk"
26
+
27
+ #: easy-table.php:288
28
+ msgid "Once plugin installed, go to plugin options page to configure some options"
29
+ msgstr ""
30
+
31
+ #: easy-table.php:289
32
+ msgid "You are ready to write a table in post or page."
33
+ msgstr ""
34
+
35
+ #: easy-table.php:290
36
+ msgid "To be able write table in widget you have to check <em>Enable render table in widget</em> option in the option page."
37
+ msgstr ""
38
+
39
+ #: easy-table.php:308
40
+ #, php-format
41
+ msgid "%s Option"
42
+ msgstr "Pengaturan %s"
43
+
44
+ #: easy-table.php:316
45
+ msgid "Show/hide description"
46
+ msgstr ""
47
+
48
+ #: easy-table.php:317
49
+ msgid "General options"
50
+ msgstr "Pengaturan umum"
51
+
52
+ #: easy-table.php:322
53
+ msgid "Short code tag"
54
+ msgstr ""
55
+
56
+ #: easy-table.php:324
57
+ msgid "Shortcode tag, type \"table\" if you want to use [table] short tag."
58
+ msgstr ""
59
+
60
+ #: easy-table.php:329
61
+ msgid "Also render table in widget?"
62
+ msgstr ""
63
+
64
+ #: easy-table.php:331
65
+ msgid "Check this if you want the table could be rendered in widget."
66
+ msgstr ""
67
+
68
+ #: easy-table.php:340
69
+ msgid "Use tablesorter?"
70
+ msgstr "Gunakan tablesorter?"
71
+
72
+ #: easy-table.php:343
73
+ msgid "Check this to use tablesorter jQuery plugin"
74
+ msgstr "Ceklist ini jika ingin menggunakan jQuery plugin tablesorter"
75
+
76
+ #: easy-table.php:347
77
+ msgid "Use TH for the first row?"
78
+ msgstr "Gunakan TH untuk baris pertama?"
79
+
80
+ #: easy-table.php:350
81
+ msgid "Check this if you want to use first row as table head (required by tablesorter)"
82
+ msgstr ""
83
+
84
+ #: easy-table.php:354
85
+ msgid "Load CSS?"
86
+ msgstr ""
87
+
88
+ #: easy-table.php:357
89
+ msgid "Check this to use CSS included in this plugin to styling table, you may unceck if you want to write your own style."
90
+ msgstr ""
91
+
92
+ #: easy-table.php:361
93
+ msgid "Table class"
94
+ msgstr ""
95
+
96
+ #: easy-table.php:363
97
+ msgid "Table class attribute, if you use bootstrap CSS, you should add at least \"table\" class."
98
+ msgstr ""
99
+
100
+ #: easy-table.php:367
101
+ msgid "Table width"
102
+ msgstr "Lebar tabel"
103
+
104
+ #: easy-table.php:369
105
+ msgid "Table width, in pixel or percent (may be overriden by CSS)"
106
+ msgstr ""
107
+
108
+ #: easy-table.php:373
109
+ msgid "Table align"
110
+ msgstr "Perataan tabel"
111
+
112
+ #: easy-table.php:375
113
+ msgid "Table align, left/right/center (may be overriden by CSS)"
114
+ msgstr ""
115
+
116
+ #: easy-table.php:379
117
+ msgid "Table border"
118
+ msgstr "Garis tabel"
119
+
120
+ #: easy-table.php:381
121
+ msgid "Table border (may be overriden by CSS)"
122
+ msgstr ""
123
+
124
+ #: easy-table.php:386
125
+ msgid "Table options"
126
+ msgstr "Pengaturan tabel"
127
+
128
+ #: easy-table.php:391
129
+ msgid "Parser Option"
130
+ msgstr "Pengaturan parser"
131
+
132
+ #: easy-table.php:392
133
+ msgid "Do not change this unless you know what you're doing"
134
+ msgstr ""
135
+
136
+ #: easy-table.php:398
137
+ msgid "Delimiter"
138
+ msgstr "Pemisah"
139
+
140
+ #: easy-table.php:401
141
+ msgid "CSV delimiter (default is comma)"
142
+ msgstr ""
143
+
144
+ #: easy-table.php:404
145
+ msgid "Enclosure"
146
+ msgstr ""
147
+
148
+ #: easy-table.php:407
149
+ msgid "CSV enclosure (default is double quote)"
150
+ msgstr ""
151
+
152
+ #: easy-table.php:410
153
+ msgid "Escape"
154
+ msgstr ""
155
+
156
+ #: easy-table.php:413
157
+ msgid "CSV escape (default is backslash)"
158
+ msgstr ""
159
+
160
+ #: easy-table.php:416
161
+ msgid "Allow read CSV from file?"
162
+ msgstr ""
163
+
164
+ #: easy-table.php:419
165
+ msgid "Check this if you also want to convert CSV file to table"
166
+ msgstr ""
167
+
168
+ #: easy-table.php:427
169
+ msgid "Save"
170
+ msgstr "Simpan"
171
+
172
+ #: easy-table.php:446
173
+ msgid "Possible parameter"
174
+ msgstr ""
175
+
176
+ #: easy-table.php:447
177
+ msgid "These parameters commonly can override global options in the left side of this page. Example usage:"
178
+ msgstr ""
179
+
180
+ #: easy-table.php:449
181
+ #: easy-table.php:450
182
+ #: easy-table.php:451
183
+ #: easy-table.php:452
184
+ #: easy-table.php:453
185
+ #: easy-table.php:454
186
+ #: easy-table.php:455
187
+ #: easy-table.php:456
188
+ #: easy-table.php:457
189
+ msgid "default value"
190
+ msgstr ""
191
+
192
+ #: easy-table.php:449
193
+ msgid "another value"
194
+ msgstr ""
195
+
196
+ #: easy-table.php:459
197
+ msgid "Test area:"
198
+ msgstr ""
199
+
200
+ #: easy-table.php:464
201
+ msgid "Reset"
202
+ msgstr ""
203
+
204
+ #: easy-table.php:465
205
+ msgid "Update preview"
206
+ msgstr ""
207
+
208
+ #: easy-table.php:467
209
+ msgid "Preview"
210
+ msgstr ""
211
+
212
+ #: easy-table.php:473
213
+ msgid "Any question or suggestion? Click here!"
214
+ msgstr ""
215
+
216
+ #~ msgid "Use CSS bootstrap?"
217
+ #~ msgstr "Gunakan CSS bootstrap?"
languages/english.mo ADDED
Binary file
languages/english.po ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: easy-table 0.1\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-05-21 02:59+0700\n"
6
+ "PO-Revision-Date: 2012-05-21 02:59+0700\n"
7
+ "Last-Translator: takien <contact@takien.com>\n"
8
+ "Language-Team: takien.com <contact@takien.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: easy-table.php:275
20
+ msgid "Settings"
21
+ msgstr ""
22
+
23
+ #: easy-table.php:287
24
+ msgid "Instruction"
25
+ msgstr ""
26
+
27
+ #: easy-table.php:288
28
+ msgid "Once plugin installed, go to plugin options page to configure some options"
29
+ msgstr ""
30
+
31
+ #: easy-table.php:289
32
+ msgid "You are ready to write a table in post or page."
33
+ msgstr ""
34
+
35
+ #: easy-table.php:290
36
+ msgid "To be able write table in widget you have to check <em>Enable render table in widget</em> option in the option page."
37
+ msgstr ""
38
+
39
+ #: easy-table.php:308
40
+ #, php-format
41
+ msgid "%s Option"
42
+ msgstr ""
43
+
44
+ #: easy-table.php:316
45
+ msgid "Show/hide description"
46
+ msgstr ""
47
+
48
+ #: easy-table.php:317
49
+ msgid "General options"
50
+ msgstr ""
51
+
52
+ #: easy-table.php:322
53
+ msgid "Short code tag"
54
+ msgstr ""
55
+
56
+ #: easy-table.php:324
57
+ msgid "Shortcode tag, type \"table\" if you want to use [table] short tag."
58
+ msgstr ""
59
+
60
+ #: easy-table.php:329
61
+ msgid "Also render table in widget?"
62
+ msgstr ""
63
+
64
+ #: easy-table.php:331
65
+ msgid "Check this if you want the table could be rendered in widget."
66
+ msgstr ""
67
+
68
+ #: easy-table.php:340
69
+ msgid "Use tablesorter?"
70
+ msgstr ""
71
+
72
+ #: easy-table.php:343
73
+ msgid "Check this to use tablesorter jQuery plugin"
74
+ msgstr ""
75
+
76
+ #: easy-table.php:347
77
+ msgid "Use TH for the first row?"
78
+ msgstr ""
79
+
80
+ #: easy-table.php:350
81
+ msgid "Check this if you want to use first row as table head (required by tablesorter)"
82
+ msgstr ""
83
+
84
+ #: easy-table.php:354
85
+ msgid "Load CSS?"
86
+ msgstr ""
87
+
88
+ #: easy-table.php:357
89
+ msgid "Check this to use CSS included in this plugin to styling table, you may unceck if you want to write your own style."
90
+ msgstr ""
91
+
92
+ #: easy-table.php:361
93
+ msgid "Table class"
94
+ msgstr ""
95
+
96
+ #: easy-table.php:363
97
+ msgid "Table class attribute, if you use bootstrap CSS, you should add at least \"table\" class."
98
+ msgstr ""
99
+
100
+ #: easy-table.php:367
101
+ msgid "Table width"
102
+ msgstr ""
103
+
104
+ #: easy-table.php:369
105
+ msgid "Table width, in pixel or percent (may be overriden by CSS)"
106
+ msgstr ""
107
+
108
+ #: easy-table.php:373
109
+ msgid "Table align"
110
+ msgstr ""
111
+
112
+ #: easy-table.php:375
113
+ msgid "Table align, left/right/center (may be overriden by CSS)"
114
+ msgstr ""
115
+
116
+ #: easy-table.php:379
117
+ msgid "Table border"
118
+ msgstr ""
119
+
120
+ #: easy-table.php:381
121
+ msgid "Table border (may be overriden by CSS)"
122
+ msgstr ""
123
+
124
+ #: easy-table.php:386
125
+ msgid "Table options"
126
+ msgstr ""
127
+
128
+ #: easy-table.php:391
129
+ msgid "Parser Option"
130
+ msgstr ""
131
+
132
+ #: easy-table.php:392
133
+ msgid "Do not change this unless you know what you're doing"
134
+ msgstr ""
135
+
136
+ #: easy-table.php:398
137
+ msgid "Delimiter"
138
+ msgstr ""
139
+
140
+ #: easy-table.php:401
141
+ msgid "CSV delimiter (default is comma)"
142
+ msgstr ""
143
+
144
+ #: easy-table.php:404
145
+ msgid "Enclosure"
146
+ msgstr ""
147
+
148
+ #: easy-table.php:407
149
+ msgid "CSV enclosure (default is double quote)"
150
+ msgstr ""
151
+
152
+ #: easy-table.php:410
153
+ msgid "Escape"
154
+ msgstr ""
155
+
156
+ #: easy-table.php:413
157
+ msgid "CSV escape (default is backslash)"
158
+ msgstr ""
159
+
160
+ #: easy-table.php:416
161
+ msgid "Allow read CSV from file?"
162
+ msgstr ""
163
+
164
+ #: easy-table.php:419
165
+ msgid "Check this if you also want to convert CSV file to table"
166
+ msgstr ""
167
+
168
+ #: easy-table.php:427
169
+ msgid "Save"
170
+ msgstr ""
171
+
172
+ #: easy-table.php:446
173
+ msgid "Possible parameter"
174
+ msgstr ""
175
+
176
+ #: easy-table.php:447
177
+ msgid "These parameters commonly can override global options in the left side of this page. Example usage:"
178
+ msgstr ""
179
+
180
+ #: easy-table.php:449
181
+ #: easy-table.php:450
182
+ #: easy-table.php:451
183
+ #: easy-table.php:452
184
+ #: easy-table.php:453
185
+ #: easy-table.php:454
186
+ #: easy-table.php:455
187
+ #: easy-table.php:456
188
+ #: easy-table.php:457
189
+ msgid "default value"
190
+ msgstr ""
191
+
192
+ #: easy-table.php:449
193
+ msgid "another value"
194
+ msgstr ""
195
+
196
+ #: easy-table.php:459
197
+ msgid "Test area:"
198
+ msgstr ""
199
+
200
+ #: easy-table.php:464
201
+ msgid "Reset"
202
+ msgstr ""
203
+
204
+ #: easy-table.php:465
205
+ msgid "Update preview"
206
+ msgstr ""
207
+
208
+ #: easy-table.php:467
209
+ msgid "Preview"
210
+ msgstr ""
211
+
212
+ #: easy-table.php:473
213
+ msgid "Any question or suggestion? Click here!"
214
+ msgstr ""
215
+
languages/index.html ADDED
File without changes
readme.txt ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Easy Table ===
2
+ Contributors: takien
3
+ Donate link: http://takien.com/donate
4
+ Tags: table,csv,csv-to-table,post,excel,csv file,widget
5
+ Requires at least: 3.0
6
+ Tested up to: 3.3.2
7
+ Stable tag: 0.1
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Easy Table is WordPress plugin to create table in post, page, or widget in easy way using CSV format. This can also display table from CSV file.
12
+
13
+ == Description ==
14
+
15
+ Easy Table is a WordPress plugin that allow you to insert table in easy way. Why it's easy? Because you don't need to write any complicated HTML syntax. Note that this plugin is not a graphical user interface table generator, so you can simply type your table data directly in your post while you writing. No need to switch to another window nor click any toolbar button.
16
+
17
+ Easy Table using standard CSV format to generate table data, it's easiest way to build a table.
18
+
19
+ = Some Features =
20
+ * Easy to use, no advanced skill required
21
+ * Display table in post, page or even in widget
22
+ * Read data from CSV file and display the data in table
23
+ * Sortable table column (using tablesorter jQuery plugin)
24
+ * Fancy table design (using Twitter CSS bootstrap)
25
+ * WYSIWYG safe, I mean you can switch HTML/View tab in WordPress editor without breaking the table data.
26
+
27
+ Example usage:
28
+
29
+ * Basic table
30
+ `[table]
31
+ Year,Make,Model,Length
32
+ 1997,Ford,E350,2.34
33
+ 2000,Mercury,Cougar,2.38
34
+ [/table]`
35
+
36
+ * Table with additional parameter
37
+ `[table tablesorter="1" id="someid"]
38
+ Year,Make,Model,Length
39
+ 1997,Ford,E350,2.34
40
+ 2000,Mercury,Cougar,2.38
41
+ [/table]`
42
+
43
+ * Table from CSV file
44
+ `[table file="example.com/blog/wp-content/uploads/pricelist.csv"][/table]`
45
+
46
+ == Installation ==
47
+
48
+ There are many ways to install this plugin, e.g:
49
+
50
+ 1. Upload compressed (zip) plugin using WordPress plugin uploader.
51
+ 2. Directly install from WordPress.org directory
52
+ 3. Upload manually uncompressed plugin file using FTP.
53
+
54
+ == Frequently Asked Questions ==
55
+
56
+ = Is there any question? =
57
+
58
+ Not yet.
59
+
60
+ == Screenshots ==
61
+
62
+ 1. Various table in a post
63
+ 2. Easy Table options page
64
+ 3. It's easy to display your uploaded CSV file as HTML table.
65
+ 4. Easy Table in text widget
66
+
67
+ == Upgrade Notice ==
68
+
69
+ No
70
+
71
+ == Changelog ==
72
+
73
+ = 0.1 =
74
+ * First release
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file
screenshot-4.png ADDED
Binary file