Automator_Get_Data::closure_integration_from_closure_code( null $closure_code = null )
Accepts a closure code(most like from closure meta) and returns that associated closure integration
Contents
Parameters Parameters
- $closure_code
-
(null) (Optional)
Default value: null
Return Return
(string)
Source Source
File: src/core/lib/utilities/class-automator-get-data.php
public function closure_integration_from_closure_code( $closure_code = null ) { if ( null === $closure_code || ! is_string( $closure_code ) ) { Automator()->error->add_error( 'closure_integration_from_closure_code', 'ERROR: You are trying to get a action integration code from a action code without providing an $action_code', $this ); return null; } // Load all default trigger settings $system_closures = Automator()->get_closures(); if ( empty( $system_closures ) ) { return null; } foreach ( $system_closures as $system_closure ) { if ( $system_closure['code'] === $closure_code ) { return $system_closure['integration']; } } global $wpdb; // Integration is not active ... get integration from DB return $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'code' AND meta_value = %s ) AND meta_key = 'integration'", $closure_code ) ); }
Expand full source code Collapse full source code View on Github