Automator_Recipe_Process_Complete::closures( null $recipe_id = null, null $user_id = null, null $recipe_log_id = null, array $args = array() )
Complete all closures in recipe
Contents
Parameters Parameters
- $recipe_id
-
(Optional)
Default value: null
- $user_id
-
(Optional)
Default value: null
- $recipe_log_id
-
(Optional)
Default value: null
- $args
-
(Optional)
Default value: array()
Return Return
(bool)
Source Source
File: src/core/lib/process/class-automator-recipe-process-complete.php
public function closures( $recipe_id = null, $user_id = null, $recipe_log_id = null, $args = array() ) { $recipe_closure_data = Automator()->get_recipe_data( 'uo-closure', $recipe_id ); foreach ( $recipe_closure_data as $closure_data ) { $closure_code = $closure_data['meta']['code']; $closure_status = $closure_data['post_status']; $closure_data['recipe_log_id'] = $recipe_log_id; $closure_integration = Automator()->get->closure_integration_from_closure_code( $closure_code ); if ( 1 === Automator()->plugin_status->get( $closure_integration ) && 'publish' === $closure_status ) { // The plugin for this action is active .. execute $closure_execution_function = Automator()->get->closure_execution_function_from_closure_code( $closure_code ); call_user_func_array( $closure_execution_function, array( $user_id, $closure_data, $recipe_id, $args, ) ); } else { // The plugin for this action is NOT active Automator()->error->add_error( 'complete_closures', 'ERROR: You are trying to complete ' . $closure_code . ' and the plugin ' . $closure_integration . ' is not active.', $this ); } } do_action_deprecated( 'uap_closures_completed', array( $recipe_id, $user_id, $args, ), '3.0', 'automator_closures_completed' ); do_action( 'automator_closures_completed', $recipe_id, $user_id, $args ); return true; }
Expand full source code Collapse full source code View on Github