Update of /cvsroot/phpwiki/phpwiki/lib/plugin
In directory usw-pr-cvs1:/tmp/cvs-serv25501/lib/plugin
Modified Files:
LikePages.php
Log Message:
Fix to split words at certain punctuation, so that e.g. LikePages
for 'Calendar:2001-10-02' finds 'Calendar'.
Index: LikePages.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/LikePages.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** LikePages.php 2001/12/16 18:33:25 1.3
--- LikePages.php 2001/12/16 19:35:35 1.4
***************
*** 46,53 ****
}
elseif ($page) {
! $words = explode(" ", split_pagename($page));
! assert($words);
! $prefix = $words[0];
! list($suffix) = array_reverse($words);
$exclude = $page;
--- 46,55 ----
}
elseif ($page) {
! $words = preg_split('/[\s:-;.,]+/',
! split_pagename($page));
! $words = preg_grep('/\S/', $words);
!
! $prefix = reset($words);
! $suffix = end($words);
$exclude = $page;
***************
*** 59,63 ****
// Search for pages containing either the suffix or the prefix.
! $search = array();
if (!empty($prefix)) {
$search[] = $this->_quote($prefix);
--- 61,65 ----
// Search for pages containing either the suffix or the prefix.
! $search = $match = array();
if (!empty($prefix)) {
$search[] = $this->_quote($prefix);
***************
*** 68,72 ****
$match[] = preg_quote($suffix, '/') . '$';
}
! $query = new TextSearchQuery(join(' OR ', $search));
$match_re = '/' . join('|', $match) . '/';
--- 70,79 ----
$match[] = preg_quote($suffix, '/') . '$';
}
!
! if ($search)
! $query = new TextSearchQuery(join(' OR ', $search));
! else
! $query = new NullTextSearchQuery; // matches nothing
!
$match_re = '/' . join('|', $match) . '/';
|