本文整理汇总了PHP中Media::addModuleFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::addModuleFile方法的具体用法?PHP Media::addModuleFile怎么用?PHP Media::addModuleFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::addModuleFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallFiles
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');
}
示例2: InstallFiles
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');
}
示例3: InstallFonts
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;
}
}
示例4: InstallFiles
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);
}