Example #1
0
 public static function compileJS()
 {
     $compile = JRequest::getVar('compile');
     $minify = JRequest::getVar('minify');
     if ($compile) {
         require_once DISCUSS_CLASSES . '/compiler.php';
         $minify = $minify ? true : false;
         $compiler = new DiscussCompiler();
         $result = $compiler->compile($minify);
         var_dump($result);
         exit;
     }
 }
Example #2
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #3
0
 public function clearCache()
 {
     $paths = array(DISCUSS_ADMIN_THEMES, DISCUSS_SITE_THEMES, DISCUSS_JOOMLA_MODULES);
     $count = 0;
     foreach ($paths as $path) {
         $cachedFiles = JFolder::files($path, 'style.less.cache', true, true);
         foreach ($cachedFiles as $file) {
             $count++;
             JFile::delete($file);
         }
     }
     // Also purge the /resources and /config files
     require_once DISCUSS_CLASSES . '/compiler.php';
     $compiler = new DiscussCompiler();
     $compiler->purgeResources();
     $message = JText::sprintf('COM_EASYDISCUSS_CACHE_DELETED', $count);
     DiscussHelper::setMessageQueue($message, DISCUSS_QUEUE_SUCCESS);
     $this->setRedirect('index.php?option=com_easydiscuss');
 }
 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;
 }