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

Source for file data.jstabs.php

Documentation is available at data.jstabs.php

  1. <?php
  2. /**
  3.  * @version  $Revision$
  4.  * @package  liberty
  5.  * @subpackage plugins_storage
  6.  */
  7.  
  8. /**
  9.  * definitions
  10.  */
  11. define'PLUGIN_GUID_DATAJSTABS''datajstabs' );
  12. global $gLibertySystem;
  13. $pluginParams array (
  14.     'tag'           => 'jstabs',
  15.     'title'         => 'Javascript Tabs',
  16.     'description'   => tra"Allow tabbing of content using a simple syntax." ),
  17.     //'help_page'     => 'DataPluginJstabs',
  18.  
  19.     'auto_activate' => FALSE,
  20.     'requires_pair' => TRUE,
  21.     'syntax'        => '{jstabs}',
  22.     'plugin_type'   => DATA_PLUGIN,
  23.  
  24.     // display icon in quicktags bar
  25.     'booticon'       => '{booticon iname="icon-folder-closed-alt" iexplain="Javascript Tabs"}',
  26.     'taginsert'     => '{jstabs}text{/jstabs}',
  27.  
  28.     // functions
  29.     'help_function' => 'data_jstabs_help',
  30.     'load_function' => 'data_jstabs',
  31. );
  32. $gLibertySystem->registerPluginPLUGIN_GUID_DATAJSTABS$pluginParams );
  33. $gLibertySystem->registerDataTag$pluginParams['tag']PLUGIN_GUID_DATAJSTABS );
  34.  
  35.  
  36. function data_jstabs$pData$pParams$pCommonObject {
  37.     global $gBitSmarty;
  38.     $gBitSmarty->loadPlugin'smarty_block_jstab' );
  39.     $gBitSmarty->loadPlugin'smarty_block_jstabs' );
  40.  
  41.     // collect all tabs
  42.     $tabs preg_split"!\n---tab:\s*!i"$pData );
  43.     $html '';
  44.  
  45.     foreach$tabs as $tab {
  46.         $tab trim$tab );
  47.         if!empty$tab )) {
  48.             // first line of every tab is the title
  49.             preg_match"!(.*?)\n(.*)!s"$tab$split );
  50.  
  51.             // we need a valid title and content to work with
  52.             if!empty$split[1&& !empty$split[2)) {
  53.                 // prepare data for tabification and parsing
  54.                 $params['title'trim$split[1);
  55.  
  56.                 $parseHash $pCommonObject->mInfo;
  57.                 $parseHash['no_cache'TRUE;
  58.                 $parseHash['data'$split[2];
  59.  
  60.                 $html .= smarty_block_jstab$params$pCommonObject->parseData$parseHash )$gBitSmarty'' );
  61.             }
  62.         }
  63.     }
  64.  
  65.     if!empty$html )) {
  66.         return smarty_block_jstabsarray()$html$gBitSmarty'' );
  67.     else {
  68.         return ' ';
  69.     }
  70. }
  71.  
  72. function data_jstabs_help({
  73.     return
  74.         '<p class="data help">'.tra"This plugin does not take any arguments but you need to use a particular syntax to add tabs. You need to insert something like: <strong>---tab: Title of the tab</strong> on a separate line. This will start a new tab with the title: <em>Title of the tab</em>." ).'</p>'
  75.         . tra"Example: ""<br />{jstabs}<br />---tab:First Tab<br />Some content<br />---tab:Second Tab<br />Some content in the second tab.<br />{/jstabs}";
  76. }
  77. ?>

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