Skip to content

Commit

Permalink
Производить очистку Assets от CSS и JS файлов через события
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Oct 10, 2013
1 parent ece8cb0 commit 2ce80e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
26 changes: 12 additions & 14 deletions cms/modules/kodicms/classes/kodicms/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ public static function factory( Model_Page_Front $page )
return new self($page);
}

/**
* Remove all assets data
* @return \KodiCMS_Meta
*/
public static function clear()
{
Assets::remove_css();
Assets::remove_js();
Assets::remove_group();
}

/**
*
* @var Model_Page_Front
Expand All @@ -26,27 +37,14 @@ public function __construct( Model_Page_Front $page )
{
$this->_page = $page;

$this->clear()
$this
->group('title', '<title>' . $this->_page->meta_title() . '</title>')
->group('keywords', '<meta name="keywords" content="' . $this->_page->meta_keywords() . '" />')
->group('description', '<meta name="description" content="' . $this->_page->meta_description() . '" />')
->group('content-type', '<meta http-equiv="content-type" content="' . $this->_page->mime() . '; charset=utf-8" />')
->group('robots', '<meta name="robots" content="' . $this->_page->robots . '" />');
}

/**
* Remove all assets data
* @return \KodiCMS_Meta
*/
public function clear()
{
Assets::remove_css();
Assets::remove_js();
Assets::remove_group();

return $this;
}

/**
*
* @param string $title
Expand Down
4 changes: 4 additions & 0 deletions cms/modules/kodicms/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
// Init settings
Observer::observe('modules::afer_load', function() {
Setting::init();
});

Observer::observe('frontpage_requested', function($page) {
Meta::clear();
});

0 comments on commit 2ce80e0

Please sign in to comment.