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

Source for file data.include.php

Documentation is available at data.include.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_data
  6.  */
  7. // +----------------------------------------------------------------------+
  8. // | Copyright (c) 2004, bitweaver.org
  9. // +----------------------------------------------------------------------+
  10. // | All Rights Reserved. See below for details and a complete list of authors.
  11. // | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  12. // |
  13. // | For comments, please use phpdocu.sourceforge.net documentation standards!!!
  14. // | -> see http://phpdocu.sourceforge.net/
  15. // +----------------------------------------------------------------------+
  16. // | Author (TikiWiki): Marc Laporte <marclaporte@users.sourceforge.net>
  17. // | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
  18. // | by: StarRider <starrrider@users.sourceforge.net>
  19. // +----------------------------------------------------------------------+
  20. // $Id$
  21.  
  22. /**
  23.  * definitions
  24.  */
  25. define'PLUGIN_GUID_DATAINCLUDE''datainclude' );
  26. global $gLibertySystem;
  27. $pluginParams array (
  28.     'tag' => 'INCLUDE',
  29.     'auto_activate' => TRUE,
  30.     'requires_pair' => FALSE,
  31.     'load_function' => 'data_include',
  32.     'title' => 'Include',
  33.     'help_page' => 'DataPluginInclude',
  34.     'description' => tra("This plugin is used to include the contents of one Wiki page in another Wiki page."),
  35.     'help_function' => 'data_include_help',
  36.     'syntax' => "{INCLUDE content_id= }",
  37.     'plugin_type' => DATA_PLUGIN
  38. );
  39. $gLibertySystem->registerPluginPLUGIN_GUID_DATAINCLUDE$pluginParams );
  40. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATAINCLUDE );
  41.  
  42. // Help Function
  43. function data_include_help({
  44.     $help '
  45.         <table class="plugin help">
  46.             <tr>
  47.                 <th>'.tra'key' ).'</th>
  48.                 <th>'.tra'type' ).'</th>
  49.                 <th>'.tra'comments' ).'</th>
  50.             </tr>
  51.             <tr class="odd">
  52.                 <td>page_name</td>
  53.                 <td>'.tra'string (optional)' ).'</td>
  54.                 <td>'.tra'To include any wiki page you can use it\'s page name (this has to be a unique name. if it\'s not unique, use the page_id instead) (this method is deprecated).' ).'</td>
  55.             </tr>
  56.             <tr class="even">
  57.                 <td>page_id</td>
  58.                 <td>'.tra'numeric (optional)' ).'</td>
  59.                 <td>'.tra'To include any wiki page you can use it\'s page_id number.' ).'</td>
  60.             </tr>
  61.             <tr class="odd">
  62.                 <td>content_id</td>
  63.                 <td>'.tra'numeric (optional)' ).'</td>
  64.                 <td>'.tra'To include any content from bitweaver insert the appropriate numeric content id. This can include blog posts, images, wiki texts...<br />
  65.                     Avaliable content can be viewed <a href="'.LIBERTY_PKG_URL.'list_content.php">here</a>' ).'</td>
  66.             </tr>
  67.         </table>
  68.         Example: {INCLUDE page_name=Welcome}
  69.         Example: {INCLUDE page_id=15}
  70.         Example: {INCLUDE content_id=15}';
  71.     return $help;
  72. }
  73.  
  74. function data_include($data$params{
  75.     $ret "<p>Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page.</p>";
  76.     // load page by page_id
  77.     ifisset$params['page_id'&& is_numeric$params['page_id') ) {
  78.         require_onceWIKI_PKG_PATH.'BitPage.php');
  79.         $wp new BitPage$params['page_id');
  80.         if$wp->load() ) {
  81.             $ret $wp->parseData$wp->mInfo );
  82.         }
  83.     // load page by content_id
  84.     elseifisset$params['content_id'&& is_numeric$params['content_id') ) {
  85.         if$obj LibertyBase::getLibertyObject$params['content_id') ) {
  86.             $ret $obj->parseData();
  87.         }
  88.     // load page by page_name
  89.     elseifisset$params['page_name') ) {
  90.         $ret "page_name isn't working yet, please use page_id or content_id";
  91.     }
  92.  
  93.     // if $ret is empty, we need to make sure there is at least a space that we get rid of the {}
  94.     ifempty$ret )) {
  95.         $ret ' ';
  96.     }
  97.  
  98.     return $ret;
  99. }
  100. ?>

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