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

Source for file data.alias.php

Documentation is available at data.alias.php

  1. <?php
  2. /**
  3.  * assigned_modules
  4.  *
  5.  * @author     xing
  6.  * @version    $Revision$
  7.  * @package    liberty
  8.  * @subpackage plugins_data
  9.  * @copyright  Copyright (c) 2004, bitweaver.org
  10.  */
  11.  
  12. /**
  13.  * Setup Code
  14.  */
  15. define( 'PLUGIN_GUID_DATAalias', 'dataalias' );
  16. global $gLibertySystem;
  17. $pluginParams = array (
  18.     'tag' => 'alias',
  19.     'auto_activate' => FALSE,
  20.     'requires_pair' => FALSE,
  21.     'load_function' => 'data_alias',
  22.     'title' => 'Alias',
  23.     'help_page' => 'DataPluginAlias',
  24.     'description' => tra( "This plugin allows you to easily create an alias for a page." ),
  25.     'help_function' => 'data_alias_help',
  26.     'syntax' => "{alias page='title'}",
  27.     'plugin_type' => DATA_PLUGIN
  28. );
  29. $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAalias, $pluginParams );
  30. $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAalias );
  31.  
  32. function data_alias_help() {
  33.     $help =
  34.         '<table class="data help">'
  35.             .'<tr>'
  36.                 .'<th>' . tra( "Key" ) . '</th>'
  37.                 .'<th>' . tra( "Type" ) . '</th>'
  38.                 .'<th>' . tra( "Comments" ) . '</th>'
  39.             .'</tr>'
  40.             .'<tr class="odd">'
  41.                 .'<td>' . tra( "page" ) . '</td>'
  42.                 .'<td>' . tra( "string") . '<br />' . tra( "(required)" ) . '</td>'
  43.                 .'<td>' . tra( "The name of any other wiki page." ) .'</td>'
  44.             .'</tr>'
  45.         .'</table>'
  46.         . tra( "Example: " ) . "{alias page='Welcome'}";
  47.     return $help;
  48. }
  49.  
  50. function data_alias( $pData, $pParams, $pCommonObject ) {
  51.     $page = '';
  52.     require_once(WIKI_PKG_PATH."BitPage.php");
  53.  
  54.     foreach( $pParams as $key => $value ) {
  55.         if( !empty( $value ) ) {
  56.             switch( $key ) {
  57.                 case 'page':
  58.                     $page = $value;
  59.                     break;
  60.             default:
  61.                 break;
  62.             }
  63.         }
  64.     }
  65.     return tra("This page is an alias for:").'&nbsp;'.BitPage::getPageLink($page, LibertyContent::pageExists($page));
  66. }
  67. ?>

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