• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mso_segment函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mso_segment函数的典型用法代码示例。如果您正苦于以下问题:PHP mso_segment函数的具体用法?PHP mso_segment怎么用?PHP mso_segment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mso_segment函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ushki_to_hook_autoload

function ushki_to_hook_autoload()
{
    // для админки плагин не работает
    if (mso_segment(1) != 'admin') {
        mso_hook_add('init', 'ushki_to_hook_custom');
    }
}
开发者ID:Kmartynov,项目名称:cms,代码行数:7,代码来源:index.php


示例2: admin_ip_admin_init

function admin_ip_admin_init($args = array())
{
    // проверяем сегменты URL
    // получаем из опций секретный сегмент
    // если это секретный, то сбрасываем ip
    // получаем список разрешенных IP из опций
    // получаем текущий IP юзера
    // если его нет в разрешенных, то die('no');
    global $MSO;
    $options_key = 'plugin_admin_ip';
    $options = mso_get_option($options_key, 'plugins', array());
    if (!isset($options['secret'])) {
        $options['secret'] = '';
    }
    if (!isset($options['ip'])) {
        $options['ip'] = '';
    }
    if ($options['secret'] and mso_segment(3) == $options['secret']) {
        // сброс ip
        // http://localhost/codeigniter/admin/plugin_admin_ip/secret_to_reset - secret_to_reset
        $options['ip'] = '';
        mso_add_option($options_key, $options, 'plugins');
        mso_redirect('admin/plugin_admin_ip');
        // редирект на страницу плагина
    }
    if ($options['ip']) {
        // указаны IP
        $ips = explode("\n", $options['ip']);
        $curr_ip = $MSO->data['session']['ip_address'];
        $ok = false;
        // признак, что доступ разрешен
        foreach ($ips as $ip) {
            if (trim($ip) == $curr_ip) {
                $ok = true;
                break;
            }
        }
        if (!$ok) {
            die('Access denied');
        }
        // рубим
    }
    if (!mso_check_allow('admin_ip_admin_page')) {
        return $args;
        // 'Доступ запрещен';
    }
    $this_plugin_url = 'plugin_admin_ip';
    // url и hook
    # добавляем свой пункт в меню админки
    # первый параметр - группа в меню
    # второй - это действие/адрес в url - http://сайт/admin/demo
    #			можно использовать добавочный, например demo/edit = http://сайт/admin/demo/edit
    # Третий - название ссылки
    mso_admin_menu_add('plugins', $this_plugin_url, 'Admin IP');
    # прописываем для указаного admin_url_ + $this_plugin_url - (он будет в url)
    # связанную функцию именно она будет вызываться, когда
    # будет идти обращение по адресу http://сайт/admin/_null
    mso_admin_url_hook($this_plugin_url, 'admin_ip_admin_page');
    return $args;
}
开发者ID:Kmartynov,项目名称:cms,代码行数:60,代码来源:index.php


示例3: range_url_autoload

function range_url_autoload()
{
    // в админке и rss не используем
    if (mso_segment(1) != 'admin' and !is_feed()) {
        mso_hook_add('init', 'range_url_init');
    }
    # хук на init
}
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:8,代码来源:index.php


示例4: upload_editor_autoload

function upload_editor_autoload()
{
    if (is_login() && mso_check_allow('admin_files')) {
        mso_hook_add('new_page', 'upload_editor_new_page');
        if (mso_segment(2) == 'page_new') {
            mso_hook_add('admin_content', 'upload_editor_js');
        }
    }
}
开发者ID:wave-maxsite,项目名称:plugin-upload_editor,代码行数:9,代码来源:index.php


示例5: cron_custom

function cron_custom($args = array())
{
    $options = mso_get_option('plugin_cron', 'plugins', array());
    if (!isset($options['slug'])) {
        $options['slug'] = 'cron';
    }
    if (mso_segment(1) == $options['slug']) {
        mso_hook('cron');
        # это крон, выполняем его хук
        die('Cron done');
        # после крона всегда останавливаем выполнение
    } else {
        return $args;
    }
}
开发者ID:Kmartynov,项目名称:cms,代码行数:15,代码来源:index.php


示例6: feedburner_init

