Scripturizer for WordPress

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.

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:

<?php

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.

Category: General | Mon, 31 May 2004 1:42 am

Links to This Article

  1. Sat, 18 September 2004 12:06 am
    TheIdeaMan
  2. Sun, 9 October 2005 9:44 am
    The LOdown
  3. Fri, 13 January 2006 4:33 am
    The LOdown

Comments

1.
Avatar for Glen Davis
Posted by Glen Davis on Mon, 31 May 2004 6:12 am

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.


2.
Avatar for scotty
Posted by scotty on Mon, 31 May 2004 7:21 am

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).


3.
Avatar for Mean Dean
Posted by Mean Dean on Tue, 1 June 2004 1:07 am

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.


4.
Avatar for Mean Dean
Posted by Mean Dean on Tue, 1 June 2004 1:07 am

Whoops … sorry, I see you already mentioned SF … lemme get that on the stick.


5.
Avatar for Kari
Posted by Kari on Thu, 10 June 2004 3:25 pm

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!


6.
Avatar for scotty
Posted by scotty on Thu, 10 June 2004 3:49 pm

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 ‘>’.


7.
Avatar for Kari
Posted by Kari on Thu, 10 June 2004 3:59 pm

Perfect diagnosis. Thank you so much!


8.
Avatar for Daniel Pronych
Posted by Daniel Pronych on Sat, 4 September 2004 5:45 pm

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!


9.
Avatar for Gregory Wostrel
Posted by Gregory Wostrel on Thu, 16 September 2004 11:21 am

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!


Avatar for Jon Mark Allen
Posted by Jon Mark Allen on Tue, 26 October 2004 10:42 am

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


Avatar for Jon Mark Allen
Posted by Jon Mark Allen on Tue, 26 October 2004 10:43 am

yeah, um…. right-click and save the above link. sorry ’bout that :-)


Avatar for scotty
Posted by scotty on Tue, 26 October 2004 11:26 am

Can’t download it - I think your web server tried to interprete the PHP file and returned me an empty page…


Avatar for Jon Mark Allen
Posted by Jon Mark Allen on Tue, 26 October 2004 1:15 pm

Ok, sorry ’bout that. I had a ‘brain-fart’ moment.

Try this one: Scripturizer 1.2


Avatar for stephen
Posted by stephen on Fri, 3 December 2004 6:38 am

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!


Avatar for jd
Posted by jd on Mon, 12 February 2007 1:59 am

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


Avatar for Jeff
Posted by Jeff on Tue, 31 July 2007 6:28 pm

Can Scripturizer be used on a forum such as PNphpBB?


Add a comment

Gravatar is used. Email address is required but will not be displayed. Please keep your comment on topic. No spamming and/or bad language. First time poster will be moderated. Scott reserves the right to delete/edit your comments.