<?php /*------------------------------------------------------------------------ # mod_imgscrawler - Images Crawler # ------------------------------------------------------------------------ # author Joomla!Vargas # copyright Copyright (C) 2010 joomlahill.com. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: http://www.joomlahill.com # Technical Support: Forum - http://www.joomlahill.com/forum -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die; global $imgscrawler_id; if (!$imgscrawler_id) { $imgscrawler_id = 1; } // Include the syndicate functions only once //require_once __DIR__ . '/helper.php'; require_once dirname(__FILE__) . '/helper.php'; $folder = modImgsCrawlerHelper::getFolder($params); $images = modImgsCrawlerHelper::getImages($params, $folder); if (!count($images)) { echo JText::_('No images '); return; } require JModuleHelper::getLayoutPath('mod_imgscrawler', $params->get('layout', 'default')); $imgscrawler_id++;
public static function getFiles($folder, $substoo, $random) { $dir = JPATH_BASE . DIRECTORY_SEPARATOR . $folder; $files = array(); $subfiles = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..' && $file != 'CVS' && $file != 'index.html') { if (!is_dir($dir . DIRECTORY_SEPARATOR . $file)) { $files[] = $folder . DIRECTORY_SEPARATOR . $file; } elseif ($substoo != 0) { $newfolder = $folder . DIRECTORY_SEPARATOR . $file; $subfiles[] = modImgsCrawlerHelper::getFiles($newfolder, $substoo, $random); } } } } closedir($handle); sort($files); foreach ($subfiles as $subfile) { $files = array_merge($files, $subfile); } return $files; }