@@ -40,12 +40,6 @@ public static function activate_plugin() {
40
40
41
41
/* Activate shared components */
42
42
self ::activate_shared ();
43
-
44
- /* Create Double Optin Page */
45
- self ::create_double_optin_page ();
46
-
47
- /* Create Double Optin List */
48
- self ::create_double_optin_list ();
49
43
50
44
/* Mark Active */
51
45
add_option ( 'Leads_Activated ' , true );
@@ -176,148 +170,6 @@ public static function abort_activation( $args ) {
176
170
exit ;
177
171
}
178
172
179
- /**
180
- * Creates the "Confirm Double Optin Page" if the double optin page id is empty
181
- */
182
- public static function create_double_optin_page (){
183
- global $ inbound_settings ;
184
-
185
- $ title = __ ( 'Confirm Subscription ' , 'inbound-pro ' );
186
-
187
- $ double_optin_page_id = self ::get_double_optin_page_id ();
188
-
189
- // If the confirm page id isn't set
190
- if (empty ($ double_optin_page_id )) {
191
-
192
- /**check by name to see if the confirm page exists, if it doesn't create it**/
193
- if (null == get_page_by_title ( $ title )){
194
- // Set the page ID so that we know the post was created successfully
195
- $ page_id = wp_insert_post (array (
196
- 'comment_status ' => 'closed ' ,
197
- 'ping_status ' => 'closed ' ,
198
- 'post_title ' => $ title ,
199
- 'post_status ' => 'publish ' ,
200
- 'post_type ' => 'page ' ,
201
- 'post_content ' => __ ('Thank you! ' , 'inbound-pro ' )
202
- ));
203
- }else {
204
- /*if the confirm page does exist, set the page id to its id*/
205
- $ page_id = get_page_by_title ( $ title );
206
- }
207
-
208
- self ::save_double_optin_page_id ($ page_id );
209
- }
210
-
211
- }
212
-
213
- /**
214
- * Creates a maintenance list
215
- */
216
- public static function create_double_optin_list () {
217
- /*get the double optin waiting list id*/
218
- if (!defined ('INBOUND_PRO_CURRENT_VERSION ' )) {
219
- $ double_optin_list_id = get_option ('list-double-optin-list-id ' , '' );
220
- } else {
221
- $ settings = Inbound_Options_API::get_option ('inbound-pro ' , 'settings ' , array ());
222
- $ double_optin_list_id = $ settings ['leads ' ]['list-double-optin-list-id ' ];
223
- }
224
-
225
- // If the list doesn't already exist, create it
226
- if (false == get_term_by ('id ' , $ double_optin_list_id , 'wplead_list_category ' )) {
227
-
228
- /* create/get maintenance lists */
229
- $ parent = self ::create_lead_list ( array (
230
- 'name ' => __ ( 'Maintenance ' , 'inbound-pro ' )
231
- ));
232
-
233
- /* createget spam lists */
234
- $ term = self ::create_lead_list ( array (
235
- 'name ' => __ ( 'Unconfirmed ' , 'inbound-pro ' ),
236
- 'parent ' =>$ parent ['id ' ]
237
- ));
238
-
239
- /*get the double optin waiting list id*/
240
- if (!defined ('INBOUND_PRO_CURRENT_VERSION ' )) {
241
- update_option ('list-double-optin-list-id ' , $ term ['id ' ]);
242
- } else {
243
- $ settings = Inbound_Options_API::get_option ('inbound-pro ' , 'settings ' );
244
- $ settings ['leads ' ]['list-double-optin-list-id ' ] = $ term ['id ' ];
245
- Inbound_Options_API::update_option ('inbound-pro ' , 'settings ' , $ settings );
246
- }
247
-
248
- }
249
- }
250
-
251
- /**
252
- * Retrieves double opt in page id
253
- * @return mixed
254
- */
255
- public static function get_double_optin_page_id () {
256
- global $ inbound_settings ;
257
- /*get the double optin confirm page id*/
258
- if (!defined ('INBOUND_PRO_CURRENT_VERSION ' )){
259
- $ double_optin_page_id = get_option ('list-double-optin-page-id ' , '' );
260
- }else {
261
- $ double_optin_page_id = $ inbound_settings ['leads ' ]['list-double-optin-page-id ' ];
262
- }
263
-
264
- return $ double_optin_page_id ;
265
- }
266
-
267
- /**
268
- * Save Double Optin Page ID
269
- * @param $page_id
270
- */
271
- public static function save_double_optin_page_id ( $ page_id ) {
272
- global $ inbound_settings ;
273
-
274
- if (!defined ('INBOUND_PRO_CURRENT_VERSION ' )) {
275
- update_option ('list-double-optin-page-id ' , $ page_id );
276
- } else {
277
- $ inbound_settings ['leads ' ]['list-double-optin-page-id ' ] = $ page_id ;
278
- Inbound_Options_API::update_option ('inbound-pro ' , 'settings ' , $ settings );
279
- }
280
- }
281
-
282
- /**
283
- * Adds a new lead list.
284
- * @developer-note: This function is also located in Inbound_Leads class, but it's currently unreachable.
285
- */
286
- public static function create_lead_list ( $ args ) {
287
-
288
- $ params = array ();
289
-
290
- /* if no list name is present then return null */
291
- if ( !isset ( $ args ['name ' ] )) {
292
- return null ;
293
- }
294
-
295
- if (isset ( $ args ['description ' ] )) {
296
- $ params ['description ' ] = $ args ['description ' ];
297
- }
298
-
299
- if (isset ( $ args ['parent ' ] )) {
300
- $ params ['parent ' ] = $ args ['parent ' ];
301
- } else {
302
- $ params ['parent ' ] = 0 ;
303
- }
304
-
305
- $ term = term_exists ( $ args ['name ' ], 'wplead_list_category ' , $ params ['parent ' ] );
306
-
307
- /* if term does not exist then create it */
308
- if ( !$ term ) {
309
- $ term = wp_insert_term ( $ args ['name ' ], 'wplead_list_category ' , $ params );
310
- }
311
-
312
- if ( is_array ($ term ) && isset ( $ term ['term_id ' ] ) ) {
313
- return array ( 'id ' => $ term ['term_id ' ] );
314
- } else if ( is_numeric ($ term ) ) {
315
- return array ( 'id ' => $ term );
316
- } else {
317
- return $ term ;
318
- }
319
- }
320
-
321
173
}
322
174
323
175
/* Add Activation Hook */
0 commit comments