| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) |
| 3 |
exit; |
| 4 |
|
| 5 |
global $wpdb; |
| 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 |
|
| 22 |
<span id="xyz_ips_system_notice_area_dismiss">Dismiss</span> |
| 23 |
</div> |
| 24 |
<?php |
| 25 |
} |
| 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); |
| 35 |
|
| 36 |
$xyz_ips_pre_ads = intval($_POST['xyz_ips_pre_ads']); |
| 37 |
$xyz_ips_limit = abs(intval($_POST['xyz_ips_limit'])); |
| 38 |
|
| 39 |
if($xyz_ips_limit==0)$xyz_ips_limit=20; |
| 40 |
$xyz_ips_credit = sanitize_text_field($_POST['xyz_ips_credit']); |
| 41 |
|
| 42 |
if(($xyz_ips_credit=="ips")||($xyz_ips_credit==0)) |
| 43 |
update_option('xyz_credit_link',$xyz_ips_credit); |
| 44 |
|
| 45 |
$xyz_ips_auto_insert = intval($_POST['xyz_ips_auto_insert']); |
| 46 |
update_option('xyz_ips_auto_insert',$xyz_ips_auto_insert); |
| 47 |
|
| 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); |
| 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); |
| 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); |
| 69 |
?> |
| 70 |
<div class="xyz_ips_system_notice_area_style1" id="xyz_ips_system_notice_area"> |
| 71 |
Settings updated successfully. |
| 72 |
<span id="xyz_ips_system_notice_area_dismiss">Dismiss</span> |
| 73 |
</div> |
| 74 |
<?php |
| 75 |
} |
| 76 |
} |
| 77 |
?> |
| 78 |
<script type="text/javascript"> |
| 79 |
|
| 80 |
jQuery(document).ready(function() { |
| 81 |
changeAutoException(); |
| 82 |
|
| 83 |
}); |
| 84 |
|
| 85 |
if(typeof changeAutoException == 'undefined') |
| 86 |
{ |
| 87 |
function changeAutoException() |
| 88 |
{ |
| 89 |
var auto_exception=jQuery("#xyz_ips_auto_exception").val(); |
| 90 |
|
| 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 |
} |
| 98 |
|
| 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 |
|
| 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> |
| 225 |
</div> |
| 226 |
|