public function attach()
 {
     if (self::$attached) {
         return;
     }
     parent::attach();
     if ($this->environment !== "development") {
         // Get resources
         $compiler = new DiscussCompiler();
         $resource = $compiler->getResources();
         // Attach resources
         if (!empty($resource)) {
             $scriptTag = $this->createScriptTag($resource["uri"]);
             $document = JFactory::getDocument();
             $document->addCustomTag($scriptTag);
         }
     }
     self::$attached = true;
 }
Beispiel #2
0
 public static function loadHeaders()
 {
     static $headersLoaded = false;
     if (!$headersLoaded) {
         $url = self::getAjaxURL();
         $config = DiscussHelper::getConfig();
         $document = JFactory::getDocument();
         $ajaxData = "/*<![CDATA[*/\n\tvar discuss_site \t= '" . $url . "';\n\tvar spinnerPath\t\t= '" . DISCUSS_SPINNER . "';\n\tvar lang_direction\t= '" . $document->direction . "';\n\tvar discuss_featured_style\t= '" . $config->get('layout_featuredpost_style', 0) . "';\n/*]]>*/";
         $document->addScriptDeclaration($ajaxData);
         // Only legacy and oranje should be using this.
         if ($config->get('layout_site_theme') == 'legacy' || $config->get('layout_site_theme') == 'oranje') {
             $document->addStyleSheet(DISCUSS_MEDIA_URI . '/styles/legacy-common.css');
         }
         // Load MCE editor css if editor is not bbcode
         if ($config->get('layout_editor') != 'bbcode') {
             $document->addStyleSheet(DISCUSS_MEDIA_URI . '/styles/editor-mce.css');
         }
         // Load EasyBlogConfiguration class
         require_once DISCUSS_CLASSES . '/configuration.php';
         // Get configuration instance
         $configuration = EasyDiscussConfiguration::getInstance();
         // Attach configuration to headers
         $configuration->attach();
         $headersLoaded = true;
     }
     return $headersLoaded;
 }