public function InstallFiles() { $media = new Media(); $media->addModuleFile('modules/preview/vendor/jquery-1.11.1.min.js'); $media->addModuleFile('modules/preview/xibo-text-render.js'); $media->addModuleFile('modules/preview/xibo-layout-scaler.js'); }
public function InstallFiles() { $media = new Media(); $media->addModuleFile('modules/preview/vendor/jquery-1.11.1.min.js'); $media->addModuleFile('modules/preview/vendor/jquery-cycle-2.1.6.min.js'); $media->addModuleFile('modules/preview/vendor/moment.js'); $media->addModuleFile('modules/preview/vendor/flipclock.min.js'); $media->addModuleFile('modules/preview/xibo-layout-scaler.js'); }
private function InstallFonts() { $media = new Media(); $fontTemplate = ' @font-face { font-family: \'[family]\'; src: url(\'[url]\'); } '; // Save a fonts.css file to the library for use as a module try { $dbh = PDOConnect::init(); $sth = $dbh->prepare('SELECT mediaID, name, storedAs FROM `media` WHERE type = :type AND IsEdited = 0 ORDER BY name'); $sth->execute(array('type' => 'font')); $fonts = $sth->fetchAll(); if (count($fonts) < 1) { return; } $css = ''; $localCss = ''; $ckeditorString = ''; foreach ($fonts as $font) { // Separate out the display name and the referenced name (referenced name cannot contain any odd characters or numbers) $displayName = $font['name']; $familyName = preg_replace('/\\s+/', ' ', preg_replace('/\\d+/u', '', $font['name'])); // Css for the client contains the actual stored as location of the font. $css .= str_replace('[url]', $font['storedAs'], str_replace('[family]', $displayName, $fontTemplate)); // Css for the local CMS contains the full download path to the font $relativeRoot = explode('://', Kit::GetXiboRoot()); $url = '//' . $relativeRoot[1] . '?p=module&mod=font&q=Exec&method=GetResource&download=1&downloadFromLibrary=1&mediaid=' . $font['mediaID']; $localCss .= str_replace('[url]', $url, str_replace('[family]', $familyName, $fontTemplate)); // CKEditor string $ckeditorString .= $displayName . '/' . $familyName . ';'; } file_put_contents('modules/preview/fonts.css', $css); // Install it (doesn't expire, is a system file, force update) $media->addModuleFile('modules/preview/fonts.css', 0, true, true); // Generate a fonts.css file for use locally (in the CMS) file_put_contents('modules/preview/fonts.css', $localCss); // Edit the CKEditor file $ckeditor = file_get_contents('theme/default/libraries/ckeditor/config.js'); $replace = "/*REPLACE*/ config.font_names = '" . $ckeditorString . "' + config.font_names; /*ENDREPLACE*/"; $ckeditor = preg_replace('/\\/\\*REPLACE\\*\\/.*?\\/\\*ENDREPLACE\\*\\//', $replace, $ckeditor); file_put_contents('theme/default/libraries/ckeditor/config.js', $ckeditor); } catch (Exception $e) { Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__); if (!$this->IsError()) { $this->SetError(1, __('Unknown Error')); } return false; } }
public function InstallFiles() { $media = new Media(); $media->addModuleFile('modules/preview/vendor/jquery-1.11.1.min.js'); $media->addModuleFile('modules/preview/xibo-layout-scaler.js'); $media->addModuleFileFromFolder($this->resourceFolder); }