Skip to content

Commit

Permalink
Merge pull request #365 from Invizo/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
code-with-mehedi authored Jan 15, 2024
2 parents f7c25b3 + 9f59616 commit a156a32
Show file tree
Hide file tree
Showing 366 changed files with 8,124 additions and 5,999 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- uses: actions/checkout@master
- name: Build
run: |
composer install
npm install
npm run build
- name: WordPress Plugin Deploy
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ vendor
.idea
lerna-debug.log
assets/build/
includes/modules/*/assets/build/
Includes/Modules/*/assets/build/
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Add misc dashbaord end hooks inside this class.
*/
class Admin_Hooks {
class AdminHooks {

use Singleton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Add admin menus inside this class.
*/
class Admin_Menu {
class AdminMenu {

use Singleton;

Expand Down Expand Up @@ -90,6 +90,26 @@ public function register_admin_menu() {
array( $this, 'settings_callback' )
);

add_submenu_page(
'sales-booster-for-woocommerce',
__( 'Documentaion', 'storegrowth-sales-booster' ),
__( 'Documentaion', 'storegrowth-sales-booster' ),
'manage_options',
'go-sgsb-docs',
array( $this, 'handle_external_redirects' )
);

if ( ! SGSB_PRO_ACTIVE ) {
add_submenu_page(
'sales-booster-for-woocommerce',
__( 'Upgrade to Pro', 'storegrowth-sales-booster' ),
'<span class="dashicons dashicons-star-filled" style="font-size: 17px"></span> ' . esc_html__( 'Upgrade to Pro', 'storegrowth-sales-booster' ),
'manage_options',
'go-sgsb-pro',
array( $this, 'handle_external_redirects' )
);
}

// Remove own submenu of `StoreGrowth`.
remove_submenu_page( 'sales-booster-for-woocommerce', 'sales-booster-for-woocommerce' );
}
Expand All @@ -116,4 +136,31 @@ public function dashboard_callback() {
wp_safe_redirect( $redirect_url );
exit;
}

/**
* Redirect to a specific URL.
*
* @param string $url The URL to redirect to.
*/
private function redirect_to_url( $url ) {
if ( ! empty( $url ) ) {
wp_redirect( $url );
exit;
}
}

/**
* Handle external redirects based on the requested page.
*/
public function handle_external_redirects() {
$redirect_pages = array(
'go-sgsb-pro' => 'https://www.storegrowth.io/pricing',
'go-sgsb-docs' => 'https://storegrowth.io/docs/',
);

if ( ! empty( $_GET['page'] ) && isset( $redirect_pages[ $_GET['page'] ] ) ) {
$redirect_url = $redirect_pages[ $_GET['page'] ];
$this->redirect_to_url( $redirect_url );
}
}
}
Loading

0 comments on commit a156a32

Please sign in to comment.