API15:JTableContent/check
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Overloaded check function
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
check()
Returns
boolean
Defined in
libraries/joomla/database/table/content.php
Importing
jimport( 'joomla.database.table.content' );
Source Body
function check() { /* TODO: This filter is too rigorous,need to implement more configurable solution // specific filters $filter = & JFilterInput::getInstance( null, null, 1, 1 ); $this->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; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
