Mycroft Search Plugin Generator

I was at work, and an idea hit me: Firefox search plugins are just text files. They also contain a lot of stuff that WordPress stores in it’s database. Why not make WordPress generate a search plugin for itself? Why not make a plugin that will work on any WordPress 1.5+ install? So I spent the rest of the day making the Mycroft Search Plugin Generator plugin

Current Version: 0.92

How it works:
When you change the settings, the plugin generates a .src file. This file is a Mycroft plugin file. the_mycroft_plugin() outputs some javascript and a link which trigger Firefox into installing the plugin.

Installation/Documentation:
Either:

  • RECOMMENDED: Install WordPress Plugin Manager then use the One Click Install for Mycroft Search Plugin Generator. This will also make it easier to install other plugins and upgrade them in the future.
  • OR: Download Mycroft Search Plugin Generator, extract and upload wbft-mycroft-search.php to your wp-content/plugins directory. Log-in to your WP admin panel, go to the Plugins tab and activate the Mycroft Search Plugin Generator plugin.

Then:

  • Go to Options > Mycroft Search Plugin and change the options. At the very least, be sure to click “Update options »”, as this is the only event that the .src file will ever get created.

How to implement:
First, go to Options > Mycroft Search Plugin and configure the plugin

  • Use Custom Name for Plugin
    If you turn this option on, Custom Plugin Name will be used for the name of the plugin. Otherwise, your standard weblog title will be used.
  • Plugin File Name
    This will become the first part of the .src file. This should not contain any characters that standard file names cannot contain. If you enter any, it will be changed the same way that post and page slugs are generated. When you install, a recommended plugin file name will be generated from your weblog title.
  • Plugin Icon
    This is the icon that will appear next to your search plugin. This should be the full URL to a 16×16 GIF or PNG file.
    The image file name must be identical to the Plugin File Name, and end in either .gif or .png. For example: /innergeek.gif
  • Plugin Category
    To be honest, I don’t know how this is ever used in Firefox, but Firefox asks for it. Feel free to change it to a category of website that your weblog fits. Blogs is probably sufficient.
  • Plugin Description
    Same as above. Defaults to “Searches the blog posts on [weblog title]”
  • Include Javascript in <head> or when the_mycroft_plugin() is called
    If you’re using the_mycroft_plugin() in your header or footer template, you probably want this to be set to “in <head>“. This assumes you have < ?php wp_head(); ?> in your header.
    If it’s set to when the_mycroft_plugin() is called, the Javascript will be included inline just before the link is output.

Then Simply add this php code to any WordPress template:
<?php the_mycroft_plugin (); ?>
to get Add [weblog title] to your Firefox Search Box!, where
or customise the link text like this:
<?php the_mycroft_plugin ("Firefox Search Plugin"); ?>
to get Firefox Search Plugin.

Version History:
0.92: * Alert to non-firefox users telling them they need Firefox to use Mycroft plugins.
* Fixed problem with Use Custom name.
* Shortened menu item from “Mycroft Search Plugin” to “Mycroft”.
* Moved image preview to simulated menu preview with rollover effect.
* Linked to plugin page in plugin header.
* Increased the size of some text boxes.
* Fixed some wording issues.
0.91: Fixed issue with .src not getting created when it didn’t exist.
0.9: Initial Public Release.

Known Issues:

  • The plugin does not create the .src file until you press “Update options »”.
  • Image field is not checked to see if the image’s filename or dimensions are valid.
  • Doesn’t come with a default image set, but tries to guess what the image will be named.

Credit:

  • Brett Taylor (Me! aka Glutnix) for coming up with the idea and implementing it within a day.

Bugs and Suggestions
Any bugs or suggestions, please email me – email link in the sidebar.

10 Responses to “Mycroft Search Plugin Generator”

  1. Brett Says:

    test comment on a page

  2. WordPress Italy Says in a pinging manner:

    Plugin WordPress: Mycroft Search Plugin Generator

    Mycroft Search Plugin Generator permette agli utenti di aggiungere facilmente un plugin di ricerca per Firefox per fare delle ricerche all’ interno del loro blog WordPress.
    [Traduzione da BloggingPro]

  3. oso Says:

    Would love to get this working, but unfortunately on the options page I get the following error:

    Fatal error: Cannot redeclare the_mycroft_plugin() (previously declared in /home/.abbottwasher/dsasaki/el-oso.net/blog/wp-content/plugins/wbft-mycroft-search.php:22) in /home/.abbottwasher/dsasaki/el-oso.net/blog/wp-content/plugins/wbft-mycroft-search.php on line 22

  4. Brett Says:

    Oso, that’s just weird… have you installed it twice or something? Try deleting the file you have, downloading the plugin file again and install that instead…

  5. oso Says:

    Strange, I tried exactly that, but still getting the same error message. There’s only one copy in my plugins folder (or anywhere else for that matter). I’ll wait and see if anyone else gets the same message and can figure it out.

  6. Austin Says:

    I get the exact same error!

  7. oso Says:

    Austin, are you using wordpress 1.5 or 1.5.2?

  8. Austin Says:

    1.5

  9. inner.geek » Blog Archive » WordPress Plugin: Mycroft Search Plugin Generator Says in a pinging manner:

    […] in that will work on any WordPress 1.5+ install? So I spent the rest of the day making the Mycroft Search Plugin Generator plugin! Try it at the bottom of the side […]

  10. oso Says:

    I’m planning on upgrading to 1.5.2 soon and will leave a comment if that fixes my problems.

Leave a Reply

Personalize your comments: Get a Gravatar.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> &lt; &gt;

Manage Comment Subscriptions