PluginProbe
Extendify / 3.2.3
Extendify v3.2.3
3.2.3 3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 All 129 releases
← All changes | app/Agent/Admin.php +37 -7 3.1.6 → 3.2.3 View file →
@@ -11,8 +11,9 @@
11 11 use Extendify\Agent\Controllers\ChatHistoryController;
12 12 use Extendify\Agent\Controllers\TourController;
13 13 use Extendify\Config;
14 14 use Extendify\Constants;
15 +use Extendify\Mcp\Profile as McpProfile;
15 16 use Extendify\Shared\Services\Escaper;
16 17 use Extendify\Shared\Services\HttpClient;
17 18 use Extendify\Agent\TagBlocks;
18 19 use Extendify\Agent\TagTemplateParts;
@@ -17,11 +18,11 @@
17 18 use Extendify\Agent\TagBlocks;
18 19 use Extendify\Agent\TagTemplateParts;
19 20 use Extendify\Agent\WooProductImages;
20 21 use Extendify\Agent\AbilitiesDiscovery;
21 -use Extendify\Agent\Controllers\SiteNavigationController;
22 22 use Extendify\PartnerData;
23 23 use Extendify\Shared\DataProvider\ProductsData;
24 +use Extendify\SiteVisibility;
24 25
25 26 /**
26 27 * This class handles any file loading for the admin area.
27 28 */
@@ -41,11 +42,8 @@
41 42 // Tag blocks so we can identify them later
42 43 TagBlocks::init();
43 44 TagTemplateParts::init();
44 45
45 - // Add the site navigation ids to the navigation blocks
46 - SiteNavigationController::init();
47 -
48 46 Skeleton::init();
49 47
50 48 WooProductImages::init();
51 49
@@ -74,9 +72,9 @@
74 72 public function loadScriptsAndStyles()
75 73 {
76 74 // The Customizer preview iframe is a front-end render, so this fires
77 75 // there too — but the Agent only belongs on the live, top-level page.
78 - if (is_customize_preview()) {
76 + if (is_customize_preview() || McpProfile::isOwnScreen()) {
79 77 return;
80 78 }
81 79
82 80 $version = constant('EXTENDIFY_DEVMODE') ? uniqid() : Config::$version;
@@ -118,8 +116,10 @@
118 116 (bool) use_block_editor_for_post($this->getCurrentPostId()) :
119 117 false,
120 118 'isOnEditorOrFSE' => $this->isGutenbergOrFse(),
121 119 'activePlugins' => array_values(\get_option('active_plugins', [])),
120 + // The accessor also reads a key set by the IMAGIFY_API_KEY constant.
121 + 'hasImagifyApiKey' => function_exists('get_imagify_option') && (bool) \get_imagify_option('api_key'),
122 122 'isUsingVibes' => version_compare((string) wp_get_theme('extendable')->get('Version'), '2.0.32', '>='),
123 123 'siteTitle' => \esc_attr(\get_bloginfo('name')),
124 124 'siteDescription' => \esc_attr(\get_bloginfo('description')),
125 125 'themePresets' => $this->getThemePresets(),
@@ -139,8 +139,12 @@
139 139 }, $pluginRecommendations));
140 140 $agentContext = [
141 141 'availableAdminPages' => get_option('_transient_extendify_admin_pages_menu', []),
142 142 'pluginRecommendations' => $mappedPluginRecommendations,
143 + 'sitePublished' => SiteVisibility::isPublished(),
144 + 'comingSoonEnabled' => (bool) PartnerData::setting('useComingSoon'),
145 + 'searchEngineBlockEnabled' => (bool) PartnerData::setting('useSearchEngineBlock'),
146 + 'searchEnginesBlocked' => SiteVisibility::searchEnginesBlocked(),
143 147 ];
144 148 $abilities = [
145 149 'canEditPost' => (bool) \current_user_can('edit_post', \get_queried_object_id()),
146 150 // TODO: this may be true for a user, while they still can't edit every post
@@ -173,10 +177,9 @@
173 177 // For example, we could check whether their theme has variations.
174 178 'abilities' => $abilities,
175 179 // Registered WordPress Abilities (6.9+) this user may run.
176 180 'wpAbilities' => AbilitiesDiscovery::discover(),
177 - // List of suggestions the AI can make for this user.
178 - // For example, we could check whether they need to set up a specific plugin.
181 + // The domain card reads only the register-domain record.
179 182 'suggestions' => $this->getSuggestions(),
180 183 'domainsSuggestionSettings' => [
181 184 'showPrimary' => (bool) PartnerData::setting('showPrimaryDomainRecommendationAgent'),
182 185 'showSecondary' => (bool) PartnerData::setting('showSecondaryDomainRecommendationAgent'),
@@ -311,12 +314,39 @@
311 314 $typography = \wp_get_global_settings(['typography']);
312 315
313 316 return [
314 317 'color' => $this->originSlugs($color, 'palette', 'defaultPalette'),
318 + 'colorValues' => $this->originValues($color, 'palette', 'defaultPalette', 'color'),
315 319 'gradient' => $this->originSlugs($color, 'gradients', 'defaultGradients'),
316 320 'fontSize' => $this->originSlugs($typography, 'fontSizes', 'defaultFontSizes'),
317 321 'fontFamily' => $this->originSlugs($typography, 'fontFamilies', 'defaultFontFamilies'),
318 322 ];
323 + }
324 +
325 + /**
326 + * Slug => value, so a colour written as its own hex finds the token naming it.
327 + *
328 + * @return array<string, string>
329 + */
330 + private function originValues($node, $listKey, $defaultKey, $valueKey)
331 + {
332 + $list = $node[$listKey] ?? [];
333 +
334 + $origins = ['custom', 'theme'];
335 + if (($node[$defaultKey] ?? true) !== false) {
336 + $origins[] = 'default';
337 + }
338 +
339 + $values = [];
340 + foreach ($origins as $origin) {
341 + foreach ($list[$origin] ?? [] as $item) {
342 + if (isset($item['slug'], $item[$valueKey])) {
343 + $values[(string) $item['slug']] = (string) $item[$valueKey];
344 + }
345 + }
346 + }
347 +
348 + return $values;
319 349 }
320 350
321 351 /**
322 352 * Preset slugs from a settings node's origin buckets; drops the `default`