| @@ -332,8 +332,29 @@ | ||
| 332 | 332 | } |
| 333 | 333 | return null; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | + public function get_function_by_name( $name, $options = [] ) | |
| 337 | + { | |
| 338 | + $functions = $this->get_functions( ); | |
| 339 | + | |
| 340 | + foreach ( $functions as $function ) { | |
| 341 | + if ( $function['name'] == $name ) { | |
| 342 | + | |
| 343 | + if ( array_key_exists( 'php_ready_args', $options ) && $options['php_ready_args'] === false ) { | |
| 344 | + $function['args'] = array_map( function ( $arg ) { | |
| 345 | + $arg['name'] = ltrim( $arg['name'], '$' ); | |
| 346 | + return $arg; | |
| 347 | + }, $function['args'] ); | |
| 348 | + } | |
| 349 | + | |
| 350 | + return $function; | |
| 351 | + } | |
| 352 | + } | |
| 353 | + | |
| 354 | + return null; | |
| 355 | + } | |
| 356 | + | |
| 336 | 357 | #endregion |
| 337 | 358 | |
| 338 | 359 | #region Utilities |
| 339 | 360 | |
| @@ -346,9 +367,9 @@ | ||
| 346 | 367 | * @throws Exception |
| 347 | 368 | */ |
| 348 | 369 | public function validate( $params ) |
| 349 | 370 | { |
| 350 | - $valide_scopes = ['backend', 'frontend', 'function', 'persistent', 'scheduled']; | |
| 371 | + $valide_scopes = ['backend', 'frontend', 'function', 'persistent', 'scheduled', 'content_php', 'content_js']; | |
| 351 | 372 | $errors = []; |
| 352 | 373 | if ( isset( $params['endpoint'] ) && !empty( $params['endpoint'] ) ) { |
| 353 | 374 | $query = $this->wpdb->prepare( |
| 354 | 375 | "SELECT * FROM $this->table_name where endpoint = %s", |
| @@ -547,9 +568,9 @@ | ||
| 547 | 568 | } |
| 548 | 569 | |
| 549 | 570 | public function stats() |
| 550 | 571 | { |
| 551 | - $scopes = ['function', 'scheduled', 'global']; | |
| 572 | + $scopes = ['function', 'scheduled', 'global', 'content_php', 'content_js']; | |
| 552 | 573 | $globalScopes = ['backend', 'frontend', 'persistent']; |
| 553 | 574 | |
| 554 | 575 | $stats = [ |
| 555 | 576 | 'all' => 0, |