settings.class.php
2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( __FILE__ ) == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
die ( 'Please do not load this screen directly. Thanks!' );
}
/**
* WooDojo - ShortLinks Settings
*
* Settings for the WooDojo - ShortLinks feature.
*
* @package WordPress
* @subpackage WooDojo
* @category Bundled
* @author WooThemes
* @since 1.0.0
*
* TABLE OF CONTENTS
*
* - __construct()
* - init_sections()
* - init_fields()
*/
class WooDojo_ShortLinks_Settings extends WooDojo_Settings_API {
/**
* __construct function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function __construct () {
parent::__construct(); // Required in extended classes.
} // End __construct()
/**
* init_sections function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function init_sections () {
$sections = array();
$sections['main'] = array(
'name' => __( 'Main Settings', 'woodojo' ),
'description' => __( 'Main settings and configuration', 'woodojo' )
);
$sections['bitly-setup'] = array(
'name' => __( 'Bitly Setup', 'woodojo' ),
'description' => __( 'Settings and configuration for Bitly', 'woodojo' )
);
$this->sections = $sections;
} // End init_sections()
/**
* init_fields function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function init_fields () {
$fields = array();
/* Setup default services list and make it filterable */
$service_list = array( 'native' => 'Native', 'bitly' => 'Bitly', 'tinyurl' => 'TinyURL' );
$service_list = apply_filters( 'woodojo_shortlinks_service_list', $service_list );
$fields['service'] = array(
'name' => __( 'Service Select', 'woodojo' ),
'description' => __( 'Select the service to use for generating a short url.', 'woodojo' ),
'type' => 'select',
'default' => 'native',
'section' => 'main',
'required' => 1,
'options' => $service_list
);
$fields['bitly_login'] = array(
'name' => __( 'Bitly Username', 'woodojo' ),
'description' => __( 'Enter your Bitly username.', 'woodojo' ),
'type' => 'text',
'default' => '',
'section' => 'bitly-setup',
'required' => 0
);
$fields['bitly_api_key'] = array(
'name' => __( 'Bitly API Key', 'woodojo' ),
'description' => __( 'Enter your Bitly API Key.', 'woodojo' ),
'type' => 'text',
'default' => '',
'section' => 'bitly-setup',
'required' => 0
);
$this->fields = $fields;
} // End init_fields()
} // End Class
?>