PluginProbe
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin / 1.5
PDF & Print by BestWebSoft – WordPress Posts and Pages PDF Generator Plugin v1.5
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
← All changes | pdf-print.php +63 -483 1.7.31.5 View file →
@@ -1,16 +1,16 @@
1 1 <?php
2 2 /*
3 3 Plugin Name: PDF & Print
4 -Plugin URI: http://bestwebsoft.com/plugin/
4 +Plugin URI: http://bestwebsoft.com/plugin/
5 5 Description: Plugin adds PDF creation and Print button on your site.
6 6 Author: BestWebSoft
7 -Version: 1.7.3
7 +Version: 1.5
8 8 Author URI: http://bestwebsoft.com/
9 9 License: GPLv2 or later
10 10 */
11 11
12 -/* © Copyright 2014 BestWebSoft ( http://support.bestwebsoft.com )
12 +/* © Copyright 2013 BestWebSoft ( http://support.bestwebsoft.com )
13 13
14 14 This program is free software; you can redistribute it and/or modify
15 15 it under the terms of the GNU General Public License, version 2, as
16 16 published by the Free Software Foundation.
@@ -24,103 +24,27 @@
24 24 along with this program; if not, write to the Free Software
25 25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 26 */
27 27
28 +require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' );
29 +
28 30 /* Add our own menu */
29 31 if ( ! function_exists( 'pdfprnt_add_pages' ) ) {
30 32 function pdfprnt_add_pages() {
31 - global $bstwbsftwppdtplgns_options, $wpmu, $bstwbsftwppdtplgns_added_menu;
32 - $bws_menu_info = get_plugin_data( plugin_dir_path( __FILE__ ) . "bws_menu/bws_menu.php" );
33 - $bws_menu_version = $bws_menu_info["Version"];
34 - $base = plugin_basename(__FILE__);
35 -
36 - if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
37 - if ( 1 == $wpmu ) {
38 - if ( ! get_site_option( 'bstwbsftwppdtplgns_options' ) )
39 - add_site_option( 'bstwbsftwppdtplgns_options', array(), '', 'yes' );
40 - $bstwbsftwppdtplgns_options = get_site_option( 'bstwbsftwppdtplgns_options' );
41 - } else {
42 - if ( ! get_option( 'bstwbsftwppdtplgns_options' ) )
43 - add_option( 'bstwbsftwppdtplgns_options', array(), '', 'yes' );
44 - $bstwbsftwppdtplgns_options = get_option( 'bstwbsftwppdtplgns_options' );
45 - }
46 - }
47 -
48 - if ( isset( $bstwbsftwppdtplgns_options['bws_menu_version'] ) ) {
49 - $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version;
50 - unset( $bstwbsftwppdtplgns_options['bws_menu_version'] );
51 - update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes' );
52 - require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' );
53 - } else if ( ! isset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] ) || $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] < $bws_menu_version ) {
54 - $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version;
55 - update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes' );
56 - require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' );
57 - } else if ( ! isset( $bstwbsftwppdtplgns_added_menu ) ) {
58 - $plugin_with_newer_menu = $base;
59 - foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value ) {
60 - if ( $bws_menu_version < $value && is_plugin_active( $base ) ) {
61 - $plugin_with_newer_menu = $key;
62 - }
63 - }
64 - $plugin_with_newer_menu = explode( '/', $plugin_with_newer_menu );
65 - $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? basename( WP_CONTENT_DIR ) : 'wp-content';
66 - if ( file_exists( ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php' ) )
67 - require_once( ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php' );
68 - else
69 - require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' );
70 - $bstwbsftwppdtplgns_added_menu = true;
71 - }
72 -
73 - add_menu_page( 'BWS Plugins', 'BWS Plugins', 'manage_options', 'bws_plugins', 'bws_add_menu_render', plugins_url( 'images/px.png', __FILE__ ), 1001 );
33 + add_menu_page( 'BWS Plugins', 'BWS Plugins', 'manage_options', 'bws_plugins', 'bws_add_menu_render', WP_CONTENT_URL . "/plugins/google-plus-one/images/px.png", 1001 );
74 34 add_submenu_page( 'bws_plugins', __( 'PDF & Print Settings', 'pdf-print' ), __( 'PDF & Print', 'pdf-print' ), 'manage_options', "pdf-print.php", 'pdfprnt_settings_page' );
75 35 }
76 36 }
77 37
78 -/* Init plugin */
79 -if ( ! function_exists ( 'pdfprnt_init' ) ) {
80 - function pdfprnt_init() {
81 - /* Internationalization, first(!) */
82 - load_plugin_textdomain( 'pdf-print', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
83 - /* Get/Register and check settings for plugin */
84 - if ( ! is_admin() || ( isset( $_GET['page'] ) && "pdf-print.php" == $_GET['page'] ) )
85 - pdfprnt_settings();
86 - }
87 -}
88 -
89 -if ( ! function_exists( 'pdfprnt_admin_init' ) ) {
90 - function pdfprnt_admin_init() {
91 - global $bws_plugin_info, $pdfprnt_plugin_info;
92 -
93 - if ( ! $pdfprnt_plugin_info )
94 - $pdfprnt_plugin_info = get_plugin_data( __FILE__ );
95 -
96 - if ( ! isset( $bws_plugin_info ) || empty( $bws_plugin_info ) )
97 - $bws_plugin_info = array( 'id' => '101', 'version' => $pdfprnt_plugin_info["Version"] );
98 - /* Function check if plugin is compatible with current WP version */
99 - pdfprnt_version_check();
100 - }
101 -}
102 -
103 38 /* Register settings for plugin */
104 39 if ( ! function_exists( 'pdfprnt_settings' ) ) {
105 40 function pdfprnt_settings() {
106 - global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $wpmu, $pdfprnt_plugin_info;
107 -
108 - if ( ! $pdfprnt_plugin_info ) {
109 - if ( ! function_exists( 'get_plugin_data' ) )
110 - require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
111 - $pdfprnt_plugin_info = get_plugin_data( __FILE__ );
112 - }
113 -
114 - /* Variable to verify performance number of once function. */
115 - $pdfprnt_output_count_buttons = 0;
41 + global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $wpmu;
42 + $pdfprnt_output_count_buttons = 0; /* Variable to verify performance number of once function. */
116 43 $pdfprnt_default_post_types = array();
117 - /* Default post types of WordPress. */
118 44 foreach ( get_post_types( array( 'public' => 1, 'show_ui' => 1, '_builtin' => true ), 'names' ) as $value )
119 - $pdfprnt_default_post_types[] = $value;
120 -
45 + $pdfprnt_default_post_types[] = $value; /* Default post types of WordPress. */
121 46 $pdfprnt_options_array_defaults = array(
122 - 'plugin_option_version' => $pdfprnt_plugin_info["Version"],
123 47 'position' => 'top-right',
124 48 'position_search_archive' => 'left',
125 49 'position_custom' => 'left',
126 50 'show_btn_print' => 1,
@@ -133,29 +57,23 @@
133 57 'tmpl_post' => 1,
134 58 'tmpl_search' => 1,
135 59 'tmpl_custom' => 1,
136 60 'tmpl_shorcode' => 1,
137 - 'use_types_posts' => $pdfprnt_default_post_types,
138 - 'show_print_window' => 0
61 + 'use_types_posts' => $pdfprnt_default_post_types
139 62 );
140 -
141 63 if ( 1 == $wpmu ) {
142 - if ( ! get_site_option( 'pdfprnt_options_array' ) )
143 - add_site_option( 'pdfprnt_options_array', $pdfprnt_options_array_defaults, '', 'yes' );
144 -
145 - $pdfprnt_options_array = get_site_option( 'pdfprnt_options_array' );
64 + if ( ! get_site_option( 'pdfprnt_options_array' ) ) {
65 + add_site_option( 'pdfprnt_options_array', $cptch_option_defaults, '', 'yes' );
66 + }
146 67 } else {
147 68 if ( ! get_option( 'pdfprnt_options_array' ) )
148 69 add_option( 'pdfprnt_options_array', $pdfprnt_options_array_defaults, '', 'yes' );
149 -
70 + }
71 + if ( 1 == $wpmu )
72 + $pdfprnt_options_array = get_site_option( 'pdfprnt_options_array' );
73 + else
150 74 $pdfprnt_options_array = get_option( 'pdfprnt_options_array' );
151 - }
152 -
153 - if ( ! isset( $pdfprnt_options_array['plugin_option_version'] ) || $pdfprnt_options_array['plugin_option_version'] != $pdfprnt_plugin_info["Version"] ) {
154 - $pdfprnt_options_array = array_merge( $pdfprnt_options_array_defaults, $pdfprnt_options_array );
155 - $pdfprnt_options_array['plugin_option_version'] = $pdfprnt_plugin_info["Version"];
156 - update_option( 'pdfprnt_options_array', $pdfprnt_options_array );
157 - }
75 + $pdfprnt_options_array = array_merge( $pdfprnt_options_array_defaults, $pdfprnt_options_array );
158 76 }
159 77 }
160 78
161 79 /* Function check if plugin is compatible with current WP version */
@@ -160,17 +78,16 @@
160 78
161 79 /* Function check if plugin is compatible with current WP version */
162 80 if ( ! function_exists ( 'pdfprnt_version_check' ) ) {
163 81 function pdfprnt_version_check() {
164 - global $wp_version, $pdfprnt_plugin_info;
165 - if ( ! $pdfprnt_plugin_info )
166 - $pdfprnt_plugin_info = get_plugin_data( __FILE__, false );
82 + global $wp_version;
83 + $plugin_data = get_plugin_data( __FILE__, false );
167 84 $require_wp = "3.0"; /* Wordpress at least requires version */
168 85 $plugin = plugin_basename( __FILE__ );
169 86 if ( version_compare( $wp_version, $require_wp, "<" ) ) {
170 87 if ( is_plugin_active( $plugin ) ) {
171 88 deactivate_plugins( $plugin );
172 - wp_die( "<strong>" . $pdfprnt_plugin_info['Name'] . " </strong> " . __( 'requires', 'pdf-print' ) . " <strong>WordPress" . $require_wp . " </strong> " . __( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'pdf-print') . "<br /><br />" . __( 'Back to the WordPress', 'pdf-print') . " <a href='" . get_admin_url( null, 'plugins.php' ) . "'>" . __( 'Plugins page', 'pdf-print') . "</a>." );
89 + wp_die( "<strong>" . $plugin_data['Name'] . " </strong> " . __( 'requires', 'pdf-print' ) . " <strong>WordPress" . $require_wp . " </strong> " . __( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'pdf-print') . "<br /><br />" . __( 'Back to the WordPress', 'pdf-print') . " <a href='" . get_admin_url( null, 'plugins.php' ) . "'>" . __( 'Plugins page', 'pdf-print') . "</a>." );
173 90 }
174 91 }
175 92 }
176 93 }
@@ -177,11 +94,9 @@
177 94
178 95 /* Add admin page */
179 96 if ( ! function_exists ( 'pdfprnt_settings_page' ) ) {
180 97 function pdfprnt_settings_page () {
181 - global $pdfprnt_options_array, $wp_version, $pdfprnt_plugin_info;
182 - $message = $error = "";
183 -
98 + global $pdfprnt_options_array;
184 99 $pdfprnt_positions_values = array(
185 100 'top-left' => __( 'Top Left', 'pdf-print' ),
186 101 'top-right' => __( 'Top Right', 'pdf-print' ),
187 102 'bottom-left' => __( 'Bottom Left', 'pdf-print' ),
@@ -186,9 +101,8 @@
186 101 'top-right' => __( 'Top Right', 'pdf-print' ),
187 102 'bottom-left' => __( 'Bottom Left', 'pdf-print' ),
188 103 'bottom-right' => __( 'Bottom Right', 'pdf-print' )
189 104 );
190 -
191 105 if ( isset( $_REQUEST['pdfprnt_position'] ) &&
192 106 isset( $_REQUEST['pdfprnt_position_search_archive'] ) &&
193 107 isset( $_REQUEST['pdfprnt_position_custom'] ) &&
194 108 isset( $_REQUEST['pdfprnt_use_theme_stylesheet'] ) &&
@@ -209,150 +123,18 @@
209 123 $pdfprnt_options_array['show_btn_print_search_archive'] = isset( $_REQUEST['pdfprnt_show_btn_print_search_archive'] ) ? 1 : 0;
210 124 $pdfprnt_options_array['show_btn_pdf_custom'] = isset( $_REQUEST['pdfprnt_show_btn_pdf_custom'] ) ? 1 : 0;
211 125 $pdfprnt_options_array['show_btn_print_custom'] = isset( $_REQUEST['pdfprnt_show_btn_print_custom'] ) ? 1 : 0;
212 126 $pdfprnt_options_array['tmpl_shorcode'] = isset( $_REQUEST['pdfprnt_tmpl_shorcode'] ) ? 1 : 0;
213 - $pdfprnt_options_array['show_print_window'] = isset( $_REQUEST['pdfprnt_show_print_window'] ) ? 1 : 0;
214 127 $pdfprnt_options_array['use_types_posts'] = isset( $_REQUEST['pdfprnt_use_types_posts'] ) ? $_REQUEST['pdfprnt_use_types_posts'] : array();
215 128 update_option ( 'pdfprnt_options_array', $pdfprnt_options_array );
216 129 $message = __( 'Settings saved.', 'pdf-print' );
217 - }
218 - /* GO PRO */
219 - if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) {
220 - global $wpmu;
221 -
222 - $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? trim( $_POST['bws_license_key'] ) : "";
223 - $bstwbsftwppdtplgns_options_defaults = array();
224 - if ( 1 == $wpmu ) {
225 - if ( !get_site_option( 'bstwbsftwppdtplgns_options' ) )
226 - add_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options_defaults, '', 'yes' );
227 - $bstwbsftwppdtplgns_options = get_site_option( 'bstwbsftwppdtplgns_options' );
228 - } else {
229 - if ( !get_option( 'bstwbsftwppdtplgns_options' ) )
230 - add_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options_defaults, '', 'yes' );
231 - $bstwbsftwppdtplgns_options = get_option( 'bstwbsftwppdtplgns_options' );
232 - }
233 -
234 - if ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_license_nonce_name' ) ) {
235 - if ( '' != $bws_license_key ) {
236 - if ( strlen( $bws_license_key ) != 18 ) {
237 - $error = __( "Wrong license key", 'pdf-print' );
238 - } else {
239 - $bws_license_plugin = trim( $_POST['bws_license_plugin'] );
240 - if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] < ( time() + (24 * 60 * 60) ) ) {
241 - $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
242 - } else {
243 - $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
244 - $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time();
245 - }
246 -
247 - /* download Pro */
248 - if ( !function_exists( 'get_plugins' ) )
249 - require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
250 - if ( ! function_exists( 'is_plugin_active_for_network' ) )
251 - require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
252 - $all_plugins = get_plugins();
253 - $active_plugins = get_option( 'active_plugins' );
254 -
255 - if ( ! array_key_exists( $bws_license_plugin, $all_plugins ) ) {
256 - $current = get_site_transient( 'update_plugins' );
257 - if ( is_array( $all_plugins ) && !empty( $all_plugins ) && isset( $current ) && is_array( $current->response ) ) {
258 - $to_send = array();
259 - $to_send["plugins"][ $bws_license_plugin ] = array();
260 - $to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key;
261 - $to_send["plugins"][ $bws_license_plugin ]["bws_illegal_client"] = true;
262 - $options = array(
263 - 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
264 - 'body' => array( 'plugins' => serialize( $to_send ) ),
265 - 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
266 - $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options );
267 -
268 - if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
269 - $error = __( "Something went wrong. Try again later. If the error will appear again, please, contact us <a href=http://support.bestwebsoft.com>BestWebSoft</a>. We are sorry for inconvenience.", 'pdf-print' );
270 - } else {
271 - $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
272 -
273 - if ( is_array( $response ) && !empty( $response ) ) {
274 - foreach ( $response as $key => $value ) {
275 - if ( "wrong_license_key" == $value->package ) {
276 - $error = __( "Wrong license key", 'pdf-print' );
277 - } elseif ( "wrong_domain" == $value->package ) {
278 - $error = __( "This license key is bind to another site", 'pdf-print' );
279 - } elseif ( "you_are_banned" == $value->package ) {
280 - $error = __( "Unfortunately, you have exceeded the number of available tries. Please, upload the plugin manually.", 'pdf-print' );
281 - }
282 - }
283 - if ( '' == $error ) {
284 - global $wpmu;
285 - $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
286 -
287 - $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';
288 - $uploadDir = wp_upload_dir();
289 - $zip_name = explode( '/', $bws_license_plugin );
290 - if ( file_put_contents( $uploadDir["path"] . "/" . $zip_name[0] . ".zip", file_get_contents( $url ) ) ) {
291 - @chmod( $uploadDir["path"] . "/" . $zip_name[0] . ".zip", octdec( 755 ) );
292 - if ( class_exists( 'ZipArchive' ) ) {
293 - $zip = new ZipArchive();
294 - if ( $zip->open( $uploadDir["path"] . "/" . $zip_name[0] . ".zip" ) === TRUE ) {
295 - $zip->extractTo( WP_PLUGIN_DIR );
296 - $zip->close();
297 - } else {
298 - $error = __( "Failed to open the zip archive. Please, upload the plugin manually", 'pdf-print' );
299 - }
300 - } elseif ( class_exists( 'Phar' ) ) {
301 - $phar = new PharData( $uploadDir["path"] . "/" . $zip_name[0] . ".zip" );
302 - $phar->extractTo( WP_PLUGIN_DIR );
303 - } else {
304 - $error = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually", 'pdf-print' );
305 - }
306 - @unlink( $uploadDir["path"] . "/" . $zip_name[0] . ".zip" );
307 - } else {
308 - $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'pdf-print' );
309 - }
310 -
311 - /* activate Pro */
312 - if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) {
313 - array_push( $active_plugins, $bws_license_plugin );
314 - update_option( 'active_plugins', $active_plugins );
315 - $pro_plugin_is_activated = true;
316 - } elseif ( '' == $error ) {
317 - $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'pdf-print' );
318 - }
319 - }
320 - } else {
321 - $error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvienience.", 'pdf-print' );
322 - }
323 - }
324 - }
325 - } else {
326 - /* activate Pro */
327 - if ( ! ( in_array( $bws_license_plugin, $active_plugins ) || is_plugin_active_for_network( $bws_license_plugin ) ) ) {
328 - array_push( $active_plugins, $bws_license_plugin );
329 - update_option( 'active_plugins', $active_plugins );
330 - $pro_plugin_is_activated = true;
331 - }
332 - }
333 - update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes' );
334 - }
335 - } else {
336 - $error = __( "Please, enter Your license key", 'pdf-print' );
337 - }
338 - }
339 - }
340 - ?>
130 + } ?>
341 131 <div class="wrap">
342 132 <div class="icon32 icon32-bws" id="icon-options-general"></div>
343 133 <h2><?php echo __( 'PDF & Print Settings', 'pdf-print' ); ?></h2>
344 - <h2 class="nav-tab-wrapper">
345 - <a class="nav-tab<?php if ( !isset( $_GET['action'] ) ) echo ' nav-tab-active'; ?>" href="admin.php?page=pdf-print.php"><?php _e( 'Settings', 'pdf-print' ); ?></a>
346 - <a class="nav-tab<?php if ( isset( $_GET['action'] ) && 'extra' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=pdf-print.php&amp;action=extra"><?php _e( 'Extra settings', 'pdf-print' ); ?></a>
347 - <a class="nav-tab" href="http://bestwebsoft.com/plugin/pdf-print/#faq" target="_blank"><?php _e( 'FAQ', 'pdf-print' ); ?></a>
348 - <a class="nav-tab bws_go_pro_tab<?php if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=pdf-print.php&amp;action=go_pro"><?php _e( 'Go PRO', 'pdf-print' ); ?></a>
349 - </h2>
350 - <div class="updated fade" <?php if ( empty( $message ) || "" != $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $message; ?></strong></p></div>
351 - <div id="pdfprnt_settings_notice" class="updated fade" style="display:none"><p><strong><?php _e( "Notice:", 'pdf-print' ); ?></strong> <?php _e( "The plugin's settings have been changed. In order to save them please don't forget to click the 'Save Changes' button.", 'pdf-print' ); ?></p></div>
352 - <div class="error" <?php if ( "" == $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $error; ?></strong></p></div>
353 - <?php if ( ! isset( $_GET['action'] ) ) { ?>
354 - <form method="post" action="admin.php?page=pdf-print.php" id="pdfprnt_settings_form">
134 + <div class="updated fade" <?php if( empty( $message ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $message; ?></strong></p></div>
135 + <div>
136 + <form method="post" action="admin.php?page=pdf-print.php">
355 137 <table class="form-table pdfprnt_settings_table">
356 138 <tr>
357 139 <th scope="row"><?php echo __( 'Use of theme stylesheet or plugin default style:', 'pdf-print' ); ?></th>
358 140 <td>
@@ -532,122 +314,16 @@
532 314 <label><input type="checkbox" name="pdfprnt_tmpl_shorcode" <?php if ( 1 == $pdfprnt_options_array['tmpl_shorcode'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'Do!', 'pdf-print' ); ?></span></label>
533 315 </td>
534 316 </tr>
535 317 <tr>
536 - <th scope="row"><?php echo __( 'Show the print window', 'pdf-print' ); ?></th>
537 - <td>
538 - <label><input type="checkbox" name="pdfprnt_show_print_window" <?php if ( 1 == $pdfprnt_options_array['show_print_window'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'Mark the checkbox to show it', 'pdf-print' ); ?></span></label><br />
318 + <td colspan="2">
319 + <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'pdf-print' ); ?>" />
539 320 </td>
540 321 </tr>
541 322 </table>
542 - <input type="hidden" name="pdfprnt_form_submit" value="1" />
543 - <p class="submit">
544 - <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'pdf-print' ); ?>" />
545 - </p>
546 323 <?php wp_nonce_field( plugin_basename( __FILE__ ), 'pdfprnt_nonce_name' ); ?>
547 324 </form>
548 - <div class="bws-plugin-reviews">
549 - <div class="bws-plugin-reviews-rate">
550 - <?php _e( 'If you enjoy our plugin, please give it 5 stars on WordPress', 'pdf-print' ); ?>:
551 - <a href="http://wordpress.org/support/view/plugin-reviews/pdf-print" target="_blank" title="PDF &amp; Print reviews"><?php _e( 'Rate the plugin', 'pdf-print' ); ?></a>
552 - </div>
553 - <div class="bws-plugin-reviews-support">
554 - <?php _e( 'If there is something wrong about it, please contact us', 'pdf-print' ); ?>:
555 - <a href="http://support.bestwebsoft.com">http://support.bestwebsoft.com</a>
556 - </div>
557 - </div>
558 - <?php } elseif ( 'extra' == $_GET['action'] ) { ?>
559 - <div class="bws_pro_version_bloc">
560 - <div class="bws_pro_version_table_bloc">
561 - <div class="bws_table_bg"></div>
562 - <table class="form-table bws_pro_version">
563 - <tr valign="top">
564 - <td colspan="2">
565 - <?php _e( 'Please choose the necessary post types (or single pages) where PDF & Print buttons will be displayed:', 'pdf-print' ); ?>
566 - </td>
567 - </tr>
568 - <tr valign="top">
569 - <td colspan="2">
570 - <label>
571 - <input disabled="disabled" checked="checked" id="twttrpr_jstree_url" type="checkbox" name="twttrpr_jstree_url" value="1" />
572 - <?php _e( "Show URL for pages", 'pdf-print' );?>
573 - </label>
574 - </td>
575 - </tr>
576 - <tr valign="top">
577 - <td colspan="2">
578 - <img src="<?php echo plugins_url( 'images/pro_screen_1.png', __FILE__ ); ?>" alt="<?php _e( "Example of site pages' tree", 'pdf-print' ); ?>" title="<?php _e( "Example of site pages' tree", 'pdf-print' ); ?>" />
579 - </td>
580 - </tr>
581 - <tr valign="top">
582 - <td colspan="2">
583 - <input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'pdf-print' ); ?>" />
584 - </td>
585 - </tr>
586 - <tr valign="top">
587 - <th scope="row" colspan="2">
588 - * <?php _e( 'If you upgrade to Pro version all your settings will be saved.', 'pdf-print' ); ?>
589 - </th>
590 - </tr>
591 - </table>
592 - </div>
593 - <div class="bws_pro_version_tooltip">
594 - <div class="bws_info">
595 - <?php _e( 'Unlock premium options by upgrading to a PRO version.', 'pdf-print' ); ?>
596 - <a href="http://bestwebsoft.com/plugin/pdf-print-pro/?k=d9da7c9c2046bed8dfa38d005d4bffdb&pn=101&v=<?php echo $pdfprnt_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="PDF & Print Pro"><?php _e( 'Learn More', 'pdf-print' ); ?></a>
597 - </div>
598 - <a class="bws_button" href="http://bestwebsoft.com/plugin/pdf-print-pro/?k=d9da7c9c2046bed8dfa38d005d4bffdb&pn=101&v=<?php echo $pdfprnt_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>#purchase" target="_blank" title="PDF & Print Pro">
599 - <?php _e( 'Go', 'pdf-print' ); ?> <strong>PRO</strong>
600 - </a>
601 - <div class="clear"></div>
602 - </div>
603 - </div>
604 - <?php } elseif ( 'go_pro' == $_GET['action'] ) { ?>
605 - <?php if ( isset( $pro_plugin_is_activated ) && true === $pro_plugin_is_activated ) { ?>
606 - <script type="text/javascript">
607 - window.setTimeout( function() {
608 - window.location.href = 'admin.php?page=pdf-print-pro.php';
609 - }, 5000 );
610 - </script>
611 - <p><?php _e( "Congratulations! The PRO version of the plugin is successfully download and activated.", 'pdf-print' ); ?></p>
612 - <p>
613 - <?php _e( "Please, go to", 'pdf-print' ); ?> <a href="admin.php?page=pdf-print-pro.php"><?php _e( 'the setting page', 'pdf-print' ); ?></a>
614 - (<?php _e( "You will be redirected automatically in 5 seconds.", 'pdf-print' ); ?>)
615 - </p>
616 - <?php } else { ?>
617 - <form method="post" action="admin.php?page=pdf-print.php&amp;action=go_pro">
618 - <p>
619 - <?php _e( 'You can download and activate', 'pdf-print' ); ?>
620 - <a href="http://bestwebsoft.com/plugin/pdf-print-pro/?k=d9da7c9c2046bed8dfa38d005d4bffdb&pn=101&v=<?php echo $pdfprnt_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="PDF & Print Pro">PRO</a>
621 - <?php _e( 'version of this plugin by entering Your license key.', 'pdf-print' ); ?><br />
622 - <span style="color: #888888;font-size: 10px;">
623 - <?php _e( 'You can find your license key on your personal page Client area, by clicking on the link', 'pdf-print' ); ?>
624 - <a href="http://bestwebsoft.com/wp-login.php">http://bestwebsoft.com/wp-login.php</a>
625 - <?php _e( '(your username is the email you specify when purchasing the product).', 'pdf-print' ); ?>
626 - </span>
627 - </p>
628 - <?php if ( isset( $bstwbsftwppdtplgns_options['go_pro']['pdf-print-pro/pdf-print-pro.php']['count'] ) &&
629 - '5' < $bstwbsftwppdtplgns_options['go_pro']['pdf-print-pro/pdf-print-pro.php']['count'] &&
630 - $bstwbsftwppdtplgns_options['go_pro']['pdf-print-pro/pdf-print-pro.php']['time'] < ( time() + ( 24 * 60 * 60 ) ) ) { ?>
631 - <p>
632 - <input disabled="disabled" type="text" name="bws_license_key" value="<?php echo $bws_license_key; ?>" />
633 - <input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Go!', 'pdf-print' ); ?>" />
634 - </p>
635 - <p>
636 - <?php _e( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'pdf-print' ); ?>
637 - </p>
638 - <?php } else { ?>
639 - <p>
640 - <input type="text" name="bws_license_key" value="<?php echo $bws_license_key; ?>" />
641 - <input type="hidden" name="bws_license_plugin" value="pdf-print-pro/pdf-print-pro.php" />
642 - <input type="hidden" name="bws_license_submit" value="submit" />
643 - <input type="submit" class="button-primary" value="<?php _e( 'Go!', 'pdf-print' ); ?>" />
644 - <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_nonce_name' ); ?>
645 - </p>
646 - <?php } ?>
647 - </form>
648 - <?php }
649 - } ?>
325 + </div>
650 326 </div>
651 327 <?php }
652 328 }
653 329
@@ -660,19 +336,13 @@
660 336 if ( 1 == $pdfprnt_options_array['show_btn_pdf'] || 1 == $pdfprnt_options_array['show_btn_print'] ) {
661 337 $position = ( 'top-left' == $pdfprnt_options_array['position'] || 'top-right' == $pdfprnt_options_array['position'] ) ? true : false;
662 338 $str = '<div class="pdfprnt-' . $pdfprnt_options_array['position'] . '">';
663 339 if ( 1 == $pdfprnt_options_array['show_btn_pdf'] ) {
664 - if ( ! is_front_page () )
665 - $permalink = add_query_arg( 'print' , 'pdf' , get_permalink( $post->ID ) );
666 - else
667 - $permalink = add_query_arg( 'print' , 'pdf' , get_permalink() . '?page-id=' . $post->ID );
340 + $permalink = add_query_arg( 'print' , 'pdf' , get_permalink( $post->ID ) );
668 341 $str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/pdf.png', __FILE__ ) . '" alt="image_pdf" title="View PDF" /></a>';
669 342 }
670 343 if ( 1 == $pdfprnt_options_array['show_btn_print'] ) {
671 - if ( ! is_front_page () )
672 - $permalink = add_query_arg( 'print' , 'print' , get_permalink( $post->ID ) );
673 - else
674 - $permalink = add_query_arg( 'print' , 'print' , get_permalink() . '?page-id=' . $post->ID );
344 + $permalink = add_query_arg( 'print' , 'print' , get_permalink( $post->ID ) );
675 345 $str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/print.gif', __FILE__ ) . '" alt="image_print" title="Print Content" /></a>';
676 346 }
677 347 $str .= '</div>';
678 348 if ( $position )
@@ -722,18 +392,11 @@
722 392 }
723 393 $str .= '</div>';
724 394 unset( $current_url );
725 395 unset( $permalink );
726 - echo $str;
396 + return $str;
727 397 }
728 398 }
729 -if ( ! function_exists( 'pdfprnt_auto_show_buttons_search_archive' ) ) {
730 - function pdfprnt_auto_show_buttons_search_archive() {
731 - if ( is_archive() || is_search() )
732 - add_action( 'loop_start', 'pdfprnt_show_buttons_search_archive' );
733 - }
734 - add_action( 'wp_head', 'pdfprnt_auto_show_buttons_search_archive' );
735 -}
736 399
737 400 /* Output buttons of page for BWS Portfolio plugin */
738 401 if( ! function_exists( 'pdfprnt_show_buttons_for_bws_portfolio' ) ) {
739 402 function pdfprnt_show_buttons_for_bws_portfolio() {
@@ -765,9 +428,9 @@
765 428 }
766 429 }
767 430
768 431 /* Output buttons of post for BWS Portfolio plugin */
769 -if ( ! function_exists( 'pdfprnt_show_buttons_for_bws_portfolio_post' ) ) {
432 +if( ! function_exists( 'pdfprnt_show_buttons_for_bws_portfolio_post' ) ) {
770 433 function pdfprnt_show_buttons_for_bws_portfolio_post() {
771 434 global $pdfprnt_options_array, $post;
772 435 if ( 1 !== $pdfprnt_options_array['show_btn_pdf_custom'] && 1 !== $pdfprnt_options_array['show_btn_print_custom'] )
773 436 return;
@@ -790,9 +453,9 @@
790 453 }
791 454 }
792 455
793 456 /* Output buttons of page for custom post type */
794 -if ( ! function_exists( 'pdfprnt_show_buttons_for_custom_post_type' ) ) {
457 +if( ! function_exists( 'pdfprnt_show_buttons_for_custom_post_type' ) ) {
795 458 function pdfprnt_show_buttons_for_custom_post_type( $custom_query ) {
796 459 global $pdfprnt_options_array, $pdfprnt_output_count_buttons;
797 460 if ( 0 < $pdfprnt_output_count_buttons )
798 461 return;
@@ -855,19 +518,23 @@
855 518 return $links;
856 519 }
857 520 }
858 521
522 +/* Init plugin */
523 +if ( ! function_exists ( 'pdfprnt_plugin_init' ) ) {
524 + function pdfprnt_plugin_init() {
525 + load_plugin_textdomain( 'pdf-print', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
526 + load_plugin_textdomain( 'bestwebsoft', false, dirname( plugin_basename( __FILE__ ) ) . '/bws_menu/languages/' );
527 + }
528 +}
529 +
859 530 /* Add stylesheets */
860 531 if ( ! function_exists ( 'pdfprnt_admin_head' ) ) {
861 532 function pdfprnt_admin_head() {
862 - global $wp_version;
863 - if ( $wp_version < 3.8 )
864 - wp_enqueue_style( 'pdfprnt_stylesheet', plugins_url( 'css/style_wp_before_3.8.css', __FILE__ ) );
865 - else
866 - wp_enqueue_style( 'pdfprnt_stylesheet', plugins_url( 'css/style.css', __FILE__ ) );
533 + wp_enqueue_style( 'pdfprnt-stylesheet', plugins_url( 'css/style.css', __FILE__ ) );
867 534
868 - if ( isset( $_GET['page'] ) && "pdf-print.php" == $_GET['page'] )
869 - wp_enqueue_script( 'pdfprnt_script', plugins_url( 'js/script.js', __FILE__ ) );
535 + if ( isset( $_GET['page'] ) && $_GET['page'] == "bws_plugins" )
536 + wp_enqueue_script( 'bws_menu_script', plugins_url( 'js/bws_menu.js', __FILE__ ) );
870 537 }
871 538 }
872 539
873 540 /* Generate templates for pdf file or print */
@@ -962,10 +629,8 @@
962 629 <?php break;
963 630 }
964 631 if ( $isprint ) : ?>
965 632 <script type="text/javascript" src="<?php echo plugins_url( 'js/pdfprnt.print.js', __FILE__ ); ?>"></script>
966 - <?php if ( 1 == $pdfprnt_options_array['show_print_window'] ) {
967 - echo '<script>window.onload = function(){ window.print(); };</script>'; } ?>
968 633 <?php endif; ?>
969 634 </head>
970 635 <body>
971 636 <?php echo $content; ?>
@@ -991,9 +656,9 @@
991 656 'post_type' => 'attachment',
992 657 'post_mime_type' => 'image',
993 658 'numberposts' => 1
994 659 );
995 - $attachments = get_children( $args );
660 + $attachments = get_children( $args );
996 661 $post_thumbnail_id = key( $attachments );
997 662 }
998 663 $image = wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
999 664 $image_alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
@@ -998,12 +663,12 @@
998 663 $image = wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
999 664 $image_alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
1000 665 $image_desc = get_post( $post_thumbnail_id );
1001 666 $image_desc = $image_desc->post_content;
1002 - if ( '1' == get_option( 'prtfl_postmeta_update' ) ) {
667 + if( get_option( 'prtfl_postmeta_update' ) == '1' ) {
1003 668 $post_meta = get_post_meta( $post->ID, 'prtfl_information', true );
1004 669 $date_compl = $post_meta['_prtfl_date_compl'];
1005 - if ( ! empty( $date_compl ) && 'in progress' != $date_compl ) {
670 + if( ! empty( $date_compl ) && 'in progress' != $date_compl ) {
1006 671 $date_compl = explode( '/', $date_compl );
1007 672 $date_compl = date( get_option( 'date_format' ), strtotime( $date_compl[1] . '-' . $date_compl[0] . '-' . $date_compl[2] ) );
1008 673 }
1009 674 $link = $post_meta['_prtfl_link'];
@@ -1009,9 +674,9 @@
1009 674 $link = $post_meta['_prtfl_link'];
1010 675 $short_descr = $post_meta['_prtfl_short_descr'];
1011 676 } else {
1012 677 $date_compl = get_post_meta( $post->ID, '_prtfl_date_compl', true );
1013 - if ( ! empty( $date_compl ) && 'in progress' != $date_compl ) {
678 + if( ! empty( $date_compl ) && 'in progress' != $date_compl ) {
1014 679 $date_compl = explode( '/', $date_compl );
1015 680 $date_compl = date( get_option( 'date_format' ), strtotime( $date_compl[1] . '-' . $date_compl[0] . '-' . $date_compl[2] ) );
1016 681 }
1017 682 $link = get_post_meta( $post->ID, '_prtfl_link', true);
@@ -1049,9 +714,9 @@
1049 714 function generate_query_posts_for_portfolio() {
1050 715 global $wp_query;
1051 716 $paged = isset( $wp_query->query_vars['paged'] ) ? $wp_query->query_vars['paged'] : 1;
1052 717 $technologies = isset( $wp_query->query_vars["technologies"] ) ? $wp_query->query_vars["technologies"] : "";
1053 - if ( "" != $technologies ) {
718 + if( $technologies != "" ) {
1054 719 $args = array(
1055 720 'post_type' => 'portfolio',
1056 721 'post_status' => 'publish',
1057 722 'posts_per_page' => get_option('posts_per_page'),
@@ -1100,11 +765,9 @@
1100 765 switch ( $print ) {
1101 766 case 'pdf': /* Content for PDF from post */
1102 767 include ( 'mpdf/mpdf.php' );
1103 768 $mpdf = new mPDF( get_bloginfo( 'charset' ) );
1104 - $mpdf = new mPDF('+aCJK');
1105 769 $user_info = get_userdata( $post->post_author );
1106 - $mpdf->SetAutoFont(AUTOFONT_ALL);
1107 770 $mpdf->SetAuthor( $user_info->display_name );
1108 771 $mpdf->SetTitle( $post->post_title );
1109 772 $mpdf->SetSubject( get_bloginfo( 'blogdescription' ) );
1110 773 $html = '<div class="container">
@@ -1132,9 +795,8 @@
1132 795 $titles = array();
1133 796 $authors = array();
1134 797 include ( 'mpdf/mpdf.php' );
1135 798 $mpdf = new mPDF( get_bloginfo( 'charset' ) );
1136 - $mpdf = new mPDF('+aCJK');
1137 799 foreach ( $posts as $p ) {
1138 800 if ( ! in_array( get_post_type( $p ), $pdfprnt_options_array['use_types_posts'] ) )
1139 801 continue;
1140 802 $titles[] = $p->post_title;
@@ -1147,9 +809,8 @@
1147 809 unset( $user_info );
1148 810 }
1149 811 $titles = array_unique( $titles );
1150 812 $authors = array_unique( $authors );
1151 - $mpdf->SetAutoFont(AUTOFONT_ALL);
1152 813 $mpdf->SetTitle( implode( ',', $titles ) );
1153 814 $mpdf->SetAuthor( implode( ',', $authors ) );
1154 815 $mpdf->SetSubject( get_bloginfo( 'blogdescription' ) );
1155 816 $mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_search'] ) );
@@ -1176,11 +837,9 @@
1176 837 break;
1177 838 case 'pdf-portfolio': /* Content for PDF from portfolio post */
1178 839 include ( 'mpdf/mpdf.php' );
1179 840 $mpdf = new mPDF( get_bloginfo( 'charset' ) );
1180 - $mpdf = new mPDF( '+aCJK' );
1181 841 $user_info = get_userdata( $post->post_author );
1182 - $mpdf->SetAutoFont( AUTOFONT_ALL );
1183 842 $mpdf->SetAuthor( $user_info->display_name );
1184 843 $mpdf->SetTitle( $post->post_title );
1185 844 $mpdf->SetSubject( get_bloginfo( 'blogdescription' ) );
1186 845 $html = '<div class="container">
@@ -1223,12 +882,10 @@
1223 882 unset( $user_info );
1224 883 }
1225 884 include ( 'mpdf/mpdf.php' );
1226 885 $mpdf = new mPDF( get_bloginfo( 'charset' ) );
1227 - $mpdf = new mPDF( '+aCJK' );
1228 886 $titles = array_unique( $titles );
1229 887 $authors = array_unique( $authors );
1230 - $mpdf->SetAutoFont( AUTOFONT_ALL );
1231 888 $mpdf->SetTitle( implode( ',', $titles ) );
1232 889 $mpdf->SetAuthor( implode( ',', $authors ) );
1233 890 $mpdf->SetSubject( get_bloginfo( 'blogdescription' ) );
1234 891 $mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'] ) );
@@ -1274,12 +931,10 @@
1274 931 unset( $user_info );
1275 932 }
1276 933 include ( 'mpdf/mpdf.php' );
1277 934 $mpdf = new mPDF( get_bloginfo( 'charset' ) );
1278 - $mpdf = new mPDF( '+aCJK' );
1279 935 $titles = array_unique( $titles );
1280 936 $authors = array_unique( $authors );
1281 - $mpdf->SetAutoFont( AUTOFONT_ALL );
1282 937 $mpdf->SetTitle( implode( ',', $titles ) );
1283 938 $mpdf->SetAuthor( implode( ',', $authors ) );
1284 939 $mpdf->SetSubject( get_bloginfo( 'blogdescription' ) );
1285 940 $mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'] ) );
@@ -1324,9 +979,9 @@
1324 979 /* Add custom admin bar menu */
1325 980 if ( ! function_exists( 'pdfprnt_admin_bar_menu' ) ) {
1326 981 function pdfprnt_admin_bar_menu() {
1327 982 global $pdfprnt_options_array, $wp_admin_bar, $wp, $posts;
1328 - if ( ! is_super_admin() || ! is_admin_bar_showing() || is_admin() ) /* Checking user */
983 + if ( ! is_super_admin() || ! is_admin_bar_showing() ) /* Checking user */
1329 984 return;
1330 985 if ( ( ! is_search() && ! is_archive() ) || ( is_category() || ! have_posts() ) )
1331 986 return;
1332 987 $is_return = true;
@@ -1374,87 +1029,10 @@
1374 1029 unset( $template_url );
1375 1030 }
1376 1031 }
1377 1032
1378 -if ( ! function_exists ( 'pdfprnt_plugin_banner' ) ) {
1379 - function pdfprnt_plugin_banner() {
1380 - global $hook_suffix, $pdfprnt_plugin_info;
1381 - if ( 'plugins.php' == $hook_suffix ) {
1382 - $banner_array = array(
1383 - array( 'sndr_hide_banner_on_plugin_page', 'sender/sender.php', '0.5' ),
1384 - array( 'srrl_hide_banner_on_plugin_page', 'user-role/user-role.php', '1.4' ),
1385 - array( 'pdtr_hide_banner_on_plugin_page', 'updater/updater.php', '1.12' ),
1386 - array( 'cntctfrmtdb_hide_banner_on_plugin_page', 'contact-form-to-db/contact_form_to_db.php', '1.2' ),
1387 - array( 'cntctfrmmlt_hide_banner_on_plugin_page', 'contact-form-multi/contact-form-multi.php', '1.0.7' ),
1388 - array( 'gglmps_hide_banner_on_plugin_page', 'bws-google-maps/bws-google-maps.php', '1.2' ),
1389 - array( 'fcbkbttn_hide_banner_on_plugin_page', 'facebook-button-plugin/facebook-button-plugin.php', '2.29' ),
1390 - array( 'twttr_hide_banner_on_plugin_page', 'twitter-plugin/twitter.php', '2.34' ),
1391 - array( 'pdfprnt_hide_banner_on_plugin_page', 'pdf-print/pdf-print.php', '1.7.1' ),
1392 - array( 'gglplsn_hide_banner_on_plugin_page', 'google-one/google-plus-one.php', '1.1.4' ),
1393 - array( 'gglstmp_hide_banner_on_plugin_page', 'google-sitemap-plugin/google-sitemap-plugin.php', '2.8.4' ),
1394 - array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
1395 - array( 'cntctfrm_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.62' ),
1396 - array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
1397 - array( 'cptch_hide_banner_on_plugin_page', 'captcha/captcha.php', '3.8.4' ),
1398 - array( 'gllr_hide_banner_on_plugin_page', 'gallery-plugin/gallery-plugin.php', '3.9.1' )
1399 - );
1400 - if ( ! $pdfprnt_plugin_info )
1401 - $pdfprnt_plugin_info = get_plugin_data( __FILE__ );
1402 - if ( ! function_exists( 'is_plugin_active_for_network' ) )
1403 - require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
1404 - $active_plugins = get_option( 'active_plugins' );
1405 - $all_plugins = get_plugins();
1406 - $this_banner = 'pdfprnt_hide_banner_on_plugin_page';
1407 - foreach ( $banner_array as $key => $value ) {
1408 - if ( $this_banner == $value[0] ) {
1409 - global $wp_version, $bstwbsftwppdtplgns_cookie_add;
1410 - if ( ! isset( $bstwbsftwppdtplgns_cookie_add ) ) {
1411 - echo '<script type="text/javascript" src="' . plugins_url( 'js/c_o_o_k_i_e.js', __FILE__ ) . '"></script>';
1412 - $bstwbsftwppdtplgns_cookie_add = true;
1413 - } ?>
1414 - <script type="text/javascript">
1415 - (function($) {
1416 - $(document).ready( function() {
1417 - var hide_message = $.cookie( "pdfprnt_hide_banner_on_plugin_page" );
1418 - if ( hide_message == "true") {
1419 - $( ".pdfprnt_message" ).css( "display", "none" );
1420 - } else {
1421 - $( ".pdfprnt_message" ).css( "display", "block" );
1422 - };
1423 - $( ".pdfprnt_close_icon" ).click( function() {
1424 - $( ".pdfprnt_message" ).css( "display", "none" );
1425 - $.cookie( "pdfprnt_hide_banner_on_plugin_page", "true", { expires: 32 } );
1426 - });
1427 - });
1428 - })(jQuery);
1429 - </script>
1430 - <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
1431 - <div class="pdfprnt_message bws_banner_on_plugin_page" style="display: none;">
1432 - <img class="pdfprnt_close_icon close_icon" title="" src="<?php echo plugins_url( 'images/close_banner.png', __FILE__ ); ?>" alt=""/>
1433 - <div class="button_div">
1434 - <a class="button" target="_blank" href="http://bestwebsoft.com/plugin/pdf-print-pro/?k=e2f2549f4d70bc4cb9b48071169d264e&pn=101&v=<?php echo $pdfprnt_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>"><?php _e( "Learn More", 'pdf-print' ); ?></a>
1435 - </div>
1436 - <div class="text">
1437 - <?php _e( "It's time to upgrade your <strong>PDF & Print</strong> to <strong>PRO</strong> version", 'pdf-print' ); ?>!<br />
1438 - <span><?php _e( 'Extend standard plugin functionality with new great options', 'pdf-print' ); ?>.</span>
1439 - </div>
1440 - <div class="icon">
1441 - <img title="" src="<?php echo plugins_url( 'images/banner.png', __FILE__ ); ?>" alt=""/>
1442 - </div>
1443 - </div>
1444 - </div>
1445 - <?php break;
1446 - }
1447 - if ( isset( $all_plugins[ $value[1] ] ) && $all_plugins[ $value[1] ]["Version"] >= $value[2] && ( 0 < count( preg_grep( '/' . str_replace( '/', '\/', $value[1] ) . '/', $active_plugins ) ) || is_plugin_active_for_network( $value[1] ) ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
1448 - break;
1449 - }
1450 - }
1451 - }
1452 - }
1453 -}
1454 -
1455 1033 /* Deleting plugin options on uninstalling */
1456 -if ( ! function_exists( 'pdfprnt_uninstall' ) ) {
1034 +if( ! function_exists( 'pdfprnt_uninstall' ) ) {
1457 1035 function pdfprnt_uninstall() {
1458 1036 delete_option( 'pdfprnt_options_array' );
1459 1037 delete_site_option( 'pdfprnt_options_array' );
1460 1038 }
@@ -1461,26 +1039,28 @@
1461 1039 }
1462 1040
1463 1041 /* Adding function to output PDF document or pirnt page */
1464 1042 add_action( 'wp', 'pdfprnt_print' );
1465 -/* Initialization */
1466 -add_action( 'init', 'pdfprnt_init' );
1467 -add_action( 'admin_init', 'pdfprnt_admin_init' );
1043 +/* Initialization default plugin settings */
1044 +add_action( 'init', 'pdfprnt_settings' );
1045 +/* Checks version of Wordpress required for plugin */
1046 +add_action( 'admin_init', 'pdfprnt_version_check' );
1047 +/* Load internationalization */
1048 +add_action( 'init', 'pdfprnt_plugin_init' );
1468 1049 /* Adding stylesheets */
1469 -add_action( 'admin_enqueue_scripts', 'pdfprnt_admin_head' );
1470 -add_action( 'wp_enqueue_scripts', 'pdfprnt_admin_head' );
1050 +add_action( 'init', 'pdfprnt_admin_head' );
1471 1051 /* Adding 'BWS Plugins' admin menu */
1472 1052 add_action( 'admin_menu', 'pdfprnt_add_pages' );
1473 1053 /* Add menu to bar menu WordPress */
1474 1054 add_action( 'admin_bar_menu', 'pdfprnt_admin_bar_menu', 1000 );
1055 +
1475 1056 /* Add query vars */
1476 1057 add_filter( 'query_vars', 'print_vars_callback' );
1058 +/* Adds "Settings" link to the plugin action page */
1059 +add_filter( 'plugin_action_links', 'pdfprnt_action_links', 10, 2 );
1477 1060 /* Additional links on the plugin page */
1478 -add_filter( 'plugin_action_links', 'pdfprnt_action_links', 10, 2 );
1479 1061 add_filter( 'plugin_row_meta', 'pdfprnt_links', 10, 2 );
1480 1062 /* Adding buttons plugin to content */
1481 1063 add_filter( 'the_content', 'pdfprnt_content' );
1482 -/* Adding banner */
1483 -add_action( 'admin_notices', 'pdfprnt_plugin_banner' );
1484 -/* Plugin uninstall function */
1064 +
1485 1065 register_uninstall_hook( __FILE__, 'pdfprnt_uninstall' );
1486 1066 ?>