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 / mb-helper-functions.php

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

147 lines 3.5 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 if(function_exists('get_current_screen')){
18 $screen = get_current_screen();
19 if(is_object($screen)){
20 if($screen->id == 'plugins' || $screen->id == 'plugins-network'){
21 return true;
22 }
23 }
24 }
25 return false;
26 }
27
28 function wpdbbkp_get_current_url(){
29
30 $link = "http";
31
32 if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'){
33 $link = "https";
34 }
35
36 $link .= "://";
37 $link .= $_SERVER['HTTP_HOST'];
38 $link .= $_SERVER['REQUEST_URI'];
39
40 return $link;
41 }
42
43 /**
44 * display deactivation logic on plugins page
45 *
46 * @since 1.4.0
47 */
48
49
50 function wpdbbkp_add_deactivation_feedback_modal() {
51
52
53 if( !is_admin() && !wpdbbkp_is_plugins_page()) {
54 return;
55 }
56
57 $current_user = wp_get_current_user();
58 if( !($current_user instanceof WP_User) ) {
59 $email = '';
60 } else {
61 $email = trim( $current_user->user_email );
62 }
63
64 require_once WPDB_PATH."includes/admin/deactivate-feedback.php";
65
66 }
67
68 /**
69 * send feedback via email
70 *
71 * @since 1.4.0
72 */
73 function wpdbbkp_send_feedback() {
74
75 if ( ! isset( $_POST['wpdbbkp_security_nonce'] ) ){
76 return;
77 }
78 if ( !wp_verify_nonce( $_POST['wpdbbkp_security_nonce'], 'wpdbbkp-pub-nonce' ) ){
79 return;
80 }
81
82 if( ! current_user_can( 'manage_options' ) ) {
83 return;
84 }
85
86 if( isset( $_POST['data'] ) ) {
87 parse_str( $_POST['data'], $form );
88 }
89
90 $text = '';
91 if( isset( $form['wpdbbkp_disable_text'] ) ) {
92 $text = implode( "\n\r", $form['wpdbbkp_disable_text'] );
93 }
94
95 $headers = array();
96
97 $from = isset( $form['wpdbbkp_disable_from'] ) ? $form['wpdbbkp_disable_from'] : '';
98 if( $from ) {
99 $headers[] = "From: $from";
100 $headers[] = "Reply-To: $from";
101 }
102
103 $subject = isset( $form['wpdbbkp_disable_reason'] ) ? $form['wpdbbkp_disable_reason'] : '(no reason given)';
104
105 $subject = $subject.' - Backup for WP Publisher';
106
107 if($subject == 'technical - Backup for WP Publisher'){
108
109 $text = trim($text);
110
111 if(!empty($text)){
112
113 $text = 'technical issue description: '.$text;
114
115 }else{
116
117 $text = 'no description: '.$text;
118 }
119
120 }
121
122 $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
123
124 wp_die();
125 }
126 add_action( 'wp_ajax_wpdbbkp_send_feedback', 'wpdbbkp_send_feedback' );
127
128
129
130 add_action( 'admin_enqueue_scripts', 'wpdbbkp_enqueue_makebetter_email_js' );
131
132 function wpdbbkp_enqueue_makebetter_email_js(){
133
134 if( !is_admin() && !wpdbbkp_is_plugins_page()) {
135 return;
136 }
137
138
139 wp_register_script( 'wpdbbkp-make-better-js', WPDB_PLUGIN_URL . '/assets/js/make-better-admin.js', array( 'jquery' ), WPDB_VERSION);
140 wp_localize_script('wpdbbkp-make-better-js', 'wpdbbkp_pub_script_vars', array(
141 'nonce' => wp_create_nonce( 'wpdbbkp-pub-nonce' ),)
142 );
143 wp_enqueue_script( 'wpdbbkp-make-better-js');
144 wp_enqueue_style( 'wpdbbkp-make-better-css', WPDB_PLUGIN_URL . '/assets/css/make-better-admin.css', false , WPDB_VERSION);
145 }
146
147 add_filter('admin_footer', 'wpdbbkp_add_deactivation_feedback_modal');