当前位置: 首页>>代码示例>>PHP>>正文


PHP Media::addModuleFile方法代码示例

本文整理汇总了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');
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:7,代码来源:finance.module.php

示例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');
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:9,代码来源:clock.module.php

示例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;
        }
    }
开发者ID:ajiwo,项目名称:xibo-cms,代码行数:52,代码来源:font.module.php

示例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);
 }
开发者ID:taphier,项目名称:xibo-cms,代码行数:7,代码来源:forecastio.module.php


注:本文中的Media::addModuleFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。