| @@ -53,9 +53,8 @@ | ||
| 53 | 53 | public function __construct( Visualizer_Plugin $plugin ) { |
| 54 | 54 | parent::__construct( $plugin ); |
| 55 | 55 | |
| 56 | 56 | $this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' ); |
| 57 | - $this->_addFilter( 'visualizer_get_language', 'getLanguage' ); | |
| 58 | 57 | $this->_addShortcode( 'visualizer', 'renderChart' ); |
| 59 | 58 | |
| 60 | 59 | // add do_shortocde hook for widget_text filter |
| 61 | 60 | if ( ! has_filter( 'widget_text', 'do_shortcode' ) ) { |
| @@ -70,16 +69,8 @@ | ||
| 70 | 69 | add_action( 'rest_api_init', array( $this, 'endpoint_register' ) ); |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | 72 | /** |
| 74 | - * Returns the language/locale. | |
| 75 | - */ | |
| 76 | - function getLanguage( $dummy, $only_language ) { | |
| 77 | - return $this->get_language(); | |
| 78 | - } | |
| 79 | - | |
| 80 | - | |
| 81 | - /** | |
| 82 | 73 | * Registers the endpoints |
| 83 | 74 | */ |
| 84 | 75 | function endpoint_register() { |
| 85 | 76 | register_rest_route( |
| @@ -158,8 +149,9 @@ | ||
| 158 | 149 | wp_register_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 159 | 150 | wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true ); |
| 160 | 151 | wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'visualizer-google-jsapi-old', 'jquery' ), Visualizer_Plugin::VERSION, true ); |
| 161 | 152 | wp_register_script( 'visualizer-clipboardjs', VISUALIZER_ABSURL . 'js/lib/clipboardjs/clipboard.min.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true ); |
| 153 | + wp_enqueue_script( 'visualizer-clipboardjs' ); | |
| 162 | 154 | wp_register_style( 'visualizer-front', VISUALIZER_ABSURL . 'css/front.css', array(), Visualizer_Plugin::VERSION ); |
| 163 | 155 | do_action( 'visualizer_pro_frontend_load_resources' ); |
| 164 | 156 | } |
| 165 | 157 | |
| @@ -176,16 +168,15 @@ | ||
| 176 | 168 | * @access public |
| 177 | 169 | * @param array $atts The array of shortcode attributes. |
| 178 | 170 | */ |
| 179 | 171 | public function renderChart( $atts ) { |
| 180 | - global $wp_version; | |
| 181 | 172 | $atts = shortcode_atts( |
| 182 | 173 | array( |
| 183 | 174 | 'id' => false, // chart id |
| 184 | - 'class' => false, // chart class | |
| 185 | - 'series' => false, // series filter hook | |
| 186 | - 'data' => false, // data filter hook | |
| 187 | - 'settings' => false, // data filter hook | |
| 175 | + 'class' => false, // chart class | |
| 176 | + 'series' => false, // series filter hook | |
| 177 | + 'data' => false, // data filter hook | |
| 178 | + 'settings' => false, // data filter hook | |
| 188 | 179 | ), $atts |
| 189 | 180 | ); |
| 190 | 181 | |
| 191 | 182 | // if empty id or chart does not exists, then return empty string |
| @@ -196,13 +187,8 @@ | ||
| 196 | 187 | if ( ! apply_filters( 'visualizer_pro_show_chart', true, $atts['id'] ) ) { |
| 197 | 188 | return ''; |
| 198 | 189 | } |
| 199 | 190 | |
| 200 | - // in case revisions exist. | |
| 201 | - if ( true === ( $revisions = $this->undoRevisions( $chart->ID, true ) ) ) { | |
| 202 | - $chart = get_post( $chart->ID ); | |
| 203 | - } | |
| 204 | - | |
| 205 | 191 | $id = 'visualizer-' . $atts['id']; |
| 206 | 192 | $defaultClass = 'visualizer-front'; |
| 207 | 193 | $class = apply_filters( Visualizer_Plugin::FILTER_CHART_WRAPPER_CLASS, $atts['class'], $atts['id'] ); |
| 208 | 194 | $class = $defaultClass . ' ' . $class . ' ' . 'visualizer-front-' . $atts['id']; |
| @@ -234,14 +220,11 @@ | ||
| 234 | 220 | } |
| 235 | 221 | |
| 236 | 222 | $id = $id . '-' . rand(); |
| 237 | 223 | $arguments = array( '', $id, $settings ); |
| 238 | - $css = ''; | |
| 239 | 224 | apply_filters_ref_array( 'visualizer_pro_inline_css', array( &$arguments ) ); |
| 240 | - if ( ! empty( $arguments ) ) { | |
| 241 | - $css = $arguments[0]; | |
| 242 | - $settings = $arguments[2]; | |
| 243 | - } | |
| 225 | + $css = $arguments[0]; | |
| 226 | + $settings = $arguments[2]; | |
| 244 | 227 | |
| 245 | 228 | // add chart to the array |
| 246 | 229 | $this->_charts[ $id ] = array( |
| 247 | 230 | 'type' => $type, |
| @@ -254,11 +237,10 @@ | ||
| 254 | 237 | wp_enqueue_script( 'visualizer-render' ); |
| 255 | 238 | wp_localize_script( |
| 256 | 239 | 'visualizer-render', 'visualizer', array( |
| 257 | 240 | 'charts' => $this->_charts, |
| 258 | - 'language' => $this->get_language(), | |
| 259 | 241 | 'map_api_key' => get_option( 'visualizer-map-api-key' ), |
| 260 | - 'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '', | |
| 242 | + 'rest_url' => rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ), | |
| 261 | 243 | 'i10n' => array( |
| 262 | 244 | 'copied' => __( 'Copied!', 'visualizer' ), |
| 263 | 245 | ), |
| 264 | 246 | ) |
| @@ -283,9 +265,8 @@ | ||
| 283 | 265 | |
| 284 | 266 | if ( 'copy' === $key ) { |
| 285 | 267 | $copy = $this->_getDataAs( $atts['id'], 'csv' ); |
| 286 | 268 | $actions_div .= ' data-clipboard-text="' . esc_attr( $copy['csv'] ) . '"'; |
| 287 | - wp_enqueue_script( 'visualizer-clipboardjs' ); | |
| 288 | 269 | } |
| 289 | 270 | |
| 290 | 271 | $actions_div .= apply_filters( 'visualizer_action_attributes', '', $key, $atts['id'] ); |
| 291 | 272 | $actions_div .= '>' . $label . '</a> '; |