| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly. |
| 5 |
} |
| 6 |
add_action( 'admin_init', 'zoho_flow_admin_init', 10, 0 ); |
| 7 |
|
| 8 |
function zoho_flow_admin_init() { |
| 9 |
do_action( 'zoho_flow_admin_init' ); |
| 10 |
} |
| 11 |
|
| 12 |
add_action( 'admin_menu', 'zoho_flow_admin_menu', 9, 0 ); |
| 13 |
function zoho_flow_admin_menu() { |
| 14 |
global $_wp_last_object_menu; |
| 15 |
|
| 16 |
$_wp_last_object_menu++; |
| 17 |
|
| 18 |
do_action( 'zoho_flow_admin_menu' ); |
| 19 |
|
| 20 |
add_menu_page( |
| 21 |
__( 'Zoho Flow', 'zoho-flow' ) |
| 22 |
,__( 'Zoho Flow', 'zoho-flow' ) |
| 23 |
,'zoho_flow_admin_page' |
| 24 |
, 'zoho_flow' |
| 25 |
,'zoho_flow_show_admin_page' |
| 26 |
, 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDEwMjQgMTAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiMwMDA7fQoJLnN0MXtmaWxsOiMwMDk4NDk7fQoJLnN0MntmaWxsOiNGRkZGRkY7fQo8L3N0eWxlPgo8cmVjdCBjbGFzcz0ic3QwIiB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB0cmFuc2Zvcm09InNjYWxlKC4wMDA2KSIvPgo8Zz4KCTxnPgoJCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0yMTEuMDMsODU1LjQ4Yy0xMC4zNywwLTIwLjQ1LTUuMzgtMjYuMDEtMTVMNC4wMiw1MjdjLTUuMzYtOS4yOC01LjM2LTIwLjcyLDAtMzBsMjQxLTQxNy4zOAoJCQljNS4zNi05LjI4LDE1LjI2LTE1LDI1Ljk4LTE1aDQ4MmMxNC4xNywwLDI2LjUzLDkuODYsMjkuNDcsMjMuNzJjMi45MywxMy44NC00LjA4LDI3Ljc5LTE2Ljk5LDMzLjU2CgkJCWMtMS43OSwwLjg1LTQyLjkzLDIwLjgxLTg5LjIyLDcwLjkyYy0yNy42LDI5Ljg3LTUxLjY0LDY0LjUxLTcxLjQ3LDEwMi45NWMtMTkuODEsMzguNDEtMzUuNDUsODAuNzYtNDYuNjYsMTI2LjI5bDgyLjc2LTAuMDYKCQkJYzAuMDEsMCwwLjAxLDAsMC4wMiwwYzE2LjU2LDAsMjkuOTksMTMuNDIsMzAsMjkuOThjMC4wMSwxNi41Ny0xMy40MSwzMC4wMS0yOS45OCwzMC4wMmwtMTIwLDAuMDhjLTAuMDEsMC0wLjAxLDAtMC4wMiwwCgkJCWMtOC45MywwLTE3LjQtMy45OC0yMy4xLTEwLjg2Yy01LjctNi44OC04LjA0LTE1Ljk1LTYuMzgtMjQuNzNjMTIuNDctNjUuNzgsMzMuMDYtMTI2LjQ5LDYxLjE5LTE4MC40NgoJCQljMjIuNjgtNDMuNTEsNTAuMjktODIuNzQsODIuMDUtMTE2LjYxYzguNTYtOS4xMiwxNi45OC0xNy4zOCwyNS4wOS0yNC44MkgyODguMzJMNjQuNjQsNTEybDE3Mi4zNCwyOTguNDcKCQkJYzguMjgsMTQuMzUsMy4zNywzMi43LTEwLjk4LDQwLjk4QzIyMS4yOCw4NTQuMTgsMjE2LjEyLDg1NS40OCwyMTEuMDMsODU1LjQ4eiIvPgoJPC9nPgoJPGc+CgkJPHBhdGggY2xhc3M9InN0MiIgZD0iTTc1Myw5NTkuMzhIMjcxYy0xNC4xNywwLTI2LjUzLTkuODYtMjkuNDctMjMuNzJjLTIuOTMtMTMuODQsNC4wOC0yNy43OSwxNi45OS0zMy41NgoJCQljMS43MS0wLjgxLDQyLjg4LTIwLjc2LDg5LjIyLTcwLjkxYzI3LjU5LTI5Ljg3LDUxLjYzLTY0LjUsNzEuNDYtMTAyLjkzYzE5LjgxLTM4LjQsMzUuNDUtODAuNzUsNDYuNjctMTI2LjI3bC04Mi43NiwwCgkJCWMtMTYuNTcsMC0zMC0xMy40My0zMC0zMGMwLTE2LjU3LDEzLjQzLTMwLDMwLTMwbDExOS45OCwwYzguOTQsMCwxNy40MSwzLjk4LDIzLjExLDEwLjg3YzUuNyw2Ljg4LDguMDMsMTUuOTUsNi4zNywyNC43MwoJCQljLTEyLjQ3LDY1Ljc2LTMzLjA2LDEyNi40Ni02MS4yLDE4MC40MWMtMjIuNjgsNDMuNS01MC4yOSw4Mi43Mi04Mi4wNSwxMTYuNThjLTguNTUsOS4xMi0xNi45NiwxNy4zNy0yNS4wNywyNC44aDM3MS40NAoJCQlMOTU5LjM2LDUxMkw3ODcuMTcsMjEzLjc4Yy04LjI4LTE0LjM1LTMuMzctMzIuNywxMC45OC00MC45OGMxNC4zNS04LjI5LDMyLjctMy4zNyw0MC45OCwxMC45OEwxMDE5Ljk4LDQ5NwoJCQljNS4zNiw5LjI4LDUuMzYsMjAuNzIsMCwzMGwtMjQxLDQxNy4zOEM3NzMuNjIsOTUzLjY3LDc2My43Miw5NTkuMzgsNzUzLDk1OS4zOHoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K' |
| 27 |
,$_wp_last_object_menu ); |
| 28 |
|
| 29 |
add_submenu_page( |
| 30 |
'zoho_flow' |
| 31 |
,__( 'Zoho Flow', 'zoho-flow' ) |
| 32 |
,__( 'Integrations', 'zoho-flow' ) |
| 33 |
,'zoho_flow_admin_page' |
| 34 |
,'zoho_flow' |
| 35 |
,'zoho_flow_show_admin_page'); |
| 36 |
|
| 37 |
add_submenu_page( |
| 38 |
'zoho_flow' |
| 39 |
,__( 'Zoho Flow', 'zoho-flow' ) |
| 40 |
,__( 'Settings', 'zoho-flow' ) |
| 41 |
,'zoho_flow_admin_page' |
| 42 |
,'zoho_flow_system_info' |
| 43 |
,'zoho_flow_show_system_info_page'); |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
add_filter( 'admin_footer_text', 'zoho_flow_admin_footer_text', 1 ); |
| 48 |
function zoho_flow_admin_footer_text( $footer_text ) { |
| 49 |
if ( ! current_user_can( 'zoho_flow_admin_page' ) ) { |
| 50 |
return $footer_text; |
| 51 |
} |
| 52 |
$current_screen = get_current_screen(); |
| 53 |
|
| 54 |
if(isset( $current_screen->id ) && (($current_screen->id == 'toplevel_page_zoho_flow') || ($current_screen->id == 'zoho-flow_page_zoho_flow_system_info'))){ |
| 55 |
$footer_text = sprintf( |
| 56 |
/* translators: 1: Zoho Flow 2:: five stars */ |
| 57 |
esc_html__( 'If you love using %1$s, please leave us a %2$s rating.', 'zoho-flow' ), |
| 58 |
sprintf( '<strong>%s</strong>', esc_html__( 'Zoho Flow', 'zoho-flow' ) ), |
| 59 |
'<a href="https://wordpress.org/support/plugin/zoho-flow/reviews?rate=5#new-post" target="_blank" class="zoho-flow-rating-link" data-rated="' . esc_attr__( 'Thanks 😊', 'zoho-flow' ) . '">★★★★★</a>' |
| 60 |
); |
| 61 |
} |
| 62 |
return $footer_text; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
add_action( 'wp_ajax_zoho_flow_rated', 'zoho_flow_rated' ); |
| 67 |
function zoho_flow_rated(){ |
| 68 |
if ( ! current_user_can( 'zoho_flow_admin_page' ) ) { |
| 69 |
wp_die( -1 ); |
| 70 |
} |
| 71 |
update_option( 'zoho_flow_admin_footer_text_rated', 1 ); |
| 72 |
update_option( 'last_review_notice_date', gmdate( 'Y-m-d', strtotime( '+2 months', current_time( 'timestamp', true ) ) ) ); |
| 73 |
wp_die(); |
| 74 |
} |
| 75 |
|
| 76 |
function zoho_flow_enqueue_scripts(){ |
| 77 |
$admin_js_version = filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-admin.js' ); |
| 78 |
$review_notice_js_version = filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-review-notice.js' ); |
| 79 |
$suggestion_notice_js_version = filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-suggestion-notice.js' ); |
| 80 |
$system_info_js_version = filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-system-info.js' ); |
| 81 |
$admin_css_version = filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/css/zoho-flow-admin.css' ); |
| 82 |
|
| 83 |
wp_register_script('zoho-flow-admin', plugins_url('../assets/js/zoho-flow-admin.js', __FILE__), array('jquery'), $admin_js_version, false); |
| 84 |
wp_register_script('zoho-flow-review-notice', plugins_url('../assets/js/zoho-flow-review-notice.js', __FILE__), array('jquery'), $review_notice_js_version, false); |
| 85 |
wp_register_script('zoho-flow-suggestion-notice', plugins_url('../assets/js/zoho-flow-suggestion-notice.js', __FILE__), array('jquery'), $suggestion_notice_js_version, false); |
| 86 |
wp_register_script('zoho-flow-system-info', plugins_url('../assets/js/zoho-flow-system-info.js', __FILE__), array('jquery'), $system_info_js_version, false); |
| 87 |
wp_localize_script( |
| 88 |
'zoho-flow-review-notice', |
| 89 |
'zohoFlowReviewNotice', |
| 90 |
array( |
| 91 |
'nonce' => wp_create_nonce( 'zoho_flow_change_next_review_date' ), |
| 92 |
) |
| 93 |
); |
| 94 |
wp_localize_script( |
| 95 |
'zoho-flow-suggestion-notice', |
| 96 |
'zohoFlowSuggestionNotice', |
| 97 |
array( |
| 98 |
'nonce' => wp_create_nonce( 'zoho_flow_change_next_suggestion_date' ), |
| 99 |
) |
| 100 |
); |
| 101 |
$i18n_array = array( |
| 102 |
'enter_description' => __('Enter description', 'zoho-flow'), |
| 103 |
'generating' => __('Generating...', 'zoho-flow'), |
| 104 |
'generate' => __('Generate', 'zoho-flow'), |
| 105 |
'remove_api_key_confirmation' => __('Remove API key?', 'zoho-flow'), |
| 106 |
'unable_to_copy_api_key' => __('Unable to copy the API key', 'zoho-flow') |
| 107 |
); |
| 108 |
wp_localize_script( 'zoho-flow-admin', 'i18n', $i18n_array ); |
| 109 |
wp_enqueue_script('zoho-flow-admin'); |
| 110 |
|
| 111 |
wp_register_style('zoho-flow-admin', plugins_url('../assets/css/zoho-flow-admin.css', __FILE__), array(), $admin_css_version); |
| 112 |
wp_enqueue_style('zoho-flow-admin'); |
| 113 |
|
| 114 |
add_thickbox(); |
| 115 |
} |
| 116 |
|
| 117 |
function zoho_flow_generate_api_key(){ |
| 118 |
if ( ! current_user_can( 'zoho_flow_admin_page' ) ) { |
| 119 |
return new WP_Error( 'ajax_forbidden', esc_html__( 'You are not allowed to perform the operation.', 'zoho-flow'), array( 'status' => 403 ) ); |
| 120 |
} |
| 121 |
if(isset($_POST['service_id'], $_POST['api_key_generation_nonce'])) { |
| 122 |
if(!wp_verify_nonce(sanitize_key(wp_unslash($_POST['api_key_generation_nonce'])),'generate_api_key')){ |
| 123 |
wp_send_json_error(__('Unable to generate API Key. Please try after refreshing the page.', 'zoho-flow'), 403); |
| 124 |
}else{ |
| 125 |
$service_id = sanitize_key(wp_unslash($_POST['service_id'])); |
| 126 |
$description = isset($_POST['description']) ? sanitize_text_field(wp_unslash($_POST['description'])) : ''; |
| 127 |
$service = Zoho_Flow_Services::get_instance()->get_service($service_id)['instance']; |
| 128 |
if(isset($service)){ |
| 129 |
$result = $service->generate_api_key($description); |
| 130 |
if(is_wp_error($result)){ |
| 131 |
if(isset($result->get_error_data()['status'])){ |
| 132 |
$status = $result->get_error_data()['status']; |
| 133 |
wp_send_json_error($result->get_error_message(), $status); |
| 134 |
} |
| 135 |
else{ |
| 136 |
wp_send_json_error($result, 500); |
| 137 |
} |
| 138 |
} |
| 139 |
else{ |
| 140 |
update_option( 'last_review_notice_date', gmdate( 'Y-m-d', strtotime( '-4 months', current_time( 'timestamp', true ) ) ) ); |
| 141 |
echo esc_html( $result ); |
| 142 |
} |
| 143 |
} |
| 144 |
else{ |
| 145 |
wp_send_json_error(__('Service not found', 'zoho-flow'), 400); |
| 146 |
} |
| 147 |
} |
| 148 |
} |
| 149 |
wp_die(); |
| 150 |
} |
| 151 |
add_action( 'wp_ajax_zoho_flow_generate_api_key', 'zoho_flow_generate_api_key' ); |
| 152 |
|
| 153 |
function zoho_flow_remove_api_key(){ |
| 154 |
if ( ! current_user_can( 'zoho_flow_admin_page' ) ) { |
| 155 |
return new WP_Error( 'ajax_forbidden', esc_html__( 'You are not allowed to perform the operation.', 'zoho-flow'), array( 'status' => 403 ) ); |
| 156 |
} |
| 157 |
if(isset($_POST['service_id'], $_POST['api_key_id'], $_POST['api_key_removal_nonce'])) { |
| 158 |
if(!wp_verify_nonce(sanitize_key(wp_unslash($_POST['api_key_removal_nonce'])),'remove_api_key')){ |
| 159 |
wp_send_json_error(__('Unable to remove API Key. Please try after refreshing the page.', 'zoho-flow'), 403); |
| 160 |
}else{ |
| 161 |
$api_key_id = sanitize_text_field(wp_unslash($_POST['api_key_id'])); |
| 162 |
if(!ctype_digit($api_key_id)){ |
| 163 |
wp_send_json_error(__('Invalid API Key ID provided', 'zoho-flow'), 400); |
| 164 |
wp_die(); |
| 165 |
return; |
| 166 |
} |
| 167 |
$service_id = sanitize_key(wp_unslash($_POST['service_id'])); |
| 168 |
$service = Zoho_Flow_Services::get_instance()->get_service($service_id)['instance']; |
| 169 |
if(isset($service)){ |
| 170 |
$result = $service->remove_api_key($api_key_id); |
| 171 |
if(is_wp_error($result)){ |
| 172 |
if(isset($result->get_error_data()['status'])){ |
| 173 |
$status = $result->get_error_data()['status']; |
| 174 |
wp_send_json_error($result->get_error_message(), $status); |
| 175 |
} |
| 176 |
else{ |
| 177 |
wp_send_json_error($result, 500); |
| 178 |
} |
| 179 |
} |
| 180 |
else{ |
| 181 |
echo esc_html__( 'API key removed', 'zoho-flow' ); |
| 182 |
} |
| 183 |
} |
| 184 |
else{ |
| 185 |
wp_send_json_error(__('Service not found', 'zoho-flow'), 400); |
| 186 |
} |
| 187 |
} |
| 188 |
} |
| 189 |
wp_die(); |
| 190 |
} |
| 191 |
add_action( 'wp_ajax_zoho_flow_remove_api_key', 'zoho_flow_remove_api_key' ); |
| 192 |
|
| 193 |
function zoho_flow_api_key_table(){ |
| 194 |
if ( ! current_user_can( 'zoho_flow_admin_page' ) ) { |
| 195 |
wp_send_json_error( esc_html__( 'You are not allowed to perform the operation.', 'zoho-flow' ), 403 ); |
| 196 |
} |
| 197 |
if ( ! isset( $_POST['service_id'], $_POST['api_key_removal_nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['api_key_removal_nonce'] ) ), 'remove_api_key' ) ) { |
| 198 |
wp_send_json_error( esc_html__( 'Unable to load API keys. Please refresh and try again.', 'zoho-flow' ), 403 ); |
| 199 |
} |
| 200 |
$service_id = sanitize_key( wp_unslash( $_POST['service_id'] ) ); |
| 201 |
$api_keys_table = new Zoho_Flow_API_Key_List_Table(); |
| 202 |
$api_keys_table->set_service_id($service_id); |
| 203 |
$api_keys_table->prepare_items(); |
| 204 |
$api_keys_table->display(); |
| 205 |
wp_die(); |
| 206 |
} |
| 207 |
add_action( 'wp_ajax_zoho_flow_api_key_table', 'zoho_flow_api_key_table' ); |
| 208 |
|
| 209 |
function zoho_flow_test_tls(){ |
| 210 |
$resp = wp_remote_get("https://tlstest.zoho.com/api"); |
| 211 |
if(is_wp_error($resp)){ |
| 212 |
return $resp; |
| 213 |
} |
| 214 |
$json = json_decode($resp['body'], true); |
| 215 |
return $json; |
| 216 |
} |
| 217 |
|
| 218 |
function zoho_flow_review_banner(){ |
| 219 |
wp_enqueue_script('zoho-flow-review-notice', plugins_url('../assets/js/zoho-flow-review-notice.js', __FILE__), array('jquery'), filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-review-notice.js' ), false); |
| 220 |
wp_localize_script( |
| 221 |
'zoho-flow-review-notice', |
| 222 |
'zohoFlowReviewNotice', |
| 223 |
array( |
| 224 |
'nonce' => wp_create_nonce( 'zoho_flow_change_next_review_date' ), |
| 225 |
) |
| 226 |
); |
| 227 |
global $pagenow; |
| 228 |
$review_allowed_pages = array( |
| 229 |
"index.php", |
| 230 |
"plugins.php", |
| 231 |
); |
| 232 |
if ( current_user_can('administrator') ) { |
| 233 |
$zoho_flow_services_obj = Zoho_Flow_Services::get_instance(); |
| 234 |
if($zoho_flow_services_obj->is_current_user_has_api_keys()){ |
| 235 |
$option_slug = "zoho_flow_next_review_date_".get_current_user_id(); |
| 236 |
$next_review_notice_date = get_option($option_slug); |
| 237 |
if(empty($next_review_notice_date)){ |
| 238 |
add_option( $option_slug, date_add(date_create(),date_interval_create_from_date_string("1 day")), '', 'yes' ); |
| 239 |
} |
| 240 |
else if(date_timestamp_get(date_create()) > date_timestamp_get($next_review_notice_date)){ |
| 241 |
$current_screen = get_current_screen(); |
| 242 |
$is_zoho_flow_screen = isset( $current_screen->id ) && in_array( $current_screen->id, array( 'toplevel_page_zoho_flow', 'zoho-flow_page_zoho_flow_system_info' ), true ); |
| 243 |
if(in_array($pagenow,$review_allowed_pages)){ |
| 244 |
?> |
| 245 |
<div id= "flow-review-notice" style="border: 5px solid transparent;border-bottom: 0;border-left: 0;border-right: 0;padding: 10px;border-image: url('<?php echo esc_url( plugins_url('../assets/images/zoho-colors.gif', __FILE__) ); ?>') 100% 1 stretch;" class="notice notice-info is-dismissible"> |
| 246 |
<?php |
| 247 |
} |
| 248 |
else if ( ( $pagenow == 'admin.php' ) && $is_zoho_flow_screen ) { |
| 249 |
?> |
| 250 |
<div id= "flow-review-notice" style="padding: 10px;" class="notice notice-info is-dismissible"> |
| 251 |
<?php |
| 252 |
} |
| 253 |
else{ |
| 254 |
return true; |
| 255 |
} |
| 256 |
?> |
| 257 |
<div style="display:flex"> |
| 258 |
<div style="min-width:8%;margin-top: auto;margin-bottom: auto;padding: 0px 15px;"> |
| 259 |
<img style="max-height: 64px;" src="<?php echo esc_url( plugins_url('../assets/images/Flow-logo-animation.gif', __FILE__) ); ?>"/> |
| 260 |
</div> |
| 261 |
<div style="margin-left: auto;margin-right: auto;padding-right: 121px;"> |
| 262 |
<div style="font-size: 17px;padding: 15px;text-align: center;font-weight: 600;"> |
| 263 |
<?php |
| 264 |
echo sprintf( |
| 265 |
/* translators: %s: Zoho Flow. */ |
| 266 |
esc_html__('Happy with %1$s? Please give us a review!','zoho-flow'),sprintf('<strong>%s</strong>',esc_html__('Zoho Flow','zoho-flow')) |
| 267 |
); |
| 268 |
?> |
| 269 |
</div> |
| 270 |
<div style="font-size: 15px;padding: 10px;padding-top: 5px;text-align: center;"> |
| 271 |
<?php |
| 272 |
echo sprintf( |
| 273 |
/* translators: 1: Review link text, 2: Zoho Flow. */ |
| 274 |
esc_html__('Your feedback matters. Please leave a %1$s to help us improve. Thank you for being a part of the %2$s community.','zoho-flow'), '<a href="https://wordpress.org/support/plugin/zoho-flow/reviews?rate=5#new-post" target="_blank" class="zoho-flow-rating-link" >review</a>',sprintf('<strong>%s</strong>',esc_html__('Zoho Flow','zoho-flow')) |
| 275 |
); |
| 276 |
?> |
| 277 |
</div> |
| 278 |
<div style="text-align:center;"> |
| 279 |
<a id="notice-review-botton" class="button button-primary" style="margin:5px;" href="https://wordpress.org/support/plugin/zoho-flow/reviews?rate=5#new-post" target="_blank"><?php echo esc_html__('Review', 'zoho-flow') ?></a> |
| 280 |
<a id="notice-later-botton" class="button button-secondary" style="margin:5px;"><?php echo esc_html__('Maybe later', 'zoho-flow') ?></a> |
| 281 |
<a id="notice-donot-botton" class="button button-secondary" style="margin:5px;"><?php echo esc_html__('Do not show again', 'zoho-flow') ?></a> |
| 282 |
</div> |
| 283 |
</div> |
| 284 |
</div> |
| 285 |
</div> |
| 286 |
<?php |
| 287 |
} |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
} |
| 292 |
add_action('zoho-flow-review-notice', 'zoho_flow_review_banner'); |
| 293 |
add_action( 'admin_notices', 'zoho_flow_review_banner' ); |
| 294 |
|
| 295 |
function zoho_flow_change_next_review_date(){ |
| 296 |
if ( ! current_user_can( 'administrator' ) ) { |
| 297 |
wp_die( -1 ); |
| 298 |
} |
| 299 |
if ( isset( $_POST['days_to_increase'], $_POST['review_notice_nonce'] ) ) { |
| 300 |
$days_to_increase = sanitize_text_field( wp_unslash( $_POST['days_to_increase'] ) ); |
| 301 |
$review_notice_nonce = sanitize_key( wp_unslash( $_POST['review_notice_nonce'] ) ); |
| 302 |
|
| 303 |
if ( empty( $days_to_increase ) || ! is_numeric( $days_to_increase ) || ! wp_verify_nonce( $review_notice_nonce, 'zoho_flow_change_next_review_date' ) ) { |
| 304 |
wp_die(); |
| 305 |
} |
| 306 |
$option_slug = "zoho_flow_next_review_date_".get_current_user_id(); |
| 307 |
update_option( $option_slug, date_add(date_create(),date_interval_create_from_date_string( sanitize_key($days_to_increase)." days")), '', 'yes' ); |
| 308 |
} |
| 309 |
wp_die(); |
| 310 |
} |
| 311 |
add_action( 'wp_ajax_zoho_flow_change_next_review_date', 'zoho_flow_change_next_review_date' ); |
| 312 |
|
| 313 |
function zoho_flow_integration_suggestion_banner(){ |
| 314 |
wp_enqueue_script('zoho-flow-suggestion-notice', plugins_url('../assets/js/zoho-flow-suggestion-notice.js', __FILE__), array('jquery'), filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-suggestion-notice.js' ), false); |
| 315 |
wp_localize_script( |
| 316 |
'zoho-flow-suggestion-notice', |
| 317 |
'zohoFlowSuggestionNotice', |
| 318 |
array( |
| 319 |
'nonce' => wp_create_nonce( 'zoho_flow_change_next_suggestion_date' ), |
| 320 |
) |
| 321 |
); |
| 322 |
if ( current_user_can('administrator') ) { |
| 323 |
if( ! class_exists( 'Zoho_Flow_Service_Suggestion' ) ) { |
| 324 |
require_once( WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/zoho-flow-service-suggestion.php' ); |
| 325 |
} |
| 326 |
$service_suggestion = new Zoho_Flow_Service_Suggestion(); |
| 327 |
if($service_suggestion->permission_to_show()){ |
| 328 |
$next_suggestion_notice_date = get_option($service_suggestion->get_option_slug()); |
| 329 |
if((empty($next_suggestion_notice_date)) || (date_timestamp_get(date_create()) > date_timestamp_get($next_suggestion_notice_date))){ |
| 330 |
$service_suggestion->display(); |
| 331 |
} |
| 332 |
|
| 333 |
} |
| 334 |
} |
| 335 |
} |
| 336 |
add_action('zoho-flow-suggestion-notice', 'zoho_flow_suggestion_banner'); |
| 337 |
add_action( 'admin_notices', 'zoho_flow_integration_suggestion_banner' ); |
| 338 |
|
| 339 |
function zoho_flow_change_next_suggestion_date(){ |
| 340 |
if ( ! current_user_can( 'administrator' ) ) { |
| 341 |
wp_die( -1 ); |
| 342 |
} |
| 343 |
if ( isset( $_POST['days_to_increase'], $_POST['flow_service_id'], $_POST['suggestion_notice_nonce'] ) ) { |
| 344 |
$suggestion_notice_nonce = sanitize_key( wp_unslash( $_POST['suggestion_notice_nonce'] ) ); |
| 345 |
$flow_service_id = sanitize_key( wp_unslash( $_POST['flow_service_id'] ) ); |
| 346 |
$days_to_increase = sanitize_key( wp_unslash( $_POST['days_to_increase'] ) ); |
| 347 |
|
| 348 |
if ( empty( $flow_service_id ) || empty( $days_to_increase ) || ! is_numeric( $days_to_increase ) || ! wp_verify_nonce( $suggestion_notice_nonce, 'zoho_flow_change_next_suggestion_date' ) ) { |
| 349 |
wp_die(); |
| 350 |
} |
| 351 |
|
| 352 |
$option_slug = "zoho_flow_next_suggestion_date_".$flow_service_id."_".get_current_user_id(); |
| 353 |
if(empty(get_option($option_slug))){ |
| 354 |
add_option( $option_slug, date_add(date_create(),date_interval_create_from_date_string($days_to_increase." days")), '', 'yes' ); |
| 355 |
} |
| 356 |
update_option( $option_slug, date_add(date_create(),date_interval_create_from_date_string($days_to_increase." days")), '', 'yes' ); |
| 357 |
} |
| 358 |
wp_die(); |
| 359 |
} |
| 360 |
add_action( 'wp_ajax_zoho_flow_change_next_suggestion_date', 'zoho_flow_change_next_suggestion_date' ); |
| 361 |
|
| 362 |
add_action('admin_notices',function() { |
| 363 |
global $pagenow; |
| 364 |
$current_screen = get_current_screen(); |
| 365 |
$is_zoho_flow_screen = isset( $current_screen->id ) && in_array( $current_screen->id, array( 'toplevel_page_zoho_flow', 'zoho-flow_page_zoho_flow_system_info' ), true ); |
| 366 |
if((($pagenow=='admin.php')) && $is_zoho_flow_screen){ |
| 367 |
remove_all_actions( 'admin_notices' ); |
| 368 |
} |
| 369 |
}, |
| 370 |
1); |
| 371 |
|
| 372 |
function zoho_flow_show_admin_page(){ |
| 373 |
zoho_flow_enqueue_scripts(); |
| 374 |
$zoho_gif = plugins_url('../assets/images/Flow-logo-animation.gif', __FILE__); |
| 375 |
?> |
| 376 |
<div id="loader" style="position:fixed; width:100%; height:100%; z-index:9999; background: url('<?php echo esc_url( $zoho_gif ); ?>') 45% 45% no-repeat white;background-size: 64px 64px, cover;"></div> |
| 377 |
<div class="wrap"> |
| 378 |
|
| 379 |
<?php |
| 380 |
$service_request = filter_input( INPUT_GET, 'service', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); |
| 381 |
if ( ! empty( $service_request ) ) { |
| 382 |
$service_param = sanitize_key( $service_request ); |
| 383 |
$zoho_flow_services = Zoho_Flow_Services::get_instance(); |
| 384 |
$service = $zoho_flow_services->get_service($service_param); |
| 385 |
if(is_null($service)){ |
| 386 |
zoho_flow_show_unavailable_service(); |
| 387 |
} |
| 388 |
else{ |
| 389 |
zoho_flow_show_service_details($service); |
| 390 |
} |
| 391 |
} |
| 392 |
else{ |
| 393 |
zoho_flow_show_service_grid(); |
| 394 |
} |
| 395 |
?> |
| 396 |
</div> |
| 397 |
<?php |
| 398 |
|
| 399 |
} |
| 400 |
|
| 401 |
function zoho_flow_show_service_grid(){ |
| 402 |
?> |
| 403 |
<div class="zoho-flow-header"> |
| 404 |
<h1 class="wp-heading-inline"> |
| 405 |
<img class="zflow-logo" src="<?php echo esc_url( plugins_url('../assets/images/flow-256.png', __FILE__) ); ?>"/> |
| 406 |
<?php echo esc_html__('Zoho Flow', 'zoho-flow') ?> |
| 407 |
</h1> |
| 408 |
<h3><?php echo esc_html__('Integrate your WordPress plugins with other business applications', 'zoho-flow') ?></h3> |
| 409 |
</div> |
| 410 |
<?php |
| 411 |
zoho_flow_review_banner(); |
| 412 |
if ( !get_option('permalink_structure')){ |
| 413 |
?> |
| 414 |
<div id="permalink-warning-notice" class="notice inline notice-warning"> |
| 415 |
<h2><?php echo esc_html__( 'Permalink is not enabled','zoho-flow' ) ?></h2> |
| 416 |
<p><?php echo esc_html__( 'It appears that permalink has not been enabled for this site. For this plugin to work properly, you need to enable permalinks. ', 'zoho-flow' )?><a href="<?php echo esc_url( admin_url('options-permalink.php') ); ?>">Enable</a></p> |
| 417 |
</div> |
| 418 |
<?php |
| 419 |
} |
| 420 |
$resp = zoho_flow_test_tls(); |
| 421 |
if(is_wp_error($resp)){ |
| 422 |
?> |
| 423 |
<div id="url-call-fail-notice" class="notice inline notice-warning"> |
| 424 |
<h2><?php echo esc_html__( 'External url call failed', 'zoho-flow' ) ?></h2> |
| 425 |
<p><?php echo esc_html__( 'This plugin needs to call external url for its functionality. However, it did not work due to the below error.', 'zoho-flow' ) ?></p> |
| 426 |
<p style="font-weight:bold;"><?php echo esc_html( $resp->get_error_message() ); ?></p> |
| 427 |
</div> |
| 428 |
<?php |
| 429 |
} |
| 430 |
else{ |
| 431 |
if( isset( $resp['status'] ) && ( 200 != $resp['status'] ) ){ |
| 432 |
$version = 'TLSv1.3'; |
| 433 |
?> |
| 434 |
<div id="tls-connection-fail-notice" class="notice inline notice-warning"> |
| 435 |
<h2><?php echo esc_html__( 'TLS connection failed', 'zoho-flow' ) ?></h2> |
| 436 |
|
| 437 |
<p> |
| 438 |
<?php |
| 439 |
// translators: %s refers to the minimum TLS version |
| 440 |
printf(esc_html__( 'This plugins requires at least %s to work properly. Kindly upgrade the TLS version of your wordpress setup.', 'zoho-flow' ), esc_html( $version )) |
| 441 |
?> |
| 442 |
</p> |
| 443 |
</div> |
| 444 |
<?php |
| 445 |
} |
| 446 |
} |
| 447 |
?> |
| 448 |
<div id="service_details_popup" style="display:none;"> |
| 449 |
<div id="service_details_popup_content" > |
| 450 |
<h1><?php echo 'service_name' ?></h1> |
| 451 |
<p><?php echo 'service_description' ?></p> |
| 452 |
</div> |
| 453 |
</div> |
| 454 |
<div class="plugin-gallery-wrapper"> |
| 455 |
<div class="plugin-gallery" style="max-width:75%"> |
| 456 |
<h2><?php echo esc_html__( 'WordPress plugin integrations available in Zoho Flow', 'zoho-flow' )?></h2> |
| 457 |
<p><?php echo esc_html__( 'Click the WordPress plugins to access their API keys and other connection requirements.', 'zoho-flow' )?></p> |
| 458 |
<div class="table services-list-grid"> |
| 459 |
<?php |
| 460 |
if( ! class_exists( 'Zoho_Flow_Services_Grid' ) ) { |
| 461 |
require_once( WP_ZOHO_FLOW_PLUGIN_DIR . '/includes/zoho-flow-services-grid.php' ); |
| 462 |
} |
| 463 |
$servicesTable = new Zoho_Flow_Services_Grid(); |
| 464 |
$servicesTable->display(); |
| 465 |
?> |
| 466 |
</div> |
| 467 |
</div> |
| 468 |
<div class="plugin-gallery-right-side" style="max-width:25%"> |
| 469 |
<div class="why-flow-section"> |
| 470 |
<h2><img class="zflow-logo" src="<?php echo esc_url( plugins_url('../assets/images/flow-256.png', __FILE__) ); ?>"><?php echo esc_html__('About Zoho Flow', 'zoho-flow') ?></h2> |
| 471 |
<p><?php echo esc_html__('Zoho Flow is an integration platform that lets you connect different applications without writing code. It also lets you integrate popular WordPress plugins. Zoho Flow offers a dynamic drag-and-drop builder that can help you build integrations and automated workflows within minutes.','zoho-flow') ?></p> |
| 472 |
<p class="zflow-cta"> |
| 473 |
<a target="_blank" href="//www.zoho.com/flow/features.html?utm_source=wordpress&utm_medium=link&utm_campaign=zoho-flow-plugin"><?php echo esc_html__('Features', 'zoho-flow') ?></a> | |
| 474 |
<a target="_blank" href="//www.zoho.com/flow/help/?utm_source=wordpress&utm_medium=link&utm_campaign=zoho-flow-plugin"><?php echo esc_html__('Help', 'zoho-flow') ?></a> | |
| 475 |
<a target="_blank" href="//www.zoho.com/flow/pricing.html?utm_source=wordpress&utm_medium=link&utm_campaign=zoho-flow-plugin"><?php echo esc_html__('Pricing', 'zoho-flow') ?></a> |
| 476 |
</p> |
| 477 |
</div> |
| 478 |
<div class="flow-gallery-section"> |
| 479 |
<h2><?php echo esc_html__('Gallery', 'zoho-flow') ?></h2> |
| 480 |
<p><?php echo esc_html__('Check out Zoho Flow\'s gallery page to integrate your favorite applications and build automated workflows.', 'zoho-flow') ?></p> |
| 481 |
<p> |
| 482 |
<a target="_blank" href="//www.zohoflow.com/apps/?utm_source=wordpress&utm_medium=link&utm_campaign=zoho-flow-plugin"><?php echo esc_html__('Access Gallery', 'zoho-flow') ?></a> |
| 483 |
</p> |
| 484 |
</div> |
| 485 |
<div class="flow-video-section"> |
| 486 |
<h2><?php echo esc_html__('Watch Zoho Flow in action', 'zoho-flow') ?></h2> |
| 487 |
<div class="zvideo-thumb-wrap zcpopup-controller"> |
| 488 |
<a id="open-video-popup" href="https://www.youtube.com/embed/68JFXlpm6iI?autoplay=1&TB_iframe=true" class="thickbox" title="Getting started with Zoho Flow"> |
| 489 |
<img src="<?php echo esc_url( plugins_url('../assets/images/flow-video-thumb.png', __FILE__) ); ?>"> |
| 490 |
<span class="zarrow"></span> |
| 491 |
</a> |
| 492 |
</div> |
| 493 |
</div> |
| 494 |
<div class="zflow-req-app"> |
| 495 |
<div class="zicon zicon1"></div> |
| 496 |
<h2><?php echo esc_html__('Can\'t find an app or plugin? ', 'zoho-flow') ?></h2> |
| 497 |
<p><?php echo esc_html__('If you aren\'t able to find the app or plugin that you need in our gallery, let us know and we\'ll try our best to add them!', 'zoho-flow') ?></p> |
| 498 |
<p> |
| 499 |
<a href="https://creatorapp.zohopublic.in/zohointranet/zoho-flow/form-embed/Request_an_App/qqePxZq7ZkzdWKGCYvntEk14O9YqjUGHJUZJHYsMA5zOK6XEC8b6Gh7mrdz2TnYu4AUVBRwu1YzKVU8KAwbn2OurBsJ66FqkT8Rm?zc_BdrClr=ffffff&zc_Header=false&TB_iframe=true&width=320&height=440" class="thickbox" title="Integration request"><?php echo esc_html__('Request app/plugin', 'zoho-flow') ?></a> |
| 500 |
</p> |
| 501 |
</div> |
| 502 |
<div class="zflow-feedback"> |
| 503 |
<div class="zicon zicon1"></div> |
| 504 |
<h2><?php echo esc_html__('How\'s your Zoho Flow experience? ', 'zoho-flow') ?></h2> |
| 505 |
<p><?php echo esc_html__('We’d love to hear your thoughts on Zoho Flow so far. Share your feedback or leave a review.', 'zoho-flow') ?></p> |
| 506 |
<p> |
| 507 |
<p class="zflow-cta"> |
| 508 |
<a href="https://creatorapp.zohopublic.in/zohointranet/zoho-flow/form-embed/Wordpress_showcase_page_feedback_form/dfxN3WHea2J0EyvNYkC6QyuUSMQWVhww2wYVXky75rRSNp9a3pPq0P5b6v2y3ZjUCgMZMDYRwM6Z6hhu8tFfWnJkmdrPZYk6TCOe?zc_BdrClr=ffffff&zc_Header=false&TB_iframe=true&width=320&height=280" class="thickbox" title="Share your feedback"><?php echo esc_html__('Give us feedback', 'zoho-flow') ?></a> | |
| 509 |
<a target="_blank" href="https://wordpress.org/support/plugin/zoho-flow/reviews?rate=5#new-post"><?php echo esc_html__('Write a review', 'zoho-flow') ?></a> |
| 510 |
</p> |
| 511 |
</p> |
| 512 |
</div> |
| 513 |
<div class="flow-webinar-section"> |
| 514 |
<h2><?php echo esc_html__('Register for live webinar', 'zoho-flow') ?></h2> |
| 515 |
<div class="zwebinar-registration-wrap"> |
| 516 |
<a href="https://www.zoho.com/flow/webinars.html?utm_source=wordpress&utm_medium=link&utm_campaign=zoho-flow-plugin" target="_blank"> |
| 517 |
<img src="<?php echo esc_url( plugins_url('../assets/images/zoho-flow-webinar.png', __FILE__) ); ?>"> |
| 518 |
</a> |
| 519 |
</div> |
| 520 |
</div> |
| 521 |
<div class="flow-social-media-section"> |
| 522 |
<p style="margin:0px !important;height: 20px !important;"><?php echo esc_html__('Follow us on', 'zoho-flow') ?></p> |
| 523 |
<div class="social-media-icons"> |
| 524 |
<a href="https://www.linkedin.com/company/zoho-flow" style="text-decoration:none !important; outline: 0 !important;" target="_blank"> |
| 525 |
<img src="<?php echo esc_url( plugins_url('../assets/images/logos/linkedin.png', __FILE__) ); ?>" style="height: 20px;"> |
| 526 |
</a> |
| 527 |
<a href="https://twitter.com/ZohoFlow" style="text-decoration:none !important; outline: 0 !important;" target="_blank"> |
| 528 |
<img src="<?php echo esc_url( plugins_url('../assets/images/logos/twitter.png', __FILE__) ); ?>" style="height: 20px;"> |
| 529 |
</a> |
| 530 |
<a href="https://www.facebook.com/ZohoFlow/" style="text-decoration:none !important; outline: 0 !important;" target="_blank"> |
| 531 |
<img src="<?php echo esc_url( plugins_url('../assets/images/logos/facebook.png', __FILE__) ); ?>" style="height: 20px;"> |
| 532 |
</a> |
| 533 |
</div> |
| 534 |
</div> |
| 535 |
</div> |
| 536 |
</div> |
| 537 |
<?php |
| 538 |
$flow_widget_url = add_query_arg( |
| 539 |
array( |
| 540 |
'services' => 'zoho_flow', |
| 541 |
'limit' => '3', |
| 542 |
), |
| 543 |
'https://flow.zoho.com/embed/flow-widget.js' |
| 544 |
); |
| 545 |
wp_print_script_tag( array( 'src' => $flow_widget_url ) ); |
| 546 |
?> |
| 547 |
<?php |
| 548 |
|
| 549 |
} |
| 550 |
|
| 551 |
function zoho_flow_show_unavailable_service(){ |
| 552 |
?> |
| 553 |
<div class="unavailable-zoho-flow-service"> |
| 554 |
<img src="<?php echo esc_url( plugins_url('../assets/images/no-result-found.svg', __FILE__) ); ?>"/> |
| 555 |
<h2><?php echo esc_html__( 'The plugin was not found!', 'zoho-flow' )?></h2> |
| 556 |
</div> |
| 557 |
<?php |
| 558 |
} |
| 559 |
|
| 560 |
function zoho_flow_service_not_available_popup($service_name, $service_description){ |
| 561 |
?> |
| 562 |
<div id="service_details_popup" style="display:none;"> |
| 563 |
<h1><?php echo esc_html( $service_name ); ?></h1> |
| 564 |
<p><?php echo esc_html( $service_description ); ?></p> |
| 565 |
</div> |
| 566 |
<?php |
| 567 |
} |
| 568 |
|
| 569 |
function zoho_flow_api_key_html($current_service){ |
| 570 |
$service_id = $current_service->get_service_id(); |
| 571 |
$button_label = esc_html__( 'Generate', 'zoho-flow' ); |
| 572 |
$ok_button_label = esc_html__( 'Ok', 'zoho-flow' ); |
| 573 |
?> |
| 574 |
<div id="api_key_details" style="display:none;"> |
| 575 |
<form id="generate-api-key-form" method="post" style="padding:10px 0"> |
| 576 |
<?php wp_nonce_field( 'generate_api_key', 'api_key_generation_nonce' );?> |
| 577 |
<input type="hidden" name="action" value="zoho_flow_generate_api_key"> |
| 578 |
<input type="hidden" name="service_id" value="<?php echo esc_attr($service_id) ?>"> |
| 579 |
<label style="font-size: 13px;" for="description"><?php echo esc_html__('Provide a label for this API key', 'zoho-flow') ?></label> |
| 580 |
<input id="api-key-description" type="text" maxlength="100" name="description" style="display: block; |
| 581 |
margin: 10px 0; |
| 582 |
height: 40px; |
| 583 |
width: 95%;"/> |
| 584 |
<span> |
| 585 |
<input type="button" id="generate-api-key" class="button button-primary" value="<?php echo esc_attr( $button_label ); ?>"></button> |
| 586 |
<span style="display:none;"><?php echo esc_html__('Generating API key...', 'zoho-flow') ?></span> |
| 587 |
</span> |
| 588 |
</form> |
| 589 |
<div id="api-key-div" style="display:none; font-size: 13px;"> |
| 590 |
<h3 style="margin-bottom:0px;"><?php echo esc_html('API Key', 'zoho-flow') ?></h3> |
| 591 |
<p style="margin:0px;padding-bottom:0px"><?php echo esc_html__('Copy the API key and keep it safe. The API key can\'t be copied or retrieved again.', 'zoho-flow') ?></p> |
| 592 |
<div style="margin:10px 0"> |
| 593 |
<span id="api-key-span"></span> |
| 594 |
<a id="copy-api-key" style="padding: 6px 0px;" class="dashicons dashicons-admin-page"></a> |
| 595 |
</div> |
| 596 |
<h3><?php echo esc_html('Base URL', 'zoho-flow') ?></h3> |
| 597 |
<div style="margin:10px 0"> |
| 598 |
<span id="site-url-span"><?php echo esc_html(home_url(),'zoho-flow')?></span> |
| 599 |
<a id="copy-site-url" style="padding: 6px 0px;" class="dashicons dashicons-admin-page"></a> |
| 600 |
</div> |
| 601 |
<p id="api-key-ok-button"> |
| 602 |
<button id="ok-api-key-popup" class="button button-primary"><?php echo esc_html( $ok_button_label ); ?></button> |
| 603 |
<span id='copy-sucess'>Copied!</span> |
| 604 |
</p> |
| 605 |
</div> |
| 606 |
</div> |
| 607 |
<?php |
| 608 |
} |
| 609 |
|
| 610 |
function zoho_flow_show_service_details($service){ |
| 611 |
update_option( 'zoho_flow_admin_footer_text_rated', 0 ); |
| 612 |
$services = Zoho_Flow_Services::get_instance()->get_services(); |
| 613 |
$current_service = Zoho_Flow_Services::get_instance()->get_service($service['id'])['instance']; |
| 614 |
$service_name = $current_service->get_service_name(); |
| 615 |
$gallery_app_link = $service['gallery_app_link']; |
| 616 |
$app_documentation_link = $service['app_documentation_link']; |
| 617 |
$embed_link = $service['embed_link']; |
| 618 |
$service_name |
| 619 |
?> |
| 620 |
<span> |
| 621 |
<a style="text-decoration:none;box-shadow: none;" href="<?php echo esc_url( menu_page_url( 'zoho_flow', false ) ); ?>">← <?php echo esc_html__( 'Back', 'zoho-flow' )?></a> |
| 622 |
</span> |
| 623 |
<div class="service-details-header-wrapper"> |
| 624 |
<div style="display:grid;"> |
| 625 |
<div class="service-details-logo-wrapper"> |
| 626 |
<div style="display:inline-flex;"> |
| 627 |
<img class="service-details-logo" src="<?php echo esc_url( plugins_url('../assets/images/flow-256.png', __FILE__) ); ?>"/> |
| 628 |
<div class="service-details-logo-arrow" >⇄</div> |
| 629 |
<img class="service-details-logo" src="<?php echo esc_url( plugins_url('../assets/images/logos/' . $service['icon_file'], __FILE__) ); ?>"/> |
| 630 |
</div> |
| 631 |
</div> |
| 632 |
<div class="service-details-title"> |
| 633 |
<?php |
| 634 |
echo esc_html( $service['name'] . ' Integration' ); |
| 635 |
?> |
| 636 |
</div> |
| 637 |
<div> |
| 638 |
<div class="service-details-description"> |
| 639 |
<?php |
| 640 |
echo esc_html( $service['description'] ); |
| 641 |
?> |
| 642 |
</div> |
| 643 |
</div> |
| 644 |
</div> |
| 645 |
</div> |
| 646 |
<div class="service-details-wrapper"> |
| 647 |
<div class="service-details-content-wrapper"> |
| 648 |
<div class="service_details_content"> |
| 649 |
<div> |
| 650 |
<h3 style="display:inline;vertical-align:middle;"><?php echo esc_html__( 'API Keys', 'zoho-flow' )?></h3> |
| 651 |
<a style="vertical-align:middle;margin-left:5px;" id="open-api-key-generation-popup" href="<?php echo esc_attr('#TB_inline?width=600&height=150&inlineId=api_key_details') ?>" class="button button-primary thickbox" title="<?php echo esc_attr($service_name) ?> : <?php echo esc_attr__('Generate new API key', 'zoho-flow') ?>"><?php echo esc_html__('+ New API Key', 'zoho-flow') ?></a> |
| 652 |
<span id="notice" class="notice" style="display:none;margin-left:10px;padding:5px;vertical-align:middle;"></span> |
| 653 |
<p> |
| 654 |
<?php |
| 655 |
// translators: %s refers to the plugin name |
| 656 |
printf(esc_html__( 'You can use any of the active API keys to connect %s to Zoho Flow. Generate one if you don\'t have any.', 'zoho-flow' ), esc_html( $service_name )) |
| 657 |
?> |
| 658 |
</p> |
| 659 |
|
| 660 |
<form id="remove-api-key-form" method="post"> |
| 661 |
<?php wp_nonce_field( 'remove_api_key', 'api_key_removal_nonce' );?> |
| 662 |
<input type="hidden" name="action" value="zoho_flow_remove_api_key"> |
| 663 |
<input type="hidden" name="service_id" value="<?php echo esc_attr($current_service->get_service_id()) ?>"> |
| 664 |
<div id="api-key-list-display" class="table api-key-table"> |
| 665 |
<?php |
| 666 |
$api_keys_table = new Zoho_Flow_API_Key_List_Table(); |
| 667 |
$api_keys_table->set_service_id($current_service->get_service_id()); |
| 668 |
$api_keys_table->prepare_items(); |
| 669 |
$api_keys_table->display(); |
| 670 |
?> |
| 671 |
</div> |
| 672 |
</form> |
| 673 |
<?php zoho_flow_api_key_html($current_service) ?> |
| 674 |
</div> |
| 675 |
</div> |
| 676 |
</div> |
| 677 |
<div class="service-details-right-panel"> |
| 678 |
<h3 style="width:100%;"> |
| 679 |
<?php |
| 680 |
// translators: %s refers to the plugin name |
| 681 |
printf(esc_html__('How to integrate %s with other apps via Zoho Flow?', 'zoho-flow') , esc_html( $service_name )) |
| 682 |
?> |
| 683 |
</h3> |
| 684 |
<h4><?php echo esc_html__('Step 1', 'zoho-flow') ?></h4> |
| 685 |
<p><a href="<?php echo esc_url( 'https://www.zoho.com/flow/signup.html?utm_source=wordpress&utm_medium=link&utm_campaign=zoho_flow_' . $gallery_app_link ); ?>" target="_blank"><?php echo esc_html__('Register', 'zoho-flow') ?></a><?php echo esc_html__(' for a Zoho Flow account or log in if you already have one.', 'zoho-flow') ?></p> |
| 686 |
<h4><?php echo esc_html__('Step 2', 'zoho-flow') ?></h4> |
| 687 |
<p><a id= "open-api-key-generation-popup-from-right-panel" href="#TB_inline?width=600&height=150&inlineId=api_key_details" class="thickbox" title="<?php echo esc_attr($service_name) ?> - <?php echo esc_attr__('Generate new API key', 'zoho-flow') ?>"><?php echo esc_html__('Generate', 'zoho-flow') ?></a><?php echo esc_html__(' an API Key for the plugin. Keep it safe as it can\'t be retrieved again.', 'zoho-flow') ?></p> |
| 688 |
<h4><?php echo esc_html__('Step 3', 'zoho-flow') ?></h4> |
| 689 |
<p><?php echo esc_html__('Open Zoho Flow and create a new flow. Note that each plugin or app has specific triggers and actions. Select the ones that suit your desired workflow.', 'zoho-flow') ?></p> |
| 690 |
<h4><?php echo esc_html__('Step 4', 'zoho-flow') ?></h4> |
| 691 |
<p><?php echo esc_html__('When prompted for a connection, enter the previously generated API key for the plugin and provide the Base URL of your WordPress website.', 'zoho-flow') ?></p> |
| 692 |
<h4><?php echo esc_html__('Step 5', 'zoho-flow') ?></h4> |
| 693 |
<p><?php echo esc_html__('Configure the trigger and actions of your workflow. Once set up, switch the flow on.', 'zoho-flow') ?></p> |
| 694 |
<p> |
| 695 |
<strong> |
| 696 |
<?php echo esc_html__('Note:', 'zoho-flow') ?> |
| 697 |
</strong> |
| 698 |
<?php |
| 699 |
echo esc_html__(' If there\'s a specific trigger, action, or app/plugin you\'d like to connect that isn\'t currently available, or if you have feedback about the existing integrations, please contact Zoho Flow support. We\'re always looking to enhance our platform based on user feedback.', 'zoho-flow' ) |
| 700 |
?> |
| 701 |
</p> |
| 702 |
<h3 style="width:100%;"><?php printf(esc_html__('More information', 'zoho-flow')) ?></h3> |
| 703 |
<p> |
| 704 |
<a target="_blank" href="<?php echo esc_url( 'https://www.zohoflow.com/apps/' . $gallery_app_link . '/integrations/?utm_source=wordpress&utm_medium=link&utm_campaign=zoho_flow_' . $gallery_app_link ); ?>"> |
| 705 |
<?php |
| 706 |
// translators: %s refers to the plugin name |
| 707 |
printf(esc_html__('%s integrations', 'zoho-flow') , esc_html( $service_name )) |
| 708 |
?> |
| 709 |
</a></p> |
| 710 |
<p> |
| 711 |
<a target="_blank" href="<?php echo esc_url( 'https://help.zoho.com/portal/en/kb/flow/user-guide/app-specific-documentation/articles/' . $app_documentation_link . '/?utm_source=wordpress&utm_medium=link&utm_campaign=zoho_flow_' . $gallery_app_link ); ?>"> |
| 712 |
<?php |
| 713 |
if(!empty($app_documentation_link)){ |
| 714 |
// translators: %s refers to the plugin name |
| 715 |
printf(esc_html__('%s app documentation', 'zoho-flow') , esc_html( $service_name )) ; |
| 716 |
} |
| 717 |
?> |
| 718 |
</a></p> |
| 719 |
<p><a target="_blank" href="<?php echo esc_url( 'https://www.zoho.com/flow/help/?utm_source=wordpress&utm_medium=link&utm_campaign=zoho_flow_' . $gallery_app_link ); ?>">Help resources</a> |
| 720 |
<h3 style="width:100%;"><?php printf(esc_html__('Support','zoho-flow')) ?></h3> |
| 721 |
<p><a href="mailto:support@zohoflow.com">support@zohoflow.com</a></p> |
| 722 |
<p><a href="mailto:support@zohoflow.eu">support@zohoflow.eu</a> (for EU Customers)</p> |
| 723 |
</div> |
| 724 |
</div> |
| 725 |
<div class="service-embed-wrapper"> |
| 726 |
<?php |
| 727 |
$flow_widget_url = add_query_arg( |
| 728 |
array( |
| 729 |
'services' => $embed_link, |
| 730 |
'limit' => '3', |
| 731 |
), |
| 732 |
'https://flow.zoho.com/embed/flow-widget.js' |
| 733 |
); |
| 734 |
wp_print_script_tag( array( 'src' => $flow_widget_url ) ); |
| 735 |
?> |
| 736 |
</div> |
| 737 |
<?php |
| 738 |
|
| 739 |
|
| 740 |
} |
| 741 |
|
| 742 |
function zoho_flow_show_system_info_page(){ |
| 743 |
zoho_flow_enqueue_scripts(); |
| 744 |
wp_enqueue_script('zoho-flow-system-info', plugins_url('../assets/js/zoho-flow-system-info.js', __FILE__), array('jquery'), filemtime( WP_ZOHO_FLOW_PLUGIN_DIR . '/assets/js/zoho-flow-system-info.js' ), false); |
| 745 |
$zoho_gif = plugins_url('../assets/images/Flow-logo-animation.gif', __FILE__); |
| 746 |
?> |
| 747 |
<div id="loader" style="position:fixed; width:100%; height:100%; z-index:9999; background: url('<?php echo esc_url( $zoho_gif ); ?>') 45% 45% no-repeat white;background-size: 64px 64px, cover;"></div> |
| 748 |
<div class="wrap"> |
| 749 |
|
| 750 |
<?php |
| 751 |
?> |
| 752 |
<div class="zoho-flow-header"> |
| 753 |
<h1 class="wp-heading-inline"> |
| 754 |
<img class="zflow-logo" src="<?php echo esc_url( plugins_url('../assets/images/flow-256.png', __FILE__) ); ?>"/> |
| 755 |
<?php echo esc_html__('Zoho Flow', 'zoho-flow') ?> |
| 756 |
</h1> |
| 757 |
<!--<h3><?php echo esc_html__('Integrate your WordPress plugins with other business applications', 'zoho-flow') ?></h3>--> |
| 758 |
</div> |
| 759 |
<?php |
| 760 |
zoho_flow_review_banner(); |
| 761 |
?> |
| 762 |
<div class="system-info-wrapper"> |
| 763 |
<h2><?php echo esc_html__('Settings', 'zoho-flow') ?></h2> |
| 764 |
|
| 765 |
<?php |
| 766 |
$site_info_table = new Zoho_Flow_Settings_Menue(); |
| 767 |
$site_info_table->prepare_items(); |
| 768 |
$site_info_table->display(); |
| 769 |
?> |
| 770 |
|
| 771 |
</div> |
| 772 |
<div class="system-info-wrapper"> |
| 773 |
<h2><?php echo esc_html__('System Info', 'zoho-flow') ?></h2> |
| 774 |
|
| 775 |
<?php |
| 776 |
$site_info_table = new Zoho_Flow_System_Info_Menue(); |
| 777 |
$site_info_table->prepare_items(); |
| 778 |
$site_info_table->display(); |
| 779 |
?> |
| 780 |
|
| 781 |
</div> |
| 782 |
<?php |
| 783 |
} |
| 784 |
|