class-subscribe-and-connect-settings-connect.php
6.75 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/*
* Subscribe & Connect Connect Settings
*
* All functionality pertaining to the connect settings screen.
*
* @package WordPress
* @subpackage Subscribe_And_Connect
* @category Admin
* @author WooThemes
* @since 1.0.0
*
* TABLE OF CONTENTS
*
* - __construct()
* - init_sections()
* - init_fields()
* - get_duration_options()
*/
class Subscribe_And_Connect_Settings_Connect extends Subscribe_And_Connect_Settings_API {
/**
* __construct function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function __construct () {
parent::__construct(); // Required in extended classes.
$this->token = 'subscribe-and-connect-connect';
$this->name = __( 'Connect', 'subscribe-and-connect' );
} // End __construct()
/**
* init_sections function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function init_sections () {
$sections = array();
$sections['networks'] = array(
'name' => __( 'Social Networks', 'subscribe-and-connect' ),
'description' => __( 'Add links and icons to the social networks you\'d like to link to.', 'subscribe-and-connect' )
);
$sections['subscriptions'] = array(
'name' => __( 'Subscription Options', 'subscribe-and-connect' ),
'description' => __( 'Setup the various ways in which your visitors can subscribe to your content.', 'subscribe-and-connect' )
);
$this->sections = $sections;
} // End init_sections()
/**
* init_fields function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function init_fields () {
global $pagenow;
$fields = array();
$fields['rss'] = array(
'name' => __( 'RSS', 'subscribe-and-connect' ),
'description' => __( 'Display an RSS icon along with your social network links.', 'subscribe-and-connect' ),
'type' => 'checkbox',
'default' => true,
'section' => 'networks',
'required' => 0
);
$fields['networks'] = array(
'name' => __( 'Social Networks', 'subscribe-and-connect' ),
'description' => __( 'The social networks to be linked to in the "Connect" portion of the output. Drag and drop to reorder.', 'subscribe-and-connect' ),
'type' => 'network',
'default' => array( 'facebook' ),
'section' => 'networks',
'required' => 0
);
$fields['networks_order'] = array(
'name' => '',
'description' => '',
'type' => 'hidden',
'default' => '',
'section' => 'networks',
'required' => 0
);
// Subscriptions
$newsletter_services = array(
'none' => __( 'None', 'subscribe-and-connect' ),
'aweber' => __( 'Aweber', 'subscribe-and-connect' ),
'campaign_monitor' => __( 'Campaign Monitor', 'subscribe-and-connect' ),
'feedburner' => __( 'Feedburner', 'subscribe-and-connect' ),
'mad_mimi' => __( 'Mad Mimi', 'subscribe-and-connect' ),
'mailchimp' => __( 'Mailchimp', 'subscribe-and-connect' )
);
// Check if MailPoet is installed and add as option
$wysija_lists = array();
if ( class_exists( 'WYSIJA' ) ) {
$newsletter_services['wysija'] = __( 'MailPoet Newsletters', 'subscribe-and-connect' );
$model_list = WYSIJA::get( 'list','model' );
$wysija_lists_temp = $model_list->get( array( 'name','list_id' ), array( 'is_enabled' => 1 ) );
foreach( $wysija_lists_temp as $list ) {
$wysija_lists[$list['list_id']] = $list['name'];
}
}
$fields['newsletter_service'] = array(
'name' => __( 'Newsletter Service', 'subscribe-and-connect' ),
'description' => __( 'Select the newsletter service you are using.', 'subscribe-and-connect' ) . '<br /><small>' . sprintf( __( '(Need a hand setting up your newsletter subscriptions? %1$sSee our documentation%2$s for a helping hand.)', 'subscribe-and-connect' ), '<a href="' . esc_url( 'http://docs.woothemes.com/document/subscribe-and-connect/#section-2' ) . '">', '</a>' ) . '</small>',
'type' => 'select',
'default' => 'none',
'options' => $newsletter_services,
'section' => 'subscriptions'
);
$fields['newsletter_service_id'] = array(
'name' => __( 'Feedburner Feed ID', 'subscribe-and-connect' ),
'description' => sprintf( __( 'Enter the your Feedburner Feed ID %s(?)%s.', 'subscribe-and-connect' ), '<a href="' . esc_url( 'http://support.google.com/feedburner/bin/answer.py?hl=en&answer=78982' ) . '" target="_blank">', '</a>' ),
'type' => 'text',
'default' => '' ,
'section' => 'subscriptions'
);
$fields['newsletter_service_form_action'] = array(
'name' => __( 'Newsletter Form Action', 'subscribe-and-connect' ),
'description' => __( 'Enter the the form action if required.', 'subscribe-and-connect' ),
'type' => 'text',
'default' => '' ,
'section' => 'subscriptions'
);
$fields['newsletter_mail_chimp_list_subscription_url'] = array(
'name' => __( 'MailChimp List Subscription URL', 'subscribe-and-connect' ),
'description' => sprintf( __( 'If you have a MailChimp account you can enter the %sMailChimp List Subscribe URL%s to allow your users to subscribe to a MailChimp List.', 'subscribe-and-connect' ), '<a href="' . esc_url( 'http://woochimp.heroku.com/' ) . '" target="_blank">', '</a>' ),
'type' => 'text',
'default' => '' ,
'section' => 'subscriptions'
);
$fields['newsletter_mad_mimi_subscription_url'] = array(
'name' => __( 'Mad Mimi Webform URL', 'subscribe-and-connect' ),
'description' => __( 'Your Mad Mini Webform URL, eg. https://madmimi.com/signups/subscribe/84680', 'subscribe-and-connect' ),
'type' => 'text',
'default' => '' ,
'section' => 'subscriptions'
);
$fields['newsletter_aweber_list_id'] = array(
'name' => __( 'Aweber List Name', 'subscribe-and-connect' ),
'description' => __( 'The name of the list to subscribe users to.', 'subscribe-and-connect' ),
'type' => 'text',
'default' => '' ,
'section' => 'subscriptions'
);
if ( class_exists( 'WYSIJA' ) ) {
$fields['newsletter_wysija_list_id'] = array(
'name' => __( 'MailPoet List', 'subscribe-and-connect' ),
'description' => __( 'Select the name of the MailPoet list to subscribe users to.', 'subscribe-and-connect' ),
'type' => 'select',
'default' => '' ,
'section' => 'subscriptions',
'options' => $wysija_lists
);
}
$this->fields = $fields;
} // End init_fields()
} // End Class
?>