Skip to content

Instantly share code, notes, and snippets.

@hertsch
Last active January 2, 2016 06:49
Show Gist options
  • Save hertsch/8265843 to your computer and use it in GitHub Desktop.
Save hertsch/8265843 to your computer and use it in GitHub Desktop.
Remove kitCommand command line from CMS search result
if ($query->numRows() > 0) {
if ($res = $query->fetchRow()) {
// remove all kitCommands from the content
preg_match_all('/(~~)( | )(.){3,512}( | )(~~)/', $res['content'], $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$res['content'] = str_replace($match[0], '', $res['content']);
}
$mod_vars = array(
'page_link' => $func_page_link,
'page_link_target' => "#wb_section_$func_section_id",
'page_title' => $func_page_title,
'page_description' => $func_page_description,
'page_modified_when' => $func_page_modified_when,
'page_modified_by' => $func_page_modified_by,
'text' => $res['content'].$divider,
'max_excerpt_num' => $max_excerpt_num
);
if (print_excerpt2($mod_vars, $func_vars)) {
$result = true;
}
}
}
return $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment