当前位置: 首页>>代码示例>>PHP>>正文


PHP bbcode::parse_only_smilies方法代码示例

本文整理汇总了PHP中bbcode::parse_only_smilies方法的典型用法代码示例。如果您正苦于以下问题:PHP bbcode::parse_only_smilies方法的具体用法?PHP bbcode::parse_only_smilies怎么用?PHP bbcode::parse_only_smilies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bbcode的用法示例。


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

示例1: generate_text_for_display

/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $only_smileys = false, $censor = true, $acro_autolinks = false, $forum_id = '999999')
{
    global $bbcode, $config, $user;
    if (empty($text)) {
        return '';
    }
    if (defined('IS_ICYPHOENIX') && $censor) {
        $text = censor_text($text);
    }
    if (!class_exists('bbcode') || empty($bbcode)) {
        include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
    }
    if (empty($bbcode)) {
        $bbcode = new bbcode();
        if (!$user->data['session_logged_in']) {
            $user->data['user_allowhtml'] = $config['allow_html'] ? true : false;
            $user->data['user_allowbbcode'] = $config['allow_bbcode'] ? true : false;
            $user->data['user_allowsmile'] = $config['allow_smilies'] ? true : false;
        }
        $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? true : false;
        $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? true : false;
        $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? true : false;
    }
    if ($only_smileys) {
        $text = $bbcode->parse_only_smilies($text);
    } else {
        $text = $bbcode->parse($text);
        if ($acro_autolinks) {
            $text = $bbcode->acronym_pass($text);
            $text = $bbcode->autolink_text($text, $forum_id);
        }
    }
    return $text;
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:38,代码来源:functions_bbcode.php

示例2: get_event_topics


//.........这里部分代码省略.........
    if ($limit) {
        $db->sql_freeresult($result);
        $sql .= " LIMIT {$start}, {$max_limit}";
        $result = $db->sql_query($sql);
    }
    $bbcode->allow_html = $user->data['user_allowhtml'] && $config['allow_html'] ? 1 : 0;
    $bbcode->allow_bbcode = $user->data['user_allowbbcode'] && $config['allow_bbcode'] ? 1 : 0;
    $bbcode->allow_smilies = $user->data['user_allowsmile'] && $config['allow_smilies'] ? 1 : 0;
    // read the items
    while ($row = $db->sql_fetchrow($result)) {
        // prepare the message
        $topic_author_id = $row['poster_id'];
        $topic_author = $row['poster_id'] == ANONYMOUS ? $row['post_username'] : $row['username'];
        $topic_time = $row['topic_time'];
        $topic_last_author_id = $row['lp_poster_id'];
        $topic_last_author = $row['lp_poster_id'] == ANONYMOUS ? $row['lp_post_username'] : $row['lp_username'];
        $topic_last_time = $row['lp_post_time'];
        $topic_views = $row['topic_views'];
        $topic_replies = $row['topic_replies'];
        $topic_icon = $row['topic_icon'];
        $topic_title = $row['topic_title'];
        $message = htmlspecialchars($row['post_text']);
        $topic_calendar_time = $row['topic_calendar_time'];
        $topic_calendar_duration = $row['topic_calendar_duration'];
        $topic_link = append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $row['topic_id']);
        $topic_title = censor_text($topic_title);
        $message = censor_text($message);
        $short_title = strlen($topic_title) > $topic_title_length + 3 ? substr($topic_title, 0, $topic_title_length) . '...' : $topic_title;
        // Convert and clean special chars!
        $topic_title = htmlspecialchars_clean($topic_title);
        $short_title = htmlspecialchars_clean($short_title);
        // SMILEYS IN TITLE - BEGIN
        if ($config['smilies_topic_title'] && !$lofi) {
            $topic_title = $bbcode->parse_only_smilies($topic_title);
            $short_title = $bbcode->parse_only_smilies($short_title);
        }
        // SMILEYS IN TITLE - END
        $dsp_topic_icon = '';
        if (function_exists('get_icon_title')) {
            $dsp_topic_icon = get_icon_title($topic_icon, 0, POST_CALENDAR);
        }
        // parse the message
        $message = substr($message, 0, $topic_text_length);
        // remove HTML if not allowed
        if (!$config['allow_html'] && $row['enable_html']) {
            $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
        }
        $message = $bbcode->parse($message);
        // get the date format
        $fmt = $lang['DATE_FORMAT_CALENDAR'];
        if (!empty($topic_calendar_duration)) {
            $fmt = $config['default_dateformat'];
        }
        // replace \n with <br />
        //$message = preg_replace("/[\n\r]{1,2}/", '<br />', $message);
        // build the overview
        $sav_tpl = $template->_tpldata;
        $det_handler = '_overview_topic_' . $row['topic_id'];
        $template->set_filenames(array($det_handler => 'calendar_overview_topic.tpl'));
        $nav_desc = '';
        if ($cat_hierarchy) {
            $nav_desc = make_cat_nav_tree(POST_FORUM_URL . $row['forum_id'], '', '', 'gensmall');
        } else {
            $nav_desc = '<a href="' . append_sid(IP_ROOT_PATH . CMS_PAGE_VIEWFORUM . '?' . POST_FORUM_URL . '=' . $row['forum_id']) . '" class="gensmall">' . $row['forum_name'] . '</a>';
        }
        $template->assign_vars(array('L_CALENDAR_EVENT' => $lang['Calendar_event'], 'L_AUTHOR' => $lang['Author'], 'L_TOPIC_DATE' => $lang['Date'], 'L_FORUM' => $lang['Forum'], 'L_VIEWS' => $lang['Views'], 'L_REPLIES' => $lang['Replies'], 'TOPIC_TITLE' => $dsp_topic_icon . '&nbsp;' . $topic_title, 'CALENDAR_EVENT' => get_calendar_title_date($topic_calendar_time, $topic_calendar_duration), 'AUTHOR' => $topic_author, 'TOPIC_DATE' => create_date($user->data['user_dateformat'], $topic_time, $config['board_timezone']), 'NAV_DESC' => $nav_desc, 'CALENDAR_MESSAGE' => $message, 'VIEWS' => $topic_views, 'REPLIES' => $topic_replies));
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:67,代码来源:functions_calendar.php

示例3: empty

 function generate_topic_title($topic_id, $topic_data, $max_title_length)
 {
     global $config, $bbcode, $lang, $lofi;
     $max_title_length = (int) $max_title_length > 255 || $max_title_length < 15 ? 255 : $max_title_length;
     $topic_title = censor_text($topic_data['topic_title']);
     $topic_title_clean = empty($topic_data['topic_title_clean']) ? substr(ip_clean_string($topic_title, $lang['ENCODING']), 0, 254) : $topic_data['topic_title_clean'];
     if (empty($topic_data['topic_title_clean'])) {
         if (!function_exists('update_clean_topic_title')) {
             @(include_once IP_ROOT_PATH . 'includes/functions_topics.' . PHP_EXT);
         }
         update_clean_topic_title($topic_id, $topic_title_clean);
     }
     $topic_title_prefix = empty($topic_data['title_compl_infos']) ? '' : trim($topic_data['title_compl_infos']) . ' ';
     // Convert and clean special chars!
     $topic_title = htmlspecialchars_clean($topic_title);
     // SMILEYS IN TITLE - BEGIN
     if ($config['smilies_topic_title'] == true && !$lofi) {
         if (!class_exists('bbcode')) {
             include IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
         }
         if (empty($bbcode)) {
             $bbcode = new bbcode();
         }
         $bbcode->allow_smilies = $config['allow_smilies'] && $topic_data['enable_smilies'] ? true : false;
         $topic_title = $bbcode->parse_only_smilies($topic_title);
     }
     // SMILEYS IN TITLE - END
     $topic_title = $topic_title_prefix . $topic_title;
     $topic_title_plain = htmlspecialchars(strip_tags($topic_title));
     $topic_title_short = $topic_title;
     if (strlen($topic_title) > $max_title_length - 3) {
         // remove tags from the short version, in case a smiley or a quick title prefix is in there
         $topic_title_short = substr(strip_tags($topic_title), 0, intval($max_title_length)) . '...';
     }
     $topic_title_data = array('title' => $topic_title, 'title_clean' => $topic_title_clean, 'title_plain' => $topic_title_plain, 'title_prefix' => $topic_title_prefix, 'title_short' => $topic_title_short);
     return $topic_title_data;
 }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:37,代码来源:class_topics.php


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