Source for file class.acBlockType_text.php

Documentation is available at class.acBlockType_text.php

  1. <?php
  2. {
  3.     function __construct(&$content_obj, $params = array())
  4.     {
  5.         $params['block_type'] = 'text';
  6.         parent::__construct($content_obj, $params);
  7.         
  8.         $size        = isset($params['size']) ? intval($params['size']) : '';
  9.         $maxlength   = isset($params['maxlength']) ? $params['maxlength'] : '';
  10.         $usewysiwyg  = (!isset($params['usewysiwyg']) || !ac_utils::IsFalse($params['usewysiwyg'])) && ((!isset($params['wysiwyg']) || !ac_utils::IsFalse($params['wysiwyg'])));
  11.         $rows        = isset($params['rows']) ? $params['rows'] : '';
  12.         $cols        = isset($params['cols']) ? $params['cols'] : '';
  13.         $auto_resize = !isset($params['auto_resize']) || !ac_utils::IsFalse($params['auto_resize']);
  14.         $oneline     = isset($params['oneline']) && ac_utils::IsTrue($params['oneline']);
  15.         
  16.         $this->SetProperty('size', $size);
  17.         $this->SetProperty('usewysiwyg', $usewysiwyg );
  18.         $this->SetProperty('oneline', $oneline );
  19.         $this->SetProperty('maxlength', $maxlength );
  20.         $this->SetProperty('rows', $rows );
  21.         $this->SetProperty('cols', $cols );
  22.         $this->SetProperty('auto_resize', $auto_resize);
  23.     }
  24.     
  25.     public function GetInput()
  26.     {
  27.         if($this->content_obj->GetPropertyValue('disable_wysiwyg'))
  28.             $this->SetProperty('usewysiwyg',false);
  29.         
  30.         if (!$this->GetProperty('oneline'))
  31.             return create_textarea(
  32.                 $this->GetProperty('usewysiwyg'), 
  33.                 $this->GetContent(), 
  34.                 $this->GetProperty('id'), 
  35.                 ($this->GetProperty('auto_resize') ? 'AdvancedContent_textarea' : ''), 
  36.                 $this->GetProperty('id'), 
  37.                 '', 
  38.                 $this->content_obj->GetStylesheet(), 
  39.                 $this->GetProperty('cols') ? $this->GetProperty('cols') : 80, 
  40.                 $this->GetProperty('rows') ? $this->GetProperty('rows') : 15, 
  41.                 '', '', 
  42.                 ($this->GetProperty('cols') || $this->GetProperty('rows') ? 
  43.                     ('style="' . 
  44.                         ($this->GetProperty('cols') ? 'width:auto;' : '') . 
  45.                         ($this->GetProperty('rows') ? 'height:auto;' : '') . 
  46.                     '"') : ''
  47.                 )
  48.             );
  49.         else
  50.             return '<input id="'.$this->GetProperty('id').'" type="text"' . 
  51.                 ($this->GetProperty('style') != '' ? 
  52.                     'style="' . $this->GetProperty('style') . ' "' : '') . 
  53.                 ($this->GetProperty('maxlength') != '' ? 
  54.                     ' maxlength="' . $this->GetProperty('maxlength') . ' "' : '') . 
  55.                 ($this->GetProperty('size') != '' ? 
  56.                     ' size="' . $this->GetProperty('size') . ' "' : '') . 
  57.                 ' name="' . $this->GetProperty('id') . 
  58.                 '" value="' . htmlspecialchars($this->GetContent()) . '" />';
  59.     }
  60.     
  61.     public function GetHeaderHTML()
  62.     {
  63.         if($this->_header_html_called)
  64.             return;
  65.         
  66.         $this->_header_html_called = true;
  67.         
  68.         return '
  69. <script language="javascript" type="text/javascript">
  70. /* <![CDATA[ */
  71. ac_onload.push(function(){
  72.     (function($){
  73.         $("textarea.AdvancedContent_textarea").autoResize({
  74.             animate:false,
  75.             extraSpace: 0,
  76.             limit:jQuery(window).height()
  77.         }).keydown();
  78.     })(jQuery);
  79. });
  80. /* ]]> */
  81. </script>';
  82.     }
  83.     
  84. }
  85. ?>

Documentation generated on Tue, 09 Oct 2012 16:57:04 +0200 by phpDocumentor 1.4.1