Esempio n. 1
0
function my_out_component_css($component_options = array('header_component1', 'header_component2', 'header_component3', 'header_component4', 'header_component5', 'footer_component1', 'footer_component2', 'footer_component3', 'footer_component4', 'footer_component5'))
{
    // проходимся по всем заданным опциям
    foreach ($component_options as $option) {
        // и если они определены
        if ($dir = mso_get_option($option, 'templates', false)) {
            $fn = 'components/' . $dir . '/style.css';
            mso_add_file($fn);
            // подключаем внешими стилями
        }
    }
}
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 * 
 * Компиляция less в css

  При влючении этого файла проверьте разрешения на запись файла var_style.css
*/
// укажем less-файл - полный путь
$less_file = getinfo('template_dir') . 'css-less/var_style.less';
// выходной файл - путь относительно каталога шаблона
$css_file = 'css/var_style.css';
// если нет var_style.less, то отдаем var_style.css
if (!file_exists($less_file)) {
    mso_add_file($css_file);
} else {
    echo mso_lessc($less_file, getinfo('template_dir') . $css_file, getinfo('template_url') . $css_file, false, false, true);
}
# end file
Esempio n. 3
0
    function mso_default_head_section($options = array())
    {
        // ob_start(); # задел на будущее - буферизация
        // <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=8"><![endif]-->
        echo '<!DOCTYPE HTML>
<html><head>' . mso_hook('head-start') . '
	<meta charset="UTF-8">
	<title>' . mso_head_meta('title') . '</title>
	<meta name="generator" content="MaxSite CMS">
	<meta name="description" content="' . mso_head_meta('description') . '">
	<meta name="keywords" content="' . mso_head_meta('keywords') . '">
	<link rel="shortcut icon" href="' . getinfo('template_url') . 'images/favicons/' . mso_get_option('default_favicon', 'templates', 'favicon1.png') . '" type="image/x-icon">
	';
        if (mso_get_option('default_canonical', 'templates', 0)) {
            echo mso_link_rel('canonical');
        }
        echo NT . '<!-- RSS -->' . NT . mso_rss();
        if (file_exists(getinfo('template_dir') . 'custom/head-start.php')) {
            require getinfo('template_dir') . 'custom/head-start.php';
        }
        echo NT . '<!-- CSS -->' . NT . '<link rel="stylesheet" href="';
        if (file_exists(getinfo('template_dir') . 'css/css.php')) {
            echo getinfo('template_url') . 'css/css.php';
        } else {
            if (file_exists(getinfo('template_dir') . 'css/my_style.css')) {
                echo getinfo('template_url') . 'css/my_style.css';
            } else {
                if (file_exists(getinfo('template_dir') . 'css/style-all-mini.css')) {
                    echo getinfo('template_url') . 'css/style-all-mini.css';
                } elseif (file_exists(getinfo('template_dir') . 'css/style-all.css')) {
                    echo getinfo('template_url') . 'css/style-all.css';
                } else {
                    echo getinfo('templates_url') . 'default/css/style-all-mini.css';
                }
            }
        }
        echo '">';
        // подключение var_style.css
        // если есть var_style.php, то используем только его
        if (file_exists(getinfo('template_dir') . 'css/var_style.php')) {
            require getinfo('template_dir') . 'css/var_style.php';
        } else {
            $var_file = '';
            if (file_exists(getinfo('template_dir') . 'css/var_style.css')) {
                $var_file = getinfo('template') . '/css/var_style.css';
            } elseif (file_exists(getinfo('templates_dir') . 'default/css/var_style.css')) {
                $var_file = 'default/css/var_style.css';
            }
            // если var_style.css нулевой длины, то не подключаем его
            if (filesize(getinfo('templates_dir') . $var_file)) {
                echo NT . '<link rel="stylesheet" href="' . getinfo('templates_url') . $var_file . '">';
            }
        }
        echo NT . '<link rel="stylesheet" href="' . getinfo('template_url') . 'css/print.css" media="print">';
        out_component_css();
        echo NT . mso_load_jquery();
        echo NT . '<!-- plugins -->' . NR;
        mso_hook('head');
        echo NT . '<!-- /plugins -->' . NR;
        mso_add_file('css/add_style.css');
        default_out_profiles();
        if (file_exists(getinfo('template_dir') . 'custom/head.php')) {
            require getinfo('template_dir') . 'custom/head.php';
        }
        if ($f = mso_page_foreach('head')) {
            require $f;
        }
        if (function_exists('ushka')) {
            echo ushka('head');
        }
        if (file_exists(getinfo('template_dir') . 'js/my.js')) {
            echo '	<script src="' . getinfo('template_url') . 'js/my.js"></script>';
        }
        if ($my_style = mso_get_option('my_style', 'templates', '')) {
            echo NR . '<!-- custom css-my_style -->' . NR . '<style>' . NR . $my_style . '</style>';
        }
        mso_hook('head-end');
        if (function_exists('ushka')) {
            echo ushka('google_analytics_top');
        }
        /*
        # буферизация на будущее
        $head = ob_get_contents();
        ob_end_clean();
        echo $head;
        */
        echo NR . '</head>';
        if (!$_POST) {
            flush();
        }
    }