PluginProbe
Chartify – WordPress Chart Plugin / 3.8.1
Chartify – WordPress Chart Plugin v3.8.1
3.8.1 3.8.0 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 trunk 1.0.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 All 84 releases
← All changes | pb_templates/chart-builder-elementor.php +21 -15 3.1.1 → 3.8.1 View file →
@@ -12,9 +12,9 @@
12 12 // Icon name from the Elementor font file, as per http://dtbaker.net/web-development/creating-your-own-custom-elementor-widgets/
13 13 return 'chart-elementor-widget-logo';
14 14 }
15 15 public function get_categories() {
16 - return array( 'general', 'wordpress' );
16 + return array( 'wordpress' );
17 17 }
18 18 protected function register_controls() {
19 19 $this->start_controls_section(
20 20 'section_chart_builder',
@@ -68,14 +68,14 @@
68 68 </style>';
69 69 }
70 70
71 71 $settings = $this->get_settings_for_display();
72 - echo ("<div class='chart-elementor-container'>
73 - [ays_chart id={$settings['chart_selector']}]
74 - </div>");
72 + echo '<div class="chart-elementor-container">';
73 + echo esc_html( "[ays_chart id=" . $settings['chart_selector'] . "]" );
74 + echo '</div>';
75 75 if ( ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
76 76 echo ("<p style='margin:4px 0 0 3px;font-size:12px;font-style:italic;'>
77 - " . __( 'Note: The chart will be visible on the front end of your website.', "chart-builder" ) . "
77 + " . esc_html__( 'Note: The chart will be visible on the front end of your website.', "chart-builder" ) . "
78 78 </p>");
79 79 }
80 80 }
81 81
@@ -82,13 +82,17 @@
82 82 public function get_active_charts(){
83 83 global $wpdb;
84 84 $current_user = get_current_user_id();
85 85 $charts_table = $wpdb->prefix . CHART_BUILDER_DB_PREFIX . 'charts';
86 - $sql = "SELECT id,title FROM {$charts_table} WHERE `status`='published'";
87 - if( ! current_user_can( 'manage_options' ) ){
88 - $sql .= " AND author_id = ". absint( $current_user ) ." ";
86 + $sql = "SELECT id, title FROM {$charts_table} WHERE `status` = %s";
87 + $params = ['published'];
88 + if (!current_user_can('manage_options')) {
89 + $sql .= " AND author_id = %d";
90 + $params[] = absint($current_user);
89 91 }
90 - $results = $wpdb->get_results( $sql, ARRAY_A );
92 + $sql .= " ORDER BY id DESC ";
93 + // phpcs:ignore
94 + $results = $wpdb->get_results($wpdb->prepare($sql, ...$params), ARRAY_A);
91 95 $options = array();
92 96 foreach ( $results as $result ){
93 97 $options[$result['id']] = $result['title'];
94 98 }
@@ -98,15 +102,17 @@
98 102 public function get_default_chart(){
99 103 global $wpdb;
100 104 $current_user = get_current_user_id();
101 105 $charts_table = $wpdb->prefix . CHART_BUILDER_DB_PREFIX . 'charts';
102 - $sql = "SELECT id FROM {$charts_table} WHERE `status`='published'";
103 - if( ! current_user_can( 'manage_options' ) ){
104 - $sql .= " AND author_id = ". absint( $current_user ) ." ";
106 + $sql = "SELECT id FROM {$charts_table} WHERE `status` = %s";
107 + $params = ['published'];
108 + if (!current_user_can('manage_options')) {
109 + $sql .= " AND author_id = %d";
110 + $params[] = absint($current_user);
105 111 }
106 - $sql .= " LIMIT 1;";
107 - $id = $wpdb->get_var( $sql );
108 -
112 + $sql .= " ORDER BY id DESC LIMIT 1";
113 + // phpcs:ignore
114 + $id = $wpdb->get_var($wpdb->prepare($sql, ...$params));
109 115 return intval($id);
110 116 }
111 117
112 118 protected function content_template() {}