PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 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 All 34 releases
← All changes | integrations/clickup/includes/admin.php +108 -0 5.8.3 → 6.0.3 View file →
@@ -1,0 +1,108 @@
1 +<?php
2 +/**
3 + * Admin
4 + *
5 + * @package AutomatorWP\Integrations\ClickUp\Admin
6 + * @author AutomatorWP <[email protected]>, Ruben Garcia <[email protected]>
7 + * @since 1.0.0
8 + */
9 +// Exit if accessed directly
10 +if( !defined( 'ABSPATH' ) ) exit;
11 +
12 +/**
13 + * Shortcut function to get plugin options
14 + *
15 + * @since 1.0.0
16 + *
17 + * @param string $option_name
18 + * @param bool $default
19 + *
20 + * @return mixed
21 + */
22 +function automatorwp_clickup_get_option( $option_name, $default = false ) {
23 +
24 + $prefix = 'automatorwp_clickup_';
25 +
26 + return automatorwp_get_option( $prefix . $option_name, $default );
27 +}
28 +
29 +/**
30 + * Register plugin settings sections
31 + *
32 + * @since 1.0.0
33 + *
34 + * @return array
35 + */
36 +function automatorwp_clickup_settings_sections( $automatorwp_settings_sections ) {
37 +
38 + $automatorwp_settings_sections['clickup'] = array(
39 + 'title' => __( 'ClickUp', 'automatorwp' ),
40 + 'icon' => 'dashicons-admin-comments',
41 + );
42 +
43 + return $automatorwp_settings_sections;
44 +
45 +}
46 +add_filter( 'automatorwp_settings_sections', 'automatorwp_clickup_settings_sections' );
47 +
48 +/**
49 + * Register plugin settings meta boxes
50 + *
51 + * @since 1.0.0
52 + *
53 + * @return array
54 + */
55 +function automatorwp_clickup_settings_meta_boxes( $meta_boxes ) {
56 +
57 + $prefix = 'automatorwp_clickup_';
58 +
59 + $meta_boxes['automatorwp-clickup-settings'] = array(
60 + 'title' => automatorwp_dashicon( 'admin-comments' ) . __( 'ClickUp', 'automatorwp' ),
61 + 'fields' => apply_filters( 'automatorwp_clickup_settings_fields', array(
62 + $prefix . 'token' => array(
63 + 'name' => __( 'API token:', 'automatorwp' ),
64 + 'desc' => sprintf( __( 'Your ClickUp API token.'), 'automatorwp' ),
65 + 'type' => 'text',
66 + ),
67 + $prefix . 'authorize' => array(
68 + 'type' => 'text',
69 + 'render_row_cb' => 'automatorwp_clickup_authorize_display_cb'
70 + ),
71 + ) ),
72 + );
73 +
74 + return $meta_boxes;
75 +
76 +}
77 +add_filter( "automatorwp_settings_clickup_meta_boxes", 'automatorwp_clickup_settings_meta_boxes' );
78 +
79 +
80 +/**
81 + * Display callback for the authorize setting
82 + *
83 + * @since 1.0.0
84 + *
85 + * @param array $field_args Array of field arguments.
86 + * @param CMB2_Field $field The field object
87 + */
88 +function automatorwp_clickup_authorize_display_cb( $field_args, $field ) {
89 +
90 + $field_id = $field_args['id'];
91 +
92 + $token = automatorwp_clickup_get_option( 'token', '' );
93 +
94 + ?>
95 + <div class="cmb-row cmb-type-custom cmb2-id-automatorwp-clickup-authorize table-layout" data-fieldtype="custom">
96 + <div class="cmb-th">
97 + <label><?php echo __( 'Connect with ClickUp:', 'automatorwp' ); ?></label>
98 + </div>
99 + <div class="cmb-td">
100 + <a id="<?php echo $field_id; ?>" class="button button-primary" href="#"><?php echo __( 'Save credentials', 'automatorwp' ); ?></a>
101 + <p class="cmb2-metabox-description"><?php echo __( 'Add you ClickUp API Token and click on "Authorize" to connect.', 'automatorwp' ); ?></p>
102 + <?php if ( ! empty( $token ) ) : ?>
103 + <div class="automatorwp-notice-success"><?php echo __( 'Site connected with ClickUp successfully.', 'automatorwp' ); ?></div>
104 + <?php endif; ?>
105 + </div>
106 + </div>
107 + <?php
108 +}