← All changes
|
admin/partials/charts/chart-builder-charts-display.php
+87
-71
3.0.3
→
3.8.1
View file →
| @@ -1,19 +1,20 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | $items = $this->db_obj->get_items(); |
| 3 | + | |
| 3 | 4 | $all_items = CBFunctions()->get_all_charts_count(); |
| 4 | 5 | $chart_count_per_page = count($items) > 0 ? $all_items/$this->db_obj->get_pagination_count() : 0; |
| 5 | -$chart_paged = isset($_GET['paged']) && $_GET['paged'] != '' ? absint( sanitize_text_field($_GET['paged'])) : ''; | |
| 6 | +$chart_paged = isset($_GET['paged']) && $_GET['paged'] != '' ? absint( sanitize_text_field(wp_unslash($_GET['paged']))) : ''; | |
| 6 | 7 | $search = $this->db_obj->get_search_value(); |
| 7 | 8 | $chart_max_id = Chart_Builder_Admin::get_max_id('charts'); |
| 8 | 9 | $this->settings_obj = new Chart_Builder_Settings_DB_Actions($this->plugin_name); |
| 9 | 10 | $chart_title_length = $this->settings_obj->get_listtables_title_length(); |
| 10 | -$filter_by_type = (isset($_GET['filterbytype']) && $_GET['filterbytype'] != "") ? intval(sanitize_text_field($_GET['filterbytype'])) : ''; | |
| 11 | -$filter_by_source = (isset($_GET['filterbysource']) && $_GET['filterbysource'] != "") ? intval(sanitize_text_field($_GET['filterbysource'])) : ''; | |
| 12 | -$filter_by_chart_source = (isset($_GET['filterbychartsource']) && $_GET['filterbychartsource'] != "") ? intval(sanitize_text_field($_GET['filterbychartsource'])) : ''; | |
| 13 | -$filter_by_date = (isset($_GET['filterbydate']) && $_GET['filterbydate'] != "") ? sanitize_text_field($_GET['filterbydate']) : ''; | |
| 14 | -$order_by = (isset($_GET['orderby']) && $_GET['orderby'] != "") ? sanitize_text_field($_GET['orderby']) : ''; | |
| 15 | -$order = (isset($_GET['order']) && $_GET['order'] != "") ? sanitize_text_field($_GET['order']) : 'desc'; | |
| 11 | +$filter_by_type = (isset($_GET['filterbytype']) && $_GET['filterbytype'] != "") ? intval(sanitize_text_field(wp_unslash($_GET['filterbytype']))) : ''; | |
| 12 | +$filter_by_source = (isset($_GET['filterbysource']) && $_GET['filterbysource'] != "") ? intval(sanitize_text_field(wp_unslash($_GET['filterbysource']))) : ''; | |
| 13 | +$filter_by_chart_source = (isset($_GET['filterbychartsource']) && $_GET['filterbychartsource'] != "") ? intval(sanitize_text_field(wp_unslash($_GET['filterbychartsource']))) : ''; | |
| 14 | +$filter_by_date = (isset($_GET['filterbydate']) && $_GET['filterbydate'] != "") ? sanitize_text_field(wp_unslash($_GET['filterbydate'])) : ''; | |
| 15 | +$order_by = (isset($_GET['orderby']) && $_GET['orderby'] != "") ? sanitize_text_field(wp_unslash($_GET['orderby'])) : ''; | |
| 16 | +$order = (isset($_GET['order']) && $_GET['order'] != "") ? sanitize_text_field(wp_unslash($_GET['order'])) : 'desc'; | |
| 16 | 17 | $chart_types = array( |
| 17 | 18 | "Line Chart", |
| 18 | 19 | "Bar Chart", |
| 19 | 20 | "Pie Chart", |
| @@ -50,10 +51,10 @@ | ||
| 50 | 51 | 'desc' => __("Descending", "chart-builder"), |
| 51 | 52 | ); |
| 52 | 53 | $filter_by_author_data = $this->db_obj->get_searched_author_info(); |
| 53 | 54 | |
| 54 | -$plus_icon_svg = "<span class=''><img src='". CHART_BUILDER_ADMIN_URL ."/images/icons/plus=icon.svg'></span>"; | |
| 55 | -$youtube_icon_svg = "<span class=''><img src='". CHART_BUILDER_ADMIN_URL ."/images/icons/youtube-video-icon.svg'></span>"; | |
| 55 | +$plus_icon_svg = "<span class=''><img src='". esc_url(plugins_url('/images/icons/plus-icon.svg', dirname(__FILE__, 2))) ."'></span>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 56 | +$youtube_icon_svg = "<span class=''><img src='". esc_url(plugins_url('/images/icons/youtube-video-icon.svg', dirname(__FILE__, 2))) ."'></span>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 56 | 57 | |
| 57 | 58 | ?> |
| 58 | 59 | <div class="wrap ays_charts_list_table"> |
| 59 | 60 | <div class="ays-chart-heading-box"> |
| @@ -65,15 +66,17 @@ | ||
| 65 | 66 | </div> |
| 66 | 67 | </div> |
| 67 | 68 | <h1 class="wp-heading-inline"> |
| 68 | 69 | <?php |
| 69 | - echo __( esc_html( get_admin_page_title() ), "chart-builder" ); | |
| 70 | + echo esc_html( get_admin_page_title() ); | |
| 70 | 71 | ?> |
| 71 | 72 | </h1> |
| 72 | 73 | |
| 73 | 74 | <div class="ays-chart-add-new-button-box" style="margin-top: 10px;"> |
| 74 | 75 | <?php |
| 75 | - echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary chart-add-new-bttn chart-add-new-button-new-design"> %s ' . __( 'Add New', "chart-builder" ) . '</a>', esc_attr( $_REQUEST['page'] ), 'add', $plus_icon_svg); | |
| 76 | + $svg_sanitize_properties = Chart_Builder_Admin::chart_builder_svg_sanitize_allowed_properties(); | |
| 77 | + $sanitized_plus_icon_svg = wp_kses($plus_icon_svg, $svg_sanitize_properties); | |
| 78 | + echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary chart-add-new-bttn chart-add-new-button-new-design"> %s ' . esc_html__( 'Add New', "chart-builder" ) . '</a>', esc_attr(sanitize_text_field(wp_unslash($_REQUEST['page'])) ), 'add',wp_kses_post($sanitized_plus_icon_svg)); | |
| 76 | 79 | ?> |
| 77 | 80 | </div> |
| 78 | 81 | <div id="poststuff"> |
| 79 | 82 | <div id="post-body" class="metabox-holder"> |
| @@ -82,14 +85,15 @@ | ||
| 82 | 85 | <form method="post"> |
| 83 | 86 | <div class="ays-chart-table-actions-row"> |
| 84 | 87 | <div class="ays-chart-table-actions-row-section"> |
| 85 | 88 | <div class="ays-chart-delete-button"> |
| 89 | + <?php wp_nonce_field( $this->plugin_name . '-bulk-delete' ); ?> | |
| 86 | 90 | <button name="bulk_delete" id="ays-chart-bulk-delete" disabled><i class="ays_fa ays_fa_trash"></i><?php echo esc_html(__( 'Delete', "chart-builder" )); ?></button> |
| 87 | 91 | <button type="submit" name="bulk_delete_confirm" id="ays-chart-bulk-delete-confirm" style="display: none;"></button> |
| 88 | 92 | </div> |
| 89 | 93 | <div class="ays-chart-filter-section"> |
| 90 | 94 | <select name="filterbytype" id="ays-chart-filter-select"> |
| 91 | - <option value=""><?= __( "Select Type", "chart-builder" ) ?></option> | |
| 95 | + <option value=""><?php echo esc_html__( "Select Type", "chart-builder" ) ?></option> | |
| 92 | 96 | <?php |
| 93 | 97 | foreach ( $chart_types as $k => $v ): |
| 94 | 98 | $selected = ( $filter_by_type == ($k+1) ) ? 'selected' : ''; |
| 95 | 99 | ?> |
| @@ -98,33 +102,33 @@ | ||
| 98 | 102 | endforeach; |
| 99 | 103 | ?> |
| 100 | 104 | </select> |
| 101 | 105 | <select name="filterbysource" id="ays-chart-filter-source"> |
| 102 | - <option value=""><?= __( "Select Source", "chart-builder" ) ?></option> | |
| 106 | + <option value=""><?php echo esc_html__( "Select Source", "chart-builder" ) ?></option> | |
| 103 | 107 | <?php |
| 104 | 108 | foreach ( $chart_sources as $k => $v ): |
| 105 | 109 | $disabled = $k >= 2 ? 'disabled' : '' ; |
| 106 | 110 | $selected = ( $filter_by_source == ($k+1) ) ? 'selected' : ''; |
| 107 | 111 | ?> |
| 108 | - <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> | |
| 112 | + <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo esc_attr($disabled); ?>><?php echo esc_html($v); ?></option> | |
| 109 | 113 | <?php |
| 110 | 114 | endforeach; |
| 111 | 115 | ?> |
| 112 | 116 | </select> |
| 113 | 117 | <select name="filterbychartsource" id="ays-chart-filter-chart-source"> |
| 114 | - <option value=""><?= __( "Select Chart Source", "chart-builder" ) ?></option> | |
| 118 | + <option value=""><?php echo esc_html__( "Select Chart Source", "chart-builder" ) ?></option> | |
| 115 | 119 | <?php |
| 116 | 120 | foreach ( $chart_source_types as $k => $v ): |
| 117 | 121 | $disabled = $k >= 2 ? 'disabled' : '' ; |
| 118 | 122 | $selected = ( $filter_by_chart_source == ($k+1) ) ? 'selected' : ''; |
| 119 | 123 | ?> |
| 120 | - <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> | |
| 124 | + <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo esc_attr($disabled); ?>><?php echo esc_html($v); ?></option> | |
| 121 | 125 | <?php |
| 122 | 126 | endforeach; |
| 123 | 127 | ?> |
| 124 | 128 | </select> |
| 125 | 129 | <select name="filterbydate" id="ays-chart-filter-date"> |
| 126 | - <option value=""><?= __( "Select Date", "chart-builder" ) ?></option> | |
| 130 | + <option value=""><?php echo esc_html__( "Select Date", "chart-builder" ) ?></option> | |
| 127 | 131 | <?php |
| 128 | 132 | foreach ( $chart_dates as $k => $v ): |
| 129 | 133 | $selected = ( $filter_by_date == $k ) ? 'selected' : ''; |
| 130 | 134 | ?> |
| @@ -134,13 +138,13 @@ | ||
| 134 | 138 | ?> |
| 135 | 139 | </select> |
| 136 | 140 | <select name="filterbyauthor" id="ays-chart-filter-author"> |
| 137 | 141 | <?php if (isset($filter_by_author_data) && !empty($filter_by_author_data)): ?> |
| 138 | - <option value="<?php echo esc_html($filter_by_author_data['ID'])?>" selected><?php echo esc_html($filter_by_author_data['display_name'])?></option> | |
| 142 | + <option value="<?php echo esc_attr($filter_by_author_data['ID'])?>" selected><?php echo esc_html($filter_by_author_data['display_name'])?></option> | |
| 139 | 143 | <?php endif; ?> |
| 140 | 144 | </select> |
| 141 | 145 | <select name="orderby" id="ays-chart-order-by"> |
| 142 | - <option value=""><?= __( "Order by", "chart-builder" ) ?></option> | |
| 146 | + <option value=""><?php echo esc_html__( "Order by", "chart-builder" ) ?></option> | |
| 143 | 147 | <?php |
| 144 | 148 | foreach ( $order_by_values as $k => $v ): |
| 145 | 149 | // $disabled = $k >= 2 ? 'disabled' : '' ; |
| 146 | 150 | $selected = ( $order_by == $k ) ? 'selected' : ''; |
| @@ -164,9 +168,9 @@ | ||
| 164 | 168 | <button type="submit" name="ays_chart_filter_clear" id="ays-chart-filter-clear"><?php echo esc_html(__( 'Clear filters', "chart-builder" )); ?></button> |
| 165 | 169 | </div> |
| 166 | 170 | </div> |
| 167 | 171 | <div class="ays-chart-search-block"> |
| 168 | - <input type="text" name="s" id="ays-chart-search-input" value="<?php echo $search; ?>"> | |
| 172 | + <input type="text" name="s" id="ays-chart-search-input" value="<?php echo esc_attr($search); ?>"> | |
| 169 | 173 | <button type="submit" name="ays_chart_search" id="ays-chart-search"><?php echo esc_html(__( 'Search', "chart-builder" )); ?></button> |
| 170 | 174 | </div> |
| 171 | 175 | </div> |
| 172 | 176 | <table class="chart-list-table table"> |
| @@ -194,11 +198,11 @@ | ||
| 194 | 198 | <input type="checkbox" class="form-check-input check-current-row" name="bulk-delete[]" value="<?php echo esc_attr($item['id']) ?>" /> |
| 195 | 199 | </td> |
| 196 | 200 | <td class="column-title"><?php |
| 197 | 201 | if($item['status'] == 'trashed'){ |
| 202 | + $delete_nonce = wp_create_nonce( $this->plugin_name . '-trash-item' ); | |
| 203 | + }else{ | |
| 198 | 204 | $delete_nonce = wp_create_nonce( $this->plugin_name . '-delete-item' ); |
| 199 | - }else{ | |
| 200 | - $delete_nonce = wp_create_nonce( $this->plugin_name . '-trash-item' ); | |
| 201 | 205 | } |
| 202 | 206 | $publish_nonce = wp_create_nonce( $this->plugin_name . '-publish-item' ); |
| 203 | 207 | $unpublish_nonce = wp_create_nonce( $this->plugin_name . '-unpublish-item' ); |
| 204 | 208 | $duplicate_nonce = wp_create_nonce( $this->plugin_name . '-duplicate-item' ); |
| @@ -203,34 +207,33 @@ | ||
| 203 | 207 | $unpublish_nonce = wp_create_nonce( $this->plugin_name . '-unpublish-item' ); |
| 204 | 208 | $duplicate_nonce = wp_create_nonce( $this->plugin_name . '-duplicate-item' ); |
| 205 | 209 | $chart_title = stripcslashes( $item['title'] ); |
| 206 | 210 | $q = esc_attr( $chart_title ); |
| 207 | - | |
| 208 | - $restitle = Chart_Builder_Admin::ays_restriction_string("word", $chart_title, $chart_title_length); | |
| 209 | - | |
| 210 | - $title = sprintf( '<a href="?page=%s&action=%s&id=%d" title="%s">%s</a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ), $q, $restitle); | |
| 211 | - | |
| 211 | + $custom_post_id = isset($item['custom_post_id']) && $item['custom_post_id'] != 0 && $item['custom_post_id'] != '' ? esc_attr(intval($item['custom_post_id'])) : 0; | |
| 212 | + $restitle = Chart_Builder_Admin::ays_restriction_string("word", $chart_title, $chart_title_length); | |
| 212 | 213 | $actions = array(); |
| 213 | 214 | if($item['status'] == 'trashed'){ |
| 214 | 215 | $title = sprintf( '<strong><a>%s</a></strong>', $restitle ); |
| 215 | - $actions['restore'] = sprintf( '<a href="?page=%s&action=%s&id=%d&_wpnonce=%s">'. __('Restore', "chart-builder") .'</a>', esc_attr( $_REQUEST['page'] ), 'restore', absint( $item['id'] ), $delete_nonce ); | |
| 216 | - $actions['delete'] = sprintf( '<a class="ays_confirm_del" data-message="%s" href="?page=%s&action=%s&id=%s&_wpnonce=%s">'. __('Delete Permanently', "chart-builder") .'</a>', $restitle, esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce ); | |
| 216 | + $actions['restore'] = sprintf( '<a href="?page=%s&action=%s&id=%d&_wpnonce=%s">'. __('Restore', "chart-builder") .'</a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page']))), 'restore', absint( $item['id'] ), $delete_nonce ); | |
| 217 | + $actions['delete'] = sprintf( '<a class="ays_confirm_del" data-message="%s" href="?page=%s&action=%s&id=%s&_wpnonce=%s">'. esc_html__('Delete Permanently', "chart-builder") .'</a>', $restitle, esc_attr(sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'delete', absint( $item['id'] ), $delete_nonce ); | |
| 217 | 218 | }else{ |
| 218 | - $actions['edit'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%d" data-bs-toggle="tooltip" title="'. esc_html(__('Edit',"chart-builder")) .'"><i class="ays_fa ays_fa_pen_to_square"></i></a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ) ); | |
| 219 | + $actions['edit'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%d" data-bs-toggle="tooltip" title="'. esc_html(__('Edit',"chart-builder")) .'"><i class="ays_fa ays_fa_pen_to_square"></i></a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'edit', absint( $item['id'] ) ); | |
| 219 | 220 | |
| 220 | 221 | $draft_text = ''; |
| 221 | 222 | if( $item['status'] == 'draft' && !( isset( $_GET['fstatus'] ) && $_GET['fstatus'] == 'draft' )){ |
| 222 | 223 | $draft_text = ' — ' . '<span class="post-state">' . __( "Draft", "chart-builder" ) . '</span>'; |
| 223 | - $actions['publish'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Publish',"chart-builder")) .'"><i class="ays_fa ays_fa_unpublished"></i></a>', esc_attr( $_REQUEST['page'] ), 'publish', absint( $item['id'] ), $publish_nonce ); | |
| 224 | + $actions['publish'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Publish',"chart-builder")) .'"><i class="ays_fa ays_fa_unpublished"></i></a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'publish', absint( $item['id'] ), $publish_nonce ); | |
| 224 | 225 | } else { |
| 225 | - $actions['unpublish'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Unpublish',"chart-builder")) .'"><i class="ays_fa ays_fa_published"></i></a>', esc_attr( $_REQUEST['page'] ), 'unpublish', absint( $item['id'] ), $unpublish_nonce ); | |
| 226 | + $actions['unpublish'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Unpublish',"chart-builder")) .'"><i class="ays_fa ays_fa_published"></i></a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'unpublish', absint( $item['id'] ), $unpublish_nonce ); | |
| 226 | 227 | } |
| 227 | 228 | |
| 228 | - $title = sprintf( '<strong><a href="?page=%s&action=%s&id=%d" title="%s">%s</a>%s</strong>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ), $q, $restitle, $draft_text ); | |
| 229 | - | |
| 230 | - $actions['duplicate'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Duplicate',"chart-builder")) .'"><i class="ays_fa ays_fa_copy"></i></a>', esc_attr( $_REQUEST['page'] ), 'duplicate', absint( $item['id'] ), $duplicate_nonce ); | |
| 229 | + $title = sprintf( '<strong><a href="?page=%s&action=%s&id=%d" title="%s">%s</a>%s</strong>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'edit', absint( $item['id'] ), $q, $restitle, $draft_text ); | |
| 230 | + if($custom_post_id > 0){ | |
| 231 | + $actions['custom_posts'] = sprintf( '<a href="%s" class="btn btn-primary btn-sm" target="_blank"><i class="fa fa-eye"></i></a>', esc_url( add_query_arg( 'preview', 'true', get_permalink($custom_post_id) ) )); | |
| 232 | + } | |
| 233 | + $actions['duplicate'] = sprintf( '<a class="btn btn-primary btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Duplicate',"chart-builder")) .'"><i class="ays_fa ays_fa_copy"></i></a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'duplicate', absint( $item['id'] ), $duplicate_nonce ); | |
| 231 | 234 | |
| 232 | - $actions['delete'] = sprintf( '<a class="ays_chart_delete_confirm btn btn-danger btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Delete',"chart-builder")) .'"><i class="ays_fa ays_fa_trash_o"></i></a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce ); | |
| 235 | + $actions['delete'] = sprintf( '<a class="ays_chart_delete_confirm btn btn-danger btn-sm" href="?page=%s&action=%s&id=%s&_wpnonce=%s" data-bs-toggle="tooltip" title="'. esc_html(__('Delete',"chart-builder")) .'"><i class="ays_fa ays_fa_trash_o"></i></a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'delete', absint( $item['id'] ), $delete_nonce ); | |
| 233 | 236 | } |
| 234 | 237 | echo wp_kses_post($title); |
| 235 | 238 | |
| 236 | 239 | echo '<p class="chart-list-table-actions-row">'; |
| @@ -238,9 +241,11 @@ | ||
| 238 | 241 | $link_class = ''; |
| 239 | 242 | // if( $action == 'delete' ){ |
| 240 | 243 | // $link_class = 'link-danger'; |
| 241 | 244 | // } |
| 242 | - echo '<span class="chart-list-table-action-link ' . $link_class . '">' . $action_html . '</span>'; | |
| 245 | + echo '<span class="chart-list-table-action-link ' . esc_attr( $link_class ) . '">'; | |
| 246 | + echo wp_kses_post( $action_html ); | |
| 247 | + echo '</span>'; | |
| 243 | 248 | } |
| 244 | 249 | echo '</p>'; |
| 245 | 250 | ?></td> |
| 246 | 251 | <td class="column-type"><?php |
| @@ -245,35 +250,35 @@ | ||
| 245 | 250 | ?></td> |
| 246 | 251 | <td class="column-type"><?php |
| 247 | 252 | switch ($item['source_chart_type']) { |
| 248 | 253 | case 'line_chart': |
| 249 | - echo "<p><img src='" . CHART_BUILDER_ADMIN_URL . "/images/icons/line-chart.png" . "' width='20px'>"; | |
| 250 | - echo "<span style='margin-left: 8px'>" . __('Line Chart', $this->plugin_name) . "</span></p>"; | |
| 254 | + echo "<p><img src='" . esc_url(plugins_url('/images/icons/line-chart.png', dirname(__FILE__, 2))) . "' width='20px'>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 255 | + echo "<span style='margin-left: 8px'>" . esc_html__('Line Chart', 'chart-builder') . "</span></p>"; | |
| 251 | 256 | break; |
| 252 | 257 | |
| 253 | 258 | case 'bar_chart': |
| 254 | - echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/bar-chart.png" . "' width='20px'>"; | |
| 255 | - echo "<span style='margin-left: 8px'>" . __('Bar Chart', "chart-builder") . "</span></p>"; | |
| 259 | + echo "<p><img src='" . esc_url(plugins_url('/images/icons/bar-chart.png', dirname(__FILE__, 2))) . "' width='20px'>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 260 | + echo "<span style='margin-left: 8px'>" . esc_html__('Bar Chart', "chart-builder") . "</span></p>"; | |
| 256 | 261 | break; |
| 257 | 262 | |
| 258 | 263 | case 'pie_chart': |
| 259 | - echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/pie-chart.png" . "' width='20px'>"; | |
| 260 | - echo "<span style='margin-left: 8px'>" . __('Pie Chart', "chart-builder") . "</span></p>"; | |
| 264 | + echo "<p><img src='" . esc_url(plugins_url('/images/icons/pie-chart.png', dirname(__FILE__, 2))) . "' width='20px'>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 265 | + echo "<span style='margin-left: 8px'>" . esc_html__('Pie Chart', "chart-builder") . "</span></p>"; | |
| 261 | 266 | break; |
| 262 | 267 | |
| 263 | 268 | case 'column_chart': |
| 264 | - echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/column-chart.png" . "' width='20px'>"; | |
| 265 | - echo "<span style='margin-left: 8px'>" . __('Column Chart', "chart-builder") . "</span></p>"; | |
| 269 | + echo "<p><img src='" . esc_url(plugins_url('/images/icons/column-chart.png', dirname(__FILE__, 2))) . "' width='20px'>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 270 | + echo "<span style='margin-left: 8px'>" . esc_html__('Column Chart', "chart-builder") . "</span></p>"; | |
| 266 | 271 | break; |
| 267 | 272 | |
| 268 | 273 | case 'donut_chart': |
| 269 | - echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/donut-chart.png" . "' width='20px'>"; | |
| 270 | - echo "<span style='margin-left: 8px'>" . __('Donut Chart', "chart-builder") . "</span></p>"; | |
| 274 | + echo "<p><img src='" . esc_url(plugins_url('/images/icons/donut-chart.png', dirname(__FILE__, 2))) . "' width='20px'>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 275 | + echo "<span style='margin-left: 8px'>" . esc_html__('Donut Chart', "chart-builder") . "</span></p>"; | |
| 271 | 276 | break; |
| 272 | 277 | |
| 273 | 278 | case 'org_chart': |
| 274 | - echo "<p><img src='" . CHART_BUILDER_ADMIN_URL . "/images/icons/org-chart.png" . "' width='20px'>"; | |
| 275 | - echo "<span style='margin-left: 8px'>" . __('Org Chart', $this->plugin_name) . "</span></p>"; | |
| 279 | + echo "<p><img src='" . esc_url(plugins_url('/images/icons/org-chart.png', dirname(__FILE__, 2))) . "' width='20px'>";// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage | |
| 280 | + echo "<span style='margin-left: 8px'>" . esc_html__('Org Chart', 'chart-builder') . "</span></p>"; | |
| 276 | 281 | break; |
| 277 | 282 | } |
| 278 | 283 | ?></td> |
| 279 | 284 | <td class="column-source-type"><?php |
| @@ -278,13 +283,13 @@ | ||
| 278 | 283 | ?></td> |
| 279 | 284 | <td class="column-source-type"><?php |
| 280 | 285 | switch ($item['source_type']) { |
| 281 | 286 | case 'quiz_maker': |
| 282 | - echo "<span style='margin-left: 8px'>" . __('Quiz Maker', $this->plugin_name) . "</span>"; | |
| 287 | + echo "<span style='margin-left: 8px'>" . esc_html__('Quiz Maker', 'chart-builder') . "</span>"; | |
| 283 | 288 | break; |
| 284 | 289 | case 'manual': |
| 285 | 290 | default: |
| 286 | - echo "<span style='margin-left: 8px'>" . __('Manual', $this->plugin_name) . "</span>"; | |
| 291 | + echo "<span style='margin-left: 8px'>" . esc_html__('Manual', 'chart-builder') . "</span>"; | |
| 287 | 292 | break; |
| 288 | 293 | } |
| 289 | 294 | ?></td> |
| 290 | 295 | <td class="column-chart-source"><?php |
| @@ -289,13 +294,13 @@ | ||
| 289 | 294 | ?></td> |
| 290 | 295 | <td class="column-chart-source"><?php |
| 291 | 296 | switch ($item['type']) { |
| 292 | 297 | case 'chart-js': |
| 293 | - echo "<span style='margin-left: 8px'>" . __('Chart.js', $this->plugin_name) . "</span>"; | |
| 298 | + echo "<span style='margin-left: 8px'>" . esc_html__('Chart.js', 'chart-builder') . "</span>"; | |
| 294 | 299 | break; |
| 295 | 300 | case 'google-charts': |
| 296 | 301 | default: |
| 297 | - echo "<span style='margin-left: 8px'>" . __('Google Charts', $this->plugin_name) . "</span>"; | |
| 302 | + echo "<span style='margin-left: 8px'>" . esc_html__('Google Charts', 'chart-builder') . "</span>"; | |
| 298 | 303 | break; |
| 299 | 304 | } |
| 300 | 305 | ?></td> |
| 301 | 306 | <td class="column-shortcode"> |
| @@ -302,9 +307,9 @@ | ||
| 302 | 307 | <div class="ays-chart-shortcode-container"> |
| 303 | 308 | <div class="ays-chart-copy-image" data-bs-toggle="tooltip" title="<?php echo esc_html(__('Click to copy',"chart-builder"));?>"> |
| 304 | 309 | <img src='<?php echo esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/copy-image.svg" ?>'> |
| 305 | 310 | </div> |
| 306 | - <!-- <input type="text" class="ays-chart-shortcode-input" onClick="this.setSelectionRange(0, this.value.length)" readonly value="<//?= esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" /> --> | |
| 311 | + <!-- <input type="text" class="ays-chart-shortcode-input" onClick="this.setSelectionRange(0, this.value.length)" readonly value="<//?php echo esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" /> --> | |
| 307 | 312 | <input type="text" class="ays-chart-shortcode-input" readonly value="<?php echo esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" /> |
| 308 | 313 | </div> |
| 309 | 314 | </td> |
| 310 | 315 | <td class="column-author"><?php |
| @@ -312,9 +317,9 @@ | ||
| 312 | 317 | if( $author ){ |
| 313 | 318 | $author_name = $author->data->display_name; |
| 314 | 319 | echo esc_html($author_name); |
| 315 | 320 | } else { |
| 316 | - echo '<span style="color:red">'.__('Deleted user', 'chart-builder').'</span>'; | |
| 321 | + echo '<span style="color:red">'. esc_html__('Deleted user', 'chart-builder').'</span>'; | |
| 317 | 322 | } |
| 318 | 323 | ?></td> |
| 319 | 324 | <td class="column-status"><?php |
| 320 | 325 | $status = ucfirst( $item['status'] ); |
| @@ -322,10 +327,10 @@ | ||
| 322 | 327 | |
| 323 | 328 | echo wp_kses_post( $html ); |
| 324 | 329 | ?></td> |
| 325 | 330 | <td class="column-date"><?php |
| 326 | - $date = date( 'Y/m/d', strtotime( $item['date_modified'] ) ); | |
| 327 | - $title_date = date( 'l jS \of F Y h:i:s A', strtotime( $item['date_modified'] ) ); | |
| 331 | + $date = gmdate( 'Y/m/d', strtotime( $item['date_modified'] ) ); | |
| 332 | + $title_date = gmdate( 'l jS \of F Y h:i:s A', strtotime( $item['date_modified'] ) ); | |
| 328 | 333 | $html = "<p style='font-size:14px;margin:0;text-decoration: dotted underline;' title='" . $title_date . "'>" . $date . "</p>"; |
| 329 | 334 | |
| 330 | 335 | echo wp_kses_post( $html ); |
| 331 | 336 | ?></td> |
| @@ -346,9 +351,9 @@ | ||
| 346 | 351 | <button type="submit" name="bulk_delete_confirm" id="ays-chart-bulk-delete-confirm-bottom" style="display: none;"></button> |
| 347 | 352 | </div> |
| 348 | 353 | <div class="ays-chart-filter-section"> |
| 349 | 354 | <select name="filterbytype" id="ays-chart-filter-select-bottom"> |
| 350 | - <option value=""><?= __( "Select Type", "chart-builder" ) ?></option> | |
| 355 | + <option value=""><?php echo esc_html__( "Select Type", "chart-builder" ) ?></option> | |
| 351 | 356 | <?php |
| 352 | 357 | foreach ( $chart_types as $k => $v ): |
| 353 | 358 | $selected = ( $filter_by_type == ($k+1) ) ? 'selected' : ''; |
| 354 | 359 | ?> |
| @@ -357,33 +362,33 @@ | ||
| 357 | 362 | endforeach; |
| 358 | 363 | ?> |
| 359 | 364 | </select> |
| 360 | 365 | <select name="filterbysource" id="ays-chart-filter-source-bottom"> |
| 361 | - <option value=""><?= __( "Select Source", "chart-builder" ) ?></option> | |
| 366 | + <option value=""><?php echo esc_html__( "Select Source", "chart-builder" ) ?></option> | |
| 362 | 367 | <?php |
| 363 | 368 | foreach ( $chart_sources as $k => $v ): |
| 364 | 369 | $disabled = $k >= 2 ? 'disabled' : '' ; |
| 365 | 370 | $selected = ( $filter_by_source == ($k+1) ) ? 'selected' : ''; |
| 366 | 371 | ?> |
| 367 | - <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> | |
| 372 | + <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo esc_attr($disabled); ?>><?php echo esc_html($v); ?></option> | |
| 368 | 373 | <?php |
| 369 | 374 | endforeach; |
| 370 | 375 | ?> |
| 371 | 376 | </select> |
| 372 | 377 | <select name="filterbychartsource" id="ays-chart-filter-chart-source-bottom"> |
| 373 | - <option value=""><?= __( "Select Chart Source", "chart-builder" ) ?></option> | |
| 378 | + <option value=""><?php echo esc_html__( "Select Chart Source", "chart-builder" ) ?></option> | |
| 374 | 379 | <?php |
| 375 | 380 | foreach ( $chart_source_types as $k => $v ): |
| 376 | 381 | $disabled = $k >= 2 ? 'disabled' : '' ; |
| 377 | 382 | $selected = ( $filter_by_chart_source == ($k+1) ) ? 'selected' : ''; |
| 378 | 383 | ?> |
| 379 | - <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo $disabled; ?>><?php echo esc_html($v); ?></option> | |
| 384 | + <option value="<?php echo esc_attr($k+1); ?>" <?php echo esc_attr($selected); ?> <?php echo esc_attr($disabled); ?>><?php echo esc_html($v); ?></option> | |
| 380 | 385 | <?php |
| 381 | 386 | endforeach; |
| 382 | 387 | ?> |
| 383 | 388 | </select> |
| 384 | 389 | <select name="filterbydate" id="ays-chart-filter-date-bottom"> |
| 385 | - <option value=""><?= __( "Select Date", "chart-builder" ) ?></option> | |
| 390 | + <option value=""><?php echo esc_html__( "Select Date", "chart-builder" ) ?></option> | |
| 386 | 391 | <?php |
| 387 | 392 | foreach ( $chart_dates as $k => $v ): |
| 388 | 393 | $selected = ( $filter_by_date == $k ) ? 'selected' : ''; |
| 389 | 394 | ?> |
| @@ -397,9 +402,9 @@ | ||
| 397 | 402 | <option value="<?php echo esc_html($filter_by_author_data['ID'])?>" selected><?php echo esc_html($filter_by_author_data['display_name'])?></option> |
| 398 | 403 | <?php endif; ?> |
| 399 | 404 | </select> |
| 400 | 405 | <select name="orderby" id="ays-chart-order-by-bottom"> |
| 401 | - <option value=""><?= __( "Order by", "chart-builder" ) ?></option> | |
| 406 | + <option value=""><?php echo esc_html__( "Order by", "chart-builder" ) ?></option> | |
| 402 | 407 | <?php |
| 403 | 408 | foreach ( $order_by_values as $k => $v ): |
| 404 | 409 | // $disabled = $k >= 2 ? 'disabled' : '' ; |
| 405 | 410 | $selected = ( $order_by == $k ) ? 'selected' : ''; |
| @@ -457,31 +462,42 @@ | ||
| 457 | 462 | </div> |
| 458 | 463 | <br class="clear"> |
| 459 | 464 | <div class="ays-chart-add-new-button-box"> |
| 460 | 465 | <?php |
| 461 | - echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary chart-add-new-bttn chart-add-new-button-new-design"> %s ' . __( 'Add New', "chart-builder" ) . '</a>', esc_attr( $_REQUEST['page'] ), 'add', $plus_icon_svg); | |
| 466 | + $svg_sanitize_properties = Chart_Builder_Admin::chart_builder_svg_sanitize_allowed_properties(); | |
| 467 | + $sanitized_plus_icon_svg = wp_kses($plus_icon_svg, $svg_sanitize_properties); | |
| 468 | + echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary chart-add-new-bttn chart-add-new-button-new-design"> %s ' . esc_html__( 'Add New', "chart-builder" ) . '</a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'add', wp_kses_post($plus_icon_svg)); | |
| 462 | 469 | ?> |
| 463 | 470 | </div> |
| 464 | 471 | <?php if($chart_max_id <= 3): ?> |
| 465 | 472 | <div class="ays-chart-create-chart-video-box" style="margin: 0 auto 30px;"> |
| 466 | 473 | <div class="ays-chart-create-chart-title"> |
| 467 | - <h4><?php echo __( "Create Your First Chart in Under One Minute", $this->plugin_name ); ?></h4> | |
| 474 | + <h4><?php echo esc_html__( "Create Your First Chart in Under One Minute", 'chart-builder' ); ?></h4> | |
| 468 | 475 | </div> |
| 469 | 476 | <div class="ays-chart-create-chart-youtube-video"> |
| 470 | - <iframe width="560" height="315" src="https://www.youtube.com/embed/ysjUMK0HH3c" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" loading="lazy" allowfullscreen style="max-width: 100%;"></iframe> | |
| 477 | + <div class="ays-chart-youtube-placeholder" data-video-id="ysjUMK0HH3c" style="cursor: pointer"> | |
| 478 | + <img src="<?php echo esc_url(CHART_BUILDER_ADMIN_URL .'/images/create-chart-on-wordpress.webp'); ?>" loading="lazy" width="560" height="315"> | |
| 479 | + </div> | |
| 471 | 480 | </div> |
| 472 | 481 | <div class="ays_chart_small_hint_text_for_message_variables" style="text-align: center;"> |
| 473 | - <?php echo __( 'Please note that this video will disappear once you created 4 charts.', $this->plugin_name ); ?> | |
| 482 | + <?php echo esc_html__( 'Please note that this video will disappear once you created 4 charts.', 'chart-builder' ); ?> | |
| 474 | 483 | </div> |
| 475 | 484 | <div class="ays-chart-create-chart-youtube-video-button-box"> |
| 476 | - <?php echo sprintf( '<a href="?page=%s&action=%s" class="ays-chart-add-new-button-video chart-add-new-button-new-design"> %s ' . __('Add New', $this->plugin_name) . '</a>', esc_attr( $_REQUEST['page'] ), 'add', $plus_icon_svg);?> | |
| 485 | + <?php | |
| 486 | + $svg_sanitize_properties = Chart_Builder_Admin::chart_builder_svg_sanitize_allowed_properties(); | |
| 487 | + $sanitized_plus_icon_svg = wp_kses($plus_icon_svg, $svg_sanitize_properties); | |
| 488 | + echo sprintf( '<a href="?page=%s&action=%s" class="ays-chart-add-new-button-video chart-add-new-button-new-design"> %s ' . esc_html__('Add New', 'chart-builder') . '</a>', esc_attr( sanitize_text_field(wp_unslash($_REQUEST['page'] ))), 'add', wp_kses_post($plus_icon_svg)); | |
| 489 | + ?> | |
| 477 | 490 | </div> |
| 478 | 491 | </div> |
| 479 | 492 | <?php else: ?> |
| 480 | 493 | <div class="ays-chart-create-chart-video-box ays-chart-create-chart-video-box-only-link" style="margin: auto;"> |
| 481 | 494 | <div class="ays-chart-create-chart-youtube-video"> |
| 482 | - <?php echo $youtube_icon_svg; ?> | |
| 483 | - <a href="https://www.youtube.com/watch?v=ysjUMK0HH3c" target="_blank" style="color:#2271b1;text-decoration:none" title="YouTube video player"><?php echo __("How to create chart in one minute?", $this->plugin_name); ?></a> | |
| 495 | + <?php | |
| 496 | + $svg_sanitize_properties = Chart_Builder_Admin::chart_builder_svg_sanitize_allowed_properties(); | |
| 497 | + $sanitized_youtube_icon_svg = wp_kses($youtube_icon_svg, $svg_sanitize_properties); | |
| 498 | + echo wp_kses_post($sanitized_youtube_icon_svg); ?> | |
| 499 | + <a href="https://www.youtube.com/watch?v=ysjUMK0HH3c" target="_blank" style="color:#2271b1;text-decoration:none" title="YouTube video player"><?php echo esc_html__("How to create chart in one minute?", 'chart-builder'); ?></a> | |
| 484 | 500 | </div> |
| 485 | 501 | </div> |
| 486 | 502 | <?php endif; ?> |
| 487 | 503 | </div> |