Code: Select all
############################################################################################
## MOD Title: {AUTHOR} Replacement Tag Enhancement
## MOD Author: Jerome < spam@jerome-gamez.de > (Jerome Gamez) http://jerome-gamez.de/
## MOD Description: Adds an additional attribute to the {AUTHOR}-Replacement Tag
## MOD Version: 1.0
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit: includes/inc_front/content.func.inc.php
##
###########################################################################################
## For Security Purposes, Please Check http://www.phpwcms.de/forum/viewtopic.php?t=1415
## for the latest version of this MOD. Downloading this MOD from other sites could cause
## malicious code to enter into your phpwcms-installation. As such, phpwcms will not
## offer support for MOD's not offered at: http://www.phpwcms.de/forum/
###########################################################################################
## Author Notes:
##
## This enhancement enables you to prepend an additional conditional Text to the
## {AUTHOR} Replacement Tag.
##
## If the article has no author, the prepended text is not inserted into the content
##
## Usage examples:
##
## {AUTHOR}
## => Jerome Gamez
##
## {AUTHOR:Author:}
## => Author:Jerome Gamez
##
## {AUTHOR:Author: }
## => Author: Jerome Gamez
##
## If the article has no author:
## {AUTHOR:Author: }
## => (which means: nothing ;)
##
###########################################################################################
## MOD History:
##
## 2004-04-05 - Version 1.0
## * Initial Release
##
###########################################################################################
## Before Adding This MOD To Your phpwcms, You Should Back Up All Files Related To This MOD
###########################################################################################
#
#-----[ OPEN ]------------------------------------------
#
include/inc_func/content.func.inc.php
#
#-----[ FIND ]------------------------------------------
#
// AUTHOR replacement tag: by Magnar Stav Johanssen
if( ! (strpos($content["all"],'{AUTHOR}')===false)) {
$content["all"] = str_replace('{AUTHOR}', $content["articles"][$aktion[1]]["article_username"], $content["all"]);
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
// AUTHOR replacement tag: by Magnar Stav Johanssen
/* original method
if( ! (strpos($content["all"],'{AUTHOR}')===false)) {
$content["all"] = str_replace('{AUTHOR}', $content["articles"][$aktion[1]]["article_username"], $content["all"]);
}
*/
if( ! (strpos($content["all"],'{AUTHOR')===false))
{
$content["all"] = str_replace('{AUTHOR}', $content["articles"][$aktion[1]]["article_username"], $content["all"]);
if (empty($content["articles"][$aktion[1]]["article_username"]))
$content["all"] = preg_replace('/\{AUTHOR:(.+?)\}/', $content["articles"][$aktion[1]]["article_username"] , $content["all"]);
else
$content["all"] = preg_replace('/\{AUTHOR:(.+?)\}/', "$1 ".$content["articles"][$aktion[1]]["article_username"] , $content["all"]);
}
I hope you can make use of it!
- Jérôme