PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.2
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.2
6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 5.6.2 All 33 releases
automatorwp / integrations / jetengine / includes / functions.php

functions.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.2, at integrations/jetengine/includes/functions.php

70 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Functions
4 *
5 * @package AutomatorWP\JetEngine\Functions
6 * @author AutomatorWP <contact@automatorwp.com>, Ruben Garcia <rubengcdev@gmail.com>
7 * @since 1.0.0
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Get JetEngine post type
14 *
15 * @since 1.0.0
16 *
17 * @return array
18 */
19 function automatorwp_jetengine_options_cb_post_type( $field ) {
20
21 // Setup vars
22 $value = $field->escaped_value;
23 $none_value = 'any';
24 $none_label = __( 'any type', 'automatorwp' );
25 $options = automatorwp_options_cb_none_option( $field, $none_value, $none_label );
26
27 $post_types_obj = jet_engine()->cpt;
28 $post_types = $post_types_obj->get_items();
29
30 foreach ( $post_types as $post_type ) {
31
32 if ( ! empty( $post_type['id'] ) && ! empty( $post_type['slug'] ) ) {
33
34 $options[$post_type['slug']] = $post_type['labels']['name'];
35
36 }
37 }
38
39 return $options;
40
41 }
42
43 /**
44 * Check JetEngine post type
45 *
46 * @since 1.0.0
47 *
48 * @param object $post Post data
49 *
50 * @return bool
51 */
52 function automatorwp_jetengine_check_type( $post ) {
53
54 $array_types = array();
55
56 // Get JetEngine post types
57 $post_types_obj = jet_engine()->cpt;
58 $post_types = $post_types_obj->get_items();
59
60 foreach( $post_types as $post_type ) {
61 $array_types[] = $post_type['slug'];
62 }
63
64 // Bail if the post is not a JetEngine type
65 if ( !in_array( $post->post_type, $array_types ) ){
66 return false;
67 }
68
69 return true;
70 }