public function testOxFieldConvertToPseudoHtml() { $oField = new oxField("a&g<e>n\"t'ūrų Литовские für\r\n"); $oField->convertToPseudoHtml(); $this->assertEquals("a&g<e>n"t'ūrų Литовские für<br />\n", $oField->getRawValue()); }
/** * returns quoted field value for using in update statement * * @param string $sFieldName name of field * @param oxField $oField field object * * @return string */ protected function _getUpdateFieldValue($sFieldName, $oField) { $mValue = null; if ($oField instanceof oxField) { $mValue = $oField->getRawValue(); } elseif (isset($oField->value)) { $mValue = $oField->value; } $oDb = oxDb::getDb(); //Check if this field value is null AND it can be null according if not returning default value if (null === $mValue) { if ($this->_canFieldBeNull($sFieldName)) { return 'null'; } elseif ($mValue = $this->_getFieldDefaultValue($sFieldName)) { return $oDb->quote($mValue); } } return $oDb->quote($mValue); }
/** * returns quoted field value for using in update statement * * @param string $sFieldName name of field * @param oxField $oField field object * * @return string */ protected function _getUpdateFieldValue($sFieldName, $oField) { $mValue = null; if ($oField instanceof oxField) { $mValue = $oField->getRawValue(); } elseif (isset($oField->value)) { $mValue = $oField->value; } // Sarunas. check if this field value is null AND it can be null according to table description if (null === $mValue && $this->_canFieldBeNull($sFieldName)) { return 'null'; } return oxDb::getDb()->quote($mValue); }
public function testGetRawValueIfSetAsRaw() { $oField = new oxField(); $oField->setValue("ssss<\n>", oxField::T_RAW); $this->assertEquals("ssss<\n>", $oField->value); $this->assertEquals("ssss<\n>", $oField->getRawValue()); }