set_basename( false, __FILE__ ); } else { $rankify_autoload_path = __DIR__ . '/vendor/autoload.php'; if ( file_exists( $rankify_autoload_path ) ) { require_once $rankify_autoload_path; } // Init Freemius SDK if ( !function_exists( '\\DaftPlug\\Rankify\\rankify_pro' ) ) { // Create a helper function for easy SDK access. function rankify_pro() { global $rankify_pro; if ( !isset( $rankify_pro ) ) { // Include Freemius SDK. // SDK is auto-loaded through composer $rankify_pro = \fs_dynamic_init( [ 'id' => '37807', 'slug' => 'rankify', 'premium_slug' => 'rankify-pro', 'type' => 'plugin', 'public_key' => 'pk_8ec045cf7dc01af9b632afdafbc09', 'is_premium' => false, 'premium_suffix' => 'Pro', 'has_addons' => false, 'has_paid_plans' => true, 'is_org_compliant' => true, 'bundle_id' => '20420', 'bundle_public_key' => 'pk_fe5ea0f481c10a8938d37ffed52b9', 'bundle_license_auto_activation' => true, 'menu' => [ 'slug' => 'rankify', 'first-path' => 'admin.php?page=rankify', 'pricing' => true, 'contact' => true, 'account' => true, 'support' => true, 'addons' => false, ], 'is_live' => true, ] ); } return $rankify_pro; } } // Init Freemius. \DaftPlug\Rankify\rankify_pro(); // No trials anywhere: Pro is enabled from daftplug.com. Removing the // 'trial' config only clears the SDK's own trial-days value — it still // offers a trial whenever the API has told it the plan has one, which is // what kept the "Start Trial" menu item and its counter alive. This is the // supported way to refuse, and it also stops the promotion re-arming. \DaftPlug\Rankify\rankify_pro()->add_filter( 'show_trial', '__return_false' ); // The promotion is a sticky notice, so an install that already saw one // keeps it until it is retracted. Clear it once rather than waiting for a // user to dismiss something we no longer offer. add_action( 'admin_init', function () { if ( get_option( 'rankify_trial_retracted' ) ) { return; } // FS_Admin_Notices::instance() is a singleton keyed on the slug, so this // is the same manager the SDK built during init; Freemius keeps its own // reference private and exposes no getter. if ( class_exists( 'FS_Admin_Notices' ) ) { \FS_Admin_Notices::instance( 'rankify' )->remove_sticky( 'trial_promotion' ); } update_option( 'rankify_trial_retracted', 1, false ); } ); // Signal that SDK was initiated. do_action( 'rankify_pro_loaded' ); // Define Constants define( 'RANKIFY_VERSION', '1.2.1' ); define( 'RANKIFY_FILE', __FILE__ ); define( 'RANKIFY_BASENAME', plugin_basename( __FILE__ ) ); define( 'RANKIFY_DIR_URL', plugin_dir_url( __FILE__ ) ); define( 'RANKIFY_DIR_PATH', plugin_dir_path( __FILE__ ) ); define( 'RANKIFY_UPLOAD_DIR', trailingslashit( wp_upload_dir()['basedir'] ) . 'rankify/' ); define( 'RANKIFY_UPLOAD_URL', trailingslashit( wp_upload_dir()['baseurl'] ) . 'rankify/' ); // Include Helpers require_once RANKIFY_DIR_PATH . 'includes/helpers/Utils.php'; // Include Admin require_once RANKIFY_DIR_PATH . 'includes/admin/Admin.php'; // Include Features require_once RANKIFY_DIR_PATH . 'includes/features/Features.php'; // Activation register_activation_hook( RANKIFY_FILE, function () { // Sitemaps and redirects both register rewrite rules, so the rules have to // be rebuilt on activation or the routes 404 until someone saves permalinks. flush_rewrite_rules(); } ); // Deactivation register_deactivation_hook( RANKIFY_FILE, function () { flush_rewrite_rules(); } ); // Initialize Admin and Features add_action( 'init', function () { new Admin(); new Features(); } ); }