PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.3.1
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.3.1
2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 All 28 releases
insert-php / libs / factory / forms / controls / url.php

url.php in Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts 2.3.1, at libs/factory/forms/controls/url.php

44 lines 882 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 FactoryForms420_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_FactoryForms420_UrlControl') ) {
22
23 class Wbcr_FactoryForms420_UrlControl extends Wbcr_FactoryForms420_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