Easy Table - Version 1.2

Version Description

  • Added: align parameter is now back. (Previously removed on version 1.1)
Download this release

Release Info

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

Code changes from version 1.1.4 to 1.2

Files changed (2) hide show
  1. easy-table.php +46 -21
  2. readme.txt +4 -1
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: 1.1.4
8
  Author URI: http://takien.com/
9
  */
10
 
@@ -39,6 +39,7 @@ var $settings = Array(
39
  'class' => '',
40
  'caption' => false,
41
  'width' => '100%',
 
42
  'th' => true,
43
  'tf' => false,
44
  'border' => 0,
@@ -86,7 +87,7 @@ function __construct(){
86
  private function easy_table_base($return){
87
  $easy_table_base = Array(
88
  'name' => 'Easy Table',
89
- 'version' => '1.1.4',
90
  'plugin-domain' => 'easy-table'
91
  );
92
  return $easy_table_base[$return];
@@ -94,26 +95,27 @@ private function easy_table_base($return){
94
 
95
  function easy_table_short_code($atts, $content="") {
96
  $shortcode_atts = shortcode_atts(array(
97
- 'class' => $this->option('class'),
98
- 'caption' => $this->option('caption'),
99
- 'width' => $this->option('width'),
100
- 'th' => $this->option('th'),
101
- 'tf' => $this->option('tf'),
102
- 'border' => $this->option('border'),
103
- 'id' => $this->option('id'),
104
- 'theme' => $this->option('theme'),
105
- 'tablesorter' => $this->option('tablesorter'),
106
- 'delimiter' => $this->option('delimiter'),
107
- 'enclosure' => $this->option('enclosure'),
108
- 'escape' => $this->option('escape'),
109
- 'file' => $this->option('file'),
110
- 'trim' => $this->option('trim'),
111
  'sort' => '',
112
  'nl' => $this->option('nl'),
113
  'ai' => false,
114
- 'terminator' => $this->option('terminator'),
115
- 'limit' => $this->option('limit'),
116
- 'style' => '', /*table inline style, since 1.0*/
 
117
  'colalign' => '', /*column align, ex: [table colalign="left|right|center"], @since 1.0*/
118
  'colwidth' => '', /*column width, ex: [table colwidth="100|200|300"], @since 1.0*/
119
  'fixlinebreak' => $this->option('fixlinebreak') /* fix linebreak on cell if terminator is not \n or \r @since 1.1.4 */
@@ -231,11 +233,28 @@ private function csv_to_table($data,$args){
231
  $c_width = explode('|',$colwidth);
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  $output = '<table '.($id ? 'id="'.$id.'"':'');
235
 
236
  //$output .= ' width="'.$width.'" '; width attr not used, use style instead (see below) - since 1.1.3
237
-
238
- $output .= ' style="'.((stripos($style,'width') === false) ? ('width:'.$width.';') : $style).'" ';
239
  $output .= ' class="easy-table easy-table-'.$theme.' '.($tablesorter ? 'tablesorter __sortlist__ ':'').$class.'" '.
240
  (($border !=='0') ? 'border="'.$border.'"' : '').
241
  '>'."\n";
@@ -762,6 +781,12 @@ settings_fields('easy_table_option_field');
762
  'type' => 'text',
763
  'description' => __('Table border (may be overriden by CSS)','easy-table'),
764
  'value' => $this->option('border'))
 
 
 
 
 
 
765
  );
766
  ?>
767
 
4
  Plugin URI: http://takien.com/
5
  Description: Create table in post, page, or widget in easy way.
6
  Author: Takien
7
+ Version: 1.2
8
  Author URI: http://takien.com/
9
  */
10
 
39
  'class' => '',
40
  'caption' => false,
41
  'width' => '100%',
42
+ 'align' => 'left',
43
  'th' => true,
44
  'tf' => false,
45
  'border' => 0,
87
  private function easy_table_base($return){
88
  $easy_table_base = Array(
89
  'name' => 'Easy Table',
90
+ 'version' => '1.2',
91
  'plugin-domain' => 'easy-table'
92
  );
93
  return $easy_table_base[$return];
95
 
96
  function easy_table_short_code($atts, $content="") {
97
  $shortcode_atts = shortcode_atts(array(
98
+ 'class' => $this->option('class'),
99
+ 'caption' => $this->option('caption'),
100
+ 'width' => $this->option('width'),
101
+ 'th' => $this->option('th'),
102
+ 'tf' => $this->option('tf'),
103
+ 'border' => $this->option('border'),
104
+ 'id' => $this->option('id'),
105
+ 'theme' => $this->option('theme'),
106
+ 'tablesorter' => $this->option('tablesorter'),
107
+ 'delimiter' => $this->option('delimiter'),
108
+ 'enclosure' => $this->option('enclosure'),
109
+ 'escape' => $this->option('escape'),
110
+ 'file' => $this->option('file'),
111
+ 'trim' => $this->option('trim'),
112
  'sort' => '',
113
  'nl' => $this->option('nl'),
114
  'ai' => false,
115
+ 'terminator' => $this->option('terminator'),
116
+ 'limit' => $this->option('limit'),
117
+ 'align' => $this->option('align'),
118
+ 'style' => '', /*table inline style, since 1.0*/
119
  'colalign' => '', /*column align, ex: [table colalign="left|right|center"], @since 1.0*/
120
  'colwidth' => '', /*column width, ex: [table colwidth="100|200|300"], @since 1.0*/
121
  'fixlinebreak' => $this->option('fixlinebreak') /* fix linebreak on cell if terminator is not \n or \r @since 1.1.4 */
233
  $c_width = explode('|',$colwidth);
234
  }
235
 
236
+ /* added back $align, with new way of implementation,
237
+ * @since 1.4
238
+ */
239
+ $style = rtrim($style, ';');
240
+ switch ($align) :
241
+ case 'center':
242
+ $alignstyle = '; margin-left:auto;margin-right:auto';
243
+ break;
244
+ case 'right':
245
+ $alignstyle = '; margin-left:auto;margin-right:0';
246
+ break;
247
+ default:
248
+ $alignstyle = '';
249
+ break;
250
+ endswitch;
251
+
252
+ $style = $style.$alignstyle;
253
+
254
  $output = '<table '.($id ? 'id="'.$id.'"':'');
255
 
256
  //$output .= ' width="'.$width.'" '; width attr not used, use style instead (see below) - since 1.1.3
257
+ $output .= ' style="'.((stripos($style,'width') === false) ? ('width:'.$width.';') : '').' '.ltrim($style,';').'" ';
 
258
  $output .= ' class="easy-table easy-table-'.$theme.' '.($tablesorter ? 'tablesorter __sortlist__ ':'').$class.'" '.
259
  (($border !=='0') ? 'border="'.$border.'"' : '').
260
  '>'."\n";
781
  'type' => 'text',
782
  'description' => __('Table border (may be overriden by CSS)','easy-table'),
783
  'value' => $this->option('border'))
784
+ ,Array(
785
+ 'name' =>'easy_table_plugin_option[align]',
786
+ 'label' => __('Table align','easy-table'),
787
+ 'type' => 'text',
788
+ 'description' => __('Table align (left, center, right)','easy-table'),
789
+ 'value' => $this->option('align'))
790
  );
791
  ?>
792
 
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.6
7
- Stable tag: 1.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -225,6 +225,9 @@ No
225
 
226
  == Changelog ==
227
 
 
 
 
228
  = 1.1.4 =
229
  * Added new parameter 'fixlinebreak' to optionally convert newline to &lt;br /&gt; if terminator is not \r or \n
230
 
4
  Tags: table,csv,csv-to-table,post,excel,csv file,widget,tablesorter
5
  Requires at least: 3.0
6
  Tested up to: 3.6
7
+ Stable tag: 1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
225
 
226
  == Changelog ==
227
 
228
+ = 1.2 =
229
+ * Added: `align` parameter is now back. (Previously removed on version 1.1)
230
+
231
  = 1.1.4 =
232
  * Added new parameter 'fixlinebreak' to optionally convert newline to &lt;br /&gt; if terminator is not \r or \n
233