| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: DesignSetGo |
| 4 |
* Plugin URI: https://designsetgoblocks.com |
| 5 |
* Description: Professional Gutenberg block library with 58 blocks and 18 powerful extensions - complete Form Builder, container system, interactive elements, maps, modals, breadcrumbs, timelines, scroll effects, and animations. Built with WordPress standards for guaranteed editor/frontend parity. |
| 6 |
* Version: 2.7.3 |
| 7 |
* Requires at least: 6.7 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: DesignSetGo |
| 10 |
* Author URI: https://designsetgoblocks.com/nealey |
| 11 |
* License: GPL-2.0-or-later |
| 12 |
* Text Domain: designsetgo |
| 13 |
* Domain Path: /languages |
| 14 |
* |
| 15 |
* @package DesignSetGo |
| 16 |
*/ |
| 17 |
|
| 18 |
namespace DesignSetGo; |
| 19 |
|
| 20 |
// Exit if accessed directly. |
| 21 |
use DesignSetGo\LLMS_Txt\Controller; |
| 22 |
use DesignSetGo\LLMS_Txt\File_Manager; |
| 23 |
use DesignSetGo\Patterns\Loader; |
| 24 |
|
| 25 |
if ( ! defined( 'ABSPATH' ) ) { |
| 26 |
exit; |
| 27 |
} |
| 28 |
|
| 29 |
define( 'DESIGNSETGO_VERSION', '2.7.3' ); |
| 30 |
define( 'DESIGNSETGO_FILE', __FILE__ ); |
| 31 |
define( 'DESIGNSETGO_PATH', plugin_dir_path( __FILE__ ) ); |
| 32 |
define( 'DESIGNSETGO_URL', plugin_dir_url( __FILE__ ) ); |
| 33 |
define( 'DESIGNSETGO_BASENAME', plugin_basename( __FILE__ ) ); |
| 34 |
|
| 35 |
/** |
| 36 |
* Load the plugin. |
| 37 |
*/ |
| 38 |
require_once DESIGNSETGO_PATH . 'includes/class-plugin.php'; |
| 39 |
|
| 40 |
/** |
| 41 |
* Load animation attributes helper (used by dynamic blocks). |
| 42 |
*/ |
| 43 |
require_once DESIGNSETGO_PATH . 'includes/data/block-animation-attributes.php'; |
| 44 |
|
| 45 |
/** |
| 46 |
* Load SVG icon library (used by dynamic blocks). |
| 47 |
*/ |
| 48 |
require_once DESIGNSETGO_PATH . 'includes/data/icon-svg-library.php'; |
| 49 |
|
| 50 |
/** |
| 51 |
* Load star rating value math (used by the star-rating block and by the |
| 52 |
* JSON-LD builder, which runs on wp_head before any block renders). |
| 53 |
*/ |
| 54 |
require_once DESIGNSETGO_PATH . 'includes/features/star-rating-functions.php'; |
| 55 |
|
| 56 |
/** |
| 57 |
* Load breadcrumbs helper functions (used by breadcrumbs block). |
| 58 |
*/ |
| 59 |
require_once DESIGNSETGO_PATH . 'includes/features/breadcrumbs-functions.php'; |
| 60 |
|
| 61 |
/** |
| 62 |
* Load pattern placeholder image helper (used by block patterns). |
| 63 |
*/ |
| 64 |
require_once DESIGNSETGO_PATH . 'includes/patterns/placeholder-images.php'; |
| 65 |
|
| 66 |
/** |
| 67 |
* Load block-support routing helper (used by dynamic blocks whose wrapper is |
| 68 |
* a content-column positioning box, e.g. Pill, Icon). |
| 69 |
*/ |
| 70 |
require_once DESIGNSETGO_PATH . 'includes/block-support-routing.php'; |
| 71 |
|
| 72 |
/** |
| 73 |
* Initialize the plugin. |
| 74 |
*/ |
| 75 |
function designsetgo_init() { |
| 76 |
return Plugin::instance(); |
| 77 |
} |
| 78 |
|
| 79 |
// Kick off the plugin. |
| 80 |
designsetgo_init(); |
| 81 |
|
| 82 |
/** |
| 83 |
* Plugin activation hook. |
| 84 |
* |
| 85 |
* Schedules cron jobs for data retention cleanup and flushes rewrite rules. |
| 86 |
*/ |
| 87 |
function designsetgo_activate() { |
| 88 |
// Schedule daily cleanup of old form submissions. |
| 89 |
if ( ! wp_next_scheduled( 'designsetgo_cleanup_old_submissions' ) ) { |
| 90 |
wp_schedule_event( time(), 'daily', 'designsetgo_cleanup_old_submissions' ); |
| 91 |
} |
| 92 |
|
| 93 |
// Schedule rewrite rules flush for llms.txt feature. |
| 94 |
// Uses transient-based approach since rewrite rules aren't registered yet. |
| 95 |
require_once DESIGNSETGO_PATH . 'includes/llms-txt/class-controller.php'; |
| 96 |
Controller::schedule_flush_rewrite_rules(); |
| 97 |
|
| 98 |
// Clear cached pattern file list so new/changed patterns are picked up. |
| 99 |
Loader::clear_cache(); |
| 100 |
} |
| 101 |
register_activation_hook( __FILE__, 'DesignSetGo\designsetgo_activate' ); |
| 102 |
|
| 103 |
/** |
| 104 |
* Plugin deactivation hook. |
| 105 |
* |
| 106 |
* Unschedules all cron jobs. |
| 107 |
*/ |
| 108 |
function designsetgo_deactivate() { |
| 109 |
// Clear scheduled cleanup job. |
| 110 |
$timestamp = wp_next_scheduled( 'designsetgo_cleanup_old_submissions' ); |
| 111 |
if ( $timestamp ) { |
| 112 |
wp_unschedule_event( $timestamp, 'designsetgo_cleanup_old_submissions' ); |
| 113 |
} |
| 114 |
|
| 115 |
// Remove physical llms.txt if we wrote it. Only clear the ownership option when |
| 116 |
// the delete actually succeeds — if the filesystem is unavailable (e.g. FTP host |
| 117 |
// without credentials), leave the option intact so the plugin still knows it owns |
| 118 |
// the file on next activation rather than misreporting it as a third-party conflict. |
| 119 |
if ( get_option( 'designsetgo_llms_txt_physical' ) ) { |
| 120 |
if ( File_Manager::fs_delete( File_Manager::site_root_path() . 'llms.txt' ) ) { |
| 121 |
delete_option( 'designsetgo_llms_txt_physical' ); |
| 122 |
} |
| 123 |
} |
| 124 |
} |
| 125 |
register_deactivation_hook( __FILE__, 'DesignSetGo\designsetgo_deactivate' ); |
| 126 |
|