coming-soon
Last commit date
admin
1 month ago
app
1 month ago
includes
2 weeks ago
languages
2 weeks ago
public
1 month ago
resources
1 month ago
GPL.txt
3 years ago
README.txt
1 month ago
coming-soon.php
2 weeks ago
wp-cli-functions.php
1 month ago
coming-soon.php
200 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Coming Soon Page, Maintenance Mode, Landing Pages & WordPress Website Builder by SeedProd |
| 4 | * Plugin URI: https://www.seedprod.com/lite-upgrade/?utm_source=WordPress&utm_campaign=liteplugin&utm_medium=plugin-uri-link |
| 5 | * Description: The Easiest WordPress Drag & Drop Page Builder that allows you to build your website, create Landing Pages, Coming Soon Pages, Maintenance Mode Pages and more. |
| 6 | * Version: 6.20.1 |
| 7 | * Author: SeedProd |
| 8 | * Author URI: https://www.seedprod.com/lite-upgrade/?utm_source=WordPress&utm_campaign=liteplugin&utm_medium=author-uri-link |
| 9 | * Text Domain: coming-soon |
| 10 | * Domain Path: /languages |
| 11 | * License: GPLv2 or later |
| 12 | * |
| 13 | * @package SeedProd |
| 14 | * @subpackage SeedProd |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * Default Constants |
| 19 | */ |
| 20 | |
| 21 | define( 'SEEDPROD_BUILD', 'lite' ); |
| 22 | define( 'SEEDPROD_SLUG', 'coming-soon/coming-soon.php' ); |
| 23 | define( 'SEEDPROD_VERSION', '6.20.1' ); |
| 24 | define( 'SEEDPROD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 25 | // Example output: /Applications/MAMP/htdocs/wordpress/wp-content/plugins/seedprod/. |
| 26 | define( 'SEEDPROD_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 27 | // Example output: http://localhost:8888/wordpress/wp-content/plugins/seedprod/. |
| 28 | |
| 29 | |
| 30 | if ( defined( 'SEEDPROD_LOCAL_JS' ) ) { |
| 31 | // phpcs:disable Squiz.PHP.CommentedOutCode,Squiz.Commenting.InlineComment.InvalidEndChar,WordPress.Commenting.InlineComment.InvalidEndChar |
| 32 | define( 'SEEDPROD_API_URL', 'http://v4app.seedprod.test/v4/' ); |
| 33 | define( 'SEEDPROD_WEB_API_URL', 'http://v4app.seedprod.test/' ); |
| 34 | define( 'SEEDPROD_BACKGROUND_DOWNLOAD_API_URL', 'https://api.seedprod.com/v3/background_download' ); |
| 35 | |
| 36 | } else { |
| 37 | define( 'SEEDPROD_API_URL', 'https://api.seedprod.com/v4/' ); |
| 38 | define( 'SEEDPROD_WEB_API_URL', 'https://app.seedprod.com/' ); |
| 39 | define( 'SEEDPROD_BACKGROUND_DOWNLOAD_API_URL', 'https://api.seedprod.com/v3/background_download' ); |
| 40 | } |
| 41 | |
| 42 | |
| 43 | |
| 44 | /** |
| 45 | * Load Translation |
| 46 | */ |
| 47 | function seedprod_lite_load_textdomain() { |
| 48 | // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Required for premium plugin not hosted on WordPress.org. |
| 49 | load_plugin_textdomain( 'coming-soon', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 50 | } |
| 51 | |
| 52 | add_action( 'plugins_loaded', 'seedprod_lite_load_textdomain' ); |
| 53 | |
| 54 | |
| 55 | /** |
| 56 | * Upon activation of the plugin check php version, load defaults and show welcome screen. |
| 57 | */ |
| 58 | function seedprod_lite_activation() { |
| 59 | // Include plugin.php to use is_plugin_active() and deactivate_plugins() . |
| 60 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 61 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 62 | } |
| 63 | |
| 64 | seedprod_lite_check_for_free_version(); |
| 65 | |
| 66 | // Deactivate the other version to prevent conflicts. |
| 67 | if ( SEEDPROD_BUILD === 'pro' ) { |
| 68 | // Pro is being activated, check if lite is active and deactivate it. |
| 69 | if ( is_plugin_active( 'coming-soon/coming-soon.php' ) ) { |
| 70 | deactivate_plugins( 'coming-soon/coming-soon.php' ); |
| 71 | } |
| 72 | } elseif ( is_plugin_active( 'seedprod-coming-soon-pro-5/seedprod-coming-soon-pro-5.php' ) ) { |
| 73 | // Lite is being activated, check if pro is active and deactivate it. |
| 74 | deactivate_plugins( 'seedprod-coming-soon-pro-5/seedprod-coming-soon-pro-5.php' ); |
| 75 | } |
| 76 | |
| 77 | update_option( 'seedprod_run_activation', true, '', false ); |
| 78 | |
| 79 | // Load and set default settings. |
| 80 | require_once SEEDPROD_PLUGIN_PATH . 'resources/data-templates/default-settings.php'; |
| 81 | add_option( 'seedprod_settings', $seedprod_default_settings ); |
| 82 | |
| 83 | // Set initial version. |
| 84 | $data = array( |
| 85 | 'installed_version' => SEEDPROD_VERSION, |
| 86 | 'installed_date' => time(), |
| 87 | 'installed_pro' => SEEDPROD_BUILD, |
| 88 | ); |
| 89 | |
| 90 | add_option( 'seedprod_over_time', $data ); |
| 91 | |
| 92 | // Set a token. |
| 93 | add_option( 'seedprod_token', wp_generate_uuid4() ); |
| 94 | |
| 95 | // Welcome page flag. |
| 96 | set_transient( '_seedprod_welcome_screen_activation_redirect', true, 60 ); |
| 97 | |
| 98 | // Set cron to fetch feed. |
| 99 | if ( ! wp_next_scheduled( 'seedprod_notifications' ) ) { |
| 100 | if ( SEEDPROD_BUILD === 'pro' ) { |
| 101 | wp_schedule_event( time() + 7200, 'daily', 'seedprod_notifications' ); |
| 102 | } else { |
| 103 | wp_schedule_event( time(), 'daily', 'seedprod_notifications' ); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | // Copy help docs on installation. |
| 108 | $upload_dir = wp_upload_dir(); |
| 109 | $path = trailingslashit( $upload_dir['basedir'] ) . 'seedprod-help-docs/'; // target directory. |
| 110 | $cache_file = wp_normalize_path( trailingslashit( $path ) . 'articles.json' ); |
| 111 | |
| 112 | // Copy articles file. |
| 113 | if ( true === seedprod_lite_set_up_upload_dir( $path, $cache_file ) ) { |
| 114 | $initial_location = SEEDPROD_PLUGIN_PATH . 'resources/data-templates/articles.json'; |
| 115 | copy( $initial_location, $cache_file ); |
| 116 | } |
| 117 | |
| 118 | // Set cron to fetch help docs. |
| 119 | if ( ! wp_next_scheduled( 'seedprod_lite_fetch_help_docs' ) ) { |
| 120 | if ( SEEDPROD_BUILD === 'pro' ) { |
| 121 | wp_schedule_event( time() + 7200, 'weekly', 'seedprod_lite_fetch_help_docs' ); |
| 122 | } else { |
| 123 | wp_schedule_event( time(), 'weekly', 'seedprod_lite_fetch_help_docs' ); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // Flush rewrite rules. |
| 128 | flush_rewrite_rules(); |
| 129 | } |
| 130 | |
| 131 | register_activation_hook( __FILE__, 'seedprod_lite_activation' ); |
| 132 | |
| 133 | |
| 134 | /** |
| 135 | * Deactivate Flush Rules |
| 136 | */ |
| 137 | function seedprod_lite_deactivate() { |
| 138 | wp_clear_scheduled_hook( 'seedprod_notifications' ); |
| 139 | wp_clear_scheduled_hook( 'seedprod_fetch_help_docs' ); |
| 140 | } |
| 141 | |
| 142 | register_deactivation_hook( __FILE__, 'seedprod_lite_deactivate' ); |
| 143 | |
| 144 | |
| 145 | |
| 146 | /** |
| 147 | * Load Plugin |
| 148 | */ |
| 149 | require_once SEEDPROD_PLUGIN_PATH . 'app/bootstrap.php'; |
| 150 | require_once SEEDPROD_PLUGIN_PATH . 'app/routes.php'; |
| 151 | require_once SEEDPROD_PLUGIN_PATH . 'app/load_controller.php'; |
| 152 | // Load Custom Gutenberg Blocks |
| 153 | // Commented out - not currently in use |
| 154 | // if ( file_exists( SEEDPROD_PLUGIN_PATH . 'blocks/countdown/index.php' ) ) { |
| 155 | // require_once SEEDPROD_PLUGIN_PATH . 'blocks/countdown/index.php'; |
| 156 | // } |
| 157 | |
| 158 | |
| 159 | /** |
| 160 | * Initialize the new WordPress-native admin pages |
| 161 | * This runs alongside the existing Vue system for gradual migration |
| 162 | */ |
| 163 | add_action( 'plugins_loaded', 'seedprod_lite_init_native_admin', 15 ); |
| 164 | /** |
| 165 | * Initialize WordPress-native admin pages (alongside Vue system). |
| 166 | * |
| 167 | * @return void |
| 168 | */ |
| 169 | function seedprod_lite_init_native_admin() { |
| 170 | // Only load in admin. |
| 171 | if ( is_admin() ) { |
| 172 | require_once SEEDPROD_PLUGIN_PATH . 'includes/class-seedprod-init.php'; |
| 173 | $seedprod_native = new SeedProd_Lite_Init(); |
| 174 | $seedprod_native->run(); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Register WP-CLI commands |
| 180 | */ |
| 181 | if ( defined( 'WP_CLI' ) && WP_CLI ) { |
| 182 | require_once SEEDPROD_PLUGIN_PATH . 'wp-cli-functions.php'; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Register WordPress Abilities API (WP 6.9+) |
| 187 | * |
| 188 | * Exposes SeedProd capabilities as machine-readable abilities |
| 189 | * for automation tools, AI agents, and third-party integrations. |
| 190 | */ |
| 191 | if ( function_exists( 'wp_register_ability' ) ) { |
| 192 | require_once SEEDPROD_PLUGIN_PATH . 'includes/class-seedprod-abilities.php'; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Maybe Migrate |
| 197 | */ |
| 198 | add_action( 'upgrader_process_complete', 'seedprod_lite_check_for_free_version' ); |
| 199 | add_action( 'init', 'seedprod_lite_check_for_free_version' ); |
| 200 |