function MARKER($marker)
{
    return Marker::decode($marker);
}
 /**
  * Render page template with all variables
  *
  * @return string
  */
 public static function page($slug = null, $inject = array())
 {
     // CHECK $slug IS NOT NULL
     $SLUG_FULL = is_null($slug) ? SLUG_FULL : $slug;
     // Page with lang = SITE_LANG and is_homepage = 1
     if ($SLUG_FULL === '/') {
         // HOMEPAGE
         $page = CmsPage::with(array('elements' => function ($query) {
             $query->where_is_valid(1);
         }))->where_lang(SITE_LANG)->where_is_valid(VALID())->first();
         if (empty($page)) {
             return Response::error('404');
         }
         // More pages with lang = SITE_LANG and slug = SLUG_FULL
     } else {
         // MORE PAGES
         // Check slug is not lang
         if (array_key_exists(str_replace('/', '', $SLUG_FULL), Config::get('cms::settings.langs'))) {
             //Redirect al cambio lingua
             return Redirect::to_action('site@lang', array(str_replace('/', '', $SLUG_FULL)));
         }
         // Get page
         $page = self::page_base($SLUG_FULL);
         // Check page exists
         if (empty($page)) {
             // If not exists, look at SLUG_FIRST and save SLUG_LAST
             $page = self::page_base(SLUG_FIRST);
             // Check page exists
             // Not exists
             if (empty($page)) {
                 return Response::error('404');
                 // It exists and it is a ZOOM of EXTRA
             } else {
                 // Get Model to load
                 switch (getExtra($page->extra_id)) {
                     case 'blogs':
                         $model = CmsBlog::with(array('blogrels'));
                         break;
                         //case 'products':
                         //	$model = 'CmsProduct';
                         //	break;
                 }
                 // Load ZOOM if $extra exists
                 if (isset($model)) {
                     $extra = $model->where_lang(SITE_LANG)->where_slug(SLUG_LAST)->where_is_valid(VALID())->first();
                 }
             }
         }
     }
     //Bind $elements / $extra to ZONE
     if (!empty($page)) {
         // Check if SITE_ROLE < access_level -> to_login
         if (SITE_ROLE < $page->access_level) {
             return Redirect::to_action('site@login')->with('back_url', $SLUG_FULL);
         }
         // Set page_layout from DB or default if not set
         $page_layout = $page->layout;
         if (empty($page->layout)) {
             $page_layout = 'default';
         }
         //INJECT PAGE LAYOUT
         if (!empty($inject)) {
             $page_layout = !empty($inject['layout']) ? $inject['layout'] : $page_layout;
         }
         // Get layouts from config.design
         $arr_layout = Config::get('cms::theme.layout_' . $page_layout);
         // Load template
         $layout = View::make('cms::theme.' . THEME . '.layouts.' . $page_layout);
         // Bind page name
         $layout['NAME'] = $page->name;
         $layout['CLASSNAME'] = Str::slug($page->name);
         // Check layout exists
         if (!empty($arr_layout)) {
             // Bind zones as empty to avoid errors
             foreach ($arr_layout as $key => $value) {
                 $layout[strtoupper($key)] = '';
             }
         }
         // Bind contents to layout variables
         if (!empty($page)) {
             // Bind elements to $ZONE in page layout
             if (!empty($page->elements)) {
                 // Create zone array
                 $zone = array();
                 foreach ($page->elements as $item) {
                     $tmp_text = '<div id="' . $item->name . '" class="' . Config::get('cms::theme.ele_class') . '">';
                     $tmp_text .= Marker::decode($item->text);
                     $tmp_text .= '</div>';
                     $zone[$item->zone][] = $tmp_text;
                 }
                 // INJECT EXTERNAL ELEMENT INTO ZONE
                 if (!empty($inject)) {
                     // Clean content
                     // unset($zone);
                     // Append results
                     $zone[$inject['zone']][0] = $inject['view'];
                 }
                 // Bind pageitem text to ZONE which become layout variable
                 foreach ($page->elements as $item) {
                     $layout[strtoupper($item->zone)] = trim(implode("\n", $zone[$item->zone]));
                 }
             } else {
                 $new_page = CmsPage::where_lang(SITE_LANG)->where_parent_id($page->id)->where_is_valid(1)->order_by('order_id', 'asc')->first();
                 if (!empty($new_page)) {
                     return Redirect::to($new_page->slug);
                 }
             }
             // Bind $extra to layout ZONE if present
             if (!empty($extra)) {
                 //EXTRA VIEW ZOOM
                 $extra_what = CONF('cms::settings.extra_id', $page->extra_id);
                 $tmp_text = View::make('cms::theme.' . THEME . '.partials.details.' . $extra_what);
                 $tmp_text['text'] = $extra;
                 // Bind extra name
                 $layout['NAME'] = $extra->name;
                 $layout['CLASSNAME'] = Str::slug($page->name);
                 // Bind pageitem text to ZONE which become layout variable
                 $layout[strtoupper($extra->zone)] = trim(implode("\n", array($tmp_text)));
             }
         }
     } else {
         // Page not found, empty layout
         $layout = '';
     }
     //Set default title
     $title = !empty($page->title) ? $page->title : $page->name;
     //Set $extra title
     $title = isset($extra) ? $extra->name : $title;
     $title = !empty($extra->title) ? $extra->title : $title;
     $title = CmsUtility::string_style($title, Config::get('cms::theme.title_style'));
     // Add preview string to title
     if (SLUG_PREVIEW) {
         $title = LL('cms::title.preview_title', CMSLANG) . $title;
     }
     //Set default keyw
     $keyw = !empty($page->keyw) ? $page->keyw : Config::get('cms::theme.keyw');
     //Set $extra keyw
     $keyw = isset($extra) ? $extra->keyw : $keyw;
     $keyw = !empty($extra->keyw) ? $extra->keyw : $keyw;
     //Set default descr
     $descr = !empty($page->descr) ? $page->descr : Config::get('cms::theme.descr');
     //Set $extra descr
     $descr = isset($extra) ? $extra->descr : $descr;
     $descr = !empty($extra->descr) ? $extra->descr : $descr;
     //Set default template, header, footer, layout se non settati
     $template = !empty($page->template) ? $page->template : 'default';
     $header = !empty($page->header) ? $page->header : 'default';
     $footer = !empty($page->footer) ? $page->footer : 'default';
     // INJECT PAGE PARTIALS
     if (!empty($inject)) {
         $template = !empty($inject['template']) ? $inject['template'] : $template;
         $header = !empty($inject['header']) ? $inject['header'] : $header;
         $footer = !empty($inject['footer']) ? $inject['footer'] : $footer;
     }
     //APPLICATION COMPOSER
     View::composer('cms::theme.' . THEME . '.templates.' . $template, function ($view) {
         CmsRender::asset();
         //BASE JS
         Asset::container('header')->add('base_js', Config::get('application.url') . '/site/js');
         if (!isset($view->title)) {
             $view->title = Config::get('cms::theme.title');
         }
         if (!isset($view->descr)) {
             $view->descr = Config::get('cms::theme.descr');
         }
         if (!isset($view->keyw)) {
             $view->keyw = Config::get('cms::theme.keyw');
         }
         if (!isset($view->header)) {
             $view->header = '';
         }
         if (!isset($view->layout)) {
             $view->layout = '';
         }
         if (!isset($view->footer)) {
             $view->footer = '';
         }
     });
     //Prepare html buffer
     $html = View::make('cms::theme.' . THEME . '.templates.' . $template)->with('title', $title)->with('keyw', $keyw)->with('descr', $descr)->nest('header', 'cms::theme.' . THEME . '.partials.header_' . $header)->with('layout', $layout)->nest('footer', 'cms::theme.' . THEME . '.partials.footer_' . $footer);
     //Output buffer
     self::clean_code($html);
 }