InScript

Jun 5, 2005 | Tags: , , , , , | Written by John

InScript is an extensible scripting framework that provides the capability to insert and modify data without needing to modify any WordPress files.

At the simplest level, it is a generic pattern matcher – it searches for specific patterns, or tags, and replaces them with something else. However, instead of replacing these patterns with static text, you can replace them with variables, functions, and even PHP code.

Some of the features that InScript provides are:

  • Dynamic variables, which can be used in many places and are automatically updated (the version and last updated details above are dynamic variables)
  • Disable WordPress texturize functions across the whole blog, individual posts, or even individual words
  • Conversely, enable texturize, textile, markdown, or any formatting on individual posts or words
  • Embed well-defined scripts inside posts and any other part of WordPress, without modifying the theme

The embedded scripts are very powerful, and allow you to do things like:

  • Insert post & author information
  • Add HTTP meta-values and make them post-specific
  • Customise the appearance of words, paragraphs, or posts
  • Change date formats on individual sections
  • Insert highlighted code
  • Insert custom PHP code
  • Add custom stylesheets for specific posts

Because of the extensible nature of the plugin, you can add ‘scriptlets’ (mini-plugins) that provide extra features and yet use the same InScript framework.

Here are the current scriptlets:

  • rss-link-list.zip - embed RSS feeds in conjunction with the rssLinkList plugin (which must be installed and enabled)
  • pinyin-converter.zip - Pinyin converter allows Chinese pinyin to be inserted in the form zhong1guo2 and converted to the correct tonal version of %%lang_pinyin [text=zhong1guo2]%%

Note: install scriptlets into the /wp-content/plugins/inscript/scripts directory.

No really, what does it do?

The best way to explain what InScript does is by providing examples. Note that these examples are provided 'live' by InScript.

Example 1 – Code highlighting

Often you want to highlight some code within a post. This creates several problems:

  • Code uses special characters that interfere with HTML
  • WordPress mangles a lot of the characters
  • It’s a chore to color the code by hand

We can insert an InScript tag to do all this for us.

%%format_highlight [file=/wp-feed.php] [wp=off]%%

And this produces:

%%format_highlight [file=/wp-feed.php] [wp=off]%%

Example 2 – Blog title & description

Notice anything special about the title of this page? No? Okay, go and look at it again. Yes, that's right, it's different from the rest of the blog. This is because of these two custom fields:

inscript_option_blogdescription = Now with added plugin goodness!
inscript_option_blogname = SuburbanGiraffe

More fun

Of course, all of these are simplistic examples. Separate plugins already exist to achieve many of the functions described here. The point is that InScript gives you the ability to perform these functions anywhere in your blog, using just one syntax and one plugin. Additionally, you can customise the output exactly as you want, using a wider range of functions. You can cook up all sorts of madness – now, who’s for colour-highlighted code in their title?

Before I finish, here are some more live functions:

  • Word shuffle - %%str_shuffle [text=my old man is a dustman and he likes giraffes]%%
  • Reverse - %%str_reverse [text=hello world and welcome to my plugin]%%
  • Rot13 - %%str_rot13 [text=hello world and welcome to my plugin]%%
  • Leet - %%str_leet [text=hello world and welcome to my plugin]%%
  • Email obsfucator - %%str_obscure_email [email=test.email@example.com]%%
  • System info - %%system_os%% %%system_release%% %%system_version%% %%system_machine%%
  • Time since - this page was created (as opposed to %%post_date%%)
  • PHP version - %%php_version%%
  • HTTP agent - your browser is %%http_agent%%
  • WordPress version - %%blog_version%%

And here's the WordPress calendar function embedded into a post:

%%wp_getcalendar%%
Share This

Comments (page 9 of 11)

  1. author
    Neil :

    Mar 2, 2007 12:15 pm

    I'm very interested in this plugin, but I'm getting an error message I don't understand...

    Anytime I try to do anything on the InScript options page, I get the following error:

    WARNING!
    Could not update the auto.php file - check write permissions on the inscript directory

    I've uploaded the inscript directory and given it CHMOD 777 permissions, but I can't even find an auto.php file...what am I missing?

    I'm running WP2.0.7 with InScript 1.7.1.

    Thanks in advance for the help...

  2. author
    Dirk :

    Mar 1, 2007 6:07 pm

    Thank you for the 1.7.1 fix for WP 2.1. You made my day!

  3. John (author) :

    Feb 28, 2007 9:37 pm

    New version 1.7.1 should fix any WordPress 2.1 problems

  4. author
    Dirk :

    Feb 1, 2007 8:52 am

    Hi John,
    I just installed WP 2.1, activated Inscript, defined hooks and (as a test) !!anything!! under Options>Inscript, inserted !!anything!! in a post and the value of !!anything!! is shown but with the following warning above:

    Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/www/web12/html/wp-content/plugins/inscript.php on line 708

    Can you please help me?

  5. author
    Dirk :

    Jan 15, 2007 6:13 pm

    Hi John, forget about question 3/ and /4. Just found the solution ...

  6. author
    Dirk :

    Jan 15, 2007 11:22 am

    John, with inscript WP becomes a Porsche CMS, great job!
    Questions:
    1/ %%random_line is a great function. I there an inscript function that allows me to show content within a page or post only for a certain period of time and then shows default content instead or other content with a *timer* (I know there is a way to do that with a php function)
    2/ Is there an inscript function that allows to disable a post at a certain point of time?
    3/ Can I use headspace and inscript at the same time?
    4/ (Probably stupid...) How do I use inscript to specify a head_title for a certain page or post? In the "Custom field" section within the "write post/page" page, and if yes do I have to use a variable like !!something!! as the value or can I use plain text or whatever in the value field? (I would like to see all meta values on the "write post/page" page instead of jumpimg to the "Options>Inscript" Page ...)
    Thanks for your help! And thank you for inscript!

  7. Ahmad :

    Oct 31, 2006 6:45 am

    Hello,
    Just wondering if anyone could help. I did something stupid and started my blog using a numerical archive system, and now I'd like to change it so that the post title is part of the URL for SEO reasons. Is there any Wordpress plugins that anyone knows of that could switch it without sending Googlers to invalid pages? Maybe some sort of redirector to the correct page?

    Thanks.

  8. John (author) :

    Sep 27, 2006 4:54 am

    Eric, if you're still trying to get InScript to work then drop me a line and point me at a non-working page and I'll take a look.

  9. Eric :

    Aug 22, 2006 7:31 am

    John, sorry for the long delay. Busy summer and complete overhaul of all my compter systems sucked up a bunch of time.

    %%system%% does not appear in the source text.

    I don't know if there's hosts with known issues. I'm hosting at Hostgator.

    Thanks,
    Eric

  10. John (author) :

    Jul 12, 2006 10:08 pm

    Eric, when you view the source does %%system%% appear in the text, or is that missing?

    Wilson, you probably could do something like that by creating your own pieces of code, but it may be easier to use HeadSpace2 as it's more specific for that purpose.

Leave a comment


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

Home | Software | Terms & Conditions | Sitemap | John Godley © 2008
Close
E-mail It