summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/common.php8
-rw-r--r--inc/confutils.php17
2 files changed, 22 insertions, 3 deletions
diff --git a/inc/common.php b/inc/common.php
index c943ffa3c..b5c29d621 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -365,7 +365,7 @@ function checkwordblock(){
if(!$conf['usewordblock']) return false;
- $blockfile = file(DOKU_CONF.'wordblock.conf');
+ $wordblocks = getWordblocks();
//how many lines to read at once (to work around some PCRE limits)
if(version_compare(phpversion(),'4.3.0','<')){
//old versions of PCRE define a maximum of parenthesises even if no
@@ -377,7 +377,7 @@ function checkwordblock(){
//MAX_PATTERN_SIZE in modern PCRE
$chunksize = 600;
}
- while($blocks = array_splice($blockfile,0,$chunksize)){
+ while($blocks = array_splice($wordblocks,0,$chunksize)){
$re = array();
#build regexp from blocks
foreach($blocks as $block){
@@ -386,7 +386,9 @@ function checkwordblock(){
if(empty($block)) continue;
$re[] = $block;
}
- if(preg_match('#('.join('|',$re).')#si',$TEXT)) return true;
+ if(preg_match('#('.join('|',$re).')#si',$TEXT, $match=array())) {
+ return true;
+ }
}
return false;
}
diff --git a/inc/confutils.php b/inc/confutils.php
index 9432c10d5..cc1d8064a 100644
--- a/inc/confutils.php
+++ b/inc/confutils.php
@@ -116,6 +116,23 @@ function getInterwiki() {
}
/**
+ * returns array of wordblock patterns
+ *
+ */
+function getWordblocks() {
+ static $wordblocks = NULL;
+ if ( !$wordblocks ) {
+ $wordblocks = file(DOKU_CONF.'wordblock.conf');
+ if (@file_exists(DOKU_CONF.'wordblock.local.conf')) {
+ $local = file(DOKU_CONF.'wordblock.local.conf');
+ $wordblocks = array_merge($wordblocks, $local);
+ }
+ }
+ return $wordblocks;
+}
+
+
+/**
* Builds a hash from a configfile
*
* If $lower is set to true all hash keys are converted to