| @@ -156,9 +156,9 @@ | ||
| 156 | 156 | self::_renderGroupEnd(); |
| 157 | 157 | |
| 158 | 158 | self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) ); |
| 159 | 159 | self::_renderSectionStart(); |
| 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.' ); | |
| 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.' ); | |
| 161 | 161 | |
| 162 | 162 | $example = ' |
| 163 | 163 | { |
| 164 | 164 | "vAxis": { |
| @@ -191,8 +191,10 @@ | ||
| 191 | 191 | * |
| 192 | 192 | * @access protected |
| 193 | 193 | */ |
| 194 | 194 | protected function _renderActionSettings() { |
| 195 | + global $wp_version; | |
| 196 | + $disable_actions = version_compare( $wp_version, '4.7.0', '<' ); | |
| 195 | 197 | self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), false ); |
| 196 | 198 | self::_renderCheckboxItem( |
| 197 | 199 | esc_html__( 'Print', 'visualizer' ), |
| 198 | 200 | 'actions[]', |
| @@ -197,9 +199,10 @@ | ||
| 197 | 199 | esc_html__( 'Print', 'visualizer' ), |
| 198 | 200 | 'actions[]', |
| 199 | 201 | isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false, |
| 200 | 202 | 'print', |
| 201 | - esc_html__( 'To enable printing the 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' ), | |
| 204 | + $disable_actions | |
| 202 | 205 | ); |
| 203 | 206 | self::_renderCheckboxItem( |
| 204 | 207 | esc_html__( 'CSV', 'visualizer' ), |
| 205 | 208 | 'actions[]', |
| @@ -204,9 +207,10 @@ | ||
| 204 | 207 | esc_html__( 'CSV', 'visualizer' ), |
| 205 | 208 | 'actions[]', |
| 206 | 209 | isset( $this->actions ) && in_array( 'csv;application/csv', $this->actions ) ? true : false, |
| 207 | 210 | 'csv;application/csv', |
| 208 | - esc_html__( 'To enable downloading the data as a CSV.', '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 downloading the data as a CSV.', 'visualizer' ), | |
| 212 | + $disable_actions | |
| 209 | 213 | ); |
| 210 | 214 | |
| 211 | 215 | $disabled = ! ( class_exists( 'PHPExcel' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) ); |
| 212 | 216 | self::_renderCheckboxItem( |
| @@ -213,10 +217,10 @@ | ||
| 213 | 217 | esc_html__( 'Excel', 'visualizer' ), |
| 214 | 218 | 'actions[]', |
| 215 | 219 | isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false, |
| 216 | 220 | 'xls;application/vnd.ms-excel', |
| 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 | |
| 221 | + $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' ) ), | |
| 222 | + $disable_actions || $disabled | |
| 219 | 223 | ); |
| 220 | 224 | self::_renderCheckboxItem( |
| 221 | 225 | esc_html__( 'Copy', 'visualizer' ), |
| 222 | 226 | 'actions[]', |
| @@ -221,9 +225,10 @@ | ||
| 221 | 225 | esc_html__( 'Copy', 'visualizer' ), |
| 222 | 226 | 'actions[]', |
| 223 | 227 | isset( $this->actions ) && in_array( 'copy', $this->actions ) ? true : false, |
| 224 | 228 | 'copy', |
| 225 | - esc_html__( 'To enable copying the data to the clipboard.', 'visualizer' ) | |
| 229 | + $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' ), | |
| 230 | + $disable_actions | |
| 226 | 231 | ); |
| 227 | 232 | self::_renderSectionEnd(); |
| 228 | 233 | } |
| 229 | 234 | |
| @@ -662,9 +667,9 @@ | ||
| 662 | 667 | protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc, $disabled = false ) { |
| 663 | 668 | echo '<div class="viz-section-item">'; |
| 664 | 669 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 665 | 670 | echo '<b>', $title, '</b>'; |
| 666 | - echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ($value == $default ? 'checked' : ''), ' ', ($disabled ? 'disabled=disabled' : ''), '>'; | |
| 671 | + echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ( $value == $default ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>'; | |
| 667 | 672 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| 668 | 673 | echo '</div>'; |
| 669 | 674 | } |
| 670 | 675 | |