Test Setup Failed
Push — 17.1 ( 29ee37...8a89ce )
by Hadi
20:13 queued 08:49
created
api/src/Etemplate/Widget/Url.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @param array &$validated=array() validated content
64 64
 	 * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont'
65 65
 	 */
66
-	public function validate($cname, array $expand, array $content, &$validated=array())
66
+	public function validate($cname, array $expand, array $content, &$validated = array())
67 67
 	{
68 68
 		$form_name = self::form_name($cname, $this->id, $expand);
69 69
 
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 
74 74
 			if ((string)$value === '' && $this->attrs['needed'])
75 75
 			{
76
-				self::set_validation_error($form_name,lang('Field must not be empty !!!'),'');
76
+				self::set_validation_error($form_name, lang('Field must not be empty !!!'), '');
77 77
 				return;
78 78
 			}
79 79
 			elseif ((string)$value != '' && !isset($this->attrs['preg']))
80 80
 			{
81
-				switch($this->type)
81
+				switch ($this->type)
82 82
 				{
83 83
 					case 'url':
84 84
 						// if no protocol given eg. "www.egroupware.org" prepend "http://" for validation
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 						}
89 89
 						$url_valid = filter_var($value, FILTER_VALIDATE_URL) ||
90 90
 							// Remove intl chars & check again, but if it passes we'll keep the original
91
-							filter_var(preg_replace('/[^[:print:]]/','',$value), FILTER_VALIDATE_URL);
91
+							filter_var(preg_replace('/[^[:print:]]/', '', $value), FILTER_VALIDATE_URL);
92 92
 						//error_log(__METHOD__."() filter_var(value=".array2string($value).", FILTER_VALIDATE_URL)=".array2string(filter_var($value, FILTER_VALIDATE_URL))." --> url_valid=".array2string($url_valid));
93 93
 						// remove http:// validation prefix again
94 94
 						if ($missing_protocol)
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 						}
98 98
 						if (!$url_valid)
99 99
 						{
100
-							self::set_validation_error($form_name,lang("'%1' has an invalid format !!!",$value),'');
100
+							self::set_validation_error($form_name, lang("'%1' has an invalid format !!!", $value), '');
101 101
 							return;
102 102
 						}
103 103
 						$this->attrs['preg'] = self::URL_PREG;
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 				}
109 109
 			}
110 110
 
111
-			$valid =& self::get_array($validated, $form_name, true);
111
+			$valid = & self::get_array($validated, $form_name, true);
112 112
 
113
-			if ((int) $this->attrs['maxlength'] > 0 && strlen($value) > (int) $this->attrs['maxlength'])
113
+			if ((int)$this->attrs['maxlength'] > 0 && strlen($value) > (int)$this->attrs['maxlength'])
114 114
 			{
115
-				$value = substr($value,0,(int) $this->attrs['maxlength']);
115
+				$value = substr($value, 0, (int)$this->attrs['maxlength']);
116 116
 			}
117
-			if ($this->attrs['preg'] && !preg_match($this->attrs['preg'],$value))
117
+			if ($this->attrs['preg'] && !preg_match($this->attrs['preg'], $value))
118 118
 			{
119
-				switch($this->type)
119
+				switch ($this->type)
120 120
 				{
121 121
 					default:
122 122
 						//error_log("preg_match('{$this->attrs['preg']}', '$value')=".array2string(preg_match($this->attrs['preg'], $value)));
123
-						self::set_validation_error($form_name,lang("'%1' has an invalid format !!!",$value)/*." !preg_match('$this->attrs[preg]', '$value')"*/,'');
123
+						self::set_validation_error($form_name, lang("'%1' has an invalid format !!!", $value)/*." !preg_match('$this->attrs[preg]', '$value')"*/, '');
124 124
 						break;
125 125
 				}
126 126
 			}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	public static function ajax_contact($_email)
138 138
 	{
139 139
 		$email = \EGroupware\Api\Mail::stripRFC822Addresses(array($_email));
140
-		$result = $GLOBALS['egw']->contacts->search(array('contact_email'=>$email[0], 'contact_email_home' => $email[0]), array('email','email_home'),
140
+		$result = $GLOBALS['egw']->contacts->search(array('contact_email'=>$email[0], 'contact_email_home' => $email[0]), array('email', 'email_home'),
141 141
 			'', '', '', false, 'OR', false);
142 142
 		\EGroupware\Api\Json\Response::data($result ? true : false);
143 143
 	}
Please login to merge, or discard this patch.