PluginProbe
WP Database Backup – Unlimited Database & Files Backup by Backup for WP / 6.11
WP Database Backup – Unlimited Database & Files Backup by Backup for WP v6.11
7.13 7.12 trunk 1.1 2.1.1 5.9 6.0 6.1 6.10 6.11 6.12 6.12.1 6.2 6.3 6.4 6.5 6.5.1 6.6 6.7 6.8 6.9 7.0 7.0.1 7.1 7.10 All 34 releases
wp-database-backup / includes / admin / newsletter.php

newsletter.php in WP Database Backup – Unlimited Database & Files Backup by Backup for WP 6.11, at includes/admin/newsletter.php

94 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Newsletter class
4 *
5 * @author Magazine3
6 * @category Admin
7 * @path controllers/admin/newsletter
8 * @Version 1.0
9 */
10
11 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) exit;
13
14 class wpdbbkp_ads_newsletter {
15
16 function __construct () {
17 add_filter( 'wpdbbkp_localize_filter',array($this,'wpdbbkp_add_localize_footer_data'),10,2);
18 add_action('wp_ajax_wpdbbkp_subscribe_to_news_letter', array($this, 'wpdbbkp_subscribe_to_news_letter'));
19 }
20
21 function wpdbbkp_subscribe_to_news_letter(){
22
23 if ( ! isset( $_POST['wpdbbkp_security_nonce'] ) ){
24 return;
25 }
26 if ( !wp_verify_nonce( $_POST['wpdbbkp_security_nonce'], 'wpdbbkp_ajax_check_nonce' ) ){
27 return;
28 }
29 if( ! current_user_can( 'manage_options' ) ) {
30 return;
31 }
32
33 if(isset($_POST['email'])){
34
35 $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
36
37 $api_params = array(
38 'name' => sanitize_text_field($_POST['name']),
39 'email' => sanitize_email($_POST['email']),
40 'website' => sanitize_text_field($_POST['website']),
41 'type' => 'wpdbbkp'
42 );
43
44 $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
45 if ( ! is_wp_error( $response ) ) {
46 $response = wp_remote_retrieve_body( $response );
47 echo $response;
48 }else{
49 echo esc_html__('Unable to submit form, please try again','wpdbbkp') ;
50 }
51
52 }else{
53 echo esc_html__('Email id required','wpdbbkp');
54 }
55
56 wp_die();
57 }
58
59 function wpdbbkp_add_localize_footer_data($object, $object_name){
60
61 $dismissed = explode (',', get_user_meta (wp_get_current_user()->ID, 'dismissed_wp_pointers', true));
62 $do_tour = !in_array ('wpdbbkp_subscribe_pointer', $dismissed);
63
64 if ($do_tour) {
65 wp_enqueue_style ('wp-pointer');
66 wp_enqueue_script ('wp-pointer');
67 }
68
69 if($object_name == 'wpdbbkp_localize_data'){
70
71 global $current_user;
72 $tour = array ();
73 $tab = isset($_GET['tab']) ? esc_attr($_GET['tab']) : '';
74
75 if (!array_key_exists($tab, $tour)) {
76
77 $object['do_tour'] = $do_tour;
78 $object['get_home_url'] = get_home_url();
79 $object['current_user_email'] = $current_user->user_email;
80 $object['current_user_name'] = $current_user->display_name;
81 $object['displayID'] = '#menu-settings';
82 $object['button1'] = esc_html('No Thanks','wpdbbkp');
83 $object['button2'] = false;
84 $object['function_name'] = '';
85 }
86
87 }
88 return $object;
89
90 }
91
92 }
93 $wpdbbkp_ads_newsletter = new wpdbbkp_ads_newsletter();
94 ?>