Skip to content

Instantly share code, notes, and snippets.

@dave1010
Created January 31, 2009 08:52
Show Gist options
  • Save dave1010/55487 to your computer and use it in GitHub Desktop.
Save dave1010/55487 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "search-php",
homepage: "http://createopen.com/blog/",
author: { name: "David Hulbert", email: "dave1010+ubiquity@gmail.com"},
icon: "http://static.php.net/www.php.net/favicon.ico",
license: "MPL",
takes: {"function": noun_arb_text},
description: "Searches PHP for a function.",
help: "Searches PHP for a function and previews the description. Example: 'search-php strpos'",
preview: function(pblock) {
if (pblock.text.length) {
"Takes you to the PHP documentation",
var url = "http://php.net/{QUERY}"
var query = pblock.text;
var urlString = url.replace("{QUERY}", query);
jQuery.get(urlString, {}, function(d){
if( d.length > 0 ) {
var desc = jQuery(".description", d);
var title = jQuery(".refpurpose", d);
}
pblock.innerHTML = desc + title;
});
} else {
pblock.innerHTML = "Search PHP for a function"
}
},
execute: function(functionname) {
var url = "http://php.net/{QUERY}"
var query = functionname.text;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment