Exemple #1
0
function mkj_sc_head($args = array())
{
    if (!is_type('page')) {
        return $args;
    }
    // Настройки плагина.
    $options = mso_get_option('plugin_mkj_sc', 'plugins', array());
    if (!isset($options['type']) or !$options['type']) {
        $options['type'] = false;
    }
    if (!isset($options['css']) or !$options['css']) {
        $options['css'] = '';
    }
    // Если произвольные таблицы стилей пусты, грузим стандартный стиль.
    if (!$options['css']) {
        echo '<link rel="stylesheet" href="' . getinfo('plugins_url') . 'mkj_sc/mkj_sc.css">', NR;
    }
    if (!$options['type'] or $options['css']) {
        echo '<style>', NR;
        if (!$options['type']) {
            echo 'input.comments_submit { display: none; }', NR;
        }
        if ($options['css']) {
            echo $options['css'], NR;
        }
        echo '</style>', NR;
    }
    return $args;
}
Exemple #2
0
function template_options_autoload($args = array())
{
    mso_create_allow('template_options_admin', t('Доступ к настройкам шаблона'));
    if (is_type('admin')) {
        mso_hook_add('admin_init', 'template_options_admin_init');
    }
    # хук на админку
}
Exemple #3
0
function rater_autoload($args = array())
{
    if (is_type('page')) {
        mso_hook_add('head', 'rater_head');
        mso_hook_add('content_end', 'rater_content_end');
    }
    mso_register_widget('rater_widget', t('Рейтинг страниц'));
    # регистрируем виджет
}
Exemple #4
0
function addzakl_autoload($args = array())
{
    if (is_type('page')) {
        $options = mso_get_option('plugin_addzakl', 'plugins', array());
        if (!isset($options['priory'])) {
            $options['priory'] = 10;
        }
        mso_hook_add('content_end', 'addzakl_content_end', $options['priory']);
    }
}
Exemple #5
0
function samborsky_ping_autoload($args = array())
{
    // Ставим хук на публикацию. При mso_new_page и mso_edit_page
    mso_hook_add('new_page_publish', 'samborsky_ping_do');
    mso_hook_add('edit_page_publish', 'samborsky_ping_do');
    if (is_type('admin')) {
        // хук на админку
        mso_hook_add('admin_init', 'samborsky_ping_init');
    }
}
Exemple #6
0
function samborsky_polls_autoload($args = array())
{
    if (is_type('admin')) {
        // хук на админку
        mso_hook_add('admin_init', 'samborsky_polls_init');
    }
    // Ядро
    require getinfo('plugins_dir') . 'samborsky_polls/sp_kernel.php';
    // Хук в <head></head>
    mso_hook_add('head', 'samborsky_polls_head');
    mso_hook_add('custom_page_404', 'samborsky_polls_archive_404');
    # По какому адресу будем показывать архив
    mso_register_widget('samborsky_polls_widget', t('Голосования'));
    # регистрируем виджет
}
Exemple #7
0
 /**
  * @param string|callable $type
  * @param callable|null $var
  * @return callable
  * @throws Exception
  */
 function is_type_dg($type, $var = null)
 {
     if (is_string($type)) {
         $type = return_dg($type);
     } else {
         debug_enforce(is_type($type, 'callable'), "Invalid type identifier " . var_dump_human_compact($type));
     }
     if (null === $var) {
         $var = tuple_get();
     } else {
         debug_enforce(is_type($var, 'callable'), "is_type_dg expects callable returning actual variable, given: " . var_dump_human_compact($var));
     }
     return function () use($type, $var) {
         $args = func_get_args();
         return is_type(call_user_func_array($type, $args), call_user_func_array($var, $args));
     };
 }
