set_basename( false, __FILE__ ); // Free and Pro never run together: activating this copy switches the copy that is already loaded off. register_activation_hook( __FILE__, function () { if ( defined( 'QUICKLYFLY_FILE' ) && plugin_basename( QUICKLYFLY_FILE ) !== plugin_basename( __FILE__ ) ) { deactivate_plugins( plugin_basename( QUICKLYFLY_FILE ) ); } } ); } else { define( 'QUICKLYFLY_VERSION', '1.0.0' ); define( 'QUICKLYFLY_FILE', __FILE__ ); // Asset version: the plugin version plus the main file's time. While developing (SCRIPT_DEBUG) it follows the newest CSS/JS file, so a changed asset is never served from an old browser cache. $quicklyfly_asset_time = (int) filemtime( __FILE__ ); if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { foreach ( (array) glob( plugin_dir_path( __FILE__ ) . 'assets/{css,js}{/,/pro__premium_only/}*.{css,js}', GLOB_BRACE ) as $quicklyfly_asset ) { $quicklyfly_asset_time = max( $quicklyfly_asset_time, (int) filemtime( $quicklyfly_asset ) ); } } define( 'QUICKLYFLY_ASSET_VER', QUICKLYFLY_VERSION . '.' . $quicklyfly_asset_time ); unset($quicklyfly_asset_time, $quicklyfly_asset); define( 'QUICKLYFLY_DIR', plugin_dir_path( __FILE__ ) ); define( 'QUICKLYFLY_URL', plugin_dir_url( __FILE__ ) ); define( 'QUICKLYFLY_MIN_PHP', '7.4' ); define( 'QUICKLYFLY_UPGRADE_URL', 'https://plugesoft.com/quicklyfly' ); define( 'QUICKLYFLY_FEEDBACK_EMAIL', 'feedback@plugesoft.com' ); /** * Autoloads QuicklyFly_* classes from includes/ and its subdirectories. * * QuicklyFly_Route_Policy => class-quicklyfly-route-policy.php * * @param string $class_name Class being loaded. * @return void */ function quicklyfly_autoload( $class_name ) { if ( 0 !== strpos( $class_name, 'QuicklyFly_' ) ) { return; } $file = 'class-' . strtolower( str_replace( '_', '-', $class_name ) ) . '.php'; foreach ( array( '', 'admin/', 'frontend/', 'integrations/', 'pro__premium_only/' ) as $sub_dir ) { $path = QUICKLYFLY_DIR . 'includes/' . $sub_dir . $file; if ( is_readable( $path ) ) { require_once $path; return; } } } spl_autoload_register( 'quicklyfly_autoload' ); /** * Removes QuicklyFly data when the plugin is deleted. * * Runs from the Freemius `after_uninstall` hook (a root uninstall.php is not allowed on Freemius deployments). * Policy: data is removed ONLY when the administrator enabled "Remove all data on uninstall"; otherwise * settings are kept. * * @return void */ function quicklyfly_uninstall_cleanup() { $settings = get_option( 'quicklyfly_settings', array() ); if ( empty( $settings['remove_data_on_uninstall'] ) ) { return; } delete_option( 'quicklyfly_settings' ); delete_option( 'quicklyfly_diagnostics_log' ); delete_transient( 'quicklyfly_activation_redirect' ); delete_transient( 'quicklyfly_pricing_plans' ); delete_transient( 'quicklyfly_compat_status' ); delete_transient( 'quicklyfly_feedback_sent' ); delete_post_meta_by_key( '_quicklyfly_off' ); } if ( !function_exists( 'quicklyfly_fs' ) && !defined( 'QUICKLYFLY_SKIP_FREEMIUS' ) ) { /** * Freemius SDK access (licensing, trial, upgrades, account). * * @return Freemius */ function quicklyfly_fs() { global $quicklyfly_fs; if ( !isset( $quicklyfly_fs ) ) { // Include Freemius SDK. require_once __DIR__ . '/vendor/freemius/start.php'; $quicklyfly_fs = fs_dynamic_init( array( 'id' => '44917', 'slug' => 'quicklyfly', 'type' => 'plugin', 'public_key' => 'pk_69418121ca60bb986301a279d81dd', 'is_premium' => false, 'premium_suffix' => 'Pro', 'has_addons' => false, 'has_paid_plans' => true, 'is_org_compliant' => true, 'trial' => array( 'days' => 7, 'is_require_payment' => false, ), 'menu' => array( 'first-path' => 'admin.php?page=quicklyfly', ), 'is_live' => true, ) ); } return $quicklyfly_fs; } // Init Freemius (the helper is named quicklyfly_fs() so that every global carries the plugin prefix). quicklyfly_fs(); // QuicklyFly has its own deactivation form (admin/class-quicklyfly-feedback.php), so Freemius' is switched off. quicklyfly_fs()->add_filter( 'show_deactivation_feedback_form', '__return_false' ); // The licence form belongs on the Account page only, not under every QuicklyFly screen. quicklyfly_fs()->add_filter( 'templates/connect.php', array('QuicklyFly_License', 'filter_connect_form') ); // The SDK may only redirect to its own screens in a normal page request, never in a background (ajax, REST, cron, CLI) one. quicklyfly_fs()->add_filter( 'redirect_on_activation', function ( $redirect ) { return $redirect && !wp_doing_ajax() && !wp_doing_cron() && !(defined( 'REST_REQUEST' ) && REST_REQUEST) && !(defined( 'WP_CLI' ) && WP_CLI); } ); // Uninstall logic lives in a hook (not in an uninstall.php file), as Freemius requires. quicklyfly_fs()->add_action( 'after_uninstall', 'quicklyfly_uninstall_cleanup' ); // Signal that SDK was initiated. do_action( 'quicklyfly_fs_loaded' ); } elseif ( defined( 'QUICKLYFLY_SKIP_FREEMIUS' ) ) { // Without the SDK, WordPress' own uninstall hook does the same job. register_uninstall_hook( __FILE__, 'quicklyfly_uninstall_cleanup' ); } /** * Whether the environment meets minimum requirements. * * @return bool */ function quicklyfly_requirements_met() { return version_compare( PHP_VERSION, QUICKLYFLY_MIN_PHP, '>=' ); } /** * Shows an admin notice when requirements are not met. * * @return void */ function quicklyfly_requirements_notice() { printf( '
%s