Skip to content

Commit

Permalink
Merge branch 'develop' into pw
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Jan 28, 2025
2 parents b191c43 + 59d769f commit c6bbd8d
Show file tree
Hide file tree
Showing 47 changed files with 327 additions and 61 deletions.
40 changes: 40 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/.wordpress-org
/.git
/.github
/node_modules
/src
/tests
/bin
/docs
/build
/.idea
/.vscode
/assets/src

.distignore
.gitignore
/**/.DS_Store
/**/*.LICENCE.txt
package.json
package-lock.json
composer.json
composer.lock
README.md
CHANGELOG.md
LICENSE
phpcs.xml.dist
phpunit.xml.dist
phpunit.xml
.editorconfig
.eslintrc
.php_cs
.phpunit.result.cache
.prettierrc.js
appsero.json
CONTRIBUTING.md
DEVELOPER.md
event.json
postcss.config.js
webpack.config.js
tailwind.config.js
/
44 changes: 44 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy and Release Plugin to WP.org

on:
push:
tags:
- "*"
jobs:
releaseToWPOrg:
name: Release to WordPress.org
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer:v2
- name: Build
run: |
composer install --no-dev
npm install
npm run build
- name: Install SVN ( Subversion )
run: |
sudo apt-get update
sudo apt-get install subversion
- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
dry-run: ${{ env.DRY_RUN }}
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: dokan-lite
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Binary file added .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-13.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-14.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-15.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-16.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-17.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-18.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-19.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-5.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-6.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-7.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-8.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/screenshot-9.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 14 additions & 14 deletions assets/src/less/admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,37 @@
margin-right: 24px;
flex: 1;
.version-tag {

border-radius: 20px;
font-size: 1rem;
line-height: 20px;
font-weight: 400;
padding: 0.5rem 1rem;
max-height: 2rem;
font-size: 12px;
line-height: 16px;
font-weight: 500;
height: 30px;
box-sizing: border-box;
&.lite {
background: #FF9B5366;
color: #7B4E2E;
display: flex;
align-items: center;
padding: 0 12px;
}

&.pro {
background: #D8D8FE;
color: @dokan-color;
display: flex;
align-items: center;
gap: 8px;
text-transform: capitalize;
font-weight: 450;
padding: 5px 9px 5px 5px;
gap: 6px;
& .version-tag-pro-badge{
background: @dokan-color;
color: white;
border-radius: 28px;
display: inline-flex;
align-items: center;
padding: 3px 9px;
font-size: 16px;
margin: -10px 0 -10px -10px;
padding: 3px 8px;
font-size: 12px;
gap: 3px;
}
}
}
Expand Down Expand Up @@ -148,7 +148,7 @@
.dropdown {
opacity: 1;
visibility: visible;
top: 42px;
top: 50px;
}
}

Expand All @@ -162,7 +162,7 @@
padding: 20px;
border-radius: 3px;
border: 1px solid #e2e2e2;
box-shadow: 0 6px 12px rgb(129 129 129 / 6%);
box-shadow: 0 8px 10px #ccc;
min-width: 255px;
max-width: 255px;
opacity: 0;
Expand Down Expand Up @@ -199,7 +199,7 @@

.list-item {
margin-top: 13px;

list-style-type: none;
a {
display: flex;
align-items: center;
Expand Down
8 changes: 8 additions & 0 deletions assets/src/less/global-admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,11 @@
}
}
}



// wp dokan logo styles

#adminmenu #toplevel_page_dokan .wp-menu-image.svg {
background-size: 17px;
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "GPL2",
"authors": [
{
"name": "weDevs",
"email": "info@wedevs.com"
"name": "Dokan Inc.",
"email": "info@dokan.co"
}
],
"minimum-stability": "dev",
Expand Down
6 changes: 3 additions & 3 deletions dokan.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Plugin URI: https://dokan.co/wordpress/
* Description: An e-commerce marketplace plugin for WordPress. Powered by WooCommerce and weDevs.
* Version: 3.14.6
* Author: weDevs
* Author URI: https://dokan.co/
* Author: Dokan Inc.
* Author URI: https://dokan.co/wordpress/
* Text Domain: dokan-lite
* Requires Plugins: woocommerce
* WC requires at least: 8.0.0
Expand All @@ -15,7 +15,7 @@
*/

