Skip to content

Commit

Permalink
Update and fix safe redirect to purchase link
Browse files Browse the repository at this point in the history
  • Loading branch information
kawsarahmedr committed Sep 1, 2024
1 parent 2f826d0 commit 7a56d13
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function __construct() {
add_filter( 'woocommerce_screen_ids', array( $this, 'screen_ids' ) );
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), PHP_INT_MAX );
add_filter( 'update_footer', array( $this, 'update_footer' ), PHP_INT_MAX );
add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_redirect_hosts' ) );
}

/**
Expand Down Expand Up @@ -182,4 +183,19 @@ public static function view( $view, $args = array(), $path = '' ) {

include $file;
}

/**
* Allowed redirect hosts.
*
* @param array $hosts Allowed hosts.
*
* @since 1.0.0
* @return array
*/
public function allowed_redirect_hosts( $hosts ) {
$hosts[] = 'pluginever.com';
$hosts[] = 'www.pluginever.com';

return $hosts;
}
}
4 changes: 2 additions & 2 deletions src/Admin/Menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ public function output_reports_page() {
public function go_pro_redirect() {
wp_verify_nonce( '_nonce' );
if ( isset( $_GET['page'] ) && 'go_wcsn_pro' === $_GET['page'] ) {
wp_redirect( 'https://pluginever.com/plugins/woocommerce-serial-numbers-pro/?utm_source=admin-menu&utm_medium=link&utm_campaign=upgrade&utm_id=wc-serial-numbers' );
die;
wp_safe_redirect( 'https://pluginever.com/plugins/woocommerce-serial-numbers-pro/?utm_source=admin-menu&utm_medium=link&utm_campaign=upgrade&utm_id=wc-serial-numbers' );
exit;
}
}

Expand Down

0 comments on commit 7a56d13

Please sign in to comment.