initial
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Gravity_Forms\Gravity_SMTP\Connectors\Config;
|
||||
|
||||
use Gravity_Forms\Gravity_SMTP\Apps\App_Service_Provider;
|
||||
use Gravity_Forms\Gravity_SMTP\Gravity_SMTP;
|
||||
use Gravity_Forms\Gravity_Tools\Config;
|
||||
|
||||
class Connector_Config extends Config {
|
||||
|
||||
protected $script_to_localize = 'gravitysmtp_scripts_admin';
|
||||
protected $name = 'gravitysmtp_admin_config';
|
||||
protected $overwrite = false;
|
||||
|
||||
protected $fields;
|
||||
protected $logo;
|
||||
protected $full_logo;
|
||||
protected $title;
|
||||
protected $description;
|
||||
protected $short_name;
|
||||
protected $data;
|
||||
protected $i18n;
|
||||
|
||||
public function set_data( $data ) {
|
||||
$this->fields = $data['fields'];
|
||||
$this->short_name = $data['name'];
|
||||
$this->logo = $data['logo'];
|
||||
$this->full_logo = $data['full_logo'];
|
||||
$this->title = $data['title'];
|
||||
$this->description = $data['description'];
|
||||
$this->data = $data['data'];
|
||||
$this->i18n = $data['i18n'];
|
||||
}
|
||||
|
||||
public function should_enqueue() {
|
||||
return is_admin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Config data.
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function data() {
|
||||
$connector_data = array(
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'id' => $this->short_name,
|
||||
'logo' => $this->logo,
|
||||
'full_logo' => $this->full_logo,
|
||||
'settings' => $this->fields,
|
||||
'data' => $this->data,
|
||||
'i18n' => $this->i18n,
|
||||
);
|
||||
|
||||
$components = array(
|
||||
'settings' => array(
|
||||
'data' => array(
|
||||
'integrations' => array(
|
||||
$connector_data,
|
||||
),
|
||||
),
|
||||
),
|
||||
'tools' => array(
|
||||
'data' => array(
|
||||
'integrations' => array(
|
||||
$connector_data,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if ( $this->should_enqueue_setup_wizard() ) {
|
||||
$components['setup_wizard'] = array(
|
||||
'data' => array(
|
||||
'integrations' => array(
|
||||
$connector_data,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'components' => $components,
|
||||
);
|
||||
}
|
||||
|
||||
private function should_enqueue_setup_wizard() {
|
||||
$should_enqueue = Gravity_SMTP::container()->get( App_Service_Provider::SHOULD_ENQUEUE_SETUP_WIZARD );
|
||||
return is_callable( $should_enqueue ) ? $should_enqueue() : $should_enqueue;
|
||||
}
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Gravity_Forms\Gravity_SMTP\Connectors\Config;
|
||||
|
||||
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Get_Single_Email_Data_Endpoint;
|
||||
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Cleanup_Data_Endpoint;
|
||||
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Migrate_Settings_Endpoint;
|
||||
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Save_Connector_Settings_Endpoint;
|
||||
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Save_Plugin_Settings_Endpoint;
|
||||
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Send_Test_Endpoint;
|
||||
use Gravity_Forms\Gravity_Tools\Config;
|
||||
|
||||
class Connector_Endpoints_Config extends Config {
|
||||
|
||||
protected $script_to_localize = 'gravitysmtp_scripts_admin';
|
||||
protected $name = 'gravitysmtp_admin_config';
|
||||
|
||||
public function should_enqueue() {
|
||||
return is_admin();
|
||||
}
|
||||
|
||||
public function data() {
|
||||
return array(
|
||||
'common' => array(
|
||||
'endpoints' => array(
|
||||
Send_Test_Endpoint::ACTION_NAME => array(
|
||||
'action' => array(
|
||||
'value' => Send_Test_Endpoint::ACTION_NAME,
|
||||
'default' => 'mock_endpoint',
|
||||
),
|
||||
'nonce' => array(
|
||||
'value' => wp_create_nonce( Send_Test_Endpoint::ACTION_NAME ),
|
||||
'default' => 'nonce',
|
||||
),
|
||||
),
|
||||
Save_Connector_Settings_Endpoint::ACTION_NAME => array(
|
||||
'action' => array(
|
||||
'value' => Save_Connector_Settings_Endpoint::ACTION_NAME,
|
||||
'default' => 'mock_endpoint',
|
||||
),
|
||||
'nonce' => array(
|
||||
'value' => wp_create_nonce( Save_Connector_Settings_Endpoint::ACTION_NAME ),
|
||||
'default' => 'nonce',
|
||||
),
|
||||
),
|
||||
Save_Plugin_Settings_Endpoint::ACTION_NAME => array(
|
||||
'action' => array(
|
||||
'value' => Save_Plugin_Settings_Endpoint::ACTION_NAME,
|
||||
'default' => 'mock_endpoint',
|
||||
),
|
||||
'nonce' => array(
|
||||
'value' => wp_create_nonce( Save_Plugin_Settings_Endpoint::ACTION_NAME ),
|
||||
'default' => 'nonce',
|
||||
),
|
||||
),
|
||||
Get_Single_Email_Data_Endpoint::ACTION_NAME => array(
|
||||
'action' => array(
|
||||
'value' => Get_Single_Email_Data_Endpoint::ACTION_NAME,
|
||||
'default' => 'mock_endpoint',
|
||||
),
|
||||
'nonce' => array(
|
||||
'value' => wp_create_nonce( Get_Single_Email_Data_Endpoint::ACTION_NAME ),
|
||||
'default' => 'nonce',
|
||||
),
|
||||
),
|
||||
Cleanup_Data_Endpoint::ACTION_NAME => array(
|
||||
'action' => array(
|
||||
'value' => Cleanup_Data_Endpoint::ACTION_NAME,
|
||||
'default' => 'mock_endpoint',
|
||||
),
|
||||
'nonce' => array(
|
||||
'value' => wp_create_nonce( Cleanup_Data_Endpoint::ACTION_NAME ),
|
||||
'default' => 'nonce',
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user