# e2pdf/trunk/classes/controller/e2pdf-integrations.php

E2Pdf – Export Pdf Tool for WordPress, version trunk. 136 lines.

- Page: https://pluginprobe.com/plugins/e2pdf/trunk/code/classes/controller/e2pdf-integrations.php
- Raw: https://pluginprobe.com/plugins/e2pdf/trunk/raw/classes/controller/e2pdf-integrations.php
- Modified: 2026-05-27T06:04:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/e2pdf/trunk/code/classes/controller/e2pdf-integrations.php#L10-L20`.

```php
<?php

/**
 * File: /controller/e2pdf-integrations.php
 *
 * @package  E2Pdf
 * @license  GPLv3
 * @link     https://e2pdf.com
 */
if (!defined('ABSPATH')) {
    die('Access denied.');
}

class Controller_E2pdf_Integrations extends Helper_E2pdf_View {

    // url: admin.php?page=e2pdf-integrations
    public function index_action() {
        $this->view('options', Model_E2pdf_Options::get_options(false, ['zapier_group']));
        $this->view('groups', $this->get_groups());
    }

    // url: admin.php?page=e2pdf-integrations&action=adobesign
    public function adobesign_action() {
        if ($this->post->get('_wpnonce')) {
            if (wp_verify_nonce($this->post->get('_wpnonce'), 'e2pdf_integrations')) {
                if (
                        get_option('e2pdf_adobesign_client_id', '') !== $this->post->get('e2pdf_adobesign_client_id') ||
                        get_option('e2pdf_adobesign_client_secret', '') !== $this->post->get('e2pdf_adobesign_client_secret') ||
                        get_option('e2pdf_adobesign_region', '') !== $this->post->get('e2pdf_adobesign_region') ||
                        !get_option('e2pdf_adobesign_refresh_token')
                ) {
                    update_option('e2pdf_adobesign_code', false);
                    update_option('e2pdf_adobesign_api_access_point', false);
                    update_option('e2pdf_adobesign_web_access_point', false);
                    update_option('e2pdf_adobesign_refresh_token', false);
                    set_transient('e2pdf_adobesign_access_token', false);
                    Model_E2pdf_Options::update_options('adobesign_group', $this->post->get());
                    if (!get_option('e2pdf_adobesign_client_id', '') || !get_option('e2pdf_adobesign_client_secret', '') || !get_option('e2pdf_adobesign_region', '')) {
                        $this->redirect(
                                $this->helper->get_url(
                                        [
                                            'page' => 'e2pdf-integrations',
                                            'action' => 'adobesign',
                                            'notification' => $this->add_notification('update', __('Not Authorized', 'e2pdf')),
                                        ]
                                )
                        );
                    } else {
                        $request = (new Model_E2pdf_AdobeSign())->get_code();
                        if (isset($request['redirect'])) {
                            $this->redirect($request['redirect']);
                        }
                    }
                }
            } else {
                wp_die($this->message('wp_verify_nonce_error'));
            }
        } elseif ($this->get->get('code') && $this->get->get('_wpnonce') && get_option('e2pdf_adobesign_client_id', '') && get_option('e2pdf_adobesign_client_secret', '')) {
            if (wp_verify_nonce($this->get->get('_wpnonce'), 'e2pdf_adobe')) {
                update_option('e2pdf_adobesign_code', sanitize_text_field(wp_unslash($this->get->get('code'))));
                $request = (new Model_E2pdf_AdobeSign())->get_token();
                $this->redirect(
                        $this->helper->get_url(
                                [
                                    'page' => 'e2pdf-integrations',
                                    'action' => 'adobesign',
                                    'notification' => isset($request['error']) ? $this->add_notification('error', $request['error']) : $this->add_notification('update', __('App Authorized', 'e2pdf')),
                                ]
                        )
                );
            } else {
                wp_die($this->message('wp_verify_nonce_error'));
            }
        } else {
            new Model_E2pdf_AdobeSign();
        }

        $this->view('options', Model_E2pdf_Options::get_options(false, ['adobesign_group']));
        $this->view('groups', $this->get_groups());
    }

    // url: admin.php?page=e2pdf-integrations&action=gdrive
    public function gdrive_action() {
        if ($this->post->get('_wpnonce')) {
            if (wp_verify_nonce($this->post->get('_wpnonce'), 'e2pdf_integrations')) {
                if (
                        get_option('e2pdf_gdrive_client_id', '') !== $this->post->get('e2pdf_gdrive_client_id') ||
                        get_option('e2pdf_gdrive_client_secret', '') !== $this->post->get('e2pdf_gdrive_client_secret') ||
                        !get_option('e2pdf_gdrive_refresh_token')
                ) {
                    update_option('e2pdf_gdrive_refresh_token', '');
                    delete_transient('e2pdf_gdrive_access_token');
                    Model_E2pdf_Options::update_options('gdrive_group', $this->post->get());
                    if (!get_option('e2pdf_gdrive_client_id', '') || !get_option('e2pdf_gdrive_client_secret', '')) {
                        $this->redirect(
                                $this->helper->get_url(
                                        [
                                            'page' => 'e2pdf-integrations',
                                            'action' => 'gdrive',
                                            'notification' => $this->add_notification('update', __('Not Authorized', 'e2pdf')),
                                        ]
                                )
                        );
                    } else {
                        $request = (new Model_E2pdf_Gdrive())->get_code();
                        if (isset($request['redirect'])) {
                            $this->redirect($request['redirect']);
                        }
                    }
                }
            } else {
                wp_die($this->message('wp_verify_nonce_error'));
            }
        } else {
            new Model_E2pdf_Gdrive();
        }
        $this->view('options', Model_E2pdf_Options::get_options(false, ['gdrive_group']));
        $this->view('groups', $this->get_groups());
    }

    // get integration option groups
    public function get_groups() {
        $groups = Model_E2pdf_Options::get_options(
                false,
                [
                    'zapier_group',
                    'adobesign_group',
                    'gdrive_group',
                ],
                false
        );

        return $groups;
    }
}

```
