astra-sites
Last commit date
admin
3 years ago
assets
2 years ago
classes
2 years ago
inc
2 years ago
languages
2 years ago
.eslintignore
4 years ago
astra-sites.php
2 years ago
readme.txt
2 years ago
webpack.config.js
4 years ago
astra-sites.php
122 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Starter Templates |
| 4 | * Plugin URI: https://wpastra.com/ |
| 5 | * Description: Starter Templates is all in one solution for complete starter sites, single page templates, blocks & images. This plugin offers the premium library of ready templates & provides quick access to beautiful Pixabay images that can be imported in your website easily. |
| 6 | * Version: 3.5.7 |
| 7 | * Author: Brainstorm Force |
| 8 | * Author URI: https://www.brainstormforce.com |
| 9 | * Text Domain: astra-sites |
| 10 | * |
| 11 | * @package Astra Sites |
| 12 | */ |
| 13 | |
| 14 | // Check PHP version before loading the plugin. |
| 15 | if ( version_compare( PHP_VERSION, '7.4', '<' ) ) { |
| 16 | add_action( 'admin_notices', 'astra_sites_php_version_notice' ); |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Display notice if PHP version is below 7.4 |
| 22 | */ |
| 23 | function astra_sites_php_version_notice() { |
| 24 | $plugin_name = 'Starter Templates'; |
| 25 | ?> |
| 26 | <div class="error"> |
| 27 | <p><?php echo esc_html( $plugin_name . ' requires PHP version 7.4 or higher. Please upgrade your PHP version.' ); ?></p> |
| 28 | </div> |
| 29 | <?php |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Set constants. |
| 34 | */ |
| 35 | if ( ! defined( 'ASTRA_SITES_NAME' ) ) { |
| 36 | define( 'ASTRA_SITES_NAME', __( 'Starter Templates', 'astra-sites' ) ); |
| 37 | } |
| 38 | |
| 39 | if ( ! defined( 'ASTRA_SITES_VER' ) ) { |
| 40 | define( 'ASTRA_SITES_VER', '3.5.7' ); |
| 41 | } |
| 42 | |
| 43 | if ( ! defined( 'ASTRA_SITES_FILE' ) ) { |
| 44 | define( 'ASTRA_SITES_FILE', __FILE__ ); |
| 45 | } |
| 46 | |
| 47 | if ( ! defined( 'ASTRA_SITES_BASE' ) ) { |
| 48 | define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) ); |
| 49 | } |
| 50 | |
| 51 | if ( ! defined( 'ASTRA_SITES_DIR' ) ) { |
| 52 | define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) ); |
| 53 | } |
| 54 | |
| 55 | if ( ! defined( 'ASTRA_SITES_URI' ) ) { |
| 56 | define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) ); |
| 57 | } |
| 58 | |
| 59 | if ( ! function_exists( 'astra_sites_setup' ) ) : |
| 60 | |
| 61 | /** |
| 62 | * Astra Sites Setup |
| 63 | * |
| 64 | * @since 1.0.5 |
| 65 | */ |
| 66 | function astra_sites_setup() { |
| 67 | require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php'; |
| 68 | |
| 69 | // Admin. |
| 70 | require_once ASTRA_SITES_DIR . 'classes/class-astra-sites-admin.php'; |
| 71 | } |
| 72 | |
| 73 | add_action( 'plugins_loaded', 'astra_sites_setup' ); |
| 74 | |
| 75 | endif; |
| 76 | |
| 77 | // Astra Notices. |
| 78 | require_once ASTRA_SITES_DIR . 'inc/lib/astra-notices/class-astra-notices.php'; |
| 79 | |
| 80 | // BSF Analytics Tracker. |
| 81 | if ( ! class_exists( 'BSF_Analytics_Loader' ) ) { |
| 82 | require_once ASTRA_SITES_DIR . 'admin/bsf-analytics/class-bsf-analytics-loader.php'; |
| 83 | } |
| 84 | |
| 85 | // BSF_Quick_Links. |
| 86 | if ( ! class_exists( 'BSF_Quick_Links' ) ) { |
| 87 | require_once ASTRA_SITES_DIR . 'inc/lib/bsf-quick-links/class-bsf-quick-links.php'; |
| 88 | } |
| 89 | |
| 90 | $bsf_analytics = BSF_Analytics_Loader::get_instance(); |
| 91 | |
| 92 | $bsf_analytics->set_entity( |
| 93 | array( |
| 94 | 'bsf' => array( |
| 95 | 'product_name' => __( 'Starter Templates', 'astra-sites' ), |
| 96 | 'path' => ASTRA_SITES_DIR . 'admin/bsf-analytics', |
| 97 | 'author' => 'Brainstorm Force', |
| 98 | 'time_to_display' => '+24 hours', |
| 99 | ), |
| 100 | ) |
| 101 | ); |
| 102 | |
| 103 | if ( ! function_exists( 'astra_pro_sites_activation_redirect' ) ) : |
| 104 | |
| 105 | /** |
| 106 | * Astra pro sites activation redirect. |
| 107 | * |
| 108 | * @param mixed $plugin details of plugin. |
| 109 | * @since 3.3.0 |
| 110 | * @return void |
| 111 | */ |
| 112 | function astra_pro_sites_activation_redirect( $plugin ) { |
| 113 | if ( ( ! defined( 'WP_CLI' ) || ! WP_CLI ) && ( plugin_basename( __FILE__ ) == $plugin ) ) { |
| 114 | wp_safe_redirect( admin_url( 'themes.php?page=starter-templates' ) ); |
| 115 | exit(); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | add_action( 'activated_plugin', 'astra_pro_sites_activation_redirect' ); |
| 120 | |
| 121 | endif; |
| 122 |