/**
  * Возвращает список скриптов и стилей для использования на сайте.
  *
  * @mcms_message ru.molinos.cms.compressor.enumXXX
  */
 public static function on_compressor_enum(Context $ctx, $mode = 'website')
 {
     $result = array();
     $conf = $ctx->config->get('modules/tinymce');
     $conf['gzip'] = false;
     if (empty($conf['gzip'])) {
         $result[] = array('script', 'lib/modules/tinymce/editor/tiny_mce.js');
     } else {
         $result[] = array('script', 'lib/modules/tinymce/editor/tiny_mce_gzip.js');
     }
     $initializer = empty($conf['initializer']) ? '' : $conf['initializer'] . ', ';
     $initializer .= 'document_base_url: "http://' . MCMS_HOST_NAME . $ctx->folder() . '/", ';
     $initializer .= 'tiny_mce_path: "lib/modules/tinymce/editor"';
     $text = 'tinyMCE_initializer = {' . $initializer . '};';
     os::write($path = os::path($ctx->config->getPath('main/tmpdir'), 'tinymce_initializer.js'), $text);
     $result[] = array('script', os::localpath($path));
     $theme = empty($conf['theme']) ? 'simple' : $conf['theme'];
     if (!empty($conf['gzip'])) {
         if (file_exists($path = os::path('lib', 'modules', 'tinymce', 'editor', 'template_' . $theme . '_gzip.js'))) {
             $result[] = array('script', os::webpath($path));
         }
     }
     if (file_exists($path = os::path('lib', 'modules', 'tinymce', 'editor', 'template_' . $theme . '.js'))) {
         $result[] = array('script', os::webpath($path));
     }
     return $result;
 }
Example #2
0
 public function getBase(Context $ctx = null)
 {
     $result = '';
     $result .= $this->scheme ? $this->scheme : 'http';
     $result .= '://';
     if (!empty($this->host)) {
         $result .= $this->host;
     } else {
         $result .= MCMS_HOST_NAME;
     }
     if (null !== $ctx) {
         $result .= $ctx->folder();
     }
     $result .= '/';
     return $result;
 }