| @@ -215,9 +215,12 @@ | ||
| 215 | 215 | * @access private |
| 216 | 216 | */ |
| 217 | 217 | private function _renderLibrary() { |
| 218 | 218 | // Added by Ash/Upwork |
| 219 | - $filterBy = ! empty( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 219 | + $filterBy = null; | |
| 220 | + if ( isset( $_GET['s'] ) && strlen( $_GET['s'] ) > 0 ) { | |
| 221 | + $filterBy = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING ); | |
| 222 | + } | |
| 220 | 223 | // Added by Ash/Upwork |
| 221 | 224 | echo $this->custom_css; |
| 222 | 225 | echo '<div id="visualizer-types" class="visualizer-clearfix">'; |
| 223 | 226 | echo '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="list-icon" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8C0 12.42 3.58 16 8 16C12.42 16 16 12.42 16 8C16 3.58 12.42 0 8 0ZM7.385 12.66H6.045L2.805 8.12L4.146 6.87L6.715 9.27L11.856 3.339L13.196 4.279L7.385 12.66Z"/></symbol></svg>'; |
| @@ -229,22 +232,13 @@ | ||
| 229 | 232 | $count = 0; |
| 230 | 233 | foreach ( $this->charts as $placeholder_id => $chart ) { |
| 231 | 234 | // show the sidebar after the first 3 charts. |
| 232 | 235 | $count++; |
| 233 | - $enable_controls = false; | |
| 234 | - $settings = isset( $chart['settings'] ) ? $chart['settings'] : array(); | |
| 235 | - if ( ! empty( $settings['controls']['controlType'] ) ) { | |
| 236 | - $column_index = $settings['controls']['filterColumnIndex']; | |
| 237 | - $column_label = $settings['controls']['filterColumnLabel']; | |
| 238 | - if ( 'false' !== $column_index || 'false' !== $column_label ) { | |
| 239 | - $enable_controls = true; | |
| 240 | - } | |
| 241 | - } | |
| 242 | 236 | if ( 3 === $count ) { |
| 243 | 237 | $this->_renderSidebar(); |
| 244 | - $this->_renderChartBox( $placeholder_id, $chart['id'], $enable_controls ); | |
| 238 | + $this->_renderChartBox( $placeholder_id, $chart['id'] ); | |
| 245 | 239 | } else { |
| 246 | - $this->_renderChartBox( $placeholder_id, $chart['id'], $enable_controls ); | |
| 240 | + $this->_renderChartBox( $placeholder_id, $chart['id'] ); | |
| 247 | 241 | } |
| 248 | 242 | } |
| 249 | 243 | // show the sidebar if there are less than 3 charts. |
| 250 | 244 | if ( $count < 3 ) { |
| @@ -257,17 +251,14 @@ | ||
| 257 | 251 | echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">'; |
| 258 | 252 | echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', 'visualizer' ), '<p><h2><a href="javascript:;" class="add-new-h2 add-new-chart">', esc_html__( 'Add New', 'visualizer' ), '</a></h2></p></div>'; |
| 259 | 253 | echo '</div>'; |
| 260 | 254 | echo '<div class="visualizer-chart-footer visualizer-clearfix">'; |
| 261 | - echo '<div class="visualizer-action-group visualizer-nochart">'; | |
| 262 | - echo '<span class="visualizer-chart-action visualizer-nochart-delete"><span class="dashicons dashicons-trash"></span></span>'; | |
| 263 | - echo '<span class="visualizer-chart-action visualizer-nochart-shortcode"><span class="dashicons dashicons-shortcode"></span></span>'; | |
| 264 | - echo '<span class="visualizer-chart-action visualizer-nochart-image"><span class="dashicons dashicons-format-image"></span></span>'; | |
| 265 | - echo '<span class="visualizer-chart-action visualizer-nochart-export"><span class="dashicons dashicons-download"></span></span>'; | |
| 266 | - echo '<span class="visualizer-chart-action visualizer-nochart-clone"><span class="dashicons dashicons-admin-page"></span></span>'; | |
| 267 | - echo '<span class="visualizer-chart-action visualizer-nochart-edit"><span class="dashicons dashicons-admin-generic"></span></span>'; | |
| 255 | + echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>'; | |
| 256 | + echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>'; | |
| 257 | + echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>'; | |
| 258 | + echo '<span class="visualizer-chart-action visualizer-nochart-export"></span>'; | |
| 259 | + echo '<span class="visualizer-chart-action visualizer-nochart-shortcode"></span>'; | |
| 268 | 260 | echo '</div>'; |
| 269 | - echo '</div>'; | |
| 270 | 261 | echo '</div></div>'; |
| 271 | 262 | $this->_renderSidebar(); |
| 272 | 263 | echo '</div>'; |
| 273 | 264 | } |
| @@ -290,9 +281,9 @@ | ||
| 290 | 281 | * |
| 291 | 282 | * @param string $placeholder_id The placeholder's id for the chart. |
| 292 | 283 | * @param int $chart_id The id of the chart. |
| 293 | 284 | */ |
| 294 | - private function _renderChartBox( $placeholder_id, $chart_id, $with_filter = false ) { | |
| 285 | + private function _renderChartBox( $placeholder_id, $chart_id ) { | |
| 295 | 286 | $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS ); |
| 296 | 287 | $title = '#' . $chart_id; |
| 297 | 288 | if ( ! empty( $settings[0]['title'] ) ) { |
| 298 | 289 | $title = $settings[0]['title']; |
| @@ -344,30 +335,21 @@ | ||
| 344 | 335 | $chart_status['title'] = __( 'Click to view the error', 'visualizer' ); |
| 345 | 336 | } |
| 346 | 337 | $shortcode = sprintf( '[visualizer id="%s" lazy="no" class=""]', $chart_id ); |
| 347 | 338 | echo '<div class="items"><div class="visualizer-chart"><div class="visualizer-chart-title">', esc_html( $title ), '</div>'; |
| 348 | - if ( Visualizer_Module::is_pro() && $with_filter ) { | |
| 349 | - echo '<div id="chart_wrapper_' . $placeholder_id . '">'; | |
| 350 | - echo '<div id="control_wrapper_' . $placeholder_id . '" class="vz-library-chart-filter"></div>'; | |
| 351 | - } | |
| 352 | 339 | echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">'; |
| 353 | 340 | echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">'; |
| 354 | 341 | echo '</div>'; |
| 355 | - if ( Visualizer_Module::is_pro() && $with_filter ) { | |
| 356 | - echo '</div>'; | |
| 357 | - } | |
| 358 | 342 | echo '<div class="visualizer-chart-footer visualizer-clearfix">'; |
| 359 | - echo '<div class="visualizer-action-group">'; | |
| 360 | - echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" onclick="return showNotice.warn();"><span class="dashicons dashicons-trash"></span><span class="tooltip-text">' . esc_attr__( 'Delete', 'visualizer' ) . '</span></a>'; | |
| 361 | - echo '<a class="visualizer-chart-action visualizer-chart-shortcode" href="javascript:;" data-clipboard-text="', esc_attr( $shortcode ), '"><span class="dashicons dashicons-shortcode"></span><span class="tooltip-text">' . esc_attr__( 'Copy Shortcode', 'visualizer' ) . '</span></a>'; | |
| 343 | + echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>'; | |
| 344 | + echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>'; | |
| 345 | + echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>'; | |
| 346 | + echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" title="', esc_attr__( 'Export', 'visualizer' ), '" data-chart="', $export_link, '"></a>'; | |
| 362 | 347 | if ( $this->can_chart_have_action( 'image', $chart_id ) ) { |
| 363 | - echo '<a class="visualizer-chart-action visualizer-chart-image" href="javascript:;" data-chart="visualizer-', $chart_id, '" data-chart-title="', $title, '"><span class="dashicons dashicons-format-image"></span><span class="tooltip-text">' . esc_attr__( 'Download PNG', 'visualizer' ) . '</span></a>'; | |
| 348 | + echo '<a class="visualizer-chart-action visualizer-chart-image" href="javascript:;" title="', esc_attr__( 'Download as image', 'visualizer' ), '" data-chart="visualizer-', $chart_id, '" data-chart-title="', $title, '"></a>'; | |
| 364 | 349 | } |
| 365 | - echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" data-chart="', $export_link, '"><span class="dashicons dashicons-download"></span><span class="tooltip-text">' . esc_attr__( 'Export CSV', 'visualizer' ) . '</span></a>'; | |
| 366 | - echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '"><span class="dashicons dashicons-admin-page"></span><span class="tooltip-text">' . esc_attr__( 'Duplicate', 'visualizer' ) . '</span></a>'; | |
| 367 | - echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" data-chart="', $chart_id, '"><span class="dashicons dashicons-admin-generic"></span><span class="tooltip-text">' . esc_attr__( 'Edit', 'visualizer' ) . '</span></a>'; | |
| 368 | - echo '</div>'; | |
| 369 | - do_action( 'visualizer_chart_languages', $chart_id ); | |
| 350 | + echo '<a class="visualizer-chart-action visualizer-chart-shortcode" href="javascript:;" title="', esc_attr__( 'Click to copy shortcode', 'visualizer' ), '" data-clipboard-text="', esc_attr( $shortcode ), '"></a>'; | |
| 351 | + echo '<span> </span>'; | |
| 370 | 352 | echo '<hr><div class="visualizer-chart-status"><span title="' . __( 'Chart ID', 'visualizer' ) . '">(' . $chart_id . '):</span> <span class="visualizer-date" title="' . __( 'Last Updated', 'visualizer' ) . '">' . $chart_status['date'] . '</span><span class="visualizer-error"><i class="dashicons ' . $chart_status['icon'] . '" data-viz-error="' . esc_attr( str_replace( '"', "'", $chart_status['error'] ) ) . '" title="' . esc_attr( $chart_status['title'] ) . '"></i></span></div>'; |
| 371 | 353 | echo '</div>'; |
| 372 | 354 | echo '</div></div>'; |
| 373 | 355 | } |
| @@ -397,12 +379,10 @@ | ||
| 397 | 379 | echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Use database query to create charts', 'visualizer' ) . '</li>'; |
| 398 | 380 | echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Create charts from WordPress tables', 'visualizer' ) . '</li>'; |
| 399 | 381 | echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Frontend editor', 'visualizer' ) . '</li>'; |
| 400 | 382 | echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Private charts', 'visualizer' ) . '</li>'; |
| 401 | - echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'WPML support for translating charts', 'visualizer' ) . '</li>'; | |
| 402 | - echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Integration with Woocommerce Data endpoints', 'visualizer' ) . '</li>'; | |
| 403 | 383 | echo '<li><svg class="icon list-icon"><use xlink:href="#list-icon"></use></svg>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li></ul>'; |
| 404 | - echo '<p><a href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'sidebarupsell' ) . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a></p>'; | |
| 384 | + echo '<p><a href="' . str_replace( '#pricing', '#features', Visualizer_Plugin::PRO_TEASER_URL ) . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a></p>'; | |
| 405 | 385 | echo '</div>'; |
| 406 | 386 | echo '</div>'; |
| 407 | 387 | echo '</div>'; |
| 408 | 388 | echo '</div>'; |