summaryrefslogtreecommitdiff
path: root/inc/parser/handler.php
diff options
context:
space:
mode:
authorTom N Harris <tnharris@whoopdedo.org>2009-05-28 23:54:38 +0200
committerTom N Harris <tnharris@whoopdedo.org>2009-05-28 23:54:38 +0200
commit4b7f9e7005c4562f8b4b554ea5ea53fb1ebf804a (patch)
tree11fd280d8bd90a9c6aa58e2f2e4c0f2e0e4adef0 /inc/parser/handler.php
parent4917a83a8d49fae8bcb51077f92f39bc839119c7 (diff)
downloadrpg-4b7f9e7005c4562f8b4b554ea5ea53fb1ebf804a.tar.gz
rpg-4b7f9e7005c4562f8b4b554ea5ea53fb1ebf804a.tar.bz2
Change expensive uses of split to the much faster explode.
darcs-hash:20090528215438-6942e-bf1b875e689ade6bd1a17e3d812ce16bf35c84a6.gz
Diffstat (limited to 'inc/parser/handler.php')
-rw-r--r--inc/parser/handler.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 5bcb3c2f0..83f837b70 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -363,7 +363,7 @@ class Doku_Handler {
function code($match, $state, $pos) {
switch ( $state ) {
case DOKU_LEXER_UNMATCHED:
- $matches = preg_split('/>/u',$match,2);
+ $matches = explode('>',$match,2);
$matches[0] = trim($matches[0]);
if ( trim($matches[0]) == '' ) {
$matches[0] = NULL;
@@ -444,7 +444,7 @@ class Doku_Handler {
$link = preg_replace(array('/^\[\[/','/\]\]$/u'),'',$match);
// Split title from URL
- $link = preg_split('/\|/u',$link,2);
+ $link = explode('|',$link,2);
if ( !isset($link[1]) ) {
$link[1] = NULL;
} else if ( preg_match('/^\{\{[^\}]+\}\}$/',$link[1]) ) {
@@ -457,7 +457,7 @@ class Doku_Handler {
if ( preg_match('/^[a-zA-Z0-9\.]+>{1}.*$/u',$link[0]) ) {
// Interwiki
- $interwiki = preg_split('/>/u',$link[0]);
+ $interwiki = explode('>',$link[0],2);
$this->_addCall(
'interwikilink',
array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]),
@@ -638,7 +638,7 @@ function Doku_Handler_Parse_Media($match) {
$link = preg_replace(array('/^\{\{/','/\}\}$/u'),'',$match);
// Split title from URL
- $link = preg_split('/\|/u',$link,2);
+ $link = explode('|',$link,2);
// Check alignment
@@ -997,7 +997,9 @@ class Doku_Handler_List {
} else {
$type = 'o';
}
- return count(explode(' ',str_replace("\t",' ',$match)));
+ // Is the +1 needed? It used to be count(explode(...))
+ // but I don't think the number is seen outside this handler
+ return substr_count(str_replace("\t",' ',$match), ' ') + 1;
}
}