checkbox.php
2 days ago
color.php
2 days ago
date.php
2 days ago
editor.php
2 days ago
file.php
2 days ago
hidden.php
2 days ago
html.php
2 days ago
index.html
2 days ago
number.php
2 days ago
password.php
2 days ago
select.php
2 days ago
separator.php
2 days ago
tel.php
2 days ago
text.php
2 days ago
textarea.php
2 days ago
password.php
71 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | $name = !empty($displayData['name']) ? $displayData['name'] : 'name'; |
| 15 | $id = !empty($displayData['id']) ? $displayData['id'] : $name; |
| 16 | $value = isset($displayData['value']) ? $displayData['value'] : ''; |
| 17 | $class = isset($displayData['class']) ? $displayData['class'] : ''; |
| 18 | $toggle = isset($displayData['toggle']) ? $displayData['toggle'] : true; |
| 19 | |
| 20 | ?> |
| 21 | |
| 22 | <div class="input-append"> |
| 23 | |
| 24 | <input |
| 25 | type="password" |
| 26 | name="<?php echo $this->escape($name); ?>" |
| 27 | id="<?php echo $this->escape($id); ?>" |
| 28 | value="<?php echo $this->escape($value); ?>" |
| 29 | size="40" |
| 30 | class="<?php echo $this->escape($class); ?>" |
| 31 | /> |
| 32 | |
| 33 | <?php |
| 34 | if ($toggle) |
| 35 | { |
| 36 | ?> |
| 37 | <button type="button" class="btn" id="<?php echo $id; ?>-btn"> |
| 38 | <i class="fas fa-eye"></i> |
| 39 | </button> |
| 40 | <?php |
| 41 | } |
| 42 | ?> |
| 43 | |
| 44 | </div> |
| 45 | |
| 46 | <?php |
| 47 | if ($toggle) |
| 48 | { |
| 49 | ?> |
| 50 | <script> |
| 51 | (function($) { |
| 52 | 'use strict'; |
| 53 | |
| 54 | $(function() { |
| 55 | $('#<?php echo $id; ?>-btn').on('click', function() { |
| 56 | const input = $(this).prev(); |
| 57 | |
| 58 | if (input.is(':password')) { |
| 59 | input.attr('type', 'text'); |
| 60 | $(this).find('i').removeClass('fa-eye').addClass('fa-eye-slash'); |
| 61 | } else { |
| 62 | input.attr('type', 'password'); |
| 63 | $(this).find('i').removeClass('fa-eye-slash').addClass('fa-eye'); |
| 64 | } |
| 65 | }); |
| 66 | }); |
| 67 | })(jQuery); |
| 68 | </script> |
| 69 | <?php |
| 70 | } |
| 71 |