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

Source for file function.textarea.php

Documentation is available at function.textarea.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  * @link http://www.bitweaver.org/wiki/function_textarea function_textarea
  7.  */
  8.  
  9. /** 
  10.  * Smarty plugin
  11.  * -------------------------------------------------------------
  12.  * File: function.textarea.php
  13.  * Type: function
  14.  * Name: textarea
  15.  * -------------------------------------------------------------
  16.  */ 
  17. function smarty_function_textarea$pParams&$pSmarty {
  18.     global $gBitSystem$gContent$gLibertySystem;
  19.  
  20.     $attributes '';
  21.     $style '';
  22.     $class 'form-control ';
  23.     if (((!empty($gLibertySystem->mPlugins['bithtml']&& $gLibertySystem->mPlugins['bithtml']['is_active'== 'y'||
  24.         (!empty($gLibertySystem->mPlugins['tikiwiki']&& $gLibertySystem->mPlugins['tikiwiki']['is_active'== 'y' &&
  25.         $gBitSystem->isFeatureActive'content_force_allow_html' )))
  26.         && empty$pParams['nowysiwyg')
  27.         {
  28.         $class .= 'wysiwyg';
  29.     }
  30.     if (empty($pParams['rows'])) {
  31.         $pParams['rows'(empty($_COOKIE['rows']$gBitSystem->getConfig('liberty_textarea_height'20$_COOKIE['rows']);
  32.     }
  33.     if (empty($pParams['cols'])) {
  34.         $pParams['cols'(empty($_COOKIE['cols']$gBitSystem->getConfig('liberty_textarea_width'35$_COOKIE['rows']);
  35.     }
  36.     if (empty($pParams['id'])) {
  37.         $pParams['id'LIBERTY_TEXT_AREA;
  38.     }
  39.     ifempty$pParams['name') ){
  40.         $pParams['name''edit';
  41.     }
  42.     ifempty$pParams['maxchars') ){
  43.         // prevent smarty presistence of vars
  44.         $pParams['maxchars'0;
  45.     }
  46.     foreach ($pParams as $_key=>$_value{
  47.         switch ($_key{
  48.         case 'edit':
  49.         case 'name':
  50.         case 'id':
  51.         case 'help':
  52.         case 'noformat':
  53.         case 'label':
  54.         case 'error':
  55.         case 'required':
  56.         case 'maxchars':
  57.             $pSmarty->assign("textarea_".$_key$_value);
  58.             break;
  59.         case 'class':
  60.             $class .= ' '.$_key;
  61.             break;
  62.         case 'style':
  63.             $style .= $_key;
  64.             break;
  65.         case 'formatguid':
  66.             $pSmarty->assign('formatGuid'$_value);
  67.             break;
  68.         case 'langcode':
  69.             $pSmarty->assign('langCode'$_value);
  70.             break;
  71.         case 'gContent':
  72.             // Trick out gContent
  73.             $oldContent $gContent;
  74.             $gContent $_value;
  75.             $pSmarty->assign('gContent'$_value);
  76.             break;
  77.         default:
  78.             $attributes .= $_key.'="'.$_value.'" ';
  79.             break;
  80.         }
  81.     }
  82.     // We control hieght here when bnspell is on so as to be able to not
  83.     // lose the rest of the style on the textarea.
  84.     if ($gBitSystem->isPackageActive('bnspell')) {
  85.         $style .= (empty($style'' ';').'height:'.$pParams['rows'].'em;';
  86.     }
  87.     $pSmarty->assign('textarea_attributes'$attributes);
  88.  
  89.     if (!empty($style)) {
  90.         $pSmarty->assign('textarea_style''style="'.$style.'"');
  91.     }
  92.     $pSmarty->assign('textarea_class''class="'.$class.'"');
  93.     $ret $pSmarty->fetch("bitpackage:liberty/edit_textarea.tpl");
  94.  
  95.     ifis_object$gContent ) ) {
  96.         if$formatGuid $gContent->getField'format_guid' ) ) {
  97.             $pSmarty->assign('formatGuid'$formatGuid);
  98.         }
  99.         if$langCode $gContent->getField'lang_code' ) ) {
  100.             $pSmarty->assign'langCode'$langCode );
  101.         }
  102.     }
  103.  
  104.     // Restore gContent
  105.     if (isset($oldContent)) {
  106.         $gContent $oldContent;
  107.         $pSmarty->assign('gContent'$oldContent);
  108.     }
  109.  
  110.     // since we have the funky {textarea} in play, we'll display the edit help tab
  111.     $pSmarty->assign'display_help_tab'TRUE );
  112.  
  113.     return $ret;
  114. }
  115. ?>

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