/** * Caches the emoticons * * @return boolean */ public function saveCache() { $emoticons = $this->emoticonRepository->getAll(); $cEmoticons = count($emoticons); $data = []; for ($i = 0; $i < $cEmoticons; ++$i) { $picInfos = getimagesize($this->appPath->getUploadsDir() . 'emoticons/' . $emoticons[$i]['img']); $code = $emoticons[$i]['code']; $description = $emoticons[$i]['description']; $data[$code] = '<img src="' . $this->appPath->getWebRoot() . 'uploads/emoticons/' . $emoticons[$i]['img'] . '" width="' . $picInfos[0] . '" height="' . $picInfos[1] . '" alt="' . $description . '" title="' . $description . '" />'; } return $this->cache->save(static::CACHE_ID, $data); }
/** * Löscht eine Datei im uploads Ordner * * @param string $file * * @return boolean */ public function removeUploadedFile($file) { $path = $this->appPath->getUploadsDir() . $this->directory . '/' . $file; if (!empty($file) && !preg_match('=/=', $file) && is_file($path) === true) { return unlink($path); } return false; }
/** * @param array $files * @param string $path */ protected function saveMinifiedAsset(array $files, $path) { $options = []; $options['minifiers']['text/css'] = ['Minify_CSSmin', 'minify']; $content = \Minify::combine($files, $options); if (!is_dir($this->appPath->getUploadsDir() . 'assets')) { @mkdir($this->appPath->getUploadsDir() . 'assets', 0755); } // Write the contents of the file to the uploads folder file_put_contents($path, $content, LOCK_EX); }