/var/www/html_uk/wp-content/plugins/automatewoo/includes/Actions/Custom_Function.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
// phpcs:ignoreFile

namespace AutomateWoo;

if ( ! 
defined'ABSPATH' ) ) exit;

/**
 * @class Action_Custom_Function
 */
class Action_Custom_Function extends Action {


    function 
load_admin_details() {
        
$this->title       __'Custom Function''automatewoo' );
        
$this->description sprintf(
            
/* translators: %1$s documentation link start, %2$s documentation link end. */
            
__'This action can be used by developers to trigger custom code from a workflow. %1$sView documentation%2$s.''automatewoo' ),
            
'<a href="' Admin::get_docs_link'actions/custom-functions/' ) . '">',
            
'</a>'
        
);
    }


    function 
load_fields() {
        
$function_name = new Fields\Text();
        
$function_name->set_title__'Function name''automatewoo'  ) );
        
$function_name->set_name('function_name');

        
$this->add_field($function_name);
    }


    function 
run() {
        
$function $this->get_option'function_name' );
        if ( 
function_exists$function ) ) {
            
call_user_func$function$this->workflow );
        }
    }

}