PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / 1.8.4
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin v1.8.4
trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 All 71 releases
pdf-print / bws_menu / bws_functions.php

bws_functions.php in PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin 1.8.4, at bws_menu/bws_functions.php

808 lines 41.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * General functions for BestWebSoft plugins
4 * Version: 1.1.1
5 */
6 if ( ! function_exists ( 'bws_add_general_menu' ) ) {
7 function bws_add_general_menu( $base ) {
8 global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_added_menu;
9 $bws_menu_info = get_plugin_data( dirname( dirname( plugin_dir_path( __FILE__ ) ) ) . '/' . dirname( $base ) . '/bws_menu/bws_menu.php' );
10 $bws_menu_version = $bws_menu_info["Version"];
11
12 if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
13 if ( is_multisite() ) {
14 if ( ! get_site_option( 'bstwbsftwppdtplgns_options' ) )
15 add_site_option( 'bstwbsftwppdtplgns_options', array() );
16 $bstwbsftwppdtplgns_options = get_site_option( 'bstwbsftwppdtplgns_options' );
17 } else {
18 if ( ! get_option( 'bstwbsftwppdtplgns_options' ) )
19 add_option( 'bstwbsftwppdtplgns_options', array() );
20 $bstwbsftwppdtplgns_options = get_option( 'bstwbsftwppdtplgns_options' );
21 }
22 }
23
24 if ( isset( $bstwbsftwppdtplgns_options['bws_menu_version'] ) ) {
25 $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version;
26 unset( $bstwbsftwppdtplgns_options['bws_menu_version'] );
27 if ( is_multisite() )
28 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
29 else
30 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
31 require_once( dirname( __FILE__ ) . '/bws_menu.php' );
32 } else if ( ! isset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] ) || $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] < $bws_menu_version ) {
33 $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version;
34 if ( is_multisite() )
35 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
36 else
37 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
38 require_once( dirname( __FILE__ ) . '/bws_menu.php' );
39 } else if ( ! isset( $bstwbsftwppdtplgns_added_menu ) ) {
40 $all_plugins = get_plugins();
41 foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value ) {
42 if ( array_key_exists( $key, $all_plugins ) ) {
43 if ( $bws_menu_version < $value && is_plugin_active( $base ) ) {
44 if ( ! isset( $plugin_with_newer_menu ) )
45 $plugin_with_newer_menu = $key;
46 elseif ( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $plugin_with_newer_menu ] < $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] )
47 $plugin_with_newer_menu = $key;
48 }
49 } else {
50 unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] );
51 if ( is_multisite() )
52 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
53 else
54 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
55 }
56 }
57 if ( ! isset( $plugin_with_newer_menu ) )
58 $plugin_with_newer_menu = $base;
59 $plugin_with_newer_menu = explode( '/', $plugin_with_newer_menu );
60 $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? basename( WP_CONTENT_DIR ) : 'wp-content';
61
62 if ( file_exists( ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php' ) )
63 require_once( ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php' );
64 else
65 require_once( dirname( __FILE__ ) . '/bws_menu.php' );
66 $bstwbsftwppdtplgns_added_menu = true;
67 }
68 add_menu_page( 'BWS Plugins', 'BWS Plugins', 'manage_options', 'bws_plugins', 'bws_add_menu_render', plugins_url( 'images/px.png', __FILE__ ), 1001 );
69 }
70 }
71
72
73 /**
74 * Function check if plugin is compatible with current WP version
75 * @return void
76 */
77 if ( ! function_exists ( 'bws_wp_version_check' ) ) {
78 function bws_wp_version_check( $plugin_basename, $plugin_info, $require_wp ) {
79 global $wp_version;
80 if ( version_compare( $wp_version, $require_wp, "<" ) ) {
81 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
82 if ( is_plugin_active( $plugin_basename ) ) {
83 deactivate_plugins( $plugin_basename );
84 $admin_url = ( function_exists( 'get_admin_url' ) ) ? get_admin_url( null, 'plugins.php' ) : esc_url( '/wp-admin/plugins.php' );
85 wp_die(
86 sprintf(
87 "<strong>%s</strong> %s <strong>WordPress %s</strong> %s <br /><br />%s <a href='%s'>%s</a>.",
88 $plugin_info['Name'],
89 __( 'requires', 'bestwebsoft' ),
90 $require_wp,
91 __( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'bestwebsoft' ),
92 __( 'Back to the WordPress', 'bestwebsoft' ),
93 $admin_url,
94 __( 'Plugins page', 'bestwebsoft' )
95 )
96 );
97 }
98 }
99 }
100 }
101
102 if ( ! function_exists( 'bws_plugin_banner' ) ) {
103 function bws_plugin_banner( $plugin_info, $this_banner_prefix, $link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
104 global $wp_version, $bstwbsftwppdtplgns_cookie_add, $bstwbsftwppdtplgns_banner_array;
105
106 if ( empty( $bstwbsftwppdtplgns_banner_array ) ) {
107 if ( ! function_exists( 'bws_get_banner_array' ) )
108 require_once( dirname( __FILE__ ) . '/bws_menu.php' );
109 bws_get_banner_array();
110 }
111
112 if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
113 $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-128x128.png';
114 }
115
116 if ( ! function_exists( 'is_plugin_active' ) )
117 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
118
119 $all_plugins = get_plugins();
120
121 $this_banner = $this_banner_prefix . '_hide_banner_on_plugin_page';
122 foreach ( $bstwbsftwppdtplgns_banner_array as $key => $value ) {
123 if ( $this_banner == $value[0] ) {
124 if ( ! isset( $bstwbsftwppdtplgns_cookie_add ) ) {
125 echo '<script type="text/javascript" src="' . plugins_url( 'js/c_o_o_k_i_e.js', __FILE__ ) . '"></script>';
126 $bstwbsftwppdtplgns_cookie_add = true;
127 } ?>
128 <script type="text/javascript">
129 (function($) {
130 $(document).ready( function() {
131 var hide_message = $.cookie( '<?php echo $this_banner_prefix; ?>_hide_banner_on_plugin_page' );
132 if ( hide_message == "true" ) {
133 $( ".<?php echo $this_banner_prefix; ?>_message" ).css( "display", "none" );
134 } else {
135 $( ".<?php echo $this_banner_prefix; ?>_message" ).css( "display", "block" );
136 };
137 $( ".<?php echo $this_banner_prefix; ?>_close_icon" ).click( function() {
138 $( ".<?php echo $this_banner_prefix; ?>_message" ).css( "display", "none" );
139 $.cookie( "<?php echo $this_banner_prefix; ?>_hide_banner_on_plugin_page", "true", { expires: 32 } );
140 });
141 });
142 })(jQuery);
143 </script>
144 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
145 <div class="<?php echo $this_banner_prefix; ?>_message bws_banner_on_plugin_page" style="display: none;">
146 <img class="<?php echo $this_banner_prefix; ?>_close_icon close_icon" title="" src="<?php echo plugins_url( 'images/close_banner.png', __FILE__ ); ?>" alt=""/>
147 <div class="icon">
148 <img title="" src="<?php echo esc_attr( $banner_url_or_slug ); ?>" alt="" />
149 </div>
150 <div class="text"><?php
151 _e( 'It’s time to upgrade your', 'bestwebsoft' ); ?> <strong><?php echo $plugin_info['Name']; ?> plugin</strong> <?php _e( 'to', 'bestwebsoft' ); ?> <strong>PRO</strong> <?php _e( 'version!', 'bestwebsoft' ); ?><br />
152 <span><?php _e( 'Extend standard plugin functionality with new great options.', 'bestwebsoft' ); ?></span>
153 </div>
154 <div class="button_div">
155 <a class="button" target="_blank" href="http://bestwebsoft.com/products/<?php echo $link_slug; ?>/?k=<?php echo $link_key; ?>&amp;pn=<?php echo $link_pn; ?>&amp;v=<?php echo $plugin_info["Version"]; ?>&amp;wp_v=<?php echo $wp_version; ?>"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a>
156 </div>
157 </div>
158 </div>
159 <?php break;
160 }
161 if ( isset( $all_plugins[ $value[1] ] ) && $all_plugins[ $value[1] ]["Version"] >= $value[2] && is_plugin_active( $value[1] ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
162 break;
163 }
164 }
165 }
166 }
167
168 if ( ! function_exists( 'bws_plugin_reviews_block' ) ) {
169 function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?>
170 <div class="bws-plugin-reviews">
171 <div class="bws-plugin-reviews-rate">
172 <?php _e( 'If you enjoy our plugin, please give it 5 stars on WordPress', 'bestwebsoft' ); ?>:
173 <a href="http://wordpress.org/support/view/plugin-reviews/<?php echo $plugin_slug; ?>" target="_blank" title="<?php echo $plugin_name; ?> reviews"><?php _e( 'Rate the plugin', 'bestwebsoft' ); ?></a>
174 </div>
175 <div class="bws-plugin-reviews-support">
176 <?php _e( 'If there is something wrong about it, please contact us', 'bestwebsoft' ); ?>:
177 <a href="http://support.bestwebsoft.com">http://support.bestwebsoft.com</a>
178 </div>
179 </div>
180 <?php }
181 }
182
183 if ( ! function_exists( 'bws_go_pro_tab_check' ) ) {
184 function bws_go_pro_tab_check( $plugin_basename ) {
185 global $wp_version, $bstwbsftwppdtplgns_options;
186 $result = array();
187
188 $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? stripslashes( esc_html( trim( $_POST['bws_license_key'] ) ) ) : "";
189
190 if ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( $plugin_basename, 'bws_license_nonce_name' ) ) {
191 if ( '' != $bws_license_key ) {
192 if ( strlen( $bws_license_key ) != 18 ) {
193 $result['error'] = __( "Wrong license key", 'bestwebsoft' );
194 } else {
195 $bws_license_plugin = stripslashes( esc_html( $_POST['bws_license_plugin'] ) );
196 if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - (24 * 60 * 60) ) ) {
197 $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
198 } else {
199 $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
200 $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time();
201 }
202
203 /* download Pro */
204 if ( ! function_exists( 'get_plugins' ) )
205 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
206
207 $all_plugins = get_plugins();
208
209 if ( ! array_key_exists( $bws_license_plugin, $all_plugins ) ) {
210 $current = get_site_transient( 'update_plugins' );
211 if ( is_array( $all_plugins ) && !empty( $all_plugins ) && isset( $current ) && is_array( $current->response ) ) {
212 $to_send = array();
213 $to_send["plugins"][ $bws_license_plugin ] = array();
214 $to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key;
215 $to_send["plugins"][ $bws_license_plugin ]["bws_illegal_client"] = true;
216 $options = array(
217 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
218 'body' => array( 'plugins' => serialize( $to_send ) ),
219 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
220 $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options );
221
222 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
223 $result['error'] = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ' <a href="http://support.bestwebsoft.com">BestWebSoft</a>. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' );
224 } else {
225 $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
226 if ( is_array( $response ) && !empty( $response ) ) {
227 foreach ( $response as $key => $value ) {
228 if ( "wrong_license_key" == $value->package ) {
229 $result['error'] = __( "Wrong license key", 'bestwebsoft' );
230 } elseif ( "wrong_domain" == $value->package ) {
231 $result['error'] = __( "This license key is bind to another site", 'bestwebsoft' );
232 } elseif ( "you_are_banned" == $value->package ) {
233 $result['error'] = __( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' );
234 } elseif ( "time_out" == $value->package ) {
235 $result['error'] = __( "Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates you should extend it in your", 'bestwebsoft' ) . ' <a href="http://bestwebsoft.com/wp-admin/admin.php?page=bws_plugins_client_area">Client area</a>';
236 } elseif ( "duplicate_domen_for_trial" == $value->package ) {
237 $result['error'] = __( "Unfortunately, the PRO licence was already installed to this domain. The PRO Trial license can be installed only once.", 'bestwebsoft' );
238 }
239 }
240 if ( empty( $result['error'] ) ) {
241 $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
242
243 $url = 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/downloads/?bws_first_download=' . $bws_license_plugin . '&bws_license_key=' . $bws_license_key . '&download_from=5';
244 $uploadDir = wp_upload_dir();
245 $zip_name = explode( '/', $bws_license_plugin );
246
247 if ( !function_exists( 'curl_init' ) ) {
248 $received_content = file_get_contents( $url );
249 } else {
250 $ch = curl_init();
251 curl_setopt( $ch, CURLOPT_URL, $url );
252 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
253 $received_content = curl_exec( $ch );
254 curl_close( $ch );
255 }
256
257 if ( ! $received_content ) {
258 $result['error'] = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
259 } else {
260 if ( is_writable( $uploadDir["path"] ) ) {
261 $file_put_contents = $uploadDir["path"] . "/" . $zip_name[0] . ".zip";
262 if ( file_put_contents( $file_put_contents, $received_content ) ) {
263 @chmod( $file_put_contents, octdec( 755 ) );
264 if ( class_exists( 'ZipArchive' ) ) {
265 $zip = new ZipArchive();
266 if ( $zip->open( $file_put_contents ) === TRUE ) {
267 $zip->extractTo( WP_PLUGIN_DIR );
268 $zip->close();
269 } else {
270 $result['error'] = __( "Failed to open the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
271 }
272 } elseif ( class_exists( 'Phar' ) ) {
273 $phar = new PharData( $file_put_contents );
274 $phar->extractTo( WP_PLUGIN_DIR );
275 } else {
276 $result['error'] = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually", 'bestwebsoft' );
277 }
278 @unlink( $file_put_contents );
279 } else {
280 $result['error'] = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
281 }
282 } else {
283 $result['error'] = __( "UploadDir is not writable. Please, upload the plugin manually", 'bestwebsoft' );
284 }
285 }
286
287 /* activate Pro */
288 if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) {
289 if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
290 /* if multisite and free plugin is network activated */
291 $active_plugins = get_site_option( 'active_sitewide_plugins' );
292 $active_plugins[ $bws_license_plugin ] = time();
293 update_site_option( 'active_sitewide_plugins', $active_plugins );
294 } else {
295 /* activate on a single blog */
296 $active_plugins = get_option( 'active_plugins' );
297 array_push( $active_plugins, $bws_license_plugin );
298 update_option( 'active_plugins', $active_plugins );
299 }
300 $result['pro_plugin_is_activated'] = true;
301 } elseif ( empty( $result['error'] ) ) {
302 $result['error'] = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
303 }
304 }
305 } else {
306 $result['error'] = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' );
307 }
308 }
309 }
310 } else {
311 $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
312 /* activate Pro */
313 if ( ! is_plugin_active( $bws_license_plugin ) ) {
314 if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
315 /* if multisite and free plugin is network activated */
316 $network_wide = true;
317 } else {
318 /* activate on a single blog */
319 $network_wide = false;
320 }
321 activate_plugin( $bws_license_plugin, NULL, $network_wide );
322 $result['pro_plugin_is_activated'] = true;
323 }
324 }
325 if ( is_multisite() )
326 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
327 else
328 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
329 }
330 } else {
331 $result['error'] = __( "Please, enter Your license key", 'bestwebsoft' );
332 }
333 }
334 return $result;
335 }
336 }
337
338 if ( ! function_exists( 'bws_go_pro_tab' ) ) {
339 function bws_go_pro_tab( $plugin_info, $plugin_basename, $page, $pro_page, $bws_license_plugin, $link_slug, $link_key, $link_pn, $pro_plugin_is_activated = false, $trial_days_number = false ) {
340 global $wp_version, $bstwbsftwppdtplgns_options;
341 $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? stripslashes( esc_html( trim( $_POST['bws_license_key'] ) ) ) : "";
342 if ( $pro_plugin_is_activated ) { ?>
343 <script type="text/javascript">
344 window.setTimeout( function() {
345 window.location.href = 'admin.php?page=<?php echo $pro_page; ?>';
346 }, 5000 );
347 </script>
348 <p><?php _e( "Congratulations! The PRO version of the plugin is successfully download and activated.", 'bestwebsoft' ); ?></p>
349 <p>
350 <?php _e( "Please, go to", 'bestwebsoft' ); ?> <a href="admin.php?page=<?php echo $pro_page; ?>"><?php _e( 'the setting page', 'bestwebsoft' ); ?></a>
351 (<?php _e( "You will be redirected automatically in 5 seconds.", 'bestwebsoft' ); ?>)
352 </p>
353 <?php } else { ?>
354 <form method="post" action="admin.php?page=<?php echo $page; ?>&amp;action=go_pro">
355 <p>
356 <?php _e( 'You can download and activate', 'bestwebsoft' ); ?>
357 <a href="http://bestwebsoft.com/products/<?php echo $link_slug; ?>/?k=<?php echo $link_key; ?>&amp;pn=<?php echo $link_pn; ?>&amp;v=<?php echo $plugin_info["Version"]; ?>&amp;wp_v=<?php echo $wp_version; ?>" target="_blank" title="<?php echo $plugin_info["Name"]; ?> Pro">PRO</a>
358 <?php _e( 'version of this plugin by entering Your license key.', 'bestwebsoft' ); ?><br />
359 <span class="bws_info">
360 <?php _e( 'You can find your license key on your personal page Client area, by clicking on the link', 'bestwebsoft' ); ?>
361 <a href="http://bestwebsoft.com/wp-login.php">http://bestwebsoft.com/wp-login.php</a>
362 <?php _e( '(your username is the email you specify when purchasing the product).', 'bestwebsoft' ); ?>
363 </span>
364 </p>
365 <?php if ( $trial_days_number !== false )
366 $trial_days_number = __( 'or', 'bestwebsoft' ) . ' <a href="http://bestwebsoft.com/products/' . $link_slug . '/trial/" target="_blank">' . sprintf( __( 'Start Your Free %s-Day Trial Now', 'bestwebsoft' ), $trial_days_number ) . '</a>';
367 if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
368 '5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
369 $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
370 <p>
371 <input disabled="disabled" type="text" name="bws_license_key" value="<?php echo $bws_license_key; ?>" />
372 <input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
373 <?php if ( $trial_days_number !== false ) echo $trial_days_number; ?>
374 </p>
375 <p><?php _e( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' ); ?></p>
376 <?php } else { ?>
377 <p>
378 <input type="text" maxlength="100" name="bws_license_key" value="<?php echo $bws_license_key; ?>" />
379 <input type="hidden" name="bws_license_plugin" value="<?php echo $bws_license_plugin; ?>" />
380 <input type="hidden" name="bws_license_submit" value="submit" />
381 <input type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
382 <?php if ( $trial_days_number !== false ) echo $trial_days_number;
383 wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
384 </p>
385 <?php } ?>
386 </form>
387 <?php }
388 }
389 }
390
391 if ( ! function_exists( 'bws_go_pro_from_trial_tab' ) ) {
392 function bws_go_pro_from_trial_tab( $plugin_info, $plugin_basename, $page, $link_slug, $link_key, $link_pn, $trial_license_is_set = true ) {
393 global $wp_version, $bstwbsftwppdtplgns_options;
394 $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? stripslashes( esc_html( trim( $_POST['bws_license_key'] ) ) ) : "";
395 if ( $trial_license_is_set ) { ?>
396 <form method="post" action="admin.php?page=<?php echo $page; ?>&amp;action=go_pro">
397 <p>
398 <?php echo sprintf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), '<a href="http://bestwebsoft.com/products/' . $link_slug . '/?k=' . $link_key . '&amp;pn=' . $link_pn . '&amp;v=' . $plugin_info["Version"] . '&amp;wp_v=' . $wp_version .'" target="_blank" title="' . $plugin_info["Name"] . '">PRO</a>' ) . ' ';
399 _e( 'After that you can activate it by entering your license key.', 'bestwebsoft' ); ?><br />
400 <span class="bws_info">
401 <?php _e( 'You can find your license key on your personal page Client area, by clicking on the link', 'bestwebsoft' ); ?>
402 <a href="http://bestwebsoft.com/wp-login.php">http://bestwebsoft.com/wp-login.php</a>
403 <?php _e( '(your username is the email you specify when purchasing the product).', 'bestwebsoft' ); ?>
404 </span>
405 </p>
406 <?php if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['count'] ) &&
407 '5' < $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['count'] &&
408 $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
409 <p>
410 <input disabled="disabled" type="text" name="bws_license_key" value="" />
411 <input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
412 </p>
413 <p><?php _e( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' ); ?></p>
414 <?php } else { ?>
415 <p>
416 <input type="text" maxlength="100" name="bws_license_key" value="" />
417 <input type="hidden" name="bws_license_plugin" value="<?php echo $plugin_basename; ?>" />
418 <input type="hidden" name="bws_license_submit" value="submit" />
419 <input type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
420 <?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
421 </p>
422 <?php } ?>
423 </form>
424 <?php } else { ?>
425 <script type="text/javascript">
426 window.setTimeout( function() {
427 window.location.href = 'admin.php?page=<?php echo $page; ?>';
428 }, 5000 );
429 </script>
430 <p><?php _e( "Congratulations! The PRO license of the plugin is successfully activated.", 'bestwebsoft' ); ?></p>
431 <p>
432 <?php _e( "Please, go to", 'bestwebsoft' ); ?> <a href="admin.php?page=<?php echo $page; ?>"><?php _e( 'the setting page', 'bestwebsoft' ); ?></a>
433 (<?php _e( "You will be redirected automatically in 5 seconds.", 'bestwebsoft' ); ?>)
434 </p>
435 <?php }
436 }
437 }
438
439 if ( ! function_exists( 'bws_check_pro_license' ) ) {
440 function bws_check_pro_license( $plugin_basename, $trial_plugin = false ) {
441 global $wp_version, $bstwbsftwppdtplgns_options;
442 $result = array();
443
444 if ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( $plugin_basename, 'bws_license_nonce_name' ) ) {
445 $license_key = isset( $_POST['bws_license_key'] ) ? stripslashes( esc_html( trim( $_POST['bws_license_key'] ) ) ) : '';
446
447 if ( '' != $license_key ) {
448 if ( ! function_exists( 'get_plugins' ) )
449 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
450 $plugins_all = get_plugins();
451 $current = get_site_transient( 'update_plugins' );
452
453 if ( is_array( $plugins_all ) && !empty( $plugins_all ) && isset( $current ) && is_array( $current->response ) ) {
454 $to_send = array();
455 $to_send["plugins"][ $plugin_basename ] = $plugins_all[ $plugin_basename ];
456 $to_send["plugins"][ $plugin_basename ]["bws_license_key"] = $license_key;
457 $to_send["plugins"][ $plugin_basename ]["bws_illegal_client"] = true;
458 $options = array(
459 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
460 'body' => array( 'plugins' => serialize( $to_send ) ),
461 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
462 );
463 $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options );
464 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
465 $result['error'] = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ' <a href=http://support.bestwebsoft.com>BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
466 } else {
467 $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
468 if ( is_array( $response ) && !empty( $response ) ) {
469 foreach ( $response as $key => $value ) {
470 if ( "wrong_license_key" == $value->package ) {
471 $result['error'] = __( 'Wrong license key.', 'bestwebsoft' );
472 } else if ( "wrong_domain" == $value->package ) {
473 $result['error'] = __( 'This license key is bind to another site.', 'bestwebsoft' );
474 } else if ( "time_out" == $value->package ) {
475 $result['message'] = __( 'This license key is valid, but Your license has expired. If you want to update our plugin in future, you should extend the license.', 'bestwebsoft' );
476 } elseif ( "you_are_banned" == $value->package ) {
477 $result['error'] = __( "Unfortunately, you have exceeded the number of available tries.", 'bestwebsoft' );
478 } elseif ( "duplicate_domen_for_trial" == $value->package ) {
479 $result['error'] = __( "Unfortunately, the PRO Trial licence was already installed to this domain. The PRO Trial license can be installed only once.", 'bestwebsoft' );
480 }
481 if ( empty( $result['message'] ) && empty( $result['error'] ) ) {
482 if ( isset( $value->trial ) )
483 $result['message'] = __( 'The PRO Trial license key is valid.', 'bestwebsoft' );
484 else
485 $result['message'] = __( 'The license key is valid.', 'bestwebsoft' );
486
487 if ( isset( $value->time_out ) && $value->time_out != '' )
488 $result['message'] .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $value->time_out . '.';
489
490 if ( isset( $value->trial ) && $trial_plugin != false )
491 $result['message'] .= ' ' . sprintf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), '<a href="http://bestwebsoft.com/products/' . $trial_plugin['link_slug'] . '/?k=' . $trial_plugin['link_key'] . '&pn=' . $trial_plugin['link_pn'] . '&v=' . $trial_plugin['plugin_info']['Version'] . '&wp_v=' . $wp_version . '" target="_blank" title="' . $trial_plugin['plugin_info']['Name'] . '">PRO</a>' );
492
493 if ( isset( $value->trial ) ) {
494 $bstwbsftwppdtplgns_options['trial'][ $plugin_basename ] = 1;
495 } else {
496 unset( $bstwbsftwppdtplgns_options['trial'][ $plugin_basename ] );
497 }
498 }
499 if ( empty( $result['error'] ) ) {
500 if ( $bstwbsftwppdtplgns_options[ $plugin_basename ] != $license_key ) {
501 $bstwbsftwppdtplgns_options[ $plugin_basename ] = $license_key;
502 $bstwbsftwppdtplgns_options['time_out'][ $plugin_basename ] = $value->time_out;
503 if ( is_multisite() )
504 update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
505 else
506 update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
507 $file = @fopen( dirname( dirname( __FILE__ ) ) . "/license_key.txt" , "w+" );
508 if ( $file ) {
509 @fwrite( $file, $license_key );
510 @fclose( $file );
511 }
512 }
513 }
514 }
515 } else {
516 $result['error'] = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ' <a href=http://support.bestwebsoft.com>BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
517 }
518 }
519 }
520 } else {
521 $result['error'] = __( 'Please, enter your license key', 'bestwebsoft' );
522 }
523 }
524 return $result;
525 }
526 }
527
528 if ( ! function_exists ( 'bws_check_pro_license_form' ) ) {
529 function bws_check_pro_license_form( $plugin_basename, $page ) {
530 global $bstwbsftwppdtplgns_options;
531 $license_key = ( isset( $bstwbsftwppdtplgns_options[ $plugin_basename ] ) ) ? $bstwbsftwppdtplgns_options[ $plugin_basename ] : ''; ?>
532 <div class="clear"></div>
533 <form method="post" action="admin.php?page=<?php echo $page; ?>">
534 <p><?php echo _e( 'If needed you can check if the license key is correct or reenter it in the field below. You can find your license key on your personal page - Client area - on our website', 'bestwebsoft' ) . ' <a href="http://bestwebsoft.com/wp-login.php">http://bestwebsoft.com/wp-login.php</a> ' . __( '(your username is the email you specify when purchasing the product). If necessary, please submit "Lost your password?" request.', 'bestwebsoft' ); ?></p>
535 <p>
536 <input type="text" maxlength="100" name="bws_license_key" value="<?php echo $license_key; ?>" />
537 <input type="hidden" name="bws_license_submit" value="submit" />
538 <input type="submit" class="button-primary" value="<?php _e( 'Check license key', 'bestwebsoft' ) ?>" />
539 <?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
540 </p>
541 </form>
542 <?php }
543 }
544
545 if ( ! function_exists ( 'bws_plugin_update_row' ) ) {
546 function bws_plugin_update_row( $plugin_key, $link_slug = false, $free_plugin_name = false ) {
547 global $bstwbsftwppdtplgns_options;
548 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
549 if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $plugin_key ] ) ) {
550 echo '<tr class="plugin-update-tr">
551 <td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
552 <div class="update-message" style="background-color: #FFEBE8; border-color: #CC0000;"><strong>' . __( 'WARNING: Illegal use notification', 'bestwebsoft' ) . '.</strong> ' . __( 'You can use one license of the Pro plugin for one domain only. Please check and edit your license or domain if necessary using you personal Client Area. We strongly recommend you to solve the problem within 24 hours, otherwise the Pro plugin will be deactivated.', 'bestwebsoft' ) . ' <a target="_blank" href="http://support.bestwebsoft.com/hc/en-us/articles/204240089">' . __( 'Learn More', 'bestwebsoft' ) . '</a></div>
553 </td>
554 </tr>';
555 } elseif ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( date("m/d/Y") ) ) {
556 echo '<tr class="plugin-update-tr">
557 <td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
558 <div class="update-message" style="color: #8C0000;">';
559 if ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) && $link_slug != false ) {
560 echo __( 'Notice: Your PRO Trial license has expired. To continue using the plugin you should buy a PRO license', 'bestwebsoft' ) . ' - <a href="http://bestwebsoft.com/products/' . $link_slug .'/">http://bestwebsoft.com/products/' . $link_slug . '/</a>';
561 } else {
562 echo __( 'Your license has expired. To continue getting top-priority support and plugin updates you should extend it.', 'bestwebsoft' ) . ' <a target="_new" href="http://support.bestwebsoft.com/entries/53487136">' . __( "Learn more", 'bestwebsoft' ) . '</a>';
563 }
564 echo '</div>
565 </td>
566 </tr>';
567 } elseif ( isset( $bstwbsftwppdtplgns_options['trial'][ $plugin_key ] ) ) {
568 echo '<tr class="plugin-update-tr">
569 <td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
570 <div class="update-message" style="color: #8C0000;">';
571 if ( $free_plugin_name != false ) {
572 echo sprintf( __( 'Notice: You are using the PRO Trial license of %s plugin.', 'bestwebsoft' ), $free_plugin_name );
573 } else {
574 _e( 'Notice: You are using the PRO Trial license of plugin.', 'bestwebsoft' );
575 }
576 if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) )
577 echo ' ' . __( "The PRO Trial license will expire on", 'bestwebsoft' ) . ' ' . $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] . '.';
578 echo '</div>
579 </td>
580 </tr>';
581 }
582 }
583 }
584
585 if ( ! function_exists ( 'bws_plugin_banner_timeout' ) ) {
586 function bws_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url = false ) {
587 global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_cookie_add;
588 if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( date("m/d/Y") . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( date("m/d/Y") ) ) ) {
589 if ( ! isset( $bstwbsftwppdtplgns_cookie_add ) ) {
590 echo '<script type="text/javascript" src="' . plugins_url( 'js/c_o_o_k_i_e.js', __FILE__ ) . '"></script>';
591 $bstwbsftwppdtplgns_cookie_add = true;
592 } ?>
593 <script type="text/javascript">
594 (function($) {
595 $(document).ready( function() {
596 var hide_message = $.cookie( "<?php echo $plugin_prefix; ?>_timeout_hide_banner_on_plugin_page" );
597 if ( hide_message == "true" ) {
598 $( ".<?php echo $plugin_prefix; ?>_message" ).css( "display", "none" );
599 } else {
600 $( ".<?php echo $plugin_prefix; ?>_message" ).css( "display", "block" );
601 }
602 $( ".<?php echo $plugin_prefix; ?>_close_icon" ).click( function() {
603 $( ".<?php echo $plugin_prefix; ?>_message" ).css( "display", "none" );
604 $.cookie( "<?php echo $plugin_prefix; ?>_timeout_hide_banner_on_plugin_page", "true", { expires: 30 } );
605 });
606 });
607 })(jQuery);
608 </script>
609 <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
610 <div class="<?php echo $plugin_prefix; ?>_message bws_banner_on_plugin_page" style="display:none;">
611 <img class="<?php echo $plugin_prefix; ?>_close_icon close_icon" title="" src="<?php echo plugins_url( 'images/close_banner.png', __FILE__ ); ?>" alt=""/>
612 <div class="icon">
613 <img title="" src="<?php echo $banner_url; ?>" alt="" />
614 </div>
615 <div class="text"><?php _e( "You license for", 'bestwebsoft' ); ?> <strong><?php echo $plugin_name; ?></strong> <?php echo __( "expires on", 'bestwebsoft' ) . ' ' . $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] . ' ' . __( "and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ); ?> <a target="_new" href="http://support.bestwebsoft.com/entries/53487136"><?php _e( "Learn more", 'bestwebsoft' ); ?></a></div>
616 </div>
617 </div>
618 <?php }
619 }
620 }
621
622 if ( ! function_exists ( 'bws_plugin_init' ) ) {
623 function bws_plugin_init() {
624 /* Internationalization, first(!) */
625 load_plugin_textdomain( 'bestwebsoft', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
626 }
627 }
628
629 if ( ! function_exists ( 'bws_admin_add_scripts' ) ) {
630 function bws_admin_add_scripts() {
631 global $wp_version;
632 if ( $wp_version < 3.8 )
633 wp_enqueue_style( 'bws-admin-style', plugins_url( 'css/general_style_wp_before_3.8.css', __FILE__ ) );
634 else
635 wp_enqueue_style( 'bws-admin-style', plugins_url( 'css/general_style.css', __FILE__ ) );
636
637 if ( isset( $_GET['page'] ) && $_GET['page'] == "bws_plugins" ) {
638 wp_enqueue_style( 'bws_menu_style', plugins_url( 'css/style.css', __FILE__ ) );
639 wp_enqueue_script( 'bws_menu_script', plugins_url( 'js/bws_menu.js' , __FILE__ ) );
640 if ( $wp_version >= '3.8' )
641 wp_enqueue_script( 'theme-install' );
642 elseif ( $wp_version >= '3.4' )
643 wp_enqueue_script( 'theme' );
644 }
645 }
646 }
647
648 if ( ! function_exists ( 'bws_admin_head' ) ) {
649 function bws_admin_head() {
650 if ( isset( $_GET['page'] ) && $_GET['page'] == "bws_plugins" ) { ?>
651 <noscript>
652 <style type="text/css">
653 .bws_product_button {
654 display: inline-block;
655 }
656 </style>
657 </noscript>
658 <?php }
659 }
660 }
661
662 /**
663 * Tooltip block
664 */
665 if ( ! function_exists( 'bws_add_tooltip_in_admin' ) ) {
666 function bws_add_tooltip_in_admin( $tooltip_args = array() ) {
667 new BWS_admin_tooltip( $tooltip_args );
668 }
669 }
670
671 if ( ! class_exists( 'BWS_admin_tooltip' ) ) {
672 class BWS_admin_tooltip {
673 private $tooltip_args;
674
675 public function __construct( $tooltip_args ) {
676 global $wp_version;
677 if ( 3.3 > $wp_version )
678 return;
679 /* Default arguments */
680 $tooltip_args_default = array(
681 'tooltip_id' => false,
682 'css_selector' => false,
683 'actions' => array(
684 'click' => true,
685 'onload' => false,
686 ),
687 'buttons' => array(
688 'close' => array(
689 'type' => 'dismiss',
690 'text' => __( 'Close', 'bestwebsoft' ),
691 ),
692 ),
693 'position' => array(
694 'edge' => 'top',
695 'align' => 'center',
696 'pos-left' => 0,
697 'pos-top' => 0,
698 'zindex' => 10000
699 ),
700 );
701 $tooltip_args = array_merge( $tooltip_args_default, $tooltip_args );
702 /* Check that our merged array has default values */
703 foreach ( $tooltip_args_default as $arg_key => $arg_value ) {
704 if ( is_array( $arg_value ) ) {
705 foreach ( $arg_value as $key => $value) {
706 if ( ! isset( $tooltip_args[ $arg_key ][ $key ] ) ) {
707 $tooltip_args[ $arg_key ][ $key ] = $tooltip_args_default[ $arg_key ][ $key ];
708 }
709 }
710 }
711 }
712 /* Check if tooltip is dismissed */
713 if ( true === $tooltip_args['actions']['onload'] ) {
714 if ( in_array( $tooltip_args['tooltip_id'], array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ) ) ) {
715 $tooltip_args['actions']['onload'] = false;
716 }
717 }
718 /* Check entered data */
719 if ( false === $tooltip_args['tooltip_id'] || false === $tooltip_args['css_selector'] || ( false === $tooltip_args['actions']['click'] && false === $tooltip_args['actions']['onload'] ) ) {
720 /* if not enough data to output a tooltip or both actions (click, onload) are false */
721 return;
722 } else {
723 /* check position */
724 if ( ! in_array( $tooltip_args['position']['edge'], array( 'left', 'right', 'top', 'bottom' ) ) ) {
725 $tooltip_args['position']['edge'] = 'top';
726 }
727 if ( ! in_array( $tooltip_args['position']['align'], array( 'top', 'bottom', 'left', 'right', 'center', ) ) ) {
728 $tooltip_args['position']['align'] = 'center';
729 }
730 }
731 /* fix position */
732 switch ( $tooltip_args['position']['edge'] ) {
733 case 'left':
734 case 'right':
735 switch ( $tooltip_args['position']['align'] ) {
736 case 'top':
737 case 'bottom':
738 $tooltip_args['position']['align'] = 'center';
739 break;
740 }
741 break;
742 case 'top':
743 case 'bottom':
744 if ( $tooltip_args['position']['align'] == 'left' ) {
745 $tooltip_args['position']['pos-left'] -= 65;
746 }
747 break;
748 }
749 $this->tooltip_args = $tooltip_args;
750 /* add styles and scripts */
751 wp_enqueue_style( 'wp-pointer' );
752 wp_enqueue_script( 'wp-pointer' );
753 /* add script that displays our tooltip */
754 add_action( 'admin_print_footer_scripts', array( $this, 'add_scripts' ) );
755 }
756
757 /**
758 * Display tooltip
759 */
760 public function add_scripts() {
761 global $bstwbsftwppdtplgns_tooltip_script_add;
762 if ( ! isset( $bstwbsftwppdtplgns_tooltip_script_add ) ) {
763 echo '<script type="text/javascript" src="' . plugins_url( 'js/bws_tooltip.js', __FILE__ ) . '"></script>';
764 $bstwbsftwppdtplgns_tooltip_script_add = true;
765 }
766 $tooltip_args = $this->tooltip_args; ?>
767 <script type="text/javascript">
768 (function($) {
769 $(document).ready( function() {
770 $.bwsTooltip( <?php echo json_encode( $tooltip_args ); ?> );
771 })
772 })(jQuery);
773 </script>
774 <?php }
775 }
776 }
777
778 if ( ! function_exists ( 'bws_form_restore_default_settings' ) ) {
779 function bws_form_restore_default_settings( $plugin_basename ) { ?>
780 <form method="post" action="">
781 <p><?php _e( 'Restore all plugin settings to defaults', 'bestwebsoft' ); ?></p>
782 <p>
783 <input type="submit" class="button" value="<?php _e( 'Restore settings', 'bestwebsoft' ); ?>" />
784 </p>
785 <input type="hidden" name="bws_restore_default" value="submit" />
786 <?php wp_nonce_field( $plugin_basename, 'bws_settings_nonce_name' ); ?>
787 </form>
788 <?php }
789 }
790
791 if ( ! function_exists ( 'bws_form_restore_default_confirm' ) ) {
792 function bws_form_restore_default_confirm( $plugin_basename ) { ?>
793 <div>
794 <p><?php _e( 'Are you sure you want to restore all settings by default?', 'bestwebsoft' ) ?></p>
795 <form method="post" action="">
796 <p>
797 <button class="button" name="bws_restore_confirm"><?php _e( 'Yes, restore all settings', 'bestwebsoft' ) ?></button>
798 <button class="button" name="bws_restore_deny"><?php _e( 'No, go back to the settings page', 'bestwebsoft' ) ?></button>
799 <?php wp_nonce_field( $plugin_basename, 'bws_settings_nonce_name' ); ?>
800 </p>
801 </form>
802 </div>
803 <?php }
804 }
805
806 add_action( 'admin_init', 'bws_plugin_init' );
807 add_action( 'admin_enqueue_scripts', 'bws_admin_add_scripts' );
808 add_action( 'admin_head', 'bws_admin_head' );