wiki
[ class tree: wiki ] [ index: wiki ] [ all elements ]

Source for file sitemap.php

Documentation is available at sitemap.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2004 bitweaver.org
  4.  * Copyright (c) 2003 tikwiki.org
  5.  * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  6.  * All Rights Reserved. See below for details and a complete list of authors.
  7.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  8.  *
  9.  * @package wiki
  10.  * @subpackage functions
  11.  */
  12.  
  13. /**
  14.  * required setup
  15.  */
  16. require_once( '../kernel/setup_inc.php' );
  17.  
  18. require_once( WIKI_PKG_PATH.'BitBook.php' );
  19.  
  20. $book = new BitBook();
  21. $gSiteMapHash = array();
  22.  
  23. $listHash = array();
  24.  
  25. if( $bookList = $book->getList( $listHash ) ) {
  26.     foreach( $bookList['data'] as $bookHash ) {
  27.         $bookStructure = new LibertyStructure( $bookHash['structure_id'] );
  28.         $listBook = $bookStructure->buildTreeToc( $bookHash['structure_id'] );
  29.         process_book_list( $listBook );
  30.     }
  31. }
  32.  
  33.  
  34. function process_book_list( $pList, $pDepth = 1 ) {
  35.     global $gSiteMapHash;
  36.     foreach( array_keys( $pList ) as $key ) {
  37.         if( !empty( $pList[$key]['display_url'] ) ) {
  38.             $hash = array();
  39.             $hash['loc'] =  BIT_BASE_URI.$pList[$key]['display_url'];
  40.             $hash['lastmod'] = date( 'Y-m-d', $pList[$key]['last_modified'] );
  41.             if( (time() - $pList[$key]['last_modified']) < 86400 ) {
  42.                 $freq = 'daily';
  43.             } elseif( (time() - $pList[$key]['last_modified']) < (86400 * 7) ) {
  44.                 $freq = 'weekly';
  45.             } else {
  46.                 $freq = 'monthly';
  47.             }
  48.             
  49.             $hash['changefreq'] = $freq;
  50.             $hash['priority'] = 1 - (round( $pDepth * .5 ) * .1);
  51.             $gSiteMapHash[$pList[$key]['content_id']] = $hash;
  52.         }
  53.         if( !empty( $pList[$key]['sub'] ) ) {
  54.             process_book_list( $pList[$key]['sub'], ($pDepth + 1) );
  55.         }
  56.     }
  57. }
  58.  
  59. $gBitSmarty->assign_by_ref( 'gSiteMapHash', $gSiteMapHash );
  60. $gBitThemes->setFormatHeader( 'xml' );
  61. print $gBitSmarty->display( 'bitpackage:kernel/sitemap.tpl' );

Documentation generated on Wed, 29 Jul 2015 13:57:28 +0000 by phpDocumentor 1.5.0-lsces