/*
* Copyright (c) 2019 weDevs (email: info@wedevs.com). All rights reserved.
* Copyright (c) 2025 Dokan Inc. (email: info@dokan.co). All rights reserved.
*
* Released under the GPL license
* http://www.opensource.org/licenses/gpl-license.php
Expand Down
13 changes: 11 additions & 2 deletions includes/Admin/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ public function add_admin_menu() {
// translators: %s: withdraw count
$withdraw_text = sprintf( __( 'Withdraw %s', 'dokan-lite' ), '<span class="awaiting-mod count-1"><span class="pending-count">' . $withdraw['pending'] . '</span></span>' );
}

$dashboard = add_menu_page( __( 'Dokan', 'dokan-lite' ), __( 'Dokan', 'dokan-lite' ), $capability, $slug, [ $this, 'dashboard' ], 'data:image/svg+xml;base64,' . base64_encode( '<svg xmlns="http://www.w3.org/2000/svg" width="52" height="62" fill="#fff"><path opacity=".5" d="M36.265 29.552c-.043 10.6-4.597 21.543-14.007 26.521C15.64 59.592 0 62.295 0 50.837V8.181C0 1.83 5.371-.273 10.742.028c7.992.429 15.64 4.163 20.281 11.029 2.965 4.377 4.597 9.656 5.113 14.977.043 1.201.129 2.36.129 3.519z"/><path d="M51.088 25.819c-.902-8.754-6.273-16.093-13.707-20.513-4.287-2.569-9.511-3.458-12.924.218-1.104 1.189-1.818 2.742-2.593 4.168L1.332 47.404c-1.89 3.478-1.46 6.352.258 8.712 2.578 3.519 7.691 5.107 11.859 5.536 3.867.429 7.777 0 11.515-.858 11.3-2.575 21.312-10.256 24.706-21.414 1.332-4.377 1.891-8.969 1.418-13.561z"/></svg>' ), $menu_position );
$menu_icon = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxNSAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxwYXRoIGQ9Ik0xMC41NDU4IDguNjA0NjVDMTAuNTMzMyAxMS42OTA5IDk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MjM3IDE2LjMzOTNDOS4yMDg3OCAxNC44Nzc0IDEwLjUzMzMgMTEuNjkxMiAxMC41NDU3IDguNjE3NDFDMTAuNTQ1NyA4LjI4MDA1IDEwLjUzMzMgNy45NDI2OCAxMC40OTU4IDcuNjA1MzJDMTAuMzU4MyA2LjA1NTkzIDkuODcxMDIgNC41MTkwNCA5LjAwODg2IDMuMjQ0NTVDOC41MzQwNSAyLjUzMjMzIDcuOTQ2NzggMS45NDUwNyA3LjI4NDU0IDEuNDU3NzZDNy4wNzIxMyAxLjY0NTE5IDYuODcyMjEgMS44OTUwOSA2LjcwOTc3IDIuMjA3NDdDNi43MDk3NyAyLjIxOTk2IDAuMzk5Nzg0IDEzLjgxNTMgMC4zOTk3ODQgMTMuODE1M0MtMC4wMTI1NTI1IDE0LjU2NSAtMC4wMzc1NDQ4IDE1LjIyNzMgMC4xNzQ4NzEgMTUuODAyMUMwLjE3NDg3MSAxNS44MTQ2IDAuMTg3MzY2IDE1LjgyNyAwLjE4NzM2NiAxNS44Mzk1QzAuMTk5ODYyIDE1Ljg2NDUgMC4yMTIzNTUgMTUuOTAyIDAuMjI0ODUgMTUuOTI3QzAuMjM3MzQ1IDE1Ljk1MiAwLjIzNzM0NyAxNS45NjQ1IDAuMjQ5ODQyIDE1Ljk4OTVDMC4yNDk4NDIgMTYuMDAyIDAuMjYyMzM3IDE2LjAxNDUgMC4yNjIzMzcgMTYuMDE0NUMxLjI0OTQ0IDE3LjkxMzcgNC44MjMwMiAxNy4yMTQgNi40NzIzNyAxNi4zMzkzWiIgZmlsbD0iIzlFQTNBOCIvPgogICAgPC9zdmc+';

$dashboard = add_menu_page(
__( 'Dokan', 'dokan-lite' ),
__( 'Dokan', 'dokan-lite' ),
$capability,
$slug,
[ $this, 'dashboard' ],
$menu_icon,
$menu_position
);

if ( current_user_can( $capability ) ) {
$submenu[ $slug ][] = [ __( 'Dashboard', 'dokan-lite' ), $capability, 'admin.php?page=' . $slug . '#/' ];
Expand Down
4 changes: 2 additions & 2 deletions includes/Analytics/Reports/BaseQueryFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function add_where_subquery( array $clauses ): array {
* @return array The modified where clauses.
*/
protected function add_where_subquery_for_refund( array $clauses ): array {
if ( ! isset( $_GET['refunds'] ) ) {
if ( ! isset( $_GET['refunds'] ) ) { //phpcs:ignore
return $clauses;
}

Expand Down Expand Up @@ -176,6 +176,6 @@ public function get_vendor_id() {
return dokan_get_current_user_id();
}

return (int) ( wp_unslash( $_GET['sellers'] ?? 0 ) ); // phpcs:ignore
return (int) ( wp_unslash( $_GET['sellers'] ?? 0 ) ); // phpcs:ignore
}
}
115 changes: 115 additions & 0 deletions includes/Analytics/Reports/CacheKeyModifier.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

