| @@ -91,16 +91,8 @@ | ||
| 91 | 91 | */ |
| 92 | 92 | protected $_supportsAnimation = true; |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * Which library does this this chart implement? | |
| 96 | - * | |
| 97 | - * @access protected | |
| 98 | - * @var string | |
| 99 | - */ | |
| 100 | - protected $_library = null; | |
| 101 | - | |
| 102 | - /** | |
| 103 | 95 | * Constructor. |
| 104 | 96 | * |
| 105 | 97 | * @since 1.0.0 |
| 106 | 98 | * |
| @@ -131,10 +123,8 @@ | ||
| 131 | 123 | '' => '', |
| 132 | 124 | '1' => esc_html__( 'Yes', 'visualizer' ), |
| 133 | 125 | '0' => esc_html__( 'No', 'visualizer' ), |
| 134 | 126 | ); |
| 135 | - | |
| 136 | - $this->hooks(); | |
| 137 | 127 | } |
| 138 | 128 | |
| 139 | 129 | /** |
| 140 | 130 | * Renders chart title settings. |
| @@ -174,9 +164,9 @@ | ||
| 174 | 164 | self::_renderGroupEnd(); |
| 175 | 165 | |
| 176 | 166 | self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) ); |
| 177 | 167 | self::_renderSectionStart(); |
| 178 | - self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' ); | |
| 168 | + self::_renderSectionDescription( __( 'Configure the graph by providing configuration variables right from the', 'visualizer' ) . ' <a href="https://developers.google.com/chart/interactive/docs/reference" target="_blank">Google Visualization</a> API.' ); | |
| 179 | 169 | |
| 180 | 170 | $example = ' |
| 181 | 171 | { |
| 182 | 172 | "vAxis": { |
| @@ -192,10 +182,9 @@ | ||
| 192 | 182 | esc_html__( 'Configuration', 'visualizer' ), |
| 193 | 183 | 'manual', |
| 194 | 184 | $this->manual, |
| 195 | 185 | sprintf( |
| 196 | - esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), | |
| 197 | - '<br><code>' . $example . '</code>' | |
| 186 | + esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), '<br><code>' . $example . '</code>' | |
| 198 | 187 | ), |
| 199 | 188 | '', |
| 200 | 189 | array( 'rows' => 5 ) |
| 201 | 190 | ); |
| @@ -218,9 +207,9 @@ | ||
| 218 | 207 | esc_html__( 'Print', 'visualizer' ), |
| 219 | 208 | 'actions[]', |
| 220 | 209 | isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false, |
| 221 | 210 | 'print', |
| 222 | - $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable printing the chart/data.', 'visualizer' ), | |
| 211 | + $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable printing the data.', 'visualizer' ), | |
| 223 | 212 | $disable_actions |
| 224 | 213 | ); |
| 225 | 214 | self::_renderCheckboxItem( |
| 226 | 215 | esc_html__( 'CSV', 'visualizer' ), |
| @@ -230,9 +219,9 @@ | ||
| 230 | 219 | $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' ), |
| 231 | 220 | $disable_actions |
| 232 | 221 | ); |
| 233 | 222 | |
| 234 | - $disabled = ! self::is_excel_enabled(); | |
| 223 | + $disabled = ! ( class_exists( 'PHPExcel' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) ); | |
| 235 | 224 | self::_renderCheckboxItem( |
| 236 | 225 | esc_html__( 'Excel', 'visualizer' ), |
| 237 | 226 | 'actions[]', |
| 238 | 227 | isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false, |
| @@ -251,20 +240,8 @@ | ||
| 251 | 240 | self::_renderSectionEnd(); |
| 252 | 241 | } |
| 253 | 242 | |
| 254 | 243 | /** |
| 255 | - * Checks if the Excel module can be enabled. | |
| 256 | - */ | |
| 257 | - private static function is_excel_enabled() { | |
| 258 | - $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload.php'; | |
| 259 | - if ( is_readable( $vendor_file ) ) { | |
| 260 | - include_once( $vendor_file ); | |
| 261 | - } | |
| 262 | - | |
| 263 | - return class_exists( 'PhpOffice\PhpSpreadsheet\Spreadsheet' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && extension_loaded( 'fileinfo' ) && version_compare( PHP_VERSION, '5.6.0', '>' ); | |
| 264 | - } | |
| 265 | - | |
| 266 | - /** | |
| 267 | 244 | * Renders chart general settings group. |
| 268 | 245 | * |
| 269 | 246 | * @since 1.0.0 |
| 270 | 247 | * |
| @@ -362,9 +339,9 @@ | ||
| 362 | 339 | |
| 363 | 340 | self::_renderCheckboxItem( |
| 364 | 341 | esc_html__( 'Animate on startup', 'visualizer' ), |
| 365 | 342 | 'animation[startup]', |
| 366 | - isset( $this->animation['startup'] ) ? $this->animation['startup'] : 0, | |
| 343 | + $this->animation['startup'], | |
| 367 | 344 | true, |
| 368 | 345 | esc_html__( 'Determines if the chart will animate on the initial draw.', 'visualizer' ) |
| 369 | 346 | ); |
| 370 | 347 | |
| @@ -768,14 +745,7 @@ | ||
| 768 | 745 | echo '<b>', $title, '</b>'; |
| 769 | 746 | echo '<textarea class="control-text" ', $attributes, ' name="', $name, '" placeholder="', $placeholder, '">', $value, '</textarea>'; |
| 770 | 747 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| 771 | 748 | echo '</div>'; |
| 772 | - } | |
| 773 | - | |
| 774 | - /** | |
| 775 | - * Returns the library this chart implements. | |
| 776 | - */ | |
| 777 | - public function getLibrary() { | |
| 778 | - return $this->_library; | |
| 779 | 749 | } |
| 780 | 750 | |
| 781 | 751 | } |