| 1 |
<?php |
<?php |
| 2 |
|
/** |
| 3 |
function node_gdata($op) { |
* Copyright and License info |
| 4 |
switch ($op) { |
* |
| 5 |
case 'read': |
* Copyright 2006 Sumit Datta | sumitdatta _at_ gmail _dot_ com |
| 6 |
global $base_url; |
* |
| 7 |
$nodes = db_query_range("SELECT n.nid FROM {node} n WHERE n.promote = '1' AND n.status = '1' ORDER BY n.created DESC", 0, variable_get('atom_feed_entries', 15)); |
This program is free software; you can redistribute it and/or modify |
| 8 |
$feed_info = array(); |
it under the terms of the GNU General Public License as published by |
| 9 |
$feed_info['title'] = strip_tags(variable_get('site_name', 'Drupal')); |
the Free Software Foundation; either version 2 of the License, or |
| 10 |
$feed_info['subtitle'] = strip_tags(variable_get('site_slogan', '')); |
(at your option) any later version. |
| 11 |
$feed_info['html_url'] = $base_url; |
|
| 12 |
$feed_info['gdata_url'] = url('gdata', NULL, NULL, true); |
This program is distributed in the hope that it will be useful, |
| 13 |
_gdata_print_feed($nodes, $feed_info); |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
break; |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
GNU General Public License for more details. |
| 16 |
case 'write': |
|
| 17 |
break; |
You should have received a copy of the GNU General Public License |
| 18 |
|
along with this program; if not, write to the Free Software |
| 19 |
case 'update': |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
break; |
*/ |
| 21 |
|
|
| 22 |
case 'delete': |
function node_gdata($op, $path = '') { |
| 23 |
break; |
global $base_url, $user; |
| 24 |
|
if (0 == ($module_details = variable_get('gdata_gdata', 0))) { |
| 25 |
case 'search': |
die(gdata_error('error')); |
| 26 |
break; |
} |
| 27 |
|
switch ($op) { |
| 28 |
/* |
case 'read': |
| 29 |
* Return an array cantaining three elements 'implements', 'path', 'help': |
$sql = "SELECT n.nid FROM {node} n WHERE n.promote = '1' AND n.status = '1' ORDER BY n.created DESC"; |
| 30 |
* 'implements' :: this is an array of the terms : |
if (false !== ($nodes = db_query_range($sql, 0, variable_get('gdata_feed_entries', 15)))) { |
| 31 |
* 'read', 'write', 'update', 'delete', 'search', in any order. Each |
if (0 != db_num_rows($nodes)) { |
| 32 |
* term signifies that your module implements the feature. The |
$feed_info = array(); |
| 33 |
* absence of any term means that feature is not implemented. If no |
$feed_info['title'] = strip_tags(variable_get('site_name', 'Drupal')); |
| 34 |
* feature is implemented then the module will NOT be used. |
$feed_info['subtitle'] = strip_tags(variable_get('site_slogan', '')); |
| 35 |
* |
$feed_info['html_url'] = $base_url; |
| 36 |
* 'path' :: this is the path under /gfeed/ that you want to handle. |
$feed_info['feed_url'] = url($path, NULL, NULL, true); |
| 37 |
* Do NOT register this path with the normal node_menu( ) hook. |
_gdata_print_feed($nodes, $feed_info); |
| 38 |
* Also the administrator may change the path. All that is handled by |
} |
| 39 |
* gdata module. If this is not provided then the name of module is used. |
else { |
| 40 |
* |
gdata_blank_feed($path); |
| 41 |
* 'help' :: this is a string which explains what your module does (incase |
} |
| 42 |
* the administrator has forgotten it or is confused :) ) |
} |
| 43 |
*/ |
break; |
| 44 |
case 'info': |
|
| 45 |
$array = array( |
case 'write': |
| 46 |
'enabled' => 'true', |
break; |
| 47 |
'implements' => array('read', 'write', 'search'), |
|
| 48 |
'path' => '', |
case 'update': |
| 49 |
'help' => t('This is just a testing of GData hook, for node module'), |
break; |
| 50 |
); |
|
| 51 |
break; |
case 'delete': |
| 52 |
} |
break; |
| 53 |
return $array; |
|
| 54 |
} |
case 'search': |
| 55 |
|
break; |
| 56 |
|
|
| 57 |
|
/* |
| 58 |
|
* Return an array cantaining three elements 'implements', 'path', 'help': |
| 59 |
|
* 'implements' :: this is an array of the terms : |
| 60 |
|
* 'read', 'write', 'update', 'delete', 'search', in any order. Each |
| 61 |
|
* term signifies that your module implements the feature. The |
| 62 |
|
* absence of any term means that feature is not implemented. If no |
| 63 |
|
* feature is implemented then the module will NOT be used. |
| 64 |
|
* |
| 65 |
|
* 'path' :: this is the path under /gfeed/ that you want to handle. |
| 66 |
|
* Do NOT register this path with the normal node_menu( ) hook. |
| 67 |
|
* Also the administrator may change the path. All that is handled by |
| 68 |
|
* gdata module. If this is not provided then the name of module is used. |
| 69 |
|
* |
| 70 |
|
* 'help' :: this is a string which explains what your module does (incase |
| 71 |
|
* the administrator has forgotten it or is confused :) ) |
| 72 |
|
*/ |
| 73 |
|
case 'info': |
| 74 |
|
$array = array( |
| 75 |
|
'enabled' => 'true', |
| 76 |
|
'implements' => array('read'), |
| 77 |
|
'path' => 'node', |
| 78 |
|
'help' => t('This is just a testing of GData hook, for node module'), |
| 79 |
|
); |
| 80 |
|
break; |
| 81 |
|
} |
| 82 |
|
return $array; |
| 83 |
|
} |