| @@ -241,8 +241,20 @@ | ||
| 241 | 241 | * |
| 242 | 242 | * @return mixed The result of the snippet execution. |
| 243 | 243 | * @throws Exception If the snippet cannot be executed. |
| 244 | 244 | */ |
| 245 | + /** | |
| 246 | + * Declare every active PHP function snippet in the current request so they can call | |
| 247 | + * one another, without executing any of them. Idempotent and cheap (runs once per | |
| 248 | + * request). executeSnippet()/executeSnippetByName() already call this internally, so | |
| 249 | + * you only need it to make function snippets callable from your own custom PHP. | |
| 250 | + * | |
| 251 | + * @return void | |
| 252 | + */ | |
| 253 | + public function loadFunctions() { | |
| 254 | + $this->core->define_all_functions(); | |
| 255 | + } | |
| 256 | + | |
| 245 | 257 | public function executeSnippetByName( $name, $args = [] ) { |
| 246 | 258 | try { |
| 247 | 259 | if ( empty( $name ) ) { |
| 248 | 260 | throw new Exception( 'The snippet name is required.' ); |