| @@ -35,11 +35,14 @@ | ||
| 35 | 35 | $horizontal_spacing = sanitize_text_field( $_POST['horizontal_spacing'] ); |
| 36 | 36 | $vertical_position = sanitize_text_field( $_POST['vertical_position'] ); |
| 37 | 37 | $vertical_spacing = sanitize_text_field( $_POST['vertical_spacing'] ); |
| 38 | 38 | $background_color = sanitize_text_field( $_POST['background_color'] ); |
| 39 | + $background_position = sanitize_text_field( $_POST['background_position'] ); | |
| 40 | + $button_z_index = intval( $_POST['button_z_index'] ); | |
| 39 | 41 | $button_border = sanitize_text_field( $_POST['button_border'] ); |
| 40 | 42 | $icon_image_url = esc_url_raw( $_POST['icon_image_url'] ); |
| 41 | - $mobile_display_checkbox = yydev_phone_btn_checkbox_isset('mobile_display_checkbox'); | |
| 43 | + $hide_button_on_desktop = yydev_phone_btn_checkbox_isset('hide_button_on_desktop'); | |
| 44 | + $hide_button_on_mobile = yydev_phone_btn_checkbox_isset('hide_button_on_mobile'); | |
| 42 | 45 | $mobile_width = intval( $_POST['mobile_width'] ); |
| 43 | 46 | $mobile_button_position_checkbox = yydev_phone_btn_checkbox_isset('mobile_button_position_checkbox'); |
| 44 | 47 | $mobile_horizontal_position = sanitize_text_field( $_POST['mobile_horizontal_position'] ); |
| 45 | 48 | $mobile_horizontal_spacing = sanitize_text_field( $_POST['mobile_horizontal_spacing'] ); |
| @@ -45,8 +48,11 @@ | ||
| 45 | 48 | $mobile_horizontal_spacing = sanitize_text_field( $_POST['mobile_horizontal_spacing'] ); |
| 46 | 49 | $mobile_vertical_position = sanitize_text_field( $_POST['mobile_vertical_position'] ); |
| 47 | 50 | $mobile_vertical_spacing = sanitize_text_field( $_POST['mobile_vertical_spacing'] ); |
| 48 | 51 | |
| 52 | + $exclude_option = sanitize_text_field( $_POST['exclude_option'] ); | |
| 53 | + $exclude_ids = sanitize_text_field( $_POST['exclude_ids'] ); | |
| 54 | + | |
| 49 | 55 | // ---------------------------------------------- |
| 50 | 56 | // insert the data into an array |
| 51 | 57 | // ---------------------------------------------- |
| 52 | 58 | |
| @@ -60,11 +66,14 @@ | ||
| 60 | 66 | 'horizontal_spacing' => $horizontal_spacing, |
| 61 | 67 | 'vertical_position' => $vertical_position, |
| 62 | 68 | 'vertical_spacing' => $vertical_spacing, |
| 63 | 69 | 'background_color' => $background_color, |
| 70 | + 'background_position' => $background_position, | |
| 71 | + 'button_z_index' => $button_z_index, | |
| 64 | 72 | 'button_border' => $button_border, |
| 65 | 73 | 'icon_image_url' => $icon_image_url, |
| 66 | - 'mobile_display_checkbox' => $mobile_display_checkbox, | |
| 74 | + 'hide_button_on_desktop' => $hide_button_on_desktop, | |
| 75 | + 'hide_button_on_mobile' => $hide_button_on_mobile, | |
| 67 | 76 | 'mobile_width' => $mobile_width, |
| 68 | 77 | 'mobile_button_position_checkbox' => $mobile_button_position_checkbox, |
| 69 | 78 | 'mobile_horizontal_position' => $mobile_horizontal_position, |
| 70 | 79 | 'mobile_horizontal_spacing' => $mobile_horizontal_spacing, |
| @@ -69,8 +78,11 @@ | ||
| 69 | 78 | 'mobile_horizontal_position' => $mobile_horizontal_position, |
| 70 | 79 | 'mobile_horizontal_spacing' => $mobile_horizontal_spacing, |
| 71 | 80 | 'mobile_vertical_position' => $mobile_vertical_position, |
| 72 | 81 | 'mobile_vertical_spacing' => $mobile_vertical_spacing, |
| 82 | + | |
| 83 | + 'exclude_option' => $exclude_option, | |
| 84 | + 'exclude_ids' => $exclude_ids, | |
| 73 | 85 | ); // $creating_data_array = array( |
| 74 | 86 | |
| 75 | 87 | // ---------------------------------------------- |
| 76 | 88 | // creating a value with all the array data |
| @@ -88,9 +100,9 @@ | ||
| 88 | 100 | // inserting all the data to datbase |
| 89 | 101 | // ---------------------------------------------- |
| 90 | 102 | |
| 91 | 103 | $plugin_data = $array_key_name . "***" . $array_item_value; |
| 92 | - $plugin_data = yydev_phone_btn_mysql_prep($plugin_data); | |
| 104 | + $plugin_data = sanitize_text_field($plugin_data); | |
| 93 | 105 | |
| 94 | 106 | // update optuon on the database into wp_options |
| 95 | 107 | update_option($wp_options_name, $plugin_data); |
| 96 | 108 | |
| @@ -154,25 +166,25 @@ | ||
| 154 | 166 | </div><!--yydev_phone_btn_line--> |
| 155 | 167 | |
| 156 | 168 | <div class="yydev_phone_btn_line"> |
| 157 | 169 | <label for="phone_number">Phone Number: </label> |
| 158 | - <input type="text" id="phone_number" class="input-short" name="phone_number" value="<?php echo $plugin_data_array['phone_number']; ?>" /> | |
| 170 | + <input type="text" id="phone_number" class="input-short" name="phone_number" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['phone_number']); ?>" /> | |
| 159 | 171 | <small>Example: 0999999999</small> |
| 160 | 172 | </div><!--yydev_phone_btn_line--> |
| 161 | 173 | |
| 162 | 174 | <div class="yydev_phone_btn_line"> |
| 163 | 175 | <label for="button_width">Button Width: </label> |
| 164 | - <input type="text" id="button_width" class="input-very-short" name="button_width" value="<?php echo $plugin_data_array['button_width']; ?>" /> PX | |
| 176 | + <input type="text" id="button_width" class="input-very-short" name="button_width" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['button_width']); ?>" /> PX | |
| 165 | 177 | </div><!--yydev_phone_btn_line--> |
| 166 | 178 | |
| 167 | 179 | <div class="yydev_phone_btn_line"> |
| 168 | 180 | <label for="button_height">Button Height: </label> |
| 169 | - <input type="text" id="button_height" class="input-very-short" name="button_height" value="<?php echo $plugin_data_array['button_height']; ?>" /> PX | |
| 181 | + <input type="text" id="button_height" class="input-very-short" name="button_height" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['button_height']); ?>" /> PX | |
| 170 | 182 | </div><!--yydev_phone_btn_line--> |
| 171 | 183 | |
| 172 | 184 | <div class="yydev_phone_btn_line"> |
| 173 | 185 | <label for="border_radius">Border Radius (Button Roundness): </label> |
| 174 | - <input type="text" id="border_radius" class="input-very-short" name="border_radius" value="<?php echo $plugin_data_array['border_radius']; ?>" /> | |
| 186 | + <input type="text" id="border_radius" class="input-very-short" name="border_radius" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['border_radius']); ?>" /> | |
| 175 | 187 | <small>Examples: 10px, 50%</small> |
| 176 | 188 | </div><!--yydev_phone_btn_line--> |
| 177 | 189 | |
| 178 | 190 | <div class="yydev_phone_btn_line"> |
| @@ -183,9 +195,9 @@ | ||
| 183 | 195 | <option value="right" <?php if ($plugin_data_array['horizontal_position'] == "right") {echo "selected";} ?> >Right</option> |
| 184 | 196 | </select> |
| 185 | 197 | |
| 186 | 198 | <label for="horizontal_spacing">Horizontal Spacing: </label> |
| 187 | - <input type="text" id="horizontal_spacing" class="input-very-short" name="horizontal_spacing" value="<?php echo $plugin_data_array['horizontal_spacing']; ?>" /> | |
| 199 | + <input type="text" id="horizontal_spacing" class="input-very-short" name="horizontal_spacing" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['horizontal_spacing']); ?>" /> | |
| 188 | 200 | <small>Examples: 10px, 50%</small> |
| 189 | 201 | </div><!--yydev_phone_btn_line--> |
| 190 | 202 | |
| 191 | 203 | |
| @@ -197,28 +209,40 @@ | ||
| 197 | 209 | <option value="bottom" <?php if ($plugin_data_array['vertical_position'] == "bottom") {echo "selected";} ?> >Bottom</option> |
| 198 | 210 | </select> |
| 199 | 211 | |
| 200 | 212 | <label for="vertical_spacing">Vertical Spacing: </label> |
| 201 | - <input type="text" id="vertical_spacing" class="input-very-short" name="vertical_spacing" value="<?php echo $plugin_data_array['vertical_spacing']; ?>" /> | |
| 213 | + <input type="text" id="vertical_spacing" class="input-very-short" name="vertical_spacing" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['vertical_spacing']); ?>" /> | |
| 202 | 214 | <small>Examples: 10px, 50%</small> |
| 203 | 215 | </div><!--yydev_phone_btn_line--> |
| 204 | 216 | |
| 205 | 217 | <div class="yydev_phone_btn_line"> |
| 206 | 218 | <label for="background_color">Background color hex: </label> |
| 207 | - <input type="text" id="background_color" class="input-long" name="background_color" value="<?php echo $plugin_data_array['background_color']; ?>" /> | |
| 219 | + <input type="text" id="background_color" class="input-long" name="background_color" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['background_color']); ?>" /> | |
| 208 | 220 | <small>Example: #09547c</small> |
| 209 | 221 | </div><!--yydev_phone_btn_line--> |
| 210 | 222 | |
| 211 | 223 | <div class="yydev_phone_btn_line"> |
| 224 | + <label for="background_position">Background icon position: </label> | |
| 225 | + <input type="text" id="background_position" class="input-short" name="background_position" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['background_position']); ?>" /> | |
| 226 | + <small>Example: 50% 50%, 10px 10px</small> | |
| 227 | + </div><!--yydev_phone_btn_line--> | |
| 228 | + | |
| 229 | + <div class="yydev_phone_btn_line"> | |
| 230 | + <label for="button_z_index">Z-index: </label> | |
| 231 | + <input type="text" id="button_z_index" class="input-very-short" name="button_z_index" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['button_z_index']); ?>" /> | |
| 232 | + <small>Example: 9999</small> | |
| 233 | + </div><!--yydev_phone_btn_line--> | |
| 234 | + | |
| 235 | + <div class="yydev_phone_btn_line"> | |
| 212 | 236 | <label for="button_border">Border Settings: </label> |
| 213 | - <input type="text" id="button_border" class="input-short" name="button_border" value="<?php echo $plugin_data_array['button_border']; ?>" /> | |
| 237 | + <input type="text" id="button_border" class="input-short" name="button_border" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['button_border']); ?>" /> | |
| 214 | 238 | <small>Example: 2px solid #bbdeff, none</small> |
| 215 | 239 | </div><!--yydev_phone_btn_line--> |
| 216 | 240 | |
| 217 | 241 | <div class="yydev_phone_btn_line"> |
| 218 | - <img class="yydev_light_img_bg" style="background:<?php echo $plugin_data_array['background_color']; ?>" src="<?php echo $plugin_data_array['icon_image_url']; ?>" alt="" /> | |
| 242 | + <img class="yydev_light_img_bg" style="background:<?php echo $plugin_data_array['background_color']; ?>" src="<?php echo esc_url($plugin_data_array['icon_image_url']); ?>" alt="" /> | |
| 219 | 243 | <label for="icon_image_url">Custom Icon Url: </label> |
| 220 | - <input type="text" id="icon_image_url" class="input-very-long yydev_image_input" name="icon_image_url" value="<?php echo $plugin_data_array['icon_image_url']; ?>" /> | |
| 244 | + <input type="text" id="icon_image_url" class="input-very-long yydev_image_input" name="icon_image_url" value="<?php echo esc_url($plugin_data_array['icon_image_url']); ?>" /> | |
| 221 | 245 | <input type="button" name="yydev_upload_image" class="yydev_upload_image button-secondary" value="Choose Image..." /> |
| 222 | 246 | |
| 223 | 247 | <div class="clear"></div> |
| 224 | 248 | </div><!--yydev_phone_btn_line--> |
| @@ -224,21 +248,26 @@ | ||
| 224 | 248 | </div><!--yydev_phone_btn_line--> |
| 225 | 249 | |
| 226 | 250 | |
| 227 | 251 | <br /> |
| 228 | - <h2> Mobile Settings: </h2> | |
| 252 | + <h2> Display Settings: </h2> | |
| 229 | 253 | |
| 230 | 254 | <div class="yydev_phone_btn_line"> |
| 231 | - <input type="checkbox" id="mobile_display_checkbox" class="checkbox" name="mobile_display_checkbox" value="1" <?php if($plugin_data_array['mobile_display_checkbox'] == 1) {echo "checked";} ?> /> | |
| 232 | - <label for="mobile_display_checkbox">Hide the button on desktop (will display button only on mobile)</label> | |
| 255 | + <input type="checkbox" id="hide_button_on_desktop" class="checkbox" name="hide_button_on_desktop" value="1" <?php if($plugin_data_array['hide_button_on_desktop'] == 1) {echo "checked";} ?> /> | |
| 256 | + <label for="hide_button_on_desktop">Hide the button on desktop (will display button only on mobile)</label> | |
| 233 | 257 | </div><!--yydev_phone_btn_line--> |
| 234 | 258 | |
| 235 | 259 | <div class="yydev_phone_btn_line"> |
| 236 | - <label for="mobile_width">Show button only when screen width is smaller than: </label> | |
| 237 | - <input type="text" id="mobile_width" class="input-very-short" name="mobile_width" value="<?php echo $plugin_data_array['mobile_width']; ?>" /> PX | |
| 260 | + <input type="checkbox" id="hide_button_on_mobile" class="checkbox" name="hide_button_on_mobile" value="1" <?php if($plugin_data_array['hide_button_on_mobile'] == 1) {echo "checked";} ?> /> | |
| 261 | + <label for="hide_button_on_mobile">Hide the button on mobile (will display button only on desktop)</label> | |
| 238 | 262 | </div><!--yydev_phone_btn_line--> |
| 239 | 263 | |
| 264 | + <div class="yydev_phone_btn_line"> | |
| 265 | + <label for="mobile_width">Define mobile screen resolution (affect the 2 checkboxes above): </label> | |
| 266 | + <input type="text" id="mobile_width" class="input-very-short" name="mobile_width" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['mobile_width']); ?>" /> PX | |
| 267 | + </div><!--yydev_phone_btn_line--> | |
| 240 | 268 | |
| 269 | + | |
| 241 | 270 | <br /> |
| 242 | 271 | <h2> Mobile Positioning: </h2> |
| 243 | 272 | |
| 244 | 273 | |
| @@ -255,9 +284,9 @@ | ||
| 255 | 284 | <option value="right" <?php if ($plugin_data_array['mobile_horizontal_position'] == "right") {echo "selected";} ?> >Right</option> |
| 256 | 285 | </select> |
| 257 | 286 | |
| 258 | 287 | <label for="mobile_horizontal_spacing">Horizontal Spacing: </label> |
| 259 | - <input type="text" id="mobile_horizontal_spacing" class="input-very-short" name="mobile_horizontal_spacing" value="<?php echo $plugin_data_array['mobile_horizontal_spacing']; ?>" /> | |
| 288 | + <input type="text" id="mobile_horizontal_spacing" class="input-very-short" name="mobile_horizontal_spacing" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['mobile_horizontal_spacing']); ?>" /> | |
| 260 | 289 | <small>Examples: 10px, 50%</small> |
| 261 | 290 | </div><!--yydev_phone_btn_line--> |
| 262 | 291 | |
| 263 | 292 | |
| @@ -269,14 +298,36 @@ | ||
| 269 | 298 | <option value="bottom" <?php if ($plugin_data_array['mobile_vertical_position'] == "bottom") {echo "selected";} ?> >Bottom</option> |
| 270 | 299 | </select> |
| 271 | 300 | |
| 272 | 301 | <label for="mobile_vertical_spacing">Vertical Spacing: </label> |
| 273 | - <input type="text" id="mobile_vertical_spacing" class="input-very-short" name="mobile_vertical_spacing" value="<?php echo $plugin_data_array['mobile_vertical_spacing']; ?>" /> | |
| 302 | + <input type="text" id="mobile_vertical_spacing" class="input-very-short" name="mobile_vertical_spacing" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['mobile_vertical_spacing']); ?>" /> | |
| 274 | 303 | <small>Examples: 10px, 50%</small> |
| 275 | 304 | </div><!--yydev_phone_btn_line--> |
| 276 | 305 | |
| 277 | 306 | <br /> |
| 307 | + <h2> Include/Exclude Pages By ID: </h2> | |
| 278 | 308 | |
| 309 | + <p> Insert the pages ID and separate them by comma. You can use <a target="_blank" href="https://wordpress.org/plugins/show-posts-and-pages-id/">Show Pages IDs</a> plugin for help. | |
| 310 | + <br /><br /> | |
| 311 | + Example <small>(one page)</small>: 14 | |
| 312 | + <br /> Example <small>(multiple pages)</small>: 14, 16, 23 </p> | |
| 313 | + | |
| 314 | + <div class="yydev_phone_btn_line"> | |
| 315 | + | |
| 316 | + <label for="exclude_option">Include/Exclude Option: </label> | |
| 317 | + | |
| 318 | + <select name="exclude_option" id='exclude_option'> | |
| 319 | + <option value="none" <?php if($plugin_data_array['exclude_option'] == "none") {echo "selected";} ?> >Not Active (Default)</option> | |
| 320 | + <option value="exclude" <?php if($plugin_data_array['exclude_option'] == "exclude") {echo "selected";} ?> >Exclude Pages By ID</option> | |
| 321 | + <option value="include" <?php if ($plugin_data_array['exclude_option'] == "include") {echo "selected";} ?> >Include Only On Pages</option> | |
| 322 | + </select> | |
| 323 | + | |
| 324 | + <input type="text" id="exclude_ids" class="input-short" name="exclude_ids" value="<?php echo yydev_phone_btn_html_output($plugin_data_array['exclude_ids']); ?>" /> | |
| 325 | + | |
| 326 | + </div><!--yydev_phone_btn_line--> | |
| 327 | + | |
| 328 | + <br /> | |
| 329 | + | |
| 279 | 330 | <?php |
| 280 | 331 | // creating nonce to make sure the form was submitted correctly from the right page |
| 281 | 332 | wp_nonce_field( 'yydev_phone_btn_action', 'yydev_phone_btn_nonce' ); |
| 282 | 333 | ?> |
| @@ -285,6 +336,8 @@ | ||
| 285 | 336 | |
| 286 | 337 | </form> |
| 287 | 338 | |
| 288 | 339 | <br /><br /><br /> |
| 289 | -<span id="footer-thankyou-code">This plugin was create by <a target="_blank" href="https://www.yydevelopment.com">YYDevelopment</a>. If you liked the plugin please give it a <a target="_blank" href="https://wordpress.org/plugins/phone-button/#reviews">5 stars review</a>.</span> | |
| 340 | +<span id="footer-thankyou-code">This plugin was create by <a target="_blank" href="https://www.yydevelopment.com">YYDevelopment</a>. If you liked the plugin please give it a <a target="_blank" href="https://wordpress.org/plugins/phone-button/#reviews">5 stars review</a>. | |
| 341 | +If you want to help support this FREE plugin <a target="_blank" href="https://www.yydevelopment.com/coffee-break/?plugin=phone-button">buy us a coffee</a>.</span> | |
| 342 | +</span> | |
| 290 | 343 | </div><!--wrap--> |