Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement order mark as recieved for customers. #2290

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

MdAsifHossainNadim
Copy link
Contributor

@MdAsifHossainNadim MdAsifHossainNadim commented Jun 10, 2024

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

#3428

Closes

How to test the changes in this Pull Request:

  • Steps or issue link

Changelog entry

**new:** Order mark as received for customers.

Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.

Before Changes

Describe the issue before changes with screenshots(s).

After Changes

Link

Feature Video (optional)

Link of detailed video if this PR is for a feature.

PR Self Review Checklist:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

  • New Features

    • Added a hook to modify switcher value based on shipping status.
    • Introduced page view tracking for posts with localStorage and AJAX.
  • Bug Fixes

    • Enhanced nonce validation for seller registration.
    • Improved error message handling and sanitization across various components.
    • Corrected withdraw limit processing during setup.
  • Documentation

    • Updated README with new plugin description, version compatibility, and feature highlights.
  • Style

    • Updated CSS for containment size, layout, and style adjustments.
    • Added CSS properties for better margin and line-height control.
  • Security

    • Enhanced output sanitization using wp_kses_post in multiple widgets and functions.
  • Refactor

    • Improved method signature clarity and parameter naming for better code readability and maintenance.
    • Consolidated nonce validation logic into a dedicated method.

Copy link
Contributor

coderabbitai bot commented Jun 10, 2024

Walkthrough

The recent update to the Dokan WooCommerce multivendor marketplace plugin encompasses various enhancements and bug fixes. Key changes include updates to the plugin description and compatibility in the README, improved security measures in multiple files, enhancements to widgets, and logic refinements in core functionalities such as vendor registration and product handling. These updates enhance user experience, security, and maintainability.

Changes

Files/Directories Change Summary
src/admin/components/Fields.vue Added logic to modify switcher value based on shipping receive status.
README.md Updated descriptions, version compatibility, and improved marketing language.
assets/css/dokan-tailwind.css, assets/css/style.css Introduced new CSS properties and styling adjustments.
assets/js/page-views.js, assets/src/js/page-views.js Implemented page view tracking using localStorage and AJAX.
dokan.php Updated plugin version and WooCommerce compatibility.
includes/Admin/SetupWizard.php Refined handling of the withdraw limit during setup.
includes/Admin/SetupWizardNoWC.php Sanitized error messages using esc_html.
includes/Admin/Hooks.php, includes/Order/Admin/Hooks.php Renamed parameters and applied security enhancements.
includes/PageViews.php Added script loading functionality and updated view tracking.
includes/REST/ProductController.php Renamed parameters and improved error handling.
includes/Registration.php Delegated nonce validation to a new validate_nonce method for modularity.
includes/ReverseWithdrawal/ReverseWithdrawal.php, includes/Traits/ChainableContainer.php Updated error messages and added phpcs comments.
includes/Widgets/BestSellingProducts.php, includes/Widgets/FilterByAttributes.php, includes/Widgets/ProductCategoryMenu.php, includes/Widgets/StoreCategoryMenu.php, includes/Widgets/TopratedProducts.php Enhanced output security and improved parameter handling.

Poem

In fields of code where changes bloom,
Tweaks and updates, dispelling gloom.
A plugin grows, both strong and bright,
With widgets, styles, and AJAX might.
Compatibility now up to date,
Security stands tall and straight.
🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3508b85 and 2f29b36.

Files selected for processing (1)
  • src/admin/components/Fields.vue (1 hunks)
Additional comments not posted (1)
src/admin/components/Fields.vue (1)

849-861: Adjust the switcher value based on the shipping receive status.

The implementation of the hook to adjust the switcher value based on the shipping receive status is well-integrated within the onToggleSwitch method. This change aligns with the PR objectives to allow customers to mark orders as received. Ensure that the hook behaves as expected under all conditions by conducting thorough testing.

@MdAsifHossainNadim MdAsifHossainNadim self-assigned this Jun 10, 2024
@MdAsifHossainNadim MdAsifHossainNadim added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval labels Jun 10, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2f29b36 and 4a375f7.

