|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package WETU_Importer |
|
4
|
|
|
* @author LightSpeed |
|
5
|
|
|
* @license GPL-2.0+ |
|
6
|
|
|
* @link |
|
7
|
|
|
* @copyright 2016 LightSpeed |
|
8
|
|
|
**/ |
|
9
|
|
|
|
|
10
|
|
|
class WETU_Importer_Settings extends WETU_Importer { |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Initialize the plugin by setting localization, filters, and administration functions. |
|
14
|
|
|
* |
|
15
|
|
|
* @since 1.0.0 |
|
16
|
|
|
* |
|
17
|
|
|
* @access private |
|
18
|
|
|
*/ |
|
19
|
|
|
public function __construct() { |
|
20
|
|
|
$temp_options = get_option('_lsx-to_settings',false); |
|
21
|
|
|
if(false !== $temp_options && isset($temp_options[$this->plugin_slug]) && !empty($temp_options[$this->plugin_slug])){ |
|
22
|
|
|
$this->options = $temp_options[$this->plugin_slug]; |
|
23
|
|
|
$this->set_variables(); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
add_filter( 'lsx_to_framework_settings_tabs', array( $this, 'settings_page_array') ); |
|
27
|
|
|
add_action('lsx_to_framework_api_tab_content',array( $this, 'api_settings'),10,1); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Returns the array of settings to the UIX Class in the lsx framework |
|
32
|
|
|
*/ |
|
33
|
|
|
public function settings_page_array($tabs){ |
|
34
|
|
|
$tabs[$this->plugin_slug] = array( |
|
35
|
|
|
'page_title' => __('Image Scaling','wetu-importer'), |
|
36
|
|
|
'page_description' => __('','wetu-importer'), |
|
37
|
|
|
'menu_title' => __('Importer','wetu-importer'), |
|
38
|
|
|
'template' => WETU_IMPORTER_PATH.'settings/wetu.php', |
|
39
|
|
|
'default' => false |
|
40
|
|
|
); |
|
41
|
|
|
return $tabs; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Adds the API key to the API Tab |
|
46
|
|
|
*/ |
|
47
|
|
|
public function api_settings($tab='general') { |
|
48
|
|
|
if('settings' === $tab){ ?> |
|
49
|
|
|
<tr class="form-field-wrap"> |
|
50
|
|
|
<th class="tour-operator_table_heading" style="padding-bottom:0px;" scope="row" colspan="2"> |
|
51
|
|
|
<h4 style="margin-bottom:0px;"><span><?php _e( 'WETU API', 'wetu-importer' ); ?></span></h4> |
|
52
|
|
|
</th> |
|
53
|
|
|
</tr> |
|
54
|
|
|
<tr class="form-field"> |
|
55
|
|
|
<th scope="row"> |
|
56
|
|
|
<i class="dashicons-before dashicons-admin-network"></i> <label for="wetu_api_key"> <?php _e( 'Key', 'wetu-importer' ); ?></label> |
|
57
|
|
|
</th> |
|
58
|
|
|
<td> |
|
59
|
|
|
<input type="text" {{#if wetu_api_key}} value="{{wetu_api_key}}" {{/if}} name="wetu_api_key" /> |
|
60
|
|
|
</td> |
|
61
|
|
|
</tr> |
|
62
|
|
|
<tr class="form-field"> |
|
63
|
|
|
<th scope="row"> |
|
64
|
|
|
<i class="dashicons-before dashicons-admin-users"></i> <label for="wetu_api_username"> <?php _e( 'Username', 'wetu-importer' ); ?></label> |
|
65
|
|
|
</th> |
|
66
|
|
|
<td> |
|
67
|
|
|
<input type="text" {{#if wetu_api_username}} value="{{wetu_api_username}}" {{/if}} name="wetu_api_username" /> |
|
68
|
|
|
</td> |
|
69
|
|
|
</tr> |
|
70
|
|
|
<tr class="form-field"> |
|
71
|
|
|
<th scope="row"> |
|
72
|
|
|
<i class="dashicons-before dashicons-lock"></i> <label for="wetu_api_password"> <?php _e( 'Password', 'wetu-importer' ); ?></label> |
|
73
|
|
|
</th> |
|
74
|
|
|
<td> |
|
75
|
|
|
<input type="text" {{#if wetu_api_password}} value="{{wetu_api_password}}" {{/if}} name="wetu_api_password" /> |
|
76
|
|
|
</td> |
|
77
|
|
|
</tr> |
|
78
|
|
|
<?php } |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
$wetu_importer_settings = new WETU_Importer_Settings(); |
|
82
|
|
|
|