public function makeHTML() { global $p; parent::makeHTML(); if (!in_array('/lib/vfolder/css/vf.css', $p->css)) { $p->css[] = '/lib/vfolder/css/vf.css'; } if (!in_array('/lib/js/jquery.hoverIntent.js', $p->js)) { $p->js[] = '/lib/js/jquery.hoverIntent.js'; } if (!in_array('/lib/vfolder/js/vf.js', $p->js)) { $p->js[] = '/lib/vfolder/js/vf.js'; } }
/** * @global $p \Sky\Page */ public function makeHTML() { global $p; if (!$this->identifier) { $this->identifier = 'vf-gallery-' . self::$count . '-' . md5(rand()); } self::$count++; $this->setMemToken(); parent::makeHTML(); if (!in_array('/lib/vfolder/css/vf.css', $p->css)) { $p->css[] = '/lib/vfolder/css/vf.css'; } if (!in_array('/lib/vfolder/js/vf.js', $p->js)) { $p->js[] = '/lib/vfolder/js/vf.js'; } if ($this->contextMenu) { $p->css[] = '/lib/jquery.contextMenu/jquery.contextMenu.css'; $p->js[] = '/lib/jquery.contextMenu/jquery.contextMenu.js'; } }
?> > <?php if ($empty) { ?> <div class="vf-gallery-empty-message"> <?php echo $gallery->empty_message; ?> </div> <?php } else { # getItem will strip the data we have already if the item is not an image, # we need to preserve non-image items' data $_items = $items; $items = vf::getItem(vf_gallery_inc::itemsToFlatArray($items), array('width' => $gallery->width, 'height' => $gallery->height, 'crop' => $gallery->crop)); global $sky_content_type; foreach ($_items as $index => $_i) { if ($i['media_type'] != 'image') { continue; } # if we have items that are not images, # we need to restore the data to our items array # and generate an appropriate html representation (vfolder server file icons) $type = $_i['media_type'] . '/' . $i_['media_subtype']; $_item_src = sprintf('%s://%s/images/file-icons/%s.jpg', vf::$client->secure ? 'https' : 'http', vf::getFilesDomain(), array_search($type, $sky_content_type) ?: 'file'); $_item_html = sprintf('<img width="%s" heigh="%s" src="%s" />', $gallery->width, $gallery->height, $_item_src); $items->items[$index] = (object) array('_id' => $_i['_id'], 'items_id' => $_i['_id'], 'src' => $_item_src, 'html' => $_item_html); } // makes sure $items is consistent $items = call_user_func(function () use($items) {