| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: PDF & Print |
| 4 | -Plugin URI: http://bestwebsoft.com/products/ | |
| 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.6 | |
| 7 | +Version: 1.7.3 | |
| 8 | 8 | Author URI: http://bestwebsoft.com/ |
| 9 | 9 | License: GPLv2 or later |
| 10 | 10 | */ |
| 11 | 11 | |
| @@ -27,17 +27,23 @@ | ||
| 27 | 27 | |
| 28 | 28 | /* Add our own menu */ |
| 29 | 29 | if ( ! function_exists( 'pdfprnt_add_pages' ) ) { |
| 30 | 30 | function pdfprnt_add_pages() { |
| 31 | - global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_added_menu; | |
| 31 | + global $bstwbsftwppdtplgns_options, $wpmu, $bstwbsftwppdtplgns_added_menu; | |
| 32 | 32 | $bws_menu_info = get_plugin_data( plugin_dir_path( __FILE__ ) . "bws_menu/bws_menu.php" ); |
| 33 | 33 | $bws_menu_version = $bws_menu_info["Version"]; |
| 34 | 34 | $base = plugin_basename(__FILE__); |
| 35 | 35 | |
| 36 | 36 | if ( ! isset( $bstwbsftwppdtplgns_options ) ) { |
| 37 | - if ( ! get_option( 'bstwbsftwppdtplgns_options' ) ) | |
| 38 | - add_option( 'bstwbsftwppdtplgns_options', array(), '', 'yes' ); | |
| 39 | - $bstwbsftwppdtplgns_options = get_option( '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 | + } | |
| 40 | 46 | } |
| 41 | 47 | |
| 42 | 48 | if ( isset( $bstwbsftwppdtplgns_options['bws_menu_version'] ) ) { |
| 43 | 49 | $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version; |
| @@ -73,10 +79,8 @@ | ||
| 73 | 79 | if ( ! function_exists ( 'pdfprnt_init' ) ) { |
| 74 | 80 | function pdfprnt_init() { |
| 75 | 81 | /* Internationalization, first(!) */ |
| 76 | 82 | load_plugin_textdomain( 'pdf-print', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 77 | - /* Function check if plugin is compatible with current WP version */ | |
| 78 | - pdfprnt_version_check(); | |
| 79 | 83 | /* Get/Register and check settings for plugin */ |
| 80 | 84 | if ( ! is_admin() || ( isset( $_GET['page'] ) && "pdf-print.php" == $_GET['page'] ) ) |
| 81 | 85 | pdfprnt_settings(); |
| 82 | 86 | } |
| @@ -89,9 +93,11 @@ | ||
| 89 | 93 | if ( ! $pdfprnt_plugin_info ) |
| 90 | 94 | $pdfprnt_plugin_info = get_plugin_data( __FILE__ ); |
| 91 | 95 | |
| 92 | 96 | if ( ! isset( $bws_plugin_info ) || empty( $bws_plugin_info ) ) |
| 93 | - $bws_plugin_info = array( 'id' => '101', 'version' => $pdfprnt_plugin_info["Version"] ); | |
| 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(); | |
| 94 | 100 | } |
| 95 | 101 | } |
| 96 | 102 | |
| 97 | 103 | /* Register settings for plugin */ |
| @@ -96,9 +102,9 @@ | ||
| 96 | 102 | |
| 97 | 103 | /* Register settings for plugin */ |
| 98 | 104 | if ( ! function_exists( 'pdfprnt_settings' ) ) { |
| 99 | 105 | function pdfprnt_settings() { |
| 100 | - global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $pdfprnt_plugin_info; | |
| 106 | + global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $wpmu, $pdfprnt_plugin_info; | |
| 101 | 107 | |
| 102 | 108 | if ( ! $pdfprnt_plugin_info ) { |
| 103 | 109 | if ( ! function_exists( 'get_plugin_data' ) ) |
| 104 | 110 | require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| @@ -131,13 +137,20 @@ | ||
| 131 | 137 | 'use_types_posts' => $pdfprnt_default_post_types, |
| 132 | 138 | 'show_print_window' => 0 |
| 133 | 139 | ); |
| 134 | 140 | |
| 135 | - if ( ! get_option( 'pdfprnt_options_array' ) ) | |
| 136 | - add_option( 'pdfprnt_options_array', $pdfprnt_options_array_defaults, '', 'yes' ); | |
| 141 | + if ( 1 == $wpmu ) { | |
| 142 | + if ( ! get_site_option( 'pdfprnt_options_array' ) ) | |
| 143 | + add_site_option( 'pdfprnt_options_array', $pdfprnt_options_array_defaults, '', 'yes' ); | |
| 137 | 144 | |
| 138 | - $pdfprnt_options_array = get_option( 'pdfprnt_options_array' ); | |
| 145 | + $pdfprnt_options_array = get_site_option( 'pdfprnt_options_array' ); | |
| 146 | + } else { | |
| 147 | + if ( ! get_option( 'pdfprnt_options_array' ) ) | |
| 148 | + add_option( 'pdfprnt_options_array', $pdfprnt_options_array_defaults, '', 'yes' ); | |
| 139 | 149 | |
| 150 | + $pdfprnt_options_array = get_option( 'pdfprnt_options_array' ); | |
| 151 | + } | |
| 152 | + | |
| 140 | 153 | if ( ! isset( $pdfprnt_options_array['plugin_option_version'] ) || $pdfprnt_options_array['plugin_option_version'] != $pdfprnt_plugin_info["Version"] ) { |
| 141 | 154 | $pdfprnt_options_array = array_merge( $pdfprnt_options_array_defaults, $pdfprnt_options_array ); |
| 142 | 155 | $pdfprnt_options_array['plugin_option_version'] = $pdfprnt_plugin_info["Version"]; |
| 143 | 156 | update_option( 'pdfprnt_options_array', $pdfprnt_options_array ); |
| @@ -148,18 +161,16 @@ | ||
| 148 | 161 | /* Function check if plugin is compatible with current WP version */ |
| 149 | 162 | if ( ! function_exists ( 'pdfprnt_version_check' ) ) { |
| 150 | 163 | function pdfprnt_version_check() { |
| 151 | 164 | global $wp_version, $pdfprnt_plugin_info; |
| 165 | + if ( ! $pdfprnt_plugin_info ) | |
| 166 | + $pdfprnt_plugin_info = get_plugin_data( __FILE__, false ); | |
| 152 | 167 | $require_wp = "3.0"; /* Wordpress at least requires version */ |
| 153 | 168 | $plugin = plugin_basename( __FILE__ ); |
| 154 | 169 | if ( version_compare( $wp_version, $require_wp, "<" ) ) { |
| 155 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
| 156 | 170 | if ( is_plugin_active( $plugin ) ) { |
| 157 | 171 | deactivate_plugins( $plugin ); |
| 158 | - if ( ! $pdfprnt_plugin_info ) | |
| 159 | - $pdfprnt_plugin_info = get_plugin_data( __FILE__ ); | |
| 160 | - $admin_url = ( function_exists( 'get_admin_url' ) ) ? get_admin_url( null, 'plugins.php' ) : esc_url( '/wp-admin/plugins.php' ); | |
| 161 | - 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='" . $admin_url . "'>" . __( 'Plugins page', 'pdf-print') . "</a>." ); | |
| 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>." ); | |
| 162 | 173 | } |
| 163 | 174 | } |
| 164 | 175 | } |
| 165 | 176 | } |
| @@ -176,13 +187,8 @@ | ||
| 176 | 187 | 'bottom-left' => __( 'Bottom Left', 'pdf-print' ), |
| 177 | 188 | 'bottom-right' => __( 'Bottom Right', 'pdf-print' ) |
| 178 | 189 | ); |
| 179 | 190 | |
| 180 | - if ( ! function_exists( 'get_plugins' ) || ! function_exists( 'is_plugin_active_for_network' ) ) | |
| 181 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); | |
| 182 | - $all_plugins = get_plugins(); | |
| 183 | - $active_plugins = get_option( 'active_plugins' ); | |
| 184 | - | |
| 185 | 191 | if ( isset( $_REQUEST['pdfprnt_position'] ) && |
| 186 | 192 | isset( $_REQUEST['pdfprnt_position_search_archive'] ) && |
| 187 | 193 | isset( $_REQUEST['pdfprnt_position_custom'] ) && |
| 188 | 194 | isset( $_REQUEST['pdfprnt_use_theme_stylesheet'] ) && |
| @@ -210,22 +216,28 @@ | ||
| 210 | 216 | $message = __( 'Settings saved.', 'pdf-print' ); |
| 211 | 217 | } |
| 212 | 218 | /* GO PRO */ |
| 213 | 219 | if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) { |
| 220 | + global $wpmu; | |
| 214 | 221 | |
| 215 | - $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? trim( esc_html( $_POST['bws_license_key'] ) ) : ""; | |
| 222 | + $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? trim( $_POST['bws_license_key'] ) : ""; | |
| 216 | 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 | + } | |
| 217 | 233 | |
| 218 | - if ( !get_option( 'bstwbsftwppdtplgns_options' ) ) | |
| 219 | - add_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options_defaults, '', 'yes' ); | |
| 220 | - $bstwbsftwppdtplgns_options = get_option( 'bstwbsftwppdtplgns_options' ); | |
| 221 | - | |
| 222 | 234 | if ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_license_nonce_name' ) ) { |
| 223 | 235 | if ( '' != $bws_license_key ) { |
| 224 | 236 | if ( strlen( $bws_license_key ) != 18 ) { |
| 225 | 237 | $error = __( "Wrong license key", 'pdf-print' ); |
| 226 | 238 | } else { |
| 227 | - $bws_license_plugin = stripslashes( esc_html( $_POST['bws_license_plugin'] ) ); | |
| 239 | + $bws_license_plugin = trim( $_POST['bws_license_plugin'] ); | |
| 228 | 240 | if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] < ( time() + (24 * 60 * 60) ) ) { |
| 229 | 241 | $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1; |
| 230 | 242 | } else { |
| 231 | 243 | $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1; |
| @@ -231,9 +243,16 @@ | ||
| 231 | 243 | $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1; |
| 232 | 244 | $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time(); |
| 233 | 245 | } |
| 234 | 246 | |
| 235 | - /* download Pro */ | |
| 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 | + | |
| 236 | 255 | if ( ! array_key_exists( $bws_license_plugin, $all_plugins ) ) { |
| 237 | 256 | $current = get_site_transient( 'update_plugins' ); |
| 238 | 257 | if ( is_array( $all_plugins ) && !empty( $all_plugins ) && isset( $current ) && is_array( $current->response ) ) { |
| 239 | 258 | $to_send = array(); |
| @@ -260,9 +279,10 @@ | ||
| 260 | 279 | } elseif ( "you_are_banned" == $value->package ) { |
| 261 | 280 | $error = __( "Unfortunately, you have exceeded the number of available tries. Please, upload the plugin manually.", 'pdf-print' ); |
| 262 | 281 | } |
| 263 | 282 | } |
| 264 | - if ( '' == $error ) { | |
| 283 | + if ( '' == $error ) { | |
| 284 | + global $wpmu; | |
| 265 | 285 | $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key; |
| 266 | 286 | |
| 267 | 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'; |
| 268 | 288 | $uploadDir = wp_upload_dir(); |
| @@ -315,16 +335,17 @@ | ||
| 315 | 335 | } else { |
| 316 | 336 | $error = __( "Please, enter Your license key", 'pdf-print' ); |
| 317 | 337 | } |
| 318 | 338 | } |
| 319 | - } ?> | |
| 339 | + } | |
| 340 | + ?> | |
| 320 | 341 | <div class="wrap"> |
| 321 | 342 | <div class="icon32 icon32-bws" id="icon-options-general"></div> |
| 322 | - <h2><?php _e( 'PDF & Print Settings', 'pdf-print' ); ?></h2> | |
| 343 | + <h2><?php echo __( 'PDF & Print Settings', 'pdf-print' ); ?></h2> | |
| 323 | 344 | <h2 class="nav-tab-wrapper"> |
| 324 | 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> |
| 325 | 346 | <a class="nav-tab<?php if ( isset( $_GET['action'] ) && 'extra' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=pdf-print.php&action=extra"><?php _e( 'Extra settings', 'pdf-print' ); ?></a> |
| 326 | - <a class="nav-tab" href="http://bestwebsoft.com/products/pdf-print/faq/" target="_blank"><?php _e( 'FAQ', 'pdf-print' ); ?></a> | |
| 347 | + <a class="nav-tab" href="http://bestwebsoft.com/plugin/pdf-print/#faq" target="_blank"><?php _e( 'FAQ', 'pdf-print' ); ?></a> | |
| 327 | 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&action=go_pro"><?php _e( 'Go PRO', 'pdf-print' ); ?></a> |
| 328 | 349 | </h2> |
| 329 | 350 | <div class="updated fade" <?php if ( empty( $message ) || "" != $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $message; ?></strong></p></div> |
| 330 | 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> |
| @@ -332,9 +353,9 @@ | ||
| 332 | 353 | <?php if ( ! isset( $_GET['action'] ) ) { ?> |
| 333 | 354 | <form method="post" action="admin.php?page=pdf-print.php" id="pdfprnt_settings_form"> |
| 334 | 355 | <table class="form-table pdfprnt_settings_table"> |
| 335 | 356 | <tr> |
| 336 | - <th scope="row"><?php _e( 'Use of theme stylesheet or plugin default style:', 'pdf-print' ); ?></th> | |
| 357 | + <th scope="row"><?php echo __( 'Use of theme stylesheet or plugin default style:', 'pdf-print' ); ?></th> | |
| 337 | 358 | <td> |
| 338 | 359 | <select name="pdfprnt_use_theme_stylesheet"> |
| 339 | 360 | <option value="0" <?php if ( 0 == $pdfprnt_options_array['use_theme_stylesheet'] ) echo 'selected="selected"'; ?>><?php echo __( 'Default stylesheet', 'pdf-print' ); ?></option> |
| 340 | 361 | <option value="1" <?php if ( 1 == $pdfprnt_options_array['use_theme_stylesheet'] ) echo 'selected="selected"'; ?>><?php echo __( 'Current theme stylesheet', 'pdf-print' ); ?></option> |
| @@ -341,9 +362,9 @@ | ||
| 341 | 362 | </select> |
| 342 | 363 | </td> |
| 343 | 364 | </tr> |
| 344 | 365 | <tr> |
| 345 | - <th scope="row"><?php _e( 'The types of posts that the plugin will use:', 'pdf-print' ); ?></th> | |
| 366 | + <th scope="row"><?php echo __( 'The types of posts that the plugin will use:', 'pdf-print' ); ?></th> | |
| 346 | 367 | <td> |
| 347 | 368 | <select name="pdfprnt_use_types_posts[]" multiple="multiple"> |
| 348 | 369 | <?php foreach ( get_post_types( array( 'public' => 1, 'show_ui' => 1 ), 'objects' ) as $key => $value ) : ?> |
| 349 | 370 | <option value="<?php echo $key; ?>" <?php if ( in_array( $key, $pdfprnt_options_array['use_types_posts'] ) ) echo 'selected="selected"'; ?>><?php echo $value->label; ?></option> |
| @@ -350,9 +371,11 @@ | ||
| 350 | 371 | <?php endforeach; ?> |
| 351 | 372 | </select> |
| 352 | 373 | </td> |
| 353 | 374 | </tr> |
| 354 | - <?php if( 0 < count( preg_grep( '/portfolio\/portfolio.php/', $active_plugins ) ) ) : ?> | |
| 375 | + <?php | |
| 376 | + $active_plugins = get_option( 'active_plugins' ); | |
| 377 | + if( 0 < count( preg_grep( '/portfolio\/portfolio.php/', $active_plugins ) ) ) : ?> | |
| 355 | 378 | <tr> |
| 356 | 379 | <th scope="row"></th> |
| 357 | 380 | <td> |
| 358 | 381 | <span class="pdfprnt_explanation"><?php echo __( 'If you are using a Portfolio plugin (powered by bestwebsoft.com) and you need the output pdf and print buttons next to each post, you just need to insert the strings in loop into the template source code in files portfolio.php and portfolio-post.php', 'pdf-print' ) . ' <?php if ( function_exists( \'pdfprnt_show_buttons_for_bws_portfolio_post\' ) ) echo pdfprnt_show_buttons_for_bws_portfolio_post(); ?><br/> ' . __( ' In order to use PDF and Print buttons for all posts you need to put the strings below into the template source code in file portfolio.php', 'pdf-print' ) . ' <?php if ( function_exists( \'pdfprnt_show_buttons_for_bws_portfolio\' ) ) echo pdfprnt_show_buttons_for_bws_portfolio(); ?>'; ?></span> |
| @@ -360,9 +383,9 @@ | ||
| 360 | 383 | </tr> |
| 361 | 384 | <?php endif; ?> |
| 362 | 385 | <tr> |
| 363 | 386 | <th scope="row"> |
| 364 | - <?php _e( 'Position of buttons in content:', 'pdf-print' ); ?> | |
| 387 | + <?php echo __( 'Position of buttons in content:', 'pdf-print' ); ?> | |
| 365 | 388 | </th> |
| 366 | 389 | <td> |
| 367 | 390 | <select name="pdfprnt_position"> |
| 368 | 391 | <?php foreach ( $pdfprnt_positions_values as $key => $value ) : ?> |
| @@ -371,9 +394,9 @@ | ||
| 371 | 394 | </select> |
| 372 | 395 | </td> |
| 373 | 396 | </tr> |
| 374 | 397 | <tr> |
| 375 | - <th scope="row"><?php _e( 'Show:', 'pdf-print' ); ?></th> | |
| 398 | + <th scope="row"><?php echo __( 'Show:', 'pdf-print' ); ?></th> | |
| 376 | 399 | <td> |
| 377 | 400 | <label><input type="checkbox" name="pdfprnt_show_btn_pdf" <?php if ( 1 == $pdfprnt_options_array['show_btn_pdf'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'PDF button', 'pdf-print' ); ?></span></label><br /> |
| 378 | 401 | <label><input type="checkbox" name="pdfprnt_show_btn_print" <?php if ( 1 == $pdfprnt_options_array['show_btn_print'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'Print button', 'pdf-print' ); ?></span></label> |
| 379 | 402 | </td> |
| @@ -379,9 +402,9 @@ | ||
| 379 | 402 | </td> |
| 380 | 403 | </tr> |
| 381 | 404 | <tr> |
| 382 | 405 | <th scope="row"> |
| 383 | - <?php _e( 'Default template setting for post:', 'pdf-print' ); ?> | |
| 406 | + <?php echo __( 'Default template setting for post:', 'pdf-print' ); ?> | |
| 384 | 407 | </th> |
| 385 | 408 | <td> |
| 386 | 409 | <div> |
| 387 | 410 | <label> |
| @@ -404,9 +427,9 @@ | ||
| 404 | 427 | </td> |
| 405 | 428 | </tr> |
| 406 | 429 | <tr> |
| 407 | 430 | <th scope="row"> |
| 408 | - <?php _e( 'Position of buttons in content for custom post:', 'pdf-print' ); ?> | |
| 431 | + <?php echo __( 'Position of buttons in content for custom post:', 'pdf-print' ); ?> | |
| 409 | 432 | </th> |
| 410 | 433 | <td> |
| 411 | 434 | <select name="pdfprnt_position_custom"> |
| 412 | 435 | <option value="pdfprnt-left" <?php if ( 'left' == $pdfprnt_options_array['position_custom'] ) echo 'selected="selected"'; ?>><?php echo __( 'Align Left', 'pdf-print' ); ?></option> |
| @@ -414,9 +437,9 @@ | ||
| 414 | 437 | </select> |
| 415 | 438 | </td> |
| 416 | 439 | </tr> |
| 417 | 440 | <tr> |
| 418 | - <th scope="row"><?php _e( 'Show for custom posts:', 'pdf-print' ); ?></th> | |
| 441 | + <th scope="row"><?php echo __( 'Show for custom posts:', 'pdf-print' ); ?></th> | |
| 419 | 442 | <td> |
| 420 | 443 | <label><input type="checkbox" name="pdfprnt_show_btn_pdf_custom" <?php if ( 1 == $pdfprnt_options_array['show_btn_pdf_custom'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'PDF button', 'pdf-print' ); ?></span></label><br /> |
| 421 | 444 | <label><input type="checkbox" name="pdfprnt_show_btn_print_custom" <?php if ( 1 == $pdfprnt_options_array['show_btn_print_custom'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'Print button', 'pdf-print' ); ?></span></label> |
| 422 | 445 | </td> |
| @@ -422,9 +445,9 @@ | ||
| 422 | 445 | </td> |
| 423 | 446 | </tr> |
| 424 | 447 | <tr> |
| 425 | 448 | <th scope="row"> |
| 426 | - <?php _e( 'Default template setting for custom posts:', 'pdf-print' ); ?> | |
| 449 | + <?php echo __( 'Default template setting for custom posts:', 'pdf-print' ); ?> | |
| 427 | 450 | </th> |
| 428 | 451 | <td> |
| 429 | 452 | <div> |
| 430 | 453 | <label> |
| @@ -453,9 +476,9 @@ | ||
| 453 | 476 | </td> |
| 454 | 477 | </tr> |
| 455 | 478 | <tr> |
| 456 | 479 | <th scope="row"> |
| 457 | - <?php _e( 'Position of buttons on search or archive page:', 'pdf-print' ); ?> | |
| 480 | + <?php echo __( 'Position of buttons on search or archive page:', 'pdf-print' ); ?> | |
| 458 | 481 | </th> |
| 459 | 482 | <td> |
| 460 | 483 | <select name="pdfprnt_position_search_archive"> |
| 461 | 484 | <option value="pdfprnt-left" <?php if ( 'left' == $pdfprnt_options_array['position_search_archive'] ) echo 'selected="selected"'; ?>><?php echo __( 'Align Left', 'pdf-print' ); ?></option> |
| @@ -463,9 +486,9 @@ | ||
| 463 | 486 | </select> |
| 464 | 487 | </td> |
| 465 | 488 | </tr> |
| 466 | 489 | <tr> |
| 467 | - <th scope="row"><?php _e( 'Show for search or archive page:', 'pdf-print' ); ?></th> | |
| 490 | + <th scope="row"><?php echo __( 'Show for search or archive page:', 'pdf-print' ); ?></th> | |
| 468 | 491 | <td> |
| 469 | 492 | <label><input type="checkbox" name="pdfprnt_show_btn_pdf_search_archive" <?php if ( 1 == $pdfprnt_options_array['show_btn_pdf_search_archive'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'PDF button', 'pdf-print' ); ?></span></label><br /> |
| 470 | 493 | <label><input type="checkbox" name="pdfprnt_show_btn_print_search_archive" <?php if ( 1 == $pdfprnt_options_array['show_btn_print_search_archive'] ) echo 'checked="checked"'; ?> /> <span><?php echo __( 'Print button', 'pdf-print' ); ?></span></label> |
| 471 | 494 | </td> |
| @@ -471,9 +494,9 @@ | ||
| 471 | 494 | </td> |
| 472 | 495 | </tr> |
| 473 | 496 | <tr> |
| 474 | 497 | <th scope="row"> |
| 475 | - <?php _e( 'Default template setting for search and archive:', 'pdf-print' ); ?> | |
| 498 | + <?php echo __( 'Default template setting for search and archive:', 'pdf-print' ); ?> | |
| 476 | 499 | </th> |
| 477 | 500 | <td> |
| 478 | 501 | <div> |
| 479 | 502 | <label> |
| @@ -502,18 +525,18 @@ | ||
| 502 | 525 | </td> |
| 503 | 526 | </tr> |
| 504 | 527 | <tr> |
| 505 | 528 | <th scope="row"> |
| 506 | - <?php _e( 'Settings for shorcodes:', 'pdf-print' ); ?> | |
| 529 | + <?php echo __( 'Settings for shorcodes:', 'pdf-print' ); ?> | |
| 507 | 530 | </th> |
| 508 | 531 | <td> |
| 509 | - <label><input type="checkbox" name="pdfprnt_tmpl_shorcode" <?php if ( 1 == $pdfprnt_options_array['tmpl_shorcode'] ) echo 'checked="checked"'; ?> /> <span><?php _e( 'Do!', 'pdf-print' ); ?></span></label> | |
| 532 | + <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> | |
| 510 | 533 | </td> |
| 511 | 534 | </tr> |
| 512 | 535 | <tr> |
| 513 | - <th scope="row"><?php _e( 'Show the print window', 'pdf-print' ); ?></th> | |
| 536 | + <th scope="row"><?php echo __( 'Show the print window', 'pdf-print' ); ?></th> | |
| 514 | 537 | <td> |
| 515 | - <input type="checkbox" name="pdfprnt_show_print_window" <?php if ( 1 == $pdfprnt_options_array['show_print_window'] ) echo 'checked="checked"'; ?> /> | |
| 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 /> | |
| 516 | 539 | </td> |
| 517 | 540 | </tr> |
| 518 | 541 | </table> |
| 519 | 542 | <input type="hidden" name="pdfprnt_form_submit" value="1" /> |
| @@ -569,11 +592,11 @@ | ||
| 569 | 592 | </div> |
| 570 | 593 | <div class="bws_pro_version_tooltip"> |
| 571 | 594 | <div class="bws_info"> |
| 572 | 595 | <?php _e( 'Unlock premium options by upgrading to a PRO version.', 'pdf-print' ); ?> |
| 573 | - <a href="http://bestwebsoft.com/products/pdf-print/?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> | |
| 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> | |
| 574 | 597 | </div> |
| 575 | - <a class="bws_button" href="http://bestwebsoft.com/products/pdf-print/buy/?k=d9da7c9c2046bed8dfa38d005d4bffdb&pn=101&v=<?php echo $pdfprnt_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="PDF & Print Pro"> | |
| 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"> | |
| 576 | 599 | <?php _e( 'Go', 'pdf-print' ); ?> <strong>PRO</strong> |
| 577 | 600 | </a> |
| 578 | 601 | <div class="clear"></div> |
| 579 | 602 | </div> |
| @@ -593,9 +616,9 @@ | ||
| 593 | 616 | <?php } else { ?> |
| 594 | 617 | <form method="post" action="admin.php?page=pdf-print.php&action=go_pro"> |
| 595 | 618 | <p> |
| 596 | 619 | <?php _e( 'You can download and activate', 'pdf-print' ); ?> |
| 597 | - <a href="http://bestwebsoft.com/products/pdf-print/?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> | |
| 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> | |
| 598 | 621 | <?php _e( 'version of this plugin by entering Your license key.', 'pdf-print' ); ?><br /> |
| 599 | 622 | <span style="color: #888888;font-size: 10px;"> |
| 600 | 623 | <?php _e( 'You can find your license key on your personal page Client area, by clicking on the link', 'pdf-print' ); ?> |
| 601 | 624 | <a href="http://bestwebsoft.com/wp-login.php">http://bestwebsoft.com/wp-login.php</a> |
| @@ -630,11 +653,8 @@ | ||
| 630 | 653 | |
| 631 | 654 | /* Positioning buttons in the page */ |
| 632 | 655 | if( ! function_exists( 'pdfprnt_content' ) ) { |
| 633 | 656 | function pdfprnt_content( $content ) { |
| 634 | - if ( is_admin() ) | |
| 635 | - return; | |
| 636 | - | |
| 637 | 657 | global $pdfprnt_options_array, $post; |
| 638 | 658 | if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) // Check for existence the type of posts. |
| 639 | 659 | return $content; |
| 640 | 660 | if ( 1 == $pdfprnt_options_array['show_btn_pdf'] || 1 == $pdfprnt_options_array['show_btn_print'] ) { |
| @@ -854,91 +874,106 @@ | ||
| 854 | 874 | if ( ! function_exists( 'pdfprnt_generate_template' ) ) { |
| 855 | 875 | function pdfprnt_generate_template( $content, $template = false, $isprint = false ) { |
| 856 | 876 | global $pdfprnt_options_array; |
| 857 | 877 | $tmpl = isset( $_GET['tmpl'] ) ? $_GET['tmpl'] : ""; |
| 858 | - ob_start(); /* Starting output buffering */ ?> | |
| 859 | - <html> | |
| 860 | - <head> | |
| 861 | - <?php if ( 1 == $pdfprnt_options_array['use_theme_stylesheet'] ) : ?> | |
| 862 | - <link type="text/css" rel="stylesheet" href="<?php echo get_bloginfo( 'stylesheet_url' ); ?>" media="all" /> | |
| 863 | - <?php else: ?> | |
| 864 | - <link type="text/css" rel="stylesheet" href="<?php echo plugins_url( 'css/default.css', __FILE__ ); ?>" media="all" /> | |
| 865 | - <?php endif; | |
| 866 | - if ( ! $template ) | |
| 867 | - $template = $pdfprnt_options_array['tmpl_post']; | |
| 868 | - switch ( $template ) { /* Using template choosed on settings page */ | |
| 869 | - case 1: /* Allign left template */ ?> | |
| 870 | - <style type="text/css"> | |
| 871 | - h1, h2, h3, h4, h5, h6 { | |
| 872 | - text-align: left; | |
| 873 | - } | |
| 874 | - img { | |
| 875 | - float: right; | |
| 876 | - } | |
| 877 | - </style> | |
| 878 | - <?php break; | |
| 879 | - case 2: /* Allign center template */ ?> | |
| 880 | - <style type="text/css"> | |
| 881 | - h1, h2, h3, h4, h5, h6 { | |
| 882 | - text-align: center; | |
| 883 | - } | |
| 884 | - img { | |
| 885 | - float: left; | |
| 886 | - } | |
| 887 | - </style> | |
| 888 | - <?php break; | |
| 889 | - case 3: /* Allign right template */ ?> | |
| 890 | - <style type="text/css"> | |
| 891 | - h1, h2, h3, h4, h5, h6 { | |
| 892 | - text-align: right; | |
| 893 | - } | |
| 894 | - img { | |
| 895 | - float: left; | |
| 896 | - } | |
| 897 | - </style> | |
| 898 | - <?php break; | |
| 899 | - } | |
| 900 | - switch ( $tmpl ) { /* If got something by GET (from admin bar) */ | |
| 901 | - case 1: /* Allign left template */ ?> | |
| 902 | - <style type="text/css"> | |
| 903 | - h1, h2, h3, h4, h5, h6 { | |
| 904 | - text-align: left; | |
| 905 | - } | |
| 906 | - img { | |
| 907 | - float: right; | |
| 908 | - } | |
| 909 | - </style> | |
| 910 | - <?php break; | |
| 911 | - case 2: /* Allign center template */ ?> | |
| 912 | - <style type="text/css"> | |
| 913 | - h1, h2, h3, h4, h5, h6 { | |
| 914 | - text-align: center; | |
| 915 | - } | |
| 916 | - img { | |
| 917 | - float: left; | |
| 918 | - } | |
| 919 | - </style> | |
| 920 | - <?php break; | |
| 921 | - case 3: /* Allign right template */ ?> | |
| 922 | - <style type="text/css"> | |
| 923 | - h1, h2, h3, h4, h5, h6 { | |
| 924 | - text-align: right; | |
| 925 | - } | |
| 926 | - img { | |
| 927 | - float: left; | |
| 928 | - } | |
| 929 | - </style> | |
| 930 | - <?php break; | |
| 931 | - } | |
| 932 | - if ( $isprint && 1 == $pdfprnt_options_array['show_print_window'] ) { | |
| 933 | - echo '<script>window.onload = function(){ window.print(); };</script>'; | |
| 934 | - } ?> | |
| 935 | - </head> | |
| 936 | - <body> | |
| 937 | - <?php echo $content; ?> | |
| 938 | - </body> | |
| 939 | - </html> | |
| 940 | - <?php $html = ob_get_contents(); /* Getting output buffering */ | |
| 878 | + ob_start(); /* Starting output buffering */ | |
| 879 | + ?> | |
| 880 | + <html> | |
| 881 | + <head> | |
| 882 | + <?php if ( 1 == $pdfprnt_options_array['use_theme_stylesheet'] ) : ?> | |
| 883 | + <link type="text/css" rel="stylesheet" href="<?php echo get_bloginfo( 'stylesheet_url' ); ?>" media="all" /> | |
| 884 | + <?php else: ?> | |
| 885 | + <link type="text/css" rel="stylesheet" href="<?php echo plugins_url( 'css/default.css', __FILE__ ); ?>" media="all" /> | |
| 886 | + <?php endif; | |
| 887 | + if ( ! $template ) | |
| 888 | + $template = $pdfprnt_options_array['tmpl_post']; | |
| 889 | + switch ( $template ) { /* Using template choosed on settings page */ | |
| 890 | + case 1: /* Allign left template */ | |
| 891 | + ?> | |
| 892 | + <style type="text/css"> | |
| 893 | + h1, h2, h3, h4, h5, h6 { | |
| 894 | + text-align: left; | |
| 895 | + } | |
| 896 | + img { | |
| 897 | + float: right; | |
| 898 | + } | |
| 899 | + </style> | |
| 900 | + <?php | |
| 901 | + break; | |
| 902 | + case 2: /* Allign center template */ | |
| 903 | + ?> | |
| 904 | + <style type="text/css"> | |
| 905 | + h1, h2, h3, h4, h5, h6 { | |
| 906 | + text-align: center; | |
| 907 | + } | |
| 908 | + img { | |
| 909 | + float: left; | |
| 910 | + } | |
| 911 | + </style> | |
| 912 | + <?php | |
| 913 | + break; | |
| 914 | + case 3: /* Allign right template */ | |
| 915 | + ?> | |
| 916 | + <style type="text/css"> | |
| 917 | + h1, h2, h3, h4, h5, h6 { | |
| 918 | + text-align: right; | |
| 919 | + } | |
| 920 | + img { | |
| 921 | + float: left; | |
| 922 | + } | |
| 923 | + </style> | |
| 924 | + <?php | |
| 925 | + break; | |
| 926 | + } | |
| 927 | + switch ( $tmpl ) { /* If got something by GET (from admin bar) */ | |
| 928 | + case 1: /* Allign left template */ | |
| 929 | + ?> | |
| 930 | + <style type="text/css"> | |
| 931 | + h1, h2, h3, h4, h5, h6 { | |
| 932 | + text-align: left; | |
| 933 | + } | |
| 934 | + img { | |
| 935 | + float: right; | |
| 936 | + } | |
| 937 | + </style> | |
| 938 | + <?php | |
| 939 | + break; | |
| 940 | + case 2: /* Allign center template */ | |
| 941 | + ?> | |
| 942 | + <style type="text/css"> | |
| 943 | + h1, h2, h3, h4, h5, h6 { | |
| 944 | + text-align: center; | |
| 945 | + } | |
| 946 | + img { | |
| 947 | + float: left; | |
| 948 | + } | |
| 949 | + </style> | |
| 950 | + <?php | |
| 951 | + break; | |
| 952 | + case 3: /* Allign right template */ | |
| 953 | + ?> | |
| 954 | + <style type="text/css"> | |
| 955 | + h1, h2, h3, h4, h5, h6 { | |
| 956 | + text-align: right; | |
| 957 | + } | |
| 958 | + img { | |
| 959 | + float: left; | |
| 960 | + } | |
| 961 | + </style> | |
| 962 | + <?php break; | |
| 963 | + } | |
| 964 | + if ( $isprint ) : ?> | |
| 965 | + <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 | + <?php endif; ?> | |
| 969 | + </head> | |
| 970 | + <body> | |
| 971 | + <?php echo $content; ?> | |
| 972 | + </body> | |
| 973 | + </html> | |
| 974 | + <?php | |
| 975 | + $html = ob_get_contents(); /* Getting output buffering */ | |
| 941 | 976 | ob_end_clean(); /* Closing output buffering */ |
| 942 | 977 | return $html; /* Now we done with template */ |
| 943 | 978 | } |
| 944 | 979 | } |
| @@ -949,9 +984,9 @@ | ||
| 949 | 984 | ob_start(); /* Starting output buffering */ |
| 950 | 985 | $portfolio_options = get_option( 'prtfl_options' ); |
| 951 | 986 | $meta_values = get_post_custom( $post->ID ); |
| 952 | 987 | $post_thumbnail_id = get_post_thumbnail_id( $post->ID ); |
| 953 | - if ( empty ( $post_thumbnail_id ) ) { | |
| 988 | + if( empty ( $post_thumbnail_id ) ) { | |
| 954 | 989 | $args = array( |
| 955 | 990 | 'post_parent' => $post->ID, |
| 956 | 991 | 'post_type' => 'attachment', |
| 957 | 992 | 'post_mime_type' => 'image', |
| @@ -1344,9 +1379,8 @@ | ||
| 1344 | 1379 | function pdfprnt_plugin_banner() { |
| 1345 | 1380 | global $hook_suffix, $pdfprnt_plugin_info; |
| 1346 | 1381 | if ( 'plugins.php' == $hook_suffix ) { |
| 1347 | 1382 | $banner_array = array( |
| 1348 | - array( 'lmtttmpts_hide_banner_on_plugin_page', 'limit-attempts/limit-attempts.php', '1.0.2' ), | |
| 1349 | 1383 | array( 'sndr_hide_banner_on_plugin_page', 'sender/sender.php', '0.5' ), |
| 1350 | 1384 | array( 'srrl_hide_banner_on_plugin_page', 'user-role/user-role.php', '1.4' ), |
| 1351 | 1385 | array( 'pdtr_hide_banner_on_plugin_page', 'updater/updater.php', '1.12' ), |
| 1352 | 1386 | array( 'cntctfrmtdb_hide_banner_on_plugin_page', 'contact-form-to-db/contact_form_to_db.php', '1.2' ), |
| @@ -1396,9 +1430,9 @@ | ||
| 1396 | 1430 | <div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
| 1397 | 1431 | <div class="pdfprnt_message bws_banner_on_plugin_page" style="display: none;"> |
| 1398 | 1432 | <img class="pdfprnt_close_icon close_icon" title="" src="<?php echo plugins_url( 'images/close_banner.png', __FILE__ ); ?>" alt=""/> |
| 1399 | 1433 | <div class="button_div"> |
| 1400 | - <a class="button" target="_blank" href="http://bestwebsoft.com/products/pdf-print/?k=e2f2549f4d70bc4cb9b48071169d264e&pn=101&v=<?php echo $pdfprnt_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>"><?php _e( "Learn More", 'pdf-print' ); ?></a> | |
| 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> | |
| 1401 | 1435 | </div> |
| 1402 | 1436 | <div class="text"> |
| 1403 | 1437 | <?php _e( "It's time to upgrade your <strong>PDF & Print</strong> to <strong>PRO</strong> version", 'pdf-print' ); ?>!<br /> |
| 1404 | 1438 | <span><?php _e( 'Extend standard plugin functionality with new great options', 'pdf-print' ); ?>.</span> |
| @@ -1421,8 +1455,9 @@ | ||
| 1421 | 1455 | /* Deleting plugin options on uninstalling */ |
| 1422 | 1456 | if ( ! function_exists( 'pdfprnt_uninstall' ) ) { |
| 1423 | 1457 | function pdfprnt_uninstall() { |
| 1424 | 1458 | delete_option( 'pdfprnt_options_array' ); |
| 1459 | + delete_site_option( 'pdfprnt_options_array' ); | |
| 1425 | 1460 | } |
| 1426 | 1461 | } |
| 1427 | 1462 | |
| 1428 | 1463 | /* Adding function to output PDF document or pirnt page */ |