Current File : /home/resuelf/www/wp-content/plugins/auto-post-thumbnail/libs/factory/forms/controls/url.php
<?php

	/**
	 * Url Control
	 *
	 * Main options:
	 * @see FactoryForms463_TextboxControl
	 *
	 * @author Alex Kovalev <[email protected]>
	 * @copyright (c) 2018, Webcraftic Ltd
	 *
	 * @package factory-forms
	 * @since 1.0.0
	 */

	// Exit if accessed directly
	if( !defined('ABSPATH') ) {
		exit;
	}

	if( !class_exists('Wbcr_FactoryForms463_UrlControl') ) {

		class Wbcr_FactoryForms463_UrlControl extends Wbcr_FactoryForms463_TextboxControl {

			public $type = 'url';

			/**
			 * Adding 'http://' to the url if it was missed.
			 *
			 * @since 1.0.0
			 * @return string
			 */
			public function getSubmitValue($name, $sub_name)
			{
				$value = parent::getSubmitValue($name, $sub_name);
				if( !empty($value) && substr($value, 0, 4) != 'http' ) {
					$value = 'http://' . $value;
				}

				return $value;
			}
		}
	}