PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.4.8
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.4.8
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
← All changes | classes/modules/snippet.php +1 -34 0.5.70.4.8 View file →
@@ -137,15 +137,13 @@
137 137 $snippet['functionArgs'] = [];
138 138 $snippet['functionArgsDict'] = [];
139 139 $snippet['functionBehavior'] = '';
140 140 $snippet['functionTarget'] = 'PHP';
141 - $snippet['functionMcp'] = false;
142 141
143 142 foreach ( $functions_snippet as $function_snippet ) {
144 143 if ( $function_snippet['snippetId'] == $snippetId ) {
145 144
146 145 $snippet['functionName'] = $function_snippet['name'];
147 - $snippet['functionMcp'] = !empty( $function_snippet['mcp'] );
148 146 if ( !isset( $function_snippet['behavior'] ) || empty( $function_snippet['behavior'] ) ) {
149 147 $snippet['functionBehavior'] = 'dynamic';
150 148 }
151 149 else {
@@ -217,9 +215,8 @@
217 215 'name' => $params['functionName'],
218 216 'behavior' => $params['functionBehavior'],
219 217 'desc' => $params['description'] ?? '',
220 218 'target' => $params['functionTarget'] ?? 'PHP',
221 - 'mcp' => !empty( $params['functionMcp'] ),
222 219 'args' => [],
223 220 ];
224 221
225 222 foreach ( $params['functionArgs'] as $argName ) {
@@ -356,27 +353,8 @@
356 353
357 354 return null;
358 355 }
359 356
360 - /**
361 - * Return the snippet IDs of every function that opted in to MCP exposure.
362 - * Used by the "MCP" list filter and its count (functionMcp lives in the
363 - * functions option, not a snippets table column, so it can't be queried in SQL).
364 - *
365 - * @return int[]
366 - */
367 - public function get_mcp_function_ids()
368 - {
369 - $functions = get_option( $this->option_functions, [] );
370 - $ids = [];
371 - foreach ( $functions as $fn ) {
372 - if ( !empty( $fn['mcp'] ) && !empty( $fn['snippetId'] ) ) {
373 - $ids[] = (int) $fn['snippetId'];
374 - }
375 - }
376 - return $ids;
377 - }
378 -
379 357 #endregion
380 358
381 359 #region Utilities
382 360
@@ -612,11 +590,8 @@
612 590
613 591 // Combined count for the "Content" filter (PHP + JS). Not added to 'all', already counted above.
614 592 $stats['content'] = (int) $stats['content_php'] + (int) $stats['content_js'];
615 593
616 - // Functions exposed via MCP. A subset of 'function', so not added to 'all'.
617 - $stats['mcp'] = count( $this->get_mcp_function_ids() );
618 -
619 594 return $stats;
620 595 }
621 596
622 597 public function import( )
@@ -733,17 +708,9 @@
733 708 $where[] = $this->wpdb->prepare( "active = %d", $value );
734 709 } elseif ( $filter['accessor'] === 'endpoint' ) {
735 710 $where[] = boolval( $filter['value'] ) ? "endpoint <> ''" : "endpoint = ''";
736 711 } elseif ( $filter['accessor'] === 'scope' ) {
737 - if ( $filter['value'] === 'mcp' ) {
738 - // Not a scope: constrain to the functions opted in to MCP exposure.
739 - $ids = $this->get_mcp_function_ids();
740 - if ( empty( $ids ) ) {
741 - $where[] = '1 = 0';
742 - } else {
743 - $where[] = 'id IN (' . implode( ',', array_map( 'intval', $ids ) ) . ')';
744 - }
745 - } else if ( is_array( $filter['value'] ) ) {
712 + if ( is_array( $filter['value'] ) ) {
746 713 $scopes = array_map( function( $scope ) {
747 714 return esc_sql( $scope );
748 715 }, $filter['value'] );
749 716 $where[] = "scope IN ('" . implode( "', '", $scopes ) . "')";