Exemple #8
0
    $add_body_class = 'ie6';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0')) {
    $add_body_class = 'ie7';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 8.0')) {
    $add_body_class = 'ie8';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 9.0')) {
    $add_body_class = 'ie9';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE 10.0')) {
    $add_body_class = 'ie10';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Trident/7')) {
    $add_body_class = 'ie11';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Edge/12')) {
    $add_body_class = 'edge';
}
$add_body_class .= ' is-type-' . getinfo('type');
if (is_type('home')) {
    mso_set_val('body_class', 'body-home ' . $add_body_class);
} else {
    mso_set_val('body_class', 'body-' . getinfo('type') . ' ' . $add_body_class);
}
// возвращает путь к странице через связи дочерние-родительские страницы
function parents_out_way_to($page_id = 0)
{
    $cache_key = 'parents_out_way_to' . $page_id;
    $k = mso_get_cache($cache_key);
    if ($k) {
        return $k;
    }
    // да есть в кэше
    $r = '';
    $CI =& get_instance();
Exemple #9
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
$p->format('edit', '<i class="i-edit t-gray600 hover-t-black" title="Edit page"></i>', '<div class="b-right mar10-t">', '</div>');
$p->format('title', '<h1 class="t-gray700 bor-double-b bor3px bor-gray300 pad5-b">', '</h1>', !is_type('page'));
$p->format('date', 'j F Y г.', '<time datetime="[page_date_publish_iso]" class="i-calendar">', '</time>');
$p->format('view_count', '<span class="i-eye mar15-l">' . tf('Просмотров') . ': ', '</span>');
$p->format('comments_count', '<span class="i-comment mar15-l">' . tf('Комментарии') . ': ', '</span>');
$p->format('cat', '<i class="i-bookmark-o mar10-l"></i>', '<br><span class="i-bookmark" title="' . tf('Рубрика записи') . '">', '</span>');
$p->format('tag', '<i class="i-tag mar10-l"></i>', '<br><span class="i-tags links-no-color" title="' . tf('Метка записи') . '">', '</span>');
$p->html(NR . '<header class="mar20-b">');
$p->line('[edit][title]');
$p->div_start('info info-top t-gray600 t90');
$p->line('[date][view_count][comments_count][cat][tag]');
$p->div_end('info info-top');
$p->html('</header>');
# end of file
Exemple #10
0
function calendar_widget_custom($arg = array(), $num = 1)
{
    # массив названий месяцев
    if (!isset($arg['months'])) {
        $arg['months'] = array(t('Январь'), t('Февраль'), t('Март'), t('Апрель'), t('Май'), t('Июнь'), t('Июль'), t('Август'), t('Сентябрь'), t('Октябрь'), t('Ноябрь'), t('Декабрь'));
    }
    # массив названий дней недели
    if (!isset($arg['days'])) {
        $arg['days'] = array(t('Пн'), t('Вт'), t('Ср'), t('Чт'), t('Пт'), t('Сб'), t('Вс'));
    }
    # оформление виджета
    if (!isset($arg['header'])) {
        $arg['header'] = '<h2 class="box"><span>' . t('Календарь') . '</span></h2>';
    }
    if (!isset($arg['block_start'])) {
        $arg['block_start'] = '<div class="calendar">';
    }
    if (!isset($arg['block_end'])) {
        $arg['block_end'] = '</div>';
    }
    if (!isset($arg['elem_previous'])) {
        $arg['elem_previous'] = '««';
    }
    if (!isset($arg['elem_next'])) {
        $arg['elem_next'] = '»»';
    }
    $prefs = array('start_day' => 'monday', 'month_type' => 'long', 'day_type' => 'long', 'show_next_prev' => TRUE, 'local_time' => time(), 'next_prev_url' => getinfo('site_url') . 'archive/');
    $prefs['template'] = '
	   {table_open}<table border="0" cellpadding="0" cellspacing="0">{/table_open}

	   {heading_row_start}<tr>{/heading_row_start}

	   {heading_previous_cell}<th><a href="{previous_url}">' . $arg['elem_previous'] . '</a></th>{/heading_previous_cell}
	   {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
	   {heading_next_cell}<th><a href="{next_url}">' . $arg['elem_next'] . '</a></th>{/heading_next_cell}

	   {heading_row_end}</tr>{/heading_row_end}

	   {week_row_start}<tr class="week">{/week_row_start}
	   {week_day_cell}<td>{week_day}</td>{/week_day_cell}
	   {week_row_end}</tr>{/week_row_end}

	   {cal_row_start}<tr>{/cal_row_start}
	   {cal_cell_start}<td>{/cal_cell_start}

	   {cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
	   {cal_cell_content_today}<div class="today-content"><a href="{content}">{day}</a></div>{/cal_cell_content_today}

	   {cal_cell_no_content}{day}{/cal_cell_no_content}
	   {cal_cell_no_content_today}<div class="today">{day}</div>{/cal_cell_no_content_today}

	   {cal_cell_blank}&nbsp;{/cal_cell_blank}

	   {cal_cell_end}</td>{/cal_cell_end}
	   {cal_row_end}</tr>{/cal_row_end}

	   {table_close}</table>{/table_close}';
    $CI =& get_instance();
    $CI->load->library('calendar', $prefs);
    $mktime = mktime() + getinfo('time_zone') * 60 * 60;
    // с учетом часового пояса ?
    # если это архив, то нужно показать календарь на этот год и месяц
    if (is_type('archive')) {
        $year = (int) mso_segment(2);
        if ($year > date('Y', $mktime) or $year < 2000) {
            $year = date('Y', $mktime);
        }
        $month = (int) mso_segment(3);
        if ($month > 12 or $month < 1) {
            $month = date('m', $mktime);
        }
    } else {
        $year = date('Y', $mktime);
        $month = date('m', $mktime);
    }
    # для выделения дат нужно смотреть записи, которые в этом месяце
    $CI->db->select('page_date_publish');
    $CI->db->from('page');
    $CI->db->join('page_type', 'page_type.page_type_id = page.page_type_id');
    $CI->db->where('page_status', 'publish');
    $CI->db->where('page_type_name', 'blog');
    $CI->db->where('page_date_publish >= ', mso_date_convert_to_mysql($year, $month));
    $CI->db->where('page_date_publish < ', mso_date_convert_to_mysql($year, $month + 1));
    # не выводить неопубликованные
    $CI->db->where('page_date_publish < ', mso_date_convert('Y-m-d H:i:s', date('Y-m-d H:i:s')));
    $query = $CI->db->get();
    $data = array();
    if ($query->num_rows() > 0) {
        $pages = $query->result_array();
        foreach ($pages as $key => $page) {
            $d = (int) mso_date_convert('d', $page['page_date_publish']);
            $data[$d] = getinfo('site_url') . 'archive/' . $year . '/' . $month . '/' . $d;
        }
        /*	$data = array(
        			   3  => 'http://your-site.com/news/article/2006/03/',
        			   7  => 'http://your-site.com/news/article/2006/07/" title="123',
        			   26 => 'http://your-site.com/news/article/2006/26/'
        			); */
    }
    $out = $CI->calendar->generate($year, $month, $data);
    $month_en = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
    $day_en = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
    $out = str_replace($month_en, $arg['months'], $out);
    $out = str_replace($day_en, $arg['days'], $out);
    # если используется английский, то заменим большие названия на маленькие
    $out = str_replace(array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'), array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'), $out);
    $out = $arg['header'] . $arg['block_start'] . $out . $arg['block_end'];
    return $out;
}
Exemple #11
0
 function name_site()
 {
     return !is_type('home') ? $this->link(getinfo('siteurl'), getinfo('name_site')) : getinfo('name_site');
 }
Exemple #12
0
function comment_button_head($arg = array())
{
    if (is_type('page')) {
        echo '<script src="' . getinfo('plugins_url') . 'comment_button/comment_button.js"></script>' . NR;
    }
}
Exemple #13
0
function multipage_pagination()
{
    if (!is_type('page')) {
        return true;
    }
    global $multipage_pagination;
    if (isset($multipage_pagination)) {
        $options = mso_get_option('plugin_multipage', 'plugins', array());
        if (isset($options['before_pag'])) {
            echo $options['before_pag'];
        }
        mso_hook('pagination', $multipage_pagination);
        if (isset($options['after_pag'])) {
            echo $options['after_pag'];
        }
    }
}
Exemple #14
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
	info-top файл
	предыдущая - следующая запись
	вывод рубрик перед заголовком записи
*/
$np_out = '';
if (is_type('page') and $p->val('page_type_name') == 'blog') {
    $np = mso_next_prev_page(array('page_id' => $p->val('page_id'), 'page_categories' => $p->val('page_categories'), 'page_date_publish' => $p->val('page_date_publish'), 'use_category' => false));
    if ($np['next']) {
        $np_out .= '<div class="b-left"><i class="i-long-arrow-left"></i> ' . $p->link(mso_page_url($np['next']['page_slug']), $np['next']['page_title']) . '</div>';
    }
    if ($np['prev']) {
        $np_out .= '<div class="b-right">' . $p->link(mso_page_url($np['prev']['page_slug']), $np['prev']['page_title']) . ' <i class="i-long-arrow-right"></i></div>';
    }
    $p->block($np_out, '<div class="next-prev-page clearfix t90">', '</div>');
}
$p->format('edit', '<i class="i-edit t-gray600 hover-t-black" title="Edit page"></i>', '<div class="b-right mar10-t">', '</div>');
$p->format('title', '<h1 class="t-gray700 bor-double-b bor3px bor-gray300 pad5-b">', '</h1>', false);
$p->format('date', 'j F Y г.', '<time datetime="[page_date_publish_iso]" class="i-calendar">', '</time>');
$p->format('view_count', '<span class="i-eye mar15-l">' . tf('Просмотров') . ': ', '</span>');
$p->format('comments_count', '<span class="i-comment mar15-l">Комментарии: ', '</span>');
$p->format('cat', '<i class="i-bookmark-o mar10-l"></i>', '<br><span class="i-bookmark" title="' . tf('Рубрика записи') . '">', '</span>');
$p->format('tag', '<i class="i-tag mar10-l"></i>', '<br><span class="i-tags links-no-color" title="' . tf('Метка записи') . '">', '</span>');
$p->html(NR . '<header class="mar20-b">');
$p->line('[edit][title]');
$p->div_start('info info-top t-gray600 t90');
Exemple #15
0
function tweetmeme_com_content($text = '')
{
    global $page;
    if (!is_type('page') and !is_type('home')) {
        return $text;
    }
    // если запись не опубликована, не отображаем блок
    if (is_type('page') and isset($page['page_status']) and $page['page_status'] != 'publish') {
        return $text;
    }
    $options = mso_get_option('plugin_tweetmeme_com', 'plugins', array());
    // получаем опции
    // отображать только на одиночной странице
    if (!isset($options['show_only_page'])) {
        $options['show_only_page'] = 0;
    }
    if ($options['show_only_page'] and !is_type('page')) {
        return $text;
    }
    if (is_type('page') and isset($options['page_type']) and $options['page_type']) {
        $p_type_name = mso_explode($options['page_type'], false);
        // нет у указанных типах страниц
        if (!in_array($page['page_type_name'], $p_type_name)) {
            return $text;
        }
    }
    // стиль выравнивания
    if (!isset($options['style'])) {
        $options['style'] = '';
    }
    if (!isset($options['align'])) {
        $options['align'] = 'right';
    }
    if ($options['style']) {
        $style = ' style="' . $options['style'] . '"';
    } else {
        if ($options['align'] == 'left') {
            $style = ' style="float: left; margin-right: 10px;"';
        } elseif ($options['align'] == 'right') {
            $style = ' style="float: right; margin-left: 10px; width: "';
        } else {
            $style = '';
        }
    }
    if (!isset($options['twitter_orig'])) {
        $options['twitter_orig'] = false;
    }
    // если использовать вывод с tweetmeme.com
    if (!$options['twitter_orig']) {
        if (!isset($options['tweetmeme_style'])) {
            $options['tweetmeme_style'] = 'none';
        }
        if (is_type('home')) {
            $js1 = 'tweetmeme_url = \'' . getinfo('site_url') . 'page/' . $page['page_slug'] . '\';';
        } else {
            $js1 = 'tweetmeme_url = \'' . mso_current_url(true) . '\';';
        }
        if ($options['tweetmeme_style'] == 'compact') {
            $js2 = 'tweetmeme_style = \'compact\';';
        } else {
            $js2 = '';
        }
        if ($js1 or $js2) {
            $js = '<script>' . $js1 . $js2 . '</script>';
        } else {
            $js = '';
        }
        // $text = '<span style="display: none"><![CDATA[<noindex>]]></span><div class="tweetmeme_com"' . $style . '>' . $js . '<script src="' . getinfo('plugins_url'). 'tweetmeme_com/button.js"></script></div><span style="display: none"><![CDATA[</noindex>]]></span>' . $text;
        $text = '<div class="tweetmeme_com"' . $style . '>' . $js . '<script src="http://tweetmeme.com/i/scripts/button.js"></script></div>' . $text;
    } else {
        // блок выводится с оригинального twitter.com
        if (is_type('home')) {
            $url = getinfo('site_url') . 'page/' . $page['page_slug'];
        } else {
            $url = mso_current_url(true);
        }
        if (!isset($options['twitter_data-count'])) {
            $options['twitter_data-count'] = 'vertical';
        }
        $options['twitter_data-count'] = ' data-count="' . $options['twitter_data-count'] . '" ';
        if (!isset($options['twitter_data-via'])) {
            $options['twitter_data-via'] = '';
        }
        if ($options['twitter_data-via']) {
            $options['twitter_data-via'] = ' data-via="' . $options['twitter_data-via'] . '" ';
        }
        $text = '<div class="tweetmeme_com"' . $style . '>' . '<a rel="nofollow" href="http://twitter.com/share" class="twitter-share-button" data-url="' . $url . '"' . $options['twitter_data-count'] . ' data-text="' . $page['page_title'] . '" ' . $options['twitter_data-via'] . '>Tweet</a>
		<script src="http://platform.twitter.com/widgets.js"></script>' . '</div>' . $text;
    }
    return $text;
}
Exemple #16
0
function mso_get_pages($r = array(), &$pag)
{
    global $MSO, $mso_page_current;
    $CI =& get_instance();
    if (!isset($r['limit'])) {
        $r['limit'] = 7;
    } else {
        // проверим входящий лимит - он должен быть числом
        $r['limit'] = (int) $r['limit'];
        $r['limit'] = abs($r['limit']);
        if (!$r['limit']) {
            $r['limit'] = 7;
        }
        // что-то не то, заменяем на дефолт=7
    }
    if (!isset($r['cut'])) {
        $r['cut'] = tf('Далее');
    }
    // ссылка на [cut]
    if (!isset($r['xcut'])) {
        $r['xcut'] = true;
    }
    // для тех у кого нет cut, но есть xcut выводить после xcut
    if (!isset($r['show_cut'])) {
        $r['show_cut'] = true;
    }
    // отображать ссылку «далее» для [cut] ?
    if (!isset($r['show_xcut'])) {
        $r['show_xcut'] = true;
    }
    // отображать ссылку «далее» для [xcut] ?
    // приписка к ссылке на страницу полной записи
    if (!isset($r['a_link_cut'])) {
        $r['a_link_cut'] = '#cut';
    }
    // удалять ли [cut], если false, то cut не обрабатывается
    // если false, то $r['cut'] и $r['xcut'] уже не учитываются
    if (!isset($r['work_cut'])) {
        $r['work_cut'] = true;
    }
    // отдавать все поля из таблиц (только для типов home и page)
    // если false, то только то, что предопределено
    if (!isset($r['all_fields'])) {
        $r['all_fields'] = false;
    }
    if (!isset($r['cat_order'])) {
        $r['cat_order'] = 'category_name';
    }
    // сортировка рубрик
    if (!isset($r['cat_order_asc'])) {
        $r['cat_order_asc'] = 'asc';
    }
    // порядок рубрик
    if (!isset($r['meta_order'])) {
        $r['meta_order'] = 'meta_value';
    }
    // сортировка meta
    if (!isset($r['meta_order_asc'])) {
        $r['meta_order_asc'] = 'asc';
    }
    // порядок meta
    if (!isset($r['pagination'])) {
        $r['pagination'] = true;
    }
    // использовать пагинацию
    if (!isset($r['content'])) {
        $r['content'] = true;
    }
    // получать весь текст
    // если 0, значит все страницы - только для главной
    // можно указать номера страниц через запятую
    if (!isset($r['page_id'])) {
        $r['page_id'] = 0;
    }
    // можно указать номера рубрик через запятую
    if (!isset($r['cat_id'])) {
        $r['cat_id'] = 0;
    }
    // если 0, значит все рубрики - только для главной
    if (!isset($r['type'])) {
        $r['type'] = 'blog';
    }
    // если false - то все, иначе blog или static
    if ($r['page_id']) {
        $r['type'] = false;
    }
    // если указан номер, то тип страницы сбрасываем
    if (!isset($r['order'])) {
        $r['order'] = 'page_date_publish';
    }
    // поле сортировки страниц
    if (!isset($r['order_asc'])) {
        $r['order_asc'] = 'desc';
    }
    // поле сортировки страниц
    // если нужно вывести все данные, невзирая на limit, то no_limit=true - пагинация при этом отключается
    if (!isset($r['no_limit'])) {
        $r['no_limit'] = false;
    }
    if ($r['no_limit']) {
        $r['pagination'] = false;
    }
    // custom_type - аналог is_type - анализ явного указания типа данных
    if (!isset($r['custom_type'])) {
        $r['custom_type'] = false;
    }
    // кастомная функция - вызывается вместо автоанализа по is_type
    // эта функция обязательно должна быть подобна _mso_sql_build_home($r, &$pag) и т.п.
    if (!isset($r['custom_func'])) {
        $r['custom_func'] = false;
    }
    // для функции mso_page_title - передаем тип ссылки для страниц
    if (!isset($r['link_page_type'])) {
        $r['link_page_type'] = 'page';
    }
    // для _mso_sql_build_category можно указать массив номеров рубрик
    // и получить все записи указанных рубрик
    if (!isset($r['categories'])) {
        $r['categories'] = array();
    }
    // исключить указанные в массиве записи
    if (!isset($r['exclude_page_id'])) {
        $r['exclude_page_id'] = array();
    }
    // произвольный slug - используется там, где вычисляется mso_segment(2)
    // страница, рубрика, метка, поиск
    if (!isset($r['slug'])) {
        $r['slug'] = false;
    }
    // если true, то публикуется только те, которые старше текущей даты
    // если false - то публикуются все
    // если юзер залогинен, то дата сбрасывается при выводе page
    if (!isset($r['date_now'])) {
        $r['date_now'] = true;
    }
    // смещение времени в формате ЧЧ:ММ
    // если нет, то берется из настроек
    if (!isset($r['time_zone'])) {
        $time_zone = getinfo('time_zone');
        if ($time_zone < 10 and $time_zone > 0) {
            $time_zone = '0' . $time_zone;
        } elseif ($time_zone > -10 and $time_zone < 0) {
            $time_zone = '0' . $time_zone;
            $time_zone = str_replace('0-', '-0', $time_zone);
        } else {
            $time_zone = '00.00';
        }
        $time_zone = str_replace('.', ':', $time_zone);
        $r['time_zone'] = $time_zone;
    }
    // если указано учитывать время публикации, то выполняем запрос в котором получаем
    // все записи, которые будущие и которые следует исключить из выборки
    // сей алгоритм связан с оптимизацией запросов к MySQL и значительным (очень!) ускорением
    // сложного select без использования NOW()
    if ($r['date_now']) {
        $CI->db->select('SQL_BUFFER_RESULT `page_id`', false);
        $CI->db->where('page_date_publish > ', 'DATE_ADD(NOW(), INTERVAL "' . $r['time_zone'] . '" HOUR_MINUTE)', false);
        $query = $CI->db->get('page');
        if ($query and $query->num_rows() > 0) {
            $page_id_date_now = $query->result_array();
            $r['page_id_date_now'] = array();
            foreach ($page_id_date_now as $key => $val) {
                $r['page_id_date_now'][] = $val['page_id'];
            }
        } else {
            $r['page_id_date_now'] = false;
        }
        // нет записей
    } else {
        $r['page_id_date_now'] = false;
    }
    // не нужно учитывать время
    // учитывать ли опцию публикация RSS в странице -
    // если true, то отдаются только те, которые отмечены с этой опцией, false - все
    if (!isset($r['only_feed'])) {
        $r['only_feed'] = false;
    }
    // стутус страниц - если false, то не учитывается
    if (!isset($r['page_status'])) {
        $r['page_status'] = 'publish';
    }
    // можно указать номер автора - получим только его записи
    if (!isset($r['page_id_autor'])) {
        $r['page_id_autor'] = false;
    }
    // получать ли информацию о рубриках
    // если false, то возвращает пустые массивы page_categories и page_categories_detail
    if (!isset($r['get_page_categories'])) {
        $r['get_page_categories'] = true;
    }
    // получать ли информацию о метках и мета страницы
    // объединены, потому что это один sql-запрос
    // если false, то возвращает пустые массивы page_tags и page_meta
    // при этом перестанет работать парсер текста
    if (!isset($r['get_page_meta_tags'])) {
        $r['get_page_meta_tags'] = true;
    }
    // нужно ли получать данные по количеству комментариев к страницам
    if (!isset($r['get_page_count_comments'])) {
        $r['get_page_count_comments'] = true;
    }
    // можно указать key и table для получения произвольных выборок мета, например метки
    // используется только для _mso_sql_build_tag
    // в качестве meta_value используется $slug
    if (!isset($r['meta_key'])) {
        $r['meta_key'] = 'tags';
    }
    if (!isset($r['meta_table'])) {
        $r['meta_table'] = 'page';
    }
    // сегмент, признак пагинации
    if (!isset($r['pagination_next_url'])) {
        $r['pagination_next_url'] = 'next';
    }
    // функция со своим sql, в которой можно добавить свои условия
    if (!isset($r['function_add_custom_sql'])) {
        $r['function_add_custom_sql'] = false;
    } else {
        if (!function_exists($r['function_add_custom_sql'])) {
            $r['function_add_custom_sql'] = false;
        }
    }
    // хук, если нужно поменять параметры
    // $r_restore = $r;
    $r = mso_hook('mso_get_pages', $r);
    # для каждого типа страниц строится свой sql-запрос
    # мы оформляем его в $CI, а здесь только выполняем $CI->db->get();
    // если указана кастомная функция, то выполняем r1
    if ($r['custom_func'] and function_exists($r['custom_func'])) {
        $r['custom_func']($r, $pag);
    } elseif ($r['custom_type']) {
        $custom_type = $r['custom_type'];
        if ($custom_type == 'home') {
            _mso_sql_build_home($r, $pag);
        } elseif ($custom_type == 'page') {
            _mso_sql_build_page($r, $pag);
        } elseif ($custom_type == 'category') {
            _mso_sql_build_category($r, $pag);
        } elseif ($custom_type == 'tag') {
            _mso_sql_build_tag($r, $pag);
        } elseif ($custom_type == 'archive') {
            _mso_sql_build_archive($r, $pag);
        } elseif ($custom_type == 'search') {
            _mso_sql_build_search($r, $pag);
        } elseif ($custom_type == 'author') {
            _mso_sql_build_author($r, $pag);
        } else {
            return array();
        }
    } elseif (is_type('home')) {
        _mso_sql_build_home($r, $pag);
    } elseif (is_type('page')) {
        _mso_sql_build_page($r, $pag);
    } elseif (is_type('category')) {
        _mso_sql_build_category($r, $pag);
    } elseif (is_type('tag')) {
        _mso_sql_build_tag($r, $pag);
    } elseif (is_type('archive')) {
        _mso_sql_build_archive($r, $pag);
    } elseif (is_type('search')) {
        _mso_sql_build_search($r, $pag);
    } elseif (is_type('author')) {
        _mso_sql_build_author($r, $pag);
    } else {
        return array();
    }
    // сам запрос и его обработка
    // $query = $CI->db->get();
    // нужно добавить SQL_BUFFER_RESULT
    // поскольку CodeIgniteryt не позволяет добавлять его явно, придется извращаться
    $query_sql = str_replace('SELECT ', 'SELECT SQL_BUFFER_RESULT ', $CI->db->_compile_select());
    // дурацкое экранирование CodeIgniter - используем свои костыли для запятых в запросе
    $query_sql = str_replace('_MSO_ZAP_', ',', $query_sql);
    $query = $CI->db->query($query_sql);
    $CI->db->_reset_select();
    // восстанавливать после запроса???
    // $r = mso_hook('mso_get_pages_restore', $r_restore);
    if ($query and $query->num_rows() > 0) {
        $pages = $query->result_array();
        $MSO->data['pages_is'] = true;
        // ставим признак, что записи получены
        if (is_type('page')) {
            // проверяем статус публикации - если page_status <> publish то смотрим автора и сравниваем с текущим юзером
            $page_status = $pages[0]['page_status'];
            // в page - всегда одна запись
            if ($page_status != 'publish') {
                if (isset($MSO->data['session']['users_id'])) {
                    // if ( $pages[0]['page_id_autor'] <> $MSO->data['session']['users_id'] ) return array();
                    if ($pages[0]['page_id_autor'] != $MSO->data['session']['users_id'] && !mso_check_allow('admin_page_edit_other')) {
                        return array();
                    } else {
                        if ($page_status == 'draft') {
                            $pages[0]['page_title'] .= ' ' . tf('(черновик)');
                        }
                        // else $pages[0]['page_title'] .= ' (личное)';
                    }
                } else {
                    return array();
                }
                // не залогинен
            }
        }
        // массив всех page_id
        $all_page_id = array();
        foreach ($pages as $key => $page) {
            $all_page_id[] = $page['page_id'];
            $content = $page['page_content'];
            $content = mso_hook('content_init', $content);
            $content = str_replace('<!-- pagebreak -->', '[cut]', $content);
            // совместимость с TinyMCE
            $content = str_replace('<!--more-->', '[cut]', $content);
            // совместимость с Wordpress
            # если после [cut] пробелы до конца строки, то удалим их
            $content = preg_replace('|\\[cut\\]\\s*<br|', '[cut]<br', $content);
            $content = preg_replace('|\\[cut\\](\\&nbsp;)*<br|', '[cut]<br', $content);
            $content = preg_replace('|\\[cut\\](\\&nbsp;)*(\\s)*<br|', '[cut]<br', $content);
            //$content = mso_hook('content', $content);
            //$content = mso_hook('content_auto_tag', $content);
            //$content = mso_hook('content_balance_tags', $content);
            //$content = mso_hook('content_out', $content);
            $pages[$key]['page_slug'] = $page['page_slug'] = mso_slug($page['page_slug']);
            if ($r['work_cut']) {
                if ($r['xcut']) {
                    // можно использовать [xcut]
                    $content = str_replace('[xcut', '[mso_xcut][cut', $content);
                } else {
                    $content = str_replace('[xcut', '[cut', $content);
                }
                if (preg_match('/\\[cut(.*?)?\\]/', $content, $matches)) {
                    $content = explode($matches[0], $content, 2);
                    $cut = $matches[1];
                } else {
                    $content = array($content);
                    $cut = '';
                }
                $output = $content[0];
                if (count($content) > 1) {
                    // ссылка на «далее...»
                    if ($r['cut']) {
                        if ($cut) {
                            if (isset($content[1])) {
                                if (strpos($cut, '%wordcount%') !== false) {
                                    $cut = str_replace('%wordcount%', mso_wordcount($content[1]), $cut);
                                }
                            }
                        } else {
                            $cut = $r['cut'];
                        }
                        # отображать ссылку?
                        if ($r['show_cut']) {
                            $output .= mso_page_title($page['page_slug'] . $r['a_link_cut'], $cut, '<span class="mso-cut">', '</span>', true, false, $r['link_page_type']);
                        }
                    } else {
                        $output .= '<a id="cut"></a>' . $content[1];
                    }
                }
                if ($r['xcut']) {
                    if (strpos($output, '[mso_xcut]') !== false) {
                        $xcontent = explode('[mso_xcut]', $output);
                        if ($r['cut'] and $cut) {
                            if ($r['show_xcut']) {
                                $cut = mso_page_title($page['page_slug'] . $r['a_link_cut'], $cut, '<span class="mso-cut">', '</span>', true, false, $r['link_page_type']);
                            } else {
                                $cut = '';
                            }
                            $output = $xcontent[0] . $cut;
                        } else {
                            $output = $xcontent[1];
                        }
                    }
                }
            } else {
                $output = $content;
            }
            // отдаем как есть
            # хуки на контент
            $mso_page_current = $page;
            // глобальная переменная, где хранится текущая обрабатываемая page
            $output = mso_hook('content_in', $output);
            $output = mso_hook('content', $output);
            /*
            $output = mso_hook('content_auto_tag', $output);
            $output = mso_hook('content_balance_tags', $output);
            $output = mso_hook('content_out', $output);
            $output = mso_hook('content_complete', $output);
            */
            $pages[$key]['page_content'] = $output;
            $pages[$key]['page_categories'] = array();
            $pages[$key]['page_categories_detail'] = array();
            $pages[$key]['page_tags'] = array();
            $pages[$key]['page_meta'] = array();
        }
        if ($r['get_page_categories']) {
            // теперь одним запросом получим все рубрики каждой записи
            $CI->db->select('page_id, category.category_id, category.category_name, category.category_slug, category.category_desc, category.category_id_parent');
            $CI->db->where_in('page_id', $all_page_id);
            $CI->db->order_by('category.' . $r['cat_order'], $r['cat_order_asc']);
            // сортировка рубрик
            $CI->db->from('cat2obj');
            $CI->db->join('category', 'cat2obj.category_id = category.category_id');
            if ($query = $CI->db->get()) {
                $cat = $query->result_array();
            } else {
                $cat = array();
            }
            // переместим все в массив page_id[] = category_id
            $page_cat = array();
            $page_cat_detail = array();
            foreach ($cat as $key => $val) {
                $page_cat[$val['page_id']][] = $val['category_id'];
                $page_cat_detail[$val['page_id']][$val['category_id']] = array('category_name' => $val['category_name'], 'category_slug' => $val['category_slug'], 'category_desc' => $val['category_desc'], 'category_id_parent' => $val['category_id_parent'], 'category_id' => $val['category_id']);
            }
        }
        if ($r['get_page_meta_tags']) {
            // по этому же принципу получаем все метки
            $CI->db->select('SQL_BUFFER_RESULT `meta_id_obj`, `meta_key`, `meta_value`', false);
            $CI->db->where(array('meta_table' => 'page'));
            $CI->db->where_in('meta_id_obj', $all_page_id);
            $CI->db->order_by($r['meta_order'], $r['meta_order_asc']);
            // сортировка мета
            if ($query = $CI->db->get('meta')) {
                $meta = $query->result_array();
            } else {
                $meta = array();
            }
            // переместим все в массив page_id[] = category_id
            $page_meta = array();
            foreach ($meta as $key => $val) {
                $page_meta[$val['meta_id_obj']][$val['meta_key']][] = $val['meta_value'];
            }
        }
        // нужно получить колво комментариев к записям
        if ($r['get_page_count_comments']) {
            $CI->db->select('SQL_BUFFER_RESULT `comments_page_id`, COUNT(`comments_id`) AS `page_count_comments`', false);
            $CI->db->where_in('comments_page_id', $all_page_id);
            $CI->db->where('comments_approved', '1');
            $CI->db->group_by('comments_page_id');
            $CI->db->from('comments');
            $query = $CI->db->get();
            $count_comments = $query->result_array();
            // переместим все в массив page_count_comments
            $page_count_comments = array();
            foreach ($count_comments as $key => $val) {
                $page_count_comments[$val['comments_page_id']] = $val['page_count_comments'];
            }
        }
        // получим данные о всех парсерах
        $parser_all = mso_hook('parser_register', array());
        // все зарегистрированные парсеры
        // добавим в массив pages полученную информацию по меткам и рубрикам
        foreach ($pages as $key => $val) {
            // рубрики
            if ($r['get_page_categories'] and isset($page_cat[$val['page_id']]) and $page_cat[$val['page_id']]) {
                $pages[$key]['page_categories'] = $page_cat[$val['page_id']];
                $pages[$key]['page_categories_detail'] = $page_cat_detail[$val['page_id']];
            }
            // метки отдельно как page_tags
            if ($r['get_page_meta_tags'] and isset($page_meta[$val['page_id']]['tags']) and $page_meta[$val['page_id']]['tags']) {
                $pages[$key]['page_tags'] = $page_meta[$val['page_id']]['tags'];
            }
            // остальные мета отдельно в page_meta
            if ($r['get_page_meta_tags'] and isset($page_meta[$val['page_id']]) and $page_meta[$val['page_id']]) {
                $pages[$key]['page_meta'] = $page_meta[$val['page_id']];
            }
            // колво комментариев
            if ($r['get_page_count_comments']) {
                if (isset($page_count_comments[$val['page_id']])) {
                    $pages[$key]['page_count_comments'] = $page_count_comments[$val['page_id']];
                } else {
                    $pages[$key]['page_count_comments'] = 0;
                }
                // нет комментариев
            } else {
                $pages[$key]['page_count_comments'] = 0;
            }
            // ставим, что нет комментариев
            // обработка контента хуками
            $output = $pages[$key]['page_content'];
            // обработка парсером
            if (isset($pages[$key]['page_meta']['parser_content'])) {
                if ($pages[$key]['page_meta']['parser_content'][0] !== 'none') {
                    $p = $pages[$key]['page_meta']['parser_content'][0];
                    if (isset($parser_all[$p]['content'])) {
                        $func = $parser_all[$p]['content'];
                        // функция, которую нужно выполнить
                        if (function_exists($func)) {
                            $output = $func($output);
                        }
                    }
                }
            } else {
                // парсер не указан, используем дефолтный
                // проверим его наличие по функции parser_default_content()
                // иначе нужно включить плагин
                if (!function_exists('parser_default_content')) {
                    require_once getinfo('plugins_dir') . 'parser_default/index.php';
                }
                $output = parser_default_content($output);
            }
            // pr($output, 1);
            // старые хуки, больше не используются
            // $output = mso_hook('content_auto_tag', $output);
            // $output = mso_hook('content_balance_tags', $output);
            // $output = mso_hook('content_out', $output);
            $output = mso_hook('content_complete', $output);
            $pages[$key]['page_content'] = $output;
        }
    } else {
        $pages = array();
        $MSO->data['pages_is'] = false;
        // ставим признак, что записей нет
    }
    return $pages;
}
Exemple #17
0
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
// здесь определим $MAIN_FILE — ои используется в main-end.php
global $MAIN_FILE;
// если есть custom/main-template.php, то испольузм его
if ($fn = mso_fe('custom/main-template.php')) {
    $MAIN_FILE = $fn;
} else {
    // main-шаблон вывода находится в meta-поле page_template
    // это определено в shared/meta/meta.ini
    // если метаполе не задано, то может использоваться main/type/page/main.php
    if (is_type('page') and isset($pages) and isset($pages[0])) {
        if ($page_template = mso_page_meta_value('page_template', $pages[0]['page_meta'])) {
            if ($fn = mso_fe('main/' . $page_template . '/main.php')) {
                mso_set_val('main_file', $fn);
                // выставляем путь к файлу
            }
        } elseif ($fn = mso_fe('main/type/page/main.php')) {
            mso_set_val('main_file', $fn);
            // выставляем путь к файлу
        } else {
            if ($page_template = mso_get_option('main_template_page', 'templates', '')) {
                if ($fn = mso_fe('main/' . $page_template . '/main.php')) {
                    mso_set_val('main_file', $fn);
                    // выставляем путь к файлу
                }
            }
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
	вывод заданного изображения из заданного каталога
*/
// где выводить
$component_output = mso_get_option('component_image_select_output', 'templates', array());
if (!in_array('all', $component_output)) {
    if (!in_array(getinfo('type'), $component_output)) {
        return;
    }
}
$subdir = mso_get_option('default_header_image', 'templates', '-template-');
if ($subdir == '-template-') {
    // каталог шаблона
    $subdir = getinfo('template_url') . 'images/headers/';
} else {
    $subdir = getinfo('uploads_url') . $subdir . '/';
}
// каталог в uploads
$img = '<img src="' . $subdir . mso_get_option('component_image_select', 'templates', '') . '" alt="" title="">';
// ссылка на главную
$component_image_select_link_home = mso_get_option('component_image_select_link_home', 'templates', true);
if ($component_image_select_link_home and !is_type('home')) {
    $img = '<a href="' . getinfo('site_url') . '">' . $img . '</a>';
}
echo '<div class="image-select"><div class="wrap">' . $img . '</div></div>';
# end file
Exemple #19
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
echo '<div class="info info-top">';
mso_page_title($page_slug, $page_title, '<h1>', '</h1>', !is_type('page'));
mso_page_date($page_date_publish, array('format' => 'D, j F Y г.', 'days' => tf('Понедельник Вторник Среда Четверг Пятница Суббота Воскресенье'), 'month' => tf('января февраля марта апреля мая июня июля августа сентября октября ноября декабря')), '<span>', '</span>');
//mso_page_author_link($users_nik, $page_id_autor, '<br><span>Автор:</span> ', '');
echo '</div>';
Exemple #20
0
function mso_link_rel($rel = 'canonical', $add = '')
{
    if (!$rel) {
        return;
    }
    // пустой тип
    if ($rel == 'canonical') {
        if ($add) {
            echo '<link rel="canonical" ' . $add . '>';
        } else {
            // для разных типов данных формируем разный канонический адрес
            // он напрямую зависит от типа
            $url = '';
            if (is_type('page') or is_type('category') or is_type('tag') or is_type('author')) {
                $url = getinfo('site_url') . mso_segment(1) . '/' . mso_segment(2);
            } elseif (is_type('home')) {
                $url = getinfo('site_url');
            }
            if ($url) {
                echo '<link rel="canonical" href="' . $url . '">' . NR;
            }
        }
    } else {
        if ($add) {
            echo '<link rel="' . $rel . '" ' . $add . '>';
        }
    }
}
Exemple #21
0
 /**
  * Asserts that gettype($var) === $type
  *
  * @param mixed $var
  * @param string $type
  * @return mixed
  */
 function debug_assert_type($var, $type)
 {
     debug_assert(is_type($var, $type), "Expected parameter of type " . var_dump_human_compact($type));
     return $var;
 }
Exemple #22
0
 * 
 */
# глобальное кэширование выполняется на уровне хука при наличии соответствующего плагина
# если хук вернул true, значит данные выведены из кэша, то есть выходим
if (mso_hook('global_cache_start', false)) {
    return;
}
# можно изменить язык шаблона
// $MSO->language = 'en';
# для rss используются другие шаблоны
if (is_feed()) {
    if (is_type('page')) {
        $mso_type_file = 'feed-page';
    } elseif (is_type('comments')) {
        $mso_type_file = 'feed-comments';
    } elseif (is_type('category')) {
        $mso_type_file = 'feed-category';
    } else {
        $mso_type_file = 'feed-home';
    }
    // все страницы
    $fn1 = getinfo('template_dir') . 'type/' . $mso_type_file . '.php';
    // путь в шаблоне
    $fn2 = getinfo('templates_dir') . 'default/type/' . $mso_type_file . '.php';
    // путь в default
    if (file_exists($fn1)) {
        require $fn1;
    } elseif (file_exists($fn2)) {
        require $fn2;
    }
    // нет, значит дефолтный
Exemple #23
0
function internal_links_custom($text = '')
{
    static $a_link;
    // здесь хранится обработанный массив ссылок - чтобы не обрабатывать несколько раз
    global $_internal_links;
    $options = mso_get_option('plugin_internal_links', 'plugins', array());
    // только на page
    if (!isset($options['only_page_type'])) {
        $options['only_page_type'] = true;
    }
    if ($options['only_page_type'] and !is_type('page')) {
        return $text;
    }
    // не указаны ссылки
    if (!isset($options['links'])) {
        return $text;
    }
    if (!trim($options['links'])) {
        return $text;
    }
    if (!isset($options['default_class'])) {
        $options['default_class'] = '';
    }
    if (!isset($options['max_count'])) {
        $options['max_count'] = 1;
    } else {
        $options['max_count'] = (int) $options['max_count'];
    }
    if ($options['max_count'] === 0) {
        $options['max_count'] = -1;
    }
    // замена для preg_replace
    $links = explode("\n", str_replace("\r", '', trim($options['links'])));
    // все ссылки в массив
    if (!isset($a_link) or !$a_link) {
        $a_link = array();
        foreach ($links as $key => $link) {
            $l1 = explode('|', $link);
            if (isset($l1[0]) and isset($l1[1])) {
                $a_link[$key]['word'] = trim($l1[0]);
                $a_link[$key]['link'] = trim($l1[1]);
                if (strpos($a_link[$key]['link'], 'http://') === false) {
                    $a_link[$key]['link'] = getinfo('siteurl') . $a_link[$key]['link'];
                }
                if (isset($l1[2]) and trim($l1[2])) {
                    $a_link[$key]['class'] = trim($l1[2]);
                } else {
                    $a_link[$key]['class'] = trim($options['default_class']);
                }
            }
        }
    }
    $current_url = getinfo('siteurl') . mso_current_url(false);
    $limit = $options['max_count'];
    foreach ($a_link as $key) {
        $word = $key['word'];
        $link = $key['link'];
        if ($link == $current_url) {
            continue;
        }
        // ссылка на себя
        if (mb_stripos($text, $word, 0, 'UTF8') === false) {
            continue;
        }
        // нет вхождения
        if ($key['class']) {
            $class = ' class="' . $key['class'] . '"';
        } else {
            $class = '';
        }
        $regexp = '/(?!(?:[^<\\[]+[>\\]]|[^>\\]]+<\\/a>))(' . preg_quote($word, '/') . ')/usUi';
        $replace = "<a href=\"" . $link . "\"" . $class . ">\$0</a>";
        $text = preg_replace($regexp, $replace, $text, $limit);
    }
    // pr($text,1);
    return $text;
}
Exemple #24
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
echo '<div class="info info-top">';
mso_page_title($page_slug, $page_title, '<h1>', mso_page_edit_link($page_id, '<img src="' . getinfo('template_url') . 'images/edit.png" width="16" height="16" alt="" title="Edit page" class="right">', '', '', false) . '</h1>', !is_type('page'));
echo '<div style="margin: 10px 0; padding: 5px 3px; line-height: 1.8em;">';
// отдельный блок для info
// только для page
if (is_type('page')) {
    mso_page_date($page_date_publish, array('format' => tf('j F Y г.')), '<span title="' . tf('Дата публикации') . '"><img src="' . getinfo('template_url') . 'images/date.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
    mso_page_author_link($users_nik, $page_id_autor, '<span style="margin-left: 15px;" title="' . tf('Автор') . '"><img src="' . getinfo('template_url') . 'images/user.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
    mso_page_view_count($page_view_count, '<span style="margin-left: 15px;" title="' . tf('Просмотры записи') . '"><img src="' . getinfo('template_url') . 'images/post-view.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ' . tf('Просмотров') . ':</span> ', '');
    if ($page_comment_allow) {
        mso_page_feed($page_slug, tf('RSS'), '<span style="margin-left: 15px;" title="' . tf('Подписка на RSS') . '"><img src="' . getinfo('template_url') . 'images/rss.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>', true);
    }
    mso_page_comments_link(array('page_comment_allow' => $page_comment_allow, 'page_slug' => $page_slug, 'page_count_comments' => $page_count_comments, 'title' => '<img src="' . getinfo('template_url') . 'images/comments.png" width="16" height="16" alt=""> ', 'title_no_link' => '<img src="' . getinfo('template_url') . 'images/comments.png" width="16" height="16" alt=""> ', 'title_no_comments' => '<img src="' . getinfo('template_url') . 'images/comments.png" width="16" height="16" alt="">', 'do' => '<span style="margin-left: 15px;" title="' . tf('Комментарии') . '">', 'posle' => ($page_count_comments ? mso_page_title($page_slug . '#comments', $page_count_comments, ' ', '', true, false) : mso_page_title($page_slug . '#comments', tf('Обсудить'), ' ', '', true, false)) . '</span>'));
    mso_page_cat_link($page_categories, ' » ', '<br><span title="' . tf('Рубрики') . '"><img src="' . getinfo('template_url') . 'images/category.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
    mso_page_tag_link($page_tags, ', ', '<span style="margin-left: 15px;" title="' . tf('Метки') . '"><img src="' . getinfo('template_url') . 'images/tag.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
} else {
    mso_page_date($page_date_publish, array('format' => tf('j F Y г.')), '<span title="' . tf('Дата публикации') . '"><img src="' . getinfo('template_url') . 'images/date.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
    mso_page_author_link($users_nik, $page_id_autor, '<span style="margin-left: 15px;" title="' . tf('Автор') . '"><img src="' . getinfo('template_url') . 'images/user.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
    mso_page_cat_link($page_categories, ' » ', ' <span style="margin-left: 15px;" title="' . tf('Рубрики') . '"><img src="' . getinfo('template_url') . 'images/category.png" width="16" height="16" alt="" style="vertical-align: text-top;"> ', '</span>');
    mso_page_comments_link(array('page_comment_allow' => $page_comment_allow, 'page_slug' => $page_slug, 'page_count_comments' => $page_count_comments, 'title' => '<img src="' . getinfo('template_url') . 'images/comments.png" width="16" height="16" alt=""> ', 'title_no_link' => '<img src="' . getinfo('template_url') . 'images/comments.png" width="16" height="16" alt=""> ', 'title_no_comments' => '<img src="' . getinfo('template_url') . 'images/comments.png" width="16" height="16" alt="">', 'do' => '<span style="margin-left: 15px;" title="' . tf('Комментарии') . '">', 'posle' => ($page_count_comments ? mso_page_title($page_slug . '#comments', $page_count_comments, ' ', '', true, false) : mso_page_title($page_slug . '#comments', tf('Обсудить'), ' ', '', true, false)) . '</span>'));
}
echo '</div>';
echo '</div>';
Exemple #25
0
function comment_smiles_head($arg = array())
{
    if (!is_type('home') and !is_type('category') and !is_type('tag') and !is_type('archive') and !is_type('comments') and !is_type('contact') and !is_type('search') and !is_type('users')) {
        echo '<script src="' . getinfo('plugins_url') . 'comment_smiles/comment_smiles.js"></script>' . NR;
    }
}
Exemple #26
0
function my_default_out_profiles($path = 'assets/css/profiles/')
{
    global $page;
    if ($default_profiles = mso_get_option('default_profiles', 'templates', array())) {
        $css_out = '';
        // theme-профили подключаются как link rel="stylesheet
        foreach ($default_profiles as $css_file) {
            $fn = $path . $css_file;
            $link = strpos($css_file, 'theme-');
            // это theme- ?
            if ($link !== false and $link === 0) {
                mso_add_file($fn);
            } else {
                // получение и обработка CSS из файла
                $css_out .= my_out_css_file($fn, false, false);
            }
        }
        if ($css_out) {
            echo '<style>' . $css_out . '</style>' . NR;
        }
    }
    // здесь же выводим css-профиль записи
    // он задан через метаполе
    if (is_type('page') and isset($page) and $page) {
        if ($page_css_profiles = mso_page_meta_value('page_css_profiles', $page['page_meta'])) {
            $fn = $path . $page_css_profiles;
            $link = strpos($page_css_profiles, 'theme-');
            // это theme- ?
            if ($link !== false and $link === 0) {
                mso_add_file($fn);
                // подключаем внешими стилями
            } else {
                // получение и обработка CSS из файла
                if ($css_out = my_out_css_file($fn, false, false)) {
                    echo NR . '<style>' . $css_out . '</style>' . NR;
                }
            }
        }
    }
}
Exemple #27
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
echo '<div class="logo-links"><div class="wrap">';
echo '<div class="left w75">';
$logo = getinfo('stylesheet_url') . 'images/logos/' . mso_get_option('default_header_logo', 'templates', 'logo01.png');
if (!is_type('home')) {
    echo '<a href="' . getinfo('siteurl') . '">';
}
echo '<img class="left" src="' . $logo . '" alt="' . getinfo('name_site') . '" title="' . getinfo('name_site') . '">';
if (!is_type('home')) {
    echo '</a>';
}
echo '
			<div class="name_site">' . getinfo('name_site') . '</div>
			<div class="description_site">' . getinfo('description_site') . '</div>';
echo '</div>';
echo '<div class="right text-right w25 social">';
echo '<a class="header-social rss" href="' . getinfo('rss_url') . '"><img src="' . getinfo('stylesheet_url') . 'images/social/rss.png" width="16" height="16" alt="RSS" title="RSS"></a>';
if ($u = mso_get_option('default_twitter_url', 'templates', '')) {
    echo '<a class="header-social twitter" rel="nofollow" href="' . $u . '"><img src="' . getinfo('stylesheet_url') . 'images/social/twitter.png" width="16" height="16" alt="Twitter" title="Twitter"></a>';
}
if ($u = mso_get_option('default_facebook_url', 'templates', '')) {
    echo '<a class="header-social facebook" rel="nofollow" href="' . $u . '"><img src="' . getinfo('stylesheet_url') . 'images/social/facebook.png" width="16" height="16" alt="Facebook" title="Facebook"></a>';
}
if ($u = mso_get_option('default_skype_url', 'templates', '')) {
    echo '<a class="header-social skype" rel="nofollow" href="' . $u . '"><img src="' . getinfo('stylesheet_url') . 'images/social/skype.png" width="16" height="16" alt="Skype" title="Skype"></a>';
}
if ($u = mso_get_option('default_vkontakte_url', 'templates', '')) {
Exemple #28
0
function mso_link_rel($rel = 'canonical', $add = '', $url_only = false)
{
    if (!$rel) {
        return;
    }
    // пустой тип
    if ($rel == 'canonical') {
        if ($add) {
            return '<link rel="canonical" ' . $add . '>';
        } else {
            // для разных типов данных формируем разный канонический адрес
            // он напрямую зависит от типа
            $url = '';
            // если есть хук canonical, то выполняем его
            // если хук вернул какое-то значение, то это $url
            // если нет, то выполняем типовое определение канонического адреса
            if (mso_hook_present('canonical')) {
                $url = mso_hook('canonical');
            }
            if (!$url) {
                if (is_type('page') or is_type('category') or is_type('tag') or is_type('author') or is_type('users') or mso_segment(1) == 'sitemap' or mso_segment(1) == 'contact') {
                    if (mso_segment(2)) {
                        $url = getinfo('site_url') . mso_segment(1) . '/' . mso_segment(2);
                    } else {
                        $url = getinfo('site_url') . mso_segment(1);
                    }
                } elseif (is_type('home')) {
                    $url = getinfo('site_url');
                }
            }
            // echo $url;
            // пагинация
            if (($cur = mso_current_paged()) > 1) {
                if (is_type('home')) {
                    $url .= 'home/next/' . $cur;
                } else {
                    $url .= '/next/' . $cur;
                }
            }
            if ($url) {
                if ($url_only) {
                    return $url;
                } else {
                    return '<link rel="canonical" href="' . $url . '">';
                }
            }
        }
    } else {
        if ($add) {
            return '<link rel="' . $rel . '" ' . $add . '>';
        }
    }
}
require_once getinfo('common_dir') . 'page.php';
// функции страниц
require_once getinfo('common_dir') . 'category.php';
// функции рубрик
# если нужен RSS
//  if ( mso_segment(1) == 'feed' ) {
//    require_once(getinfo('template_dir') . 'type/rss_home.php');
//    exit();
//  }
// получим GET
// $get = mso_parse_url_get(mso_url_get());
// pr($get['lang']);
// для rss
if (is_feed()) {
    require_once getinfo('template_dir') . 'type/rss.php';
    exit;
    // выходим
}
// подключения типов страниц
if (is_type('home')) {
    require_once getinfo('template_dir') . 'type/home.php';
} elseif (is_type('category')) {
    require_once getinfo('template_dir') . 'type/category.php';
} elseif (is_type('page')) {
    require_once getinfo('template_dir') . 'type/page.php';
} else {
    require_once getinfo('template_dir') . 'type/404.php';
}
# хук глобального кэша
mso_hook('global_cache_end');
# end file
Exemple #30
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 *
 * файл functions.php подключается при инициализации сайта
 *
 */
# данные для админки
if (is_type('admin')) {
    # регистрируем сайдбар
    mso_register_sidebar('1', tf('Первый сайдбар'));
    # функции для админки
    if ($fn = mso_fe('custom/template-admin.php')) {
        require_once $fn;
    }
} else {
    # набор из mso_set_val
    if ($fn = mso_fe('custom/set_val.php')) {
        require_once $fn;
    }
    # дополнительный файл template.php
    if ($fn = mso_fe('custom/template.php')) {
        require_once $fn;
    }
}
# end file