| @@ -83,24 +83,8 @@ | ||
| 83 | 83 | */ |
| 84 | 84 | protected $_alignments; |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Whether this chart supports animation or not. | |
| 88 | - * | |
| 89 | - * @access protected | |
| 90 | - * @var bool | |
| 91 | - */ | |
| 92 | - protected $_supportsAnimation = true; | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * Which library does this this chart implement? | |
| 96 | - * | |
| 97 | - * @access protected | |
| 98 | - * @var string | |
| 99 | - */ | |
| 100 | - protected $_library = null; | |
| 101 | - | |
| 102 | - /** | |
| 103 | 87 | * Constructor. |
| 104 | 88 | * |
| 105 | 89 | * @since 1.0.0 |
| 106 | 90 | * |
| @@ -131,10 +115,8 @@ | ||
| 131 | 115 | '' => '', |
| 132 | 116 | '1' => esc_html__( 'Yes', 'visualizer' ), |
| 133 | 117 | '0' => esc_html__( 'No', 'visualizer' ), |
| 134 | 118 | ); |
| 135 | - | |
| 136 | - $this->hooks(); | |
| 137 | 119 | } |
| 138 | 120 | |
| 139 | 121 | /** |
| 140 | 122 | * Renders chart title settings. |
| @@ -174,9 +156,9 @@ | ||
| 174 | 156 | self::_renderGroupEnd(); |
| 175 | 157 | |
| 176 | 158 | self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) ); |
| 177 | 159 | 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>' ); | |
| 160 | + 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 | 161 | |
| 180 | 162 | $example = ' |
| 181 | 163 | { |
| 182 | 164 | "vAxis": { |
| @@ -192,10 +174,9 @@ | ||
| 192 | 174 | esc_html__( 'Configuration', 'visualizer' ), |
| 193 | 175 | 'manual', |
| 194 | 176 | $this->manual, |
| 195 | 177 | sprintf( |
| 196 | - esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), | |
| 197 | - '<br><code>' . $example . '</code>' | |
| 178 | + esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), '<br><code>' . $example . '</code>' | |
| 198 | 179 | ), |
| 199 | 180 | '', |
| 200 | 181 | array( 'rows' => 5 ) |
| 201 | 182 | ); |
| @@ -218,9 +199,9 @@ | ||
| 218 | 199 | esc_html__( 'Print', 'visualizer' ), |
| 219 | 200 | 'actions[]', |
| 220 | 201 | isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false, |
| 221 | 202 | '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' ), | |
| 203 | + $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 | 204 | $disable_actions |
| 224 | 205 | ); |
| 225 | 206 | self::_renderCheckboxItem( |
| 226 | 207 | esc_html__( 'CSV', 'visualizer' ), |
| @@ -230,9 +211,9 @@ | ||
| 230 | 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 downloading the data as a CSV.', 'visualizer' ), |
| 231 | 212 | $disable_actions |
| 232 | 213 | ); |
| 233 | 214 | |
| 234 | - $disabled = ! self::is_excel_enabled(); | |
| 215 | + $disabled = ! ( class_exists( 'PHPExcel' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) ); | |
| 235 | 216 | self::_renderCheckboxItem( |
| 236 | 217 | esc_html__( 'Excel', 'visualizer' ), |
| 237 | 218 | 'actions[]', |
| 238 | 219 | isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false, |
| @@ -251,20 +232,8 @@ | ||
| 251 | 232 | self::_renderSectionEnd(); |
| 252 | 233 | } |
| 253 | 234 | |
| 254 | 235 | /** |
| 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 | 236 | * Renders chart general settings group. |
| 268 | 237 | * |
| 269 | 238 | * @since 1.0.0 |
| 270 | 239 | * |
| @@ -341,61 +310,12 @@ | ||
| 341 | 310 | |
| 342 | 311 | self::_renderSectionStart( esc_html__( 'Tooltip', 'visualizer' ), false ); |
| 343 | 312 | $this->_renderTooltipSettigns(); |
| 344 | 313 | self::_renderSectionEnd(); |
| 345 | - | |
| 346 | - $this->_renderAnimationSettings(); | |
| 347 | - | |
| 348 | 314 | self::_renderGroupEnd(); |
| 349 | 315 | } |
| 350 | 316 | |
| 351 | 317 | /** |
| 352 | - * Renders animation settings section. | |
| 353 | - * | |
| 354 | - * @access protected | |
| 355 | - */ | |
| 356 | - protected function _renderAnimationSettings() { | |
| 357 | - if ( ! $this->_supportsAnimation ) { | |
| 358 | - return; | |
| 359 | - } | |
| 360 | - | |
| 361 | - self::_renderSectionStart( esc_html__( 'Animation', 'visualizer' ), false ); | |
| 362 | - | |
| 363 | - self::_renderCheckboxItem( | |
| 364 | - esc_html__( 'Animate on startup', 'visualizer' ), | |
| 365 | - 'animation[startup]', | |
| 366 | - isset( $this->animation['startup'] ) ? $this->animation['startup'] : 0, | |
| 367 | - true, | |
| 368 | - esc_html__( 'Determines if the chart will animate on the initial draw.', 'visualizer' ) | |
| 369 | - ); | |
| 370 | - | |
| 371 | - self::_renderTextItem( | |
| 372 | - esc_html__( 'Duration', 'visualizer' ), | |
| 373 | - 'animation[duration]', | |
| 374 | - isset( $this->animation['duration'] ) ? $this->animation['duration'] : 0, | |
| 375 | - esc_html__( 'The duration of the animation, in milliseconds', 'visualizer' ), | |
| 376 | - 0, | |
| 377 | - 'number' | |
| 378 | - ); | |
| 379 | - | |
| 380 | - self::_renderSelectItem( | |
| 381 | - esc_html__( 'Easing', 'visualizer' ), | |
| 382 | - 'animation[easing]', | |
| 383 | - isset( $this->animation['easing'] ) ? $this->animation['easing'] : null, | |
| 384 | - array( | |
| 385 | - 'linear' => esc_html__( 'Constant speed', 'visualizer' ), | |
| 386 | - 'in' => esc_html__( 'Start slow and speed up', 'visualizer' ), | |
| 387 | - 'out' => esc_html__( 'Start fast and slow down', 'visualizer' ), | |
| 388 | - 'inAndOut' => esc_html__( 'Start slow, speed up, then slow down', 'visualizer' ), | |
| 389 | - ), | |
| 390 | - esc_html__( 'The easing function applied to the animation.', 'visualizer' ) | |
| 391 | - ); | |
| 392 | - | |
| 393 | - self::_renderSectionEnd(); | |
| 394 | - | |
| 395 | - } | |
| 396 | - | |
| 397 | - /** | |
| 398 | 318 | * Renders tooltip settings section. |
| 399 | 319 | * |
| 400 | 320 | * @since 1.4.0 |
| 401 | 321 | * |
| @@ -768,14 +688,7 @@ | ||
| 768 | 688 | echo '<b>', $title, '</b>'; |
| 769 | 689 | echo '<textarea class="control-text" ', $attributes, ' name="', $name, '" placeholder="', $placeholder, '">', $value, '</textarea>'; |
| 770 | 690 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| 771 | 691 | echo '</div>'; |
| 772 | - } | |
| 773 | - | |
| 774 | - /** | |
| 775 | - * Returns the library this chart implements. | |
| 776 | - */ | |
| 777 | - public function getLibrary() { | |
| 778 | - return $this->_library; | |
| 779 | 692 | } |
| 780 | 693 | |
| 781 | 694 | } |