function feedburner_init($args = array())
{
    if (!is_feed()) {
        return $args;
    }
    $options = mso_get_option('plugin_feedburner', 'plugins', array());
    if (!isset($options['key'])) {
        return $args;
    }
    if (!preg_match("!feedburner|feedvalidator!i", $_SERVER['HTTP_USER_AGENT'])) {
        if (mso_segment(1) == 'feed') {
            header("Location: http://feeds2.feedburner.com/" . trim($options['key']));
            header("HTTP/1.1 302 Temporary Redirect");
            exit;
        }
    }
    return $args;
}
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:18,代码来源:index.php


示例7: admin_comments_admin

function admin_comments_admin($args = array())
{
    # выносим админские функции отдельно в файл
    global $MSO;
    if (!mso_check_allow('admin_comments')) {
        echo t('Доступ запрещен');
        return $args;
    }
    $seg = mso_segment(3);
    if ($seg == 'edit') {
        mso_hook_add_dinamic('mso_admin_header', ' return $args . t("Редактирование комментария"); ');
        mso_hook_add_dinamic('admin_title', ' return t("Редактирование комментария") . " - " . $args; ');
        require $MSO->config['admin_plugins_dir'] . 'admin_comments/edit.php';
    } else {
        mso_hook_add_dinamic('mso_admin_header', ' return $args . t("Комментарии"); ');
        mso_hook_add_dinamic('admin_title', ' return t("Комментарии") . " - " . $args; ');
        require $MSO->config['admin_plugins_dir'] . 'admin_comments/admin.php';
    }
}
开发者ID:rettebinu,项目名称:cms,代码行数:19,代码来源:index.php


示例8: admin_users_admin

function admin_users_admin($args = array())
{
    # выносим админские функции отдельно в файл
    global $MSO;
    if (!mso_check_allow('admin_users_users')) {
        echo t('Доступ запрещен');
        return $args;
    }
    # если идет вызов с номером юзера, то подключаем страницу для редактирования
    // Определим текущую страницу (на основе сегмента url)
    // http://localhost/codeigniter/admin/users/edit/1
    $seg = mso_segment(3);
    // третий - edit
    mso_hook_add_dinamic('mso_admin_header', ' return $args . "' . t('Пользователи') . '"; ');
    mso_hook_add_dinamic('admin_title', ' return "' . t('Пользователи') . ' - " . $args; ');
    // подключаем соответственно нужный файл
    if ($seg == '') {
        require $MSO->config['admin_plugins_dir'] . 'admin_users/users.php';
    } elseif ($seg == 'edit') {
        require $MSO->config['admin_plugins_dir'] . 'admin_users/edit.php';
    }
}
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:22,代码来源:index.php


示例9: global_cache_autoload

function global_cache_autoload($args = array())
{
    // в админке кэш не работает
    if (mso_segment(1) != 'admin') {
        $options = mso_get_option('plugin_global_cache', 'plugins', array());
        // кэш включен?
        if (isset($options['on']) and $options['on']) {
            // админам включить кэш?
            if (!isset($options['onlogin']) or isset($options['onlogin']) and !$options['onlogin']) {
                mso_hook_add('global_cache_start', 'global_cache_start');
                mso_hook_add('global_cache_end', 'global_cache_end');
                # дополнительные хуки, которые позволяют сбросить кэш - использовать в плагинах и т.п.
                mso_hook_add('global_cache_key_flush', 'global_cache_key_flush');
                // сброс кэша текущей страницы
                mso_hook_add('global_cache_all_flush', 'global_cache_all_flush');
                // сброс всего html-кэша
                # сброс кэша если была отправка POST
                if (isset($_POST) and $_POST) {
                    global_cache_all_flush();
                }
            }
        }
    }
}
开发者ID:Kmartynov,项目名称:cms,代码行数:24,代码来源:index.php


示例10: admin_plugin_options_admin

function admin_plugin_options_admin($args = array())
{
    if (!mso_check_allow('admin_plugin_options')) {
        echo t('Доступ запрещен');
        return $args;
    }
    mso_hook_add_dinamic('mso_admin_header', ' return $args . "' . t('Настройка плагина') . '"; ');
    mso_hook_add_dinamic('admin_title', ' return "' . t('Настройка плагина') . ' - " . $args; ');
    if ($plugin = mso_segment(3)) {
        if (!file_exists(getinfo('plugins_dir') . $plugin . '/index.php')) {
            echo t('Плагин не найден.');
            return $args;
        }
        if (!function_exists($plugin . '_mso_options')) {
            echo t('Для данного плагина настроек не предусмотрено.');
            return $args;
        } else {
            $fn = $plugin . '_mso_options';
            $fn();
        }
    } else {
        echo t('Неверно указан плагин.');
    }
}
开发者ID:Kmartynov,项目名称:cms,代码行数:24,代码来源:index.php


