Easy Table - Version 0.4

Version Description

  • Fixed: Option value can't override default value if option value is empty (if checkbox is uncecked).
  • Added: Optionally, tfoot now can be taken from last row. Example usage: [table tf="last"]somedata[/table]
Download this release

Release Info

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

Code changes from version 0.3 to 0.4

easy-table.php CHANGED
@@ -4,7 +4,7 @@ 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.3
8
Author URI: http://takien.com/
9
*/
10
@@ -82,7 +82,7 @@ function __construct(){
82
private function easy_table_base($return){
83
$easy_table_base = Array(
84
'name' => 'Easy Table',
85
- 'version' => '0.3',
86
'plugin-domain' => 'easy-table'
87
);
88
return $easy_table_base[$return];
@@ -134,20 +134,26 @@ private function csv_to_table($data,$args){
134
}
135
$max_cols = count(max($data));
136
$i=0;
137
$output = '<table '.($id ? 'id="'.$id.'"':'').' width="'.$width.'" align="'.$align.'" class="table '.($tablesorter ? 'tablesorter ':'').$class.'" '.(($border !=='0') ? 'border="'.$border.'"' : '').'>';
138
$output .= ($caption !=='') ? '<caption>'.$caption.'</caption>' : '';
139
$output .= $th ? '<thead>' : ($tf ? '' : '<tbody>');
140
foreach($data as $k=>$v){ $i++;
141
$v = array_pad($v,$max_cols,'');
142
- $output .= (($i==2) AND $tf) ? '<tfoot>': '';
143
$output .= "\r\n".'<tr>';
144
145
- $thtd = ((($i==1) AND $th) OR (($i==2) AND $tf)) ? 'th' : 'td';
146
$output .= "<$thtd>".implode("</$thtd><$thtd>",array_values($v))."</$thtd>";
147
148
$output .= '</tr>';
149
$output .= (($i==1) AND $th) ? '</thead>' : '';
150
- $output .= (($i==2) AND $tf) ? '</tfoot>': '';
151
152
}
153
$output .= '</tbody></table>';
@@ -207,14 +213,14 @@ function render_form($fields){
207
}
208
if($field['type']=='checkbox'){
209
$output .= '<tr><th><label for="'.$field['name'].'">'.$field['label'].'</label></th>';
210
- $output .= '<td><input type="checkbox" id="'.$field['name'].'" name="'.$field['name'].'" value="'.$field['value'].'" '.$field['attr'].' />';
211
$output .= ' <span class="description">'.$field['description'].'</span></td></tr>';
212
}
213
if($field['type']=='checkboxgroup'){
214
$output .= '<tr><th><label>'.$field['grouplabel'].'</label></th>';
215
$output .= '<td>';
216
foreach($field['groupitem'] as $key=>$item){
217
- $output .= '<input type="checkbox" id="'.$item['name'].'" name="'.$item['name'].'" value="'.$item['value'].'" '.$item['attr'].' /> <label for="'.$item['name'].'">'.$item['label'].'</label><br />';
218
}
219
$output .= ' <span class="description">'.$field['description'].'</span></td></tr>';
220
}
4
Plugin URI: http://takien.com/
5
Description: Create table in post, page, or widget in easy way.
6
Author: Takien
7
+ Version: 0.4
8
Author URI: http://takien.com/
9
*/
10
82
private function easy_table_base($return){
83
$easy_table_base = Array(
84
'name' => 'Easy Table',
85
+ 'version' => '0.4',
86
'plugin-domain' => 'easy-table'
87
);
88
return $easy_table_base[$return];
134
}
135
$max_cols = count(max($data));
136
$i=0;
137
+ /**
138
+ * tfoot position
139
+ * @since 0.4
140
+ */
141
+ $tfpos = ($tf == 'last') ? count($data)-1 : 2;
142
$output = '<table '.($id ? 'id="'.$id.'"':'').' width="'.$width.'" align="'.$align.'" class="table '.($tablesorter ? 'tablesorter ':'').$class.'" '.(($border !=='0') ? 'border="'.$border.'"' : '').'>';
143
$output .= ($caption !=='') ? '<caption>'.$caption.'</caption>' : '';
144
$output .= $th ? '<thead>' : ($tf ? '' : '<tbody>');
145
+
146
foreach($data as $k=>$v){ $i++;
147
$v = array_pad($v,$max_cols,'');
148
+ $output .= (($i==$tfpos) AND $tf) ? '<tfoot>': '';
149
$output .= "\r\n".'<tr>';
150
151
+ $thtd = ((($i==1) AND $th) OR (($i==$tfpos) AND $tf)) ? 'th' : 'td';
152
$output .= "<$thtd>".implode("</$thtd><$thtd>",array_values($v))."</$thtd>";
153
154
$output .= '</tr>';
155
$output .= (($i==1) AND $th) ? '</thead>' : '';
156
+ $output .= (($i==$tfpos) AND $tf) ? '</tfoot>': '';
157
158
}
159
$output .= '</tbody></table>';
213
}
214
if($field['type']=='checkbox'){
215
$output .= '<tr><th><label for="'.$field['name'].'">'.$field['label'].'</label></th>';
216
+ $output .= '<td><input type="hidden" name="'.$field['name'].'" value="" /><input type="checkbox" id="'.$field['name'].'" name="'.$field['name'].'" value="'.$field['value'].'" '.$field['attr'].' />';
217
$output .= ' <span class="description">'.$field['description'].'</span></td></tr>';
218
}
219
if($field['type']=='checkboxgroup'){
220
$output .= '<tr><th><label>'.$field['grouplabel'].'</label></th>';
221
$output .= '<td>';
222
foreach($field['groupitem'] as $key=>$item){
223
+ $output .= '<input type="hidden" name="'.$item['name'].'" value="" /><input type="checkbox" id="'.$item['name'].'" name="'.$item['name'].'" value="'.$item['value'].'" '.$item['attr'].' /> <label for="'.$item['name'].'">'.$item['label'].'</label><br />';
224
}
225
$output .= ' <span class="description">'.$field['description'].'</span></td></tr>';
226
}
languages/easy-table-id_ID.mo CHANGED
Binary file
languages/easy-table-id_ID.po CHANGED
@@ -1,9 +1,9 @@
1
msgid ""
2
msgstr ""
3
- "Project-Id-Version: easy-table 0.3\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: 2012-05-25 01:08+0700\n"
6
- "PO-Revision-Date: 2012-05-25 01:14+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"
1
msgid ""
2
msgstr ""
3
+ "Project-Id-Version: easy-table 0.4\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: 2012-05-25 01:08+0700\n"
6
+ "PO-Revision-Date: 2012-05-27 13:41+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"
languages/english.mo CHANGED
Binary file
languages/english.po CHANGED
@@ -1,9 +1,9 @@
1
msgid ""
2
msgstr ""
3
- "Project-Id-Version: easy-table 0.3\n"
4
"Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-05-25 01:07+0700\n"
6
- "PO-Revision-Date: 2012-05-25 01:07+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"
@@ -16,237 +16,237 @@ msgstr ""
16
"X-Poedit-SourceCharset: utf-8\n"
17
"X-Poedit-SearchPath-0: .\n"
18
19
- #: easy-table.php:298
20
msgid "Settings"
21
msgstr ""
22
23
- #: easy-table.php:310
24
msgid "Instruction"
25
msgstr ""
26
27
- #: easy-table.php:311
28
msgid "Once plugin installed, go to plugin options page to configure some options"
29
msgstr ""
30
31
- #: easy-table.php:312
32
msgid "You are ready to write a table in post or page."
33
msgstr ""
34
35
- #: easy-table.php:313
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:331
40
#, php-format
41
msgid "%s Option"
42
msgstr ""
43
44
- #: easy-table.php:339
45
msgid "Show/hide description"
46
msgstr ""
47
48
- #: easy-table.php:340
49
msgid "General options"
50
msgstr ""
51
52
- #: easy-table.php:345
53
msgid "Short code tag"
54
msgstr ""
55
56
- #: easy-table.php:347
57
msgid "Shortcode tag, type \"table\" if you want to use [table] short tag."
58
msgstr ""
59
60
- #: easy-table.php:352
61
msgid "Also render table in widget?"
62
msgstr ""
63
64
- #: easy-table.php:354
65
msgid "Check this if you want the table could be rendered in widget."
66
msgstr ""
67
68
- #: easy-table.php:359
69
msgid "Only load JS/CSS when in this condition"
70
msgstr ""
71
72
- #: easy-table.php:360
73
msgid "Please check in where JavaScript and CSS should be loaded"
74
msgstr ""
75
76
- #: easy-table.php:364
77
msgid "Single"
78
msgstr ""
79
80
- #: easy-table.php:370
81
msgid "Page"
82
msgstr ""
83
84
- #: easy-table.php:376
85
msgid "Front page"
86
msgstr ""
87
88
- #: easy-table.php:382
89
msgid "Archive page"
90
msgstr ""
91
92
- #: easy-table.php:394
93
msgid "Use tablesorter?"
94
msgstr ""
95
96
- #: easy-table.php:397
97
msgid "Check this to use tablesorter jQuery plugin"
98
msgstr ""
99
100
- #: easy-table.php:401
101
msgid "Use TH for the first row?"
102
msgstr ""
103
104
- #: easy-table.php:404
105
msgid "Check this if you want to use first row as table head (required by tablesorter)"
106
msgstr ""
107
108
- #: easy-table.php:408
109
msgid "Load CSS?"
110
msgstr ""
111
112
- #: easy-table.php:411
113
msgid "Check this to use CSS included in this plugin to styling table, you may unceck if you want to write your own style."
114
msgstr ""
115
116
- #: easy-table.php:415
117
msgid "Table class"
118
msgstr ""
119
120
- #: easy-table.php:417
121
msgid "Table class attribute, if you use bootstrap CSS, you should add at least \"table\" class."
122
msgstr ""
123
124
- #: easy-table.php:421
125
msgid "Table width"
126
msgstr ""
127
128
- #: easy-table.php:423
129
msgid "Table width, in pixel or percent (may be overriden by CSS)"
130
msgstr ""
131
132
- #: easy-table.php:427
133
msgid "Table align"
134
msgstr ""
135
136
- #: easy-table.php:429
137
msgid "Table align, left/right/center (may be overriden by CSS)"
138
msgstr ""
139
140
- #: easy-table.php:433
141
msgid "Table border"
142
msgstr ""
143
144
- #: easy-table.php:435
145
msgid "Table border (may be overriden by CSS)"
146
msgstr ""
147
148
- #: easy-table.php:440
149
msgid "Table options"
150
msgstr ""
151
152
- #: easy-table.php:445
153
msgid "Parser Option"
154
msgstr ""
155
156
- #: easy-table.php:446
157
msgid "Do not change this unless you know what you're doing"
158
msgstr ""
159
160
- #: easy-table.php:452
161
msgid "Delimiter"
162
msgstr ""
163
164
- #: easy-table.php:455
165
msgid "CSV delimiter (default is comma)"
166
msgstr ""
167
168
- #: easy-table.php:458
169
msgid "Enclosure"
170
msgstr ""
171
172
- #: easy-table.php:461
173
msgid "CSV enclosure (default is double quote)"
174
msgstr ""
175
176
- #: easy-table.php:464
177
msgid "Escape"
178
msgstr ""
179
180
- #: easy-table.php:467
181
msgid "CSV escape (default is backslash)"
182
msgstr ""
183
184
- #: easy-table.php:470
185
msgid "Allow read CSV from file?"
186
msgstr ""
187
188
- #: easy-table.php:473
189
msgid "Check this if you also want to convert CSV file to table"
190
msgstr ""
191
192
- #: easy-table.php:481
193
msgid "Save"
194
msgstr ""
195
196
- #: easy-table.php:500
197
msgid "Possible parameter"
198
msgstr ""
199
200
- #: easy-table.php:501
201
msgid "These parameters commonly can override global options in the left side of this page. Example usage:"
202
msgstr ""
203
204
- #: easy-table.php:503
205
- #: easy-table.php:504
206
- #: easy-table.php:505
207
- #: easy-table.php:506
208
- #: easy-table.php:507
209
- #: easy-table.php:508
210
#: easy-table.php:509
211
#: easy-table.php:510
212
#: easy-table.php:511
213
#: easy-table.php:512
214
msgid "default value"
215
msgstr ""
216
217
- #: easy-table.php:503
218
msgid "another value"
219
msgstr ""
220
221
- #: easy-table.php:514
222
msgid "Test area:"
223
msgstr ""
224
225
- #: easy-table.php:519
226
msgid "Reset"
227
msgstr ""
228
229
- #: easy-table.php:520
230
msgid "Update preview"
231
msgstr ""
232
233
- #: easy-table.php:522
234
msgid "Preview"
235
msgstr ""
236
237
- #: easy-table.php:528
238
msgid "Any question or suggestion? Click here!"
239
msgstr ""
240
241
- #: easy-table.php:529
242
msgid "Credit"
243
msgstr ""
244
245
- #: easy-table.php:531
246
msgid "Tablesorter by"
247
msgstr ""
248
249
- #: easy-table.php:532
250
msgid "CSS by"
251
msgstr ""
252
1
msgid ""
2
msgstr ""
3
+ "Project-Id-Version: easy-table 0.4\n"
4
"Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-05-27 13:40+0700\n"
6
+ "PO-Revision-Date: 2012-05-27 13:40+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"
16
"X-Poedit-SourceCharset: utf-8\n"
17
"X-Poedit-SearchPath-0: .\n"
18
19
+ #: easy-table.php:304
20
msgid "Settings"
21
msgstr ""
22
23
+ #: easy-table.php:316
24
msgid "Instruction"
25
msgstr ""
26
27
+ #: easy-table.php:317
28
msgid "Once plugin installed, go to plugin options page to configure some options"
29
msgstr ""
30
31
+ #: easy-table.php:318
32
msgid "You are ready to write a table in post or page."
33
msgstr ""
34
35
+ #: easy-table.php:319
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:337
40
#, php-format
41
msgid "%s Option"
42
msgstr ""
43
44
+ #: easy-table.php:345
45
msgid "Show/hide description"
46
msgstr ""
47
48
+ #: easy-table.php:346
49
msgid "General options"
50
msgstr ""
51
52
+ #: easy-table.php:351
53
msgid "Short code tag"
54
msgstr ""
55
56
+ #: easy-table.php:353
57
msgid "Shortcode tag, type \"table\" if you want to use [table] short tag."
58
msgstr ""
59
60
+ #: easy-table.php:358
61
msgid "Also render table in widget?"
62
msgstr ""
63
64
+ #: easy-table.php:360
65
msgid "Check this if you want the table could be rendered in widget."
66
msgstr ""
67
68
+ #: easy-table.php:365
69
msgid "Only load JS/CSS when in this condition"
70
msgstr ""
71
72
+ #: easy-table.php:366
73
msgid "Please check in where JavaScript and CSS should be loaded"
74
msgstr ""
75
76
+ #: easy-table.php:370
77
msgid "Single"
78
msgstr ""
79
80
+ #: easy-table.php:376
81
msgid "Page"
82
msgstr ""
83
84
+ #: easy-table.php:382
85
msgid "Front page"
86
msgstr ""
87
88
+ #: easy-table.php:388
89
msgid "Archive page"
90
msgstr ""
91
92
+ #: easy-table.php:400
93
msgid "Use tablesorter?"
94
msgstr ""
95
96
+ #: easy-table.php:403
97
msgid "Check this to use tablesorter jQuery plugin"
98
msgstr ""
99
100
+ #: easy-table.php:407
101
msgid "Use TH for the first row?"
102
msgstr ""
103
104
+ #: easy-table.php:410
105
msgid "Check this if you want to use first row as table head (required by tablesorter)"
106
msgstr ""
107
108
+ #: easy-table.php:414
109
msgid "Load CSS?"
110
msgstr ""
111
112
+ #: easy-table.php:417
113
msgid "Check this to use CSS included in this plugin to styling table, you may unceck if you want to write your own style."
114
msgstr ""
115
116
+ #: easy-table.php:421
117
msgid "Table class"
118
msgstr ""
119
120
+ #: easy-table.php:423
121
msgid "Table class attribute, if you use bootstrap CSS, you should add at least \"table\" class."
122
msgstr ""
123
124
+ #: easy-table.php:427
125
msgid "Table width"
126
msgstr ""
127
128
+ #: easy-table.php:429
129
msgid "Table width, in pixel or percent (may be overriden by CSS)"
130
msgstr ""
131
132
+ #: easy-table.php:433
133
msgid "Table align"
134
msgstr ""
135
136
+ #: easy-table.php:435
137
msgid "Table align, left/right/center (may be overriden by CSS)"
138
msgstr ""
139
140
+ #: easy-table.php:439
141
msgid "Table border"
142
msgstr ""
143
144
+ #: easy-table.php:441
145
msgid "Table border (may be overriden by CSS)"
146
msgstr ""
147
148
+ #: easy-table.php:446
149
msgid "Table options"
150
msgstr ""
151
152
+ #: easy-table.php:451
153
msgid "Parser Option"
154
msgstr ""
155
156
+ #: easy-table.php:452
157
msgid "Do not change this unless you know what you're doing"
158
msgstr ""
159
160
+ #: easy-table.php:458
161
msgid "Delimiter"
162
msgstr ""
163
164
+ #: easy-table.php:461
165
msgid "CSV delimiter (default is comma)"
166
msgstr ""
167
168
+ #: easy-table.php:464
169
msgid "Enclosure"
170
msgstr ""
171
172
+ #: easy-table.php:467
173
msgid "CSV enclosure (default is double quote)"
174
msgstr ""
175
176
+ #: easy-table.php:470
177
msgid "Escape"
178
msgstr ""
179
180
+ #: easy-table.php:473
181
msgid "CSV escape (default is backslash)"
182
msgstr ""
183
184
+ #: easy-table.php:476
185
msgid "Allow read CSV from file?"
186
msgstr ""
187
188
+ #: easy-table.php:479
189
msgid "Check this if you also want to convert CSV file to table"
190
msgstr ""
191
192
+ #: easy-table.php:487
193
msgid "Save"
194
msgstr ""
195
196
+ #: easy-table.php:506
197
msgid "Possible parameter"
198
msgstr ""
199
200
+ #: easy-table.php:507
201
msgid "These parameters commonly can override global options in the left side of this page. Example usage:"
202
msgstr ""
203
204
#: easy-table.php:509
205
#: easy-table.php:510
206
#: easy-table.php:511
207
#: easy-table.php:512
208
+ #: easy-table.php:513
209
+ #: easy-table.php:514
210
+ #: easy-table.php:515
211
+ #: easy-table.php:516
212
+ #: easy-table.php:517
213
+ #: easy-table.php:518
214
msgid "default value"
215
msgstr ""
216
217
+ #: easy-table.php:509
218
msgid "another value"
219
msgstr ""
220
221
+ #: easy-table.php:520
222
msgid "Test area:"
223
msgstr ""
224
225
+ #: easy-table.php:525
226
msgid "Reset"
227
msgstr ""
228
229
+ #: easy-table.php:526
230
msgid "Update preview"
231
msgstr ""
232
233
+ #: easy-table.php:528
234
msgid "Preview"
235
msgstr ""
236
237
+ #: easy-table.php:534
238
msgid "Any question or suggestion? Click here!"
239
msgstr ""
240
241
+ #: easy-table.php:535
242
msgid "Credit"
243
msgstr ""
244
245
+ #: easy-table.php:537
246
msgid "Tablesorter by"
247
msgstr ""
248
249
+ #: easy-table.php:538
250
msgid "CSS by"
251
msgstr ""
252
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://takien.com/donate
4
Tags: table,csv,csv-to-table,post,excel,csv file,widget,tablesorter
5
Requires at least: 3.0
6
Tested up to: 3.3.2
7
- Stable tag: 0.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -40,11 +40,23 @@ Year,Make,Model,Length
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
= Other notes =
47
- * Data in each cell must not have line break, otherwise it will be detected as new row.
48
* No option for colspan and rowspan
49
50
== Installation ==
@@ -74,6 +86,10 @@ No
74
75
== Changelog ==
76
77
= 0.3 =
78
* Improved: Option form now filled out with default value if there are no options saved in database and you don't need to save option to get the plugin to works.
79
* Added: Option to select where script and style should be loaded, eg. if only in single page.
4
Tags: table,csv,csv-to-table,post,excel,csv file,widget,tablesorter
5
Requires at least: 3.0
6
Tested up to: 3.3.2
7
+ Stable tag: 0.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
40
2000,Mercury,Cougar,2.38
41
[/table]`
42
43
+ * Table with no heading
44
+ `[table th="0"]some data here[/table]`
45
+
46
+ * Table with no heading
47
+ `[table th="0"]some data here[/table]`
48
+
49
+ * Table with footer/tfoot, by default tfoot automatically picked up from second row.
50
+ `[table tf="1"]some data here[/table]`
51
+
52
+ * Table with picked up from last row.
53
+ `[table tf="last"]some data here[/table]`
54
+
55
* Table from CSV file
56
`[table file="example.com/blog/wp-content/uploads/pricelist.csv"][/table]`
57
58
= Other notes =
59
+ * In PHP version lower than 5.3, data in each cell must not have line break, otherwise it will be detected as new row.
60
* No option for colspan and rowspan
61
62
== Installation ==
86
87
== Changelog ==
88
89
+ = 0.4 =
90
+ * Fixed: Option value can't override default value if option value is empty (if checkbox is uncecked).
91
+ * Added: Optionally, tfoot now can be taken from last row. Example usage: [table tf="last"]somedata[/table]
92
+
93
= 0.3 =
94
* Improved: Option form now filled out with default value if there are no options saved in database and you don't need to save option to get the plugin to works.
95
* Added: Option to select where script and style should be loaded, eg. if only in single page.