| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Plugin Name: FrontBlocks for Gutenberg/GeneratePress | |
| 4 | - * Plugin URI: https://wordpress.org/plugins/frontblocks/ | |
| 5 | - * Description: Blocks and helpers that extends Gutenberg and GeneratePress blocks. | |
| 6 | - * Version: 1.5.2 | |
| 3 | + * Plugin Name: FrontBlocks | |
| 4 | + * Plugin URI: https://github.com/closemarketing/frontblocks | |
| 5 | + * Description: Blocks and helpers to facilitate GeneratePress frontend developing. | |
| 6 | + * Version: 0.2.2 | |
| 7 | 7 | * Author: Closemarketing |
| 8 | 8 | * Author URI: https://close.marketing |
| 9 | 9 | * Text Domain: frontblocks |
| 10 | 10 | * Domain Path: /languages |
| @@ -10,14 +10,15 @@ | ||
| 10 | 10 | * Domain Path: /languages |
| 11 | 11 | * License: GPL-2.0+ |
| 12 | 12 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 13 | 13 | * |
| 14 | - * Requires at least: 5.0 | |
| 14 | + * Requires at least: 5.4 | |
| 15 | 15 | * Requires PHP: 7.0 |
| 16 | + * Requires Plugins: GeneratePress, GenerateBlocks | |
| 16 | 17 | * |
| 17 | 18 | * @package FrontBlocks |
| 18 | 19 | * @author Closemarketing |
| 19 | - * @copyright 2025 Closemarketing | |
| 20 | + * @copyright 2023 Closemarketing | |
| 20 | 21 | * @license GPL-2.0+ |
| 21 | 22 | * |
| 22 | 23 | * @wordpress-plugin |
| 23 | 24 | * |
| @@ -25,116 +26,24 @@ | ||
| 25 | 26 | */ |
| 26 | 27 | |
| 27 | 28 | defined( 'ABSPATH' ) || die( 'No script kiddies please!' ); |
| 28 | 29 | |
| 29 | -define( 'FRBL_VERSION', '1.5.2' ); | |
| 30 | +define( 'FRBL_VERSION', '0.2.2' ); | |
| 30 | 31 | define( 'FRBL_PLUGIN', __FILE__ ); |
| 31 | 32 | define( 'FRBL_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 32 | 33 | define( 'FRBL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 33 | 34 | |
| 34 | -// Load Composer autoloader. | |
| 35 | -if ( file_exists( FRBL_PLUGIN_PATH . 'vendor/autoload.php' ) ) { | |
| 36 | - require_once FRBL_PLUGIN_PATH . 'vendor/autoload.php'; | |
| 37 | -} | |
| 38 | - | |
| 39 | -require_once FRBL_PLUGIN_PATH . 'includes/Plugin_Main.php'; | |
| 40 | - | |
| 41 | -add_action( | |
| 42 | - 'plugins_loaded', | |
| 43 | - function () { | |
| 44 | - FrontBlocks\Plugin_Main::get_instance(); | |
| 45 | - } | |
| 46 | -); | |
| 47 | - | |
| 35 | +add_action( 'plugins_loaded', 'frbl__plugin_init' ); | |
| 48 | 36 | /** |
| 49 | - * Redirect to settings page on plugin activation. | |
| 50 | - */ | |
| 51 | -function frbl_plugin_activation_redirect() { | |
| 52 | - // Bail if activating from network or bulk activation. | |
| 53 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Checking WordPress activation parameter, not processing form data. | |
| 54 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { | |
| 55 | - return; | |
| 56 | - } | |
| 57 | - | |
| 58 | - // Redirect to settings page. | |
| 59 | - if ( get_option( 'frbl_activation_redirect', false ) ) { | |
| 60 | - delete_option( 'frbl_activation_redirect' ); | |
| 61 | - wp_safe_redirect( admin_url( 'themes.php?page=frontblocks-settings' ) ); | |
| 62 | - exit; | |
| 63 | - } | |
| 64 | -} | |
| 65 | -add_action( 'admin_init', 'frbl_plugin_activation_redirect' ); | |
| 66 | - | |
| 67 | -/** | |
| 68 | - * Set redirect flag on plugin activation. | |
| 69 | - */ | |
| 70 | -function frbl_set_activation_redirect() { | |
| 71 | - add_option( 'frbl_activation_redirect', true ); | |
| 72 | -} | |
| 73 | -register_activation_hook( __FILE__, 'frbl_set_activation_redirect' ); | |
| 74 | - | |
| 75 | -/** | |
| 76 | - * Record the activation date used by the review notice (see | |
| 77 | - * FrontBlocks\Admin\ReviewNotice). Done here, via register_activation_hook(), | |
| 78 | - * rather than from that class's own constructor: that class is only | |
| 79 | - * instantiated on 'plugins_loaded', which — for a plugin's own first | |
| 80 | - * activation — has already fired (or won't fire again) by the time | |
| 81 | - * WordPress includes this file and runs the activation hooks, so an | |
| 82 | - * 'activated_plugin' listener registered there would never catch it. | |
| 83 | - */ | |
| 84 | -function frbl_set_activation_date() { | |
| 85 | - if ( ! get_option( 'frbl_activation_date' ) ) { | |
| 86 | - update_option( 'frbl_activation_date', time(), false ); | |
| 87 | - } | |
| 88 | -} | |
| 89 | -register_activation_hook( __FILE__, 'frbl_set_activation_date' ); | |
| 90 | - | |
| 91 | -/** | |
| 92 | - * Check if FrontBlocks PRO is active. | |
| 37 | + * Load localization files | |
| 93 | 38 | * |
| 94 | - * @return bool | |
| 39 | + * @return void | |
| 95 | 40 | */ |
| 96 | -function frbl_is_pro_active() { | |
| 97 | - return defined( 'FRBLP_PRO_ACTIVE' ) && FRBLP_PRO_ACTIVE; | |
| 41 | +function frbl__plugin_init() { | |
| 42 | + load_plugin_textdomain( 'frontblocks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); | |
| 98 | 43 | } |
| 99 | 44 | |
| 100 | -/** | |
| 101 | - * Check if After Add to Cart Block is enabled. | |
| 102 | - * | |
| 103 | - * @return bool True if enabled. | |
| 104 | - */ | |
| 105 | -function frbl_is_after_add_to_cart_enabled() { | |
| 106 | - if ( ! frbl_is_pro_active() ) { | |
| 107 | - return false; | |
| 108 | - } | |
| 45 | +// Carousel. | |
| 46 | +require_once FRBL_PLUGIN_PATH . 'includes/carousel/frontblocks-carousel.php'; | |
| 109 | 47 | |
| 110 | - $options = get_option( 'frontblocks_settings', array() ); | |
| 111 | - return (bool) ( $options['enable_after_add_to_cart'] ?? false ); | |
| 112 | -} | |
| 113 | - | |
| 114 | -/** | |
| 115 | - * Check if Horizontal Product Form is enabled. | |
| 116 | - * | |
| 117 | - * @return bool True if enabled. | |
| 118 | - */ | |
| 119 | -function frbl_is_horizontal_product_form_enabled() { | |
| 120 | - if ( ! frbl_is_pro_active() ) { | |
| 121 | - return false; | |
| 122 | - } | |
| 123 | - | |
| 124 | - $options = get_option( 'frontblocks_settings', array() ); | |
| 125 | - return (bool) ( $options['horizontal_product_form'] ?? false ); | |
| 126 | -} | |
| 127 | - | |
| 128 | -/** | |
| 129 | - * Check if Checkout Inline Fields is enabled. | |
| 130 | - * | |
| 131 | - * @return bool True if enabled. | |
| 132 | - */ | |
| 133 | -function frbl_is_checkout_inline_enabled() { | |
| 134 | - if ( ! frbl_is_pro_active() ) { | |
| 135 | - return false; | |
| 136 | - } | |
| 137 | - | |
| 138 | - $options = get_option( 'frontblocks_settings', array() ); | |
| 139 | - return (bool) ( $options['checkout_inline'] ?? false ); | |
| 140 | -} | |
| 48 | +// Animations. | |
| 49 | +require_once FRBL_PLUGIN_PATH . 'includes/animations/frontblocks-animations.php'; | |