/** * VIDEO Marker - Shows video embed from Youtube, Screenr, Vimeo or local hosted * * [$VIDEO[{ * "code":"<video code>", => (video code) * "site":"local", => (available: youtube || screenr || vimeo || local) * "w":"420", => (video width) * "h":"315", => (video height) * "skin":"<skin>", => OPTIONAL (flowplayer skin override) * "class":"<class>", => OPTIONAL (default: video) * }]] * * @param array * @return string */ public static function VIDEO($vars = array()) { //Get variables from array $vars if (!empty($vars)) { extract($vars); } //Bind variables $_code = ''; if (isset($code) and !empty($code)) { $_code = $code; } // NAME IS CODE ALIAS if (isset($name) and !empty($name)) { $_code = $name; } $_site = 'local'; if (isset($site) and !empty($site)) { $_site = $site; } $_w = ''; if (isset($w) and !empty($w)) { $_w = $w; } $_h = ''; if (isset($h) and !empty($h)) { $_h = $h; } $_skin = ''; if (isset($skin) and !empty($skin)) { $_skin = $skin; } $_class = 'video'; if (isset($class) and !empty($class)) { $_class = $class; } if (!empty($_code)) { $_media_url = ''; // LOAD FLOWPLAYER if ($_site === 'local') { $_skin_player = !empty($_skin) ? $_skin : CONF('cms::settings.flowplayer', 'skin'); Asset::container('header')->add('flowplayercss', 'bundles/cms/flowplayer/' . $_skin_player . '.css', 'site_css'); Asset::container('footer')->add('flowplayer', 'bundles/cms/js/flowplayer.min.js', 'jquery_lib'); $_site = 'video'; $_type = File::extension($_code); $_class = CONF('cms::settings.flowplayer', 'options') . ' ' . $_class; $_media_url = MEDIA_URL($_code); } else { // SET DEFAULT VIDEO SIZE if ($_w == '') { $_w = 420; } if ($_h == '') { $_h = 315; } } $options = array('class' => $_class); $view = View::make('cms::theme.' . THEME . '.partials.markers.' . $_site); $view['url'] = $_media_url; $view['code'] = $_code; $view['w'] = $_w; $view['h'] = $_h; $view['options'] = HTML::attributes($options); return $view; } }
/** * 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); }
function getExtra($key = 0) { return CONF('cms::settings.extra_id', $key); }
?> <?if($resource_load['page_js']){?> <?php echo HTML::getJs(); ?> <?}?> <?php echo isset($after_body) ? $after_body : ''; echo HTML::getPageUnitData(); echo HTML::getScript('normal'); echo HTML::getScript('optional'); ?> <script> UserAccount.init({ open_third_login:<?php echo (int) CONF('open_third_login', 'cms_control'); ?> , isNative:<?php echo (int) _j($wreq["_client_version"]); ?> }) </script> <?if($open_perf_script){?> <script> void function(e,t,n,a,r,o){function c(t){e.attachEvent?e.attachEvent("onload",t,!1):e.addEventListener&&e.addEventListener("load",t)}function i(e,n,a){a=a||15;var r=new Date;r.setTime((new Date).getTime()+1e3*a),t.cookie=e+"="+escape(n)+";path=/;expires="+r.toGMTString()}function s(e){var n=t.cookie.match(new RegExp("(^| )"+e+"=([^;]*)(;|$)"));return null!=n?unescape(n[2]):null}function d(){var e=s("PMS_JT");if(e){i("PMS_JT","",-1);try{e=eval(e)}catch(n){e={}}e.r&&t.referrer.replace(/#.*/,"")!=e.r||alog("speed.set","wt",e.s)}}c(function(){alog("speed.set","lt",+new Date),r=t.createElement(n),r.async=!0,r.src=a+"?v="+~(new Date/864e5),o=t.getElementsByTagName(n)[0],o.parentNode.insertBefore(r,o)}),d()}(window,document,"script","http://img.baidu.com/hunter/alog/dp.mobile.min.js"); </script> <?}?> <?