private function import($path) { $ScanDir = new ScanDir($path); self::addClasses($ScanDir->getFiles(), $path); foreach ($ScanDir->getDirectories() as $dir) { self::import($path . $dir . "/"); } }
public function __construct($model, $config) { parent::__construct($config); $files = ScanDir::getFilesOfType($this->config['path'], $model::MIME, !isset($config['reverse']) || $config['reverse']); $this->count = count($files); $this->limit = isset($config['limit']) ? $config['limit'] : $this->count; $static = isset($config['static']) ? $config['static'] : true; foreach ($files as $f) { $this->models[] = new $model(array('name' => $f, 'path' => $config['path'] . $f, 'type' => $config['type'], 'static' => $static)); } }
/** * This function loads all images contained in the folder stored in $this->path, * generate the bootstrap modal carousel and returns it. * * @param int $index * @return string generated carousel */ public function parse($index) { $files = ScanDir::getFilesOfType($this->config['path'], self::MIME, $index); try { Head::getInstance()->link('lib/owl-carousel/css/owl.carousel.css'); Head::getInstance()->link('lib/owl-carousel/css/owl.theme.css'); Script::getInstance()->link('lib/owl-carousel/js/owl.carousel.js'); Head::getInstance()->link('lib/owl-carousel/css/lazy_load.css'); Script::getInstance()->link('lib/owl-carousel/js/lazy_load.js'); $items = ''; foreach ($files as $f) { $items .= '<div class="item"><img class="lazyOwl" data-src="' . Config::getInstance()->app_root . $this->config['path'] . $f . '" /></div>'; } return '<div id="carousel" class="owl-carousel owl-theme">' . $items . '</div>'; } catch (Exception $e) { Logger::getInstance()->add(new Error('An unexpected error has occurred.', 'OwlCarousel::parse("' . $this->config['path'] . '")', $e->getMessage())); return ''; } }
/** * This function loads all images contained in the folder stored in $this->path, * generate the bootstrap modal carousel and returns it. * * @param int $index * @return string generated carousel */ public function parse($index) { $files = ScanDir::getFilesOfType($this->config['path'], self::MIME, $index); try { Head::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.css'); Head::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/default-skin/default-skin.css'); Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.min.js'); Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/photoswipe-ui-default.min.js'); Script::getInstance()->link(PUBLIC_LIB_DIR . 'photoswipe/init.js'); $html = file_get_contents(PUBLIC_LIB_DIR . 'photoswipe/photoswipe.html'); $items = ''; foreach ($files as $f) { list($width, $height) = getimagesize($this->config['path'] . $f); $src = 'data-src="' . Config::getInstance()->app_root . $this->config['path'] . $f . '"'; $width = 'data-width="' . $width . '"'; $height = 'data-height="' . $height . '"'; $items .= '<span ' . $src . $width . $height . '" class="img-swipe">'; } return '<div class="hidden">' . $items . '</div>' . $html; } catch (Exception $e) { Logger::getInstance()->add(new Error('An unexpected error has occurred.', 'PhotoSwipe::parse("' . $this->config['path'] . '")', $e->getMessage())); return ''; } }
/** * @param string $dir * @return array */ public function getUnsentMessageFiles($dir) { $files = ScanDir::scan($dir, "message"); return $files; }