Skip to content

Commit

Permalink
Updated version with Freemius
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Sep 3, 2024
1 parent 038a01c commit bd1ccd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
16 changes: 3 additions & 13 deletions includes/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
namespace WebberZone\Top_Ten;

use WebberZone\Top_Ten\Admin\Cron;

if ( ! defined( 'WPINC' ) ) {
exit;
}

/**
* Main plugin class.
*
Expand Down Expand Up @@ -128,7 +126,6 @@ public static function get_instance() {
self::$instance = new self();
self::$instance->init();
}

return self::$instance;
}

Expand All @@ -155,21 +152,13 @@ private function init() {
$this->blocks = new Frontend\Blocks\Blocks();
$this->feed = new Frontend\Feed();
$this->cron = new Cron();

$this->hooks();

if ( is_admin() ) {
$this->admin = new Admin\Admin();
if ( is_multisite() ) {
$this->admin = new Admin\Network\Admin();
}
}

if ( tptn_freemius()->is__premium_only() ) {
if ( tptn_freemius()->can_use_premium_code() ) {
$this->pro = new Pro\Pro();
}
}
}

/**
Expand Down Expand Up @@ -199,9 +188,10 @@ public function initiate_plugin() {
* @since 3.3.0
*/
public function register_widgets() {
register_widget( '\WebberZone\Top_Ten\Frontend\Widgets\Posts_Widget' );
register_widget( '\WebberZone\Top_Ten\Frontend\Widgets\Count_Widget' );
register_widget( '\\WebberZone\\Top_Ten\\Frontend\\Widgets\\Posts_Widget' );
register_widget( '\\WebberZone\\Top_Ten\\Frontend\\Widgets\\Count_Widget' );
}

/**
* Function to register our new routes from the controller.
*
Expand Down
26 changes: 11 additions & 15 deletions includes/load-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@ function tptn_freemius() {
require_once TOP_TEN_PLUGIN_DIR . 'freemius/start.php';
$tptn_freemius = \fs_dynamic_init(
array(
'id' => '16384',
'slug' => 'top-10',
'premium_slug' => 'top-10-pro',
'type' => 'plugin',
'public_key' => 'pk_bc8489856ce399cf3cc8fd49fc9d3',
'is_premium' => true,
'has_premium_version' => true,
'premium_suffix' => 'Pro',
'has_addons' => false,
'has_paid_plans' => true,
'menu' => array(
'id' => '16384',
'slug' => 'top-10',
'premium_slug' => 'top-10-pro',
'type' => 'plugin',
'public_key' => 'pk_bc8489856ce399cf3cc8fd49fc9d3',
'is_premium' => false,
'premium_suffix' => 'Pro',
'has_addons' => false,
'has_paid_plans' => true,
'menu' => array(
'slug' => 'tptn_dashboard',
'contact' => false,
'support' => false,
'network' => true,
),
'is_live' => true,
'is_live' => true,
)
);
}
Expand All @@ -59,9 +58,6 @@ function tptn_freemius_get_plugin_icon() {
*/
function tptn_freemius_uninstall() {
require_once dirname( __DIR__ ) . '/uninstaller.php';
if ( tptn_freemius()->can_use_premium_code__premium_only() ) {
\WebberZone\Top_Ten\Pro\Pro::uninstall_pro();
}
}

// Init Freemius.
Expand Down

0 comments on commit bd1ccd8

Please sign in to comment.