| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: PDF & Print |
| 4 |
Plugin URI: http://bestwebsoft.com/products/ |
| 5 |
Description: Plugin adds PDF creation and Print button on your site. |
| 6 |
Author: BestWebSoft |
| 7 |
Version: 1.7.6 |
| 8 |
Author URI: http://bestwebsoft.com/ |
| 9 |
License: GPLv2 or later |
| 10 |
*/ |
| 11 |
|
| 12 |
/* © Copyright 2014 BestWebSoft ( http://support.bestwebsoft.com ) |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License, version 2, as |
| 16 |
published by the Free Software Foundation. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, |
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
GNU General Public License for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with this program; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 |
*/ |
| 27 |
|
| 28 |
/* Add our own menu */ |
| 29 |
if ( ! function_exists( 'pdfprnt_add_pages' ) ) { |
| 30 |
function pdfprnt_add_pages() { |
| 31 |
global $bstwbsftwppdtplgns_options, $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 ( ! get_option( 'bstwbsftwppdtplgns_options' ) ) |
| 38 |
add_option( 'bstwbsftwppdtplgns_options', array(), '', 'yes' ); |
| 39 |
$bstwbsftwppdtplgns_options = get_option( 'bstwbsftwppdtplgns_options' ); |
| 40 |
} |
| 41 |
|
| 42 |
if ( isset( $bstwbsftwppdtplgns_options['bws_menu_version'] ) ) { |
| 43 |
$bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version; |
| 44 |
unset( $bstwbsftwppdtplgns_options['bws_menu_version'] ); |
| 45 |
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes' ); |
| 46 |
require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' ); |
| 47 |
} else if ( ! isset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] ) || $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] < $bws_menu_version ) { |
| 48 |
$bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version; |
| 49 |
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes' ); |
| 50 |
require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' ); |
| 51 |
} else if ( ! isset( $bstwbsftwppdtplgns_added_menu ) ) { |
| 52 |
$plugin_with_newer_menu = $base; |
| 53 |
foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value ) { |
| 54 |
if ( $bws_menu_version < $value && is_plugin_active( $base ) ) { |
| 55 |
$plugin_with_newer_menu = $key; |
| 56 |
} |
| 57 |
} |
| 58 |
$plugin_with_newer_menu = explode( '/', $plugin_with_newer_menu ); |
| 59 |
$wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? basename( WP_CONTENT_DIR ) : 'wp-content'; |
| 60 |
if ( file_exists( ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php' ) ) |
| 61 |
require_once( ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php' ); |
| 62 |
else |
| 63 |
require_once( dirname( __FILE__ ) . '/bws_menu/bws_menu.php' ); |
| 64 |
$bstwbsftwppdtplgns_added_menu = true; |
| 65 |
} |
| 66 |
|
| 67 |
add_menu_page( 'BWS Plugins', 'BWS Plugins', 'manage_options', 'bws_plugins', 'bws_add_menu_render', plugins_url( 'images/px.png', __FILE__ ), 1001 ); |
| 68 |
add_submenu_page( 'bws_plugins', __( 'PDF & Print Settings', 'pdf-print' ), __( 'PDF & Print', 'pdf-print' ), 'manage_options', "pdf-print.php", 'pdfprnt_settings_page' ); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
/* Init plugin */ |
| 73 |
if ( ! function_exists ( 'pdfprnt_init' ) ) { |
| 74 |
function pdfprnt_init() { |
| 75 |
/* Internationalization, first(!) */ |
| 76 |
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 |
/* Get/Register and check settings for plugin */ |
| 80 |
if ( ! is_admin() || ( isset( $_GET['page'] ) && "pdf-print.php" == $_GET['page'] ) ) |
| 81 |
pdfprnt_settings(); |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
if ( ! function_exists( 'pdfprnt_admin_init' ) ) { |
| 86 |
function pdfprnt_admin_init() { |
| 87 |
global $bws_plugin_info, $pdfprnt_plugin_info; |
| 88 |
|
| 89 |
if ( ! $pdfprnt_plugin_info ) |
| 90 |
$pdfprnt_plugin_info = get_plugin_data( __FILE__ ); |
| 91 |
|
| 92 |
if ( ! isset( $bws_plugin_info ) || empty( $bws_plugin_info ) ) |
| 93 |
$bws_plugin_info = array( 'id' => '101', 'version' => $pdfprnt_plugin_info["Version"] ); |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
/* Register settings for plugin */ |
| 98 |
if ( ! function_exists( 'pdfprnt_settings' ) ) { |
| 99 |
function pdfprnt_settings() { |
| 100 |
global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $pdfprnt_plugin_info; |
| 101 |
|
| 102 |
if ( ! $pdfprnt_plugin_info ) { |
| 103 |
if ( ! function_exists( 'get_plugin_data' ) ) |
| 104 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 105 |
$pdfprnt_plugin_info = get_plugin_data( __FILE__ ); |
| 106 |
} |
| 107 |
|
| 108 |
/* Variable to verify performance number of once function. */ |
| 109 |
$pdfprnt_output_count_buttons = 0; |
| 110 |
$pdfprnt_default_post_types = array(); |
| 111 |
/* Default post types of WordPress. */ |
| 112 |
foreach ( get_post_types( array( 'public' => 1, 'show_ui' => 1, '_builtin' => true ), 'names' ) as $value ) |
| 113 |
$pdfprnt_default_post_types[] = $value; |
| 114 |
|
| 115 |
$pdfprnt_options_array_defaults = array( |
| 116 |
'plugin_option_version' => $pdfprnt_plugin_info["Version"], |
| 117 |
'position' => 'top-right', |
| 118 |
'position_search_archive' => 'left', |
| 119 |
'position_custom' => 'left', |
| 120 |
'show_btn_print' => 1, |
| 121 |
'show_btn_pdf' => 1, |
| 122 |
'show_btn_print_search_archive' => 1, |
| 123 |
'show_btn_pdf_search_archive' => 1, |
| 124 |
'show_btn_print_custom' => 1, |
| 125 |
'show_btn_pdf_custom' => 1, |
| 126 |
'use_theme_stylesheet' => 0, |
| 127 |
'tmpl_post' => 1, |
| 128 |
'tmpl_search' => 1, |
| 129 |
'tmpl_custom' => 1, |
| 130 |
'tmpl_shorcode' => 1, |
| 131 |
'use_types_posts' => $pdfprnt_default_post_types, |
| 132 |
'show_print_window' => 0 |
| 133 |
); |
| 134 |
|
| 135 |
if ( ! get_option( 'pdfprnt_options_array' ) ) |
| 136 |
add_option( 'pdfprnt_options_array', $pdfprnt_options_array_defaults, '', 'yes' ); |
| 137 |
|
| 138 |
$pdfprnt_options_array = get_option( 'pdfprnt_options_array' ); |
| 139 |
|
| 140 |
if ( ! isset( $pdfprnt_options_array['plugin_option_version'] ) || $pdfprnt_options_array['plugin_option_version'] != $pdfprnt_plugin_info["Version"] ) { |
| 141 |
$pdfprnt_options_array = array_merge( $pdfprnt_options_array_defaults, $pdfprnt_options_array ); |
| 142 |
$pdfprnt_options_array['plugin_option_version'] = $pdfprnt_plugin_info["Version"]; |
| 143 |
update_option( 'pdfprnt_options_array', $pdfprnt_options_array ); |
| 144 |
} |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
/* Function check if plugin is compatible with current WP version */ |
| 149 |
if ( ! function_exists ( 'pdfprnt_version_check' ) ) { |
| 150 |
function pdfprnt_version_check() { |
| 151 |
global $wp_version, $pdfprnt_plugin_info; |
| 152 |
$require_wp = "3.0"; /* Wordpress at least requires version */ |
| 153 |
$plugin = plugin_basename( __FILE__ ); |
| 154 |
if ( version_compare( $wp_version, $require_wp, "<" ) ) { |
| 155 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 156 |
if ( is_plugin_active( $plugin ) ) { |
| 157 |
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>." ); |
| 162 |
} |
| 163 |
} |
| 164 |
} |
| 165 |
} |
| 166 |
|
| 167 |
/* Add admin page */ |
| 168 |
if ( ! function_exists ( 'pdfprnt_settings_page' ) ) { |
| 169 |
function pdfprnt_settings_page () { |
| 170 |
global $pdfprnt_options_array, $wp_version, $pdfprnt_plugin_info; |
| 171 |
$message = $error = ""; |
| 172 |
|
| 173 |
$pdfprnt_positions_values = array( |
| 174 |
'top-left' => __( 'Top Left', 'pdf-print' ), |
| 175 |
'top-right' => __( 'Top Right', 'pdf-print' ), |
| 176 |
'bottom-left' => __( 'Bottom Left', 'pdf-print' ), |
| 177 |
'bottom-right' => __( 'Bottom Right', 'pdf-print' ) |
| 178 |
); |
| 179 |
|
| 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 |
if ( isset( $_REQUEST['pdfprnt_position'] ) && |
| 186 |
isset( $_REQUEST['pdfprnt_position_search_archive'] ) && |
| 187 |
isset( $_REQUEST['pdfprnt_position_custom'] ) && |
| 188 |
isset( $_REQUEST['pdfprnt_use_theme_stylesheet'] ) && |
| 189 |
isset( $_REQUEST['pdfprnt_tmpl_post'] ) && |
| 190 |
isset( $_REQUEST['pdfprnt_tmpl_custom'] ) && |
| 191 |
isset( $_REQUEST['pdfprnt_tmpl_search'] ) && |
| 192 |
check_admin_referer( plugin_basename( __FILE__ ), 'pdfprnt_nonce_name' ) ) { |
| 193 |
$pdfprnt_options_array['position'] = $_REQUEST['pdfprnt_position']; |
| 194 |
$pdfprnt_options_array['position_search_archive'] = $_REQUEST['pdfprnt_position_search_archive']; |
| 195 |
$pdfprnt_options_array['position_custom'] = $_REQUEST['pdfprnt_position_custom']; |
| 196 |
$pdfprnt_options_array['tmpl_post'] = $_REQUEST['pdfprnt_tmpl_post']; |
| 197 |
$pdfprnt_options_array['tmpl_search'] = $_REQUEST['pdfprnt_tmpl_search']; |
| 198 |
$pdfprnt_options_array['tmpl_custom'] = $_REQUEST['pdfprnt_tmpl_custom']; |
| 199 |
$pdfprnt_options_array['use_theme_stylesheet'] = $_REQUEST['pdfprnt_use_theme_stylesheet']; |
| 200 |
$pdfprnt_options_array['show_btn_pdf'] = isset( $_REQUEST['pdfprnt_show_btn_pdf'] ) ? 1 : 0; |
| 201 |
$pdfprnt_options_array['show_btn_print'] = isset( $_REQUEST['pdfprnt_show_btn_print'] ) ? 1 : 0; |
| 202 |
$pdfprnt_options_array['show_btn_pdf_search_archive'] = isset( $_REQUEST['pdfprnt_show_btn_pdf_search_archive'] ) ? 1 : 0; |
| 203 |
$pdfprnt_options_array['show_btn_print_search_archive'] = isset( $_REQUEST['pdfprnt_show_btn_print_search_archive'] ) ? 1 : 0; |
| 204 |
$pdfprnt_options_array['show_btn_pdf_custom'] = isset( $_REQUEST['pdfprnt_show_btn_pdf_custom'] ) ? 1 : 0; |
| 205 |
$pdfprnt_options_array['show_btn_print_custom'] = isset( $_REQUEST['pdfprnt_show_btn_print_custom'] ) ? 1 : 0; |
| 206 |
$pdfprnt_options_array['tmpl_shorcode'] = isset( $_REQUEST['pdfprnt_tmpl_shorcode'] ) ? 1 : 0; |
| 207 |
$pdfprnt_options_array['show_print_window'] = isset( $_REQUEST['pdfprnt_show_print_window'] ) ? 1 : 0; |
| 208 |
$pdfprnt_options_array['use_types_posts'] = isset( $_REQUEST['pdfprnt_use_types_posts'] ) ? $_REQUEST['pdfprnt_use_types_posts'] : array(); |
| 209 |
update_option ( 'pdfprnt_options_array', $pdfprnt_options_array ); |
| 210 |
$message = __( 'Settings saved.', 'pdf-print' ); |
| 211 |
} |
| 212 |
/* GO PRO */ |
| 213 |
if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) { |
| 214 |
|
| 215 |
$bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? trim( esc_html( $_POST['bws_license_key'] ) ) : ""; |
| 216 |
$bstwbsftwppdtplgns_options_defaults = array(); |
| 217 |
|
| 218 |
if ( !get_option( 'bstwbsftwppdtplgns_options' ) ) |
| 219 |
add_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options_defaults, '', 'yes' ); |
| 220 |
$bstwbsftwppdtplgns_options = get_option( 'bstwbsftwppdtplgns_options' ); |
| 221 |
|
| 222 |
if ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'bws_license_nonce_name' ) ) { |
| 223 |
if ( '' != $bws_license_key ) { |
| 224 |
if ( strlen( $bws_license_key ) != 18 ) { |
| 225 |
$error = __( "Wrong license key", 'pdf-print' ); |
| 226 |
} else { |
| 227 |
$bws_license_plugin = stripslashes( esc_html( $_POST['bws_license_plugin'] ) ); |
| 228 |
if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] < ( time() + (24 * 60 * 60) ) ) { |
| 229 |
$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1; |
| 230 |
} else { |
| 231 |
$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1; |
| 232 |
$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time(); |
| 233 |
} |
| 234 |
|
| 235 |
/* download Pro */ |
| 236 |
if ( ! array_key_exists( $bws_license_plugin, $all_plugins ) ) { |
| 237 |
$current = get_site_transient( 'update_plugins' ); |
| 238 |
if ( is_array( $all_plugins ) && !empty( $all_plugins ) && isset( $current ) && is_array( $current->response ) ) { |
| 239 |
$to_send = array(); |
| 240 |
$to_send["plugins"][ $bws_license_plugin ] = array(); |
| 241 |
$to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key; |
| 242 |
$to_send["plugins"][ $bws_license_plugin ]["bws_illegal_client"] = true; |
| 243 |
$options = array( |
| 244 |
'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ), |
| 245 |
'body' => array( 'plugins' => serialize( $to_send ) ), |
| 246 |
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); |
| 247 |
$raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options ); |
| 248 |
|
| 249 |
if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) { |
| 250 |
$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' ); |
| 251 |
} else { |
| 252 |
$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) ); |
| 253 |
|
| 254 |
if ( is_array( $response ) && !empty( $response ) ) { |
| 255 |
foreach ( $response as $key => $value ) { |
| 256 |
if ( "wrong_license_key" == $value->package ) { |
| 257 |
$error = __( "Wrong license key", 'pdf-print' ); |
| 258 |
} elseif ( "wrong_domain" == $value->package ) { |
| 259 |
$error = __( "This license key is bind to another site", 'pdf-print' ); |
| 260 |
} elseif ( "you_are_banned" == $value->package ) { |
| 261 |
$error = __( "Unfortunately, you have exceeded the number of available tries. Please, upload the plugin manually.", 'pdf-print' ); |
| 262 |
} |
| 263 |
} |
| 264 |
if ( '' == $error ) { |
| 265 |
$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key; |
| 266 |
|
| 267 |
$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 |
$uploadDir = wp_upload_dir(); |
| 269 |
$zip_name = explode( '/', $bws_license_plugin ); |
| 270 |
if ( file_put_contents( $uploadDir["path"] . "/" . $zip_name[0] . ".zip", file_get_contents( $url ) ) ) { |
| 271 |
@chmod( $uploadDir["path"] . "/" . $zip_name[0] . ".zip", octdec( 755 ) ); |
| 272 |
if ( class_exists( 'ZipArchive' ) ) { |
| 273 |
$zip = new ZipArchive(); |
| 274 |
if ( $zip->open( $uploadDir["path"] . "/" . $zip_name[0] . ".zip" ) === TRUE ) { |
| 275 |
$zip->extractTo( WP_PLUGIN_DIR ); |
| 276 |
$zip->close(); |
| 277 |
} else { |
| 278 |
$error = __( "Failed to open the zip archive. Please, upload the plugin manually", 'pdf-print' ); |
| 279 |
} |
| 280 |
} elseif ( class_exists( 'Phar' ) ) { |
| 281 |
$phar = new PharData( $uploadDir["path"] . "/" . $zip_name[0] . ".zip" ); |
| 282 |
$phar->extractTo( WP_PLUGIN_DIR ); |
| 283 |
} else { |
| 284 |
$error = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually", 'pdf-print' ); |
| 285 |
} |
| 286 |
@unlink( $uploadDir["path"] . "/" . $zip_name[0] . ".zip" ); |
| 287 |
} else { |
| 288 |
$error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'pdf-print' ); |
| 289 |
} |
| 290 |
|
| 291 |
/* activate Pro */ |
| 292 |
if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) { |
| 293 |
array_push( $active_plugins, $bws_license_plugin ); |
| 294 |
update_option( 'active_plugins', $active_plugins ); |
| 295 |
$pro_plugin_is_activated = true; |
| 296 |
} elseif ( '' == $error ) { |
| 297 |
$error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'pdf-print' ); |
| 298 |
} |
| 299 |
} |
| 300 |
} else { |
| 301 |
$error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvienience.", 'pdf-print' ); |
| 302 |
} |
| 303 |
} |
| 304 |
} |
| 305 |
} else { |
| 306 |
/* activate Pro */ |
| 307 |
if ( ! ( in_array( $bws_license_plugin, $active_plugins ) || is_plugin_active_for_network( $bws_license_plugin ) ) ) { |
| 308 |
array_push( $active_plugins, $bws_license_plugin ); |
| 309 |
update_option( 'active_plugins', $active_plugins ); |
| 310 |
$pro_plugin_is_activated = true; |
| 311 |
} |
| 312 |
} |
| 313 |
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes' ); |
| 314 |
} |
| 315 |
} else { |
| 316 |
$error = __( "Please, enter Your license key", 'pdf-print' ); |
| 317 |
} |
| 318 |
} |
| 319 |
} ?> |
| 320 |
<div class="wrap"> |
| 321 |
<div class="icon32 icon32-bws" id="icon-options-general"></div> |
| 322 |
<h2><?php _e( 'PDF & Print Settings', 'pdf-print' ); ?></h2> |
| 323 |
<h2 class="nav-tab-wrapper"> |
| 324 |
<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 |
<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> |
| 327 |
<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 |
</h2> |
| 329 |
<div class="updated fade" <?php if ( empty( $message ) || "" != $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $message; ?></strong></p></div> |
| 330 |
<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> |
| 331 |
<div class="error" <?php if ( "" == $error ) echo "style=\"display:none\""; ?>><p><strong><?php echo $error; ?></strong></p></div> |
| 332 |
<?php if ( ! isset( $_GET['action'] ) ) { ?> |
| 333 |
<form method="post" action="admin.php?page=pdf-print.php" id="pdfprnt_settings_form"> |
| 334 |
<table class="form-table pdfprnt_settings_table"> |
| 335 |
<tr> |
| 336 |
<th scope="row"><?php _e( 'Use of theme stylesheet or plugin default style:', 'pdf-print' ); ?></th> |
| 337 |
<td> |
| 338 |
<select name="pdfprnt_use_theme_stylesheet"> |
| 339 |
<option value="0" <?php if ( 0 == $pdfprnt_options_array['use_theme_stylesheet'] ) echo 'selected="selected"'; ?>><?php echo __( 'Default stylesheet', 'pdf-print' ); ?></option> |
| 340 |
<option value="1" <?php if ( 1 == $pdfprnt_options_array['use_theme_stylesheet'] ) echo 'selected="selected"'; ?>><?php echo __( 'Current theme stylesheet', 'pdf-print' ); ?></option> |
| 341 |
</select> |
| 342 |
</td> |
| 343 |
</tr> |
| 344 |
<tr> |
| 345 |
<th scope="row"><?php _e( 'The types of posts that the plugin will use:', 'pdf-print' ); ?></th> |
| 346 |
<td> |
| 347 |
<select name="pdfprnt_use_types_posts[]" multiple="multiple"> |
| 348 |
<?php foreach ( get_post_types( array( 'public' => 1, 'show_ui' => 1 ), 'objects' ) as $key => $value ) : ?> |
| 349 |
<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 |
<?php endforeach; ?> |
| 351 |
</select> |
| 352 |
</td> |
| 353 |
</tr> |
| 354 |
<?php if( 0 < count( preg_grep( '/portfolio\/portfolio.php/', $active_plugins ) ) ) : ?> |
| 355 |
<tr> |
| 356 |
<th scope="row"></th> |
| 357 |
<td> |
| 358 |
<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> |
| 359 |
</td> |
| 360 |
</tr> |
| 361 |
<?php endif; ?> |
| 362 |
<tr> |
| 363 |
<th scope="row"> |
| 364 |
<?php _e( 'Position of buttons in content:', 'pdf-print' ); ?> |
| 365 |
</th> |
| 366 |
<td> |
| 367 |
<select name="pdfprnt_position"> |
| 368 |
<?php foreach ( $pdfprnt_positions_values as $key => $value ) : ?> |
| 369 |
<option value="<?php echo $key; ?>" <?php if ( $pdfprnt_options_array['position'] == $key ) echo 'selected="selected"'; ?>><?php echo $value; ?></option> |
| 370 |
<?php endforeach; ?> |
| 371 |
</select> |
| 372 |
</td> |
| 373 |
</tr> |
| 374 |
<tr> |
| 375 |
<th scope="row"><?php _e( 'Show:', 'pdf-print' ); ?></th> |
| 376 |
<td> |
| 377 |
<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 |
<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 |
</td> |
| 380 |
</tr> |
| 381 |
<tr> |
| 382 |
<th scope="row"> |
| 383 |
<?php _e( 'Default template setting for post:', 'pdf-print' ); ?> |
| 384 |
</th> |
| 385 |
<td> |
| 386 |
<div> |
| 387 |
<label> |
| 388 |
<img src="<?php echo plugins_url( 'images/template_left.jpg', __FILE__ ); ?>" alt="template_left" /> |
| 389 |
<input type="radio" name="pdfprnt_tmpl_post" value="1" <?php if ( 1 == $pdfprnt_options_array['tmpl_post'] ) echo 'checked="checked"'; ?> /> |
| 390 |
</label> |
| 391 |
</div> |
| 392 |
<div> |
| 393 |
<label> |
| 394 |
<img src="<?php echo plugins_url( 'images/template_center.jpg', __FILE__ ); ?>" alt="template_center" /> |
| 395 |
<input type="radio" name="pdfprnt_tmpl_post" value="2" <?php if ( 2 == $pdfprnt_options_array['tmpl_post'] ) echo 'checked="checked"'; ?> /> |
| 396 |
</label> |
| 397 |
</div> |
| 398 |
<div> |
| 399 |
<label> |
| 400 |
<img src="<?php echo plugins_url( 'images/template_right.jpg', __FILE__ ); ?>" alt="template_right" /> |
| 401 |
<input type="radio" name="pdfprnt_tmpl_post" value="3" <?php if ( 3 == $pdfprnt_options_array['tmpl_post'] ) echo 'checked="checked"'; ?> /> |
| 402 |
</label> |
| 403 |
</div> |
| 404 |
</td> |
| 405 |
</tr> |
| 406 |
<tr> |
| 407 |
<th scope="row"> |
| 408 |
<?php _e( 'Position of buttons in content for custom post:', 'pdf-print' ); ?> |
| 409 |
</th> |
| 410 |
<td> |
| 411 |
<select name="pdfprnt_position_custom"> |
| 412 |
<option value="pdfprnt-left" <?php if ( 'left' == $pdfprnt_options_array['position_custom'] ) echo 'selected="selected"'; ?>><?php echo __( 'Align Left', 'pdf-print' ); ?></option> |
| 413 |
<option value="pdfprnt-right" <?php if ( 'right' == $pdfprnt_options_array['position_custom'] ) echo 'selected="selected"'; ?>><?php echo __( 'Align Right', 'pdf-print' ); ?></option> |
| 414 |
</select> |
| 415 |
</td> |
| 416 |
</tr> |
| 417 |
<tr> |
| 418 |
<th scope="row"><?php _e( 'Show for custom posts:', 'pdf-print' ); ?></th> |
| 419 |
<td> |
| 420 |
<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 |
<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 |
</td> |
| 423 |
</tr> |
| 424 |
<tr> |
| 425 |
<th scope="row"> |
| 426 |
<?php _e( 'Default template setting for custom posts:', 'pdf-print' ); ?> |
| 427 |
</th> |
| 428 |
<td> |
| 429 |
<div> |
| 430 |
<label> |
| 431 |
<img src="<?php echo plugins_url( 'images/template_left.jpg', __FILE__ ); ?>" alt="template_left" /> |
| 432 |
<input type="radio" name="pdfprnt_tmpl_custom" value="1" <?php if ( 1 == $pdfprnt_options_array['tmpl_custom'] ) echo 'checked="checked"'; ?> /> |
| 433 |
</label> |
| 434 |
</div> |
| 435 |
<div> |
| 436 |
<label> |
| 437 |
<img src="<?php echo plugins_url( 'images/template_center.jpg', __FILE__ ); ?>" alt="template_center" /> |
| 438 |
<input type="radio" name="pdfprnt_tmpl_custom" value="2" <?php if ( 2 == $pdfprnt_options_array['tmpl_custom'] ) echo 'checked="checked"'; ?> /> |
| 439 |
</label> |
| 440 |
</div> |
| 441 |
<div> |
| 442 |
<label> |
| 443 |
<img src="<?php echo plugins_url( 'images/template_right.jpg', __FILE__ ); ?>" alt="template_right" /> |
| 444 |
<input type="radio" name="pdfprnt_tmpl_custom" value="3" <?php if ( 3 == $pdfprnt_options_array['tmpl_custom'] ) echo 'checked="checked"'; ?> /> |
| 445 |
</label> |
| 446 |
</div> |
| 447 |
</td> |
| 448 |
</tr> |
| 449 |
<tr> |
| 450 |
<th scope="row"></th> |
| 451 |
<td> |
| 452 |
<span class="pdfprnt_explanation"><?php echo __( 'In order to use PDF and Print buttons on the custom page you should use the', 'pdf-print' ) . '<?php if ( function_exists( \'pdfprnt_show_buttons_for_custom_post_type\' ) ) echo pdfprnt_show_buttons_for_custom_post_type( $custom_query ); ?>' . __( ' where you have to specify query parameters for your custom post.<br/> For example: ', 'pdf-print' ) . '<?php if ( function_exists( \'pdfprnt_show_buttons_for_custom_post_type\' ) ) echo pdfprnt_show_buttons_for_custom_post_type( \'post_type=gallery&orderby=post_date\' ); ?>' . __(' or ', 'pdf-print') . '<?php if ( function_exists( \'pdfprnt_show_buttons_for_custom_post_type\' ) ) echo pdfprnt_show_buttons_for_custom_post_type( array( \'post_type\' => \'gallery\', \'orderby\' => \'post_date\' ) ); ?>.' . __( ' For more information on the syntax for assigning parameters to function see <a target="_blank" href="http://codex.wordpress.org/Class_Reference/WP_Query#Parameters">here</a>.', 'pdf-print' ); ?></span> |
| 453 |
</td> |
| 454 |
</tr> |
| 455 |
<tr> |
| 456 |
<th scope="row"> |
| 457 |
<?php _e( 'Position of buttons on search or archive page:', 'pdf-print' ); ?> |
| 458 |
</th> |
| 459 |
<td> |
| 460 |
<select name="pdfprnt_position_search_archive"> |
| 461 |
<option value="pdfprnt-left" <?php if ( 'left' == $pdfprnt_options_array['position_search_archive'] ) echo 'selected="selected"'; ?>><?php echo __( 'Align Left', 'pdf-print' ); ?></option> |
| 462 |
<option value="pdfprnt-right" <?php if ( 'right' == $pdfprnt_options_array['position_search_archive'] ) echo 'selected="selected"'; ?>><?php echo __( 'Align Right', 'pdf-print' ); ?></option> |
| 463 |
</select> |
| 464 |
</td> |
| 465 |
</tr> |
| 466 |
<tr> |
| 467 |
<th scope="row"><?php _e( 'Show for search or archive page:', 'pdf-print' ); ?></th> |
| 468 |
<td> |
| 469 |
<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 |
<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 |
</td> |
| 472 |
</tr> |
| 473 |
<tr> |
| 474 |
<th scope="row"> |
| 475 |
<?php _e( 'Default template setting for search and archive:', 'pdf-print' ); ?> |
| 476 |
</th> |
| 477 |
<td> |
| 478 |
<div> |
| 479 |
<label> |
| 480 |
<img src="<?php echo plugins_url( 'images/template_left.jpg', __FILE__ ); ?>" alt="template_left" /> |
| 481 |
<input type="radio" name="pdfprnt_tmpl_search" value="1" <?php if ( 1 == $pdfprnt_options_array['tmpl_search'] ) echo 'checked="checked"'; ?> /> |
| 482 |
</label> |
| 483 |
</div> |
| 484 |
<div> |
| 485 |
<label> |
| 486 |
<img src="<?php echo plugins_url( 'images/template_center.jpg', __FILE__ ); ?>" alt="template_center" /> |
| 487 |
<input type="radio" name="pdfprnt_tmpl_search" value="2" <?php if ( 2 == $pdfprnt_options_array['tmpl_search'] ) echo 'checked="checked"'; ?> /> |
| 488 |
</label> |
| 489 |
</div> |
| 490 |
<div> |
| 491 |
<label> |
| 492 |
<img src="<?php echo plugins_url( 'images/template_right.jpg', __FILE__ ); ?>" alt="template_right" /> |
| 493 |
<input type="radio" name="pdfprnt_tmpl_search" value="3" <?php if ( 3 == $pdfprnt_options_array['tmpl_search'] ) echo 'checked="checked"'; ?> /> |
| 494 |
</label> |
| 495 |
</div> |
| 496 |
</td> |
| 497 |
</tr> |
| 498 |
<tr> |
| 499 |
<th scope="row"></th> |
| 500 |
<td> |
| 501 |
<span class="pdfprnt_explanation"><?php echo __( 'In order to use PDF and Print buttons on the search page or archive page you should put the strings below into the template source code in files search.php or archives.php ', 'pdf-print' ) . ' <?php if ( function_exists( \'pdfprnt_show_buttons_search_archive\' ) ) echo pdfprnt_show_buttons_search_archive(); ?>'; ?></span> |
| 502 |
</td> |
| 503 |
</tr> |
| 504 |
<tr> |
| 505 |
<th scope="row"> |
| 506 |
<?php _e( 'Settings for shorcodes:', 'pdf-print' ); ?> |
| 507 |
</th> |
| 508 |
<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> |
| 510 |
</td> |
| 511 |
</tr> |
| 512 |
<tr> |
| 513 |
<th scope="row"><?php _e( 'Show the print window', 'pdf-print' ); ?></th> |
| 514 |
<td> |
| 515 |
<input type="checkbox" name="pdfprnt_show_print_window" <?php if ( 1 == $pdfprnt_options_array['show_print_window'] ) echo 'checked="checked"'; ?> /> |
| 516 |
</td> |
| 517 |
</tr> |
| 518 |
</table> |
| 519 |
<input type="hidden" name="pdfprnt_form_submit" value="1" /> |
| 520 |
<p class="submit"> |
| 521 |
<input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'pdf-print' ); ?>" /> |
| 522 |
</p> |
| 523 |
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'pdfprnt_nonce_name' ); ?> |
| 524 |
</form> |
| 525 |
<div class="bws-plugin-reviews"> |
| 526 |
<div class="bws-plugin-reviews-rate"> |
| 527 |
<?php _e( 'If you enjoy our plugin, please give it 5 stars on WordPress', 'pdf-print' ); ?>: |
| 528 |
<a href="http://wordpress.org/support/view/plugin-reviews/pdf-print" target="_blank" title="PDF & Print reviews"><?php _e( 'Rate the plugin', 'pdf-print' ); ?></a> |
| 529 |
</div> |
| 530 |
<div class="bws-plugin-reviews-support"> |
| 531 |
<?php _e( 'If there is something wrong about it, please contact us', 'pdf-print' ); ?>: |
| 532 |
<a href="http://support.bestwebsoft.com">http://support.bestwebsoft.com</a> |
| 533 |
</div> |
| 534 |
</div> |
| 535 |
<?php } elseif ( 'extra' == $_GET['action'] ) { ?> |
| 536 |
<div class="bws_pro_version_bloc"> |
| 537 |
<div class="bws_pro_version_table_bloc"> |
| 538 |
<div class="bws_table_bg"></div> |
| 539 |
<table class="form-table bws_pro_version"> |
| 540 |
<tr valign="top"> |
| 541 |
<td colspan="2"> |
| 542 |
<?php _e( 'Please choose the necessary post types (or single pages) where PDF & Print buttons will be displayed:', 'pdf-print' ); ?> |
| 543 |
</td> |
| 544 |
</tr> |
| 545 |
<tr valign="top"> |
| 546 |
<td colspan="2"> |
| 547 |
<label> |
| 548 |
<input disabled="disabled" checked="checked" id="twttrpr_jstree_url" type="checkbox" name="twttrpr_jstree_url" value="1" /> |
| 549 |
<?php _e( "Show URL for pages", 'pdf-print' );?> |
| 550 |
</label> |
| 551 |
</td> |
| 552 |
</tr> |
| 553 |
<tr valign="top"> |
| 554 |
<td colspan="2"> |
| 555 |
<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' ); ?>" /> |
| 556 |
</td> |
| 557 |
</tr> |
| 558 |
<tr valign="top"> |
| 559 |
<td colspan="2"> |
| 560 |
<input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'pdf-print' ); ?>" /> |
| 561 |
</td> |
| 562 |
</tr> |
| 563 |
<tr valign="top"> |
| 564 |
<th scope="row" colspan="2"> |
| 565 |
* <?php _e( 'If you upgrade to Pro version all your settings will be saved.', 'pdf-print' ); ?> |
| 566 |
</th> |
| 567 |
</tr> |
| 568 |
</table> |
| 569 |
</div> |
| 570 |
<div class="bws_pro_version_tooltip"> |
| 571 |
<div class="bws_info"> |
| 572 |
<?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> |
| 574 |
</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"> |
| 576 |
<?php _e( 'Go', 'pdf-print' ); ?> <strong>PRO</strong> |
| 577 |
</a> |
| 578 |
<div class="clear"></div> |
| 579 |
</div> |
| 580 |
</div> |
| 581 |
<?php } elseif ( 'go_pro' == $_GET['action'] ) { ?> |
| 582 |
<?php if ( isset( $pro_plugin_is_activated ) && true === $pro_plugin_is_activated ) { ?> |
| 583 |
<script type="text/javascript"> |
| 584 |
window.setTimeout( function() { |
| 585 |
window.location.href = 'admin.php?page=pdf-print-pro.php'; |
| 586 |
}, 5000 ); |
| 587 |
</script> |
| 588 |
<p><?php _e( "Congratulations! The PRO version of the plugin is successfully download and activated.", 'pdf-print' ); ?></p> |
| 589 |
<p> |
| 590 |
<?php _e( "Please, go to", 'pdf-print' ); ?> <a href="admin.php?page=pdf-print-pro.php"><?php _e( 'the setting page', 'pdf-print' ); ?></a> |
| 591 |
(<?php _e( "You will be redirected automatically in 5 seconds.", 'pdf-print' ); ?>) |
| 592 |
</p> |
| 593 |
<?php } else { ?> |
| 594 |
<form method="post" action="admin.php?page=pdf-print.php&action=go_pro"> |
| 595 |
<p> |
| 596 |
<?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> |
| 598 |
<?php _e( 'version of this plugin by entering Your license key.', 'pdf-print' ); ?><br /> |
| 599 |
<span style="color: #888888;font-size: 10px;"> |
| 600 |
<?php _e( 'You can find your license key on your personal page Client area, by clicking on the link', 'pdf-print' ); ?> |
| 601 |
<a href="http://bestwebsoft.com/wp-login.php">http://bestwebsoft.com/wp-login.php</a> |
| 602 |
<?php _e( '(your username is the email you specify when purchasing the product).', 'pdf-print' ); ?> |
| 603 |
</span> |
| 604 |
</p> |
| 605 |
<?php if ( isset( $bstwbsftwppdtplgns_options['go_pro']['pdf-print-pro/pdf-print-pro.php']['count'] ) && |
| 606 |
'5' < $bstwbsftwppdtplgns_options['go_pro']['pdf-print-pro/pdf-print-pro.php']['count'] && |
| 607 |
$bstwbsftwppdtplgns_options['go_pro']['pdf-print-pro/pdf-print-pro.php']['time'] < ( time() + ( 24 * 60 * 60 ) ) ) { ?> |
| 608 |
<p> |
| 609 |
<input disabled="disabled" type="text" name="bws_license_key" value="<?php echo $bws_license_key; ?>" /> |
| 610 |
<input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Go!', 'pdf-print' ); ?>" /> |
| 611 |
</p> |
| 612 |
<p> |
| 613 |
<?php _e( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'pdf-print' ); ?> |
| 614 |
</p> |
| 615 |
<?php } else { ?> |
| 616 |
<p> |
| 617 |
<input type="text" name="bws_license_key" value="<?php echo $bws_license_key; ?>" /> |
| 618 |
<input type="hidden" name="bws_license_plugin" value="pdf-print-pro/pdf-print-pro.php" /> |
| 619 |
<input type="hidden" name="bws_license_submit" value="submit" /> |
| 620 |
<input type="submit" class="button-primary" value="<?php _e( 'Go!', 'pdf-print' ); ?>" /> |
| 621 |
<?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_nonce_name' ); ?> |
| 622 |
</p> |
| 623 |
<?php } ?> |
| 624 |
</form> |
| 625 |
<?php } |
| 626 |
} ?> |
| 627 |
</div> |
| 628 |
<?php } |
| 629 |
} |
| 630 |
|
| 631 |
/* Positioning buttons in the page */ |
| 632 |
if( ! function_exists( 'pdfprnt_content' ) ) { |
| 633 |
function pdfprnt_content( $content ) { |
| 634 |
if ( is_admin() ) |
| 635 |
return; |
| 636 |
|
| 637 |
global $pdfprnt_options_array, $post; |
| 638 |
if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) // Check for existence the type of posts. |
| 639 |
return $content; |
| 640 |
if ( 1 == $pdfprnt_options_array['show_btn_pdf'] || 1 == $pdfprnt_options_array['show_btn_print'] ) { |
| 641 |
$position = ( 'top-left' == $pdfprnt_options_array['position'] || 'top-right' == $pdfprnt_options_array['position'] ) ? true : false; |
| 642 |
$str = '<div class="pdfprnt-' . $pdfprnt_options_array['position'] . '">'; |
| 643 |
if ( 1 == $pdfprnt_options_array['show_btn_pdf'] ) { |
| 644 |
if ( ! is_front_page () ) |
| 645 |
$permalink = add_query_arg( 'print' , 'pdf' , get_permalink( $post->ID ) ); |
| 646 |
else |
| 647 |
$permalink = add_query_arg( 'print' , 'pdf' , get_permalink() . '?page-id=' . $post->ID ); |
| 648 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/pdf.png', __FILE__ ) . '" alt="image_pdf" title="View PDF" /></a>'; |
| 649 |
} |
| 650 |
if ( 1 == $pdfprnt_options_array['show_btn_print'] ) { |
| 651 |
if ( ! is_front_page () ) |
| 652 |
$permalink = add_query_arg( 'print' , 'print' , get_permalink( $post->ID ) ); |
| 653 |
else |
| 654 |
$permalink = add_query_arg( 'print' , 'print' , get_permalink() . '?page-id=' . $post->ID ); |
| 655 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/print.gif', __FILE__ ) . '" alt="image_print" title="Print Content" /></a>'; |
| 656 |
} |
| 657 |
$str .= '</div>'; |
| 658 |
if ( $position ) |
| 659 |
$content = $str . $content; |
| 660 |
else |
| 661 |
$content = $content . $str; |
| 662 |
unset( $position ); |
| 663 |
unset( $str ); |
| 664 |
} |
| 665 |
return $content; |
| 666 |
} |
| 667 |
} |
| 668 |
|
| 669 |
/* Output buttons for search or archive pages */ |
| 670 |
if( ! function_exists( 'pdfprnt_show_buttons_search_archive' ) ) { |
| 671 |
function pdfprnt_show_buttons_search_archive() { |
| 672 |
global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $wp, $posts; |
| 673 |
if ( 0 < $pdfprnt_output_count_buttons ) |
| 674 |
return; |
| 675 |
if ( 1 !== $pdfprnt_options_array['show_btn_pdf_search_archive'] && 1 !== $pdfprnt_options_array['show_btn_print_search_archive'] ) |
| 676 |
return; |
| 677 |
if ( ( ! is_search() && ! is_archive() ) || ( is_category() || ! have_posts() ) ) |
| 678 |
return; |
| 679 |
/* Check for existence the type of posts. */ |
| 680 |
$is_return = true; |
| 681 |
foreach ( $posts as $post ) { |
| 682 |
if ( in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) { |
| 683 |
$is_return = false; |
| 684 |
break; |
| 685 |
} |
| 686 |
} |
| 687 |
if ( $is_return ) |
| 688 |
return; |
| 689 |
$pdfprnt_output_count_buttons++; |
| 690 |
if ( empty( $wp->request ) ) |
| 691 |
$current_url = add_query_arg( $wp->query_string, '', home_url() ); |
| 692 |
else |
| 693 |
$current_url = home_url( $wp->request ); |
| 694 |
$str = '<div class="' . $pdfprnt_options_array['position_search_archive'] . '">'; |
| 695 |
if ( 1 == $pdfprnt_options_array['show_btn_pdf_search_archive'] ) { |
| 696 |
$permalink = add_query_arg( 'print' , 'pdf-page' , $current_url ); |
| 697 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/pdf.png', __FILE__ ) . '" alt="image_pdf" title="Print PDF" /></a>'; |
| 698 |
} |
| 699 |
if ( 1 == $pdfprnt_options_array['show_btn_print_search_archive'] ) { |
| 700 |
$permalink = add_query_arg( 'print' , 'print-page' , $current_url ); |
| 701 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/print.gif', __FILE__ ) . '" alt="image_print" title="Print Content" /></a>'; |
| 702 |
} |
| 703 |
$str .= '</div>'; |
| 704 |
unset( $current_url ); |
| 705 |
unset( $permalink ); |
| 706 |
echo $str; |
| 707 |
} |
| 708 |
} |
| 709 |
if ( ! function_exists( 'pdfprnt_auto_show_buttons_search_archive' ) ) { |
| 710 |
function pdfprnt_auto_show_buttons_search_archive() { |
| 711 |
if ( is_archive() || is_search() ) |
| 712 |
add_action( 'loop_start', 'pdfprnt_show_buttons_search_archive' ); |
| 713 |
} |
| 714 |
add_action( 'wp_head', 'pdfprnt_auto_show_buttons_search_archive' ); |
| 715 |
} |
| 716 |
|
| 717 |
/* Output buttons of page for BWS Portfolio plugin */ |
| 718 |
if( ! function_exists( 'pdfprnt_show_buttons_for_bws_portfolio' ) ) { |
| 719 |
function pdfprnt_show_buttons_for_bws_portfolio() { |
| 720 |
global $pdfprnt_options_array, $pdfprnt_output_count_buttons, $wp; |
| 721 |
if ( 0 < $pdfprnt_output_count_buttons ) |
| 722 |
return; |
| 723 |
if ( 1 !== $pdfprnt_options_array['show_btn_pdf_custom'] && 1 !== $pdfprnt_options_array['show_btn_print_custom'] ) |
| 724 |
return; |
| 725 |
if ( ! in_array( 'portfolio', $pdfprnt_options_array['use_types_posts'] ) ) |
| 726 |
return; |
| 727 |
$pdfprnt_output_count_buttons++; |
| 728 |
if ( empty( $wp->request ) ) |
| 729 |
$current_url = add_query_arg( $wp->query_string, '', home_url() ); |
| 730 |
else |
| 731 |
$current_url = home_url( $wp->request ); |
| 732 |
$str = '<div class="' . $pdfprnt_options_array['position_custom'] . '">'; |
| 733 |
if ( 1 == $pdfprnt_options_array['show_btn_pdf_custom'] ) { |
| 734 |
$permalink = add_query_arg( 'print' , 'pdf-portfolio-page' , $current_url ); |
| 735 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/pdf.png', __FILE__ ) . '" alt="image_pdf" title="Print PDF" /></a>'; |
| 736 |
} |
| 737 |
if ( 1 == $pdfprnt_options_array['show_btn_print_custom'] ) { |
| 738 |
$permalink = add_query_arg( 'print' , 'print-portfolio-page' , $current_url ); |
| 739 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/print.gif', __FILE__ ) . '" alt="image_print" title="Print Content" /></a>'; |
| 740 |
} |
| 741 |
$str .= '</div>'; |
| 742 |
unset( $current_url ); |
| 743 |
unset( $permalink ); |
| 744 |
return $str; |
| 745 |
} |
| 746 |
} |
| 747 |
|
| 748 |
/* Output buttons of post for BWS Portfolio plugin */ |
| 749 |
if ( ! function_exists( 'pdfprnt_show_buttons_for_bws_portfolio_post' ) ) { |
| 750 |
function pdfprnt_show_buttons_for_bws_portfolio_post() { |
| 751 |
global $pdfprnt_options_array, $post; |
| 752 |
if ( 1 !== $pdfprnt_options_array['show_btn_pdf_custom'] && 1 !== $pdfprnt_options_array['show_btn_print_custom'] ) |
| 753 |
return; |
| 754 |
if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 755 |
return; |
| 756 |
$current_url = get_permalink(); |
| 757 |
$str = '<div class="' . $pdfprnt_options_array['position_custom'] . '">'; |
| 758 |
if ( 1 == $pdfprnt_options_array['show_btn_pdf_custom'] ) { |
| 759 |
$permalink = add_query_arg( 'print' , 'pdf-portfolio' , $current_url ); |
| 760 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/pdf.png', __FILE__ ) . '" alt="image_pdf" title="Print PDF" /></a>'; |
| 761 |
} |
| 762 |
if ( 1 == $pdfprnt_options_array['show_btn_print_custom'] ) { |
| 763 |
$permalink = add_query_arg( 'print' , 'print-portfolio' , $current_url ); |
| 764 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/print.gif', __FILE__ ) . '" alt="image_print" title="Print Content" /></a>'; |
| 765 |
} |
| 766 |
$str .= '</div>'; |
| 767 |
unset( $current_url ); |
| 768 |
unset( $permalink ); |
| 769 |
return $str; |
| 770 |
} |
| 771 |
} |
| 772 |
|
| 773 |
/* Output buttons of page for custom post type */ |
| 774 |
if ( ! function_exists( 'pdfprnt_show_buttons_for_custom_post_type' ) ) { |
| 775 |
function pdfprnt_show_buttons_for_custom_post_type( $custom_query ) { |
| 776 |
global $pdfprnt_options_array, $pdfprnt_output_count_buttons; |
| 777 |
if ( 0 < $pdfprnt_output_count_buttons ) |
| 778 |
return; |
| 779 |
if ( 1 !== $pdfprnt_options_array['show_btn_pdf_custom'] && 1 !== $pdfprnt_options_array['show_btn_print_custom'] ) |
| 780 |
return; |
| 781 |
if ( ! is_array( $custom_query ) && ! is_string( $custom_query ) ) |
| 782 |
return; |
| 783 |
$custom_query = new WP_Query( $custom_query ); |
| 784 |
/* Check for existence the type of posts. */ |
| 785 |
$is_return = true; |
| 786 |
foreach ( $custom_query->posts as $post ) { |
| 787 |
if ( in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) { |
| 788 |
$is_return = false; |
| 789 |
break; |
| 790 |
} |
| 791 |
} |
| 792 |
if ( $is_return ) |
| 793 |
return; |
| 794 |
$pdfprnt_output_count_buttons++; |
| 795 |
$current_url = add_query_arg( $custom_query->query, '', home_url() ); |
| 796 |
$str = '<div class="' . $pdfprnt_options_array['position_custom'] . '">'; |
| 797 |
if ( 1 == $pdfprnt_options_array['show_btn_pdf_custom'] ) { |
| 798 |
$permalink = add_query_arg( 'print' , 'pdf-custom-page' , $current_url ); |
| 799 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/pdf.png', __FILE__ ) . '" alt="image_pdf" title="Print PDF" /></a>'; |
| 800 |
} |
| 801 |
if ( 1 == $pdfprnt_options_array['show_btn_print_custom'] ) { |
| 802 |
$permalink = add_query_arg( 'print' , 'print-custom-page' , $current_url ); |
| 803 |
$str .= '<a href="' . $permalink . '" target="_blank"><img src="' . plugins_url( 'images/print.gif', __FILE__ ) . '" alt="image_print" title="Print Content" /></a>'; |
| 804 |
} |
| 805 |
$str .= '</div>'; |
| 806 |
unset( $current_url ); |
| 807 |
unset( $permalink ); |
| 808 |
unset( $is_return ); |
| 809 |
unset( $custom_query ); |
| 810 |
return $str; |
| 811 |
} |
| 812 |
} |
| 813 |
|
| 814 |
/* Add links */ |
| 815 |
if ( ! function_exists( 'pdfprnt_action_links' ) ) { |
| 816 |
function pdfprnt_action_links( $links, $file ) { |
| 817 |
$base = plugin_basename( __FILE__ ); |
| 818 |
if ( $file == $base ) { |
| 819 |
$settings_link = '<a href="admin.php?page=pdf-print.php">' . __( 'Settings', 'pdf-print' ) . '</a>'; |
| 820 |
array_unshift( $links, $settings_link ); |
| 821 |
} |
| 822 |
return $links; |
| 823 |
} |
| 824 |
} |
| 825 |
|
| 826 |
/* Add links */ |
| 827 |
if ( ! function_exists( 'pdfprnt_links' ) ) { |
| 828 |
function pdfprnt_links( $links, $file ) { |
| 829 |
$base = plugin_basename( __FILE__ ); |
| 830 |
if ( $file == $base ) { |
| 831 |
$links[] = '<a href="admin.php?page=pdf-print.php">' . __( 'Settings', 'pdf-print' ) . '</a>'; |
| 832 |
$links[] = '<a href="http://wordpress.org/plugins/pdf-print/faq/" target="_blank">' . __( 'FAQ', 'pdf-print' ) . '</a>'; |
| 833 |
$links[] = '<a href="http://support.bestwebsoft.com">' . __( 'Support', 'pdf-print' ) . '</a>'; |
| 834 |
} |
| 835 |
return $links; |
| 836 |
} |
| 837 |
} |
| 838 |
|
| 839 |
/* Add stylesheets */ |
| 840 |
if ( ! function_exists ( 'pdfprnt_admin_head' ) ) { |
| 841 |
function pdfprnt_admin_head() { |
| 842 |
global $wp_version; |
| 843 |
if ( $wp_version < 3.8 ) |
| 844 |
wp_enqueue_style( 'pdfprnt_stylesheet', plugins_url( 'css/style_wp_before_3.8.css', __FILE__ ) ); |
| 845 |
else |
| 846 |
wp_enqueue_style( 'pdfprnt_stylesheet', plugins_url( 'css/style.css', __FILE__ ) ); |
| 847 |
|
| 848 |
if ( isset( $_GET['page'] ) && "pdf-print.php" == $_GET['page'] ) |
| 849 |
wp_enqueue_script( 'pdfprnt_script', plugins_url( 'js/script.js', __FILE__ ) ); |
| 850 |
} |
| 851 |
} |
| 852 |
|
| 853 |
/* Generate templates for pdf file or print */ |
| 854 |
if ( ! function_exists( 'pdfprnt_generate_template' ) ) { |
| 855 |
function pdfprnt_generate_template( $content, $template = false, $isprint = false ) { |
| 856 |
global $pdfprnt_options_array; |
| 857 |
$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 */ |
| 941 |
ob_end_clean(); /* Closing output buffering */ |
| 942 |
return $html; /* Now we done with template */ |
| 943 |
} |
| 944 |
} |
| 945 |
|
| 946 |
if ( ! function_exists( 'pdfprnt_generate_template_for_bws_portfolio' ) ) { |
| 947 |
function pdfprnt_generate_template_for_bws_portfolio() { |
| 948 |
global $post; |
| 949 |
ob_start(); /* Starting output buffering */ |
| 950 |
$portfolio_options = get_option( 'prtfl_options' ); |
| 951 |
$meta_values = get_post_custom( $post->ID ); |
| 952 |
$post_thumbnail_id = get_post_thumbnail_id( $post->ID ); |
| 953 |
if ( empty ( $post_thumbnail_id ) ) { |
| 954 |
$args = array( |
| 955 |
'post_parent' => $post->ID, |
| 956 |
'post_type' => 'attachment', |
| 957 |
'post_mime_type' => 'image', |
| 958 |
'numberposts' => 1 |
| 959 |
); |
| 960 |
$attachments = get_children( $args ); |
| 961 |
$post_thumbnail_id = key( $attachments ); |
| 962 |
} |
| 963 |
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' ); |
| 964 |
$image_alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true ); |
| 965 |
$image_desc = get_post( $post_thumbnail_id ); |
| 966 |
$image_desc = $image_desc->post_content; |
| 967 |
if ( '1' == get_option( 'prtfl_postmeta_update' ) ) { |
| 968 |
$post_meta = get_post_meta( $post->ID, 'prtfl_information', true ); |
| 969 |
$date_compl = $post_meta['_prtfl_date_compl']; |
| 970 |
if ( ! empty( $date_compl ) && 'in progress' != $date_compl ) { |
| 971 |
$date_compl = explode( '/', $date_compl ); |
| 972 |
$date_compl = date( get_option( 'date_format' ), strtotime( $date_compl[1] . '-' . $date_compl[0] . '-' . $date_compl[2] ) ); |
| 973 |
} |
| 974 |
$link = $post_meta['_prtfl_link']; |
| 975 |
$short_descr = $post_meta['_prtfl_short_descr']; |
| 976 |
} else { |
| 977 |
$date_compl = get_post_meta( $post->ID, '_prtfl_date_compl', true ); |
| 978 |
if ( ! empty( $date_compl ) && 'in progress' != $date_compl ) { |
| 979 |
$date_compl = explode( '/', $date_compl ); |
| 980 |
$date_compl = date( get_option( 'date_format' ), strtotime( $date_compl[1] . '-' . $date_compl[0] . '-' . $date_compl[2] ) ); |
| 981 |
} |
| 982 |
$link = get_post_meta( $post->ID, '_prtfl_link', true); |
| 983 |
$short_descr = $post_meta['_prtfl_short_descr']; |
| 984 |
} ?> |
| 985 |
<img src="<?php echo $image[0]; ?>" width="<?php echo $image[1]; ?>" alt="<?php echo $image_alt; ?>" /> |
| 986 |
<div> |
| 987 |
<p> |
| 988 |
<strong><?php _e( 'Date of completion', 'pdf-print' ); ?>:</strong> <?php echo $date_compl; ?><br/> |
| 989 |
<strong><?php _e( 'Link', 'pdf-print' ); ?>:</strong> <a href="<?php echo $link; ?>"><?php echo $link; ?></a><br/> |
| 990 |
<strong><?php _e( 'Description', 'pdf-print' ); ?>:</strong> <?php echo $short_descr; ?><br/> |
| 991 |
</p> |
| 992 |
</div> |
| 993 |
<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' ); |
| 994 |
if ( is_array( $terms ) && count( $terms ) > 0 ) { ?> |
| 995 |
<div style="clear:both;"> |
| 996 |
<strong><?php _e( 'Technologies', 'pdf-print' ); ?>: </strong> |
| 997 |
<?php $count = 0; |
| 998 |
foreach ( $terms as $term ) { |
| 999 |
if( 0 < $count ) |
| 1000 |
echo ', '; |
| 1001 |
echo '<a href="' . get_term_link( $term->slug, 'portfolio_technologies' ) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name . '</a>'; |
| 1002 |
$count++; |
| 1003 |
} ?> |
| 1004 |
</div> |
| 1005 |
<?php } |
| 1006 |
$content = ob_get_contents(); /* Getting output buffering */ |
| 1007 |
ob_end_clean(); /* Closing output buffering */ |
| 1008 |
return $content; /* Now we done with template */ |
| 1009 |
} |
| 1010 |
} |
| 1011 |
|
| 1012 |
/* Generate query posts for Portfolio plugin */ |
| 1013 |
if ( ! function_exists( 'generate_query_posts_for_portfolio' ) ) { |
| 1014 |
function generate_query_posts_for_portfolio() { |
| 1015 |
global $wp_query; |
| 1016 |
$paged = isset( $wp_query->query_vars['paged'] ) ? $wp_query->query_vars['paged'] : 1; |
| 1017 |
$technologies = isset( $wp_query->query_vars["technologies"] ) ? $wp_query->query_vars["technologies"] : ""; |
| 1018 |
if ( "" != $technologies ) { |
| 1019 |
$args = array( |
| 1020 |
'post_type' => 'portfolio', |
| 1021 |
'post_status' => 'publish', |
| 1022 |
'posts_per_page' => get_option('posts_per_page'), |
| 1023 |
'paged' => $paged, |
| 1024 |
'tax_query' => array( |
| 1025 |
array( |
| 1026 |
'taxonomy' => 'portfolio_technologies', |
| 1027 |
'field' => 'slug', |
| 1028 |
'terms' => $technologies |
| 1029 |
) |
| 1030 |
) |
| 1031 |
); |
| 1032 |
} else { |
| 1033 |
$args = array( |
| 1034 |
'post_type' => 'portfolio', |
| 1035 |
'post_status' => 'publish', |
| 1036 |
'posts_per_page' => get_option('posts_per_page'), |
| 1037 |
'paged' => $paged |
| 1038 |
); |
| 1039 |
} |
| 1040 |
query_posts( $args ); |
| 1041 |
} |
| 1042 |
} |
| 1043 |
|
| 1044 |
/* Output print page or pdf document and include plugin script */ |
| 1045 |
if ( ! function_exists( 'pdfprnt_print' ) ) { |
| 1046 |
function pdfprnt_print( $query ) { |
| 1047 |
global $pdfprnt_options_array, $posts, $post; |
| 1048 |
if ( $print = get_query_var( 'print' ) ) { |
| 1049 |
remove_all_filters( 'the_content' ); |
| 1050 |
add_filter( 'the_content', 'capital_P_dangit', 11 ); |
| 1051 |
add_filter( 'the_content', 'wptexturize' ); |
| 1052 |
add_filter( 'the_content', 'convert_smilies' ); |
| 1053 |
add_filter( 'the_content', 'convert_chars' ); |
| 1054 |
add_filter( 'the_content', 'wpautop' ); |
| 1055 |
if ( 1 == $pdfprnt_options_array['tmpl_shorcode'] ) { |
| 1056 |
add_filter( 'the_content', 'do_shortcode' ); /* executing shorcodes on the page */ |
| 1057 |
} else { |
| 1058 |
$pattern = get_shortcode_regex(); |
| 1059 |
if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) ) { /* getting all shortcodes we are using */ |
| 1060 |
foreach ( array_unique( $matches[0] ) as $value) { |
| 1061 |
$post->post_content = str_replace( $value, "", $post->post_content ); /* replacing shorcodes to an empty string */ |
| 1062 |
} |
| 1063 |
} |
| 1064 |
} |
| 1065 |
switch ( $print ) { |
| 1066 |
case 'pdf': /* Content for PDF from post */ |
| 1067 |
include ( 'mpdf/mpdf.php' ); |
| 1068 |
$mpdf = new mPDF( get_bloginfo( 'charset' ) ); |
| 1069 |
$mpdf = new mPDF('+aCJK'); |
| 1070 |
$user_info = get_userdata( $post->post_author ); |
| 1071 |
$mpdf->SetAutoFont(AUTOFONT_ALL); |
| 1072 |
$mpdf->SetAuthor( $user_info->display_name ); |
| 1073 |
$mpdf->SetTitle( $post->post_title ); |
| 1074 |
$mpdf->SetSubject( get_bloginfo( 'blogdescription' ) ); |
| 1075 |
$html = '<div class="container"> |
| 1076 |
<div class="title"><h1><a href="' . get_permalink( $post->ID ) . '">' . $post->post_title . '</a></h1></div><br/> |
| 1077 |
<div class="content">' . apply_filters( 'the_content', $post->post_content ) . '</div> |
| 1078 |
</div>'; |
| 1079 |
$mpdf->WriteHTML( pdfprnt_generate_template( $html ) ); |
| 1080 |
$mpdf->Output(); |
| 1081 |
unset( $user_info ); |
| 1082 |
unset( $html ); |
| 1083 |
unset( $mpdf ); |
| 1084 |
die(); |
| 1085 |
break; |
| 1086 |
case 'print': /* Content for printing from post */ |
| 1087 |
$html = '<div class="container"> |
| 1088 |
<div class="title"><h1>' . $post->post_title . '</h1></div><br/> |
| 1089 |
<div class="content">' . apply_filters( 'the_content', $post->post_content ) . '</div> |
| 1090 |
</div>'; |
| 1091 |
echo pdfprnt_generate_template( $html, false, true ); |
| 1092 |
unset( $html ); |
| 1093 |
die(); |
| 1094 |
break; |
| 1095 |
case 'pdf-page': /* Content for PDF from archive or searching page */ |
| 1096 |
$html = ''; |
| 1097 |
$titles = array(); |
| 1098 |
$authors = array(); |
| 1099 |
include ( 'mpdf/mpdf.php' ); |
| 1100 |
$mpdf = new mPDF( get_bloginfo( 'charset' ) ); |
| 1101 |
$mpdf = new mPDF('+aCJK'); |
| 1102 |
foreach ( $posts as $p ) { |
| 1103 |
if ( ! in_array( get_post_type( $p ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 1104 |
continue; |
| 1105 |
$titles[] = $p->post_title; |
| 1106 |
$user_info = get_userdata( $p->post_author ); |
| 1107 |
$authors[] = $user_info->display_name; |
| 1108 |
$html .= '<div class="container"> |
| 1109 |
<div class="title"><h1><a href="' . get_permalink( $p->ID ) . '">' . $p->post_title . '</a></h1></div><br/> |
| 1110 |
<div class="content">' . apply_filters( 'the_content', $p->post_content ) . '</div> |
| 1111 |
</div><br/><hr/><br/>'; |
| 1112 |
unset( $user_info ); |
| 1113 |
} |
| 1114 |
$titles = array_unique( $titles ); |
| 1115 |
$authors = array_unique( $authors ); |
| 1116 |
$mpdf->SetAutoFont(AUTOFONT_ALL); |
| 1117 |
$mpdf->SetTitle( implode( ',', $titles ) ); |
| 1118 |
$mpdf->SetAuthor( implode( ',', $authors ) ); |
| 1119 |
$mpdf->SetSubject( get_bloginfo( 'blogdescription' ) ); |
| 1120 |
$mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_search'] ) ); |
| 1121 |
$mpdf->Output(); |
| 1122 |
unset( $authors ); |
| 1123 |
unset( $titles ); |
| 1124 |
unset( $html ); |
| 1125 |
unset( $mpdf ); |
| 1126 |
die(); |
| 1127 |
break; |
| 1128 |
case 'print-page': /* Content for printing from archive or searching page */ |
| 1129 |
$html = ''; |
| 1130 |
foreach ( $posts as $p ) { |
| 1131 |
if ( ! in_array( get_post_type( $p ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 1132 |
continue; |
| 1133 |
$html .= '<div class="container"> |
| 1134 |
<div class="title"><h1>' . $p->post_title . '</h1></div><br/> |
| 1135 |
<div class="content">' . apply_filters( 'the_content', $p->post_content ) . '</div> |
| 1136 |
</div><br/><hr/><br/>'; |
| 1137 |
} |
| 1138 |
echo pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_search'], true ); |
| 1139 |
unset( $html ); |
| 1140 |
die(); |
| 1141 |
break; |
| 1142 |
case 'pdf-portfolio': /* Content for PDF from portfolio post */ |
| 1143 |
include ( 'mpdf/mpdf.php' ); |
| 1144 |
$mpdf = new mPDF( get_bloginfo( 'charset' ) ); |
| 1145 |
$mpdf = new mPDF( '+aCJK' ); |
| 1146 |
$user_info = get_userdata( $post->post_author ); |
| 1147 |
$mpdf->SetAutoFont( AUTOFONT_ALL ); |
| 1148 |
$mpdf->SetAuthor( $user_info->display_name ); |
| 1149 |
$mpdf->SetTitle( $post->post_title ); |
| 1150 |
$mpdf->SetSubject( get_bloginfo( 'blogdescription' ) ); |
| 1151 |
$html = '<div class="container"> |
| 1152 |
<div class="title"><h1><a href="' . get_permalink( $post->ID ) . '">' . $post->post_title . '</a></h1></div><br/> |
| 1153 |
<div class="content">' . pdfprnt_generate_template_for_bws_portfolio() . '</div> |
| 1154 |
</div>'; |
| 1155 |
$mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'] ) ); |
| 1156 |
$mpdf->Output(); |
| 1157 |
unset( $html ); |
| 1158 |
unset( $user_info ); |
| 1159 |
unset( $mpdf ); |
| 1160 |
die(); |
| 1161 |
break; |
| 1162 |
case 'print-portfolio': /* Content for printing from porfolio post */ |
| 1163 |
$html = '<div class="container"> |
| 1164 |
<div class="title"><h1>' . $post->post_title . '</h1></div><br/> |
| 1165 |
<div class="content">' . pdfprnt_generate_template_for_bws_portfolio() . '</div> |
| 1166 |
</div>'; |
| 1167 |
echo pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'], true ); |
| 1168 |
unset( $html ); |
| 1169 |
die(); |
| 1170 |
break; |
| 1171 |
case 'pdf-portfolio-page': /* Content for PDF from portfolio page */ |
| 1172 |
$html = ''; |
| 1173 |
$titles = array(); |
| 1174 |
$authors = array(); |
| 1175 |
generate_query_posts_for_portfolio(); |
| 1176 |
while ( have_posts() ) { |
| 1177 |
the_post(); |
| 1178 |
global $post; |
| 1179 |
if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 1180 |
continue; |
| 1181 |
$titles[] = $post->post_title; |
| 1182 |
$user_info = get_userdata( $post->post_author ); |
| 1183 |
$authors[] = $user_info->display_name; |
| 1184 |
$html .= '<div class="container"> |
| 1185 |
<div class="title"><h1><a href="' . get_permalink( $post->ID ) . '">' . $post->post_title . '</a></h1></div><br/> |
| 1186 |
<div class="content">' . pdfprnt_generate_template_for_bws_portfolio() . '</div> |
| 1187 |
</div><br/><hr/><br/>'; |
| 1188 |
unset( $user_info ); |
| 1189 |
} |
| 1190 |
include ( 'mpdf/mpdf.php' ); |
| 1191 |
$mpdf = new mPDF( get_bloginfo( 'charset' ) ); |
| 1192 |
$mpdf = new mPDF( '+aCJK' ); |
| 1193 |
$titles = array_unique( $titles ); |
| 1194 |
$authors = array_unique( $authors ); |
| 1195 |
$mpdf->SetAutoFont( AUTOFONT_ALL ); |
| 1196 |
$mpdf->SetTitle( implode( ',', $titles ) ); |
| 1197 |
$mpdf->SetAuthor( implode( ',', $authors ) ); |
| 1198 |
$mpdf->SetSubject( get_bloginfo( 'blogdescription' ) ); |
| 1199 |
$mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'] ) ); |
| 1200 |
$mpdf->Output(); |
| 1201 |
unset( $authors ); |
| 1202 |
unset( $titles ); |
| 1203 |
unset( $html ); |
| 1204 |
unset( $mpdf ); |
| 1205 |
die(); |
| 1206 |
break; |
| 1207 |
case 'print-portfolio-page': /* Content for printing from portfolio page */ |
| 1208 |
generate_query_posts_for_portfolio(); |
| 1209 |
$html = ''; |
| 1210 |
while ( have_posts() ) { |
| 1211 |
the_post(); |
| 1212 |
global $post; |
| 1213 |
if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 1214 |
continue; |
| 1215 |
$html .= '<div class="container"> |
| 1216 |
<div class="title"><h1>' . $post->post_title . '</h1></div><br/> |
| 1217 |
<div class="content">' . pdfprnt_generate_template_for_bws_portfolio() . '</div> |
| 1218 |
</div><br/><hr/><br/>'; |
| 1219 |
} |
| 1220 |
echo pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'], true ); |
| 1221 |
unset( $html ); |
| 1222 |
die(); |
| 1223 |
break; |
| 1224 |
case 'pdf-custom-page': /* Content for PDF from custom post */ |
| 1225 |
$html = ''; |
| 1226 |
$titles = $authors = array(); |
| 1227 |
foreach ( $posts as $p ) { |
| 1228 |
if ( ! in_array( get_post_type( $p ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 1229 |
continue; |
| 1230 |
$titles[] = $p->post_title; |
| 1231 |
$user_info = get_userdata( $p->post_author ); |
| 1232 |
$authors[] = $user_info->display_name; |
| 1233 |
$html .= '<div class="container">'; |
| 1234 |
$html .= '<div class="title"><h1><a href="' . get_permalink( $p->ID ) . '">' . $p->post_title . '</a></h1></div><br/>'; |
| 1235 |
$html .= '<div class="content">'; |
| 1236 |
if ( has_post_thumbnail( $p->ID ) ) |
| 1237 |
$html .= get_the_post_thumbnail( $p->ID, 'thumbnail' ); |
| 1238 |
$html .= apply_filters( 'the_content', $p->post_content ) . '</div></div><br/><hr/><br/>'; |
| 1239 |
unset( $user_info ); |
| 1240 |
} |
| 1241 |
include ( 'mpdf/mpdf.php' ); |
| 1242 |
$mpdf = new mPDF( get_bloginfo( 'charset' ) ); |
| 1243 |
$mpdf = new mPDF( '+aCJK' ); |
| 1244 |
$titles = array_unique( $titles ); |
| 1245 |
$authors = array_unique( $authors ); |
| 1246 |
$mpdf->SetAutoFont( AUTOFONT_ALL ); |
| 1247 |
$mpdf->SetTitle( implode( ',', $titles ) ); |
| 1248 |
$mpdf->SetAuthor( implode( ',', $authors ) ); |
| 1249 |
$mpdf->SetSubject( get_bloginfo( 'blogdescription' ) ); |
| 1250 |
$mpdf->WriteHTML( pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'] ) ); |
| 1251 |
$mpdf->Output(); |
| 1252 |
unset( $authors ); |
| 1253 |
unset( $titles ); |
| 1254 |
unset( $html ); |
| 1255 |
unset( $mpdf ); |
| 1256 |
die(); |
| 1257 |
break; |
| 1258 |
case 'print-custom-page': /* Content for printing from custom post */ |
| 1259 |
$html = ''; |
| 1260 |
foreach ( $posts as $p ) { |
| 1261 |
if ( ! in_array( get_post_type( $p ), $pdfprnt_options_array['use_types_posts'] ) ) |
| 1262 |
continue; |
| 1263 |
$html .= '<div class="container">'; |
| 1264 |
$html .= '<div class="title"><h1>' . $p->post_title . '</h1></div><br/>'; |
| 1265 |
$html .= '<div class="content">'; |
| 1266 |
if ( has_post_thumbnail( $p->ID ) ) |
| 1267 |
$html .= get_the_post_thumbnail( $p->ID, 'thumbnail' ); |
| 1268 |
$html .= apply_filters( 'the_content', $p->post_content ) . '</div> |
| 1269 |
</div><br/><hr/><br/>'; |
| 1270 |
} |
| 1271 |
echo pdfprnt_generate_template( $html, $pdfprnt_options_array['tmpl_custom'], true ); |
| 1272 |
unset( $html ); |
| 1273 |
die(); |
| 1274 |
break; |
| 1275 |
} |
| 1276 |
} |
| 1277 |
} |
| 1278 |
} |
| 1279 |
|
| 1280 |
/* Add query vars */ |
| 1281 |
if ( ! function_exists( 'print_vars_callback' ) ) { |
| 1282 |
function print_vars_callback( $query_vars ) { |
| 1283 |
$query_vars[] = 'print'; |
| 1284 |
$query_vars[] = 'tmpl'; |
| 1285 |
return $query_vars; |
| 1286 |
} |
| 1287 |
} |
| 1288 |
|
| 1289 |
/* Add custom admin bar menu */ |
| 1290 |
if ( ! function_exists( 'pdfprnt_admin_bar_menu' ) ) { |
| 1291 |
function pdfprnt_admin_bar_menu() { |
| 1292 |
global $pdfprnt_options_array, $wp_admin_bar, $wp, $posts; |
| 1293 |
if ( ! is_super_admin() || ! is_admin_bar_showing() || is_admin() ) /* Checking user */ |
| 1294 |
return; |
| 1295 |
if ( ( ! is_search() && ! is_archive() ) || ( is_category() || ! have_posts() ) ) |
| 1296 |
return; |
| 1297 |
$is_return = true; |
| 1298 |
foreach ( $posts as $post ) { |
| 1299 |
if ( in_array( get_post_type( $post ), $pdfprnt_options_array['use_types_posts'] ) ) { |
| 1300 |
$is_return = false; |
| 1301 |
break; |
| 1302 |
} |
| 1303 |
} |
| 1304 |
if ( $is_return ) |
| 1305 |
return; |
| 1306 |
if ( empty( $wp->request ) ) |
| 1307 |
$current_url = add_query_arg( $wp->query_string, '', home_url() ); |
| 1308 |
else |
| 1309 |
$current_url = home_url( $wp->request ); |
| 1310 |
$permalink = add_query_arg( 'print', 'pdf-page', $current_url ); |
| 1311 |
$wp_admin_bar->add_menu( array( |
| 1312 |
'id' => 'pdfprnt-bar-menu', |
| 1313 |
'title' => '<span class="admin-bar-menu-bws-icon"></span>PDF', |
| 1314 |
'href' => $permalink |
| 1315 |
) ); |
| 1316 |
$template_url = add_query_arg( 'tmpl', '1', $permalink ); /* Adding parametrs to link */ |
| 1317 |
$wp_admin_bar->add_menu( array( |
| 1318 |
'parent' => 'pdfprnt-bar-menu', |
| 1319 |
'id' => 'pdfprnt-template-1', |
| 1320 |
'title' => '<img src="' . plugins_url( 'images/template_left.jpg', __FILE__ ) . '" alt="template_left" />', |
| 1321 |
'href' => $template_url |
| 1322 |
) ); |
| 1323 |
$template_url = add_query_arg( 'tmpl', '2', $permalink ); /* Adding parametrs to link */ |
| 1324 |
$wp_admin_bar->add_menu( array( |
| 1325 |
'parent' => 'pdfprnt-bar-menu', |
| 1326 |
'id' => 'pdfprnt-template-2', |
| 1327 |
'title' => '<img src="' . plugins_url( 'images/template_center.jpg', __FILE__ ) . '" alt="template_center" />', |
| 1328 |
'href' => $template_url |
| 1329 |
) ); |
| 1330 |
$template_url = add_query_arg( 'tmpl', '3', $permalink ); /* Adding parametrs to link */ |
| 1331 |
$wp_admin_bar->add_menu( array( |
| 1332 |
'parent' => 'pdfprnt-bar-menu', |
| 1333 |
'id' => 'pdfprnt-template-3', |
| 1334 |
'title' => '<img src="' . plugins_url( 'images/template_right.jpg', __FILE__ ) . '" alt="template_right" />', |
| 1335 |
'href' => $template_url |
| 1336 |
) ); |
| 1337 |
unset( $current_url ); |
| 1338 |
unset( $permalink ); |
| 1339 |
unset( $template_url ); |
| 1340 |
} |
| 1341 |
} |
| 1342 |
|
| 1343 |
if ( ! function_exists ( 'pdfprnt_plugin_banner' ) ) { |
| 1344 |
function pdfprnt_plugin_banner() { |
| 1345 |
global $hook_suffix, $pdfprnt_plugin_info; |
| 1346 |
if ( 'plugins.php' == $hook_suffix ) { |
| 1347 |
$banner_array = array( |
| 1348 |
array( 'lmtttmpts_hide_banner_on_plugin_page', 'limit-attempts/limit-attempts.php', '1.0.2' ), |
| 1349 |
array( 'sndr_hide_banner_on_plugin_page', 'sender/sender.php', '0.5' ), |
| 1350 |
array( 'srrl_hide_banner_on_plugin_page', 'user-role/user-role.php', '1.4' ), |
| 1351 |
array( 'pdtr_hide_banner_on_plugin_page', 'updater/updater.php', '1.12' ), |
| 1352 |
array( 'cntctfrmtdb_hide_banner_on_plugin_page', 'contact-form-to-db/contact_form_to_db.php', '1.2' ), |
| 1353 |
array( 'cntctfrmmlt_hide_banner_on_plugin_page', 'contact-form-multi/contact-form-multi.php', '1.0.7' ), |
| 1354 |
array( 'gglmps_hide_banner_on_plugin_page', 'bws-google-maps/bws-google-maps.php', '1.2' ), |
| 1355 |
array( 'fcbkbttn_hide_banner_on_plugin_page', 'facebook-button-plugin/facebook-button-plugin.php', '2.29' ), |
| 1356 |
array( 'twttr_hide_banner_on_plugin_page', 'twitter-plugin/twitter.php', '2.34' ), |
| 1357 |
array( 'pdfprnt_hide_banner_on_plugin_page', 'pdf-print/pdf-print.php', '1.7.1' ), |
| 1358 |
array( 'gglplsn_hide_banner_on_plugin_page', 'google-one/google-plus-one.php', '1.1.4' ), |
| 1359 |
array( 'gglstmp_hide_banner_on_plugin_page', 'google-sitemap-plugin/google-sitemap-plugin.php', '2.8.4' ), |
| 1360 |
array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ), |
| 1361 |
array( 'cntctfrm_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.62' ), |
| 1362 |
array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ), |
| 1363 |
array( 'cptch_hide_banner_on_plugin_page', 'captcha/captcha.php', '3.8.4' ), |
| 1364 |
array( 'gllr_hide_banner_on_plugin_page', 'gallery-plugin/gallery-plugin.php', '3.9.1' ) |
| 1365 |
); |
| 1366 |
if ( ! $pdfprnt_plugin_info ) |
| 1367 |
$pdfprnt_plugin_info = get_plugin_data( __FILE__ ); |
| 1368 |
if ( ! function_exists( 'is_plugin_active_for_network' ) ) |
| 1369 |
require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
| 1370 |
$active_plugins = get_option( 'active_plugins' ); |
| 1371 |
$all_plugins = get_plugins(); |
| 1372 |
$this_banner = 'pdfprnt_hide_banner_on_plugin_page'; |
| 1373 |
foreach ( $banner_array as $key => $value ) { |
| 1374 |
if ( $this_banner == $value[0] ) { |
| 1375 |
global $wp_version, $bstwbsftwppdtplgns_cookie_add; |
| 1376 |
if ( ! isset( $bstwbsftwppdtplgns_cookie_add ) ) { |
| 1377 |
echo '<script type="text/javascript" src="' . plugins_url( 'js/c_o_o_k_i_e.js', __FILE__ ) . '"></script>'; |
| 1378 |
$bstwbsftwppdtplgns_cookie_add = true; |
| 1379 |
} ?> |
| 1380 |
<script type="text/javascript"> |
| 1381 |
(function($) { |
| 1382 |
$(document).ready( function() { |
| 1383 |
var hide_message = $.cookie( "pdfprnt_hide_banner_on_plugin_page" ); |
| 1384 |
if ( hide_message == "true") { |
| 1385 |
$( ".pdfprnt_message" ).css( "display", "none" ); |
| 1386 |
} else { |
| 1387 |
$( ".pdfprnt_message" ).css( "display", "block" ); |
| 1388 |
}; |
| 1389 |
$( ".pdfprnt_close_icon" ).click( function() { |
| 1390 |
$( ".pdfprnt_message" ).css( "display", "none" ); |
| 1391 |
$.cookie( "pdfprnt_hide_banner_on_plugin_page", "true", { expires: 32 } ); |
| 1392 |
}); |
| 1393 |
}); |
| 1394 |
})(jQuery); |
| 1395 |
</script> |
| 1396 |
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;"> |
| 1397 |
<div class="pdfprnt_message bws_banner_on_plugin_page" style="display: none;"> |
| 1398 |
<img class="pdfprnt_close_icon close_icon" title="" src="<?php echo plugins_url( 'images/close_banner.png', __FILE__ ); ?>" alt=""/> |
| 1399 |
<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> |
| 1401 |
</div> |
| 1402 |
<div class="text"> |
| 1403 |
<?php _e( "It's time to upgrade your <strong>PDF & Print</strong> to <strong>PRO</strong> version", 'pdf-print' ); ?>!<br /> |
| 1404 |
<span><?php _e( 'Extend standard plugin functionality with new great options', 'pdf-print' ); ?>.</span> |
| 1405 |
</div> |
| 1406 |
<div class="icon"> |
| 1407 |
<img title="" src="<?php echo plugins_url( 'images/banner.png', __FILE__ ); ?>" alt=""/> |
| 1408 |
</div> |
| 1409 |
</div> |
| 1410 |
</div> |
| 1411 |
<?php break; |
| 1412 |
} |
| 1413 |
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] ] ) ) { |
| 1414 |
break; |
| 1415 |
} |
| 1416 |
} |
| 1417 |
} |
| 1418 |
} |
| 1419 |
} |
| 1420 |
|
| 1421 |
/* Deleting plugin options on uninstalling */ |
| 1422 |
if ( ! function_exists( 'pdfprnt_uninstall' ) ) { |
| 1423 |
function pdfprnt_uninstall() { |
| 1424 |
delete_option( 'pdfprnt_options_array' ); |
| 1425 |
} |
| 1426 |
} |
| 1427 |
|
| 1428 |
/* Adding function to output PDF document or pirnt page */ |
| 1429 |
add_action( 'wp', 'pdfprnt_print' ); |
| 1430 |
/* Initialization */ |
| 1431 |
add_action( 'init', 'pdfprnt_init' ); |
| 1432 |
add_action( 'admin_init', 'pdfprnt_admin_init' ); |
| 1433 |
/* Adding stylesheets */ |
| 1434 |
add_action( 'admin_enqueue_scripts', 'pdfprnt_admin_head' ); |
| 1435 |
add_action( 'wp_enqueue_scripts', 'pdfprnt_admin_head' ); |
| 1436 |
/* Adding 'BWS Plugins' admin menu */ |
| 1437 |
add_action( 'admin_menu', 'pdfprnt_add_pages' ); |
| 1438 |
/* Add menu to bar menu WordPress */ |
| 1439 |
add_action( 'admin_bar_menu', 'pdfprnt_admin_bar_menu', 1000 ); |
| 1440 |
/* Add query vars */ |
| 1441 |
add_filter( 'query_vars', 'print_vars_callback' ); |
| 1442 |
/* Additional links on the plugin page */ |
| 1443 |
add_filter( 'plugin_action_links', 'pdfprnt_action_links', 10, 2 ); |
| 1444 |
add_filter( 'plugin_row_meta', 'pdfprnt_links', 10, 2 ); |
| 1445 |
/* Adding buttons plugin to content */ |
| 1446 |
add_filter( 'the_content', 'pdfprnt_content' ); |
| 1447 |
/* Adding banner */ |
| 1448 |
add_action( 'admin_notices', 'pdfprnt_plugin_banner' ); |
| 1449 |
/* Plugin uninstall function */ |
| 1450 |
register_uninstall_hook( __FILE__, 'pdfprnt_uninstall' ); |
| 1451 |
?> |