diff --git a/assets/js/page-views.js b/assets/js/page-views.js new file mode 100644 index 0000000000..fa6aafebd4 --- /dev/null +++ b/assets/js/page-views.js @@ -0,0 +1,32 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./assets/src/js/page-views.js": +/*!*************************************!*\ + !*** ./assets/src/js/page-views.js ***! + \*************************************/ +/***/ (() => { + +eval("/* global dokanPageViewsParams */\n\njQuery(document).ready(function ($) {\n if (!localStorage) {\n return;\n }\n if (!window.dokanPageViewsParams) {\n return;\n }\n\n // Get today's date in the format of YYYY-MM-DD\n let newDate = new Date().toISOString().slice(0, 10);\n let dokanPageViewCount = JSON.parse(localStorage.getItem(\"dokan_pageview_count\"));\n\n // If there is no data in local storage or today's date is not same as the date in local storage.\n if (dokanPageViewCount === null || dokanPageViewCount.today && dokanPageViewCount.today !== newDate) {\n dokanPageViewCount = {\n \"today\": newDate,\n \"post_ids\": []\n };\n }\n\n // If the post id is not in the local storage, then send the ajax request.\n if (!dokanPageViewCount.post_ids.includes(window.dokanPageViewsParams.post_id)) {\n $.post(window.dokanPageViewsParams.ajax_url, {\n action: \"dokan_pageview\",\n _ajax_nonce: window.dokanPageViewsParams.nonce,\n post_id: window.dokanPageViewsParams.post_id\n });\n\n // Add the post id to the local storage.\n dokanPageViewCount.post_ids.push(window.dokanPageViewsParams.post_id);\n localStorage.setItem(\"dokan_pageview_count\", JSON.stringify(dokanPageViewCount));\n }\n});\n\n//# sourceURL=webpack://dokan/./assets/src/js/page-views.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = {}; +/******/ __webpack_modules__["./assets/src/js/page-views.js"](); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/assets/src/js/page-views.js b/assets/src/js/page-views.js new file mode 100644 index 0000000000..9cba7aa6cd --- /dev/null +++ b/assets/src/js/page-views.js @@ -0,0 +1,33 @@ +/* global dokanPageViewsParams */ + +jQuery( document ).ready( function( $ ) { + if( ! localStorage ) { + return; + } + + if ( ! window.dokanPageViewsParams ) { + return; + } + + // Get today's date in the format of YYYY-MM-DD + let newDate = new Date().toISOString().slice(0, 10); + let dokanPageViewCount = JSON.parse(localStorage.getItem("dokan_pageview_count")); + + // If there is no data in local storage or today's date is not same as the date in local storage. + if ( dokanPageViewCount === null || ( dokanPageViewCount.today && dokanPageViewCount.today !== newDate ) ) { + dokanPageViewCount = { "today": newDate, "post_ids": [] }; + } + + // If the post id is not in the local storage, then send the ajax request. + if ( ! dokanPageViewCount.post_ids.includes( window.dokanPageViewsParams.post_id ) ) { + $.post( window.dokanPageViewsParams.ajax_url, { + action: "dokan_pageview", + _ajax_nonce: window.dokanPageViewsParams.nonce, + post_id: window.dokanPageViewsParams.post_id, + } ); + + // Add the post id to the local storage. + dokanPageViewCount.post_ids.push( window.dokanPageViewsParams.post_id ); + localStorage.setItem( "dokan_pageview_count", JSON.stringify( dokanPageViewCount ) ); + } +} ); diff --git a/includes/Admin/Hooks.php b/includes/Admin/Hooks.php index 0543fd0b55..6c17da500c 100644 --- a/includes/Admin/Hooks.php +++ b/includes/Admin/Hooks.php @@ -96,7 +96,7 @@ class="dokan_product_author_override" data-minimum_input_length="0" data-data='' > - +
@@ -732,9 +732,15 @@ public function dokan_setup_withdraw_save() { $options = get_option( 'dokan_withdraw', [] ); $options['withdraw_methods'] = ! empty( $_POST['withdraw_methods'] ) ? wc_clean( wp_unslash( $_POST['withdraw_methods'] ) ) : []; - $options['withdraw_limit'] = ! empty( $_POST['withdraw_limit'] ) ? (float) wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['withdraw_limit'] ) ) ) < 0 ? 0 : wc_format_decimal( sanitize_text_field( wp_unslash( $_POST['withdraw_limit'] ) ) ) : 0; $options['withdraw_order_status'] = ! empty( $_POST['withdraw_order_status'] ) ? wc_clean( wp_unslash( $_POST['withdraw_order_status'] ) ) : []; + if ( ! empty( $_POST['withdraw_limit'] ) ) { + $input_limit = sanitize_text_field( wp_unslash( $_POST['withdraw_limit'] ) ); + $options['withdraw_limit'] = is_numeric( $input_limit ) && $input_limit >= 0 ? wc_format_decimal( $input_limit ) : 0; + } else { + $options['withdraw_limit'] = 0; + } + /** * Filter dokan_withdraw options before saving in setup wizard * diff --git a/includes/Admin/SetupWizardNoWC.php b/includes/Admin/SetupWizardNoWC.php index 71f1a1e10a..3c15210fe9 100644 --- a/includes/Admin/SetupWizardNoWC.php +++ b/includes/Admin/SetupWizardNoWC.php @@ -129,7 +129,7 @@ public function install_woocommerce() { delete_transient( '_wc_activation_redirect' ); if ( is_wp_error( $installed ) ) { - wp_die( $installed->get_error_message(), __( 'Error installing WooCommerce plugin', 'dokan-lite' ) ); + wp_die( esc_html( $installed->get_error_message() ), esc_html__( 'Error installing WooCommerce plugin', 'dokan-lite' ) ); } set_transient( 'dokan_setup_wizard_no_wc', true, 15 * MINUTE_IN_SECONDS ); diff --git a/includes/Ajax.php b/includes/Ajax.php index 7b983a18f7..b7f93a7c52 100755 --- a/includes/Ajax.php +++ b/includes/Ajax.php @@ -265,8 +265,8 @@ public function grant_access_to_download() { include dirname( __DIR__ ) . '/templates/orders/order-download-permission-html.php'; - $loop ++; - $file_count ++; + ++$loop; + ++$file_count; } } } @@ -414,7 +414,7 @@ public function add_order_note() { echo 'customer-note'; } echo '">
'; - echo wpautop( wptexturize( $note ) ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( wpautop( wptexturize( $note ) ) ); echo '

' . esc_html__( 'Delete note', 'dokan-lite' ) . '

'; echo ''; } @@ -484,7 +484,7 @@ public function add_shipping_tracking_info() { echo '
  • '; - echo wpautop( wptexturize( $ship_info ) ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( wpautop( wptexturize( $ship_info ) ) ); echo '

    ' . esc_html__( 'Delete', 'dokan-lite' ) . '

    '; echo '
  • '; @@ -692,6 +692,7 @@ public function dokan_json_search_products_tags() { $drop_down_tags = apply_filters( 'dokan_search_product_tags_for_vendor_products', [ + 'taxonomy' => 'product_tag', 'name__like' => $name, 'hide_empty' => 0, 'orderby' => 'name', @@ -701,7 +702,7 @@ public function dokan_json_search_products_tags() { ] ); - $product_tags = get_terms( 'product_tag', $drop_down_tags ); + $product_tags = get_terms( $drop_down_tags ); if ( $product_tags ) { foreach ( $product_tags as $pro_term ) { diff --git a/includes/Customizer/HeadingControl.php b/includes/Customizer/HeadingControl.php index f8514a0da6..8d03622e32 100644 --- a/includes/Customizer/HeadingControl.php +++ b/includes/Customizer/HeadingControl.php @@ -28,7 +28,9 @@ protected function render_content() { description ) ) { ?> - description; ?> + + description ); ?> + id ) . esc_attr( $value ); ?>"> <?php echo esc_attr( $label['label'] ); ?> diff --git a/includes/Order/Admin/Hooks.php b/includes/Order/Admin/Hooks.php index 1fc7e739bf..1e8631127c 100644 --- a/includes/Order/Admin/Hooks.php +++ b/includes/Order/Admin/Hooks.php @@ -158,7 +158,7 @@ public function shop_order_custom_columns( $col, $post_id ) { } if ( ! empty( $output ) ) { - echo apply_filters( "dokan_manage_shop_order_custom_columns_{$col}", $output, $order ); + echo wp_kses_post( apply_filters( "dokan_manage_shop_order_custom_columns_{$col}", $output, $order ) ); } } @@ -168,15 +168,15 @@ public function shop_order_custom_columns( $col, $post_id ) { * @since 3.8.0 Moved from includes/Admin/Hooks.php file * @since 3.8.0 Rewritten for HPOS * - * @param string[] $classes An array of post class names. - * @param string[] $class An array of additional class names added to the post. + * @param string[] $classes An array of post class names. + * @param string[] $css_class An array of additional class names added to the post. * @param int $post_id The post ID. * * @global WP_Post $post * * @return array */ - public function admin_shop_order_row_classes( $classes, $class, $post_id ) { + public function admin_shop_order_row_classes( $classes, $css_class, $post_id ) { if ( ! OrderUtil::is_order( $post_id ) ) { return $classes; } diff --git a/includes/PageViews.php b/includes/PageViews.php index 028e9bca28..b20390887d 100755 --- a/includes/PageViews.php +++ b/includes/PageViews.php @@ -3,83 +3,84 @@ namespace WeDevs\Dokan; /** - * Pageviews - for counting product post views. + * Page views - for counting product post views. */ class PageViews { - private $meta_key = 'pageview'; - - public function __construct() { - /* Registers the entry views extension scripts if we're on the correct page. */ - add_action( 'template_redirect', array( $this, 'load_views' ), 25 ); - - /* Add the entry views AJAX actions to the appropriate hooks. */ - add_action( 'wp_ajax_dokan_pageview', array( $this, 'update_ajax' ) ); - add_action( 'wp_ajax_nopriv_dokan_pageview', array( $this, 'update_ajax' ) ); - } - - public function load_scripts() { - $nonce = wp_create_nonce( 'dokan_pageview' ); - - echo ''; - } - - public function load_views() { - if ( is_singular( 'product' ) ) { - global $post; - - if ( $post->post_author !== dokan_get_current_user_id() ) { - wp_enqueue_script( 'jquery' ); - add_action( 'wp_footer', array( $this, 'load_scripts' ) ); - } - } - } - - public function update_view( $post_id = '' ) { - if ( ! empty( $post_id ) ) { - $old_views = get_post_meta( $post_id, $this->meta_key, true ); - $new_views = absint( $old_views ) + 1; - - update_post_meta( $post_id, $this->meta_key, $new_views, $old_views ); - $seller_id = get_post_field( 'post_author', $post_id ); - Cache::delete( "pageview_{$seller_id}" ); - } - } - - public function update_ajax() { - check_ajax_referer( 'dokan_pageview' ); - - if ( isset( $_POST['post_id'] ) ) { - $post_id = absint( $_POST['post_id'] ); - } - - if ( ! empty( $post_id ) ) { - $this->update_view( $post_id ); - } - - wp_die(); - } - + private $meta_key = 'pageview'; + + public function __construct() { + /* Registers the entry views extension scripts if we're on the correct page. */ + add_action( 'template_redirect', array( $this, 'load_views' ), 25 ); + + /* Add the entry views AJAX actions to the appropriate hooks. */ + add_action( 'wp_ajax_dokan_pageview', array( $this, 'update_ajax' ) ); + add_action( 'wp_ajax_nopriv_dokan_pageview', array( $this, 'update_ajax' ) ); + } + + /** + * Load the scripts + * + * @return void + */ + public function load_scripts() { + wp_enqueue_script( 'dokan-page-views', DOKAN_PLUGIN_ASSEST . '/js/page-views.js', array( 'jquery' ), DOKAN_PLUGIN_VERSION, true ); + wp_localize_script( + 'dokan-page-views', + 'dokanPageViewsParams', + array( + 'nonce' => wp_create_nonce( 'dokan_pageview' ), + 'post_id' => get_the_ID(), + 'ajax_url' => admin_url( 'admin-ajax.php' ), + ) + ); + } + + public function load_views() { + if ( is_singular( 'product' ) ) { + global $post; + + if ( dokan_get_current_user_id() !== $post->post_author ) { + wp_enqueue_script( 'jquery' ); + add_action( 'wp_footer', array( $this, 'load_scripts' ) ); + } + } + } + + /** + * Update the view count + * + * @param int $post_id The post ID + * + * @return void + */ + public function update_view( $post_id = '' ) { + if ( ! empty( $post_id ) ) { + $old_views = get_post_meta( $post_id, $this->meta_key, true ); + $new_views = absint( $old_views ) + 1; + + update_post_meta( $post_id, $this->meta_key, $new_views, $old_views ); + $seller_id = get_post_field( 'post_author', $post_id ); + Cache::delete( "pageview_{$seller_id}" ); + } + } + + /** + * Update the view count via AJAX + * + * @return void + */ + public function update_ajax() { + check_ajax_referer( 'dokan_pageview' ); + + if ( isset( $_POST['post_id'] ) ) { + $post_id = absint( $_POST['post_id'] ); + } + + if ( ! empty( $post_id ) ) { + $this->update_view( $post_id ); + } + + wp_die(); + } } diff --git a/includes/REST/ProductController.php b/includes/REST/ProductController.php index fbbd5df543..ee78d383e0 100644 --- a/includes/REST/ProductController.php +++ b/includes/REST/ProductController.php @@ -1197,24 +1197,24 @@ protected function prepare_object_for_database( $request, $creating = false ) { /** * Prepare links for the request. * - * @param WC_Data $object Object data. - * @param WP_REST_Request $request Request object. + * @param WC_Data $data_object Object data. + * @param WP_REST_Request $request Request object. * - * @return array Links for the given post. + * @return array Links for the given post. */ - protected function prepare_links( $object, $request ) { + protected function prepare_links( $data_object, $request ) { $links = [ 'self' => [ - 'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->base, $object->get_id() ) ), + 'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->base, $data_object->get_id() ) ), ], 'collection' => [ 'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->base ) ), ], ]; - if ( $object->get_parent_id() ) { + if ( $data_object->get_parent_id() ) { $links['up'] = [ - 'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $object->get_parent_id() ) ), + 'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $data_object->get_parent_id() ) ), ]; } @@ -1343,9 +1343,7 @@ protected function get_attribute_taxonomy_name( $slug, $product ) { // Taxonomy attribute name. if ( $attribute->is_taxonomy() ) { - $taxonomy = $attribute->get_taxonomy_object(); - - return $taxonomy->attribute_label; + return $attribute->get_taxonomy_object()->attribute_label; } // Custom product attribute name. @@ -1398,7 +1396,9 @@ protected function get_attribute_options( $product_id, $attribute ) { 'fields' => 'names', ] ); - } elseif ( isset( $attribute['value'] ) ) { + } + + if ( isset( $attribute['value'] ) ) { return array_map( 'trim', explode( '|', $attribute['value'] ) ); } @@ -1505,7 +1505,8 @@ protected function set_product_images( $product, $images ) { if ( is_wp_error( $upload ) ) { if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) { - throw new WC_REST_Exception( 'woocommerce_product_image_upload_error', $upload->get_error_message(), 400 ); + dokan_log( 'Error uploading image: ' . $upload->get_error_message() ); + throw new WC_REST_Exception( 'woocommerce_product_image_upload_error', esc_html( $upload->get_error_message() ), 400 ); } else { continue; } @@ -1514,9 +1515,9 @@ protected function set_product_images( $product, $images ) { $attachment_id = wc_rest_set_uploaded_image_as_attachment( $upload, $product->get_id() ); } - if ( ! wp_attachment_is_image( $attachment_id ) ) { + if ( $attachment_id && ! wp_attachment_is_image( $attachment_id ) ) { /* translators: %s: attachment id */ - throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'dokan-lite' ), $attachment_id ), 400 ); + throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( esc_html__( '#%s is an invalid image ID.', 'dokan-lite' ), esc_html( $attachment_id ) ), 400 ); } if ( isset( $image['position'] ) && 0 === absint( $image['position'] ) ) { @@ -2308,5 +2309,4 @@ public function get_item_schema() { return $this->add_additional_fields_schema( $schema ); } - } diff --git a/includes/ReverseWithdrawal/ReverseWithdrawal.php b/includes/ReverseWithdrawal/ReverseWithdrawal.php index a7139ba0da..4d4ff4d32c 100644 --- a/includes/ReverseWithdrawal/ReverseWithdrawal.php +++ b/includes/ReverseWithdrawal/ReverseWithdrawal.php @@ -28,7 +28,7 @@ class ReverseWithdrawal { */ public function __clone() { $message = ' Backtrace: ' . wp_debug_backtrace_summary(); - _doing_it_wrong( __METHOD__, $message . esc_html__( 'Cloning is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); + _doing_it_wrong( __METHOD__, $message . esc_html__( 'Cloning is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** @@ -38,7 +38,7 @@ public function __clone() { */ public function __wakeup() { $message = ' Backtrace: ' . wp_debug_backtrace_summary(); - _doing_it_wrong( __METHOD__, $message . esc_html__( 'Unserializing instances of this class is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); + _doing_it_wrong( __METHOD__, $message . esc_html__( 'Unserializing instances of this class is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** diff --git a/includes/Traits/ChainableContainer.php b/includes/Traits/ChainableContainer.php index 2b0d3a8288..55a39f7130 100644 --- a/includes/Traits/ChainableContainer.php +++ b/includes/Traits/ChainableContainer.php @@ -18,7 +18,7 @@ trait ChainableContainer { */ public function __clone() { $message = ' Backtrace: ' . wp_debug_backtrace_summary(); - _doing_it_wrong( __METHOD__, $message . esc_html__( 'Cloning is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); + _doing_it_wrong( __METHOD__, $message . esc_html__( 'Cloning is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** @@ -28,7 +28,7 @@ public function __clone() { */ public function __wakeup() { $message = ' Backtrace: ' . wp_debug_backtrace_summary(); - _doing_it_wrong( __METHOD__, $message . esc_html__( 'Unserializing instances of this class is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); + _doing_it_wrong( __METHOD__, $message . esc_html__( 'Unserializing instances of this class is forbidden.', 'dokan-lite' ), DOKAN_PLUGIN_VERSION ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** diff --git a/includes/Widgets/BestSellingProducts.php b/includes/Widgets/BestSellingProducts.php index a6963e1327..b519d6b515 100755 --- a/includes/Widgets/BestSellingProducts.php +++ b/includes/Widgets/BestSellingProducts.php @@ -37,9 +37,10 @@ public function widget( $args, $instance ) { $r = dokan_get_best_selling_products( $no_of_product, $vendor_id, $paged, $hide_outofstock ); - echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( $args['before_widget'] ); + if ( ! empty( $title ) ) { - echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] ); } dokan_get_template_part( @@ -49,7 +50,7 @@ public function widget( $args, $instance ) { ) ); - echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( $args['after_widget'] ); wp_reset_postdata(); } diff --git a/includes/Widgets/FilterByAttributes.php b/includes/Widgets/FilterByAttributes.php index 09978cab34..1045290d1b 100755 --- a/includes/Widgets/FilterByAttributes.php +++ b/includes/Widgets/FilterByAttributes.php @@ -38,9 +38,9 @@ public function widget( $args, $instance ) { // load frontend script wp_enqueue_script( 'dokan-frontend' ); - $taxonomy = $this->get_instance_taxonomy( $instance ); - $seller_id = empty( $seller_id ) ? get_query_var( 'author' ) : $seller_id; - $vendor = dokan()->vendor->get( $seller_id ); + $taxonomy = $this->get_instance_taxonomy( $instance ); + $seller_id = empty( $seller_id ) ? get_query_var( 'author' ) : $seller_id; + $vendor = dokan()->vendor->get( $seller_id ); if ( ! $vendor instanceof Vendor ) { return; @@ -54,16 +54,17 @@ public function widget( $args, $instance ) { $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : ''; $query_type = isset( $instance['query_type'] ) ? apply_filters( 'widget_query_type', $instance['query_type'] ) : ''; - echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( $args['before_widget'] ); + if ( ! empty( $title ) ) { - echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] ); } $seller_id = empty( $seller_id ) ? get_query_var( 'author' ) : $seller_id; dokan_store_term_menu_list( $seller_id, $taxonomy, $query_type ); - echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo wp_kses_post( $args['after_widget'] ); wp_reset_postdata(); } @@ -110,7 +111,7 @@ public function form( $instance ) {

    - +

    - +  ' . $term->name . ' (' . $term->count . ') +  ' . esc_html( $term->name ) . ' (' . esc_html( $term->count ) . ') '; } echo ''; diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 8f77234387..037e737eff 100755 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -129,6 +129,7 @@ + @@ -202,6 +203,7 @@ + diff --git a/templates/products/dokan-category-header-ui.php b/templates/products/dokan-category-header-ui.php index dcfa481e05..0b9156ca01 100644 --- a/templates/products/dokan-category-header-ui.php +++ b/templates/products/dokan-category-header-ui.php @@ -13,21 +13,23 @@ // If no category is set then add a empty category box. if ( count( $chosen_cat ) < 1 ) { - array_push( $chosen_cat, $initial_category_for_modal ); + $chosen_cat[] = $initial_category_for_modal; } ?>

    - +
    $term_id ) : ?>
    - + + +
    diff --git a/templates/products/dokan-category-ui.php b/templates/products/dokan-category-ui.php index 05eb38375b..90d1806eec 100644 --- a/templates/products/dokan-category-ui.php +++ b/templates/products/dokan-category-ui.php @@ -17,7 +17,12 @@
      diff --git a/templates/products/listing-status-filter.php b/templates/products/listing-status-filter.php index b1e790860a..a3f44c9d82 100644 --- a/templates/products/listing-status-filter.php +++ b/templates/products/listing-status-filter.php @@ -20,7 +20,7 @@ total ) ); + printf( esc_html__( 'All (%s)', 'dokan-lite' ), esc_html( number_format_i18n( $post_counts->total ) ) ); ?> diff --git a/templates/products/new-product.php b/templates/products/new-product.php index 65b379528c..4bc7b0a649 100755 --- a/templates/products/new-product.php +++ b/templates/products/new-product.php @@ -128,11 +128,11 @@ %s', esc_url( dokan_edit_product_url( $created_product ) ), - get_the_title( $created_product ) + esc_html( get_the_title( $created_product ) ) ) ); ?> diff --git a/templates/products/products-listing.php b/templates/products/products-listing.php index 86a258c40b..10dc773356 100755 --- a/templates/products/products-listing.php +++ b/templates/products/products-listing.php @@ -135,7 +135,7 @@ class="dokan-btn dokan-btn-theme" __( 'Simple', 'dokan-lite' ) ] ); + $product_types = apply_filters( 'dokan_product_types', [ 'simple' => esc_html__( 'Simple', 'dokan-lite' ) ] ); $args = array( 'posts_per_page' => 15, @@ -251,13 +251,13 @@ class="dokan-btn dokan-btn-theme" '_product_listing_filter_nonce' => wp_create_nonce( 'product_listing_filter' ), ], 'type' => 'array', - 'prev_text' => __( '« Previous', 'dokan-lite' ), - 'next_text' => __( 'Next »', 'dokan-lite' ), + 'prev_text' => esc_html__( '« Previous', 'dokan-lite' ), + 'next_text' => esc_html__( 'Next »', 'dokan-lite' ), ) ); echo '
      • '; - echo join( "
      • \n\t
      • ", $page_links ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped + echo implode( "
      • \n\t
      • ", $page_links ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped,WordPress.Security.EscapeOutput.OutputNotEscaped echo "
      • \n
      \n"; echo '
      '; } diff --git a/templates/settings/bank-payment-method-settings.php b/templates/settings/bank-payment-method-settings.php index 19adba915f..9963fe9aed 100644 --- a/templates/settings/bank-payment-method-settings.php +++ b/templates/settings/bank-payment-method-settings.php @@ -27,7 +27,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -49,7 +49,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -66,7 +66,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -84,7 +84,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -102,7 +102,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -120,7 +120,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -138,7 +138,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> @@ -156,7 +156,7 @@ ' . __( 'This is required', 'dokan-lite' ) . ''; + echo '' . esc_html__( 'This is required', 'dokan-lite' ) . ''; } ?> diff --git a/templates/settings/payment.php b/templates/settings/payment.php index 10f53ba3cb..b361a2c355 100644 --- a/templates/settings/payment.php +++ b/templates/settings/payment.php @@ -28,8 +28,11 @@ <?php echo esc_attr( $method_key ); ?>
      @@ -60,7 +63,7 @@ if ( isset( $profile_info['payment'][ $method_key ] ) && ! empty( dokan_withdraw_get_method_additional_info( $method_key ) ) ) { ?> - + diff --git a/templates/settings/store-form.php b/templates/settings/store-form.php index 86d9ffc671..7c4cf3e7af 100644 --- a/templates/settings/store-form.php +++ b/templates/settings/store-form.php @@ -62,7 +62,7 @@
      - + banner ×
      @@ -102,7 +102,7 @@
      - + gravtar ×
      @@ -325,7 +325,7 @@ lang : dokan_helper.timepicker_locale, minTime : '12:00 am', maxTime : '11:30 pm', - timeFormat : '', + timeFormat : '', scrollDefault : 'now', }); diff --git a/webpack.config.js b/webpack.config.js index 74478d8e88..b4fcf9cd85 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -53,6 +53,7 @@ const entryPoint = { 'reverse-withdrawal-style': '/assets/src/less/reverse-withdrawal.less', 'dokan-product-category-ui': '/assets/src/less/dokan-product-category-ui.less', 'dokan-admin-product-style': '/assets/src/less/dokan-admin-product.less', + 'page-views': './assets/src/js/page-views.js', }; const updatedConfig = {