| @@ -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', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" 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 | ); |
| @@ -210,10 +191,8 @@ | ||
| 210 | 191 | * |
| 211 | 192 | * @access protected |
| 212 | 193 | */ |
| 213 | 194 | protected function _renderActionSettings() { |
| 214 | - global $wp_version; | |
| 215 | - $disable_actions = version_compare( $wp_version, '4.7.0', '<' ); | |
| 216 | 195 | self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), false ); |
| 217 | 196 | self::_renderCheckboxItem( |
| 218 | 197 | esc_html__( 'Print', 'visualizer' ), |
| 219 | 198 | 'actions[]', |
| @@ -218,10 +197,9 @@ | ||
| 218 | 197 | esc_html__( 'Print', 'visualizer' ), |
| 219 | 198 | 'actions[]', |
| 220 | 199 | isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false, |
| 221 | 200 | '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 data.', 'visualizer' ), | |
| 223 | - $disable_actions | |
| 201 | + esc_html__( 'To enable printing the data.', 'visualizer' ) | |
| 224 | 202 | ); |
| 225 | 203 | self::_renderCheckboxItem( |
| 226 | 204 | esc_html__( 'CSV', 'visualizer' ), |
| 227 | 205 | 'actions[]', |
| @@ -226,10 +204,9 @@ | ||
| 226 | 204 | esc_html__( 'CSV', 'visualizer' ), |
| 227 | 205 | 'actions[]', |
| 228 | 206 | isset( $this->actions ) && in_array( 'csv;application/csv', $this->actions ) ? true : false, |
| 229 | 207 | 'csv;application/csv', |
| 230 | - $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 | - $disable_actions | |
| 208 | + esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' ) | |
| 232 | 209 | ); |
| 233 | 210 | |
| 234 | 211 | $disabled = ! ( class_exists( 'PHPExcel' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) ); |
| 235 | 212 | self::_renderCheckboxItem( |
| @@ -236,10 +213,10 @@ | ||
| 236 | 213 | esc_html__( 'Excel', 'visualizer' ), |
| 237 | 214 | 'actions[]', |
| 238 | 215 | isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false, |
| 239 | 216 | 'xls;application/vnd.ms-excel', |
| 240 | - $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : ( $disabled ? '<span class="viz-section-error">' . esc_html__( 'Enable the ZIP and XML extensions to use this setting.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as an Excel spreadsheet.', 'visualizer' ) ), | |
| 241 | - $disable_actions || $disabled | |
| 217 | + $disabled ? '<span class="viz-section-error">' . esc_html__( 'Enable the ZIP and XML extensions to use this setting.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as an Excel spreadsheet.', 'visualizer' ), | |
| 218 | + $disabled | |
| 242 | 219 | ); |
| 243 | 220 | self::_renderCheckboxItem( |
| 244 | 221 | esc_html__( 'Copy', 'visualizer' ), |
| 245 | 222 | 'actions[]', |
| @@ -244,10 +221,9 @@ | ||
| 244 | 221 | esc_html__( 'Copy', 'visualizer' ), |
| 245 | 222 | 'actions[]', |
| 246 | 223 | isset( $this->actions ) && in_array( 'copy', $this->actions ) ? true : false, |
| 247 | 224 | 'copy', |
| 248 | - $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 copying the data to the clipboard.', 'visualizer' ), | |
| 249 | - $disable_actions | |
| 225 | + esc_html__( 'To enable copying the data to the clipboard.', 'visualizer' ) | |
| 250 | 226 | ); |
| 251 | 227 | self::_renderSectionEnd(); |
| 252 | 228 | } |
| 253 | 229 | |
| @@ -329,61 +305,12 @@ | ||
| 329 | 305 | |
| 330 | 306 | self::_renderSectionStart( esc_html__( 'Tooltip', 'visualizer' ), false ); |
| 331 | 307 | $this->_renderTooltipSettigns(); |
| 332 | 308 | self::_renderSectionEnd(); |
| 333 | - | |
| 334 | - $this->_renderAnimationSettings(); | |
| 335 | - | |
| 336 | 309 | self::_renderGroupEnd(); |
| 337 | 310 | } |
| 338 | 311 | |
| 339 | 312 | /** |
| 340 | - * Renders animation settings section. | |
| 341 | - * | |
| 342 | - * @access protected | |
| 343 | - */ | |
| 344 | - protected function _renderAnimationSettings() { | |
| 345 | - if ( ! $this->_supportsAnimation ) { | |
| 346 | - return; | |
| 347 | - } | |
| 348 | - | |
| 349 | - self::_renderSectionStart( esc_html__( 'Animation', 'visualizer' ), false ); | |
| 350 | - | |
| 351 | - self::_renderCheckboxItem( | |
| 352 | - esc_html__( 'Animate on startup', 'visualizer' ), | |
| 353 | - 'animation[startup]', | |
| 354 | - $this->animation['startup'], | |
| 355 | - true, | |
| 356 | - esc_html__( 'Determines if the chart will animate on the initial draw.', 'visualizer' ) | |
| 357 | - ); | |
| 358 | - | |
| 359 | - self::_renderTextItem( | |
| 360 | - esc_html__( 'Duration', 'visualizer' ), | |
| 361 | - 'animation[duration]', | |
| 362 | - isset( $this->animation['duration'] ) ? $this->animation['duration'] : 0, | |
| 363 | - esc_html__( 'The duration of the animation, in milliseconds', 'visualizer' ), | |
| 364 | - 0, | |
| 365 | - 'number' | |
| 366 | - ); | |
| 367 | - | |
| 368 | - self::_renderSelectItem( | |
| 369 | - esc_html__( 'Easing', 'visualizer' ), | |
| 370 | - 'animation[easing]', | |
| 371 | - isset( $this->animation['easing'] ) ? $this->animation['easing'] : null, | |
| 372 | - array( | |
| 373 | - 'linear' => esc_html__( 'Constant speed', 'visualizer' ), | |
| 374 | - 'in' => esc_html__( 'Start slow and speed up', 'visualizer' ), | |
| 375 | - 'out' => esc_html__( 'Start fast and slow down', 'visualizer' ), | |
| 376 | - 'inAndOut' => esc_html__( 'Start slow, speed up, then slow down', 'visualizer' ), | |
| 377 | - ), | |
| 378 | - esc_html__( 'The easing function applied to the animation.', 'visualizer' ) | |
| 379 | - ); | |
| 380 | - | |
| 381 | - self::_renderSectionEnd(); | |
| 382 | - | |
| 383 | - } | |
| 384 | - | |
| 385 | - /** | |
| 386 | 313 | * Renders tooltip settings section. |
| 387 | 314 | * |
| 388 | 315 | * @since 1.4.0 |
| 389 | 316 | * |
| @@ -735,9 +662,9 @@ | ||
| 735 | 662 | protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc, $disabled = false ) { |
| 736 | 663 | echo '<div class="viz-section-item">'; |
| 737 | 664 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 738 | 665 | echo '<b>', $title, '</b>'; |
| 739 | - echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ( $value == $default ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>'; | |
| 666 | + echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ($value == $default ? 'checked' : ''), ' ', ($disabled ? 'disabled=disabled' : ''), '>'; | |
| 740 | 667 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| 741 | 668 | echo '</div>'; |
| 742 | 669 | } |
| 743 | 670 | |
| @@ -756,14 +683,7 @@ | ||
| 756 | 683 | echo '<b>', $title, '</b>'; |
| 757 | 684 | echo '<textarea class="control-text" ', $attributes, ' name="', $name, '" placeholder="', $placeholder, '">', $value, '</textarea>'; |
| 758 | 685 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| 759 | 686 | echo '</div>'; |
| 760 | - } | |
| 761 | - | |
| 762 | - /** | |
| 763 | - * Returns the library this chart implements. | |
| 764 | - */ | |
| 765 | - public function getLibrary() { | |
| 766 | - return $this->_library; | |
| 767 | 687 | } |
| 768 | 688 | |
| 769 | 689 | } |