May 31 2004

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:

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.

19 Comments

  1. Glen Davis on 31 May 2004 at 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. scotty on 31 May 2004 at 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. Mean Dean on 1 Jun 2004 at 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. Mean Dean on 1 Jun 2004 at 1:07 am #

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

  5. Kari on 10 Jun 2004 at 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. scotty on 10 Jun 2004 at 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. Kari on 10 Jun 2004 at 3:59 pm #

    Perfect diagnosis. Thank you so much!

  8. Daniel Pronych on 4 Sep 2004 at 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. Gregory Wostrel on 16 Sep 2004 at 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!

  10. Pingback: TheIdeaMan

  11. Jon Mark Allen on 26 Oct 2004 at 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

  12. Jon Mark Allen on 26 Oct 2004 at 10:43 am #

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

  13. scotty on 26 Oct 2004 at 11:26 am #

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

  14. Jon Mark Allen on 26 Oct 2004 at 1:15 pm #

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

    Try this one: Scripturizer 1.2

  15. stephen on 3 Dec 2004 at 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!

  16. Pingback: The LOdown

  17. Pingback: The LOdown

  18. jd on 12 Feb 2007 at 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

  19. Jeff on 31 Jul 2007 at 6:28 pm #

    Can Scripturizer be used on a forum such as PNphpBB?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>