PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 2.7.0
WDesignKit – AI Templates, Widget Builder & MCP Workflow v2.7.0
2.7.0 2.6.6 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.0 2.3.3 2.3.2 2.3.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 All 129 releases
← All changes | includes/abilities/code-snippets/wdesignkit-get-snippet.php +16 -2 2.6.2 → 2.7.0 View file →
@@ -41,8 +41,9 @@
41 41 ],
42 42 'execute_callback' => 'wdesignkit_mcp_get_snippet_info',
43 43 'permission_callback' => 'wdesignkit_mcp_permission_callback',
44 44 'meta' => [
45 + 'public' => true,
45 46 'show_in_rest' => true,
46 47 'mcp' => ['public' => true],
47 48 'annotations' => [
48 49 'instructions' => implode("\n", [
@@ -97,8 +98,9 @@
97 98 ],
98 99 'execute_callback' => 'wdesignkit_mcp_get_existing_snippet',
99 100 'permission_callback' => 'wdesignkit_mcp_permission_callback',
100 101 'meta' => [
102 + 'public' => true,
101 103 'show_in_rest' => true,
102 104 'mcp' => ['public' => true],
103 105 'annotations' => [
104 106 'instructions' => implode("\n", [
@@ -130,8 +132,14 @@
130 132 $file_based = new \Nexter_Code_Snippets_File_Based();
131 133 $file_code_list = $file_based->getSnippetData($file_id);
132 134
133 135 if (!empty($file_code_list) && is_array($file_code_list)) {
136 + $lang_code = (string) ($file_code_list['langCode'] ?? '');
137 + $type = strtolower((string) ($file_code_list['type'] ?? ''));
138 + if ($type === 'php' && $lang_code !== '' && !preg_match('/^\s*<\?php/i', $lang_code)) {
139 + $lang_code = "<?php\n" . $lang_code;
140 + }
141 +
134 142 return [
135 143 'success' => true,
136 144 'message' => '',
137 145 'source' => 'file',
@@ -142,9 +150,9 @@
142 150 'type' => $file_code_list['type'] ?? '',
143 151 'status' => $file_code_list['status'] ?? 0,
144 152 'tags' => $file_code_list['tags'] ?? [],
145 153 'codeExecute' => $file_code_list['codeExecute'] ?? '',
146 - 'langCode' => $file_code_list['langCode'] ?? '',
154 + 'langCode' => $lang_code,
147 155 ],
148 156 ];
149 157 }
150 158
@@ -157,8 +165,14 @@
157 165 if (class_exists('Nexter_Code_Snippets_File_Based')) {
158 166 $file_based = new \Nexter_Code_Snippets_File_Based();
159 167 $file_code_list = $file_based->getSnippetData((string) $post_id);
160 168 if (!empty($file_code_list) && is_array($file_code_list)) {
169 + $lang_code = (string) ($file_code_list['langCode'] ?? '');
170 + $type = strtolower((string) ($file_code_list['type'] ?? ''));
171 + if ($type === 'php' && $lang_code !== '' && !preg_match('/^\s*<\?php/i', $lang_code)) {
172 + $lang_code = "<?php\n" . $lang_code;
173 + }
174 +
161 175 return [
162 176 'success' => true,
163 177 'message' => '',
164 178 'source' => 'file',
@@ -169,9 +183,9 @@
169 183 'type' => $file_code_list['type'] ?? '',
170 184 'status' => $file_code_list['status'] ?? 0,
171 185 'tags' => $file_code_list['tags'] ?? [],
172 186 'codeExecute' => $file_code_list['codeExecute'] ?? '',
173 - 'langCode' => $file_code_list['langCode'] ?? '',
187 + 'langCode' => $lang_code,
174 188 ],
175 189 ];
176 190 }
177 191 }