| @@ -1,78 +1,171 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) | |
| 3 | + exit; | |
| 3 | 4 | global $wpdb; |
| 4 | 5 | // Load the options |
| 5 | 6 | |
| 6 | 7 | |
| 7 | -if($_POST){ | |
| 8 | - | |
| 9 | -$_POST=xyz_trim_deep($_POST); | |
| 10 | -$_POST = stripslashes_deep($_POST); | |
| 8 | +if(!$_POST && isset($_GET['ihs_notice'])&& $_GET['ihs_notice'] == 'hide') | |
| 9 | +{ | |
| 10 | + if (! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'],'ihs-shw')){ | |
| 11 | + wp_nonce_ays( 'ihs-shw'); | |
| 12 | + exit; | |
| 13 | + } | |
| 14 | + update_option('xyz_ihs_dnt_shw_notice', "hide"); | |
| 15 | + ?> | |
| 16 | +<style type='text/css'> | |
| 17 | +#xyz_ihs_notice_td | |
| 18 | +{ | |
| 19 | +display:none !important; | |
| 20 | +} | |
| 21 | +</style> | |
| 22 | +<div class="xyz_ihs_system_notice_area_style1" id="xyz_ihs_system_notice_area"> | |
| 23 | +Thanks again for using the plugin. We will never show the message again. | |
| 24 | + <span id="xyz_ihs_system_notice_area_dismiss">Dismiss</span> | |
| 25 | +</div> | |
| 26 | +<?php | |
| 27 | +} | |
| 11 | 28 | |
| 12 | - | |
| 13 | - | |
| 29 | + if($_POST){ | |
| 30 | + if (! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ihs-setting_' )) { | |
| 31 | + wp_nonce_ays( 'ihs-setting_' ); | |
| 32 | + exit; | |
| 33 | + } | |
| 34 | + else { | |
| 35 | + $_POST=xyz_trim_deep($_POST); | |
| 36 | + $_POST = stripslashes_deep($_POST); | |
| 14 | 37 | $xyz_ihs_limit = abs(intval($_POST['xyz_ihs_limit'])); |
| 38 | + $xyz_ihs_pre_ads = intval($_POST['xyz_ihs_pre_ads']); | |
| 39 | + $xyz_ihs_exec_in_editor = intval($_POST['xyz_ihs_exec_in_editor']); | |
| 15 | 40 | if($xyz_ihs_limit==0)$xyz_ihs_limit=20; |
| 16 | - | |
| 17 | - $xyz_ihs_credit = $_POST['xyz_ihs_credit']; | |
| 18 | - | |
| 19 | - | |
| 20 | - update_option('xyz_ihs_limit',$xyz_ihs_limit); | |
| 21 | - update_option('xyz_credit_link',$xyz_ihs_credit); | |
| 41 | + $xyz_ihs_credit = sanitize_text_field($_POST['xyz_ihs_credit']); | |
| 42 | + if($xyz_ihs_credit=="ihs" || $xyz_ihs_credit==0) | |
| 43 | + { | |
| 44 | + update_option('xyz_credit_link',$xyz_ihs_credit); | |
| 45 | + } | |
| 22 | 46 | |
| 23 | -?> | |
| 47 | + $xyz_ihs_sortfield=sanitize_text_field($_POST['xyz_ihs_sort_by_field']); | |
| 48 | + if(($xyz_ihs_sortfield=="title")||($xyz_ihs_sortfield=="id")) | |
| 49 | + { | |
| 50 | + update_option('xyz_ihs_sort_field_name',$xyz_ihs_sortfield); | |
| 51 | + } | |
| 24 | 52 | |
| 53 | + $xyz_ihs_sortorder=sanitize_text_field($_POST['xyz_ihs_sort_by_order']); | |
| 54 | + if(($xyz_ihs_sortorder=="asc")||($xyz_ihs_sortorder=="desc")) | |
| 55 | + { | |
| 56 | + update_option('xyz_ihs_sort_order',$xyz_ihs_sortorder); | |
| 57 | + } | |
| 25 | 58 | |
| 26 | -<div class="system_notice_area_style1" id="system_notice_area"> | |
| 27 | - Settings updated successfully. <span id="system_notice_area_dismiss">Dismiss</span> | |
| 28 | -</div> | |
| 59 | + $xyz_ihs_show_snippet_usage=intval($_POST['xyz_ihs_show_snippet_usage']); | |
| 60 | + update_option('xyz_ihs_show_snippet_usage',$xyz_ihs_show_snippet_usage); | |
| 29 | 61 | |
| 62 | + update_option('xyz_ihs_limit',$xyz_ihs_limit); | |
| 63 | + update_option('xyz_ihs_exec_in_editor',$xyz_ihs_exec_in_editor); | |
| 30 | 64 | |
| 65 | +?> | |
| 66 | +<!-- <div class="xyz_ihs_system_notice_area_style1" id="xyz_ihs_system_notice_area"> | |
| 67 | + Settings updated successfully. | |
| 68 | + <span id="xyz_ihs_system_notice_area_dismiss">Dismiss</span> | |
| 69 | +</div> --> | |
| 70 | + <div class="notice notice-success is-dismissible"> | |
| 71 | + <p><strong>Settings updated successfully. </strong></p> | |
| 72 | +</div> | |
| 31 | 73 | <?php |
| 32 | -} | |
| 33 | - | |
| 34 | - | |
| 74 | + } | |
| 75 | + } | |
| 35 | 76 | ?> |
| 36 | - | |
| 37 | 77 | <div> |
| 38 | - | |
| 39 | - | |
| 40 | 78 | <form method="post"> |
| 41 | - <div style="float: left;width: 98%"> | |
| 42 | - <fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;"> | |
| 43 | - <legend ><h3>Settings</h3></legend> | |
| 44 | - <table class="widefat" style="width:99%;"> | |
| 45 | - <tr valign="top"> | |
| 46 | - <td scope="row" ><label for="xyz_ihs_credit">Credit link to author</label> | |
| 47 | - </td> | |
| 48 | - <td><select name="xyz_ihs_credit" id="xyz_ihs_credit"> | |
| 49 | - <option value="ihs" | |
| 50 | - <?php if(isset($_POST['xyz_ihs_credit']) && $_POST['xyz_ihs_credit']=='ihs') { echo 'selected';}elseif(get_option('xyz_credit_link')=="ihs"){echo 'selected';} ?>>Enable</option> | |
| 51 | - <option value="0" | |
| 52 | - <?php if(isset($_POST['xyz_ihs_credit']) && $_POST['xyz_ihs_credit']!='ihs') { echo 'selected';}elseif(get_option('xyz_credit_link')!="ihs"){echo 'selected';} ?>>Disable</option> | |
| 53 | - | |
| 54 | - </select> | |
| 55 | - </td> | |
| 56 | - </tr> | |
| 57 | - | |
| 58 | - <tr valign="top"> | |
| 59 | - <td scope="row" class=" settingInput" id=""><label for="xyz_ihs_limit">Pagination limit</label></td> | |
| 60 | - <td id=""><input name="xyz_ihs_limit" type="text" | |
| 61 | - id="xyz_ihs_limit" value="<?php if(isset($_POST['xyz_ihs_limit']) ){echo abs(intval($_POST['xyz_ihs_limit']));}else{print(get_option('xyz_ihs_limit'));} ?>" /> | |
| 62 | - </td> | |
| 63 | - </tr> | |
| 64 | - | |
| 65 | - <tr valign="top"> | |
| 66 | - <td scope="row" class=" settingInput" id="bottomBorderNone"> | |
| 67 | - </td> | |
| 68 | - <td id="bottomBorderNone"><input style="margin:10px 0 20px 0;" id="submit" class="button-primary bottonWidth" type="submit" value=" Update Settings " /> | |
| 69 | - </td> | |
| 70 | - </tr> | |
| 71 | - | |
| 72 | - </table> | |
| 73 | - </fieldset> | |
| 74 | - | |
| 75 | - </div> | |
| 76 | - | |
| 79 | + <?php wp_nonce_field('ihs-setting_');?> | |
| 80 | + <div style="float: left;width: 98%"> | |
| 81 | + <fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;"> | |
| 82 | + <legend ><h3> | |
| 83 | + Settings | |
| 84 | + </h3></legend> | |
| 85 | + <table class="widefat" style="width:99%;"> | |
| 86 | + <tr valign="top"> | |
| 87 | + <td scope="row" > | |
| 88 | + <label for="xyz_ihs_sort">Sorting of snippets</label> | |
| 89 | + </td> | |
| 90 | + <td> | |
| 91 | + <select id="xyz_ihs_sort_by_field" name="xyz_ihs_sort_by_field"> | |
| 92 | + <option value="id" <?php if(isset($_POST['xyz_ihs_sort_by_field']) && $_POST['xyz_ihs_sort_by_field']=='id'){echo 'selected';} else if(get_option('xyz_ihs_sort_field_name')=="id"){echo 'selected';} ?>>Based on create time</option> | |
| 93 | + <option value="title" <?php if(isset($_POST['xyz_ihs_sort_by_field']) && $_POST['xyz_ihs_sort_by_field']=='title'){ echo 'selected';}elseif(get_option('xyz_ihs_sort_field_name')=="title"){echo 'selected';} ?>>Based on name</option> | |
| 94 | + </select> | |
| 95 | + | |
| 96 | + <select id="xyz_ihs_sort_by_order" name="xyz_ihs_sort_by_order" > | |
| 97 | + <option value="asc" <?php if(isset($_POST['xyz_ihs_sort_by_order']) && $_POST['xyz_ihs_sort_by_order']=='asc'){ echo 'selected';}elseif(get_option('xyz_ihs_sort_order')=="asc"){echo 'selected';} ?>>Ascending</option> | |
| 98 | + <option value="desc" <?php if(isset($_POST['xyz_ihs_sort_by_order']) && $_POST['xyz_ihs_sort_by_order']=='desc'){echo 'selected';} elseif(get_option('xyz_ihs_sort_order')=="desc"){echo 'selected';} ?>>Descending</option> | |
| 99 | + </select> | |
| 100 | + </td> | |
| 101 | + </tr> | |
| 102 | + <tr valign="top"> | |
| 103 | + <td scope="row" > | |
| 104 | + <label for="xyz_ihs_credit">Credit link to author</label> | |
| 105 | + </td> | |
| 106 | + <td> | |
| 107 | + <select name="xyz_ihs_credit" id="xyz_ihs_credit"> | |
| 108 | + <option value="ihs" | |
| 109 | + <?php selected(get_option('xyz_credit_link'),"ihs"); ?>>Enable</option> | |
| 110 | + <option value="0" | |
| 111 | + <?php if(get_option('xyz_credit_link')!="ihs"){echo 'selected';} ?>>Disable</option> | |
| 112 | + </select> | |
| 113 | + </td> | |
| 114 | + </tr> | |
| 115 | + <tr valign="top"> | |
| 116 | + <td scope="row" class=" xyz_ihs_settingInput" id=""> | |
| 117 | + <label for="xyz_ihs_limit">Pagination limit</label> | |
| 118 | + </td> | |
| 119 | + <td id=""> | |
| 120 | + <input name="xyz_ihs_limit" type="text" | |
| 121 | + id="xyz_ihs_limit" value=" | |
| 122 | +<?php if(isset($_POST['xyz_ihs_limit']) ){echo abs(intval($_POST['xyz_ihs_limit']));}else{print(get_option('xyz_ihs_limit'));} ?>" /> | |
| 123 | + </td> | |
| 124 | + </tr> | |
| 125 | + <tr valign="top"> | |
| 126 | + <td scope="row"> | |
| 127 | + <label for="xyz_ihs_pre_ads">Premium Version Ads</label> | |
| 128 | + </td> | |
| 129 | + <td> | |
| 130 | + <select name="xyz_ihs_pre_ads" id="xyz_ihs_pre_ads"> | |
| 131 | + <option value="0">Disable</option> | |
| 132 | + <option value="1" <?php selected(get_option('xyz_ihs_premium_version_ads'),1);?>>Enable</option> | |
| 133 | + </select> | |
| 134 | + </td> | |
| 135 | + </tr> | |
| 136 | + <tr valign="top"> | |
| 137 | + <td scope="row"> | |
| 138 | + <label for="xyz_ihs_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> | |
| 139 | + </td> | |
| 140 | + <td> | |
| 141 | + <select name="xyz_ihs_exec_in_editor" id="xyz_ihs_exec_in_editor"> | |
| 142 | + <option value="0" <?php selected(get_option('xyz_ihs_exec_in_editor'),0);?>>Disable</option> | |
| 143 | + <option value="1" <?php selected(get_option('xyz_ihs_exec_in_editor'),1);?>>Enable</option> | |
| 144 | + </select> | |
| 145 | + </td> | |
| 146 | + </tr> | |
| 147 | + <tr valign="top"> | |
| 148 | + <td scope="row"> | |
| 149 | + <label for="xyz_ihs_show_snippet_usage">Show Snippet Usage Details </label> | |
| 150 | + <img src="<?php echo plugins_url('insert-html-snippet/images/support.png')?>" onmouseover="document.getElementById('xyz_ihs_usage_note').style.display = '';" onmouseout="document.getElementById('xyz_ihs_usage_note').style.display = 'none';"> | |
| 151 | + <div id="xyz_ihs_usage_note" class="xyz_ihs_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> | |
| 152 | + </td> | |
| 153 | + <td> | |
| 154 | + <select name="xyz_ihs_show_snippet_usage" id="xyz_ihs_show_snippet_usage"> | |
| 155 | + <option value="0" <?php selected(get_option('xyz_ihs_show_snippet_usage'),0);?>>Disable</option> | |
| 156 | + <option value="1" <?php selected(get_option('xyz_ihs_show_snippet_usage'),1);?>>Enable</option> | |
| 157 | + </select> | |
| 158 | + </td> | |
| 159 | + </tr> | |
| 160 | + <tr valign="top"> | |
| 161 | + <td scope="row" class=" xyz_ihs_settingInput" id="xyz_ihs_bottomBorderNone"> | |
| 162 | + </td> | |
| 163 | + <td id="xyz_ihs_bottomBorderNone"> | |
| 164 | + <input style="margin:10px 0 20px 0;" id="submit" class="button-primary xyz_ihs_bottonWidth" type="submit" value=" Update Settings " /> | |
| 165 | + </td> | |
| 166 | + </tr> | |
| 167 | + </table> | |
| 168 | + </fieldset> | |
| 169 | + </div> | |
| 77 | 170 | </form> |
| 78 | -</div> | |
| 171 | +</div> | |