namespace WeDevs\Dokan\Analytics\Reports;

use WeDevs\Dokan\Contracts\Hookable;

/**
* Seller analytics data filter.
*
* @since DOKAN_SINCE
*/
class CacheKeyModifier implements Hookable {

/**
* Report entities to modify.
*
* @since DOKAN_SINCE
*
* @var array
*/
protected array $entities;

/**
* CacheKeyModifier constructor.
* Registers the hooks on instantiation.
*/
public function __construct() {
$this->setup_entities();
$this->register_hooks();
}

/**
* Setup analytics entities
*
* @since DOKAN_SINCE
*
* WC apply filters from @see https://github.com/woocommerce/woocommerce/blob/be602de39d39878085e752f30ec1dabf16b0d642/plugins/woocommerce/src/Admin/API/Reports/GenericQuery.php#L77
* WC reports generation pattern @see https://github.com/woocommerce/woocommerce/blob/be602de39d39878085e752f30ec1dabf16b0d642/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php#L53
*
* @return void
*/
protected function setup_entities(): void {
$this->entities = apply_filters(
'dokan_analytics_entities_for_query_args',
[
'categories',
'coupons',
'coupons_stats',
'customers',
'downloads',
'downloads_stats',
'orders',
'orders_stats',
'products',
'products_stats',
'revenue',
'taxes',
'taxes_stats',
'variations',
'variations_stats',
]
);
}

/**
* Register necessary hooks.
*
* @since DOKAN_SINCE
*
* @return void
*/
public function register_hooks(): void {
foreach ( $this->entities as $entity ) {
add_filter( "woocommerce_analytics_{$entity}_query_args", [ $this, 'apply_seller_filter' ] );
}
}

/**
* Apply seller filter to query arguments.
*
* Customize the WooCommerce analytics stats datastore to override the $total_query and $interval_query properties.
* This modification replaces the Automattic\WooCommerce\Admin\API\Reports\SqlQuery class with WeDevs\Dokan\Analytics\Reports\WcSqlQuery
* to apply specific filters to queries.
*
* @see https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/src/Admin/API/Reports
*
* @param array $args An array of query arguments.
*
* @return array Modified array of query arguments.
*/
public function apply_seller_filter( array $args ): array {
$seller_id = (int) dokan()->get_container()->get( \WeDevs\Dokan\Analytics\Reports\Stock\QueryFilter::class )->get_vendor_id();

// If seller ID is not set, return the original arguments.
if ( ! $this->is_valid_seller_id( $seller_id ) ) {
return $args;
}

$args['seller_id'] = $seller_id;
return $args;
}

/**
* Check if report can be filtered.
*
* @param int $seller_id Seller ID.
*
* @since DOKAN_SINCE
*
* @return bool
*/
protected function is_valid_seller_id( int $seller_id ): bool {
return $seller_id > 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class AnalyticsServiceProvider extends BaseServiceProvider {
\WeDevs\Dokan\Analytics\Reports\Variations\Stats\QueryFilter::class,
\WeDevs\Dokan\Analytics\Reports\Categories\QueryFilter::class,
\WeDevs\Dokan\Analytics\Reports\DataStoreModifier::class,
\WeDevs\Dokan\Analytics\Reports\CacheKeyModifier::class,
\WeDevs\Dokan\Analytics\Reports\Taxes\QueryFilter::class,
\WeDevs\Dokan\Analytics\Reports\Taxes\Stats\QueryFilter::class,
\WeDevs\Dokan\Analytics\Reports\Coupons\QueryFilter::class,
Expand Down
2 changes: 2 additions & 0 deletions includes/REST/DummyDataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function register_routes() {
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'import_dummy_data_status' ),
'permission_callback' => array( $this, 'get_permissions_check' ),
'args' => [], // No args needed.
),
)
);
Expand All @@ -63,6 +64,7 @@ public function register_routes() {
'methods' => WP_REST_Server::DELETABLE,
'callback' => array( $this, 'clear_dummy_data' ),
'permission_callback' => array( $this, 'get_permissions_check' ),
'args' => [], // No args needed.
),
)
);
Expand Down
2 changes: 2 additions & 0 deletions includes/REST/ReverseWithdrawalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function register_routes() {
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_transaction_types' ],
'permission_callback' => [ $this, 'get_transaction_types_permissions_check' ],
'args' => $this->get_collection_params(), // It returns a collection of items, can added pagination type support
],
'schema' => [ $this, 'get_public_item_schema_for_transaction_types' ],
]
Expand All @@ -114,6 +115,7 @@ public function register_routes() {
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_stores' ],
'permission_callback' => [ $this, 'get_stores_permissions_check' ],
'args' => $this->get_collection_params(), // This is a collection endpoint
],
'schema' => [ $this, 'get_public_schema_for_stores' ],
]
Expand Down
Loading

0 comments on commit c6bbd8d

Please sign in to comment.