Mercurial > hg > rr-repo
view sites/all/modules/schemaorg/schemaorg.drush.inc @ 13:134d4b2e75f6
updated quicktabs and google analytics modules
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Tue, 29 Oct 2013 13:48:59 +0000 |
parents | ce11bbd8f642 |
children |
line wrap: on
line source
<?php /** * @file * Drush integration for the schemaorg module. */ /** * Implements hook_drush_command(). */ function schemaorg_drush_command() { $items['schemaorg-json'] = array( 'description' => dt('Generates JSON from rdfs.schema.org.'), 'options' => array( '--with-comments' => 'Includes comment in the JSON output', ), ); return $items; } /** * JSON output command callback. */ function drush_schemaorg_json() { $data = json_decode(drupal_http_request('http://schema.rdfs.org/all.json')->data); $curated_terms = array(); foreach ($data as $category => $terms) { foreach ($terms as $id => $term) { if (drush_get_option('with-comments')) { // The value and label keys are what the jQuery UI autocomplete excepts. $curated_terms[$category][$id]['value'] = $term->id; $curated_terms[$category][$id]['label'] = $term->id . ': ' . $term->comment_plain; } else { $curated_terms[$category][] = $term->id; } } } print json_encode($curated_terms); }