| @@ -1,239 +1,66 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Show header notification in dashboard | |
| 4 | - * | |
| 5 | - * @package wpdbbkp | |
| 6 | - */ | |
| 7 | - | |
| 8 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | - exit; | |
| 10 | -} // Exit if accessed directly | |
| 11 | -$notifier_file_url = NOTIFIER_XML_FILE_WPDB; | |
| 12 | -$changelog_msg = ''; | |
| 13 | -$notifier_data = ''; | |
| 14 | -$result = array(); | |
| 15 | - | |
| 16 | -$change_message = "<strong><a href='https://www.wpseeds.com/product/wp-all-backup/' target='_blank'>WP All Backup Plugin.</a></strong> will backup and restore your entire site at will, | |
| 17 | - complete with FTP & S3 integration"; | |
| 18 | -$coupon = "Use Coupon code <strong>'WPDBSPECIAL40'</strong> and Get Flat 40% off on <strong><a href='https://www.wpseeds.com/product/wp-all-backup/' target='_blank'>WP All Backup Plugin.</a></strong>"; | |
| 19 | - | |
| 20 | -$url = $notifier_file_url; | |
| 21 | -$request = new WP_Http(); | |
| 22 | -$result = (array) $request->request( $url ); | |
| 23 | - | |
| 24 | - | |
| 25 | - | |
| 26 | - | |
| 27 | -// Load the remote XML data into a variable and return it. | |
| 28 | -$xml = simplexml_load_string( $notifier_data ); | |
| 29 | -if ( ! empty( $xml ) ) { | |
| 30 | - $changelog_msg = ''; | |
| 31 | - if ( true === isset( $xml->message ) && ! empty( $xml->message ) ) { | |
| 32 | - $change_message = $xml->message; | |
| 33 | - } | |
| 34 | - if ( true === isset( $xml->coupon ) && ! empty( $xml->coupon ) ) { | |
| 35 | - $coupon = $xml->coupon; | |
| 36 | - } | |
| 37 | - if ( true === isset( $xml->newrele ) && ! empty( $xml->newrele ) ) { | |
| 38 | - $$changelog_msg .= "<li class='list-group-item' >" . $xml->newrelease . '<li>'; | |
| 39 | - } | |
| 40 | - if ( WPDB_VERSION === $xml->latest ) { | |
| 41 | - $alert = '<strong>No Alert</strong><br/>'; | |
| 42 | - $changelog = ''; | |
| 43 | - } else { | |
| 44 | - if ( true === isset( $xml->latest ) ) { | |
| 45 | - $alert = '<strong><a href="https://www.wpseeds.com/blog/category/update/" title="Change Log" target="_blank">Plugin Updates</a></strong><br/> | |
| 46 | - <strong>There is a new version of the <br/>WP Database Backup plugin available.</strong> | |
| 47 | - You have version ' . WPDB_VERSION . ' Update to version ' . $xml->latest . '.'; | |
| 48 | - } | |
| 49 | - if ( true === isset( $xml->changelog ) ) { | |
| 50 | - $changelog = $xml->changelog; | |
| 51 | - } | |
| 52 | - | |
| 53 | - $changelog_msg .= '<li class="list-group-item" ><strong>New Version Availabel</strong></li>'; | |
| 54 | - | |
| 55 | - echo '<style>.glyphicon.glyphicon-bell { | |
| 56 | - color: red !important; | |
| 57 | - }</style>'; | |
| 58 | - } | |
| 59 | -} else { | |
| 60 | - $alert = '<strong>No Alert</strong><br/>'; | |
| 61 | - $changelog = ''; | |
| 62 | -} | |
| 63 | -$changelog_msg .= "<li class='list-group-item'>" . $change_message . '<li>'; | |
| 64 | -$changelog_msg .= "<li class='list-group-item'>" . $coupon . '<li>'; | |
| 65 | -?> | |
| 66 | - <?php if ( true === isset( $_GET['notification'] ) ) { ?> | |
| 67 | - <div class="row"> | |
| 68 | - <div class="col-xs-12 col-sm-12 col-md-12"> | |
| 69 | - <div class="alert alert-success alert-dismissible fade in" role="alert"> | |
| 70 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 71 | - <?php | |
| 72 | - if ( true === isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'wp-database-backup' ) ) { | |
| 73 | - if ( 'create' === $_GET['notification'] ) { | |
| 74 | - $backup_list = get_option( 'wp_db_backup_backups' ); | |
| 75 | - $download_backup = end( $backup_list ); | |
| 76 | - $backup_link = '<a href="' . esc_url( $download_backup['url'] ) . '" style="color: #21759B;">' . __( 'Click Here to Download Backup.', 'wpdbbkp' ) . '</a>'; | |
| 77 | - esc_attr_e( 'Database Backup Created Successfully. ', 'wpdbbkp' ); | |
| 78 | - echo wp_kses_post( $backup_link ); | |
| 79 | - } elseif ( 'restore' === $_GET['notification'] ) { | |
| 80 | - esc_attr_e( 'Database Backup Restore Successfully', 'wpdbbkp' ); | |
| 81 | - } elseif ( 'delete' === $_GET['notification'] ) { | |
| 82 | - esc_attr_e( 'Database Backup deleted Successfully', 'wpdbbkp' ); | |
| 83 | - } elseif ( 'clear_temp_db_backup_file' === $_GET['notification'] ) { | |
| 84 | - esc_attr_e( 'Clear all old/temp database backup files Successfully', 'wpdbbkp' ); | |
| 85 | - } elseif ( 'Invalid' === $_GET['notification'] ) { | |
| 86 | - esc_attr_e( 'Invalid Access!!!!', 'wpdbbkp' ); | |
| 87 | - } elseif ( 'deleteauth' === $_GET['notification'] ) { | |
| 88 | - esc_attr_e( 'Dropbox account unlink Successfully', 'wpdbbkp' ); | |
| 89 | - } elseif ( 'save' === $_GET['notification'] ) { | |
| 90 | - esc_attr_e( 'Backup Setting Saved Successfully', 'wpdbbkp' ); | |
| 91 | - } | |
| 92 | - } | |
| 93 | - ?> | |
| 94 | - </div> | |
| 95 | - </div> | |
| 96 | -</div> | |
| 97 | -<?php } ?> | |
| 98 | -<div class="row"> | |
| 99 | -<div class="col-xs-8 col-sm-8 col-md-8"> | |
| 100 | - <img id="backup_process" style="display:none" width="50" height="50" src="<?php echo esc_url( WPDB_PLUGIN_URL ); ?>/assets/images/icon_loading.gif"> | |
| 101 | -</div> | |
| 102 | - <div class="col-xs-4 col-sm-4 col-md-4 text-right"> | |
| 103 | - | |
| 104 | - <!-- Single button --> | |
| 105 | - <div class="btn-group"> | |
| 106 | - <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
| 107 | - <span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> <span class="caret"></span> | |
| 108 | - </button> | |
| 109 | - <ul class="dropdown-menu pull-right"> | |
| 110 | - <?php echo wp_kses_post( $changelog_msg ); ?> | |
| 111 | - </ul> | |
| 112 | - </div> | |
| 113 | - <!-- Single button --> | |
| 114 | - <div class="btn-group"> | |
| 115 | - <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
| 116 | - <span class="glyphicon glyphicon-bell" aria-hidden="true"></span> <span class="caret"></span> | |
| 117 | - </button> | |
| 118 | - <ul class="dropdown-menu pull-right list-group"> | |
| 119 | - <li class="list-group-item "><?php echo wp_kses_post( $alert ); ?></li> | |
| 120 | - <?php if ( ! empty( $changelog ) ) { ?> | |
| 121 | - <li class="list-group-item "><?php echo wp_kses_post( $changelog ); ?></li> | |
| 122 | -<?php } ?> | |
| 123 | - </ul> | |
| 124 | - </div> | |
| 125 | - | |
| 126 | - <!-- Single button Setting--> | |
| 127 | - <div class="btn-group"> | |
| 128 | - <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
| 129 | - <span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> <span class="caret"></span> | |
| 130 | - </button> | |
| 131 | - <ul class="dropdown-menu pull-right"> | |
| 132 | - | |
| 133 | - <li role="separator" class="divider"></li> | |
| 134 | - <li> | |
| 135 | - <a href="#" > | |
| 136 | - <p><?php esc_attr_e( 'Schedule :', 'wpdbbkp' ); ?> | |
| 137 | - <?php | |
| 138 | - $settings = get_option( 'wp_db_backup_options' ); | |
| 139 | - if ( isset( $settings['enable_autobackups'] ) && '1' === $settings['enable_autobackups'] ) { | |
| 140 | - esc_attr_e( 'Enabled -', 'wpdbbkp' ); | |
| 141 | - $autobackup_frequency = ucfirst( $settings['autobackup_frequency'] ); | |
| 142 | - echo esc_attr( $autobackup_frequency ); | |
| 143 | - } else { | |
| 144 | - esc_attr_e( 'Disabled', 'wpdbbkp' ); | |
| 145 | - } | |
| 146 | - ?> | |
| 147 | - </p> | |
| 148 | - </a> | |
| 149 | - </li> | |
| 150 | - <li role="separator" class="divider"></li> | |
| 151 | - <li > | |
| 152 | - <a href="#" > | |
| 153 | - <p><?php esc_attr_e( 'Exclude Tables :', 'wpdbbkp' ); ?></p> | |
| 154 | - <?php | |
| 155 | - $wp_db_exclude_table = array(); | |
| 156 | - $wp_db_exclude_table = (array) get_option( 'wp_db_exclude_table' ); | |
| 157 | - if ( false === empty( $wp_db_exclude_table ) ) { | |
| 158 | - echo wp_kses_post( implode( ',<br> ', $wp_db_exclude_table ) ); | |
| 159 | - } | |
| 160 | - ?> | |
| 161 | - </p> | |
| 162 | - | |
| 163 | - </a> | |
| 164 | - </li> | |
| 165 | - <li role="separator" class="divider"></li> | |
| 166 | - <li><a href="#"> | |
| 167 | - <a href="#" > | |
| 168 | - <p><?php esc_attr_e( 'Keep No of backup :', 'wpdbbkp' ); ?> | |
| 169 | - <?php | |
| 170 | - if ( 0 === (int) get_option( 'wp_local_db_backup_count' ) ) { | |
| 171 | - esc_attr_e( 'Unlimited', 'wpdbbkp' ); | |
| 172 | - } else { | |
| 173 | - echo esc_attr( get_option( 'wp_local_db_backup_count' ) ); | |
| 174 | - } | |
| 175 | - ?> | |
| 176 | - </p> | |
| 177 | - </a> | |
| 178 | - </a> | |
| 179 | - </li> | |
| 180 | - <li role="separator" class="divider"></li> | |
| 181 | - <li> | |
| 182 | - <a href="#" > | |
| 183 | - <p><?php esc_attr_e( 'Backup Log :', 'wpdbbkp' ); ?> | |
| 184 | - <?php | |
| 185 | - if ( 1 === (int) get_option( 'wp_db_log' ) ) { | |
| 186 | - esc_attr_e( 'Enabled', 'wpdbbkp' ); | |
| 187 | - } else { | |
| 188 | - esc_attr_e( 'Disabled', 'wpdbbkp' ); | |
| 189 | - } | |
| 190 | - ?> | |
| 191 | - </p> | |
| 192 | - </a> | |
| 193 | - </li> | |
| 194 | - <li role="separator" class="divider"></li> | |
| 195 | - <li> | |
| 196 | - <a href="#db_setting" data-toggle="tab" title="<?php esc_attr_e( 'Change Setting', 'wpdbbkp' ); ?>"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> <?php esc_attr_e( 'Change Setting', 'wpdbbkp' ); ?></a> | |
| 197 | - </li> | |
| 198 | - </ul> | |
| 199 | - </div> | |
| 200 | - | |
| 201 | - <!-- Single button Author--> | |
| 202 | - <div class="btn-group"> | |
| 203 | - <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
| 204 | - <span class="glyphicon glyphicon-user" aria-hidden="true"></span> <span class="caret"></span> | |
| 205 | - </button> | |
| 206 | - <ul class="dropdown-menu pull-right"> | |
| 207 | - <li> | |
| 208 | - <a href="http://walkeprashant.in" target="_blank" > | |
| 209 | - <h5 ><?php esc_attr_e( 'Plugin Author', 'wpdbbkp' ); ?></h5> | |
| 210 | - <p><?php esc_attr_e( 'Prashant Walke', 'wpdbbkp' ); ?></p> | |
| 211 | - <p><?php esc_attr_e( '(Sr. PHP Developer)', 'wpdbbkp' ); ?></p> | |
| 212 | - </a> | |
| 213 | - </li> | |
| 214 | - <li role="separator" class="divider"></li> | |
| 215 | - <li > | |
| 216 | - <a href="http://www.wpseeds.com/wp-database-backup/" target="_blank" > | |
| 217 | - <h5 ><?php esc_attr_e( 'Plugin URL', 'wpdbbkp' ); ?></h5> | |
| 218 | - </a> | |
| 219 | - </li> | |
| 220 | - <li > | |
| 221 | - <a href="http://www.wpseeds.com/blog/category/update/wp-database-backup/" target="_blank" > | |
| 222 | - <h5 ><?php esc_attr_e( 'Change Log', 'wpdbbkp' ); ?> </h5> | |
| 223 | - </a> | |
| 224 | - </li> | |
| 225 | - <li > | |
| 226 | - <a href="https://www.wpseeds.com/documentation/docs/wp-database-backup/" target="_blank" > | |
| 227 | - <h5 ><?php esc_attr_e( 'Documentation', 'wpdbbkp' ); ?></h5> | |
| 228 | - </a> | |
| 229 | - </li> | |
| 230 | - <li > | |
| 231 | - <a href="https://www.wpseeds.com/support/" target="_blank" > | |
| 232 | - <h5 ><?php esc_attr_e( 'Support', 'wpdbbkp' ); ?></h5> | |
| 233 | - </a> | |
| 234 | - </li> | |
| 235 | - </ul> | |
| 236 | - </div> | |
| 237 | - | |
| 238 | - </div> | |
| 239 | -</div> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Show header notification in dashboard | |
| 4 | + * | |
| 5 | + * @package wpdbbkp | |
| 6 | + */ | |
| 7 | + | |
| 8 | +if (!defined('ABSPATH')) { | |
| 9 | + exit; | |
| 10 | +} // Exit if accessed directly | |
| 11 | +$wpdbbkp_bg_notify = get_option('wpdbbkp_dashboard_notify',false); | |
| 12 | +if (true === isset($_GET['notification']) && true === isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'wp-database-backup') || $wpdbbkp_bg_notify) { ?> | |
| 13 | + | |
| 14 | + <div class="text-center wpdbbkp_notification"><img width="50" height="50" src="<?php echo esc_url(WPDB_PLUGIN_URL. "/assets/images/success.png"); ?>"> | |
| 15 | + <h4 class="text-success"><?php if ('create' === $_GET['notification'] || $wpdbbkp_bg_notify=='create') { | |
| 16 | + $backup_list = get_option('wp_db_backup_backups'); | |
| 17 | + $download_backup = end($backup_list); | |
| 18 | + if($download_backup && !empty($download_backup)) | |
| 19 | + { $backup_link = '<a href="' . esc_url($download_backup['url']) . '" style="color: #21759B;">' . __('Click Here to Download Backup.', 'wpdbbkp') . '</a>';} | |
| 20 | + update_option('wpdbbkp_dashboard_notify',false); | |
| 21 | + esc_html_e('Backup Created Successfully. ', 'wpdbbkp'); | |
| 22 | + } elseif ('restore' === $_GET['notification']) { | |
| 23 | + esc_html_e('Backup Restore Successfully', 'wpdbbkp'); | |
| 24 | + } elseif ('restore_limit' === $_GET['notification']) { | |
| 25 | + esc_html_e('Restore Limit for Backup reached. Please update to PRO to remove this limit', 'wpdbbkp'); | |
| 26 | + }elseif ('delete' === $_GET['notification']) { | |
| 27 | + esc_html_e('Backup deleted Successfully', 'wpdbbkp'); | |
| 28 | + }elseif ('deleteall' === $_GET['notification']) { | |
| 29 | + esc_html_e('All Backup data is deleted Successfully', 'wpdbbkp'); | |
| 30 | + } elseif ('clear_temp_db_backup_file' === $_GET['notification']) { | |
| 31 | + esc_html_e('Clear all old/temp database backup files Successfully', 'wpdbbkp'); | |
| 32 | + } elseif ('Invalid' === $_GET['notification']) { | |
| 33 | + esc_html_e('Invalid Access!!!!', 'wpdbbkp'); | |
| 34 | + } elseif ('deleteauth' === $_GET['notification']) { | |
| 35 | + esc_html_e('Dropbox account unlink Successfully', 'wpdbbkp'); | |
| 36 | + } elseif ('save' === $_GET['notification']) { | |
| 37 | + esc_html_e('Backup Setting Saved Successfully', 'wpdbbkp'); | |
| 38 | + } | |
| 39 | + ?></h4> | |
| 40 | + <?php if ('create' === $_GET['notification']) { ?> | |
| 41 | + <h5 class="text-success"><strong><?php echo wp_kses_post($backup_link); ?> </strong></h5> | |
| 42 | + <?php } ?> | |
| 43 | + </div> | |
| 44 | +<?php } ?> | |
| 45 | + | |
| 46 | +<div id="wpdb-backup-process" style="display:none"> | |
| 47 | + <div class="text-center"><img width="50" height="50" src="<?php echo esc_url(WPDB_PLUGIN_URL . "/assets/images/icon_loading.gif"); ?>"> | |
| 48 | + <h5 class="text-success"><strong><?php echo esc_html__('Backup process is working in background, it may take some time depending on size of your | |
| 49 | + website. You can close this tab if you want', 'wpdbbkp') ?></strong></h5> | |
| 50 | + <div class="progress"> | |
| 51 | + <div id="wpdbbkp_progressbar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" | |
| 52 | + style="width:0%"> | |
| 53 | + 0% | |
| 54 | + </div> | |
| 55 | + </div> | |
| 56 | + <h4 class="text-success" id="wpdbbkup_process_stats"><?php echo esc_html__('Processing...', 'wpdbbkp') ?></h4> | |
| 57 | + </div> | |
| 58 | +</div> | |
| 59 | + | |
| 60 | +<div id="backup_process" style="display:none"> | |
| 61 | + <div class="text-center"><img width="50" height="50" src="<?php echo esc_url(WPDB_PLUGIN_URL . "/assets/images/icon_loading.gif"); ?>"> | |
| 62 | + <h4 class="text-success" id="wpdbbkup_process_stats"><?php echo esc_html__('Creating Database Backup...', 'wpdbbkp') ?></h4> | |
| 63 | + <h5 class="text-success"><strong><?php echo esc_html__('It may take some time depending on size of your | |
| 64 | + Database. Do not close this window.', 'wpdbbkp') ?></strong></h5> | |
| 65 | + </div> | |
| 66 | +</div> | |