PluginProbe
Disable Comments & Delete All Comments / trunk
Disable Comments & Delete All Comments vtrunk
1.3.3 1.3.2 trunk 1.0.0 1.0.4 1.0.5 1.0.8 1.0.9 1.1.1 1.1.3 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.3.0 1.3.1
comments-plus / libs / factory / forms / controls / url.php

url.php in Disable Comments & Delete All Comments trunk, at libs/factory/forms/controls/url.php

44 lines 839 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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