/** * Get the subpages of the page * * @return array of contents */ public function getContentSubs($content_id = 0, $toarray = false) { $criteria = $this->getContentsCriteria(); $criteria->add(new icms_db_criteria_Item('content_pid', $content_id)); $crit = new icms_db_criteria_Compo(new icms_db_criteria_Item('content_visibility', 2)); $crit->add(new icms_db_criteria_Item('content_visibility', 3), 'OR'); $criteria->add($crit); $contents = $this->getObjects($criteria); if (!$toarray) { return $contents; } $ret = array(); foreach (array_keys($contents) as $i) { if ($contents[$i]->accessGranted()) { $ret[$i] = $contents[$i]->toArray(); $ret[$i]['content_body'] = icms_core_DataFilter::icms_substr(icms_cleanTags($contents[$i]->getVar('content_body', 'n'), array()), 0, 300); $ret[$i]['content_url'] = $contents[$i]->getItemLink(); } } return $ret; }
/** * Purifies the CSS that is put in the content (pages) system * * @param string $text String to purify * @return string $text The purified text * @todo Remove and replace with the proper data filter and HTML Purifier */ function icms_sanitizeContentCss($text) { if (preg_match_all('/(.*?)\\{(.*?)\\}/ie', $text, $css)) { $css = $css[0]; $perm = $not_perm = array(); foreach ($css as $k => $v) { if (!preg_match('/^\\#impress_content(.*?)/ie', $v)) { $css[$k] = '#impress_content ' . icms_cleanTags(trim($v), array()) . "\r\n"; } else { $css[$k] = icms_cleanTags(trim($v), array()) . "\r\n"; } } $text = implode($css); } return $text; }
/** * Retrieve content lead, which is everything before the [more] tag * * @return str content lead */ function getContentLead() { $ret = $this->getVar('content_body'); $ret = icms_core_DataFilter::icms_substr(icms_cleanTags($ret, array()), 0, 300); return $ret; }