本文整理汇总了PHP中mso_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP mso_hook函数的具体用法?PHP mso_hook怎么用?PHP mso_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mso_hook函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbcode_custom
function bbcode_custom($text = '')
{
$text = preg_replace_callback('~\\[pre(.*?)\\](.*?)\\[\\/pre\\]~si', 'bbcode_pre_callback', $text);
$preg = array('~\\[b (.*?)\\](.*?)\\[\\/b\\]~si' => '<strong $1>$2</strong>', '~\\[b\\](.*?)\\[\\/b\\]~si' => '<strong>$1</strong>', '~\\[bold (.*?)\\](.*?)\\[\\/bold\\]~si' => '<b $1>$2</b>', '~\\[bold\\](.*?)\\[\\/bold\\]~si' => '<b>$1</b>', '~\\[i (.*?)\\](.*?)\\[\\/i\\]~si' => '<em$1>$2</em>', '~\\[i\\](.*?)\\[\\/i\\]~si' => '<em>$1</em>', '~\\[italic (.*?)\\](.*?)\\[\\/italic\\]~si' => '<i$1>$2</i>', '~\\[italic\\](.*?)\\[\\/italic\\]~si' => '<i>$1</i>', '~\\[del (.*?)\\](.*?)\\[\\/del\\]~si' => '<del $1>$2</del>', '~\\[del\\](.*?)\\[\\/del\\]~si' => '<del>$1</del>', '~\\[s (.*?)\\](.*?)\\[\\/s\\]~si' => '<s $1>$2</s>', '~\\[s\\](.*?)\\[\\/s\\]~si' => '<s>$1</s>', '~\\[u (.*?)\\](.*?)\\[\\/u\\]~si' => '<u $1>$2</u>', '~\\[u\\](.*?)\\[\\/u\\]~si' => '<u>$1</u>', '~\\[sub\\](.*?)\\[\\/sub\\]~si' => '<sub>$1</sub>', '~\\[sup\\](.*?)\\[\\/sup\\]~si' => '<sup>$1</sup>', '~\\[small\\](.*?)\\[\\/small\\]~si' => '<small>$1</small>', '~\\[color=(.*?)\\](.*?)\\[\\/color\\]~si' => '<span style="color:$1">$2</span>', '~\\[size=(.*?)\\](.*?)\\[\\/size\\]~si' => '<span style="font-size:$1">$2</span>', '~\\[div=(.*?)\\](.*?)\\[\\/div\\]~si' => '<div style="$1">$2</div>', '~\\[span=(.*?)\\](.*?)\\[\\/span\\]~si' => '<span style="$1">$2</span>', '~\\[left (.*?)\\](.*?)\\[\\/left\\]~si' => '<div style="text-align: left; $1">$2</div>', '~\\[left\\](.*?)\\[\\/left\\]~si' => '<div style="text-align: left;">$1</div>', '~\\[right (.*?)\\](.*?)\\[\\/right\\]~si' => '<div style="text-align: right; $1">$2</div>', '~\\[right\\](.*?)\\[\\/right\\]~si' => '<div style="text-align: right;">$1</div>', '~\\[center (.*?)\\](.*?)\\[\\/center\\]~si' => '<div style="text-align: center; $1">$2</div>', '~\\[center\\](.*?)\\[\\/center\\]~si' => '<div style="text-align: center;">$1</div>', '~\\[justify (.*?)\\](.*?)\\[\\/justify\\]~si' => '<div style="text-align: justify; $1">$2</div>', '~\\[justify\\](.*?)\\[\\/justify\\]~si' => '<div style="text-align: justify;">$1</div>', '~\\[p\\](.*?)\\[\\/p\\]~si' => '<p>$1</p>', '~\\[p=(.*?)\\](.*?)\\[\\/p\\]~si' => '<p style="$1">$2</p>', '~\\[p (.*?)\\](.*?)\\[\\/p\\]~si' => '<p $1>$2</p>', '~\\[p\\((.*?)\\)\\](.*?)\\[\\/p\\]~si' => '<p class="$1">$2</p>', '~\\[pleft\\](.*?)\\[\\/pleft\\]~si' => '<p style="text-align: left;">$1</p>', '~\\[pright\\](.*?)\\[\\/pright\\]~si' => '<p style="text-align: right;">$1</p>', '~\\[pcenter\\](.*?)\\[\\/pcenter\\]~si' => '<p style="text-align: center;">$1</p>', '~\\[pjustify\\](.*?)\\[\\/pjustify\\]~si' => '<p style="text-align: justify;">$1</p>', '~\\[abbr\\](.*?)\\[\\/abbr\\]~si' => '<abbr>$1</abbr>', '~\\[abbr (.*?)\\](.*?)\\[\\/abbr\\]~si' => '<abbr title="$1">$2</abbr>', '~\\[q\\](.*?)\\[\\/q\\]~si' => '<q>$1</q>', '~\\[q (.*?)\\](.*?)\\[\\/q\\]~si' => '<q $1">$2</q>', '~\\[cite\\](.*?)\\[\\/cite\\]~si' => '<cite>$1</cite>', '~\\[cite (.*?)\\](.*?)\\[\\/cite\\]~si' => '<cite $1">$2</cite>', '~\\[address\\](.*?)\\[\\/address\\]~si' => '<address>$1</address>', '~\\[address (.*?)\\](.*?)\\[\\/address\\]~si' => '<address $1">$2</address>', '~\\[dfn\\](.*?)\\[\\/dfn\\]~si' => '<dfn>$1</dfn>', '~\\[dfn (.*?)\\](.*?)\\[\\/dfn\\]~si' => '<dfn $1">$2</dfn>', '~\\[dl\\](.*?)\\[\\/dl\\]~si' => '<dl>$1</dl>', '~\\[dl (.*?)\\](.*?)\\[\\/dl\\]~si' => '<dl $1">$2</dl>', '~\\[dt\\](.*?)\\[\\/dt\\]~si' => '<dt>$1</dt>', '~\\[dt (.*?)\\](.*?)\\[\\/dt\\]~si' => '<dt $1">$2</dt>', '~\\[dd\\](.*?)\\[\\/dd\\]~si' => '<dd>$1</dd>', '~\\[dd (.*?)\\](.*?)\\[\\/dd\\]~si' => '<dd $1">$2</dd>', '~\\[ins\\](.*?)\\[\\/ins\\]~si' => '<ins>$1</ins>', '~\\[ins (.*?)\\](.*?)\\[\\/ins\\]~si' => '<ins $1">$2</ins>', '~\\[hr\\]~si' => '<hr>', '~\\[line\\]~si' => '<hr>', '~\\[table\\]~si' => '<table>', '~\\[table (.*?)\\]~si' => '<table $1>', '~\\[\\/table\\]~si' => '</table>', '~\\[tr\\]~si' => '<tr>', '~\\[tr (.*?)\\]~si' => '<tr $1>', '~\\[\\/tr\\]~si' => '</tr>', '~\\[td\\]~si' => '<td>', '~\\[td (.*?)\\]~si' => '<td $1>', '~\\[\\/td\\]~si' => '</td>', '~\\[th\\]~si' => '<th>', '~\\[th (.*?)\\]~si' => '<th $1>', '~\\[\\/th\\]~si' => '</th>', '~\\[\\*\\](.*?)\\[\\/\\*\\]~si' => '<li>$1</li>', '~\\[\\*\\]~si' => '<li>', '~\\[ul\\](.*?)\\[\\/ul\\]~si' => "<ul>\$1</li></ul>", '~\\[list\\](.*?)\\[\\/list\\]~si' => "<ul>\$1</li></ul>", '~\\[ol\\](.*?)\\[\\/ol\\]~si' => '<ol>$1</li></ol>', '~\\[li\\]~si' => '<li>', '~\\[li (.*?)\\]~si' => '<li $1>', '~\\[\\/li\\]~si' => '</li>', '~\\[h1\\](.*?)\\[\\/h1\\]~si' => '<h1>$1</h1>', '~\\[h1\\((.[^ ]*?)\\)\\](.*?)\\[\\/h1\\]~si' => '<h1 class="$1">$2</h1>', '~\\[h1 (.*?)\\](.*?)\\[\\/h1\\]~si' => '<h1 $1>$2</h1>', '~\\[h2\\](.*?)\\[\\/h2\\]~si' => '<h2>$1</h2>', '~\\[h2\\((.[^ ]*?)\\)\\](.*?)\\[\\/h2\\]~si' => '<h2 class="$1">$2</h2>', '~\\[h2 (.*?)\\](.*?)\\[\\/h2\\]~si' => '<h2 $1>$2</h2>', '~\\[h3\\](.*?)\\[\\/h3\\]~si' => '<h3>$1</h3>', '~\\[h3\\((.[^ ]*?)\\)\\](.*?)\\[\\/h3\\]~si' => '<h3 class="$1">$2</h3>', '~\\[h3 (.*?)\\](.*?)\\[\\/h3\\]~si' => '<h3 $1>$2</h3>', '~\\[h4\\](.*?)\\[\\/h4\\]~si' => '<h4>$1</h4>', '~\\[h4\\((.[^ ]*?)\\)\\](.*?)\\[\\/h4\\]~si' => '<h4 class="$1">$2</h4>', '~\\[h4 (.*?)\\](.*?)\\[\\/h4\\]~si' => '<h4 $1>$2</h4>', '~\\[h5\\](.*?)\\[\\/h5\\]~si' => '<h5>$1</h5>', '~\\[h5\\((.[^ ]*?)\\)\\](.*?)\\[\\/h5\\]~si' => '<h5 class="$1">$2</h5>', '~\\[h5 (.*?)\\](.*?)\\[\\/h5\\]~si' => '<h5 $1>$2</h5>', '~\\[h6\\](.*?)\\[\\/h6\\]~si' => '<h6>$1</h6>', '~\\[h6\\((.[^ ]*?)\\)\\](.*?)\\[\\/h6\\]~si' => '<h6 class="$1">$2</h6>', '~\\[h6 (.*?)\\](.*?)\\[\\/h6\\]~si' => '<h6 $1>$2</h6>', '~\\[code\\](.*?)\\[\\/code\\]~si' => '<code>$1</code>', '~\\[url\\](.*?)\\[\\/url\\]~si' => '<a href="$1">$1</a>', '~\\[url=(.[^ ]*?)\\](.*?)\\[\\/url\\]~si' => '<a href="$1">$2</a>', '~\\[url=(.[^\\s]*?) (.*?)\\](.*?)\\[\\/url\\]~si' => '<a href="$1" $2>$3</a>', '~\\[url (.*?)\\](.*?)\\[\\/url\\]~si' => '<a href="$2" $1>$2</a>', '~\\[imgleft=(.*?)x(.*?)\\](.*?)\\[\\/imgleft\\]~si' => '<img src="$3" style="float: left; margin: 0 10px 0 0; width: $1px; height: $2px">', '~\\[imgleft\\](.*?)\\[\\/imgleft\\]~si' => '<img src="$1" style="float: left; margin: 0 10px 0 0;">', '~\\[imgleft (.*?)\\](.*?)\\[\\/imgleft\\]~si' => '<img src="$2" title="$1" alt="$1" style="float: left; margin: 0 10px 0 0;">', '~\\[imgright=(.*?)x(.*?)\\](.*?)\\[\\/imgright\\]~si' => '<img src="$3" style="float: right; margin: 0 0 0 10px; width: $1px; height: $2px">', '~\\[imgright\\](.*?)\\[\\/imgright\\]~si' => '<img src="$1" style="float: right; margin: 0 0 0 10px;">', '~\\[imgright (.*?)\\](.*?)\\[\\/imgright\\]~si' => '<img src="$2" title="$1" alt="$1" style="float: right; margin: 0 0 0 10px;">', '~\\[imgcenter\\](.*?)\\[\\/imgcenter\\]~si' => '<div style="text-align: center"><img src="$1"></div>', '~\\[imgcenter (.*?)\\](.*?)\\[\\/imgcenter\\]~si' => '<div style="text-align: center"><img src="$2" title="$1" alt="$1"></div>', '~\\[imgmini=_(.*?)\\](.*?)\\[\\/imgmini\\]~si' => '<a href="$2" target="_blank" class="lightbox"><img src="$1"></a>', '~\\[imgmini=(.*?)\\](.*?)\\[\\/imgmini\\]~si' => '<a href="$2"><img src="$1" class="lightbox"></a>', '~\\[img=(.*?)x(.*?)\\](.*?)\\[\\/img\\]~si' => '<img src="$3" style="width: $1px; height: $2px">', '~\\[img (.*?)\\](.*?)\\[\\/img\\]~si' => '<img src="$2" title="$1" alt="$1">', '~\\[img\\](.*?)\\[\\/img\\]~si' => '<img src="$1" title="" alt="">', '~\\[img\\((.[^ ]*?)\\)\\](.*?)\\[\\/img\\]~si' => '<img src="$2" alt="" class="$1">', '~\\[img\\((.[^ ]*?)\\) (.*?)\\](.*?)\\[\\/img\\]~si' => '<img src="$3" alt="$2" title="$2" class="$1">', '~\\[quote\\](.*?)\\[\\/quote\\]~si' => '<blockquote>$1</blockquote>', '~\\[quote=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\\](.*?)\\[\\/quote\\]~si' => '<blockquote><strong class="src">$1:</strong>$2</blockquote>', '~\\[div\\((.*?)\\)\\](.*?)\\[\\/div\\]~si' => '<div class="$1">$2</div>', '~\\[div (.*?)\\](.*?)\\[\\/div\\]~si' => '<div $1>$2</div>', '~\\[div\\((.*?)\\) (.*?)\\](.*?)\\[\\/div\\]~si' => '<div class="$1" $2>$3</div>', '~\\[span\\((.*?)\\)\\](.*?)\\[\\/span\\]~si' => '<span class="$1">$2</span>', '~\\[span (.*?)\\](.*?)\\[\\/span\\]~si' => '<span $1>$2</span>', '~\\[span\\((.*?)\\) (.*?)\\](.*?)\\[\\/span\\]~si' => '<span class="$1" $2>$3</span>', '~\\[getinfo siteurl\\]~si' => getinfo('siteurl'), '~\\[getinfo template_url\\]~si' => getinfo('template_url'), '~\\[getinfo uploads_url\\]~si' => getinfo('uploads_url'), '~\\[getinfo shared_url\\]~si' => getinfo('shared_url'));
if (strpos($text, '[text-demo]') !== false) {
if (file_exists(getinfo('plugins_dir') . 'bbcode/text-demo.txt')) {
$text_demo = file_get_contents(getinfo('plugins_dir') . 'bbcode/text-demo.txt');
$text = str_replace('[text-demo]', $text_demo, $text);
}
}
if (strpos($text, '[text-normalize]') !== false) {
if (file_exists(getinfo('plugins_dir') . 'bbcode/text-normalize.txt')) {
$text_normalize = file_get_contents(getinfo('plugins_dir') . 'bbcode/text-normalize.txt');
$text = str_replace('[text-normalize]', $text_normalize, $text);
}
}
$text = preg_replace(array_keys($preg), array_values($preg), $text);
# другие сложные патерны и замены
// создание ul/li списка по принципу меню
$pattern = '~\\[create_list\\((.*?)\\)\\](.*?)\\[/create_list\\]~si';
// с указаным css-классом
$text = preg_replace_callback($pattern, 'bbcode_create_list_callback', $text);
$pattern = '~\\[create_list\\](.*?)\\[/create_list\\]~si';
// без класса
$text = preg_replace_callback($pattern, 'bbcode_create_list_callback', $text);
// [show Вопрос] текст [/show]
$pattern = '~\\[show (.*?)\\](.*?)\\[\\/show\\]~si';
$text = preg_replace_callback($pattern, 'bbcode_show_callback', $text);
// по хуку bbcode можно выполнить свои замены
$text = mso_hook('bbcode', $text);
// pr($text, 1);
return $text;
}
示例2: 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;
}
}
示例3: editor_jw
function editor_jw($args = array())
{
global $MSO;
$editor_config['url'] = $MSO->config['admin_plugins_url'] . 'editor_jw/';
$editor_config['dir'] = $MSO->config['admin_plugins_dir'] . 'editor_jw/';
// if (isset($args['content'])) $editor_config['content'] = mso_text_to_html($args['content']);
if (isset($args['content'])) {
$editor_config['content'] = $args['content'];
} else {
$editor_config['content'] = '';
}
if (!$editor_config['content']) {
$editor_config['content'] = '<br>';
}
$editor_config['content'] = mso_hook('editor_content', $editor_config['content']);
if (isset($args['do'])) {
$editor_config['do'] = $args['do'];
} else {
$editor_config['do'] = '';
}
if (isset($args['posle'])) {
$editor_config['posle'] = $args['posle'];
} else {
$editor_config['posle'] = '';
}
if (isset($args['action'])) {
$editor_config['action'] = ' action="' . $args['action'] . '"';
} else {
$editor_config['action'] = '';
}
if (isset($args['height'])) {
$editor_config['height'] = (int) $args['action'];
} else {
$editor_options = mso_get_option('editor_options', 'admin', array());
if (isset($editor_options['editor_height'])) {
$editor_config['height'] = (int) $editor_options['editor_height'];
} else {
$editor_config['height'] = 400;
}
if ($editor_config['height'] < 100) {
$editor_config['height'] = 400;
}
}
mso_hook_add('admin_head', 'editor_jw_admin_header');
require $editor_config['dir'] . 'editor.php';
}
示例4: comment_button_custom
function comment_button_custom($arg = array())
{
$options = mso_get_option('plugin_comment_button', 'plugins', array());
if (!isset($options['show_buttons']) or !trim($options['show_buttons'])) {
$options['show_buttons'] = 'b|i|u|s|blockquote|pre';
}
$buttons = array_map('trim', preg_split("/[\\s,\\|]+/", trim($options['show_buttons'])));
echo '<p class="comment_button">
' . (!in_array('b', $buttons) ? '' : ' <button type="button" class="comment_button_b" title="' . tf('Полужирный') . '" onClick="addText(\'<b>\', \'</b>\') ">B</button>') . '
' . (!in_array('i', $buttons) ? '' : ' <button type="button" class="comment_button_i" title="' . tf('Курсив') . '" onClick="addText(\'<i>\', \'</i>\') ">I</button>') . '
' . (!in_array('u', $buttons) ? '' : ' <button type="button" class="comment_button_u" title="' . tf('Подчеркнутый') . '" onClick="addText(\'<u>\', \'</u>\') ">U</button>') . '
' . (!in_array('s', $buttons) ? '' : ' <button type="button" class="comment_button_s" title="' . tf('Зачеркнутый') . '" onClick="addText(\'<s>\', \'</s>\') ">S</button>') . '
' . (!in_array('blockquote', $buttons) ? '' : ' <button type="button" class="comment_button_blockquote" title="' . tf('Цитата') . '" onClick="addText(\'<blockquote>\', \'</blockquote>\') ">' . t('Цитата') . '</button>') . '
' . (!in_array('pre', $buttons) ? '' : ' <button type="button" class="comment_button_pre" title="' . tf('Код или преформатированный текст') . '" onclick="addText(\'<pre>\', \'</pre>\') ">' . t('Код') . '</button>') . '
' . mso_hook('comment_button_more') . '
</p>';
}
示例5: mso_hook_add
$menu .= NR . 'admin/template_options | Настройка шаблона';
$menu .= NR . 'http://max-3000.com/page/faq | ЧАВО для новичков';
$menu .= NR . 'http://max-3000.com/help | Центр помощи';
$menu .= NR . 'http://forum.max-3000.com/ | Форум поддержки';
$menu .= NR . 'logout | Выход';
$menu .= NR . ']';
return $menu;
}
mso_hook_add('main_menu_custom', '_my_users_main_menu_custom');
} elseif (is_login_comuser()) {
function _my_comusers_main_menu_custom($menu = '')
{
$comuser = is_login_comuser();
$menu .= NR . '[';
if ($comuser['comusers_nik']) {
$menu .= NR . '# | ' . $comuser['comusers_nik'];
} else {
$menu .= NR . '# | Ваши ссылки';
}
$menu .= NR . 'users/' . $comuser['comusers_id'] . ' | Своя страница';
$menu .= NR . 'http://max-3000.com/page/faq | ЧАВО для новичков';
$menu .= NR . 'http://max-3000.com/help | Центр помощи';
$menu .= NR . 'http://forum.max-3000.com/ | Форум поддержки';
$menu .= NR . 'logout | Выход';
$menu .= NR . ']';
return $menu;
}
mso_hook_add('main_menu_custom', '_my_comusers_main_menu_custom');
}
mso_hook('main_menu');
}
示例6: 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;
}
示例7: exit
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
if ($post = mso_check_post(array('data'))) {
$output = $post['data'];
$output = trim($output);
$output = str_replace(chr(10), "<br>", $output);
$output = str_replace(chr(13), "", $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_content', $output);
// стили вначале подключаем базу из preview.css
$css_link = '<link rel="stylesheet" href="' . getinfo('plugins_url') . 'editor_markitup/preview.css" type="text/css" media="screen">';
// теперь остальные по алгоритму default 2
$css_link .= NT . '<link rel="stylesheet" href="';
if (file_exists(getinfo('template_dir') . 'css/css.php')) {
$css_link .= getinfo('template_url') . 'css/css.php';
} else {
if (file_exists(getinfo('template_dir') . 'css/my_style.css')) {
$css_link .= getinfo('template_url') . 'css/my_style.css';
} else {
if (file_exists(getinfo('template_dir') . 'css/style-all-mini.css')) {
$css_link .= getinfo('template_url') . 'css/style-all-mini.css';
} elseif (file_exists(getinfo('template_dir') . 'css/style-all.css')) {
$css_link .= getinfo('template_url') . 'css/style-all.css';
} else {
$css_link .= getinfo('templates_url') . 'default/css/style-all-mini.css';
示例8: random_pages_widget_custom
function random_pages_widget_custom($options = array(), $num = 1)
{
$out = '';
if (!isset($options['header'])) {
$options['header'] = '';
}
if (!isset($options['count'])) {
$options['count'] = 3;
}
if (!isset($options['page_type'])) {
$options['page_type'] = 'blog';
}
if (!isset($options['page_content'])) {
$options['page_content'] = false;
}
$CI =& get_instance();
if (!$options['page_content']) {
$CI->db->select('page_slug, page_title');
} else {
$CI->db->select('page_slug, page_content');
}
//$CI->db->where('page_date_publish <', date('Y-m-d H:i:s'));
$CI->db->where('page_date_publish < ', 'NOW()', false);
$CI->db->where('page_status', 'publish');
if ($options['page_type']) {
$CI->db->where('page_type_name', $options['page_type']);
}
$CI->db->join('page_type', 'page_type.page_type_id = page.page_type_id');
$CI->db->from('page');
$CI->db->order_by('page_id', 'random');
$CI->db->limit($options['count']);
$query = $CI->db->get();
if ($query->num_rows() > 0) {
$pages = $query->result_array();
if (!$options['page_content']) {
$link = '<a href="' . getinfo('siteurl') . 'page/';
$out .= '<ul class="mso-widget-list">' . NR;
foreach ($pages as $page) {
$out .= '<li>' . $link . $page['page_slug'] . '">' . $page['page_title'] . '</a>' . '</li>' . NR;
}
$out .= '</ul>' . NR;
} else {
$out .= '<div class="mso-random_pages">' . NR;
foreach ($pages as $page) {
$out .= '<div class="mso-random_pages-page">' . mso_hook('content', $page['page_content']) . '</div>' . NR;
}
$out .= '</div>' . NR;
}
if ($options['header']) {
$out = $options['header'] . $out;
}
}
return $out;
}
示例9: ushka
// $menu .= NR . '---';
// $menu .= NR . 'http://max-3000.com/page/faq | ЧАВО для новичков';
// $menu .= NR . 'http://max-3000.com/help | Центр помощи';
// $menu .= NR . 'http://forum.max-3000.com/ | Форум поддержки';
if (function_exists('ushka')) {
$menu .= NR . ushka('main-menu-admin');
}
$menu .= NR . '---';
$menu .= NR . 'logout | Выход | | | i-unlock';
$menu .= NR . ']';
} elseif (is_login_comuser()) {
$comuser = is_login_comuser();
$menu .= NR . '[';
if ($comuser['comusers_nik']) {
$menu .= NR . '# | ' . $comuser['comusers_nik'] . ' | Своя страница | | i-user';
} else {
$menu .= NR . '# | Ваши ссылки';
}
$menu .= NR . 'users/' . $comuser['comusers_id'] . ' | Своя страница';
$menu .= mso_hook('main_menu_add_comuser');
$menu .= NR . '---';
$menu .= NR . 'logout | Выход';
$menu .= NR . ']';
}
if ($menu) {
echo mso_menu_build($menu, 'selected', false);
}
?>
</ul></nav>
</div></div><!-- div.wrap div.MainMenu -->
示例10: mso_edit_page
//.........这里部分代码省略.........
$query = $CI->db->get();
if (!$query->num_rows()) {
// нет
$page_id_autor = 0;
}
if ($page_id_autor != $user_data['users_id']) {
if (!mso_check_allow('edit_page_author', $user_data['users_id'], false)) {
$page_id_autor = $user_data['users_id'];
}
}
$ins_data = array('page_type_id' => $page_type_id, 'page_id_parent' => $page_id_parent, 'page_id_autor' => $page_id_autor, 'page_title' => $page_title, 'page_content' => $page_content, 'page_status' => $page_status, 'page_slug' => $page_slug, 'page_password' => $page_password, 'page_comment_allow' => $page_comment_allow, 'page_ping_allow' => $page_ping_allow, 'page_feed_allow' => $page_feed_allow, 'page_last_modified' => $page_last_modified, 'page_menu_order' => $page_menu_order);
if ($page_date_publish) {
$ins_data['page_date_publish'] = $page_date_publish;
}
$CI->db->where(array('page_id' => $page_id));
$res = $CI->db->update('page', $ins_data) ? '1' : '0';
# $CI->db->cache_delete_all();
if ($res) {
$id = $page_id;
// добавим теперь рубрики
// вначале удалим все записи из рубрик с этим page_id
$CI->db->where(array('page_id' => $page_id, 'links_id' => '0'));
// чтобы линки не грохнуть
$CI->db->delete('cat2obj');
// рубрики указаны в виде номеров через запятую
$page_id_cat = isset($data['page_id_cat']) ? $data['page_id_cat'] : '';
$page_id_cat = mso_explode($page_id_cat);
// в массив
foreach ($page_id_cat as $key => $val) {
$ins_data = array('page_id' => $id, 'category_id' => $val);
$CI->db->insert('cat2obj', $ins_data);
# $CI->db->cache_delete_all();
}
// $page_tags = метка
// метки - это мета данные
// дефолтные данные
$def_data = array('meta_key' => 'tags', 'meta_id_obj' => $id, 'meta_table' => 'page');
// вначале грохнем старые, потом добавим новые
$CI->db->where($def_data);
$CI->db->delete('meta');
// получим существующие метки
$CI->db->select('meta_id');
$CI->db->where($def_data);
$query = $CI->db->get('meta');
if (!$query->num_rows()) {
// значит инсерт
$page_tags = isset($data['page_tags']) ? $data['page_tags'] : '';
$tags = mso_explode($page_tags, false, false);
// в массив - не только числа
foreach ($tags as $key => $val) {
$ins_data = $def_data;
$ins_data['meta_value'] = $val;
$CI->db->insert('meta', $ins_data);
# $CI->db->cache_delete_all();
}
}
// опции - мета
require_once getinfo('common_dir') . 'meta.php';
$page_meta_options = isset($data['page_meta_options']) ? $data['page_meta_options'] : '';
// title##VALUE##титул##METAFIELD##description##VALUE##описание##METAFIELD##keywords##VALUE##ключи##METAFIELD##
$page_meta_options = explode('##METAFIELD##', $page_meta_options);
// вначале удалим все мета этой записи
//$where_in = array(); // здесь meta_key
//foreach ($page_meta_options as $key=>$val)
//{
// if (trim($val))
// {
// $meta_temp = explode('##VALUE##', $val);
// $where_in[] = trim($meta_temp[0]);
// }
//}
// вначале грохнем старые, потом добавим новые
//$CI->db->where( array('meta_id_obj' => $id, 'meta_table' => 'page') );
//$CI->db->where_in('meta_key', $where_in );
//$CI->db->delete('meta');
// теперь тоже самое, только добавляем через insert
foreach ($page_meta_options as $key => $val) {
if (trim($val)) {
$meta_temp = explode('##VALUE##', $val);
$meta_key = trim($meta_temp[0]);
$meta_value = trim($meta_temp[1]);
mso_add_meta($meta_key, $id, 'page', $meta_value);
//$CI->db->insert('meta', array('meta_key'=>$meta_key, 'meta_value'=>$meta_value,
// 'meta_table' => 'page', 'meta_id_obj' => $id) );
}
}
// результат возвращается в виде массива
$res = array($id, $page_slug, $page_status, $page_password, $page_date_publish);
$response = array('result' => $res, 'description' => 'Updating page');
mso_flush_cache();
// сбросим кэш
} else {
$response = array('result' => 0, 'description' => 'Error inserting page');
}
if ($response['result']) {
mso_hook('edit_page', $response['result']);
mso_hook('edit_page_' . $page_status);
}
return $response;
}
示例11: mso_load_jquery
<link rel="stylesheet" href="<?php
echo $admin_css;
?>
">
<?php
echo $admin_css_profile;
echo mso_load_jquery();
mso_hook('admin_head');
mso_hook('admin_head_css');
?>
</head>
<body class="admin-<?php
echo mso_segment(2);
?>
"><?php
mso_hook('admin_body_start');
?>
<div class="visible-tablet-phone">
<div class="flex flex-wrap-phone flex-vcenter pad10-rl my-nav-panel-tablet">
<div class="flex-grow0 pad5-t">
<a href="http://max-3000.com/"><img src="<?php
echo $admin_template_url . 'assets/images/maxsitelogo.fw.png';
?>
" alt="" title="MaxSite CMS" class="mar10-b mar10-r"></a>
<a href="<?php
echo getinfo('site_url');
?>
" class="my-q-site" title="<?php
echo t('Переход к сайту');
?>
示例12: xml_sitemap_custom
//.........这里部分代码省略.........
$out .= $t . $t . '<priority>' . $options['freq_priority']['notblog']['priority'] . '</priority>' . NR;
$out .= $t . '</url>' . NR;
}
}
// страницы
$CI->db->select('page.page_id, page_slug, page_date_publish');
if (count($options['page_cats_hide']) > 0) {
$CI->db->join('cat2obj', 'cat2obj.page_id = page.page_id', 'left');
$CI->db->where_not_in('category_id', $options['page_cats_hide']);
}
if (count($options['page_hide']) > 0) {
$CI->db->where_not_in('page.page_id', $options['page_hide']);
}
$CI->db->where('page_type_name', 'blog');
$CI->db->where('page_status', 'publish');
$CI->db->where('page_date_publish < ', 'DATE_ADD(NOW(), INTERVAL "' . $tz . '" HOUR_MINUTE)', false);
$CI->db->join('page_type', 'page_type.page_type_id = page.page_type_id', 'left');
$CI->db->group_by('page.page_id');
$CI->db->order_by('page_date_publish', 'desc');
$query = $CI->db->get('page');
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
$date = str_replace(' ', 'T', $row['page_date_publish']) . $time_zone;
$out .= $t . '<url>' . NR;
$out .= $t . $t . '<loc>' . $url . 'page/' . $row['page_slug'] . '</loc>' . NR;
$out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
$out .= $t . $t . '<changefreq>' . $options['freq_priority']['blog']['changefreq'] . '</changefreq>' . NR;
$out .= $t . $t . '<priority>' . $options['freq_priority']['blog']['priority'] . '</priority>' . NR;
$out .= $t . '</url>' . NR;
}
}
// рубрики
if (count($options['categories_show']) > 0) {
$CI->db->or_where_in('category_id', $options['categories_show']);
}
$CI->db->where('category_type', 'page');
$query = $CI->db->get('category');
if ($query->num_rows() > 0) {
$date = date('Y-m-d') . 'T' . date('H:i:s') . $time_zone;
foreach ($query->result_array() as $row) {
// $date = str_replace(' ', 'T', date('Y-m-d')) . $time_zone;
$out .= $t . '<url>' . NR;
$out .= $t . $t . '<loc>' . $url . 'category/' . $row['category_slug'] . '</loc>' . NR;
$out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
$out .= $t . $t . '<changefreq>' . $options['freq_priority']['category']['changefreq'] . '</changefreq>' . NR;
$out .= $t . $t . '<priority>' . $options['freq_priority']['category']['priority'] . '</priority>' . NR;
$out .= $t . '</url>' . NR;
}
}
// все метки
if ($options['tags_show']) {
require_once getinfo('common_dir') . 'meta.php';
$alltags = mso_get_all_tags_page();
foreach ($alltags as $tag => $count) {
$out .= $t . '<url>' . NR;
$out .= $t . $t . '<loc>' . $url . 'tag/' . htmlentities(urlencode($tag)) . '</loc>' . NR;
$out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
$out .= $t . $t . '<changefreq>' . $options['freq_priority']['tag']['changefreq'] . '</changefreq>' . NR;
$out .= $t . $t . '<priority>' . $options['freq_priority']['tag']['priority'] . '</priority>' . NR;
$out .= $t . '</url>' . NR;
}
}
// и все комюзеры
if ($options['comusers_show']) {
$CI->db->select('comusers_id');
$query = $CI->db->get('comusers');
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
$out .= $t . '<url>' . NR;
$out .= $t . $t . '<loc>' . $url . 'users/' . $row['comusers_id'] . '</loc>' . NR;
$out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
$out .= $t . $t . '<changefreq>' . $options['freq_priority']['comuser']['changefreq'] . '</changefreq>' . NR;
$out .= $t . $t . '<priority>' . $options['freq_priority']['comuser']['priority'] . '</priority>' . NR;
$out .= $t . '</url>' . NR;
}
}
}
// и все юзеры
if ($options['users_show']) {
$CI->db->select('users_id');
$query = $CI->db->get('users');
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
$out .= $t . '<url>' . NR;
$out .= $t . $t . '<loc>' . $url . 'author/' . $row['users_id'] . '</loc>' . NR;
$out .= $t . $t . '<lastmod>' . $date . '</lastmod>' . NR;
$out .= $t . $t . '<changefreq>' . $options['freq_priority']['user']['changefreq'] . '</changefreq>' . NR;
$out .= $t . $t . '<priority>' . $options['freq_priority']['user']['priority'] . '</priority>' . NR;
$out .= $t . '</url>' . NR;
}
}
}
$out .= mso_hook('xml_sitemap');
# хук, если нужно добавить свои данные
$out .= NR . '</urlset>' . NR;
$fn = getinfo('FCPATH') . 'sitemap.xml';
write_file($fn, $out);
return $args;
// для обеспечения цепочки хуков
}
示例13: multipage_pagination
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'];
}
}
}
示例14: ushka
}
if ($fn = get_component_fn('default_footer_component5')) {
require $fn;
}
}
if (function_exists('ushka')) {
echo ushka('footer-end');
}
if (file_exists(getinfo('template_dir') . 'custom/footer-end.php')) {
require getinfo('template_dir') . 'custom/footer-end.php';
}
?>
</div><!-- div class="footer-wrap" -->
</div><!-- div class="footer" -->
</div><!-- div class="all-wrap" -->
</div><!-- div class="all" -->
<?php
if (file_exists(getinfo('template_dir') . 'custom/body-end.php')) {
require getinfo('template_dir') . 'custom/body-end.php';
}
?>
<?php
if (function_exists('ushka')) {
echo ushka('google_analytics');
echo ushka('body_end');
}
mso_hook('body_end');
?>
</body></html>
示例15: mso_load_jquery
<style type="text/css">
html .ddsmoothmenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->
<?php
echo mso_load_jquery();
?>
<?php
echo mso_load_jquery('ddsmoothmenu.js');
?>
<script type="text/javascript" src="<?php
echo $admin_scripts;
?>
"></script>
<?php
mso_hook('admin_head');
?>
</head>
<body>
<div id="container">
<div class="admin-header">
<div class="navline">
<h1><a href="<?php
echo getinfo('siteurl');
?>
"><?php
echo mso_get_option('name_site', 'general');
?>
</a> → <?php
echo $admin_header;