introtext = trim( $filter->clean( $this->introtext ) ); $this->fulltext = trim( $filter->clean( $this->fulltext ) ); */ if(empty($this->title)) { $this->setError(JText::_('Article must have a title')); return false; } if(empty($this->alias)) { $this->alias = $this->title; } $this->alias = JFilterOutput::stringURLSafe($this->alias); if(trim(str_replace('-','',$this->alias)) == '') { $datenow =& JFactory::getDate(); $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); } if (trim( str_replace( ' ', '', $this->fulltext ) ) == '') { $this->fulltext = ''; } if(empty($this->introtext) && empty($this->fulltext)) { $this->setError(JText::_('Article must have some text')); return false; } // clean up keywords -- eliminate extra spaces between phrases // and cr (\r) and lf (\n) characters from string if(!empty($this->metakey)) { // only process if not empty $bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters $keys = explode(',', $after_clean); // create array using commas as delimiter $clean_keys = array(); foreach($keys as $key) { if(trim($key)) { // ignore blank keywords $clean_keys[] = trim($key); } } $this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", " } // clean up description -- eliminate quotes and <> brackets if(!empty($this->metadesc)) { // only process if not empty $bad_characters = array("\"", "<", ">"); $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); } return true; } /** * Converts record to XML * @param boolean Map foreign keys to text values */ function toXML( $mapKeysToText=false ) { $db =& JFactory::getDBO(); if ($mapKeysToText) { $query = 'SELECT name' . ' FROM #__sections' . ' WHERE id = '. (int) $this->sectionid ; $db->setQuery( $query ); $this->sectionid = $db->loadResult(); $query = 'SELECT name' . ' FROM #__categories' . ' WHERE id = '. (int) $this->catid ; $db->setQuery( $query ); $this->catid = $db->loadResult(); $query = 'SELECT name' . ' FROM #__users' . ' WHERE id = ' . (int) $this->created_by ; $db->setQuery( $query ); $this->created_by = $db->loadResult(); } return parent::toXML( $mapKeysToText ); } }