Skip to content

Commit b6343a0

Browse files
Minor correction in MInification for RSS Feed
1 parent a178fff commit b6343a0

File tree

3 files changed

+28
-31
lines changed

3 files changed

+28
-31
lines changed

astroid/astroid-framework/framework/library/astroid/Component/LazyLoad.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@ public static function run()
2121
Framework::getDebugger()->log('Lazy Load');
2222
$app = \JFactory::getApplication();
2323
$template = Framework::getTemplate();
24+
$document = Framework::getDocument();
2425
$params = $template->getParams();
2526
$run = $params->get('lazyload', 0);
26-
// Stop Lazy Load for RSSFeeds
27-
$doc = \JFactory::getDocument();
28-
if($doc->getType() == 'feed') {
29-
$run = false;
30-
}
31-
Helper::createDir(ASTROID_CACHE . '/lazy-load/' . $template->id);
32-
if (!$run) {
33-
return;
34-
}
3527

36-
Framework::getDocument()->addScript('vendor/astroid/js/lazyload.min.js');
28+
// Stop Lazy Load for RSSFeeds
29+
if ($document->getType() == 'feed') $run = false;
30+
31+
// Stop Lazy Load
32+
if (!$run) return;
33+
34+
Helper::createDir(ASTROID_CACHE . '/lazy-load/' . $template->id);
35+
$document->addScript('vendor/astroid/js/lazyload.min.js');
3736

3837
if ($params->get('lazyload_components', '')) {
3938
$run = self::selectedComponents($params->get('lazyload_components', ''), $params->get('lazyload_components_action', 'include'));
@@ -96,7 +95,7 @@ public static function run()
9695
}
9796

9897
if (Framework::getDebugger()->debug) {
99-
Framework::getReporter('Lazy Load Images')->add('<a href="' . $matches[1][$key] . '" target="_blank"><code>' . Framework::getDocument()->beutifyURL($matches[1][$key]) . '</code></a>');
98+
Framework::getReporter('Lazy Load Images')->add('<a href="' . $matches[1][$key] . '" target="_blank"><code>' . $document->beutifyURL($matches[1][$key]) . '</code></a>');
10099
}
101100

102101
if (!isset($imageMap[md5($matches[1][$key])])) {

astroid/astroid-framework/framework/library/astroid/Component/Utility.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ public static function custom()
339339
// Page level custom code
340340
$app = \JFactory::getApplication();
341341
$itemid = $app->input->get('Itemid', '', 'INT');
342-
if(empty($itemid)) {
343-
return false;
344-
}
342+
if (empty($itemid)) return false;
343+
345344
$menu = $app->getMenu();
346345
$item = $menu->getItem($itemid);
347346
$params = $item->getParams();

astroid/astroid-framework/framework/library/astroid/Document.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Document
3030
protected $minify_html = false;
3131
protected static $_fontawesome = false;
3232
protected static $_layout_paths = [];
33+
protected $type = null;
3334

3435
public function __construct()
3536
{
@@ -38,11 +39,18 @@ public function __construct()
3839
$this->minify_js = $params->get('minify_js', false);
3940
$this->minify_html = $params->get('minify_html', false);
4041

42+
$doc = \JFactory::getDocument();
43+
$this->type = $doc->getType();
4144

4245
$template = Framework::getTemplate();
4346
$this->addLayoutPath(JPATH_SITE . '/templates/' . $template->template . '/html/frontend/');
4447
}
4548

49+
public function getType()
50+
{
51+
return $this->type;
52+
}
53+
4654
public function addLayoutPath($path)
4755
{
4856
self::$_layout_paths[] = $path;
@@ -103,25 +111,16 @@ public function compress()
103111
{
104112
$app = \JFactory::getApplication();
105113
$body = $app->getBody();
106-
107-
// Stop Minification for RSSFeeds and other doc types.
108-
$doc = \JFactory::getDocument();
109-
if($doc->getType() == 'feed') {
110-
$this->minify_css = false;
111-
$this->minify_js = false;
112-
$this->minify_html = false;
113-
}
114-
if ($this->minify_css) {
115-
$body = $this->minifyCSS($body);
116-
}
117114

118-
if ($this->minify_js && !$this->isFrontendEditing()) {
119-
$body = $this->minifyJS($body);
120-
}
115+
// Stop Minification for RSSFeeds and other doc types.
116+
if ($this->type == 'feed') $this->minify_css = $this->minify_js = $this->minify_html = false;
121117

122-
if ($this->minify_html) {
123-
$body = $this->minifyHTML($body);
124-
}
118+
if ($this->minify_css) $body = $this->minifyCSS($body);
119+
120+
if ($this->minify_js && !$this->isFrontendEditing()) $body = $this->minifyJS($body);
121+
122+
if ($this->minify_html) $body = $this->minifyHTML($body);
123+
125124
$app->setBody($body);
126125
}
127126

0 commit comments

Comments
 (0)