/[drupal]/contributions/modules/export_opml/export_opml.module
ViewVC logotype

Diff of /contributions/modules/export_opml/export_opml.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Mon Nov 28 08:44:12 2005 UTC revision 1.2, Tue Nov 29 09:13:46 2005 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: $  // $Id: export_opml.module,v 1.1 2005/11/28 08:44:12 puregin Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 7  Line 7 
7   */   */
8    
9  /**  /**
10     * Implementation of hook_perm().
11     */
12    function export_opml_perm() {
13      return array('export books as opml');
14    }
15    
16    /**
17   * Implementation of hook_link().   * Implementation of hook_link().
18   */   */
19  function export_opml_link($type, $node = 0, $main = 0) {  function export_opml_link($type, $node = 0, $main = 0) {
20    $links = array();    $links = array();
21    if ($type == 'node' && isset($node->parent)) {    if ($type == 'node' && isset($node->parent)) {
22      if (!$main) {      if (!$main) {
23        if (user_access('export books')) {        if (user_access('export books as opml')) {
24          $links[] = l(t('export OPML'), 'book/export/opml/'. $node->nid, array('title' => t('Export this book page and its sub-pages as OPML.')));          $links[] = l(t('export OPML'), 'book/export/opml/'. $node->nid, array('title' => t('Export this book page and its sub-pages as OPML.')));
25        }        }
26      }      }
# Line 43  function export_opml_link($type, $node = Line 50  function export_opml_link($type, $node =
50    
51  */  */
52  function book_export_opml($nid, $depth) {  function book_export_opml($nid, $depth) {
53    if (user_access('export books')) {    if (user_access('export books as opml')) {
54        drupal_set_header('Content-Type: text/xml; charset=utf-8');        drupal_set_header('Content-Type: text/xml; charset=utf-8');
55        $output .= book_recurse($nid, $depth, 'book_node_visitor_opml_pre', 'book_node_visitor_opml_post');        $output .= book_recurse($nid, $depth, 'book_node_visitor_opml_pre', 'book_node_visitor_opml_post');
56        $ompl  = "<?xml version='1.0'?>\n";        $ompl  = "<?xml version='1.0'?>\n";
# Line 108  function export_opml_help($section) { Line 115  function export_opml_help($section) {
115    }    }
116  }  }
117    
118    /**
119     * Implementation of hook_menu().
120     */
121    function export_opml_menu($may_cache) {
122      $items = array();
123    
124      if ($may_cache) {
125        $items[] = array(
126          'path' => 'book/export',
127          'callback' => 'book_export',
128          'access' => (user_access('export books as opml') && user_access('access content')),
129          'type' => MENU_CALLBACK);
130      }
131    
132      return $items;
133    }
134    
135    
136    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2