Easy Table - Version 0.2

Version Description

  • Fixed: Backward compatibility of str_getcsv that just not work in the version 0.1, now plugin should runs on PHP 5.2
  • Fixed: Table now has 'table' class even when 'tablesorter' is not enabled.
Download this release

Release Info

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

Code changes from version 0.1 to 0.2

Files changed (2) hide show
  1. easy-table.php +22 -12
  2. readme.txt +5 -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: 0.1
8
  Author URI: http://takien.com/
9
  */
10
 
@@ -80,7 +80,7 @@ function __construct(){
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];
@@ -130,7 +130,7 @@ private function csv_to_table($data,$args){
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++;
@@ -486,17 +486,27 @@ function easy_table_init() {
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
  }
4
  Plugin URI: http://takien.com/
5
  Description: Create table in post, page, or widget in easy way.
6
  Author: Takien
7
+ Version: 0.2
8
  Author URI: http://takien.com/
9
  */
10
 
80
  private function easy_table_base($return){
81
  $easy_table_base = Array(
82
  'name' => 'Easy Table',
83
+ 'version' => '0.2',
84
  'plugin-domain' => 'easy-table'
85
  );
86
  return $easy_table_base[$return];
130
  }
131
  $max_cols = count(max($data));
132
  $i=0;
133
+ $output = '<table '.($id ? 'id="'.$id.'"':'').' width="'.$width.'" align="'.$align.'" class="table '.($tablesorter ? 'tablesorter ':'').$class.'" '.(($border !=='0') ? 'border="'.$border.'"' : '').'>';
134
  $output .= ($caption !=='') ? '<caption>'.$caption.'</caption>' : '';
135
  $output .= $th ? '<thead>' : '<tbody>';
136
  foreach($data as $k=>$v){ $i++;
486
 
487
  /**
488
  * Create function str_getcsv if not exists in server
489
+ * @since version 0.2
490
  */
491
  if (!function_exists('str_getcsv')) {
492
+ function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\"){
493
  $fiveMBs = 5 * 1024 * 1024;
494
+ if (($handle = fopen("php://temp/maxmemory:$fiveMBs", 'r+')) !== FALSE) {
495
+ fputs($handle, $input);
496
+ rewind($handle);
497
+ $line = -1;
498
+ $return = Array();
499
+ while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
500
+ $num = count($data);
501
+ for ($c=0; $c < $num; $c++) {
502
+ if(!empty($data[$c])){
503
+ $line++;
504
+ $return[$line] = $data[$c];
505
+ }
506
+ }
507
+ }
508
+ fclose($handle);
509
+ return $return;
510
+ }
511
  }
512
  }
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
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
 
@@ -70,5 +70,9 @@ No
70
 
71
  == Changelog ==
72
 
 
 
 
 
73
  = 0.1 =
74
  * First release
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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
 
71
  == Changelog ==
72
 
73
+ = 0.2 =
74
+ * Fixed: Backward compatibility of str_getcsv that just not work in the version 0.1, now plugin should runs on PHP 5.2
75
+ * Fixed: Table now has 'table' class even when 'tablesorter' is not enabled.
76
+
77
  = 0.1 =
78
  * First release