PluginProbe
Zoho Flow – No-Code Workflow Automation / trunk
Zoho Flow – No-Code Workflow Automation vtrunk
2.14.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 All 56 releases
zoho-flow / settings.php

settings.php in Zoho Flow – No-Code Workflow Automation trunk, at settings.php

156 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly.
5 }
6
7 function zoho_flow_load(){
8 if(did_action('plugins_loaded') === 1){
9
10 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/capabilities.php';
11 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/utils.php';
12 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/integrations.php';
13 if ( is_admin() ) {
14 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/admin/admin.php';
15 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/admin/system-info.php';
16 }
17
18 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/rest-api.php';
19 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/zoho-flow-service.php';
20 require_once WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/zoho-flow-services.php';
21 $zoho_flow_services = Zoho_Flow_Services::get_instance();
22 if ( ! function_exists( 'get_plugins' ) ) {
23 require_once ABSPATH . 'wp-admin/includes/plugin.php';
24 }
25
26 foreach ($zoho_flow_services_config as $service) {
27 $zoho_flow_services->add_service($service);
28 }
29 do_action('zoho_flow_init_services');
30 }
31 }
32 add_action( 'plugins_loaded', 'zoho_flow_load', 10, 0 );
33
34 function zoho_flow_activation(){
35
36 if(!post_type_exists(WP_ZOHO_FLOW_WEBHOOK_POST_TYPE)){
37 register_post_type( WP_ZOHO_FLOW_WEBHOOK_POST_TYPE, array(
38 'labels' => array(
39 'name' => __( 'Zoho Flow Webhooks', 'zoho-flow' ),
40 'singular_name' => __( 'Zoho Flow Webhook', 'zoho-flow' ),
41 ),
42 'rewrite' => false,
43 'query_var' => false,
44 'public' => false,
45 'capability_type' => 'webhook',
46 'capabilities' => array(
47 'edit_post' => 'zoho_flow_edit_webhook',
48 'read_post' => 'zoho_flow_read_webhook',
49 'delete_post' => 'zoho_flow_delete_webhook'
50 ),
51 ) );
52 }
53
54 if(!post_type_exists(WP_ZOHO_FLOW_API_KEY_POST_TYPE)){
55 register_post_type( WP_ZOHO_FLOW_API_KEY_POST_TYPE, array(
56 'labels' => array(
57 'name' => __( 'Zoho Flow API Keys', 'zoho-flow' ),
58 'singular_name' => __( 'Zoho Flow API Keys', 'zoho-flow' ),
59 ),
60 'rewrite' => false,
61 'query_var' => false,
62 'public' => false,
63 'capability_type' => 'api_key',
64 'capabilities' => array(
65 'edit_post' => 'zoho_flow_edit_api_key',
66 'read_post' => 'zoho_flow_read_api_key',
67 'delete_post' => 'zoho_flow_delete_api_key'
68 ),
69 ) );
70 }
71 }
72 register_activation_hook( __FILE__, 'zoho_flow_activation' );
73
74 function zoho_flow_uninstall(){
75 if(post_type_exists(WP_ZOHO_FLOW_WEBHOOK_POST_TYPE)){
76 $webhook_post_ids = get_posts( array(
77 'post_type' => WP_ZOHO_FLOW_WEBHOOK_POST_TYPE,
78 'posts_per_page' => -1,
79 'fields' => 'ids',
80 'no_found_rows' => true,
81 ) );
82 foreach ( $webhook_post_ids as $post_id ) {
83 wp_delete_post( $post_id, true );
84 }
85 unregister_post_type(WP_ZOHO_FLOW_WEBHOOK_POST_TYPE);
86
87 }
88 if(post_type_exists(WP_ZOHO_FLOW_API_KEY_POST_TYPE)){
89 $api_key_post_ids = get_posts( array(
90 'post_type' => WP_ZOHO_FLOW_API_KEY_POST_TYPE,
91 'posts_per_page' => -1,
92 'fields' => 'ids',
93 'no_found_rows' => true,
94 ) );
95 foreach ( $api_key_post_ids as $post_id ) {
96 wp_delete_post( $post_id, true );
97 }
98 unregister_post_type( WP_ZOHO_FLOW_API_KEY_POST_TYPE );
99 }
100
101 }
102 register_uninstall_hook(__FILE__, 'zoho_flow_uninstall');
103
104 add_action('admin_enqueue_scripts', 'zoho_flow_enqueue_thickbox');
105 function zoho_flow_enqueue_thickbox() {
106
107 wp_enqueue_script('thickbox');
108 wp_enqueue_style('thickbox');
109
110 wp_enqueue_script(
111 'zoho-flow-deactivation-js',
112 plugins_url('assets/js/zoho-flow-deactivation.js', __FILE__),
113 array('jquery', 'thickbox'), // Dependencies
114 '1.0', // Version
115 true // Load in footer
116 );
117
118 wp_localize_script('zoho-flow-deactivation-js', 'zohoFlow', array(
119 'ajaxurl' => admin_url('admin-ajax.php'),
120 'nonce' => wp_create_nonce('zoho_flow_deactivate_nonce'),
121 ));
122
123 wp_enqueue_style(
124 'zoho-flow-deactivation-css',
125 plugins_url('assets/css/zoho-flow-deactivation.css', __FILE__),
126 array('thickbox'),
127 '1.0',
128 'all'
129 );
130 }
131
132 add_action('wp_ajax_zoho_flow_deactivate_plugin', 'zoho_flow_deactivate_plugin');
133 function zoho_flow_deactivate_plugin() {
134
135 check_ajax_referer('zoho_flow_deactivate_nonce', 'zf_deactivate_nonce');
136
137 if (!current_user_can('activate_plugins')) {
138 wp_send_json_error('Unauthorized', 403);
139 }
140
141 $plugin = WP_ZOHO_FLOW_PLUGIN_NAME.'/zoho-flow.php';
142 deactivate_plugins($plugin);
143
144 wp_send_json_success('Plugin deactivated');
145 }
146
147 add_filter('plugin_action_links_' . WP_ZOHO_FLOW_PLUGIN_NAME . '/zoho-flow.php', 'zoho_flow_deactivation_link');
148 function zoho_flow_deactivation_link($links) {
149
150 $form_url = 'https://creatorapp.zohopublic.in/zohointranet/zoho-flow/form-embed/Wordpress_showcase_page_deactivation_form/vmkOy5mh2201nr0Odr4KxVsHZgr9M0NQveBR57Kuk2wTkJ1yOSpCpWuGZRxObxaT9SXZhu7bkbAYyZMdx1D25rOzP2qqx22Mgwk1';
151
152 $links['deactivate'] = '<a href="' . esc_url($form_url) . '?zc_BdrClr=ffffff&zc_Header=false&TB_iframe=true&width=320&height=440" class="thickbox zf-deactivation-popup" title="Deactivate Zoho Flow?">Deactivate</a>';
153 return $links;
154 }
155
156