12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
-
- namespace SCF\Additionals;
-
- class Carousel
- {
-
-
-
- private $picArray = [];
-
-
-
- private $picDirectory;
-
-
-
- public function __construct($directory)
- {
- $this->picDirectory = $directory;
- $this->setPicArray();
- }
-
-
-
- public function setPicArray()
- {
- $this->picArray = $this->scanDirForFiles();
- }
-
-
-
- public function getPicArray()
- {
- return $this->picArray;
- }
-
-
-
- private function scanDirForFiles()
- {
- $tempArray = [];
- $dir = $this->picDirectory;
- if ($handle = opendir($dir)) {
- $shortDir = strstr($dir, 'Styles');
- while (($file = readdir($handle)) !== false) {
- if (!in_array($file, array(".", "..")) && !is_dir($dir . $file)) {
- $tempArray[] = $shortDir . $file;
- }
-
- }
- }
-
- return $tempArray;
-
- }
- }
|