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 -8 3.0.51.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
@@ -83,10 +84,10 @@
83 84
84 85 for ( $i = 0, $len = count( $labels ); $i < $len; $i++ ) {
85 86 $default_type = $i == 0 ? 'string' : 'number';
86 87 $this->_series[] = array(
87 - 'label' => $labels[ $i ],
88 - 'type' => isset( $types[ $i ] ) ? $types[ $i ] : $default_type,
88 + 'label' => $labels[$i],
89 + 'type' => isset( $types[$i] ) ? $types[$i] : $default_type,
89 90 );
90 91 }
91 92
92 93 return true;
@@ -102,9 +103,9 @@
102 103 * @return resource File handle resource on success, otherwise FALSE.
103 104 */
104 105 protected function _get_file_handle( $filename = false ) {
105 106 // set line endings auto detect mode
106 - ini_set( 'auto_detect_line_endings', true );
107 + @ini_set( 'auto_detect_line_endings', true );
107 108 // open file and return handle
108 109 return fopen( $filename ? $filename : $this->_filename, 'rb' );
109 110 }
110 111
@@ -125,15 +126,14 @@
125 126 // read file and fill arrays
126 127 $handle = $this->_get_file_handle();
127 128 if ( $handle ) {
128 129 // fetch series
129 - if ( ! $this->_fetchSeries( $handle ) ) {
130 + if ( !$this->_fetchSeries( $handle ) ) {
130 131 return false;
131 132 }
132 133
133 134 // fetch data
134 135 while ( ( $data = fgetcsv( $handle, 0, VISUALIZER_CSV_DELIMITER, VISUALIZER_CSV_ENCLOSURE ) ) !== false ) {
135 -
136 136 $this->_data[] = $this->_normalizeData( $data );
137 137 }
138 138
139 139 // close file handle
@@ -154,5 +154,5 @@
154 154 public function getSourceName() {
155 155 return __CLASS__;
156 156 }
157 157
158 -}
158 +}