public function on_page_view() { $html = Loader::helper('html'); $bv = new BlockView(); $bv->setBlockObject($this->getBlockObject()); $this->addFooterItem($html->javascript($bv->getBlockURL() . '/magnific/magnific-combined-1.0.0.min.js', array('minify' => true))); }
public function view() { Loader::model('sortable_fancybox_gallery', 'sortable_fancybox_gallery'); $sg = new SortableFancyboxGallery($this->bID); $files = $sg->getPermittedImages(); $ih = Loader::helper('image'); $images = array(); $max_row_height = 0; foreach ($files as $file) { $image = array(); //$image['src'] = $file->getRelativePath(); // $size = @getimagesize($file->getPath()); // $image['width'] = $size[0]; // $image['height'] = $size[1]; $fv = $file->getRecentVersion(); $image['title'] = htmlspecialchars($fv->getTitle(), ENT_QUOTES, 'UTF-8'); $image['description'] = htmlspecialchars($fv->getDescription(), ENT_QUOTES, 'UTF-8'); $full = $ih->getThumbnail($file, $this->fullWidth, $this->fullHeight); $image['full_src'] = $full->src; $image['full_width'] = $full->width; $image['full_height'] = $full->height; if ($this->enableLightbox) { $thumb = $ih->getThumbnail($file, $this->thumbWidth, $this->thumbHeight, true); $image['thumb_src'] = $thumb->src; $image['thumb_width'] = $thumb->width; $image['thumb_height'] = $thumb->height; $max_row_height = $thumb->height > $max_row_height ? $thumb->height : $max_row_height; } else { $image['thumb_src'] = ''; $image['thumb_width'] = 0; $image['thumb_height'] = 0; $max_row_height = $full->height > $max_row_height ? $full->height : $max_row_height; } $images[] = $image; } $this->set('images', $images); $this->set('max_row_height', $max_row_height); //For "initial block add" css workaround: $html = Loader::helper('html'); $bv = new BlockView(); $bv->setBlockObject($this->getBlockObject()); $css_output_object = $html->css($bv->getBlockURL() . '/view.css'); //Pick up theme overrides $this->set('inline_view_css_url', $css_output_object->file); }
private function computeView() { $bFilename = $this->bFilename; $obj = $this->obj; // if we've passed in "templates/" as the first part, we strip that off. if (strpos($bFilename, 'templates/') === 0) { $bFilename = substr($bFilename, 10); } if ($bFilename) { if (is_file(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) { $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename; $bv = new BlockView(); $bv->setBlockObject($obj); $this->baseURL = $bv->getBlockURL(); $this->basePath = $bv->getBlockPath($this->render); } else if (is_file(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) { $template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename; $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle(); $this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle(); } else if (is_dir(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) { $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render; $this->baseURL = DIR_REL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename; } else if (is_dir(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) { $template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render; $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename; } // we check all installed packages if (!isset($template)) { $pl = PackageList::get(); $packages = $pl->getPackages(); foreach($packages as $pkg) { $d = ''; if (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle())) { $d = DIR_PACKAGES . '/'. $pkg->getPackageHandle(); } else if (is_dir(DIR_PACKAGES_CORE . '/'. $pkg->getPackageHandle())) { $d = DIR_PACKAGES_CORE . '/'. $pkg->getPackageHandle(); } if ($d != '') { $baseStub = (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle())) ? DIR_REL . '/' . DIRNAME_PACKAGES . '/'. $pkg->getPackageHandle() : ASSETS_URL . '/'. DIRNAME_PACKAGES . '/' . $pkg->getPackageHandle(); if (is_file($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $bFilename)) { $template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $bFilename; $this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle(); $this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle(); } else if (is_file($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) { $template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename; $this->baseURL = $baseStub . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle(); $this->basePath = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle(); } else if (is_dir($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) { $template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render; $this->baseURL = $baseStub . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename; } } if ($this->baseURL != '') { continue; } } } } else if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '.php')) { $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '.php'; $bv = new BlockView(); $bv->setBlockObject($obj); $this->baseURL = $bv->getBlockURL(); $this->basePath = $bv->getBlockPath($this->render); } else if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $this->render)) { $template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $this->render; $this->baseURL = DIR_REL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle(); } if (!isset($template)) { $bv = new BlockView(); $bv->setBlockObject($obj); $template = $bv->getBlockPath($this->render) . '/' . $this->render; $this->baseURL = $bv->getBlockURL(); } if ($this->basePath == '') { $this->basePath = dirname($template); } $this->template = $template; }
public function view() { Loader::model('deluxe_image_gallery', 'deluxe_image_gallery'); $sg = new DeluxeImageGallery($this->bID); $files = $sg->getPermittedImages(); $ch = Loader::helper('deluxe_image_gallery', 'deluxe_image_gallery'); $ih = Loader::helper('image'); $images = array(); $max_img_height = 0; foreach ($files as $file) { $image = array(); $image['fID'] = $file['fID']; $image['title'] = htmlentities($file['title'], ENT_QUOTES, APP_CHARSET); if (defined('DELUXE_IMAGE_GALLERY_HTML_CAPTIONS') && (bool) DELUXE_IMAGE_GALLERY_HTML_CAPTIONS) { $image['caption'] = $file['caption']; } else { $image['caption'] = htmlentities($file['caption'], ENT_QUOTES, APP_CHARSET); } if ($this->lightboxTitlePosition == 'inside' || $this->lightboxTitlePosition == 'over') { $image['caption'] = nl2br($image['caption']); //Don't insert linebreaks if title position is 'float'/'outside', // because that style doesn't expand down to fit more than one line. } $f = $file['file']; if ($this->enableCropping) { $thumb = $ch->getThumbnail($f, $this->thumbWidth, $this->thumbHeight); } else { $thumb = $ih->getThumbnail($f, $this->thumbWidth, $this->thumbHeight); } $image['thumb_src'] = $thumb->src; $image['thumb_width'] = $thumb->width; $image['thumb_height'] = $thumb->height; $max_img_height = $thumb->height > $max_img_height ? $thumb->height : $max_img_height; if ($this->enableLightbox && empty($this->fullWidth) && empty($this->fullHeight)) { $image['full_src'] = $f->getRelativePath(); $image['full_width'] = $f->getAttribute('width'); $image['full_height'] = $f->getAttribute('height'); } else { if ($this->enableLightbox) { $maxWidth = empty($this->fullWidth) ? 9999 : $this->fullWidth; $maxHeight = empty($this->fullHeight) ? 9999 : $this->fullHeight; $full = $ih->getThumbnail($f, $maxWidth, $maxHeight); $image['full_src'] = $full->src; $image['full_width'] = $full->width; $image['full_height'] = $full->height; } else { $image['full_src'] = ''; $image['full_width'] = 0; $image['full_height'] = 0; } } $images[] = $image; } $this->set('images', $images); $this->set('max_img_height', $max_img_height); //For "initial block add" css workaround: // (Note that this is only needed if the site is under a sub-directory) $inline_view_css_url = ''; $dir_rel = DIR_REL; //uhh... php is weird -- won't let us put a constant inside the empty() function?! if (!empty($dir_rel)) { $html = Loader::helper('html'); $bv = new BlockView(); $bv->setBlockObject($this->getBlockObject()); $css_output_object = $html->css($bv->getBlockURL() . '/view.css'); //Pick up theme overrides $inline_view_css_url = $css_output_object->file; } $this->set('inline_view_css_url', $inline_view_css_url); }