PluginProbe ʕ •ᴥ•ʔ
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback / 5.0
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback v5.0
5.1.3 5.1.2 5.1.1 5.1 5.0 trunk 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.2.0 3.2.1 3.22 3.22.1 3.22.2 3.22.3 3.22.4 3.22.5 3.22.6 3.3.0 3.3.1 3.3.2 3.3.2.1 3.3.2.2 3.3.3 3.30 3.31 3.32 3.4 3.4.1 3.4.3 3.4.4 3.5 3.5.1 3.6 3.6.1 3.7 3.8 3.9 3.9.1 3.9.2 3.9.3 3.9.4 3.9.6 3.9.6.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2 4.2.1 4.2.2 4.3 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.4
atarim-visual-collaboration / third-party / content-model / acf / class-avcf-acf-abilities.php
atarim-visual-collaboration / third-party / content-model / acf Last commit date
class-avcf-acf-abilities.php 1 month ago class-avcf-acf-content-models.php 1 month ago class-avcf-acf-detector.php 1 month ago class-avcf-acf-field-groups.php 1 month ago class-avcf-acf-helpers.php 1 month ago
class-avcf-acf-abilities.php
108 lines
1 <?php
2 /**
3 * ACF — Abilities orchestrator.
4 *
5 * Single entry point that registers the read-only check-setup baseline and
6 * dispatches the field-group and content-model ability classes. Called from
7 * doit/class-avcf-mcp.php inside the ACF-available check; each ability class
8 * still sentinel-checks ACF as defence-in-depth.
9 *
10 * Files dispatched:
11 * class-avcf-acf-field-groups.php 5 abilities
12 * class-avcf-acf-content-models.php 15 abilities (CPT/taxonomy/options ×5)
13 * (this file) 1 ability (acf-check-setup)
14 * ─────────────
15 * 21 abilities total
16 *
17 * @package atarim-visual-collaboration
18 */
19
20 if ( ! defined('ABSPATH') ) {
21 exit;
22 }
23
24 class AVCF_Abilities_ACF extends AVCF_Abilities_Base {
25
26 /**
27 * @var AVCF_ACF_Detector
28 */
29 private $detector;
30
31 public function __construct() {
32 $this->detector = new AVCF_ACF_Detector();
33 }
34
35 public function register() {
36 if ( ! $this->detector->avcf_acf_is_available() ) {
37 return;
38 }
39
40 $detector = $this->detector;
41
42 // ---- acf-check-setup ----
43 wp_register_ability( 'atarim/acf-check-setup', [
44 'label' => 'Check ACF Setup',
45 'description' => 'Call this first before any other ACF ability. Reports whether ACF is active, the edition (free / pro), the version, whether the post-type / taxonomy / options-page management abilities are available (these require ACF Pro 6.5+), and counts of currently registered field groups, ACF post types, ACF taxonomies, and ACF options pages. Zero counts mean you are starting fresh.',
46 'category' => 'atarim',
47 'input_schema' => [
48 'type' => 'object',
49 'properties' => [],
50 'additionalProperties' => false,
51 ],
52 'output_schema' => [
53 'type' => 'object',
54 'properties' => [
55 'success' => [ 'type' => 'boolean' ],
56 'active' => [ 'type' => 'boolean' ],
57 'edition' => [ 'type' => 'string' ],
58 'version' => [ 'type' => 'string' ],
59 'supports_content_model_mgmt' => [ 'type' => 'boolean' ],
60 'field_groups_count' => [ 'type' => 'integer' ],
61 'post_types_count' => [ 'type' => 'integer' ],
62 'taxonomies_count' => [ 'type' => 'integer' ],
63 'options_pages_count' => [ 'type' => 'integer' ],
64 'message' => [ 'type' => 'string' ],
65 ],
66 'required' => [ 'success', 'active', 'message' ],
67 ],
68 'execute_callback' => function( $input = [] ) use ( $detector ) {
69 $active = $detector->avcf_acf_is_available();
70 if ( ! $active ) {
71 return [ 'success' => true, 'active' => false, 'message' => 'ACF is not active on this site.' ];
72 }
73 $supports = $detector->avcf_acf_supports_internal_post_types();
74 $fg_count = function_exists( 'acf_get_field_groups' ) ? count( (array) acf_get_field_groups() ) : 0;
75 $cpt = $tax = $opt = 0;
76 if ( $supports ) {
77 $cpt = count( (array) acf_get_internal_post_type_posts( 'acf-post-type' ) );
78 $tax = count( (array) acf_get_internal_post_type_posts( 'acf-taxonomy' ) );
79 $opt = count( (array) acf_get_internal_post_type_posts( 'acf-ui-options-page' ) );
80 }
81 return [
82 'success' => true,
83 'active' => true,
84 'edition' => $detector->avcf_acf_edition(),
85 'version' => $detector->avcf_acf_version(),
86 'supports_content_model_mgmt' => $supports,
87 'field_groups_count' => $fg_count,
88 'post_types_count' => $cpt,
89 'taxonomies_count' => $tax,
90 'options_pages_count' => $opt,
91 'message' => 'OK.',
92 ];
93 },
94 'permission_callback' => function() {
95 return current_user_can( 'manage_options' );
96 },
97 'meta' => [
98 'mcp' => [ 'public' => true, 'type' => 'tool' ],
99 'annotations' => [ 'readonly' => true, 'destructive' => false, 'idempotent' => true ],
100 ],
101 ] );
102
103 // Dispatch the domain clusters.
104 ( new AVCF_ACF_Field_Groups() )->register();
105 ( new AVCF_ACF_Content_Models() )->register();
106 }
107 }
108