/** * Registers CSS/JS to manager interface */ public function registerCssJs() { $versionPostFix = $this->_prepareVersionPostfix(); /* if true, use compressed JS */ if ($this->modx->getOption('compress_js', null, false)) { foreach ($this->modx->sjscripts as &$scr) { $pos = strpos($scr, '.js'); if ($pos) { $newUrl = substr($scr, 0, $pos) . '-min' . substr($scr, $pos, strlen($scr)); } else { continue; } $pos = strpos($newUrl, 'modext/'); if ($pos) { $pos = $pos + 7; $newUrl = substr($newUrl, 0, $pos) . 'build/' . substr($newUrl, $pos, strlen($newUrl)); } $path = str_replace(array($this->modx->getOption('manager_url') . 'assets/modext/', '<script type="text/javascript" src="', '"></script>'), '', $newUrl); if (file_exists($this->modx->getOption('manager_path') . 'assets/modext/' . $path)) { $scr = $newUrl; } /* append version string */ $scr = $this->_postfixVersionToScript($scr, $versionPostFix); } } else { foreach ($this->modx->sjscripts as &$scr) { $scr = $this->_postfixVersionToScript($scr, $versionPostFix); } } /* assign css/js to header */ $this->setPlaceholder('cssjs', $this->modx->sjscripts); if (!empty($this->head['js']) || !empty($this->head['lastjs']) || !empty($this->head['css']) || !empty($this->head['html'])) { // Some plugin probably registered additional assets (ie. OnBeforeManagerPageInit), let's load them parent::registerCssJs(); } }