PluginProbe
WP-Print / 2.56
WP-Print v2.56
3.0.0 trunk 1.00 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.10 2.11 2.20 2.30 2.31 2.40 2.50 2.52 2.53 2.54 2.55 2.56 2.57 2.57.1 2.57.2 All 29 releases
wp-print / print-options.php

print-options.php in WP-Print 2.56, at print-options.php

190 lines 8.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $mode = isset($_GET['mode']) ? trim($_GET['mode']) : '';
6 $print_settings = array('print_options');
7
8
9 ### Form Processing
10 // Update Options
11 if(!empty($_POST['Submit'])) {
12 check_admin_referer('wp-print_options');
13 $print_options = array();
14 $print_options['post_text'] = addslashes(trim(wp_filter_kses($_POST['print_post_text'])));
15 $print_options['page_text'] = addslashes(trim(wp_filter_kses($_POST['print_page_text'])));
16 $print_options['print_icon'] = trim($_POST['print_icon']);
17 $print_options['print_style'] = intval($_POST['print_style']);
18 $print_options['print_html'] = trim($_POST['print_html']);
19 $print_options['comments'] = intval($_POST['print_comments']);
20 $print_options['links'] = intval($_POST['print_links']);
21 $print_options['images'] = intval($_POST['print_images']);
22 $print_options['videos'] = intval($_POST['print_videos']);
23 $print_options['disclaimer'] = trim($_POST['print_disclaimer']);
24 $update_print_queries = array();
25 $update_print_text = array();
26 $update_print_queries[] = update_option('print_options', $print_options);
27 $update_print_text[] = __('Print Options', 'wp-print');
28 $i=0;
29 $text = '';
30 foreach($update_print_queries as $update_print_query) {
31 if($update_print_query) {
32 $text .= '<p style="color: green;">'.$update_print_text[$i].' '.__('Updated', 'wp-print').'</p>';
33 }
34 $i++;
35 }
36 if(empty($text)) {
37 $text = '<p style="color: red;">'.__('No Print Option Updated', 'wp-print').'</p>';
38 }
39 }
40
41 $print_options = get_option('print_options');
42 ?>
43 <script type="text/javascript">
44 /* <![CDATA[*/
45 function check_print_style() {
46 if (parseInt(jQuery("#print_style").val()) == 4) {
47 jQuery("#print_style_custom").show();
48 } else {
49 if(jQuery("#print_style_custom").is(":visible")) {
50 jQuery("#print_style_custom").hide();
51 }
52 }
53 }
54 function print_default_templates(template) {
55 var default_template;
56 switch(template) {
57 case 'html':
58 default_template = '<a href="%PRINT_URL%" rel="nofollow" title="%PRINT_TEXT%">%PRINT_TEXT%</a>';
59 break;
60 case 'disclaimer':
61 default_template = '<?php echo js_escape(sprintf(__('Copyright &copy; %s %s. All rights reserved.', 'wp-print'), date('Y'), get_option('blogname'))); ?>';
62 break;
63 }
64 jQuery("#print_template_" + template).val(default_template);
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 <?php screen_icon(); ?>
73 <h2><?php _e('Print Options', 'wp-print'); ?></h2>
74 <h3><?php _e('Print Styles', 'wp-print'); ?></h3>
75 <table class="form-table">
76 <tr>
77 <th scope="row" valign="top"><?php _e('Print Text Link For Post', 'wp-print'); ?></th>
78 <td>
79 <input type="text" name="print_post_text" value="<?php echo stripslashes($print_options['post_text']); ?>" size="30" />
80 </td>
81 </tr>
82 <tr>
83 <th scope="row" valign="top"><?php _e('Print Text Link For Page', 'wp-print'); ?></th>
84 <td>
85 <input type="text" name="print_page_text" value="<?php echo stripslashes($print_options['page_text']); ?>" size="30" />
86 </td>
87 </tr>
88 <tr>
89 <th scope="row" valign="top"><?php _e('Print Icon', 'wp-print'); ?></th>
90 <td>
91 <?php
92 $print_icon = $print_options['print_icon'];
93 $print_icon_url = plugins_url('wp-print/images');
94 $print_icon_path = WP_PLUGIN_DIR.'/wp-print/images';
95 if($handle = @opendir($print_icon_path)) {
96 while (false !== ($filename = readdir($handle))) {
97 if ($filename != '.' && $filename != '..') {
98 if(is_file($print_icon_path.'/'.$filename)) {
99 echo '<p>';
100 if($print_icon == $filename) {
101 echo '<input type="radio" name="print_icon" value="'.$filename.'" checked="checked" />'."\n";
102 } else {
103 echo '<input type="radio" name="print_icon" value="'.$filename.'" />'."\n";
104 }
105 echo '&nbsp;&nbsp;&nbsp;';
106 echo '<img src="'.$print_icon_url.'/'.$filename.'" alt="'.$filename.'" />'."\n";
107 echo '&nbsp;&nbsp;&nbsp;('.$filename.')';
108 echo '</p>'."\n";
109 }
110 }
111 }
112 closedir($handle);
113 }
114 ?>
115 </td>
116 </tr>
117 <tr>
118 <th scope="row" valign="top"><?php _e('Print Text Link Style', 'wp-print'); ?></th>
119 <td>
120 <select name="print_style" id="print_style" size="1" onchange="check_print_style();">
121 <option value="1"<?php selected('1', $print_options['print_style']); ?>><?php _e('Print Icon With Text Link', 'wp-print'); ?></option>
122 <option value="2"<?php selected('2', $print_options['print_style']); ?>><?php _e('Print Icon Only', 'wp-print'); ?></option>
123 <option value="3"<?php selected('3', $print_options['print_style']); ?>><?php _e('Print Text Link Only', 'wp-print'); ?></option>
124 <option value="4"<?php selected('4', $print_options['print_style']); ?>><?php _e('Custom', 'wp-print'); ?></option>
125 </select>
126 <div id="print_style_custom" style="display: <?php if(intval($print_options['print_style']) == 4) { echo 'block'; } else { echo 'none'; } ?>; margin-top: 20px;">
127 <textarea rows="2" cols="80" name="print_html" id="print_template_html"><?php echo htmlspecialchars(stripslashes($print_options['print_html'])); ?></textarea><br />
128 <?php _e('HTML is allowed.', 'wp-print'); ?><br />
129 %PRINT_URL% - <?php _e('URL to the printable post/page.', 'wp-print'); ?><br />
130 %PRINT_TEXT% - <?php _e('Print text link of the post/page that you have typed in above.', 'wp-print'); ?><br />
131 %PRINT_ICON_URL% - <?php _e('URL to the print icon you have chosen above.', 'wp-print'); ?><br />
132 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-print'); ?>" onclick="print_default_templates('html');" class="button" />
133 </div>
134 </td>
135 </tr>
136 </table>
137 <h3><?php _e('Print Options', 'wp-print'); ?></h3>
138 <table class="form-table">
139 <tr>
140 <th scope="row" valign="top"><?php _e('Print Comments?', 'wp-print'); ?></th>
141 <td>
142 <select name="print_comments" size="1">
143 <option value="1"<?php selected('1', $print_options['comments']); ?>><?php _e('Yes', 'wp-print'); ?></option>
144 <option value="0"<?php selected('0', $print_options['comments']); ?>><?php _e('No', 'wp-print'); ?></option>
145 </select>
146 </td>
147 </tr>
148 <tr>
149 <th scope="row" valign="top"><?php _e('Print Links?', 'wp-print'); ?></th>
150 <td>
151 <select name="print_links" size="1">
152 <option value="1"<?php selected('1', $print_options['links']); ?>><?php _e('Yes', 'wp-print'); ?></option>
153 <option value="0"<?php selected('0', $print_options['links']); ?>><?php _e('No', 'wp-print'); ?></option>
154 </select>
155 </td>
156 </tr>
157 <tr>
158 <th scope="row" valign="top"><?php _e('Print Images?', 'wp-print'); ?></th>
159 <td>
160 <select name="print_images" size="1">
161 <option value="1"<?php selected('1', $print_options['images']); ?>><?php _e('Yes', 'wp-print'); ?></option>
162 <option value="0"<?php selected('0', $print_options['images']); ?>><?php _e('No', 'wp-print'); ?></option>
163 </select>
164 </td>
165 </tr>
166 <tr>
167 <th scope="row" valign="top"><?php _e('Print Videos?', 'wp-print'); ?></th>
168 <td>
169 <select name="print_videos" size="1">
170 <option value="1"<?php selected('1', $print_options['videos']); ?>><?php _e('Yes', 'wp-print'); ?></option>
171 <option value="0"<?php selected('0', $print_options['videos']); ?>><?php _e('No', 'wp-print'); ?></option>
172 </select>
173 </td>
174 </tr>
175 <tr>
176 <th scope="row" valign="top">
177 <?php _e('Disclaimer/Copyright Text?', 'wp-print'); ?>
178 <br /><br />
179 <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-print'); ?>" onclick="print_default_templates('disclaimer');" class="button" />
180 </th>
181 <td>
182 <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 />
183 </td>
184 </tr>
185 </table>
186 <p class="submit">
187 <input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-print'); ?>" />
188 </p>
189 </div>
190 </form>