customs
1 year ago
holders
1 year ago
checkbox.php
1 year ago
color-and-opacity.php
1 year ago
color.php
1 year ago
datepicker-range.php
1 year ago
dropdown-and-colors.php
1 year ago
dropdown.php
1 year ago
font.php
1 year ago
google-font.php
1 year ago
gradient.php
1 year ago
hidden.php
1 year ago
index.php
3 years ago
integer.php
1 year ago
list.php
1 year ago
multiple-textbox.php
1 year ago
paddings-editor.php
1 year ago
pattern.php
1 year ago
radio-colors.php
1 year ago
radio.php
1 year ago
textarea.php
1 year ago
textbox.php
1 year ago
url.php
1 year ago
wp-editor.php
1 year ago
url.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Url Control |
| 5 | * |
| 6 | * Main options: |
| 7 | * @see FactoryForms480_TextboxControl |
| 8 | * |
| 9 | * @author Alex Kovalev <alex.kovalevv@gmail.com> |
| 10 | * @copyright (c) 2018, Webcraftic Ltd |
| 11 | * |
| 12 | * @package factory-forms |
| 13 | * @since 1.0.0 |
| 14 | */ |
| 15 | |
| 16 | // Exit if accessed directly |
| 17 | if( !defined('ABSPATH') ) { |
| 18 | exit; |
| 19 | } |
| 20 | |
| 21 | if( !class_exists('Wbcr_FactoryForms480_UrlControl') ) { |
| 22 | |
| 23 | class Wbcr_FactoryForms480_UrlControl extends Wbcr_FactoryForms480_TextboxControl { |
| 24 | |
| 25 | public $type = 'url'; |
| 26 | |
| 27 | /** |
| 28 | * Adding 'http://' to the url if it was missed. |
| 29 | * |
| 30 | * @since 1.0.0 |
| 31 | * @return string |
| 32 | */ |
| 33 | public function getSubmitValue($name, $sub_name) |
| 34 | { |
| 35 | $value = parent::getSubmitValue($name, $sub_name); |
| 36 | if( !empty($value) && substr($value, 0, 4) != 'http' ) { |
| 37 | $value = 'http://' . $value; |
| 38 | } |
| 39 | |
| 40 | return $value; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 |