| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | // +----------------------------------------------------------------------+ |
| 4 | 3 | // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) | |
| 5 | 4 | // +----------------------------------------------------------------------+ |
| 6 | 5 | // | This program is free software; you can redistribute it and/or modify | |
| @@ -46,13 +45,13 @@ | ||
| 46 | 45 | * |
| 47 | 46 | * @since 1.0.0 |
| 48 | 47 | * |
| 49 | 48 | * @access public |
| 49 | + * | |
| 50 | 50 | * @param Visualizer_Plugin $plugin The instance of the plugin. |
| 51 | 51 | */ |
| 52 | 52 | public function __construct( Visualizer_Plugin $plugin ) { |
| 53 | 53 | parent::__construct( $plugin ); |
| 54 | - | |
| 55 | 54 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_GET_CHARTS, 'getCharts' ); |
| 56 | 55 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_DELETE_CHART, 'deleteChart' ); |
| 57 | 56 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_CREATE_CHART, 'renderChartPages' ); |
| 58 | 57 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_EDIT_CHART, 'renderChartPages' ); |
| @@ -57,33 +56,54 @@ | ||
| 57 | 56 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_CREATE_CHART, 'renderChartPages' ); |
| 58 | 57 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_EDIT_CHART, 'renderChartPages' ); |
| 59 | 58 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_UPLOAD_DATA, 'uploadData' ); |
| 60 | 59 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_CLONE_CHART, 'cloneChart' ); |
| 61 | - | |
| 62 | 60 | // Added by Ash/Upwork |
| 63 | 61 | $this->_addAjaxAction( Visualizer_Plugin::ACTION_EXPORT_DATA, 'exportData' ); |
| 64 | - if ( defined( 'Visualizer_Pro' ) ) { | |
| 65 | - global $Visualizer_Pro; | |
| 66 | - list($action, $name, $class) = $Visualizer_Pro->_getAjaxAction( $this ); | |
| 67 | - $this->_addAjaxAction( $action, $name, $class ); | |
| 68 | - } | |
| 69 | 62 | // Added by Ash/Upwork |
| 70 | 63 | } |
| 71 | 64 | |
| 72 | 65 | /** |
| 73 | - * Sends json response. | |
| 66 | + * Fetches charts from database. | |
| 74 | 67 | * |
| 75 | 68 | * @since 1.0.0 |
| 76 | 69 | * |
| 77 | - * @access private | |
| 78 | - * @param array $results The response array. | |
| 70 | + * @access public | |
| 79 | 71 | */ |
| 80 | - public function _sendResponse( $results ) { | |
| 81 | - header( 'Content-type: application/json' ); | |
| 82 | - nocache_headers(); | |
| 83 | - | |
| 84 | - echo json_encode( $results ); | |
| 85 | - exit; | |
| 72 | + public function getCharts() { | |
| 73 | + $query_args = array( | |
| 74 | + 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, | |
| 75 | + 'posts_per_page' => 9, | |
| 76 | + 'paged' => filter_input( INPUT_GET, 'page', FILTER_VALIDATE_INT, array( | |
| 77 | + 'options' => array( | |
| 78 | + 'min_range' => 1, | |
| 79 | + 'default' => 1, | |
| 80 | + ), | |
| 81 | + ) ), | |
| 82 | + ); | |
| 83 | + $filter = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING ); | |
| 84 | + if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) { | |
| 85 | + $query_args['meta_query'] = array( | |
| 86 | + array( | |
| 87 | + 'key' => Visualizer_Plugin::CF_CHART_TYPE, | |
| 88 | + 'value' => $filter, | |
| 89 | + 'compare' => '=', | |
| 90 | + ), | |
| 91 | + ); | |
| 92 | + } | |
| 93 | + $query = new WP_Query( $query_args ); | |
| 94 | + $charts = array(); | |
| 95 | + while ( $query->have_posts() ) { | |
| 96 | + $chart = $query->next_post(); | |
| 97 | + $chart_data = $this->_getChartArray( $chart ); | |
| 98 | + $chart_data['id'] = $chart->ID; | |
| 99 | + $charts[] = $chart_data; | |
| 100 | + } | |
| 101 | + self::_sendResponse( array( | |
| 102 | + 'success' => true, | |
| 103 | + 'data' => $charts, | |
| 104 | + 'total' => $query->max_num_pages, | |
| 105 | + ) ); | |
| 86 | 106 | } |
| 87 | 107 | |
| 88 | 108 | /** |
| 89 | 109 | * Returns chart data required for rendering. |
| @@ -90,9 +110,11 @@ | ||
| 90 | 110 | * |
| 91 | 111 | * @since 1.0.0 |
| 92 | 112 | * |
| 93 | 113 | * @access private |
| 114 | + * | |
| 94 | 115 | * @param WP_Post $chart The chart object. |
| 116 | + * | |
| 95 | 117 | * @return array The array of chart data. |
| 96 | 118 | */ |
| 97 | 119 | private function _getChartArray( WP_Post $chart = null ) { |
| 98 | 120 | if ( is_null( $chart ) ) { |
| @@ -97,12 +119,11 @@ | ||
| 97 | 119 | private function _getChartArray( WP_Post $chart = null ) { |
| 98 | 120 | if ( is_null( $chart ) ) { |
| 99 | 121 | $chart = $this->_chart; |
| 100 | 122 | } |
| 101 | - | |
| 102 | - $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 123 | + $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 103 | 124 | $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type ); |
| 104 | - $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type ); | |
| 125 | + $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type ); | |
| 105 | 126 | |
| 106 | 127 | return array( |
| 107 | 128 | 'type' => $type, |
| 108 | 129 | 'series' => $series, |
| @@ -111,54 +132,21 @@ | ||
| 111 | 132 | ); |
| 112 | 133 | } |
| 113 | 134 | |
| 114 | 135 | /** |
| 115 | - * Fetches charts from database. | |
| 136 | + * Sends json response. | |
| 116 | 137 | * |
| 117 | 138 | * @since 1.0.0 |
| 118 | 139 | * |
| 119 | - * @access public | |
| 140 | + * @access private | |
| 141 | + * | |
| 142 | + * @param array $results The response array. | |
| 120 | 143 | */ |
| 121 | - public function getCharts() { | |
| 122 | - $query_args = array( | |
| 123 | - 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, | |
| 124 | - 'posts_per_page' => 9, | |
| 125 | - 'paged' => filter_input( INPUT_GET, 'page', FILTER_VALIDATE_INT, array( | |
| 126 | - 'options' => array( | |
| 127 | - 'min_range' => 1, | |
| 128 | - 'default' => 1, | |
| 129 | - ), | |
| 130 | - ) ), | |
| 131 | - ); | |
| 132 | - | |
| 133 | - $filter = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING ); | |
| 134 | - if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) { | |
| 135 | - $query_args['meta_query'] = array( | |
| 136 | - array( | |
| 137 | - 'key' => Visualizer_Plugin::CF_CHART_TYPE, | |
| 138 | - 'value' => $filter, | |
| 139 | - 'compare' => '=', | |
| 140 | - ), | |
| 141 | - ); | |
| 142 | - } | |
| 143 | - | |
| 144 | - $query = new WP_Query( $query_args ); | |
| 145 | - | |
| 146 | - $charts = array(); | |
| 147 | - while ( $query->have_posts() ) { | |
| 148 | - $chart = $query->next_post(); | |
| 149 | - | |
| 150 | - $chart_data = $this->_getChartArray( $chart ); | |
| 151 | - $chart_data['id'] = $chart->ID; | |
| 152 | - | |
| 153 | - $charts[] = $chart_data; | |
| 154 | - } | |
| 155 | - | |
| 156 | - $this->_sendResponse( array( | |
| 157 | - 'success' => true, | |
| 158 | - 'data' => $charts, | |
| 159 | - 'total' => $query->max_num_pages, | |
| 160 | - ) ); | |
| 144 | + public static function _sendResponse( $results ) { | |
| 145 | + header( 'Content-type: application/json' ); | |
| 146 | + nocache_headers(); | |
| 147 | + echo json_encode( $results ); | |
| 148 | + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 161 | 149 | } |
| 162 | 150 | |
| 163 | 151 | /** |
| 164 | 152 | * Deletes a chart from database. |
| @@ -168,30 +156,32 @@ | ||
| 168 | 156 | * |
| 169 | 157 | * @access public |
| 170 | 158 | */ |
| 171 | 159 | public function deleteChart() { |
| 172 | - $is_post = $_SERVER['REQUEST_METHOD'] == 'POST'; | |
| 160 | + $is_post = $_SERVER['REQUEST_METHOD'] == 'POST'; | |
| 173 | 161 | $input_method = $is_post ? INPUT_POST : INPUT_GET; |
| 174 | - | |
| 175 | - $chart_id = $success = false; | |
| 176 | - $nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) ); | |
| 177 | - $capable = current_user_can( 'delete_posts' ); | |
| 162 | + $chart_id = $success = false; | |
| 163 | + $nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) ); | |
| 164 | + $capable = current_user_can( 'delete_posts' ); | |
| 178 | 165 | if ( $nonce && $capable ) { |
| 179 | - $chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) ); | |
| 166 | + $chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( | |
| 167 | + 'options' => array( | |
| 168 | + 'min_range' => 1, | |
| 169 | + ), | |
| 170 | + ) ); | |
| 180 | 171 | if ( $chart_id ) { |
| 181 | - $chart = get_post( $chart_id ); | |
| 172 | + $chart = get_post( $chart_id ); | |
| 182 | 173 | $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER; |
| 183 | 174 | } |
| 184 | 175 | } |
| 185 | - | |
| 186 | 176 | if ( $success ) { |
| 187 | 177 | wp_delete_post( $chart_id, true ); |
| 188 | 178 | } |
| 189 | - | |
| 190 | 179 | if ( $is_post ) { |
| 191 | - $this->_sendResponse( array( 'success' => $success ) ); | |
| 180 | + self::_sendResponse( array( | |
| 181 | + 'success' => $success, | |
| 182 | + ) ); | |
| 192 | 183 | } |
| 193 | - | |
| 194 | 184 | wp_redirect( wp_get_referer() ); |
| 195 | 185 | exit; |
| 196 | 186 | } |
| 197 | 187 | |
| @@ -203,18 +193,15 @@ | ||
| 203 | 193 | * |
| 204 | 194 | * @access public |
| 205 | 195 | */ |
| 206 | 196 | public function renderChartPages() { |
| 207 | - define( 'IFRAME_REQUEST', 1 ); | |
| 208 | - | |
| 197 | + defined( 'IFRAME_REQUEST' ) || define( 'IFRAME_REQUEST', 1 ); | |
| 209 | 198 | // check chart, if chart not exists, will create new one and redirects to the same page with proper chart id |
| 210 | - $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT ); | |
| 199 | + $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : ''; | |
| 211 | 200 | if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) { |
| 212 | 201 | $default_type = 'line'; |
| 213 | - | |
| 214 | - $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' ); | |
| 202 | + $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' ); | |
| 215 | 203 | $source->fetch(); |
| 216 | - | |
| 217 | 204 | $chart_id = wp_insert_post( array( |
| 218 | 205 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| 219 | 206 | 'post_title' => 'Visualization', |
| 220 | 207 | 'post_author' => get_current_user_id(), |
| @@ -220,39 +207,42 @@ | ||
| 220 | 207 | 'post_author' => get_current_user_id(), |
| 221 | 208 | 'post_status' => 'auto-draft', |
| 222 | 209 | 'post_content' => $source->getData(), |
| 223 | 210 | ) ); |
| 224 | - | |
| 225 | 211 | if ( $chart_id && ! is_wp_error( $chart_id ) ) { |
| 226 | 212 | add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type ); |
| 227 | 213 | add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 ); |
| 228 | 214 | add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); |
| 229 | 215 | add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); |
| 230 | - add_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, array( 'focusTarget' => 'datum' ) ); | |
| 216 | + add_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, array( | |
| 217 | + 'focusTarget' => 'datum', | |
| 218 | + ) ); | |
| 231 | 219 | } |
| 232 | - | |
| 233 | 220 | wp_redirect( add_query_arg( 'chart', (int) $chart_id ) ); |
| 234 | - exit; | |
| 221 | + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 235 | 222 | } |
| 236 | - | |
| 237 | 223 | // enqueue and register scripts and styles |
| 238 | 224 | wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array(), Visualizer_Plugin::VERSION ); |
| 239 | - | |
| 240 | 225 | wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true ); |
| 241 | 226 | wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 242 | 227 | wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); |
| 243 | - wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi-old', 'google-jsapi-new', 'visualizer-frame' ), Visualizer_Plugin::VERSION, true ); | |
| 244 | - wp_register_script( 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( 'wp-color-picker', 'visualizer-render' ), Visualizer_Plugin::VERSION, true ); | |
| 245 | - | |
| 228 | + wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( | |
| 229 | + 'google-jsapi-old', | |
| 230 | + 'google-jsapi-new', | |
| 231 | + 'visualizer-frame', | |
| 232 | + ), Visualizer_Plugin::VERSION, true ); | |
| 233 | + wp_register_script( 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( | |
| 234 | + 'wp-color-picker', | |
| 235 | + 'visualizer-render', | |
| 236 | + ), Visualizer_Plugin::VERSION, true ); | |
| 246 | 237 | // added by Ash/Upwork |
| 247 | - if ( defined( 'Visualizer_Pro' ) ) { | |
| 238 | + if ( VISUALIZER_PRO ) { | |
| 248 | 239 | global $Visualizer_Pro; |
| 249 | 240 | $Visualizer_Pro->_addScriptsAndStyles(); |
| 250 | 241 | } |
| 251 | - | |
| 252 | 242 | // dispatch pages |
| 253 | - $this->_chart = $chart; | |
| 254 | - switch ( filter_input( INPUT_GET, 'tab' ) ) { | |
| 243 | + $this->_chart = get_post( $chart_id ); | |
| 244 | + switch ( isset( $_GET['tab'] ) ? $_GET['tab'] : '' ) { | |
| 255 | 245 | case 'settings': |
| 256 | 246 | // changed by Ash/Upwork |
| 257 | 247 | $this->_handleDataAndSettingsPage(); |
| 258 | 248 | break; |
| @@ -260,152 +250,58 @@ | ||
| 260 | 250 | default: |
| 261 | 251 | $this->_handleTypesPage(); |
| 262 | 252 | break; |
| 263 | 253 | } |
| 264 | - | |
| 265 | - exit; | |
| 254 | + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 266 | 255 | } |
| 267 | 256 | |
| 268 | 257 | /** |
| 269 | - * Handles chart type selection page. | |
| 270 | - * | |
| 271 | - * @since 1.0.0 | |
| 272 | - * | |
| 273 | - * @access private | |
| 274 | - */ | |
| 275 | - private function _handleTypesPage() { | |
| 276 | - // process post request | |
| 277 | - if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) { | |
| 278 | - $type = filter_input( INPUT_POST, 'type' ); | |
| 279 | - if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) { | |
| 280 | - // save new chart type | |
| 281 | - update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, $type ); | |
| 282 | - | |
| 283 | - // if the chart has default data, update it with appropriate default data for new type | |
| 284 | - if ( filter_var( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, true ), FILTER_VALIDATE_BOOLEAN ) ) { | |
| 285 | - $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $type . '.csv' ); | |
| 286 | - $source->fetch(); | |
| 287 | - | |
| 288 | - $this->_chart->post_content = $source->getData(); | |
| 289 | - wp_update_post( $this->_chart->to_array() ); | |
| 290 | - | |
| 291 | - update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); | |
| 292 | - } | |
| 293 | - | |
| 294 | - // redirect to next tab | |
| 295 | - // changed by Ash/Upwork | |
| 296 | - wp_redirect( add_query_arg( 'tab', 'settings' ) ); | |
| 297 | - return; | |
| 298 | - } | |
| 299 | - } | |
| 300 | - | |
| 301 | - $render = new Visualizer_Render_Page_Types(); | |
| 302 | - $render->type = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 303 | - $render->types = Visualizer_Module_Admin::_getChartTypesLocalized(); | |
| 304 | - $render->chart = $this->_chart; | |
| 305 | - | |
| 306 | - wp_enqueue_style( 'visualizer-frame' ); | |
| 307 | - wp_enqueue_script( 'visualizer-frame' ); | |
| 308 | - | |
| 309 | - wp_iframe( array( $render, 'render' ) ); | |
| 310 | - } | |
| 311 | - | |
| 312 | - /** | |
| 313 | - * Handles chart data page. | |
| 314 | - * | |
| 315 | - * @since 1.0.0 | |
| 316 | - * | |
| 317 | - * @access private | |
| 318 | - */ | |
| 319 | - private function _handleDataPage() { | |
| 320 | - $data = $this->_getChartArray(); | |
| 321 | - | |
| 322 | - $render = new Visualizer_Render_Page_Data(); | |
| 323 | - $render->chart = $this->_chart; | |
| 324 | - $render->type = $data['type']; | |
| 325 | - | |
| 326 | - unset( $data['settings']['width'], $data['settings']['height'] ); | |
| 327 | - | |
| 328 | - wp_enqueue_style( 'visualizer-frame' ); | |
| 329 | - wp_enqueue_script( 'visualizer-render' ); | |
| 330 | - wp_localize_script( 'visualizer-render', 'visualizer', array( | |
| 331 | - 'l10n' => array( | |
| 332 | - 'remotecsv_prompt' => esc_html__( 'Please, enter the URL of CSV file:', 'visualizer' ), | |
| 333 | - 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 334 | - ), | |
| 335 | - 'charts' => array( | |
| 336 | - 'canvas' => $data, | |
| 337 | - ), | |
| 338 | - ) ); | |
| 339 | - | |
| 340 | - // Added by Ash/Upwork | |
| 341 | - if ( defined( 'Visualizer_Pro' ) ) { | |
| 342 | - global $Visualizer_Pro; | |
| 343 | - $Visualizer_Pro->_enqueueScriptsAndStyles( $data ); | |
| 344 | - } | |
| 345 | - // Added by Ash/Upwork | |
| 346 | - $this->_addAction( 'admin_head', 'renderFlattrScript' ); | |
| 347 | - | |
| 348 | - wp_iframe( array( $render, 'render' ) ); | |
| 349 | - } | |
| 350 | - | |
| 351 | - /** | |
| 352 | 258 | * Handle data and settings page |
| 353 | 259 | */ |
| 354 | 260 | private function _handleDataAndSettingsPage() { |
| 355 | - if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) { | |
| 261 | + if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) { | |
| 356 | 262 | if ( $this->_chart->post_status == 'auto-draft' ) { |
| 357 | 263 | $this->_chart->post_status = 'publish'; |
| 358 | 264 | wp_update_post( $this->_chart->to_array() ); |
| 359 | 265 | } |
| 360 | - | |
| 361 | 266 | update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST ); |
| 362 | - | |
| 363 | - $render = new Visualizer_Render_Page_Send(); | |
| 267 | + $render = new Visualizer_Render_Page_Send(); | |
| 364 | 268 | $render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID ); |
| 269 | + wp_iframe( array( $render, 'render' ) ); | |
| 365 | 270 | |
| 366 | - wp_iframe( array( $render, 'render' ) ); | |
| 367 | 271 | return; |
| 368 | 272 | } |
| 369 | - | |
| 370 | - $data = $this->_getChartArray(); | |
| 371 | - | |
| 372 | - $sidebar = ''; | |
| 273 | + $data = $this->_getChartArray(); | |
| 274 | + $sidebar = ''; | |
| 373 | 275 | $sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst( $data['type'] ); |
| 374 | 276 | if ( class_exists( $sidebar_class, true ) ) { |
| 375 | - $sidebar = new $sidebar_class( $data['settings'] ); | |
| 277 | + $sidebar = new $sidebar_class( $data['settings'] ); | |
| 376 | 278 | $sidebar->__series = $data['series']; |
| 377 | - $sidebar->__data = $data['data']; | |
| 279 | + $sidebar->__data = $data['data']; | |
| 378 | 280 | } else { |
| 379 | - $sidebar = apply_filters( 'visualizer_pro_chart_type_sidebar', '', $data ); | |
| 281 | + $sidebar = apply_filters( 'visualizer_pro_chart_type_sidebar', '', $data ); | |
| 380 | 282 | if ( $sidebar != '' ) { |
| 381 | 283 | $sidebar->__series = $data['series']; |
| 382 | - $sidebar->__data = $data['data']; | |
| 284 | + $sidebar->__data = $data['data']; | |
| 383 | 285 | } |
| 384 | 286 | } |
| 385 | - | |
| 386 | 287 | unset( $data['settings']['width'], $data['settings']['height'] ); |
| 387 | - | |
| 388 | 288 | wp_enqueue_style( 'visualizer-frame' ); |
| 389 | 289 | wp_enqueue_style( 'wp-color-picker' ); |
| 390 | 290 | wp_enqueue_style( 'visualizer-frame' ); |
| 391 | - | |
| 392 | 291 | wp_enqueue_script( 'visualizer-preview' ); |
| 393 | 292 | wp_enqueue_script( 'visualizer-render' ); |
| 394 | 293 | wp_localize_script( 'visualizer-render', 'visualizer', array( |
| 395 | 294 | 'l10n' => array( |
| 396 | - 'remotecsv_prompt' => esc_html__( 'Please, enter the URL of CSV file:', 'visualizer' ), | |
| 397 | - 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 295 | + 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 398 | 296 | ), |
| 399 | 297 | 'charts' => array( |
| 400 | 298 | 'canvas' => $data, |
| 401 | 299 | ), |
| 402 | 300 | ) ); |
| 403 | - | |
| 404 | - $render = new Visualizer_Render_Page_Data(); | |
| 405 | - $render->chart = $this->_chart; | |
| 406 | - $render->type = $data['type']; | |
| 407 | - | |
| 301 | + $render = new Visualizer_Render_Page_Data(); | |
| 302 | + $render->chart = $this->_chart; | |
| 303 | + $render->type = $data['type']; | |
| 408 | 304 | $render->sidebar = $sidebar; |
| 409 | 305 | if ( filter_input( INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN ) ) { |
| 410 | 306 | $render->button = filter_input( INPUT_GET, 'action' ) == Visualizer_Plugin::ACTION_EDIT_CHART |
| 411 | 307 | ? esc_html__( 'Save Chart', 'visualizer' ) |
| @@ -412,19 +308,54 @@ | ||
| 412 | 308 | : esc_html__( 'Create Chart', 'visualizer' ); |
| 413 | 309 | } else { |
| 414 | 310 | $render->button = esc_attr__( 'Insert Chart', 'visualizer' ); |
| 415 | 311 | } |
| 416 | - | |
| 417 | - if ( defined( 'Visualizer_Pro' ) ) { | |
| 312 | + if ( VISUALIZER_PRO ) { | |
| 418 | 313 | global $Visualizer_Pro; |
| 419 | 314 | $Visualizer_Pro->_enqueueScriptsAndStyles( $data ); |
| 420 | 315 | } |
| 316 | + $this->_addAction( 'admin_head', 'renderFlattrScript' ); | |
| 317 | + wp_iframe( array( $render, 'render' ) ); | |
| 318 | + } | |
| 421 | 319 | |
| 422 | - $this->_addAction( 'admin_head', 'renderFlattrScript' ); | |
| 320 | + /** | |
| 321 | + * Handles chart type selection page. | |
| 322 | + * | |
| 323 | + * @since 1.0.0 | |
| 324 | + * | |
| 325 | + * @access private | |
| 326 | + */ | |
| 327 | + private function _handleTypesPage() { | |
| 328 | + // process post request | |
| 329 | + if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) { | |
| 330 | + $type = filter_input( INPUT_POST, 'type' ); | |
| 331 | + if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) { | |
| 332 | + // save new chart type | |
| 333 | + update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, $type ); | |
| 334 | + // if the chart has default data, update it with appropriate default data for new type | |
| 335 | + if ( filter_var( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, true ), FILTER_VALIDATE_BOOLEAN ) ) { | |
| 336 | + $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $type . '.csv' ); | |
| 337 | + $source->fetch(); | |
| 338 | + $this->_chart->post_content = $source->getData(); | |
| 339 | + wp_update_post( $this->_chart->to_array() ); | |
| 340 | + update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); | |
| 341 | + } | |
| 342 | + // redirect to next tab | |
| 343 | + // changed by Ash/Upwork | |
| 344 | + wp_redirect( add_query_arg( 'tab', 'settings' ) ); | |
| 423 | 345 | |
| 346 | + return; | |
| 347 | + } | |
| 348 | + } | |
| 349 | + $render = new Visualizer_Render_Page_Types(); | |
| 350 | + $render->type = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 351 | + $render->types = Visualizer_Module_Admin::_getChartTypesLocalized(); | |
| 352 | + $render->chart = $this->_chart; | |
| 353 | + wp_enqueue_style( 'visualizer-frame' ); | |
| 354 | + wp_enqueue_script( 'visualizer-frame' ); | |
| 424 | 355 | wp_iframe( array( $render, 'render' ) ); |
| 425 | 356 | } |
| 426 | - // changed by Ash/Upwork | |
| 357 | + | |
| 427 | 358 | /** |
| 428 | 359 | * Renders flattr script in the iframe <head> |
| 429 | 360 | * |
| 430 | 361 | * @since 1.4.2 |
| @@ -434,9 +365,9 @@ | ||
| 434 | 365 | */ |
| 435 | 366 | public function renderFlattrScript() { |
| 436 | 367 | echo ''; |
| 437 | 368 | } |
| 438 | - | |
| 369 | + // changed by Ash/Upwork | |
| 439 | 370 | /** |
| 440 | 371 | * Parses uploaded CSV file and saves new data for the chart. |
| 441 | 372 | * |
| 442 | 373 | * @since 1.0.0 |
| @@ -444,54 +375,53 @@ | ||
| 444 | 375 | * @access public |
| 445 | 376 | */ |
| 446 | 377 | public function uploadData() { |
| 447 | 378 | // validate nonce |
| 448 | - if ( ! wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) { | |
| 379 | + // do not use filter_input as it does not work for phpunit test cases, use filter_var instead | |
| 380 | + if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'] ) ) { | |
| 449 | 381 | status_header( 403 ); |
| 450 | 382 | exit; |
| 451 | 383 | } |
| 452 | - | |
| 453 | 384 | // check chart, if chart exists |
| 454 | - $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT ); | |
| 385 | + $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : ''; | |
| 455 | 386 | if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) { |
| 456 | 387 | status_header( 400 ); |
| 457 | 388 | exit; |
| 458 | 389 | } |
| 459 | - | |
| 390 | + if ( ! isset( $_POST['vz-import-time'] ) ) { | |
| 391 | + apply_filters( 'visualizer_pro_remove_schedule', $chart_id ); | |
| 392 | + } | |
| 460 | 393 | $source = null; |
| 461 | 394 | $render = new Visualizer_Render_Page_Update(); |
| 462 | - if ( filter_input( INPUT_POST, 'remote_data', FILTER_VALIDATE_URL ) ) { | |
| 395 | + if ( isset( $_POST['remote_data'] ) && filter_var( $_POST['remote_data'], FILTER_VALIDATE_URL ) ) { | |
| 463 | 396 | $source = new Visualizer_Source_Csv_Remote( $_POST['remote_data'] ); |
| 397 | + if ( isset( $_POST['vz-import-time'] ) ) { | |
| 398 | + apply_filters( 'visualizer_pro_chart_schedule', $chart_id, $_POST['remote_data'], $_POST['vz-import-time'] ); | |
| 399 | + } | |
| 464 | 400 | } elseif ( isset( $_FILES['local_data'] ) && $_FILES['local_data']['error'] == 0 ) { |
| 465 | 401 | $source = new Visualizer_Source_Csv( $_FILES['local_data']['tmp_name'] ); |
| 466 | - | |
| 467 | 402 | // Added by Ash/Upwork |
| 468 | - } elseif ( defined( 'Visualizer_Pro' ) && isset( $_POST['chart_data'] ) && strlen( $_POST['chart_data'] ) > 0 ) { | |
| 469 | - global $Visualizer_Pro; | |
| 470 | - $source = $Visualizer_Pro->_handleChartData( $_POST['chart_data'] ); | |
| 403 | + } elseif ( isset( $_POST['chart_data'] ) && strlen( $_POST['chart_data'] ) > 0 ) { | |
| 404 | + $source = apply_filters( 'visualizer_pro_handle_chart_data', $_POST['chart_data'], '' ); | |
| 471 | 405 | // Added by Ash/Upwork |
| 472 | 406 | } else { |
| 473 | 407 | $render->message = esc_html__( 'CSV file with chart data was not uploaded. Please, try again.', 'visualizer' ); |
| 474 | 408 | } |
| 475 | - | |
| 476 | 409 | if ( $source ) { |
| 477 | 410 | if ( $source->fetch() ) { |
| 478 | 411 | $chart->post_content = $source->getData(); |
| 479 | 412 | wp_update_post( $chart->to_array() ); |
| 480 | - | |
| 481 | 413 | update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() ); |
| 482 | 414 | update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() ); |
| 483 | 415 | update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 ); |
| 484 | - | |
| 485 | - $render->data = json_encode( $source->getRawData() ); | |
| 416 | + $render->data = json_encode( $source->getRawData() ); | |
| 486 | 417 | $render->series = json_encode( $source->getSeries() ); |
| 487 | 418 | } else { |
| 488 | 419 | $render->message = esc_html__( 'CSV file is broken or invalid. Please, try again.', 'visualizer' ); |
| 489 | 420 | } |
| 490 | 421 | } |
| 491 | - | |
| 492 | 422 | $render->render(); |
| 493 | - exit; | |
| 423 | + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 494 | 424 | } |
| 495 | 425 | |
| 496 | 426 | /** |
| 497 | 427 | * Clones the chart. |
| @@ -501,18 +431,21 @@ | ||
| 501 | 431 | * @access public |
| 502 | 432 | */ |
| 503 | 433 | public function cloneChart() { |
| 504 | 434 | $chart_id = $success = false; |
| 505 | - $nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART ); | |
| 506 | - $capable = current_user_can( 'edit_posts' ); | |
| 435 | + $nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART ); | |
| 436 | + $capable = current_user_can( 'edit_posts' ); | |
| 507 | 437 | if ( $nonce && $capable ) { |
| 508 | - $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) ); | |
| 438 | + $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( | |
| 439 | + 'options' => array( | |
| 440 | + 'min_range' => 1, | |
| 441 | + ), | |
| 442 | + ) ); | |
| 509 | 443 | if ( $chart_id ) { |
| 510 | - $chart = get_post( $chart_id ); | |
| 444 | + $chart = get_post( $chart_id ); | |
| 511 | 445 | $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER; |
| 512 | 446 | } |
| 513 | 447 | } |
| 514 | - | |
| 515 | 448 | $redirect = wp_get_referer(); |
| 516 | 449 | if ( $success ) { |
| 517 | 450 | $new_chart_id = wp_insert_post( array( |
| 518 | 451 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| @@ -520,9 +453,8 @@ | ||
| 520 | 453 | 'post_author' => get_current_user_id(), |
| 521 | 454 | 'post_status' => $chart->post_status, |
| 522 | 455 | 'post_content' => $chart->post_content, |
| 523 | 456 | ) ); |
| 524 | - | |
| 525 | 457 | if ( $new_chart_id && ! is_wp_error( $new_chart_id ) ) { |
| 526 | 458 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_CHART_TYPE, get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true ) ); |
| 527 | 459 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) ); |
| 528 | 460 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) ); |
| @@ -527,9 +459,8 @@ | ||
| 527 | 459 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) ); |
| 528 | 460 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) ); |
| 529 | 461 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SERIES, get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ) ); |
| 530 | 462 | add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SETTINGS, get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ) ); |
| 531 | - | |
| 532 | 463 | $redirect = add_query_arg( array( |
| 533 | 464 | 'page' => 'visualizer', |
| 534 | 465 | 'type' => filter_input( INPUT_GET, 'type' ), |
| 535 | 466 | ), admin_url( 'upload.php' ) ); |
| @@ -534,9 +465,8 @@ | ||
| 534 | 465 | 'type' => filter_input( INPUT_GET, 'type' ), |
| 535 | 466 | ), admin_url( 'upload.php' ) ); |
| 536 | 467 | } |
| 537 | 468 | } |
| 538 | - | |
| 539 | 469 | wp_redirect( $redirect ); |
| 540 | 470 | exit; |
| 541 | 471 | } |
| 542 | 472 | |
| @@ -548,49 +478,50 @@ | ||
| 548 | 478 | * @access public |
| 549 | 479 | */ |
| 550 | 480 | public function exportData() { |
| 551 | 481 | check_ajax_referer( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION, 'security' ); |
| 552 | - | |
| 553 | 482 | $chart_id = $success = false; |
| 554 | - $capable = current_user_can( 'edit_posts' ); | |
| 483 | + $capable = current_user_can( 'edit_posts' ); | |
| 555 | 484 | if ( $capable ) { |
| 556 | - $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) ); | |
| 485 | + $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT, array( | |
| 486 | + 'options' => array( | |
| 487 | + 'min_range' => 1, | |
| 488 | + ), | |
| 489 | + ) ) : ''; | |
| 557 | 490 | if ( $chart_id ) { |
| 558 | - $chart = get_post( $chart_id ); | |
| 491 | + $chart = get_post( $chart_id ); | |
| 559 | 492 | $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER; |
| 560 | 493 | } |
| 561 | 494 | } |
| 562 | - | |
| 563 | 495 | if ( $success ) { |
| 564 | - $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ); | |
| 565 | - $filename = $settings['title']; | |
| 496 | + $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ); | |
| 497 | + $filename = isset( $settings['title'] ) ? $settings['title'] : ''; | |
| 566 | 498 | if ( empty( $filename ) ) { |
| 567 | - $filename = 'export.csv'; | |
| 499 | + $filename = 'export.csv'; | |
| 568 | 500 | } else { |
| 569 | - $filename .= '.csv'; | |
| 501 | + $filename .= '.csv'; | |
| 570 | 502 | } |
| 571 | - $rows = array(); | |
| 572 | - $series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ); | |
| 573 | - $data = unserialize( $chart->post_content ); | |
| 503 | + $rows = array(); | |
| 504 | + $series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ); | |
| 505 | + $data = unserialize( $chart->post_content ); | |
| 574 | 506 | if ( ! empty( $series ) ) { |
| 575 | - $row = array(); | |
| 507 | + $row = array(); | |
| 576 | 508 | foreach ( $series as $array ) { |
| 577 | - $row[] = $array['label']; | |
| 509 | + $row[] = $array['label']; | |
| 578 | 510 | } |
| 579 | - $rows[] = $row; | |
| 580 | - | |
| 511 | + $rows[] = $row; | |
| 581 | 512 | $row = array(); |
| 582 | 513 | foreach ( $series as $array ) { |
| 583 | - $row[] = $array['type']; | |
| 514 | + $row[] = $array['type']; | |
| 584 | 515 | } |
| 585 | - $rows[] = $row; | |
| 516 | + $rows[] = $row; | |
| 586 | 517 | } |
| 587 | - | |
| 588 | 518 | if ( ! empty( $data ) ) { |
| 589 | 519 | foreach ( $data as $array ) { |
| 590 | 520 | // ignore strings |
| 591 | - if ( ! is_array( $array ) ) { continue; } | |
| 592 | - | |
| 521 | + if ( ! is_array( $array ) ) { | |
| 522 | + continue; | |
| 523 | + } | |
| 593 | 524 | // if this is an array of arrays... |
| 594 | 525 | if ( is_array( $array[0] ) ) { |
| 595 | 526 | foreach ( $array as $arr ) { |
| 596 | 527 | $rows[] = $arr; |
| @@ -600,27 +531,58 @@ | ||
| 600 | 531 | $rows[] = $array; |
| 601 | 532 | } |
| 602 | 533 | } |
| 603 | 534 | } |
| 604 | - | |
| 605 | - $fp = tmpfile(); | |
| 535 | + $fp = tmpfile(); | |
| 606 | 536 | foreach ( $rows as $row ) { |
| 607 | 537 | fputcsv( $fp, $row ); |
| 608 | 538 | } |
| 609 | 539 | rewind( $fp ); |
| 610 | - | |
| 611 | - $csv = ''; | |
| 612 | - while ( ($array = fgetcsv( $fp )) !== false ) { | |
| 613 | - if ( strlen( $csv ) > 0 ) { $csv .= PHP_EOL; } | |
| 614 | - $csv .= implode( ',', $array ); | |
| 540 | + $csv = ''; | |
| 541 | + while ( ( $array = fgetcsv( $fp ) ) !== false ) { | |
| 542 | + if ( strlen( $csv ) > 0 ) { | |
| 543 | + $csv .= PHP_EOL; | |
| 544 | + } | |
| 545 | + $csv .= implode( ',', $array ); | |
| 615 | 546 | } |
| 616 | 547 | fclose( $fp ); |
| 617 | - | |
| 618 | - echo wp_send_json_success(array( | |
| 619 | - 'csv' => $csv, | |
| 620 | - 'name' => $filename, | |
| 621 | - )); | |
| 548 | + echo wp_send_json_success( array( | |
| 549 | + 'csv' => $csv, | |
| 550 | + 'name' => $filename, | |
| 551 | + ) ); | |
| 622 | 552 | }// End if(). |
| 553 | + defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit(); | |
| 554 | + } | |
| 623 | 555 | |
| 624 | - exit; | |
| 556 | + /** | |
| 557 | + * Handles chart data page. | |
| 558 | + * | |
| 559 | + * @since 1.0.0 | |
| 560 | + * | |
| 561 | + * @access private | |
| 562 | + */ | |
| 563 | + private function _handleDataPage() { | |
| 564 | + $data = $this->_getChartArray(); | |
| 565 | + $render = new Visualizer_Render_Page_Data(); | |
| 566 | + $render->chart = $this->_chart; | |
| 567 | + $render->type = $data['type']; | |
| 568 | + unset( $data['settings']['width'], $data['settings']['height'] ); | |
| 569 | + wp_enqueue_style( 'visualizer-frame' ); | |
| 570 | + wp_enqueue_script( 'visualizer-render' ); | |
| 571 | + wp_localize_script( 'visualizer-render', 'visualizer', array( | |
| 572 | + 'l10n' => array( | |
| 573 | + 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ), | |
| 574 | + ), | |
| 575 | + 'charts' => array( | |
| 576 | + 'canvas' => $data, | |
| 577 | + ), | |
| 578 | + ) ); | |
| 579 | + // Added by Ash/Upwork | |
| 580 | + if ( VISUALIZER_PRO ) { | |
| 581 | + global $Visualizer_Pro; | |
| 582 | + $Visualizer_Pro->_enqueueScriptsAndStyles( $data ); | |
| 583 | + } | |
| 584 | + // Added by Ash/Upwork | |
| 585 | + $this->_addAction( 'admin_head', 'renderFlattrScript' ); | |
| 586 | + wp_iframe( array( $render, 'render' ) ); | |
| 625 | 587 | } |
| 626 | 588 | } |