set_basename( false, __FILE__ ); } else { /** * DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE * `function_exists` CALL ABOVE TO PROPERLY WORK. */ if ( !function_exists( 'mydrivecloud_fs' ) ) { // Create a helper function for easy SDK access. function mydrivecloud_fs() { global $mydrivecloud_fs; if ( !isset( $mydrivecloud_fs ) ) { // Include Freemius SDK. require_once dirname( __FILE__ ) . '/vendor/freemius/start.php'; $mydrivecloud_fs = fs_dynamic_init( array( 'id' => '40141', 'slug' => 'mydrivecloud', 'type' => 'plugin', 'public_key' => 'pk_0314663594370839836e1f878276a', 'is_premium' => false, 'premium_suffix' => 'Premium', 'has_addons' => false, 'has_paid_plans' => true, 'is_org_compliant' => true, 'trial' => array( 'days' => 3, 'is_require_payment' => true, ), 'menu' => array( 'slug' => 'mydrivecloud', 'support' => false, ), 'is_live' => true, ) ); } return $mydrivecloud_fs; } // Init Freemius. mydrivecloud_fs(); // Signal that SDK was initiated. do_action( 'mydrivecloud_fs_loaded' ); } // Prevent warnings and duplicate hooks if this file is loaded more than once. if ( defined( 'MYDRIVECLOUD_VERSION' ) ) { return; } define( 'MYDRIVECLOUD_VERSION', '1.0.0' ); define( 'MYDRIVECLOUD_FILE', __FILE__ ); define( 'MYDRIVECLOUD_DIR', plugin_dir_path( __FILE__ ) ); define( 'MYDRIVECLOUD_URL', plugin_dir_url( __FILE__ ) ); /** * Return an asset version that changes whenever the file changes. * * This keeps browser and proxy caches from serving stale JavaScript or CSS * when a corrected build is reinstalled with the same plugin version. * * @param string $relative_path Path relative to the plugin directory. * @return string */ function mydrivecloud_asset_version( $relative_path ) { $file = MYDRIVECLOUD_DIR . ltrim( $relative_path, '/\\' ); if ( is_file( $file ) ) { return MYDRIVECLOUD_VERSION . '.' . (string) filemtime( $file ); } return MYDRIVECLOUD_VERSION; } /** True only after the separately distributed Premium bootstrap has loaded. */ function mydrivecloud_premium_modules_active() { return defined( 'MYDRIVECLOUD_PREMIUM_ACTIVE' ) && MYDRIVECLOUD_PREMIUM_ACTIVE; } /** Return the Freemius in-dashboard upgrade URL for contextual PRO links. */ function mydrivecloud_upgrade_url() { return mydrivecloud_fs()->get_upgrade_url(); } /** True in the distributable Free codebase. */ function mydrivecloud_is_free_codebase() { return !mydrivecloud_fs()->is_premium(); } /** True whenever an upgrade message should be shown, including unlicensed Premium. */ function mydrivecloud_should_show_upsell() { return mydrivecloud_fs()->is_not_paying(); } /** Direct Freemius checkout link used by compact contextual upsells. */ function mydrivecloud_checkout_url() { return mydrivecloud_fs()->checkout_url(); } /** Choose the direct checkout in Free and the in-dashboard upgrade page otherwise. */ function mydrivecloud_contextual_upgrade_url() { if ( mydrivecloud_is_free_codebase() ) { return mydrivecloud_checkout_url(); } return mydrivecloud_upgrade_url(); } require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-db.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-roles.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-settings.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-access.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-storage.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-permissions.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-folders.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-rest.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-profile.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-app.php'; require_once MYDRIVECLOUD_DIR . 'includes/class-mydrivecloud-cleanup.php'; register_activation_hook( __FILE__, array('MyDriveCloud_DB', 'activate') ); /** Run optional data cleanup only after Freemius reports the uninstall event. */ function mydrivecloud_fs_uninstall_cleanup() { MyDriveCloud_Cleanup::after_uninstall(); } mydrivecloud_fs()->add_action( 'after_uninstall', 'mydrivecloud_fs_uninstall_cleanup' ); add_action( 'plugins_loaded', static function () { MyDriveCloud_DB::maybe_upgrade(); if ( get_option( 'mydrivecloud_storage_warning' ) ) { add_action( 'admin_notices', static function () { if ( current_user_can( 'manage_options' ) ) { echo '
' . esc_html__( 'MyDriveCloud cannot write to the private upload directory. Check the permissions of the wp-content/uploads directory on your server.', 'mydrivecloud' ) . '