In response to MeanDean’s request, I have migrated my original PHP scripturizer to the same level of functionality as his latest Perl version, as well as adding WordPress plugin capability to add Bible reference links through content filter.
- Download: scripturizer-1.4.php (21 Dec 2004 – blog entry)
- Download: scripturizer-1.3.php (29 Oct 2004 – blog entry)
- Download: scripturizer-1.2.php (25 Oct 2004 – enhancedby Jon Mark Allen)
- Download: scripturizer-1.1.php
Usage
To use it as a WordPress plugin, simply place the downloaded PHP file into wp-content/plugins/ directory inside your WordPress installation, and then activate “Scripturizer” from the Plugin Manager page. By default it would use the English Standard Version at Good News Publisher, but it is possible to configure it to use other translations available at Bible Gateway. Please modify the source code and change the constant DEFAULT_SCRIPTURIZER_VERSION to another Bible translation.
Having Scripturizer as content filter is not terribly fast. On my lowly 400Mhz Celery server, it makes the index page to load 35% slower. But it is a pitfall of dynamically generated pages in WordPress, as opposed to statically generated pages in Movable Type. I am hoping the future versions of WP would have better caching system to perform some “semi-static” page generations.
To use Scripturizer as a PHP module, simply call the function Scripturizer::scripturize() with text as the first argument, and Bible version as an optional second argument. For example:
echo Scripturizer::scripturize('Pick your choice in John 3:36.', 'NIV');
Future Development
MeanDean from Heal Your Church Website has been thinking of starting a SourceForge project on scripturizer, to centralise development in various programming languages. Glen Davis from Chi Alpha Fellowship @ Standford has also implemented an independent version in PHP, which also includes other improvements. Hopefully all the developments will roll into one soon.
And I don’t mind making a Python version of it.
Great job! I also hope we can merge our code soon. I don’t like having forks and variants. It makes things confusing.
Suggestion–change from a filter to a hook to avoid the performance hit. Hooks are only executed once and change the data permanently. The downside is that whereas a filter affects everything already in your database, an action will only affect future data.
See my scripturizer variant for an example of how to do this or see the recently-updated WordPress Plugin API for some guidance.
One thing I don’t like those action hooks is that they changed the actual content of the blog entry, which might give some “surprises” when the author try to re-edit the entry again.
I was hoping WordPress would do something like caching – i.e. save a cached version of filtered content, which is created when first requested, into the database, and require it to be re-validated whenever the content is changed. It would then need to change some content filter API to distinguish between more static filter (given C always produce C’) and dynamic filters (given C will produce different result at different point in time).
What would you guys say to centralizing all these different versions? Either on a singular site … making each site a mirror of the other … or something like sourceforge?
I just figure it might get confusing for someone looking about.
Whoops … sorry, I see you already mentioned SF … lemme get that on the stick.
I’m a recent convert to WP and I’m thrilled about the Scripturizer plugin–it will get used in 90% of my posts. I installed it and it was working great. The problem came when I tried to log out of the WP Admin area. I got the following error: “Warning: Cannot modify header information – headers already sent by (output started at /home/whollyhi/public_html/wp-content/plugins/scripturizer-1.1.php:129) in /home/whollyhi/public_html/wp-login.php on line 44″ That same message appears for lines 45-49 and line 53.
In order to log in or out of the WP Admin area, I was forced to go to my host and delete the Scripturizer Plugin. Then everything works fine again. Any ideas what the conflict is? (And how to fix it?) Thanks!
Kari,
It is probably caused by empty lines at the end of the scripturizer PHP file. You have to make sure that
?>
is the very last line of the scripturizer-1.1.php file, and there is no space character after the ‘>’.
Perfect diagnosis. Thank you so much!
Actually, I learned from a friend of mine that it’s best not to close off your scripts with
?>
since the PHP interpeter will close it automatically preventing ANY possibility of blank lines being outputted. Make your code more XML compliant by not inserting the PHP close tag at the end. Test it for yourself with test scripts and even with includes(!) that’s exactly how I code my scripts now and it works like a charm!
Hi,
I think this scripturizer is great stuff. But I am not a PHP, Perl or whatever kind of a guy. Something that I would love to learn, but just haven’t yet. Consequently, I have no idea how to actually utilize this. Nowhere can I find a “here’s how this works and how you use it”. The assumption appears to be that I either use MT or WP or understand what to do. A little bit of help would be appreciated by the dweebs out here.
Thanks!
Pingback: TheIdeaMan
I’ve been using this plugin for quite some time now and the only feature I personally felt I couldn’t do without any longer was the ability to use a particular version for one post, but leave the rest to my default.
So I took some initative and whipped up a patch to allow per-post version changes, based on a custom keyword entry called “scripture_version”. Correct values are any version BibleGateway.com currently supports.
Please try it out and let me know what you think!
Scripturizer-1.2
yeah, um…. right-click and save the above link. sorry ’bout that :-)
Can’t download it – I think your web server tried to interprete the PHP file and returned me an empty page…
Ok, sorry ’bout that. I had a ‘brain-fart’ moment.
Try this one: Scripturizer 1.2
is there a way i can change the link from loading in the same window? in other words, can i make the link have the attribute –> target=”_blank”
if so let me know how, thanks!
Pingback: The LOdown
Pingback: The LOdown
We’re currently using Scripturizer 1.55. Any chance someone has a fix for spanning mulitple chapters and verses for WordPress yet? Example: John 3:15-4:18 links you to…John 3:15-4
Can Scripturizer be used on a forum such as PNphpBB?