| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Pixelgrade Assistant |
| 4 |
* Plugin URI: https://github.com/pixelgrade/pixelgrade-assistant |
| 5 |
* Description: We care about giving you the best experience with your free Pixelgrade theme. |
| 6 |
* Version: 2.4.0 |
| 7 |
* Requires at least: 5.9 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: Pixelgrade |
| 10 |
* Author URI: https://pixelgrade.com |
| 11 |
* License: GPL-3.0 |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html |
| 13 |
* Text Domain: pixelgrade-assistant |
| 14 |
* Domain Path: /languages/ |
| 15 |
*/ |
| 16 |
|
| 17 |
// If this file is called directly, abort. |
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
die; |
| 20 |
} |
| 21 |
|
| 22 |
define( 'PIXELGRADE_ASSISTANT__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 23 |
define( 'PIXELGRADE_ASSISTANT__PLUGIN_FILE', __FILE__ ); |
| 24 |
|
| 25 |
// Define our constants or make sure they have a value |
| 26 |
defined( 'PIXELGRADE_ASSISTANT__VERSION' ) || define( 'PIXELGRADE_ASSISTANT__VERSION', '2.4.0' ); |
| 27 |
defined( 'PIXELGRADE_ASSISTANT__API_BASE' ) || define( 'PIXELGRADE_ASSISTANT__API_BASE', 'https://pixelgrade.com/' ); |
| 28 |
defined( 'PIXELGRADE_ASSISTANT__API_BASE_DOMAIN' ) || define( 'PIXELGRADE_ASSISTANT__API_BASE_DOMAIN', 'pixelgrade.com' ); |
| 29 |
defined( 'PIXELGRADE_ASSISTANT__SHOP_BASE' ) || define( 'PIXELGRADE_ASSISTANT__SHOP_BASE', 'https://pixelgrade.com/' ); |
| 30 |
defined( 'PIXELGRADE_ASSISTANT__SHOP_BASE_DOMAIN' ) || define( 'PIXELGRADE_ASSISTANT__SHOP_BASE_DOMAIN', 'pixelgrade.com' ); |
| 31 |
defined( 'PIXELGRADE_ASSISTANT__DEV_MODE' ) || define( 'PIXELGRADE_ASSISTANT__DEV_MODE', false ); |
| 32 |
|
| 33 |
// Fail-safe guard for commercial behavior. Default false: the WordPress.org build is free. |
| 34 |
// Commercial features belong in the separate Pixelgrade Plus plugin, not behind this flag. |
| 35 |
defined( 'PIXELGRADE_ASSISTANT__IS_COMMERCIAL' ) || define( 'PIXELGRADE_ASSISTANT__IS_COMMERCIAL', false ); |
| 36 |
|
| 37 |
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
| 38 |
|
| 39 |
// Capability helpers: free vs commercial, and Pixelgrade Plus / Care detection. |
| 40 |
require_once plugin_dir_path( __FILE__ ) . 'includes/capabilities.php'; |
| 41 |
|
| 42 |
// Classic Editor is opt-in for themes that explicitly require it. |
| 43 |
require_once plugin_dir_path( __FILE__ ) . 'includes/classic-editor.php'; |
| 44 |
|
| 45 |
// Asset helpers for enqueuing @wordpress/scripts build artifacts (admin/build/*.asset.php). |
| 46 |
require_once plugin_dir_path( __FILE__ ) . 'includes/assets.php'; |
| 47 |
|
| 48 |
// Host extension surface for companion plugins (hub tab registry + host-account read accessors). |
| 49 |
require_once plugin_dir_path( __FILE__ ) . 'includes/host-extension-surface.php'; |
| 50 |
|
| 51 |
// Host-owned pixelgrade.com account connection + Account hub tab. |
| 52 |
require_once plugin_dir_path( __FILE__ ) . 'includes/account.php'; |
| 53 |
|
| 54 |
// Minimal site context shared by functional requests to Pixelgrade services. |
| 55 |
require_once plugin_dir_path( __FILE__ ) . 'includes/service-request-context.php'; |
| 56 |
|
| 57 |
// Appearance -> Pixelgrade hub: server-side bootstrap data for the React shell. |
| 58 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-hub.php'; |
| 59 |
|
| 60 |
// Shared Anima LT install/activation descriptor for fresh-site onboarding and Site Setup. |
| 61 |
require_once plugin_dir_path( __FILE__ ) . 'includes/theme-setup.php'; |
| 62 |
|
| 63 |
// Free Styles tab: in-hub style control center + editor/customizer destinations. |
| 64 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-styles.php'; |
| 65 |
|
| 66 |
// Free Overview tab: registers itself on the hub registry + builds its bootstrap payload. |
| 67 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-overview.php'; |
| 68 |
|
| 69 |
// Free Plugins tab: recommended plugin management inside the hub. |
| 70 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-plugins.php'; |
| 71 |
|
| 72 |
// Free Design Library tab: one destination for the three content granularities (whole site / |
| 73 |
// reusable part / single page); the section modules below keep their payloads + REST surfaces. |
| 74 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-design-library.php'; |
| 75 |
|
| 76 |
// Free Starter Sites section: existing free demos plus Plus-injected premium starters. |
| 77 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-starter-sites.php'; |
| 78 |
|
| 79 |
// Free Recipes tab: source-as-recipe bundles over granular starter layouts. |
| 80 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-recipes.php'; |
| 81 |
|
| 82 |
// Free Layouts tab: granular single-unit layout import. |
| 83 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-layout-units.php'; |
| 84 |
|
| 85 |
// Free Page Patterns tab: granular single-unit content import. |
| 86 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-content-patterns.php'; |
| 87 |
|
| 88 |
// Secondary System Status tab: diagnostics data and controls. |
| 89 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-system-status.php'; |
| 90 |
|
| 91 |
// Secondary Tools tab: reset/maintenance utilities. |
| 92 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-tools.php'; |
| 93 |
|
| 94 |
// Contextual editor docs panel: bootstrap data + safe server-side docs actions. |
| 95 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-docs.php'; |
| 96 |
|
| 97 |
// Free Help tab: registers itself on the hub registry and reuses the docs KB source. |
| 98 |
require_once plugin_dir_path( __FILE__ ) . 'includes/admin-help.php'; |
| 99 |
|
| 100 |
// Include functions that might assist when in dev mode. |
| 101 |
require_once plugin_dir_path( __FILE__ ) . 'includes/integrations/devmode.php'; |
| 102 |
|
| 103 |
// The agent surface: the shared verb bodies that both the CLI and the abilities run, the |
| 104 |
// `pixelgrade/*` ability registrations, and the curated MCP server. The core loads first and |
| 105 |
// unconditionally, because abilities register outside WP-CLI. |
| 106 |
require_once plugin_dir_path( __FILE__ ) . 'includes/agent/class-pixelgrade_assistant-agent-core.php'; |
| 107 |
require_once plugin_dir_path( __FILE__ ) . 'includes/agent/class-pixelgrade_assistant-abilities.php'; |
| 108 |
require_once plugin_dir_path( __FILE__ ) . 'includes/agent/class-pixelgrade_assistant-mcp-server.php'; |
| 109 |
|
| 110 |
// WP-CLI subtree: `wp pixelgrade assist …`. Inert (no-op) outside WP-CLI — see the |
| 111 |
// class_exists( '\WP_CLI' ) guard inside. |
| 112 |
require_once plugin_dir_path( __FILE__ ) . 'includes/cli/class-pixelgrade_assistant-cli.php'; |
| 113 |
|
| 114 |
// Abilities register on `wp_abilities_api_init` (WordPress 6.9+); the MCP server must be wired |
| 115 |
// before the adapter's own `init`/`rest_api_init` hooks fire, so both happen at load time here. |
| 116 |
// Assistant hosts the curated server for the whole stack (contract §4, decision D2) — abilities |
| 117 |
// owned by Style Manager, Pixelgrade Plus and Nova Blocks are aggregated without moving their |
| 118 |
// registrations. |
| 119 |
PixelgradeAssistant_Abilities::register(); |
| 120 |
PixelgradeAssistant_MCP_Server::register(); |
| 121 |
|
| 122 |
/** |
| 123 |
* Returns the main instance of PixelgradeAssistant to prevent the need to use globals. |
| 124 |
* |
| 125 |
* @return PixelgradeAssistant The PixelgradeAssistant instance |
| 126 |
*/ |
| 127 |
function PixelgradeAssistant() { |
| 128 |
/** |
| 129 |
* The core plugin class that is used to define internationalization, |
| 130 |
* admin-specific hooks, and public-facing site hooks. |
| 131 |
*/ |
| 132 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-pixelgrade_assistant.php'; |
| 133 |
|
| 134 |
$instance = PixelgradeAssistant::instance( __FILE__, PIXELGRADE_ASSISTANT__VERSION ); |
| 135 |
|
| 136 |
return $instance; |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* Begins execution of the plugin. |
| 141 |
* |
| 142 |
* Since everything within the plugin is registered via hooks, |
| 143 |
* then kicking off the plugin from this point in the file does |
| 144 |
* not affect the page life cycle. |
| 145 |
*/ |
| 146 |
PixelgradeAssistant(); |
| 147 |
|