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.

19 thoughts on “Mycroft Search Plugin Generator

  1. Brett

    test comment on a page

  2. WordPress Italy

    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

    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

    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

    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

    I get the exact same error!

  7. oso

    Austin, are you using wordpress 1.5 or 1.5.2?

  8. Austin

    1.5

  9. […] 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

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

  11. Franck

    Is there a way to use this online on a website, outside WordPress?
    Is it a stupid question?

  12. Brett

    Hi Franck, the only stupid questions are the ones not asked.

    But the answer to your question is No: it’s a WordPress plugin, it works with WordPress only.

    You can however, make your own firefox plugin manually. Do a google search and you’ll find instructions on how to achieve this.

  13. matt pist

    hi, this is a great plugin, but i was wondering, i can’t seem to make the link a picture instead of a text link, most likely because my php skills are pretty poor 🙂

    is there a way to do this? i have an excellent gif id like to use!

  14. opereysin

    hi!
    I used your plugin but i have a problem.

    When i add my site to search box, the image (.gif as you told) doesn’t shown, but the site name is already there and i can functionally search. What may be the problem?

    i checked gif’s directory and searchplugins folder. The gif is in the searchplugins folder. i tested it in Firefox 1.0.7

  15. Rene

    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.

  16. Rob - web page tools

    I found using WordPress to design my web sites a great time saver and with plugins for automatic sitemap generation and SEO optimisation and easy changing of themes its such a web design time saver. If fact i just made a template from the theme i’m currently using and after veiwing the souce code i just saved as html and with a bit of copy and pasting moved all the content on my older html pages to the new template now my older pages all look the same as the blog template. On a new site this isnt a problem but this one has been around a while before i used WordPress. Still have a load of article pages to move over but i should be able to automate some of it with a few block text replacer programs i have.

  17. Firefox Search Plugin - Matthew Botos

    […] search plugin to the right under News Feeds.The WordPress plugin that makes this possible is the Mycroft Search Plugin Generator, though like other WordPress plugins I’ve encountered recently, it required some tweaking to […]

  18. Wordpress Quickstart Guy

    I think Optimal Title should do the trick. thanks for this useful plugin.

  19. Janice VanCleave

    I am a newbee at blogging.
    I want to create a worksheet page on my blog that can be printed. I want the worksheet to have some static information provided by me and some parts that user will type in before printing the page.
    Am I looking for a plugin that will generator such a page? If so, help me with the technical terms needed to search for this plugin.
    Thank you sooooo much.
    Janice VanCleave
    http://www.scienceprojectideasforkids.com

Leave a Reply