PluginProbe
WP Database Backup – Unlimited Database & Files Backup by Backup for WP / 6.0
WP Database Backup – Unlimited Database & Files Backup by Backup for WP v6.0
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 / mb-helper-functions.php

mb-helper-functions.php in WP Database Backup – Unlimited Database & Files Backup by Backup for WP 6.0, at includes/admin/mb-helper-functions.php

145 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 // Exit if accessed directly
5 if( !defined( 'ABSPATH' ) )
6 exit;
7
8 /**
9 * Helper method to check if user is in the plugins page.
10 *
11 * @author
12 * @since 1.4.0
13 *
14 * @return bool
15 */
16 function wpdbbkp_is_plugins_page() {
17 global $pagenow;
18
19 return ( 'plugins.php' === $pagenow );
20 }
21
22 function wpdbbkp_get_current_url(){
23
24 $link = "http";
25
26 if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'){
27 $link = "https";
28 }
29
30 $link .= "://";
31 $link .= $_SERVER['HTTP_HOST'];
32 $link .= $_SERVER['REQUEST_URI'];
33
34 return $link;
35 }
36
37 /**
38 * display deactivation logic on plugins page
39 *
40 * @since 1.4.0
41 */
42
43
44 function wpdbbkp_add_deactivation_feedback_modal() {
45
46
47 if( !is_admin() && !wpdbbkp_is_plugins_page()) {
48 return;
49 }
50
51 $current_user = wp_get_current_user();
52 if( !($current_user instanceof WP_User) ) {
53 $email = '';
54 } else {
55 $email = trim( $current_user->user_email );
56 }
57
58 require_once WPDB_PATH."includes/admin/deactivate-feedback.php";
59
60 }
61
62 /**
63 * send feedback via email
64 *
65 * @since 1.4.0
66 */
67 function wpdbbkp_send_feedback() {
68
69 if ( ! isset( $_POST['wpdbbkp_security_nonce'] ) ){
70 return;
71 }
72 if ( !wp_verify_nonce( $_POST['wpdbbkp_security_nonce'], 'wpdbbkp-pub-nonce' ) ){
73 return;
74 }
75
76
77 if( isset( $_POST['data'] ) ) {
78 parse_str( $_POST['data'], $form );
79 }
80
81 $text = '';
82 if( isset( $form['wpdbbkp_disable_text'] ) ) {
83 $text = implode( "\n\r", $form['wpdbbkp_disable_text'] );
84 }
85
86 $headers = array();
87
88 $from = isset( $form['wpdbbkp_disable_from'] ) ? $form['wpdbbkp_disable_from'] : '';
89 if( $from ) {
90 $headers[] = "From: $from";
91 $headers[] = "Reply-To: $from";
92 }
93
94 $subject = isset( $form['wpdbbkp_disable_reason'] ) ? $form['wpdbbkp_disable_reason'] : '(no reason given)';
95
96 $subject = $subject.' - Backup for WP Publisher';
97
98 if($subject == 'technical - Backup for WP Publisher'){
99
100 $text = trim($text);
101
102 if(!empty($text)){
103
104 $text = 'technical issue description: '.$text;
105
106 }else{
107
108 $text = 'no description: '.$text;
109 }
110
111 }
112
113 $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
114
115 die();
116 }
117 add_action( 'wp_ajax_wpdbbkp_send_feedback', 'wpdbbkp_send_feedback' );
118
119
120
121 add_action( 'admin_enqueue_scripts', 'wpdbbkp_enqueue_makebetter_email_js' );
122
123 function wpdbbkp_enqueue_makebetter_email_js(){
124
125 if( !is_admin() && !wpdbbkp_is_plugins_page()) {
126 return;
127 }
128
129 wp_enqueue_script( 'wpdbbkp-make-better-js', WPDB_PLUGIN_URL . '/assets/js/make-better-admin.js', array( 'jquery' ), WPDB_VERSION);
130
131 wp_enqueue_style( 'wpdbbkp-make-better-css', WPDB_PLUGIN_URL . '/assets/css/make-better-admin.css', false , WPDB_VERSION);
132 wp_localize_script('wpdbbkp-make-better-js', 'wpdbbkp_pub_script_vars', array(
133 'nonce' => wp_create_nonce( 'wpdbbkp-pub-nonce' ),
134 )
135 );
136 }
137
138 if( is_admin() && wpdbbkp_is_plugins_page()) {
139 add_filter('admin_footer', 'wpdbbkp_add_deactivation_feedback_modal');
140 }
141
142
143
144
145