Skip to content

Commit

Permalink
Merge pull request #308 from codersaiful/3.4.5.0
Browse files Browse the repository at this point in the history
3.4.5.0
  • Loading branch information
codersaiful authored Nov 30, 2023
2 parents bb465ef + a4154a2 commit 57a6663
Show file tree
Hide file tree
Showing 30 changed files with 844 additions and 144 deletions.
4 changes: 2 additions & 2 deletions admin/action-hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ function wpto_admin_configuration_form_top_free($settings,$current_config_value)
<td>
<div class="wpt-form-control">
<div class="form-label col-lg-6">
<label class="wpt_label wpt_advance_search_on_of" for="wpt_table_on_archive">Table on Archives</label>
<label class="wpt_label wpt_advance_search_on_of" for="wpt_table_on_archive">Table on Shop/Archives/Taxonomy</label>
</div>
<div class="form-field col-lg-6">
<select name="data[archive_table_id]" class="wpt_fullwidth ua_input wpt_table_on_archive">
Expand All @@ -1667,7 +1667,7 @@ function wpto_admin_configuration_form_top_free($settings,$current_config_value)
<td>
<div class="wpt-form-info">
<a href="https://wooproducttable.com/docs/doc/table-options/product-table-woocommerce-archive-category-tag-attribute-page/" target="_blank" class="wpt-doc-lick">Helper doc</a>
<p>Enable Table on Archive Page. Such as: Archive Page, Tag Page, Taxonomy Page. First Select a table and check [On] to show in shop/archive page.</p>
<p>Enable Table on Shop/Archive/Taxonomy Page. Such as: Archive Page, Tag Page, Taxonomy Page. First Select a table and check [On] to show in shop/archive page.</p>
<p class="wpt-tips">
<b>Notice:</b>
<span>Product table will display products according to WooCommerce default query and Advance Search box is not available on Archive page.</span>
Expand Down
6 changes: 3 additions & 3 deletions admin/admin-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function __construct(){
$features->run();


add_action('admin_init', [$this, 'admin_init']);
// add_action('admin_init', [$this, 'admin_init']);
}

public function admin_init(){

$tracker = new Tracker();
$tracker->run();
// $tracker = new Tracker();
// $tracker->run();

}
}
7 changes: 6 additions & 1 deletion admin/configuration_page.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

/**
* This page is not depreciated.
* File has transferred to woo-product-table/admin/page/configure.php file
*
* @since 3.0.0
*/
//##Unused totally unused page
if( !function_exists( 'wpt_configuration_page' ) ){
/**
Expand Down
102 changes: 97 additions & 5 deletions admin/page-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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/' );
Expand Down Expand Up @@ -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
Expand All @@ -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 );
}
}
Loading

0 comments on commit 57a6663

Please sign in to comment.