summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-16 16:21:51 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-16 16:21:51 +0100
commit1e9686527b9ef31be27be15cd664cb7602512245 (patch)
tree7fda47ba65e49e3dac63769101b8ac4eb7f0f919 /plugins
parent8934c41e1a3d8c51666a9417a40fec4c4187c0a5 (diff)
downloadliberty-1e9686527b9ef31be27be15cd664cb7602512245.tar.gz
liberty-1e9686527b9ef31be27be15cd664cb7602512245.tar.bz2
liberty-1e9686527b9ef31be27be15cd664cb7602512245.zip
Remove echo from (()) title change when more than one link
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/filter.bitlinks.php37
1 files changed, 10 insertions, 27 deletions
diff --git a/plugins/filter.bitlinks.php b/plugins/filter.bitlinks.php
index 5c0ce9b..5d4f2b9 100755
--- a/plugins/filter.bitlinks.php
+++ b/plugins/filter.bitlinks.php
@@ -569,35 +569,18 @@ class BitLinks extends BitBase {
INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lcl.`from_content_id`=lc.`content_id` )
WHERE `to_content_id` = ?";
- if( $result = $this->mDb->query( $query, [ $pContentId ] ) ) {
- while( $row = $result->fetchRow() ) {
- // check if there are occasions of the old name with alternate display link name
- // --- ((Wiki Page|Description))
- // \([2] # check for ((
- // \b$pOldName\b # make sure the old name is on it's own
- // \| # the seperating deliminator
- // ([^\)]*) # get as many characters as possible up to the next ) - put this in $1
- // \)[2] # closing brackets ))
- $pattern[] = "!\({2}\b$pOldName\b\|([^\)]*)\){2}!";
-
- // - replace with new name leaving description in tact
- $replace[] = "(($pNewName|$1))";
+ // --- ((Wiki Page|Description))
+ $pattern = [ "!\({2}\b$pOldName\b\|([^\)]*)\){2}!" ];
+ $replace = [ "(($pNewName|$1))" ];
- // --- ((Wiki Page)) or WikiPage
- // (\({2})? # check for (( - optional - put this in $1
- // \b$pOldName\b # make sure the old name is on it's own
- // (\){2})? # closing brackets )) - optional - put this in $2
- $pattern[] = "!(\({2})?\b$pOldName\b(\){2})?!";
-
- // - the replacement depends on the new name
- $replace[] = preg_match( "! !", $pNewName )
- // since we have a space in the final name, we need to have ((
- // and )) to make the link work
- ? "(($pNewName))"
- // no spaces in the new name either, so we only insert the ((
- // and )) if the author used them to start off with
- : "$1$pNewName$2";
+ // --- ((Wiki Page)) or WikiPage
+ $pattern[] = "!(\({2})?\b$pOldName\b(\){2})?!";
+ $replace[] = preg_match( "! !", $pNewName )
+ ? "(($pNewName))"
+ : "$1$pNewName$2";
+ if( $result = $this->mDb->query( $query, [ $pContentId ] ) ) {
+ while( $row = $result->fetchRow() ) {
$data = preg_replace( $pattern, $replace, $row['data'] );
if( md5( $data ) != md5( $row['data'] ) ) {
$query = "UPDATE `".BIT_DB_PREFIX."liberty_content` SET `data`=? WHERE `content_id`=?";