예제 #1
0
파일: IncludeJs.php 프로젝트: acp3/core
 /**
  * @inheritdoc
  */
 public function process(array $params, \Smarty_Internal_Template $smarty)
 {
     if (isset($params['module'], $params['file']) === true && (bool) preg_match('=/=', $params['module']) === false && (bool) preg_match('=\\./=', $params['file']) === false) {
         // Do not include the same file multiple times
         $key = $params['module'] . '/' . $params['file'];
         if (isset($this->alreadyIncluded[$key]) === false) {
             if (!empty($params['depends'])) {
                 $this->assets->enableLibraries(explode(',', $params['depends']));
             }
             $this->alreadyIncluded[$key] = true;
             $script = '<script type="text/javascript" src="%s"></script>';
             $module = ucfirst($params['module']);
             $file = $params['file'];
             $path = $this->fileResolver->getStaticAssetPath($module . '/Resources/', $module . '/', 'Assets/js', $file . '.js');
             if (strpos($path, '/ACP3/Modules/') !== false) {
                 $path = $this->appPath->getWebRoot() . substr($path, strpos($path, '/ACP3/Modules/') + 1);
             } else {
                 $path = $this->appPath->getWebRoot() . substr($path, strlen(ACP3_ROOT_DIR));
             }
             return sprintf($script, $path);
         }
         return '';
     }
     throw new \Exception('Not all necessary arguments for the function ' . __FUNCTION__ . ' were passed!');
 }
예제 #2
0
 /**
  * @param string $group
  * @param string $layout
  *
  * @return string
  */
 protected function generateFilenameHash($group, $layout)
 {
     $filename = $this->config->getSettings(Schema::MODULE_NAME)['design'];
     $filename .= '_' . $layout;
     $filename .= '_' . $this->assets->getEnabledLibrariesAsString();
     $filename .= '_' . $group;
     return md5($filename);
 }
예제 #3
0
파일: JsLibraries.php 프로젝트: acp3/core
 /**
  * @inheritdoc
  */
 public function process(array $params, \Smarty_Internal_Template $smarty)
 {
     $this->assets->enableLibraries(explode(',', $params['enable']));
 }