"Mastering Joomla! 1.5 Extension and Framework Development"
To overcome this we can use the alias methods described in the table. This example retrieves someValue as a floating-point number: $value = JRequest::getFloat('someValue'); We can use the default value and source hash parameters with the alias methods in the same way as we do with the getVar() method. We can apply different masks to reduce the data preprocessing. There are three masks: JREQUEST_NOTRIM, JREQUEST_ALLOWHTML, and JREQUEST_ALLOWRAW. By default no mask is applied. In this example we get name from the $_POST hash and apply the JREQUEST_NOTRIM mask: $name = JRequest::getVar('name', null, 'POST', 'STRING', JREQUEST_NOTRIM); We can also use the mask when using the getString() alias method: $name = JRequest::getString('name', null, 'POST', JREQUEST_NOTRIM); To demonstrate the effects of the different masks, here is how four different inputs will be parsed: # Input Value 1
2 CSS 3 space at front of input 4 <p>Para</p> Chapter 11 [ 317 ] # Output value (No mask) 1 Paragraph link 2 CSS 3 space at front of input 4 <p>Para</p> # Output value (mask JREQUEST_NOTRIM) 1 Paragraph link 2 CSS 3 space at front of input 4 <p>Para</p> # Output value (mask JREQUEST_ALLOWHTML) 1