PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.4.2.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.4.2.2
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
← All changes | classes/Visualizer/Source/Csv.php +8 -11 3.0.81.4.2.2 View file →
@@ -18,8 +18,9 @@
18 18 // | MA 02110-1301 USA |
19 19 // +----------------------------------------------------------------------+
20 20 // | Author: Eugene Manuilov <eugene@manuilov.org> |
21 21 // +----------------------------------------------------------------------+
22 +
22 23 /**
23 24 * Source manager for local CSV files.
24 25 *
25 26 * @category Visualizer
@@ -64,15 +65,15 @@
64 65 $labels = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE );
65 66 // read series types
66 67 $types = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE );
67 68
68 - if ( ! $labels || ! $types ) {
69 + if ( !$labels || !$types ) {
69 70 return false;
70 71 }
71 72
72 73 // if no types were setup, re read labels and empty types array
73 74 $types = array_map( 'trim', $types );
74 - if ( ! self::_validateTypes( $types ) ) {
75 + if ( !self::_validateTypes( $types ) ) {
75 76 // re open the file
76 77 fclose( $handle );
77 78 $handle = $this->_get_file_handle();
78 79
@@ -82,14 +83,11 @@
82 83 }
83 84
84 85 for ( $i = 0, $len = count( $labels ); $i < $len; $i++ ) {
85 86 $default_type = $i == 0 ? 'string' : 'number';
86 -
87 - $labels[ $i ] = $this->toUTF8( $labels[ $i ] );
88 -
89 87 $this->_series[] = array(
90 - 'label' => $labels[ $i ],
91 - 'type' => isset( $types[ $i ] ) ? $types[ $i ] : $default_type,
88 + 'label' => $labels[$i],
89 + 'type' => isset( $types[$i] ) ? $types[$i] : $default_type,
92 90 );
93 91 }
94 92
95 93 return true;
@@ -105,9 +103,9 @@
105 103 * @return resource File handle resource on success, otherwise FALSE.
106 104 */
107 105 protected function _get_file_handle( $filename = false ) {
108 106 // set line endings auto detect mode
109 - ini_set( 'auto_detect_line_endings', true );
107 + @ini_set( 'auto_detect_line_endings', true );
110 108 // open file and return handle
111 109 return fopen( $filename ? $filename : $this->_filename, 'rb' );
112 110 }
113 111
@@ -128,15 +126,14 @@
128 126 // read file and fill arrays
129 127 $handle = $this->_get_file_handle();
130 128 if ( $handle ) {
131 129 // fetch series
132 - if ( ! $this->_fetchSeries( $handle ) ) {
130 + if ( !$this->_fetchSeries( $handle ) ) {
133 131 return false;
134 132 }
135 133
136 134 // fetch data
137 135 while ( ( $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ) ) !== false ) {
138 -
139 136 $this->_data[] = $this->_normalizeData( $data );
140 137 }
141 138
142 139 // close file handle
@@ -157,5 +154,5 @@
157 154 public function getSourceName() {
158 155 return __CLASS__;
159 156 }
160 157
161 -}
158 +}