Version Description
- NEW: Use translate.wordpress.org to translate the plugin
- FIXED: Unable to update options
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-Print |
Version | 2.57.1 |
Comparing to | |
See all releases |
Code changes from version 2.57 to 2.57.1
- print-options.php +171 -172
- readme.txt +5 -1
- wp-print.php +2 -2
print-options.php
CHANGED
@@ -1,190 +1,189 @@
|
|
1 |
<?php
|
2 |
### Variables Variables Variables
|
3 |
-
$base_name = plugin_basename('wp-print/print-options.php');
|
4 |
-
$base_page = 'admin.php?page='
|
5 |
-
$mode = ! empty( $_GET['mode'] ) ? trim( $_GET['mode'] ) : '';
|
6 |
$print_settings = array('print_options');
|
7 |
|
8 |
|
9 |
### Form Processing
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
}
|
40 |
|
41 |
$print_options = get_option( 'print_options' );
|
42 |
?>
|
43 |
<script type="text/javascript">
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
</script>
|
68 |
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
|
69 |
<form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>">
|
70 |
<?php wp_nonce_field('wp-print_options'); ?>
|
71 |
<div class="wrap">
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
</div>
|
190 |
</form>
|
1 |
<?php
|
2 |
### Variables Variables Variables
|
3 |
+
$base_name = plugin_basename( 'wp-print/print-options.php' );
|
4 |
+
$base_page = 'admin.php?page=' . $base_name;
|
|
|
5 |
$print_settings = array('print_options');
|
6 |
|
7 |
|
8 |
### Form Processing
|
9 |
+
if( ! empty( $_POST['Submit'] ) ) {
|
10 |
+
check_admin_referer( 'wp-print_options' );
|
11 |
+
|
12 |
+
$print_options = array();
|
13 |
+
$print_options['post_text'] = ! empty( $_POST['print_post_text'] ) ? addslashes( trim( wp_filter_kses( $_POST['print_post_text'] ) ) ) : '';
|
14 |
+
$print_options['page_text'] = ! empty( $_POST['print_page_text'] ) ? addslashes( trim( wp_filter_kses( $_POST['print_page_text'] ) ) ) : '';
|
15 |
+
$print_options['print_icon'] = ! empty( $_POST['print_icon'] ) ? trim( $_POST['print_icon'] ) : '';
|
16 |
+
$print_options['print_style'] = isset( $_POST['print_style'] ) ? intval($_POST['print_style'] ) : 1;
|
17 |
+
$print_options['print_html'] = ! empty( $_POST['print_html'] ) ? trim( $_POST['print_html'] ) : '';
|
18 |
+
$print_options['comments'] = isset( $_POST['print_comments'] ) ? intval( $_POST['print_comments'] ): 0;
|
19 |
+
$print_options['links'] = isset( $_POST['print_links'] ) ? intval( $_POST['print_links'] ) : 1;
|
20 |
+
$print_options['images'] = isset( $_POST['print_images'] ) ? intval( $_POST['print_images'] ) : 0;
|
21 |
+
$print_options['videos'] = isset( $_POST['print_videos'] ) ? intval( $_POST['print_videos'] ) : 1;
|
22 |
+
$print_options['disclaimer'] = ! empty( $_POST['print_disclaimer'] ) ? trim( $_POST['print_disclaimer'] ) : '';
|
23 |
+
$update_print_queries = array();
|
24 |
+
$update_print_text = array();
|
25 |
+
$update_print_queries[] = update_option( 'print_options', $print_options );
|
26 |
+
$update_print_text[] = __( 'Print Options', 'wp-print' );
|
27 |
+
$i = 0;
|
28 |
+
$text = '';
|
29 |
+
foreach( $update_print_queries as $update_print_query ) {
|
30 |
+
if( $update_print_query ) {
|
31 |
+
$text .= '<p style="color: green;">' . $update_print_text[$i] . ' ' .__( 'Updated', 'wp-print' ) . '</p>';
|
32 |
+
}
|
33 |
+
$i++;
|
34 |
+
}
|
35 |
+
if( empty( $text ) ) {
|
36 |
+
$text = '<p style="color: red;">' . __( 'No Print Option Updated', 'wp-print' ) . '</p>';
|
37 |
+
}
|
38 |
}
|
39 |
|
40 |
$print_options = get_option( 'print_options' );
|
41 |
?>
|
42 |
<script type="text/javascript">
|
43 |
+
/* <![CDATA[*/
|
44 |
+
function check_print_style() {
|
45 |
+
if (parseInt(jQuery("#print_style").val()) == 4) {
|
46 |
+
jQuery("#print_style_custom").show();
|
47 |
+
} else {
|
48 |
+
if(jQuery("#print_style_custom").is(":visible")) {
|
49 |
+
jQuery("#print_style_custom").hide();
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
function print_default_templates(template) {
|
54 |
+
var default_template;
|
55 |
+
switch(template) {
|
56 |
+
case 'html':
|
57 |
+
default_template = '<a href="%PRINT_URL%" rel="nofollow" title="%PRINT_TEXT%">%PRINT_TEXT%</a>';
|
58 |
+
break;
|
59 |
+
case 'disclaimer':
|
60 |
+
default_template = '<?php echo js_escape(sprintf(__('Copyright © %s %s. All rights reserved.', 'wp-print'), date('Y'), get_option('blogname'))); ?>';
|
61 |
+
break;
|
62 |
+
}
|
63 |
+
jQuery("#print_template_" + template).val(default_template);
|
64 |
+
}
|
65 |
+
/* ]]> */
|
66 |
</script>
|
67 |
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
|
68 |
<form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>">
|
69 |
<?php wp_nonce_field('wp-print_options'); ?>
|
70 |
<div class="wrap">
|
71 |
+
<?php screen_icon(); ?>
|
72 |
+
<h2><?php _e('Print Options', 'wp-print'); ?></h2>
|
73 |
+
<h3><?php _e('Print Styles', 'wp-print'); ?></h3>
|
74 |
+
<table class="form-table">
|
75 |
+
<tr>
|
76 |
+
<th scope="row" valign="top"><?php _e('Print Text Link For Post', 'wp-print'); ?></th>
|
77 |
+
<td>
|
78 |
+
<input type="text" name="print_post_text" value="<?php echo stripslashes($print_options['post_text']); ?>" size="30" />
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<th scope="row" valign="top"><?php _e('Print Text Link For Page', 'wp-print'); ?></th>
|
83 |
+
<td>
|
84 |
+
<input type="text" name="print_page_text" value="<?php echo stripslashes($print_options['page_text']); ?>" size="30" />
|
85 |
+
</td>
|
86 |
+
</tr>
|
87 |
+
<tr>
|
88 |
+
<th scope="row" valign="top"><?php _e('Print Icon', 'wp-print'); ?></th>
|
89 |
+
<td>
|
90 |
+
<?php
|
91 |
+
$print_icon = $print_options['print_icon'];
|
92 |
+
$print_icon_url = plugins_url('wp-print/images');
|
93 |
+
$print_icon_path = WP_PLUGIN_DIR.'/wp-print/images';
|
94 |
+
if($handle = @opendir($print_icon_path)) {
|
95 |
+
while (false !== ($filename = readdir($handle))) {
|
96 |
+
if ($filename != '.' && $filename != '..') {
|
97 |
+
if(is_file($print_icon_path.'/'.$filename)) {
|
98 |
+
echo '<p>';
|
99 |
+
if($print_icon == $filename) {
|
100 |
+
echo '<input type="radio" name="print_icon" value="'.$filename.'" checked="checked" />'."\n";
|
101 |
+
} else {
|
102 |
+
echo '<input type="radio" name="print_icon" value="'.$filename.'" />'."\n";
|
103 |
+
}
|
104 |
+
echo ' ';
|
105 |
+
echo '<img src="'.$print_icon_url.'/'.$filename.'" alt="'.$filename.'" />'."\n";
|
106 |
+
echo ' ('.$filename.')';
|
107 |
+
echo '</p>'."\n";
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
closedir($handle);
|
112 |
+
}
|
113 |
+
?>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<tr>
|
117 |
+
<th scope="row" valign="top"><?php _e('Print Text Link Style', 'wp-print'); ?></th>
|
118 |
+
<td>
|
119 |
+
<select name="print_style" id="print_style" size="1" onchange="check_print_style();">
|
120 |
+
<option value="1"<?php selected('1', $print_options['print_style']); ?>><?php _e('Print Icon With Text Link', 'wp-print'); ?></option>
|
121 |
+
<option value="2"<?php selected('2', $print_options['print_style']); ?>><?php _e('Print Icon Only', 'wp-print'); ?></option>
|
122 |
+
<option value="3"<?php selected('3', $print_options['print_style']); ?>><?php _e('Print Text Link Only', 'wp-print'); ?></option>
|
123 |
+
<option value="4"<?php selected('4', $print_options['print_style']); ?>><?php _e('Custom', 'wp-print'); ?></option>
|
124 |
+
</select>
|
125 |
+
<div id="print_style_custom" style="display: <?php if(intval($print_options['print_style']) == 4) { echo 'block'; } else { echo 'none'; } ?>; margin-top: 20px;">
|
126 |
+
<textarea rows="2" cols="80" name="print_html" id="print_template_html"><?php echo htmlspecialchars(stripslashes($print_options['print_html'])); ?></textarea><br />
|
127 |
+
<?php _e('HTML is allowed.', 'wp-print'); ?><br />
|
128 |
+
%PRINT_URL% - <?php _e('URL to the printable post/page.', 'wp-print'); ?><br />
|
129 |
+
%PRINT_TEXT% - <?php _e('Print text link of the post/page that you have typed in above.', 'wp-print'); ?><br />
|
130 |
+
%PRINT_ICON_URL% - <?php _e('URL to the print icon you have chosen above.', 'wp-print'); ?><br />
|
131 |
+
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-print'); ?>" onclick="print_default_templates('html');" class="button" />
|
132 |
+
</div>
|
133 |
+
</td>
|
134 |
+
</tr>
|
135 |
+
</table>
|
136 |
+
<h3><?php _e('Print Options', 'wp-print'); ?></h3>
|
137 |
+
<table class="form-table">
|
138 |
+
<tr>
|
139 |
+
<th scope="row" valign="top"><?php _e('Print Comments?', 'wp-print'); ?></th>
|
140 |
+
<td>
|
141 |
+
<select name="print_comments" size="1">
|
142 |
+
<option value="1"<?php selected('1', $print_options['comments']); ?>><?php _e('Yes', 'wp-print'); ?></option>
|
143 |
+
<option value="0"<?php selected('0', $print_options['comments']); ?>><?php _e('No', 'wp-print'); ?></option>
|
144 |
+
</select>
|
145 |
+
</td>
|
146 |
+
</tr>
|
147 |
+
<tr>
|
148 |
+
<th scope="row" valign="top"><?php _e('Print Links?', 'wp-print'); ?></th>
|
149 |
+
<td>
|
150 |
+
<select name="print_links" size="1">
|
151 |
+
<option value="1"<?php selected('1', $print_options['links']); ?>><?php _e('Yes', 'wp-print'); ?></option>
|
152 |
+
<option value="0"<?php selected('0', $print_options['links']); ?>><?php _e('No', 'wp-print'); ?></option>
|
153 |
+
</select>
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
<tr>
|
157 |
+
<th scope="row" valign="top"><?php _e('Print Images?', 'wp-print'); ?></th>
|
158 |
+
<td>
|
159 |
+
<select name="print_images" size="1">
|
160 |
+
<option value="1"<?php selected('1', $print_options['images']); ?>><?php _e('Yes', 'wp-print'); ?></option>
|
161 |
+
<option value="0"<?php selected('0', $print_options['images']); ?>><?php _e('No', 'wp-print'); ?></option>
|
162 |
+
</select>
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
+
<tr>
|
166 |
+
<th scope="row" valign="top"><?php _e('Print Videos?', 'wp-print'); ?></th>
|
167 |
+
<td>
|
168 |
+
<select name="print_videos" size="1">
|
169 |
+
<option value="1"<?php selected('1', $print_options['videos']); ?>><?php _e('Yes', 'wp-print'); ?></option>
|
170 |
+
<option value="0"<?php selected('0', $print_options['videos']); ?>><?php _e('No', 'wp-print'); ?></option>
|
171 |
+
</select>
|
172 |
+
</td>
|
173 |
+
</tr>
|
174 |
+
<tr>
|
175 |
+
<th scope="row" valign="top">
|
176 |
+
<?php _e('Disclaimer/Copyright Text?', 'wp-print'); ?>
|
177 |
+
<br /><br />
|
178 |
+
<input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-print'); ?>" onclick="print_default_templates('disclaimer');" class="button" />
|
179 |
+
</th>
|
180 |
+
<td>
|
181 |
+
<textarea rows="2" cols="80" name="print_disclaimer" id="print_template_disclaimer"><?php echo htmlspecialchars(stripslashes($print_options['disclaimer'])); ?></textarea><br /><?php _e('HTML is allowed.', 'wp-print'); ?><br />
|
182 |
+
</td>
|
183 |
+
</tr>
|
184 |
+
</table>
|
185 |
+
<p class="submit">
|
186 |
+
<input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-print'); ?>" />
|
187 |
+
</p>
|
188 |
</div>
|
189 |
</form>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://lesterchan.net/site/donation/
|
|
4 |
Tags: print, printer, wp-print
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 4.4
|
7 |
-
Stable tag: 2.57
|
8 |
|
9 |
Displays a printable version of your WordPress blog's post/page.
|
10 |
|
@@ -89,6 +89,10 @@ if(function_exists('wp_print')) {
|
|
89 |
|
90 |
|
91 |
== Changelog ==
|
|
|
|
|
|
|
|
|
92 |
= 2.57 =
|
93 |
* FIXED: Notices
|
94 |
|
4 |
Tags: print, printer, wp-print
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 4.4
|
7 |
+
Stable tag: 2.57.1
|
8 |
|
9 |
Displays a printable version of your WordPress blog's post/page.
|
10 |
|
89 |
|
90 |
|
91 |
== Changelog ==
|
92 |
+
= 2.57.1 =
|
93 |
+
* NEW: Use translate.wordpress.org to translate the plugin
|
94 |
+
* FIXED: Unable to update options
|
95 |
+
|
96 |
= 2.57 =
|
97 |
* FIXED: Notices
|
98 |
|
wp-print.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP-Print
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Displays a printable version of your WordPress blog's post/page.
|
6 |
-
Version: 2.57
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-print
|
@@ -32,7 +32,7 @@ Text Domain: wp-print
|
|
32 |
### Create Text Domain For Translations
|
33 |
add_action( 'plugins_loaded', 'print_textdomain' );
|
34 |
function print_textdomain() {
|
35 |
-
load_plugin_textdomain( 'wp-print'
|
36 |
}
|
37 |
|
38 |
|
3 |
Plugin Name: WP-Print
|
4 |
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
Description: Displays a printable version of your WordPress blog's post/page.
|
6 |
+
Version: 2.57.1
|
7 |
Author: Lester 'GaMerZ' Chan
|
8 |
Author URI: http://lesterchan.net
|
9 |
Text Domain: wp-print
|
32 |
### Create Text Domain For Translations
|
33 |
add_action( 'plugins_loaded', 'print_textdomain' );
|
34 |
function print_textdomain() {
|
35 |
+
load_plugin_textdomain( 'wp-print' );
|
36 |
}
|
37 |
|
38 |
|