Ahh, never mind me. I figured it out. The second parameter in
$wf->result()
is the parameter that gets passed on. Here's the updated code:
require_once('workflows.php');
$wf = new Workflows();
$orig = "{query}";
$json = $wf->request("http://www.kickstarter.com/projects/search.json?search=&term=".urlencode($orig));
$json = json_decode($json);
foreach($json->projects as $project)
{
$url = (preg_match('/<a href="(.*?)\?ref=live/i', $project->card_html, $matches)) ? 'http://kickstarter.com'.html_entity_decode($matches[1]) : '';
$funded = (preg_match('/class=".*?funded".*?<strong>(.*?)<\/strong>/is', $project->card_html, $matches)) ? $matches[1] : '';
$pledged = (preg_match('/class="pledged".*?<strong>(.*?)<\/strong>/is', $project->card_html, $matches)) ? $matches[1] : '';
$by = (preg_match('/<span>\s*by(.*?)\s*<\/span>/is', $project->card_html, $matches)) ? trim($matches[1]) : '';
$successful = (stripos($project->card_html, 'project-pledged-successful">') !== FALSE) ? TRUE : FALSE;
$failed = (stripos($project->card_html, 'project-failed') !== FALSE) ? TRUE : FALSE;
$status = ($successful OR $failed) ? 'Inactive' : 'Active';
$project->name = html_entity_decode($project->name, ENT_QUOTES);
$wf->result($project->id, $url, $project->name, "{$status} | by {$by} | {$funded} funded | {$pledged} pledged", 'icon.png');
}
$results = $wf->results();
if ( count( $results ) == 0 )
{
$wf->result( 'googlesuggest', $orig, 'No Suggestions', 'No search suggestions found. Search Google for '.$orig, 'icon.png' );
}
echo $wf->toxml();
And here's the download.