function testMax_limitationsGetPreprocessedString() { $this->assertEqual('abcdefg', MAX_limitationsGetPreprocessedString('abcdefg')); $this->assertEqual('abcdefg', MAX_limitationsGetPreprocessedString('AbCdefg')); $this->assertEqual('abcdefg', MAX_limitationsGetPreprocessedString(' AbCdefg ')); $this->assertEqual('abc\\d\'efg', MAX_limitationsGetPreprocessedString(' AbC\\d\'efg ')); }
/** * Returns an array of preprocessed strings. Each string * is preprocessed with {@link MAX_limitationsGetPreprocessedString} * function. * * @param array $aArray Array of strings. * @return array Array of preprocessed string. */ function MAX_limitationsGetPreprocessedArray($aArray) { $aItems = array(); foreach ($aArray as $key => $sItem) { $aItems[$key] = MAX_limitationsGetPreprocessedString($sItem); } return $aItems; }
/** * A private method to pre-compile limitaions. * * Will generally be overridden by delivery limitations with special requirements (eg. converting * the data stored in the database for the limitation from "as entered" data into lowercase, etc.). * * @access private * @param string $sData An internal representation of the limitation data * for this plugin as a string. * @return string The delivery limitation in pre-compiled form, with any changes to the format * of the data stored in the database having been made, ready to be used for * either compiling the limitation into final form, or converting the limitation * into SQL form. */ function _preCompile($sData) { return MAX_limitationsGetPreprocessedString($sData); }
/** * A private method to pre-compile limitaions. * * @access private * @param mixed $data An optional, expanded form delivery limitation. * @return string The delivery limitation in pre-compiled form, with any changes to the format * of the data stored in the database having been made, ready to be used for * either compiling the limitation into final form, or converting the limitation * into SQL form. */ function _preCompile($sData) { $aData = MAX_limitationsGeoCityUnserialize($sData); $sCountry = MAX_limitationsGetCountry($aData); MAX_limitationsSetCountry($aData, MAX_limitationsGetPreprocessedString($sCountry)); $sCities = MAX_limitationsGetSCities($aData); $aCities = MAX_limitationsGetAFromS($sCities); $aCities = MAX_limitationsGetPreprocessedArray($aCities); MAX_limitationsSetSCities($aData, MAX_limitationsGetSFromA($aCities)); return MAX_limitationsGeoCitySerialize($aData); }
/** * Override precompile not to lowercase the variable name. * * @param string $sData * @return string */ function _preCompile($sData) { $aData = $this->_expandData($sData); $aData[0] = trim($aData[0]); $aData[1] = MAX_limitationsGetPreprocessedString($aData[1]); return $this->_flattenData($aData); }