PluginProbe
Insert PHP Code Snippet / trunk
Insert PHP Code Snippet vtrunk
1.4.7 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 All 27 releases
← All changes | admin/settings.php +206 -79 1.2trunk View file →
@@ -1,98 +1,225 @@
1 1 <?php
2 +if ( ! defined( 'ABSPATH' ) )
3 + exit;
2 4
3 5 global $wpdb;
4 6 // Load the options
7 +if(!$_POST && isset($_GET['ips_notice'])&& $_GET['ips_notice'] == 'hide'){
8 + if (! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'],'ips-shw')){
9 + wp_nonce_ays( 'ips-shw');
10 + exit;
11 + }
12 + update_option('xyz_ips_dnt_shw_notice', "hide");
13 +?>
14 +<style type='text/css'>
15 + #ips_notice_td{
16 + display:none !important;
17 + }
18 +</style>
19 +<div class="xyz_ips_system_notice_area_style1" id="xyz_ips_system_notice_area">
20 + Thanks again for using the plugin. We will never show the message again.
21 + &nbsp;&nbsp;&nbsp;
22 + <span id="xyz_ips_system_notice_area_dismiss">Dismiss</span>
23 +</div>
24 +<?php
25 +}
5 26
27 +if($_POST){
28 + if (! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ips-psetting_' )) {
29 + wp_nonce_ays( 'ips-psetting_' );
30 + exit;
31 + }
32 + else{
33 + $_POST=xyz_trim_deep($_POST);
34 + $_POST = stripslashes_deep($_POST);
6 35
7 -if($_POST){
8 -
9 - $_POST=xyz_trim_deep($_POST);
10 - $_POST = stripslashes_deep($_POST);
11 -
12 - $xyz_ips_limit = abs(intval($_POST['xyz_ips_limit']));
13 - if($xyz_ips_limit==0)$xyz_ips_limit=20;
14 -
15 - $xyz_ips_credit = $_POST['xyz_ips_credit'];
36 + $xyz_ips_pre_ads = intval($_POST['xyz_ips_pre_ads']);
37 + $xyz_ips_limit = abs(intval($_POST['xyz_ips_limit']));
16 38
17 - $xyz_ips_sortfield=$_POST['xyz_ips_sort_by_field'];
18 - $xyz_ips_sortorder=$_POST['xyz_ips_sort_by_order'];
19 -
20 - update_option('xyz_ips_limit',$xyz_ips_limit);
21 - update_option('xyz_credit_link',$xyz_ips_credit);
39 + if($xyz_ips_limit==0)$xyz_ips_limit=20;
40 + $xyz_ips_credit = sanitize_text_field($_POST['xyz_ips_credit']);
22 41
42 + if(($xyz_ips_credit=="ips")||($xyz_ips_credit==0))
43 + update_option('xyz_credit_link',$xyz_ips_credit);
23 44
24 - update_option('xyz_ips_sort_field_name',$xyz_ips_sortfield);
25 - update_option('xyz_ips_sort_order',$xyz_ips_sortorder);
45 + $xyz_ips_auto_insert = intval($_POST['xyz_ips_auto_insert']);
46 + update_option('xyz_ips_auto_insert',$xyz_ips_auto_insert);
26 47
27 -
28 - ?>
29 -
30 - <div class="system_notice_area_style1" id="system_notice_area">
31 - Settings updated successfully. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
32 - </div>
33 - <?php
34 -}
48 + $xyz_ips_exec_in_editor = intval($_POST['xyz_ips_exec_in_editor']);
49 + update_option('xyz_ips_exec_in_editor',$xyz_ips_exec_in_editor);
50 + $xyz_ips_auto_exception = intval($_POST['xyz_ips_auto_exception']);
51 + update_option('xyz_ips_auto_exception',$xyz_ips_auto_exception);
35 52
53 + $xyz_ips_exception_email=sanitize_text_field($_POST['xyz_ips_exception_email']);
54 + update_option('xyz_ips_exception_email',$xyz_ips_exception_email);
36 55
56 + $xyz_ips_show_snippet_usage=intval($_POST['xyz_ips_show_snippet_usage']);
57 + update_option('xyz_ips_show_snippet_usage',$xyz_ips_show_snippet_usage);
58 + $xyz_ips_sortfield=sanitize_text_field($_POST['xyz_ips_sort_by_field']);
59 +
60 + if(($xyz_ips_sortfield=="id")||($xyz_ips_sortfield=="title"))
61 + update_option('xyz_ips_sort_field_name',$xyz_ips_sortfield);
62 +
63 + $xyz_ips_sortorder=sanitize_text_field($_POST['xyz_ips_sort_by_order']);
64 +
65 + if(($xyz_ips_sortorder=="asc")||($xyz_ips_sortorder=="desc"))
66 + update_option('xyz_ips_sort_order',$xyz_ips_sortorder);
67 +
68 + update_option('xyz_ips_limit',$xyz_ips_limit);
37 69 ?>
70 +<div class="xyz_ips_system_notice_area_style1" id="xyz_ips_system_notice_area">
71 + Settings updated successfully. &nbsp;&nbsp;&nbsp;
72 + <span id="xyz_ips_system_notice_area_dismiss">Dismiss</span>
73 +</div>
74 +<?php
75 + }
76 +}
77 +?>
78 +<script type="text/javascript">
38 79
39 -<div>
80 + jQuery(document).ready(function() {
81 + changeAutoException();
40 82
41 -
42 - <form method="post">
43 - <div style="float: left;width: 98%">
44 - <fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
45 - <legend ><h3>Settings</h3></legend>
46 - <table class="widefat" style="width:99%;">
47 -
48 - <tr valign="top">
49 - <td scope="row" ><label for="xyz_ihs_sort">Sorting of snippets</label>
50 - </td>
51 -
83 + });
52 84
53 -<td>
54 - <select id="xyz_ips_sort_by_field" name="xyz_ips_sort_by_field" >
55 - <option value="id" <?php if(isset($_POST['xyz_ips_sort_by_field']) && $_POST['xyz_ips_sort_by_field']=='id'){echo 'selected';} else if(get_option('xyz_ips_sort_field_name')=="id"){echo 'selected';} ?>>Based on create time</option>
56 - <option value="title" <?php if(isset($_POST['xyz_ips_sort_by_field']) && $_POST['xyz_ips_sort_by_field']=='title'){ echo 'selected';}else if(get_option('xyz_ips_sort_field_name')=="title"){echo 'selected';} ?>>Based on name</option>
57 - </select>&nbsp;
58 - <select id="xyz_ips_sort_by_order" name="xyz_ips_sort_by_order" >
59 - <option value="desc" <?php if(isset($_POST['xyz_ips_sort_by_order']) && $_POST['xyz_ips_sort_by_order']=='desc'){echo 'selected';} else if(get_option('xyz_ips_sort_order')=="desc"){echo 'selected';} ?>>Descending</option>
60 - <option value="asc" <?php if(isset($_POST['xyz_ips_sort_by_order']) && $_POST['xyz_ips_sort_by_order']=='asc'){ echo 'selected';}else if(get_option('xyz_ips_sort_order')=="asc"){echo 'selected';} ?>>Ascending</option>
61 - </select>
62 -
63 - </td>
64 -</tr>
65 - <tr valign="top">
66 - <td scope="row" ><label for="xyz_ips_credit">Credit link to author</label>
67 - </td>
68 - <td><select name="xyz_ips_credit" id="xyz_ips_credit">
69 - <option value="ips"
70 - <?php if(isset($_POST['xyz_ips_credit']) && $_POST['xyz_ips_credit']=='ips') { echo 'selected';}elseif(get_option('xyz_credit_link')=="ips"){echo 'selected';} ?>>Enable</option>
71 - <option value="0"
72 - <?php if(isset($_POST['xyz_ips_credit']) && $_POST['xyz_ips_credit']!='ips') { echo 'selected';}elseif(get_option('xyz_credit_link')!="ips"){echo 'selected';} ?>>Disable</option>
85 + if(typeof changeAutoException == 'undefined')
86 + {
87 + function changeAutoException()
88 + {
89 + var auto_exception=jQuery("#xyz_ips_auto_exception").val();
73 90
74 - </select>
75 - </td>
76 - </tr>
77 -
78 - <tr valign="top">
79 - <td scope="row" class=" settingInput" id=""><label for="xyz_ips_limit">Pagination limit</label></td>
80 - <td id=""><input name="xyz_ips_limit" type="text"
81 - id="xyz_ips_limit" value="<?php if(isset($_POST['xyz_ips_limit']) ){echo abs(intval($_POST['xyz_ips_limit']));}else{print(get_option('xyz_ips_limit'));} ?>" />
82 - </td>
83 - </tr>
84 -
85 - <tr valign="top">
86 - <td scope="row" class=" settingInput" id="bottomBorderNone">
87 - </td>
88 - <td id="bottomBorderNone"><input style="margin:10px 0 20px 0;" id="submit" class="button-primary bottonWidth" type="submit" value=" Update Settings " />
89 - </td>
90 - </tr>
91 -
92 - </table>
93 - </fieldset>
94 -
95 - </div>
91 + if(auto_exception==1) {
92 + jQuery("#xyz_ips_exception_email_tr").show();
93 + }
94 + else {
95 + jQuery("#xyz_ips_exception_email_tr").hide();
96 + }
97 + }
96 98
97 - </form>
99 + }
100 +</script>
101 +<div>
102 + <form method="post">
103 + <?php wp_nonce_field('ips-psetting_');?>
104 + <div style="float: left;width: 98%">
105 + <fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
106 + <legend >
107 + <h3>Settings</h3>
108 + </legend>
109 + <table class="widefat" style="width:99%;">
110 + <tr valign="top">
111 + <td scope="row" >
112 + <label for="xyz_ips_sort">Sorting of snippets</label>
113 + </td>
114 + <td>
115 + <select id="xyz_ips_sort_by_field" name="xyz_ips_sort_by_field" >
116 + <option value="id" <?php if(isset($_POST['xyz_ips_sort_by_field']) && $_POST['xyz_ips_sort_by_field']=='id'){echo 'selected';} else if(get_option('xyz_ips_sort_field_name')=="id"){echo 'selected';} ?>>Based on create time</option>
117 + <option value="title" <?php if(isset($_POST['xyz_ips_sort_by_field']) && $_POST['xyz_ips_sort_by_field']=='title'){ echo 'selected';}else if(get_option('xyz_ips_sort_field_name')=="title"){echo 'selected';} ?>>Based on name</option>
118 + </select>
119 + &nbsp;
120 + <select id="xyz_ips_sort_by_order" name="xyz_ips_sort_by_order" >
121 + <option value="desc" <?php if(isset($_POST['xyz_ips_sort_by_order']) && $_POST['xyz_ips_sort_by_order']=='desc'){echo 'selected';} else if(get_option('xyz_ips_sort_order')=="desc"){echo 'selected';} ?>>Descending</option>
122 + <option value="asc" <?php if(isset($_POST['xyz_ips_sort_by_order']) && $_POST['xyz_ips_sort_by_order']=='asc'){ echo 'selected';}else if(get_option('xyz_ips_sort_order')=="asc"){echo 'selected';} ?>>Ascending</option>
123 + </select>
124 + </td>
125 + </tr>
126 + <tr valign="top">
127 + <td scope="row" >
128 + <label for="xyz_ips_credit">Credit link to author</label>
129 + </td>
130 + <td>
131 + <select name="xyz_ips_credit" id="xyz_ips_credit">
132 + <option value="ips"
133 + <?php selected(get_option('xyz_credit_link'),"ips"); ?>>Enable</option>
134 + <option value="0"
135 + <?php if(get_option('xyz_credit_link')!="ips"){echo 'selected';} ?>>Disable</option>
136 + </select>
137 + </td>
138 + </tr>
139 + <tr valign="top">
140 + <td scope="row" class="settingInput" id="">
141 + <label for="xyz_ips_limit">Pagination limit</label>
142 + </td>
143 + <td id="">
144 + <input name="xyz_ips_limit" type="text"
145 + id="xyz_ips_limit" value="<?php if(isset($_POST['xyz_ips_limit']) ){echo abs(intval($_POST['xyz_ips_limit']));}else{print(get_option('xyz_ips_limit'));} ?>" />
146 + </td>
147 + </tr>
148 + <tr valign="top">
149 + <td scope="row">
150 + <label for="xyz_ips_auto_insert">Autoinsert PHP opening tags</label>
151 + </td>
152 + <td>
153 + <select name="xyz_ips_auto_insert" id="xyz_ips_auto_insert">
154 + <option value="0" <?php selected(get_option('xyz_ips_auto_insert'),0);?>>Disable</option>
155 + <option value="1" <?php selected(get_option('xyz_ips_auto_insert'),1);?>>Enable</option>
156 + </select>
157 + </td>
158 + </tr>
159 + <tr valign="top">
160 + <td scope="row">
161 + <label for="xyz_ips_auto_exception">Enabling automatic exception handling for PHP snippets</label>
162 + </td>
163 + <td>
164 + <select name="xyz_ips_auto_exception" id="xyz_ips_auto_exception">
165 + <option value="0" <?php selected(get_option('xyz_ips_auto_exception'),0);?>>Disable</option>
166 + <option value="1" <?php selected(get_option('xyz_ips_auto_exception'),1);?>>Enable</option>
167 + </select>
168 + </td>
169 + </tr>
170 + <tr valign="top" id="xyz_ips_exception_email_tr" style="display:none;">
171 + <td scope="row">
172 + <label for="xyz_ips_exception_email">Email address for sending exception report</label>
173 + </td>
174 + <td>
175 + <input name="xyz_ips_exception_email" type="text" id="xyz_ips_exception_email" value="<?php if(isset($_POST['xyz_ips_exception_email']) ){echo esc_attr($_POST['xyz_ips_exception_email']);}else{if(get_option('xyz_ips_exception_email')!="0"){echo esc_attr(get_option('xyz_ips_exception_email'));}} ?>" />
176 +
177 + </td>
178 + </tr>
179 + <tr valign="top">
180 + <td scope="row">
181 + <label for="xyz_ips_pre_ads">Premium Version Ads</label>
182 + </td>
183 + <td>
184 + <select name="xyz_ips_pre_ads" id="xyz_ips_pre_ads">
185 + <option value="0" <?php selected(get_option('xyz_ips_premium_version_ads'),0);?>>Disable</option>
186 + <option value="1" <?php selected(get_option('xyz_ips_premium_version_ads'),1);?>>Enable</option>
187 + </select>
188 + </td>
189 + </tr>
190 + <tr valign="top">
191 + <td scope="row">
192 + <label for="xyz_ips_exec_in_editor">Execute shortcodes in editors</label><br/><span style="color: #1A87B9;font-size:13px;" >[Enable/Disable Shortcode Execution in Editors (Gutenberg, Classic, Elementor, etc.)]</span>
193 + </td>
194 + <td>
195 + <select name="xyz_ips_exec_in_editor" id="xyz_ips_exec_in_editor">
196 + <option value="0" <?php selected(get_option('xyz_ips_exec_in_editor'),0);?>>Disable</option>
197 + <option value="1" <?php selected(get_option('xyz_ips_exec_in_editor'),1);?>>Enable</option>
198 + </select>
199 + </td>
200 + </tr>
201 + <tr valign="top">
202 + <td scope="row">
203 + <label for="xyz_ips_show_snippet_usage">Show Snippet Usage Details </label>
204 + <img src="<?php echo plugins_url('insert-php-code-snippet/images/support.png')?>" onmouseover="document.getElementById('xyz_ips_usage_note').style.display = '';" onmouseout="document.getElementById('xyz_ips_usage_note').style.display = 'none';">
205 + <div id="xyz_ips_usage_note" class="xyz_ips_informationdiv" style="display: none;">Display where each snippet is used (posts/pages) within the admin panel.<br/>Usage data is maintained automatically after the initial sync.</div>
206 + </td>
207 + <td>
208 + <select name="xyz_ips_show_snippet_usage" id="xyz_ips_show_snippet_usage">
209 + <option value="0" <?php selected(get_option('xyz_ips_show_snippet_usage'),0);?>>Disable</option>
210 + <option value="1" <?php selected(get_option('xyz_ips_show_snippet_usage'),1);?>>Enable</option>
211 + </select>
212 + </td>
213 + </tr>
214 + <tr valign="top">
215 + <td scope="row" class=" settingInput" id="xyz_ips_bottomBorderNone">
216 + </td>
217 + <td id="xyz_ips_bottomBorderNone">
218 + <input style="margin:10px 0 20px 0;" id="submit" class="button-primary xyz_ips_bottonWidth" type="submit" value=" Update Settings " />
219 + </td>
220 + </tr>
221 + </table>
222 + </fieldset>
223 + </div>
224 + </form>
98 225 </div>