-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from codersaiful/3.4.5.0
3.4.5.0
- Loading branch information
Showing
30 changed files
with
844 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ public function __construct() | |
$this->is_pro = defined( 'WPT_PRO_DEV_VERSION' ); | ||
if($this->is_pro && class_exists( '\WOO_Product_Table' ) ){ | ||
$this->pro_version = WPT_PRO_DEV_VERSION; | ||
// $this->license = \WOO_Product_Table::$direct; | ||
$this->handle_license_n_update(); | ||
} | ||
$this->page_folder_dir = $this->base_dir . 'admin/page/'; | ||
$this->topbar_file = $this->page_folder_dir . 'topbar.php'; | ||
|
@@ -47,12 +47,14 @@ public function configure_page_render() | |
} | ||
public function admin_menu() | ||
{ | ||
add_submenu_page( $this->main_slug, esc_html__( 'Configuration', 'woo-product-table' ), esc_html__( 'Configure', 'woo-product-table' ), WPT_CAPABILITY, 'woo-product-table-config', [$this, 'configure_page_render'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Tutorials', 'woo-product-table' ), __( 'Tutorial', 'woo-product-table' ), WPT_CAPABILITY, 'wpt-live-support', [$this, 'html_tutorial_page'] ); | ||
$proString = $this->is_pro ? esc_html__( ' Pro', 'woo-product-table' ) : ''; | ||
add_submenu_page( $this->main_slug, esc_html__( 'Configuration ', 'woo-product-table' ) . $proString, esc_html__( 'Configure', 'woo-product-table' ), WPT_CAPABILITY, 'woo-product-table-config', [$this, 'configure_page_render'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Tutorials', 'woo-product-table' ). $proString, __( 'Tutorial', 'woo-product-table' ), WPT_CAPABILITY, 'wpt-live-support', [$this, 'html_tutorial_page'] ); | ||
|
||
|
||
add_submenu_page( $this->main_slug, esc_html__( 'Browse Plugins', 'woo-product-table' ), __( 'Browse Plugins', 'woo-product-table' ), WPT_CAPABILITY, 'wpt-browse-plugins',[$this, 'browse_plugins_html'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Issue Submit', 'woo-product-table' ), __( 'Issue Submit', 'woo-product-table' ), WPT_CAPABILITY, 'https://github.com/codersaiful/woo-product-table/issues/new' ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Browse Plugins', 'woo-product-table' ). $proString, __( 'Browse Plugins', 'woo-product-table' ), WPT_CAPABILITY, 'wpt-browse-plugins',[$this, 'browse_plugins_html'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Addons', 'woo-product-table' ). $proString, __( 'Addons', 'woo-product-table' ), WPT_CAPABILITY, 'wpt-addons-list',[$this, 'addons_list_html'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Issue Submit', 'woo-product-table' ). $proString, __( 'Issue Submit', 'woo-product-table' ), WPT_CAPABILITY, 'https://github.com/codersaiful/woo-product-table/issues/new' ); | ||
if( ! $this->is_pro ){ | ||
add_submenu_page( $this->main_slug, esc_html__( 'Try Pro Version', 'woo-product-table' ), esc_html__( 'Try Pro Version', 'woo-product-table' ), WPT_CAPABILITY, 'https://try.wooproducttable.com/wp-admin/?utm=PluginDashboard' ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'GET PRO VERSION', 'woo-product-table' ), __( '<i>Get <strong>Pro</strong></i>', 'woo-product-table' ), WPT_CAPABILITY, 'https://wooproducttable.com/pricing/' ); | ||
|
@@ -120,6 +122,15 @@ public function browse_plugins_html() | |
} | ||
include $this->page_folder_dir . 'browse-plugins.php'; | ||
} | ||
public function addons_list_html() | ||
{ | ||
$this->topbar_sub_title = __( 'Addons','woo-product-table' ); | ||
include $this->topbar_file; | ||
if( ! $this->is_pro ){ | ||
include $this->page_folder_dir . 'premium-link-header.php'; | ||
} | ||
include $this->page_folder_dir . 'addons-list.php'; | ||
} | ||
public function html_tutorial_page() | ||
{ | ||
//In future, I will make it like min max plugin - which I already did | ||
|
@@ -131,4 +142,85 @@ public function html_tutorial_page() | |
} | ||
include $this->page_folder_dir . 'tutorials.php'; | ||
} | ||
|
||
/** | ||
* If will work, when only found pro version | ||
* | ||
* @since 3.4.3.0 | ||
* @author Saiful Islam <[email protected]> | ||
* | ||
* @return void | ||
*/ | ||
public function handle_license_n_update() | ||
{ | ||
$this->license_key = get_option( 'wpt_pro_license_key' ); | ||
if(empty($this->license_key)) return; | ||
$this->license_data_key = 'wpt_license_data'; | ||
$this->license_status_key = 'wpt_pro_license_status'; | ||
$this->license_status = get_option( $this->license_status_key ); | ||
$this->license_data = get_option($this->license_data_key); | ||
/** | ||
* Actually if not found lisen data, we will return null here | ||
* | ||
* @since 3.4.3.0 | ||
* @author Saiful Islam <[email protected]> | ||
*/ | ||
if( empty( $this->license_status ) || empty( $this->license_data ) ) return; | ||
|
||
$expires = isset($this->license_data->expires) ? $this->license_data->expires : ''; | ||
$this->item_id = isset($this->license_data->item_id) ? $this->license_data->item_id : ''; | ||
if('lifetime' == $expires) return; | ||
$exp_timestamp = strtotime($expires); | ||
/** | ||
* keno ami ei timestamp niyechi. | ||
* asole expire a zodi faka ase, tahole ta 1 jan, 1970 as strtotime er output. | ||
* | ||
* ar jehetu amora 2010 er por kaj suru korechi. tai sei expire date ba ager date asar kOnO karonoi nai. | ||
* tai zodi 2012 er kom timestamp ase amora return null kore debo. | ||
* za already diyechi: if( $exp_timestamp < $year2010_timestamp ) return; by this line. niche follow korun. | ||
*/ | ||
$year2010_timestamp = strtotime('2023-09-08 23:59:59'); | ||
if( $exp_timestamp < $year2010_timestamp ) return; | ||
|
||
//ekhon amora bortoman date er sathe tulona korbo | ||
if($exp_timestamp < time()){ | ||
|
||
$this->exp_timestamp = $exp_timestamp; | ||
// var_dump($this->license_data); | ||
if($this->license_status == 'valid'){ | ||
$this->invalid_status = 'invalid'; | ||
$this->license_data->license = $this->invalid_status; | ||
update_option( $this->license_status_key, $this->invalid_status ); | ||
update_option( $this->license_data_key, $this->license_data ); | ||
|
||
|
||
} | ||
add_action( 'admin_notices', [$this, 'renew_license_notice'] ); | ||
} | ||
|
||
|
||
} | ||
|
||
public function renew_license_notice() | ||
{ | ||
|
||
if(empty($this->item_id)) return; | ||
$wpt_logo = WPT_ASSETS_URL . 'images/logo.png'; | ||
$expired_date = date( 'd M, Y', $this->exp_timestamp ); | ||
$link_label = __( 'Renew License', 'wpt_pro' ); | ||
$link = "https://codeastrology.com/checkout/?edd_license_key={$this->license_key}&download_id={$this->item_id}"; | ||
$message = esc_html__( ' Renew it to get latest update.', 'wpt_pro' ) . '</strong>'; | ||
ob_start(); | ||
?> | ||
<div class="error wpt-renew-license-notice"> | ||
<div class="wpt-license-notice-inside"> | ||
<img src="<?php echo esc_url( $wpt_logo ); ?>" class="wpt-license-brand-logo"> | ||
Your License of <strong>Woo Product Table pro</strong> has been expired at <span style="color: #d00;font-weight:bold;"><?php echo esc_html( $expired_date ); ?></span> | ||
%1$s <a href="%2$s" target="_blank">%3$s</a> | ||
</div> | ||
</div> | ||
<?php | ||
$full_message = ob_get_clean(); | ||
printf( $full_message, $message, $link, $link_label ); | ||
} | ||
} |
Oops, something went wrong.