Пример #1
0
 protected function render($param = null)
 {
     $encoding = $this->htdoc->get('encoding');
     $title = htmlspecialchars($this->htdoc->get('title'));
     $this->meta_content_type->attr = array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=' . $encoding);
     $this->title_elm->members = array($title);
     return parent::render($param);
 }
Пример #2
0
 protected function render($param = null)
 {
     $pkg = self::get_pkg();
     $size = $this->size;
     if (isset($param[0])) {
         $size = $param[0];
     }
     if (preg_match('/\\.swf$/i', $this->attr['src'])) {
         return $this->render_flash($pkg, $size);
     }
     if (isset($pkg->config['thumb_sizes'][$size])) {
         $attr_save = $this->attr;
         $sz = $pkg->config['thumb_sizes'][$size];
         unset($this->attr['width']);
         unset($this->attr['height']);
         if (isset($sz['w'])) {
             $this->attr['width'] = $sz['w'];
         }
         if (isset($sz['h'])) {
             $this->attr['height'] = $sz['h'];
         }
         if ($this->set_thumb_size && isset($this->width) && isset($this->height)) {
             if (!isset($this->attr['width']) && isset($sz['h'])) {
                 $thumb_w = floor($this->width * ($sz['h'] / $this->height));
                 $this->attr['width'] = $thumb_w;
             }
             if (!isset($this->attr['height']) && isset($sz['w'])) {
                 $thumb_h = floor($this->height * ($sz['w'] / $this->width));
                 $this->attr['height'] = $thumb_h;
             }
         }
         $phpthumb = $pkg->config['phpthumb_url'];
         // display thumbnails using phpThumb if availiable
         if ((function_exists('phpThumbURL') || !empty($phpthumb)) && !preg_match('/\\.gif$/i', $this->attr['src'])) {
             $pt_param = '';
             foreach ($sz as $k => $v) {
                 $pt_param .= "&{$k}={$v}";
             }
             if (function_exists('phpThumbURL')) {
                 $this->attr['src'] = phpThumbURL('src=' . urlencode($this->attr['src']) . $pt_param);
             } else {
                 $this->attr['src'] = $phpthumb . '?src=' . urlencode($this->attr['src']) . $pt_param;
             }
         }
         $res = parent::render();
         $this->attr = $attr_save;
         return $res;
     }
     return parent::render();
 }