| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage mod_vikbooking_currencyconverter |
| 5 |
* @author Alessio Gaggii - E4J s.r.l |
| 6 |
* @copyright Copyright (C) 2018 E4J s.r.l. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
// No direct access |
| 12 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 13 |
|
| 14 |
jimport('adapter.module.widget'); |
| 15 |
|
| 16 |
/** |
| 17 |
* Horizontal Search Module implementation for WP |
| 18 |
* |
| 19 |
* @see JWidget |
| 20 |
* @since 1.0 |
| 21 |
*/ |
| 22 |
class ModVikbookingCurrencyconverter_Widget extends JWidget |
| 23 |
{ |
| 24 |
/** |
| 25 |
* Class constructor. |
| 26 |
*/ |
| 27 |
public function __construct() |
| 28 |
{ |
| 29 |
// attach the absolute path of the module folder |
| 30 |
parent::__construct(dirname(__FILE__)); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Sanitize widget form values as they are saved. |
| 35 |
* |
| 36 |
* @param array $new_instance Values just sent to be saved. |
| 37 |
* @param array $old_instance Previously saved values from database. |
| 38 |
* |
| 39 |
* @return array Updated safe values to be saved. |
| 40 |
*/ |
| 41 |
public function update($new_instance, $old_instance) |
| 42 |
{ |
| 43 |
$new_instance['title'] = !empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
| 44 |
$new_instance['vbonly'] = intval($new_instance['vbonly']) === 1 ? 1 : 0; |
| 45 |
$new_instance['currencynameformat'] = (int)$new_instance['currencynameformat'] > 0 && (int)$new_instance['currencynameformat'] < 4 ? (int)$new_instance['currencynameformat'] : 3; |
| 46 |
|
| 47 |
return $new_instance; |
| 48 |
} |
| 49 |
} |
| 50 |
|