예제 #1
0
파일: html.php 프로젝트: hamby/SEBLOD
 protected static function _typo($typo, $field, $value, &$config = array())
 {
     $app = JFactory::getApplication();
     $html = $typo->get('html', '');
     if (!(strpos($html, '<a href') !== false || strpos($html, '*link*') !== false || strpos($html, 'getLink') !== false)) {
         $html = parent::g_hasLink($field, $typo, $html);
     }
     if ($html != '') {
         $matches = '';
         $search = '#\\*([a-zA-Z0-9_]*)\\*#U';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             foreach ($matches[1] as $target) {
                 if (isset($field->{$target})) {
                     if (is_array($field->{$target})) {
                         $html = str_replace('*' . $target . '*', isset($field->{$target}[0]) ? $field->{$target}[0] : '', $html);
                     } else {
                         $html = str_replace('*' . $target . '*', $field->{$target}, $html);
                     }
                 }
             }
         }
     }
     if ($html != '' && strpos($html, '$cck->get') !== false) {
         $matches = '';
         $search = '#\\$cck\\->get([a-zA-Z0-9_]*)\\( ?\'([a-zA-Z0-9_,]*)\' ?\\)(;)?#';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             parent::g_addProcess('beforeRenderContent', self::$type, $config, array('name' => $field->name, 'matches' => $matches));
         }
     }
     if ($html != '' && strpos($html, '$uri->get') !== false) {
         $matches = '';
         $search = '#\\$uri\\->get([a-zA-Z]*)\\( ?\'?([a-zA-Z0-9_]*)\'? ?\\)(;)?#';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             foreach ($matches[1] as $k => $v) {
                 $variable = $matches[2][$k];
                 if ($v == 'Current') {
                     $request = $variable == 'true' ? JURI::getInstance()->toString() : JURI::current();
                     $html = str_replace($matches[0][$k], $request, $html);
                 } else {
                     $request = 'get' . $v;
                     $html = str_replace($matches[0][$k], $app->input->{$request}($variable, ''), $html);
                 }
             }
         }
     }
     if ($html != '' && strpos($html, 'J(') !== false) {
         $matches = '';
         $search = '#J\\((.*)\\)#U';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             foreach ($matches[1] as $text) {
                 $html = str_replace('J(' . $text . ')', JText::_('COM_CCK_' . str_replace(' ', '_', trim($text))), $html);
             }
         }
     }
     return $html;
 }
예제 #2
0
파일: image.php 프로젝트: hamby/SEBLOD
 protected static function _typo($typo, &$field, $value, &$config = array())
 {
     // Prepare
     $options = array('base' => JUri::root(true) . '/', 'attributes' => $typo->get('attributes', ''), 'class' => $typo->get('class', ''), 'root' => $typo->get('path_type', 0) ? JUri::root() : '');
     $thumb_array = array('thumb' => $typo->get('thumb', 'thumb1'), 'thumb_2x' => $typo->get('thumb_2x', ''), 'thumb_3x' => $typo->get('thumb_3x', ''), 'thumb_custom' => $typo->get('thumb_custom', 0), 'thumb_width' => $typo->get('thumb_width', ''), 'thumb_height' => $typo->get('thumb_height', ''), 'image' => $typo->get('image', 'value'), 'image_custom' => $typo->get('image_custom', 0), 'image_width' => $typo->get('image_width', ''), 'image_height' => $typo->get('image_height', ''), 'image_title' => $typo->get('image_title', 1));
     $alt_fieldname = $typo->get('image_alt_fieldname', '');
     if (is_array($field->value)) {
         $typo = self::_addImages($field, $thumb_array, $options);
     } else {
         $typo = self::_addImage($field, $thumb_array, $options);
     }
     if ($alt_fieldname != '') {
         parent::g_addProcess('beforeRenderContent', self::$type, $config, array('name' => $field->name, 'alt_fieldname' => $alt_fieldname));
     }
     return $typo;
 }