Files selected for processing (1)
  • src/admin/components/Fields.vue (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/admin/components/Fields.vue

@mrabbani mrabbani added 👍 Dev Review Done Upcoming Release and removed Needs: Dev Review It requires a developer review and approval Needs: Author Reply labels Jul 2, 2024
@shashwatahalder01 shashwatahalder01 added QA In Progress Dependency With Pro Needs: Testing This requires further testing and removed Needs: Testing This requires further testing QA In Progress labels Jul 3, 2024
Raad-Sheraz and others added 6 commits July 8, 2024 11:15
Updated description according to wp org team
…ess.Security.EscapeOutput.ExceptionNotEscaped` escaping (#2270)

* refactor: page view scripts load from template

* refactor: escaping tooltip text

* refactor: escaping dokan withdraw method title

* refactor: escaping installed error message

* style: ignore scaping wc_esc_json function

* refactor: escaping note and ship info

* refactor: heading control description

* style: ignore escaping the svg label image from radio image control

* refactor: shop order custom columns data

* refactor: escaping some text

* style: ignore escaping for back trace message

* refactor: escaping some variables

* style: ignore escaping for back trace message

* reactor: escaping some variables and some are ignored

* style: ignore escaping for some variables

* style: ignore escaping some variables

* update: add phpcs rule for exception output

* style: ignore escaping for dynamic content

* style: ignore escaping for dynamic content

* update: php method doc

* update: php method doc

* style: ignore escaping for dynamic content

* update: php method doc

* style: ignore escaping for dynamic content

* style: ignore escaping for dynamic content

* refactor: escpaing php variables

* refactor: escaping some variables

* refactor: escaping variables

* refactor: title text

* refactor: ecaping some text

* refactor: escaping localize text

* refactor: ecaping some text

* refactor: dynamic time format data

* update: phpcs rule set for capabilities

* update: phpcs config

* update: phpcs rule as per woocommerce

* refactor: phpcs issues

* added: Available roles in the phpcs for PHPCS check

* refactor: fix wp data sanitization errors for SetupWizard.php

* refactor: fix wp data sanitization errors for SetupWizardNoWC.php

* refactor: fix wp data sanitization errors for SetupWizard.php

* added: rules for custom sanitizing functions

* refactor: html markup escaping

* fix: template load issue for Page view

* refactor: docblock for return type `dokan_get_product_types`

* Update includes/Ajax.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update templates/settings/store-form.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* refactor: WordPress coding standards and security issues

* refactor: WordPress coding standards and security issues

* refactor: WordPress coding standards and security issues skip for non required code

* update: enqueue script instead of template `templates/page-views.php`

* update: using escaping `wp_kses_post($this->description);` instead of `wp_kses( $this->description, wp_kses_allowed_html( 'user_description' ) );`

* delete: old tempalte for `page-views.php`

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…ation form. (#2291)

* fix: Shop url rendered double slash when using WPML on vendor registration form.

* fix: phpcs issue.

* add: Used escaping function before shop url redered.

* add: Used escaping function before shop url rendered on seller registration form.
… bar (#2297)

* enhance: Direct links to the relevant settings from vendor progress bar

* fix: Missing navigation link for add address link on profile progress bar
…stomer-migration shortcode (#2308)

* fix: Fetal error in block editor on adding and editing page with customer migration shortcode

* refactor: Simplified error handling
@StalinDurjo StalinDurjo added QA In Progress and removed Needs: Testing This requires further testing labels Jul 11, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range, codebase verification and nitpick comments (1)
includes/PageViews.php (1)

6-6: Documentation update: Add a class description.

Consider adding a class description to provide context about the purpose of the PageViews class.

/**
 * Class PageViews
 *
 * Handles the logic for counting product post views.
 */
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4a375f7 and eb4e4e5.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (47)
  • README.md (3 hunks)
  • assets/css/dokan-tailwind.css (2 hunks)
  • assets/css/style.css (3 hunks)
  • assets/js/page-views.js (1 hunks)
  • assets/src/js/page-views.js (1 hunks)
  • dokan.php (2 hunks)
  • includes/Admin/Hooks.php (2 hunks)
  • includes/Admin/SetupWizard.php (2 hunks)
  • includes/Admin/SetupWizardNoWC.php (1 hunks)
  • includes/Ajax.php (5 hunks)
  • includes/Customizer/HeadingControl.php (1 hunks)
  • includes/Customizer/RadioImageControl.php (1 hunks)
  • includes/Frontend/MyAccount/BecomeAVendor.php (2 hunks)
  • includes/Order/Admin/Hooks.php (2 hunks)
  • includes/PageViews.php (1 hunks)
  • includes/REST/ProductController.php (6 hunks)
  • includes/Registration.php (4 hunks)
  • includes/ReverseWithdrawal/ReverseWithdrawal.php (2 hunks)
  • includes/Traits/ChainableContainer.php (2 hunks)
  • includes/Widgets/BestSellingProducts.php (2 hunks)
  • includes/Widgets/FilterByAttributes.php (4 hunks)
  • includes/Widgets/ProductCategoryMenu.php (3 hunks)
  • includes/Widgets/StoreCategoryMenu.php (4 hunks)
  • includes/Widgets/StoreContactForm.php (5 hunks)
  • includes/Widgets/StoreLocation.php (4 hunks)
  • includes/Widgets/StoreOpenClose.php (5 hunks)
  • includes/Widgets/TopratedProducts.php (3 hunks)
  • includes/functions-dashboard-navigation.php (2 hunks)
  • includes/functions.php (13 hunks)
  • includes/template-tags.php (4 hunks)
  • languages/dokan-lite.pot (39 hunks)
  • package.json (1 hunks)
  • phpcs.xml.dist (2 hunks)
  • readme.txt (3 hunks)
  • templates/account/update-customer-to-vendor.php (3 hunks)
  • templates/global/seller-registration-form.php (2 hunks)
  • templates/products/dokan-category-header-ui.php (1 hunks)
  • templates/products/dokan-category-ui.php (1 hunks)
  • templates/products/listing-status-filter.php (1 hunks)
  • templates/products/new-product.php (1 hunks)
  • templates/products/products-listing.php (2 hunks)
  • templates/settings/address-form.php (1 hunks)
  • templates/settings/bank-payment-method-settings.php (8 hunks)
  • templates/settings/payment.php (3 hunks)
  • templates/settings/store-form.php (3 hunks)
  • templates/whats-new.php (1 hunks)
  • webpack.config.js (1 hunks)
Files not summarized due to errors (1)
  • languages/dokan-lite.pot: Error: Message exceeds token limit
Files skipped from review due to trivial changes (13)
  • README.md
  • assets/src/js/page-views.js
  • dokan.php
  • includes/Customizer/RadioImageControl.php
  • includes/Traits/ChainableContainer.php
  • package.json
  • templates/account/update-customer-to-vendor.php
  • templates/products/dokan-category-ui.php
  • templates/products/listing-status-filter.php
  • templates/products/new-product.php
  • templates/settings/address-form.php
  • templates/settings/bank-payment-method-settings.php
  • webpack.config.js
Additional comments not posted (108)
assets/js/page-views.js (1)

1-1: Ensure localStorage and dokanPageViewsParams checks are secure.

While the script checks for the presence of localStorage and dokanPageViewsParams, it's important to ensure that the values being stored and retrieved are sanitized to prevent potential XSS attacks.

Ensure that the values stored in localStorage and used in dokanPageViewsParams are sanitized properly.

includes/Customizer/HeadingControl.php (1)

31-33: Good practice: Sanitizing the description output.

Using wp_kses_post to sanitize the description output is a good practice to prevent potential XSS attacks.

includes/PageViews.php (3)

26-37: Good practice: Localizing script parameters.

Localizing script parameters using wp_localize_script is a good practice to pass server-side data to client-side scripts securely.


39-48: Ensure proper user capability checks.

Ensure that the current user has the appropriate capabilities to view the product page and update the view count.

Ensure that the current user has the appropriate capabilities to view the product page and update the view count.


73-85: Good practice: Using check_ajax_referer for security.

Using check_ajax_referer to verify the AJAX request is a good practice to ensure that the request is valid and secure.

includes/ReverseWithdrawal/ReverseWithdrawal.php (2)

31-31: Verify proper output escaping.

Ensure that the output is properly escaped to prevent potential security issues, even if the PHPCS warnings are ignored.

Verify that the output is properly escaped to prevent potential security issues.


41-41: Verify proper output escaping.

Ensure that the output is properly escaped to prevent potential security issues, even if the PHPCS warnings are ignored.

Verify that the output is properly escaped to prevent potential security issues.

templates/products/dokan-category-header-ui.php (2)

16-16: Ensure at least one category is always present.

This change ensures that the chosen categories array has at least one category, preventing potential issues in subsequent code.


23-23: Add a label for chosen product category.

This change improves the user experience by providing a label for the category selection.

includes/Widgets/StoreCategoryMenu.php (4)

25-26: Improve documentation for widget method parameters.

This change enhances the documentation by providing clear descriptions of the parameters used in the widget method.


34-34: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


46-46: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


51-51: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.

includes/Widgets/ProductCategoryMenu.php (6)

26-27: Improve documentation for widget method parameters.

This change enhances the documentation by providing clear descriptions of the parameters used in the widget method.


36-36: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


39-39: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


46-50: Ensure correct taxonomy retrieval.

This change ensures that the category widget retrieves the correct taxonomy terms with the specified parameters, improving functionality.


53-53: Retrieve terms for specified taxonomy.

This change retrieves the terms for the specified taxonomy, ensuring that the widget displays the correct categories.


57-57: Output categories using CategoryWalker class.

This change outputs the categories using the CategoryWalker class, ensuring that the categories are displayed in a hierarchical format.

includes/Widgets/StoreLocation.php (4)

53-53: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


56-56: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


69-69: Enhance security with output sanitization.

This change enhances security by sanitizing the output using wp_kses_post, preventing potential XSS attacks.


79-80: Improve documentation for update method parameters.

This change enhances the documentation by providing clear descriptions of the parameters used in the update method.

includes/Widgets/StoreContactForm.php (6)

32-33: LGTM!

The function documentation update improves clarity and consistency.


62-62: LGTM!

The use of wp_kses_post for output sanitization enhances security.


65-65: LGTM!

The use of wp_kses_post for output sanitization of the title enhances security.


86-86: LGTM!

The use of wp_kses_post for output sanitization enhances security.


96-97: LGTM!

The function documentation update improves clarity and consistency.


110-110: LGTM!

The function documentation update improves clarity and consistency.

includes/Widgets/StoreOpenClose.php (6)

31-32: LGTM!

The function documentation update improves clarity and consistency.


64-64: LGTM!

The use of wp_kses_post for output sanitization enhances security.


67-67: LGTM!

The use of wp_kses_post for output sanitization of the title enhances security.


78-78: LGTM!

The use of wp_kses_post for output sanitization enhances security.


88-89: LGTM!

The function documentation update improves clarity and consistency.


103-103: LGTM!

The function documentation update improves clarity and consistency.

templates/global/seller-registration-form.php (3)

7-7: LGTM!

The new line improves readability.


8-9: LGTM!

The variables $home_url and $custom_store_url are defined appropriately.


35-38: LGTM!

The small block displays the home URL and custom store URL for better user experience.

includes/Widgets/TopratedProducts.php (3)

37-38: LGTM!

The use of wp_kses_post for output sanitization enhances security.


40-40: LGTM!

The use of wp_kses_post for output sanitization of the title enhances security.


50-50: LGTM!

The use of wp_kses_post for output sanitization enhances security.

templates/settings/payment.php (2)

15-15: LGTM!

The addition of the dokan-payment-methods-listing-wrapper div is appropriate for the new feature.


66-66: LGTM!

The addition of the small block to display additional information about the payment method is a good enhancement.

includes/Widgets/BestSellingProducts.php (3)

40-40: Good practice: Sanitize output.

Using wp_kses_post to sanitize the widget's output is a good security practice.


43-43: Good practice: Sanitize title output.

Using wp_kses_post to sanitize the widget's title output is a good security practice.


53-53: Good practice: Sanitize output.

Using wp_kses_post to sanitize the widget's after widget output is a good security practice.

includes/Admin/Hooks.php (2)

99-99: LGTM!

The addition of the select element for choosing vendors is appropriate and enhances the feature.


168-170: LGTM!

The method to override the product author by the admin is well-implemented and properly sanitizes the input.

includes/Widgets/FilterByAttributes.php (3)

41-41: LGTM!

The call to the method to get the taxonomy from the instance ensures the correct taxonomy is used for filtering products.


57-57: Good practice: Sanitize output.

Using wp_kses_post to sanitize the widget's output is a good security practice.


60-60: Good practice: Sanitize title output.

Using wp_kses_post to sanitize the widget's title output is a good security practice.

includes/Frontend/MyAccount/BecomeAVendor.php (2)

161-163: Avoid performing actions in admin context.

The added check ensures the method does not perform actions when accessed from the admin area, which is a good practice to prevent unintended side effects.


174-174: Ensure error message functions exist before calling.

The check ensures that the error message functions exist before calling them, which prevents potential runtime errors.

assets/css/dokan-tailwind.css (2)

49-52: Define custom properties for containment.

The added custom properties for containment are correctly defined and enhance the CSS capabilities.


102-105: Define custom properties for containment in backdrop.

The added custom properties for containment in the backdrop are correctly defined and enhance the CSS capabilities.

phpcs.xml.dist (2)

132-132: Add custom sanitizing functions.

The added custom sanitizing functions (wc_esc_json, dokan_sanitize_phone_number) are correctly defined and improve security.


206-206: Add custom capability for vendor staff.

The added custom capability (vendor_staff) is correctly defined and enhances the plugin's role management.

includes/Registration.php (4)

40-41: Delegate nonce validation to a new method.

The nonce validation is correctly delegated to the validate_nonce method, which improves modularity and readability.


88-89: Delegate nonce validation to a new method.

The nonce validation is correctly delegated to the validate_nonce method, which improves modularity and readability.


118-119: Delegate nonce validation to a new method.

The nonce validation is correctly delegated to the validate_nonce method, which improves modularity and readability.


229-239: Add nonce validation method.

The validate_nonce method correctly validates the nonce, enhancing security and modularity.

includes/Admin/SetupWizardNoWC.php (1)

132-132: Approved: Securely escaped error message in install_woocommerce function.

The error message is correctly escaped using esc_html to prevent potential XSS vulnerabilities.

includes/functions-dashboard-navigation.php (2)

217-217: Approved: Filter key for dashboard navigation menu.

The addition of rawurlencode_deep and apply_filters ensures that the navigation key is properly encoded and allows for customization.


250-250: Approved: Filter key for dashboard navigation submenu.

The addition of rawurlencode_deep and apply_filters ensures that the submenu key is properly encoded and allows for customization.

includes/Order/Admin/Hooks.php (2)

172-172: Approved: Improved parameter naming in admin_shop_order_row_classes.

The parameter name $class has been changed to $css_class for better clarity.


179-179: Approved: Improved parameter naming in admin_shop_order_row_classes.

The parameter name $class has been changed to $css_class for better clarity.

templates/products/products-listing.php (3)

138-138: Approved: Applied filters for product types.

The dokan_product_types filter allows for customization of product types.


254-255: Approved: Added pagination text customization.

The prev_text and next_text parameters for paginate_links are correctly set, allowing for translation.


260-260: Approved: Improved pagination output with proper escaping.

The pagination links are correctly outputted using implode with proper escaping.

templates/settings/store-form.php (3)

60-65: Verify proper escaping of variables.

Ensure that $banner_id and $banner_url are properly sanitized and escaped.

#!/bin/bash
# Description: Verify that variables `$banner_id` and `$banner_url` are properly sanitized and escaped.

# Test: Search for the variables' assignment and usage. Expect: Proper sanitization and escaping.
rg --type php -A 5 $'banner_id' | rg --type php -A 5 $'banner_url'

101-105: Verify proper escaping of variables.

Ensure that $gravatar_id and $gravatar_url are properly sanitized and escaped.

#!/bin/bash
# Description: Verify that variables `$gravatar_id` and `$gravatar_url` are properly sanitized and escaped.

# Test: Search for the variables' assignment and usage. Expect: Proper sanitization and escaping.
rg --type php -A 5 $'gravatar_id' | rg --type php -A 5 $'gravatar_url'

328-328: Verify proper usage of timepicker settings and validation logic.

Ensure that the timepicker settings and validation logic are correctly implemented.

#!/bin/bash
# Description: Verify that the timepicker settings and validation logic are correctly implemented.

# Test: Search for the timepicker initialization and validation logic. Expect: Proper settings and validation logic.
rg --type php -A 5 $'timepicker' | rg --type php -A 5 $'validation'
includes/template-tags.php (3)

274-277: Verify proper formatting and escaping of variables.

Ensure that the variables $status_label and $formatted_order_count are properly formatted and escaped.

#!/bin/bash
# Description: Verify that variables `$status_label` and `$formatted_order_count` are properly formatted and escaped.

# Test: Search for the variables' assignment and usage. Expect: Proper formatting and escaping.
rg --type php -A 5 $'status_label' | rg --type php -A 5 $'formatted_order_count'

Line range hint 299-309:
Verify proper sanitization and escaping of variables.

Ensure that the variables used in the store category menu are properly sanitized and escaped.

#!/bin/bash
# Description: Verify that the variables used in the store category menu are properly sanitized and escaped.

# Test: Search for the variables' assignment and usage. Expect: Proper sanitization and escaping.
rg --type php -A 5 $'seller_id' | rg --type php -A 5 $'vendor' | rg --type php -A 5 $'categories'

387-387: Verify proper sanitization and escaping of variables.

Ensure that the variables used in the store term menu list are properly sanitized and escaped.

#!/bin/bash
# Description: Verify that the variables used in the store term menu list are properly sanitized and escaped.

# Test: Search for the variables' assignment and usage. Expect: Proper sanitization and escaping.
rg --type php -A 5 $'term' | rg --type php -A 5 $'link' | rg --type php -A 5 $'checked'
includes/Ajax.php (3)

268-269: LGTM!

The increment operators are used correctly.


417-417: LGTM!

The usage of wp_kses_post ensures secure output.


487-487: LGTM!

The usage of wp_kses_post ensures secure output.

includes/Admin/SetupWizard.php (1)

737-743: LGTM! Improved input validation for withdraw_limit.

The changes improve input validation by ensuring the withdraw_limit is numeric and non-negative. This prevents potential issues with invalid input.

includes/REST/ProductController.php (2)

1200-1203: LGTM! Parameter renaming improves clarity.

The parameters in the prepare_links method have been renamed for better clarity. This change is appropriate and aligns with best practices.


Line range hint 1508-1520:
LGTM! Parameter renaming improves clarity.

The parameters in the set_product_images method have been renamed for better clarity. This change is appropriate and aligns with best practices.

However, ensure that all function calls to set_product_images match the new signature.

#!/bin/bash
# Description: Verify all function calls to `set_product_images` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type php -A 5 $'set_product_images'
readme.txt (4)

6-6: Approve version compatibility updates.

The updates to Tested up to, WC tested up to, and Stable tag ensure compatibility with the latest versions of WordPress and WooCommerce.

Also applies to: 8-8, 10-10


18-18: Approve description heading update.

The updated heading better reflects the plugin's capabilities and focus on being a powerful multivendor marketplace solution.


84-84: Approve interface description heading update.

The updated heading emphasizes the user-friendly nature of the frontend interface, which is a key selling point for the plugin.


350-356: Approve changelog additions for version 3.11.4.

The changelog entries provide clear and concise information about the updates and fixes included in version 3.11.4.

includes/functions.php (9)

109-109: LGTM!

The function uses absint to ensure the author ID is an integer.


135-135: LGTM!

The function correctly checks if the current page is a product edit page.


283-283: LGTM!

The SQL query to count stock posts is properly sanitized.


305-305: LGTM!

The SQL query to count stock posts is properly sanitized.


1092-1092: LGTM!

The function correctly retrieves a settings option and returns a default value if the option is not set.


1105-1105: LGTM!

The function correctly returns the default value if the option is not set.


1151-1151: LGTM!

The function correctly checks if the seller is trusted by retrieving the dokan_publishing meta value.


1192-1192: LGTM!

The function correctly retrieves the current page URL using add_query_arg.


1193-1193: LGTM!

The function correctly retrieves the current page URL with query parameters using add_query_arg.

templates/whats-new.php (3)

6-31: Changelog entry for version 3.11.4 looks good!

The structure and content of the new changelog entry are consistent with the existing entries.


32-43: Changelog entry for version 3.11.3 looks good!

The structure and content of the existing changelog entry are consistent with the other entries.


Line range hint 44-332:
Changelog entries for previous versions look good!

The structure and content of the existing changelog entries are consistent with the other entries.

assets/css/style.css (2)

6378-6394: LGTM! Verify the responsiveness of the .dokan-dashboard layout.

The changes introduce flexbox properties to improve layout flexibility and responsiveness.

However, ensure that the responsiveness works as expected across different screen sizes.

#!/bin/bash
# Description: Verify the responsiveness of the `.dokan-dashboard` layout.

# Test: Check for the flexbox properties in the `.dokan-dashboard` class and its child elements.
rg --type css -A 5 $'.dokan-dashboard'

6386-6394: LGTM! Verify the visual consistency of the .dokan-dashboard-menu layout.

The changes adjust the layout and border properties to improve visual consistency.

However, ensure that the visual consistency works as expected across different screen sizes.

#!/bin/bash
# Description: Verify the visual consistency of the `.dokan-dashboard-menu` layout.

# Test: Check for the border properties in the `.dokan-dashboard-menu` class and its child elements.
rg --type css -A 5 $'.dokan-dashboard-menu'
languages/dokan-lite.pot (9)

4-4: Verify metadata format and correctness.

Ensure the Project-Id-Version, Report-Msgid-Bugs-To, Last-Translator, Language-Team, MIME-Version, Content-Type, and Content-Transfer-Encoding fields are correctly formatted and accurate.


11-11: Verify POT-Creation-Date format.

Ensure the POT-Creation-Date follows the correct format: YYYY-MM-DDTHH:MM:SS+ZZ:ZZ.


137-137: Verify translation context and correctness.

Ensure the translation for "Withdraw" is contextually accurate and correctly formatted.


1043-1043: Verify translation context and correctness.

Ensure the translation for "Phone Number" is contextually accurate and correctly formatted.


1082-1082: Verify translation context and correctness.

Ensure the translation for "Your personal data will be used to support your experience throughout this website..." is contextually accurate and correctly formatted.


1309-1309: Verify translation context and correctness.

Ensure the translation for "Your Marketplace is Ready!" is contextually accurate and correctly formatted.


1313-1313: Verify translation context and correctness.

Ensure the translation for "Visit Dokan Dashboard" is contextually accurate and correctly formatted.


1317-1317: Verify translation context and correctness.

Ensure the translation for "More Settings" is contextually accurate and correctly formatted.


1321-1321: Verify translation context and correctness.

Ensure the translation for "The following plugins will be installed and activated for you:" is contextually accurate and correctly formatted.

@@ -0,0 +1 @@
jQuery(document).ready((function(a){if(!localStorage)return;if(!window.dokanPageViewsParams)return;let o=(new Date).toISOString().slice(0,10),e=JSON.parse(localStorage.getItem("dokan_pageview_count"));(null===e||e.today&&e.today!==o)&&(e={today:o,post_ids:[]}),e.post_ids.includes(window.dokanPageViewsParams.post_id)||(a.post(window.dokanPageViewsParams.ajax_url,{action:"dokan_pageview",_ajax_nonce:window.dokanPageViewsParams.nonce,post_id:window.dokanPageViewsParams.post_id}),e.post_ids.push(window.dokanPageViewsParams.post_id),localStorage.setItem("dokan_pageview_count",JSON.stringify(e)))}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optimize the script for better readability and maintainability.

The current script is written in a single line, making it difficult to read and maintain. Consider breaking it down into multiple lines and using meaningful variable names for better readability and maintainability.

jQuery(document).ready(function($) {
    if (!localStorage || !window.dokanPageViewsParams) return;

    let today = (new Date()).toISOString().slice(0, 10);
    let pageViewData = JSON.parse(localStorage.getItem("dokan_pageview_count"));

    if (!pageViewData || pageViewData.today !== today) {
        pageViewData = { today: today, post_ids: [] };
    }

    if (!pageViewData.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
        });

        pageViewData.post_ids.push(window.dokanPageViewsParams.post_id);
        localStorage.setItem("dokan_pageview_count", JSON.stringify(pageViewData));
    }
});

wp_die();
}

private $meta_key = 'pageview';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency: Use visibility modifiers for class properties.

Add visibility modifiers (e.g., private, protected, public) to class properties for better code consistency and readability.

private $meta_key = 'pageview';

Comment on lines +57 to +66
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}" );
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle potential errors when updating post meta.

Consider adding error handling when updating the post meta to ensure that any issues are properly logged and addressed.

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;

        if ( ! update_post_meta( $post_id, $this->meta_key, $new_views, $old_views ) ) {
            error_log( "Failed to update page view count for post ID: $post_id" );
        }

        $seller_id = get_post_field( 'post_author', $post_id );
        Cache::delete( "pageview_{$seller_id}" );
    }
}

@StalinDurjo StalinDurjo added QA approved This PR is approved by the QA team and removed QA In Progress labels Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants