PluginProbe
WP Database Backup – Unlimited Database & Files Backup by Backup for WP / 6.5
WP Database Backup – Unlimited Database & Files Backup by Backup for WP v6.5
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.5, at includes/admin/mb-helper-functions.php

153 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 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 if( ! current_user_can( 'manage_options' ) ) {
77 return;
78 }
79
80 if( isset( $_POST['data'] ) ) {
81 parse_str( $_POST['data'], $form );
82 }
83
84 $text = '';
85 if( isset( $form['wpdbbkp_disable_text'] ) ) {
86 $text = implode( "\n\r", $form['wpdbbkp_disable_text'] );
87 }
88
89 $headers = array();
90
91 $from = isset( $form['wpdbbkp_disable_from'] ) ? $form['wpdbbkp_disable_from'] : '';
92 if( $from ) {
93 $headers[] = "From: $from";
94 $headers[] = "Reply-To: $from";
95 }
96
97 $subject = isset( $form['wpdbbkp_disable_reason'] ) ? $form['wpdbbkp_disable_reason'] : '(no reason given)';
98
99 $subject = $subject.' - Backup for WP Publisher';
100
101 if($subject == 'technical - Backup for WP Publisher'){
102
103 $text = trim($text);
104
105 if(!empty($text)){
106
107 $text = 'technical issue description: '.$text;
108
109 }else{
110
111 $text = 'no description: '.$text;
112 }
113
114 }
115
116 $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
117
118 die();
119 }
120 add_action( 'wp_ajax_wpdbbkp_send_feedback', 'wpdbbkp_send_feedback' );
121
122
123
124 add_action( 'admin_enqueue_scripts', 'wpdbbkp_enqueue_makebetter_email_js' );
125
126 function wpdbbkp_enqueue_makebetter_email_js(){
127
128 if( !is_admin() && !wpdbbkp_is_plugins_page()) {
129 return;
130 }
131
132 wp_enqueue_script( 'wpdbbkp-make-better-js', WPDB_PLUGIN_URL . '/assets/js/make-better-admin.js', array( 'jquery' ), WPDB_VERSION);
133
134 wp_enqueue_style( 'wpdbbkp-make-better-css', WPDB_PLUGIN_URL . '/assets/css/make-better-admin.css', false , WPDB_VERSION);
135 wp_localize_script('wpdbbkp-make-better-js', 'wpdbbkp_pub_script_vars', array(
136 'nonce' => wp_create_nonce( 'wpdbbkp-pub-nonce' ),
137 )
138 );
139 }
140
141 if( is_admin() && wpdbbkp_is_plugins_page()) {
142 add_filter('admin_footer', 'wpdbbkp_add_deactivation_feedback_modal');
143 }
144
145 function wpdbbkp_is_pro_active()
146 {
147 $check_status = false;
148 $pluginPath = 'wp-database-backup-pro/wp-all-backup.php';
149 if (is_plugin_active( $pluginPath )) {
150 $check_status = true;
151 }
152 return $check_status;
153 }