예제 #1
0
 protected static function _addImage(&$field, $params, $root)
 {
     $value = $field->value;
     $ext = substr(strrchr($field->value, "."), 1);
     $filename = substr(strrchr($field->value, "/"), 1);
     $filename = str_replace('.' . $ext, '', $filename);
     $img_title = isset($field->image_title) ? $field->image_title : '';
     $img_title = $img_title != '' ? $img_title : $filename;
     $img_description = isset($field->image_alt) ? $field->image_alt : '';
     $img_description = $img_description != '' ? $img_description : $img_title;
     $box_description = $img_description;
     $width = '';
     $height = '';
     if ($params['thumb_custom'] == 1) {
         $width = ' width="' . $params['thumb_width'] . '"';
         $height = ' height="' . $params['thumb_height'] . '"';
     }
     $img = '<img title="' . $img_title . '" alt="' . $img_description . '" src="' . self::_availableThumb($field, $params['thumb'], $root) . '"' . $width . $height . ' />';
     if (isset($field->link) && $field->link) {
         $typo = parent::g_hasLink($field, new stdClass(), $img);
     } elseif ($params['image'] == 'none') {
         $typo = $img;
     } else {
         $typo = '<a id="colorBox' . $field->id . '" href="' . self::_availableValue($field, $params['image'], $root) . '" rel="colorBox' . $field->id . '" title="' . $box_description . '">' . $img . '</a>';
     }
     if ($params['image'] != 'none') {
         self::_addScripts(array('id' => $field->id), $params);
     }
     return $typo;
 }
예제 #2
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;
 }
예제 #3
0
파일: bold.php 프로젝트: hamby/SEBLOD
 public function onCCK_Field_TypoPrepareContent(&$field, $target = 'value', &$config = array())
 {
     if (self::$type != $field->typo) {
         return;
     }
     // Prepare
     $typo = parent::g_getTypo($field->typo_options);
     $value = parent::g_hasLink($field, $typo, $field->{$target});
     // Set
     if ($field->typo_label) {
         $field->label = self::_typo($typo, $field, $field->label, $config);
     }
     $field->typo = self::_typo($typo, $field, $value, $config);
 }
예제 #4
0
파일: date.php 프로젝트: densem-2013/exikom
 public function onCCK_Field_TypoPrepareContent(&$field, $target = 'value', &$config = array())
 {
     if (self::$type != $field->typo) {
         return;
     }
     self::$path = JURI::root() . 'plugins/cck_field_typo/' . self::$type . '/';
     // Prepare
     if ($field->value && $field->value != '' && $field->value != '0000-00-00 00:00:00') {
         $typo = parent::g_getTypo($field->typo_options);
         $field->typo = self::_typo($typo, $field, '', $config);
     } else {
         $field->typo = '';
     }
     $field->typo = parent::g_hasLink($field, $typo, $field->typo);
 }
예제 #5
0
파일: image.php 프로젝트: hamby/SEBLOD
 protected static function _addImage(&$field, $params, $options)
 {
     $value = $field->value;
     $ext = substr(strrchr($field->value, "."), 1);
     $filename = substr(strrchr($field->value, "/"), 1);
     $filename = str_replace('.' . $ext, '', $filename);
     $image_title = isset($field->image_title) ? $field->image_title : '';
     $field->image_title = $image_title != '' ? $image_title : $filename;
     $image_alt = isset($field->image_alt) ? $field->image_alt : '';
     $field->image_alt = $image_alt != '' ? $image_alt : $image_title;
     $field->image_title = $params['image_title'] && $field->image_title ? $field->image_title : '';
     $title = $field->image_title ? 'title="' . $field->image_title . '" ' : '';
     $attr = $options['attributes'] != '' ? ' ' . $options['attributes'] : '';
     $class = $options['class'] != '' ? ' class="' . $options['class'] . '"' : '';
     $height = '';
     $srcset = '';
     $width = '';
     if ($params['thumb_custom'] == 1) {
         $width = ' width="' . $params['thumb_width'] . '"';
         $height = ' height="' . $params['thumb_height'] . '"';
     }
     if ($params['thumb_2x']) {
         $srcset = ($options['root'] ? '' : $options['base']) . self::_availableThumb($field, $params['thumb_2x'], $options) . ' 2x';
         if ($params['thumb_3x']) {
             $srcset .= ', ' . ($options['root'] ? '' : $options['base']) . self::_availableThumb($field, $params['thumb_3x'], $options) . ' 3x';
         }
         $srcset = ' srcset="' . $srcset . '"';
     }
     $img = '<img ' . $title . 'alt="' . $field->image_alt . '" src="' . self::_availableThumb($field, $params['thumb'], $options) . '"' . $srcset . $class . $attr . $width . $height . ' />';
     if (isset($field->link) && $field->link) {
         $typo = parent::g_hasLink($field, new stdClass(), $img);
     } elseif ($params['image'] == 'none') {
         $typo = $img;
     } else {
         $typo = '<a id="colorBox' . $field->id . '" href="' . self::_availableValue($field, $params['image'], $options) . '" rel="colorBox' . $field->id . '" title="' . $field->image_alt . '">' . $img . '</a>';
     }
     if ($params['image'] != 'none') {
         self::_addScripts(array('id' => $field->id), $params);
     }
     $field->html = $img;
     return $typo;
 }