Replace Text for CaRP EvolutionThe extendable version of CaRP: caching RSS parser Replace Text is a plugin bundled with CaRP Evolution. It enables you to modify the contents of a newsfeed before display. Use it to expand acronyms, add bold or italics to certain words or phrases, "bleep" language you don't want appearing on your site, etc. IMPORTANT NOTE: Altering the contents of a newsfeed may violate copyrights or have other legal consequences. It is your responsibility to ensure that your use of this plugin is legal. You may wish to contact the publisher of a newsfeed to obtain permission before using this plugin to modify it. Installation: To install Replace Text, put replacetext.php into the "plugins" folder inside the folder containing carp.php. (If no plugins folder exists, create one.) Use: To use this plugin, do the following:
To replace "IMHO" with "in my humble opinion", and bold the word "evolution", when either occurs in item descriptions, do the following: ReplaceTextConf(1,'desc',0,'IMHO','in my humble opinion'); ReplaceTextConf(1,'desc',1,'(evolution)','<b>\\1</b>'); Note that when $is_regular_expression is 0, the matching is case sensistive. When using regular expressions, the match is not case sensitive. In the second example, "\\1" inserts the text that matched the text in parenthesis in $search_text. The example uses this style rather than ReplaceTextConf(1,'desc',1,'evolution','<b>evolution</b>'); to ensure that the case of the text is not changed (for example, from "Evolution" to "evolution"). |
Purchase CaRP Evolution on the CaRP Homepage CaRP Evolution Plugins CaRP Evolution API Documentation |