* the target is category or image, leave it
*
* @param array $matches
+ * @return string
*/
function linkReplace( $matches ) {
$colon = strpos( $matches[1], ':' );
* Returns the first few lines of the text
*
* @param string $text
- * @param int $contextlines max number of returned lines
- * @param int $contextchars average number of characters per line
+ * @param int $contextlines Max number of returned lines
+ * @param int $contextchars Average number of characters per line
* @return string
*/
- public function highlightNone( $text, $contextlines, $contextchars) {
+ public function highlightNone( $text, $contextlines, $contextchars ) {
$match = array();
$text = ltrim( $text ) . "\n"; // make sure the preg_match may find the last line
- $text = str_replace( "\n\n", "\n", $text); // remove empty lines
- preg_match( "/^(.*\n){0,$contextlines}/", $text , $match);
+ $text = str_replace( "\n\n", "\n", $text ); // remove empty lines
+ preg_match( "/^(.*\n){0,$contextlines}/", $text, $match );
$text = htmlspecialchars( substr( trim( $match[0] ), 0, $contextlines * $contextchars ) ); // trim and limit to max number of chars
return str_replace( "\n", '<br>', $text );
}