示例11: exit

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
// получим массив всех рубрик
$cats = mso_cat_array_single('page', 'category_menu_order', 'ASC', '', true, false);
// pr($cats);
// если массив рубрик получен
if ($cats) {
    // найдем нужную рубрику и получим данные о ней
    foreach ($cats as $cat) {
        if (mso_segment(2) == $cat['category_slug']) {
            $cat_id = $cat['category_id'];
            $cat_descr = $cat['category_desc'];
            $cat_name = $cat['category_name'];
            $cat_url = $cat['category_slug'];
            break;
        }
    }
    // сделаем запрос за записями этой рубрики
    $par = array('type' => false, 'cat_id' => $cat_id, 'limit' => mso_get_option('limit_post', 'templates', '10'), 'cut' => mso_get_option('more', 'templates', 'Читать полностью »'), 'type' => false, 'content' => false, 'get_page_count_comments' => false);
    $pages = mso_get_pages($par, $pagination);
    // pr($pages);
    // определим метаданные
    mso_head_meta('title', $cat_name . ' - ' . getinfo('name_site'));
    mso_head_meta('description', $cat_descr);
    mso_head_meta('keywords', $cat_descr);
    $admin_link = '';
    if (is_login()) {
        $admin_link = ' <a href="' . getinfo('siteurl') . 'admin/page_edit/' . $page['page_id'] . '">Редактировать</a>';
开发者ID:nicothin,项目名称:nicothin_ru,代码行数:31,代码来源:category.php


示例12: t

        echo '<div class="update">' . t('Обновлено!') . '</div>';
        // . $result['description'];
        mso_flush_cache();
        // сбросим кэш
    } else {
        echo '<div class="error">' . t('Ошибка обновления') . ' (' . $result['description'] . ')</div>';
    }
}
# вспомогательная функция
# имя поле значение
function _mso_add_row($title, $field, $val)
{
    $CI =& get_instance();
    $CI->table->add_row($title, form_input(array('name' => $field, 'style' => 'width: 99%', 'value' => $val)));
}
$id = (int) mso_segment(4);
// номер пользователя по сегменту url
if ($id) {
    # подготавливаем выборку из базы
    $CI->db->select('*');
    $CI->db->from('comusers');
    $CI->db->where('comusers_id', $id);
    $query = $CI->db->get();
    // если есть данные, то выводим
    if ($query->num_rows() > 0) {
        $CI->load->helper('form');
        $CI->load->library('table');
        $tmpl = array('table_open' => '<table class="page" border="0" width="99%">
						<colgroup><colgroup>', 'row_alt_start' => '<tr class="alt">', 'cell_alt_start' => '<td class="alt">');
        $CI->table->set_template($tmpl);
        // шаблон таблицы
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:31,代码来源:edit.php


示例13: exit

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
require_once getinfo('common_dir') . 'comments.php';
// получим всю информацию о комюзере - номер в сегменте url
$comuser_info = mso_get_comuser(mso_segment(2));
if ($f = mso_page_foreach('users-head-meta')) {
    require $f;
} else {
    mso_head_meta('title', tf('Комментаторы') . '. ' . getinfo('title'));
    // meta title страницы
}
if (!$comuser_info and mso_get_option('page_404_http_not_found', 'templates', 1)) {
    header('HTTP/1.0 404 Not Found');
}
// теперь сам вывод
# начальная часть шаблона
if ($fn = mso_find_ts_file('main/main-start.php')) {
    require $fn;
}
echo NR . '<div class="mso-type-users"><div class="mso-page-only"><div class="mso-page-content mso-type-users-content">';
if ($comuser_info) {
    extract($comuser_info[0]);
    if ($f = mso_page_foreach('users')) {
        require $f;
开发者ID:Kmartynov,项目名称:cms,代码行数:31,代码来源:users.php


示例14: mso_page_view_count_first

function mso_page_view_count_first($unique = false, $name_cookies = 'maxsite-cms', $expire = 2592000)
{
    global $_COOKIE, $_SESSION;
    if (!mso_get_option('page_view_enable', 'templates', '1') and !$unique) {
        return true;
    }
    //если нет такой опции или не пришло в функцию, то выходим
    if (!$unique) {
        $unique = mso_get_option('page_view_enable', 'templates', '1');
    }
    $slug = mso_segment(2);
    $all_slug = array();
    if ($unique == 0) {
        return false;
    } elseif ($unique == 1) {
        if (isset($_COOKIE[$name_cookies])) {
            $all_slug = explode('|', $_COOKIE[$name_cookies]);
        }
        // значения текущего кука
        if (in_array($slug, $all_slug)) {
            return false;
        }
        // уже есть текущий урл - не увеличиваем счетчик
    } elseif ($unique == 2) {
        session_start();
        if (isset($_SESSION[$name_cookies])) {
            $all_slug = explode('|', $_SESSION[$name_cookies]);
        }
        // значения текущей сессии
        if (in_array($slug, $all_slug)) {
            return false;
        }
        // уже есть текущий урл - не увеличиваем счетчик
    }
    // нужно увеличить счетчик
    $all_slug[] = $slug;
    // добавляем текущий slug
    $all_slug = array_unique($all_slug);
    // удалим дубли на всякий пожарный
    $all_slug = implode('|', $all_slug);
    // соединяем обратно в строку
    $expire = time() + $expire;
    if ($unique == 1) {
        @setcookie($name_cookies, $all_slug, $expire);
    } elseif ($unique == 2) {
        $_SESSION[$name_cookies] = $all_slug;
    }
    // записали в сессию
    // получим текущее значение page_view_count
    // и увеличиваем значение на 1
    $CI =& get_instance();
    $CI->db->select('page_view_count');
    if (is_numeric($slug)) {
        // ссылка вида http://site.com/page/1
        $CI->db->where('page_id', $slug);
    } else {
        $CI->db->where('page_slug', $slug);
    }
    $CI->db->limit(1);
    $query = $CI->db->get('page');
    if ($query->num_rows() > 0) {
        $pages = $query->row_array();
        $page_view_count = $pages['page_view_count'] + 1;
        $CI->db->where('page_slug', $slug);
        $CI->db->update('page', array('page_view_count' => $page_view_count));
        $CI->db->cache_delete('page', $slug);
        return true;
    }
}
开发者ID:buyvolov,项目名称:cms,代码行数:69,代码来源:page.php


示例15: exit

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
?>

<div class="admin-h-menu">
<?php 
# сделаем меню горизонтальное в текущей закладке
// основной url этого плагина - жестко задается
$plugin_url = $MSO->config['site_admin_url'] . 'sidebars';
// само меню
$a = mso_admin_link_segment_build($plugin_url, '', t('Настройки сайдбаров'), 'select') . ' | ';
$a .= mso_admin_link_segment_build($plugin_url, 'widgets', t('Настройка виджетов'), 'select');
echo $a;
?>
</div>

<?php 
// Определим текущую страницу (на основе сегмента url)
$seg = mso_segment(3);
// подключаем соответственно нужный файл
if ($seg == '') {
    require $MSO->config['admin_plugins_dir'] . 'admin_sidebars/sidebars.php';
} elseif ($seg == 'widgets') {
    require $MSO->config['admin_plugins_dir'] . 'admin_sidebars/widgets.php';
}
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:28,代码来源:admin.php


示例16: calendar_widget_custom

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);
//.........这里部分代码省略.........
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:101,代码来源:index.php


示例17: range_url_init

function range_url_init($arg = array())
{
    global $MSO;
    $options = mso_get_option('plugin_range_url', 'plugins', array());
    // главное зеркало сайта
    if (isset($options['siteurl_enable']) and $options['siteurl_enable'] and isset($options['siteurl']) and $options['siteurl']) {
        if ($MSO->config['site_url'] != $options['siteurl']) {
            mso_redirect($options['siteurl'] . mso_current_url(), true, 301);
        }
    }
    $current_url = mso_current_url();
    // текущий адрес
    if ($current_url === '') {
        return $arg;
    }
    // главная
    // отдельно правило для главной
    // если это home, но без next, то 301-редиректим на главную
    if (mso_segment(1) == 'home' and mso_segment(2) != 'next') {
        mso_redirect('', false, 301);
    }
    if (!isset($options['templates'])) {
        $options['templates'] = '';
    }
    $templates = explode("\n", trim($options['templates']));
    // разобъем по строкам
    if (!isset($options['page_404_redirect'])) {
        $options['page_404_redirect'] = 0;
    }
    if (!isset($options['page_404_header'])) {
        $options['page_404_header'] = 1;
    }
    if (!isset($options['default-templates'])) {
        $options['default-templates'] = true;
    }
    if ($options['default-templates']) {
        // в шаблоны добавим дефолтные адреса
        array_push($templates, '(page_404)', '(contact)', '(logout)', '(login)', '(password-recovery)', '(loginform)', '(loginform)(*)', '(require-maxsite)', '(require-maxsite)(*)', '(ajax)', '(ajax)(*)', '(remote)', '(sitemap)', '(sitemap)(next)(*)', '(sitemap)(cat)', '(sitemap)(cat)(next)(*)', '(home)(next)(*)', '(category)(*)', '(category)(*)(next)(*)', '(page)(*)', '(page)(*)(next)(*)', '(tag)(*)', '(tag)(*)(next)(*)', '(archive)', '(archive)(*)', '(archive)(*)(next)(*)', '(archive)(*)(*)', '(archive)(*)(*)(next)(*)', '(archive)(*)(*)(*)', '(archive)(*)(*)(*)(next)(*)', '(author)(*)', '(author)(*)(next)(*)', '(users)', '(users)(*)', '(users)(*)(edit)', '(users)(*)(lost)', '(search)(*)', '(search)(*)(next)(*)', '(comments)', '(comments)(*)', '(comments)(*)(next)(*)', '(dc)(*)', '(guestbook)', '(guestbook)(next)(*)', '(gallery)', '(gallery)(*)');
    }
    $templates = mso_hook('range_url', $templates);
    // можно добавить свои шаблоны url
    if (!isset($options['min-count-segment'])) {
        $options['min-count-segment'] = 1;
    }
    // минимальное количество сегментов
    $options['min-count-segment'] = (int) $options['min-count-segment'];
    if (count(explode('/', $current_url)) <= $options['min-count-segment']) {
        return $arg;
    }
    // адрес имеет менее N сегментов
    $allow = false;
    // результат
    foreach ($templates as $template) {
        $template = trim($template);
        if (!$template) {
            continue;
        }
        $reg = str_replace('(*)', '(.[^/]*)', $template);
        $reg = '~' . str_replace(')(', '){1}/(', $reg) . '\\z~siu';
        //pr($current_url);
        //pr($reg);
        if (preg_match($reg, $current_url)) {
            $allow = true;
            break;
        }
    }
    // pr($allow);
    if (!$allow) {
        if ($options['page_404_header']) {
            @header('HTTP/1.0 404 Not Found');
        }
        if ($options['page_404_redirect']) {
            mso_redirect('page_404');
        } else {
            $MSO->data['type'] = 'page_404';
        }
    }
    return $arg;
}
开发者ID:Kmartynov,项目名称:cms,代码行数:79,代码来源:index.php


示例18: exit

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
if (isset($pages[0]['page_categories_detail'])) {
    // описание рубрики
    foreach ($pages[0]['page_categories_detail'] as $_cat) {
        if ($_cat['category_slug'] == mso_segment(2)) {
            if ($_cat['category_desc']) {
                echo '<div class="category_desc">' . $_cat['category_desc'] . '</div>';
            }
            break;
        }
    }
}
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:16,代码来源:category-show-desc.php


示例19: exit

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * MaxSite CMS
 * (c) http://max-3000.com/
 */
// для users может быть несколько разных действий в зависимости от сегментов
// формируем по ним правильный путь к файлу
if (mso_segment(3) == 'edit') {
    if ($fn = mso_find_ts_file('type/users/units/users-form.php')) {
        require $fn;
        return;
    }
} elseif (mso_segment(3) == 'lost') {
    if ($fn = mso_find_ts_file('type/users/units/users-form-lost.php')) {
        require $fn;
        return;
    }
} elseif (mso_segment(2) == '') {
    if ($fn = mso_find_ts_file('type/users/units/users-all.php')) {
        require $fn;
        return;
    }
} else {
    if ($fn = mso_find_ts_file('type/users/units/users.php')) {
        require $fn;
        return;
    }
}
# end file
开发者ID:Kmartynov,项目名称:cms,代码行数:31,代码来源:users.php


示例20: exit

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
echo '<h3 class="category"><a href="' . getinfo('siteurl') . mso_segment(1) . '/' . mso_segment(2) . '/feed">' . tf('Подписаться на эту метку по RSS') . '</a></h3>';
开发者ID:rb2,项目名称:MaxSite-CMS,代码行数:6,代码来源:tag-show-rss-text.php



注:本文中的mso_segment函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mso_slug函数代码示例发布时间:2022-05-15
下一篇:
PHP mso_register_widget函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap