本文整理汇总了PHP中parse_smileys函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_smileys函数的具体用法?PHP parse_smileys怎么用?PHP parse_smileys使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_smileys函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Parse Textile
*
* Takes a string as input and parse the Textile
*
* @param string $str The string to be parsed
* @param bool $parse_smileys Parse the smileys or not
* @return string
*/
function parse($str, $clear = 0, $parse_smileys = FALSE)
{
$ci =& get_instance();
if (!class_exists('Textile')) {
$ci->load->library('Textile');
}
$str = htmlspecialchars_decode($str);
$str = $ci->textile->TextileThis($str);
if ($parse_smileys) {
// All this funky code applys smileys to anything OUTSIDE code blocks
preg_match_all('/<code>.*?<\\/code>/s', $str, $code_blocks, PREG_PATTERN_ORDER);
$block_num = 0;
foreach ($code_blocks[0] as $block) {
$str = str_replace($block, "{block_{$block_num}}", $str);
$block_num++;
}
$str = parse_smileys($str, image_url("smileys/"));
$block_num = 0;
foreach ($code_blocks[0] as $block) {
$str = str_replace("{block_{$block_num}}", $block, $str);
$block_num++;
}
}
$str = preg_replace('/<code>*\\s*/s', '<code>', $str);
return preg_replace('/\\s*<\\/code>/s', '</code>', $str);
}
示例2: post
public function post($year = NULL, $month = NULL, $day = NULL, $url_title = NULL)
{
$this->load->module_model('blog', 'comments_model', 'comments');
$this->load->module_model('blog', 'users_model', 'users');
if ($data['post'] = $this->blog->get_post_by_url($year, $month, $day, $url_title)) {
$data['post']['url'] = post_url($data['post']['url_title'], $data['post']['date_posted']);
$data['post']['display_name'] = $this->users->get_user_display_name($data['post']['author']);
if ($data['post']['allow_comments'] == 1) {
$this->comment($data['post']['id'], $data['post']['url']);
}
$data['comments'] = $this->comments->get_comments($data['post']['id']);
if ($data['comments'] != "") {
foreach ($data['comments'] as $key => $comment) {
$data['comments'][$key]['content'] = parse_bbcode(nl2br(parse_smileys($comment['content'], base_url() . 'application/views/admin/static/javascript/tiny_mce/plugins/emotions/img/')));
if ($comment['user_id'] != "") {
$website = $this->users->get_user_website($comment['user_id']);
$display_name = $this->users->get_user_display_name($comment['user_id']);
$data['comments'][$key]['author'] = '<a href="' . prep_url($website) . '" target="_blank">' . $display_name . '</a>';
} else {
if ($comment['author_website'] != "") {
$data['comments'][$key]['author'] = '<a href="' . prep_url($comment['author_website']) . '" target="_blank">' . $comment['author'] . '</a>';
}
}
}
}
$this->_template['page'] = 'blog/single_post';
} else {
$this->_template['page'] = 'errors/404';
}
$this->system_library->load($this->_template['page'], $data);
}
示例3: smiles_custom
function smiles_custom($content)
{
$CI =& get_instance();
$CI->load->helper('smiley');
$content = parse_smileys($content, getinfo('uploads_url') . 'smiles/');
return $content;
}
示例4: parse_bbcode
/**
* Parse bbCode
*
* Takes a string as input and replace bbCode by (x)HTML tags
*
* @access public
* @param string the text to be parsed
* @return string
*/
function parse_bbcode($str, $clear = 0, $parse_smileys = FALSE)
{
$bbcode_to_parse = _get_bbcode_to_parse_array();
if (FALSE === $bbcode_to_parse) {
return FALSE;
}
foreach ($bbcode_to_parse as $key => $val) {
for ($i = 1; $i <= $bbcode_to_parse[$key][2]; $i++) {
$str = preg_replace($key, $bbcode_to_parse[$key][$clear], $str);
}
}
$str = break_lines($str);
if ($parse_smileys) {
// All this funky code applys smileys to anything OUTSIDE code blocks
preg_match_all('/<code>.*?<\\/code>/s', $str, $code_blocks, PREG_PATTERN_ORDER);
$block_num = 0;
foreach ($code_blocks[0] as $block) {
$str = str_replace($block, "{block_{$block_num}}", $str);
$block_num++;
}
$str = parse_smileys($str, image_url("smileys/"));
$block_num = 0;
foreach ($code_blocks[0] as $block) {
$str = str_replace("{block_{$block_num}}", $block, $str);
$block_num++;
}
}
$str = preg_replace('/<code>*\\s*/s', '<code>', $str);
return preg_replace('/\\s*<\\/code>/s', '</code>', $str);
}
示例5: parse
/**
* Parse BBcode as HTML
* @param String $content
* @param Array $disabled_tools
* @return String
*/
public function parse($content, $disabled_tools = false)
{
$tools = $this->getTools($disabled_tools);
// Convert each tool output into bbcode
foreach ($tools as $tool) {
if (!empty($tool['parse']['regex_search']) && !empty($tool['parse']['regex_replace']) && $tool['enabled']) {
$content = preg_replace($tool['parse']['regex_search'], $tool['parse']['regex_replace'], $content);
}
}
// Re-create the line breaks
$content = nl2br($content);
// Convert space into actual HTML space
$content = preg_replace("/ /", " ", $content);
// Show emoticons
$content = parse_smileys($content, base_url() . $this->CI->config->item('smiley_path'));
return $content;
}
示例6: parse_string
public function parse_string($template, $data = array(), $return = FALSE, $config = array())
{
if (!is_array($config)) {
$config = array();
}
$config = array_merge($this->config, $config);
if ($config['image_url'] == '') {
$config['image_url'] = image_url('lib/smileys/');
}
$ci = $this->ci;
$is_mx = false;
if (!$return) {
list($ci, $is_mx) = $this->detect_mx();
}
$template = parse_smileys($template, (string) $config['image_url'], $config['smileys']);
return $this->output($template, $return, $ci, $is_mx);
}
示例7: updates
public function updates()
{
$new_exists = false;
$user_id = $this->authentication->read('identifier');
$last_seen = $this->last->get_by('user_id', $user_id);
$last_seen = empty($last_seen) ? 0 : $last_seen->message_id;
$exists = $this->message->latest_message($user_id, $last_seen);
//echo $exists;
if ($exists) {
$new_exists = true;
}
// THIS WHOLE SECTION NEED A GOOD OVERHAUL TO CHANGE THE FUNCTIONALITY
if ($new_exists) {
$new_messages = $this->message->unread($user_id);
$thread = array();
$senders = array();
foreach ($new_messages as $message) {
if (!isset($senders[$message->from])) {
$senders[$message->from]['count'] = 1;
} else {
$senders[$message->from]['count'] += 1;
}
$owner = $this->user->get($message->from);
$chat = array('msg' => $message->id, 'sender' => $message->from, 'recipient' => $message->to, 'avatar' => $owner->avatar != '' ? $owner->avatar : 'no-image.jpg', 'body' => parse_smileys($message->message, $this->smiley_url), 'time' => date("M j, Y, g:i a", strtotime($message->time)), 'type' => $message->from == $user_id ? 'out' : 'in', 'name' => $message->from == $user_id ? 'You' : ucwords($owner->firstname));
array_push($thread, $chat);
}
$groups = array();
foreach ($senders as $key => $sender) {
$sender = array('user' => $key, 'count' => $sender['count']);
array_push($groups, $sender);
}
// END OF THE SECTION THAT NEEDS OVERHAUL DESIGN
$this->last->update_lastSeen($user_id);
$response = array('success' => true, 'messages' => $thread, 'senders' => $groups);
//add the header here
header('Content-Type: application/json');
echo json_encode($response);
}
}
示例8: auteur_du_potin
// On récupère le message
// On cherche l'auteur du potin
include_once 'modele/infos_potin.php';
$auteur_potin = auteur_du_potin($_POST['id_Potin'], $bdd);
if ($auteur_potin != $id_user) {
// Notification à l'auteur du potin
include_once 'modele/notifications.php';
if (!notif_existe_deja($auteur_potin, 'comment_mypotin', $_POST['id_Potin'], 0, $bdd)) {
nouvelle_notif($auteur_potin, 'comment_mypotin', $_POST['id_Potin'], 0, $bdd);
}
}
// On cherche tous les commentateurs du potin
include_once 'modele/commentaires.php';
$auteurs_com = qui_a_commente_potin($_POST['id_Potin'], $bdd);
if ($auteurs_com != 'erreur_nocom') {
// Notification à tous ceux qui ont commenté, sauf l'auteur du potin
foreach ($auteurs_com as $key => $auteur_courant) {
if ($auteur_courant != $id_user && $auteur_courant != $auteur_potin) {
include_once 'modele/notifications.php';
if (!notif_existe_deja($auteur_courant, 'reply_comment', $_POST['id_Potin'], 0, $bdd)) {
nouvelle_notif($auteur_courant, 'reply_comment', $_POST['id_Potin'], 0, $bdd);
}
}
}
}
// On écrit le commentaire dans la bdd
$req = $bdd->prepare('INSERT INTO commentaires(id_auteur, id_potin, date_com, texte) VALUES(?, ?, NOW(), ?)');
$req->execute(array($id_user, $_POST['id_Potin'], $_POST['comment']));
}
echo '<p><span class="fa fa-comment-o" style="color:grey;" aria-hidden="true"></span> ' . parse_smileys(str_replace("\n", "<br/>", $commentaire)) . '</p>';
示例9: parse_smileys
<?php
}
?>
<h2><?php
echo $album;
?>
<small><?php
echo $num_photos;
?>
photos</small></h2>
<div id="intro">
<p><?php
echo parse_smileys(nl2br($full_txt), base_url() . '/assets/i/smileys/');
?>
</p>
</div>
<?php
foreach ($query->result() as $row) {
$img = '<img src="' . base_url() . $row->photo . '_thumb' . $row->photo_type . '" alt="' . $row->name . '" />';
?>
<div class="photo">
<div class="frame">
<?php
echo anchor(base_url() . $row->photo . '_mid' . $row->photo_type, $img, array('class' => 'frame', 'rel' => 'lightbox-album', 'title' => $row->name));
?>
示例10: vue_affichage_potin
function vue_affichage_potin($potin_courant, $id_user, $bdd)
{
include_once 'controleur/includes/fonctions/parse_smiley.php';
include_once 'modele/infos_potin.php';
include_once 'modele/requetes_vote.php';
include_once 'modele/commentaires.php';
include_once 'modele/contenu_vu.php';
// Si on n'avait pas vu ce potin
if (!contenu_deja_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd)) {
// On l'enregistre comme vu
new_contenu_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd);
}
$resultat = '';
$resultat .= '<div class="col-xs-12 col-potin-test" id="potin-' . $potin_courant['id_Potin'] . '" typePotin="v3">
<div class="row row-potin-test">
<div class="potin-g-test">';
if ($potin_courant['id_auteur'] == $id_user) {
$resultat .= '<div class="dropdown dropdown-potin">
<span id="dLabel" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</span>
<ul class="dropdown-menu dropdown-potin-menu" role="menu" aria-labelledby="dLabel">
<li><a class="drop-supprimer-potin" idPotin="' . $potin_courant['id_Potin'] . '" href="#">Supprimer</a></li>
</ul>
</div>';
}
$resultat .= '<div class="potin-potin">
<h4>';
$nom_concernes = explode(',', $potin_courant['concernes']);
$id_concernes = explode(',', $potin_courant['id_Concernes']);
$nb_concernes = count($nom_concernes);
$resultat .= 'Sur ';
for ($i = 0; $i < $nb_concernes - 1; $i++) {
//index.php?page=page_membre&id_concerne=3&onglet=potins
$resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $id_concernes[$i] . '&onglet=potins">' . htmlspecialchars($nom_concernes[$i]) . '</a>';
if ($i == $nb_concernes - 2) {
$resultat .= ' et ';
} else {
$resultat .= ', ';
}
}
$resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $id_concernes[$i] . '&onglet=potins">' . htmlspecialchars($nom_concernes[$nb_concernes - 1]) . '</a>';
$resultat .= ' dans <a href="' . INDEX . '?page=groupe&id_groupe=' . $potin_courant['id_Groupe'] . '">' . htmlspecialchars($potin_courant['nom_groupe']) . '</a>';
$resultat .= '</h4>
<h5>';
$resultat .= 'Quelqu\'un a écrit, le ' . htmlspecialchars($potin_courant['nom_jour_potin']) . ' ' . htmlspecialchars($potin_courant['jour_potin']) . ' ' . htmlspecialchars($potin_courant['mois_potin']) . ' ' . htmlspecialchars($potin_courant['annee_potin']) . '<br>';
$resultat .= '</h5>
<p>' . parse_smileys(str_replace("\n", "<br/>", $potin_courant['Potin'])) . '</p>
<p>';
// Affichage de l'image, si il y en a une
if ($potin_courant['Image'] != '') {
$resultat .= '<img class="image-potin-test" src="' . $potin_courant['Image'] . '" alt="Photo du potin"/>';
} else {
$resultat .= '<br>';
}
$resultat .= '</p>
</div>';
// On détermine la véracité du potin
switch (resultat_vote($potin_courant['id_Potin'], $bdd)) {
case 'sur':
$resv_css = 'sur';
$resv_text = 'C\'est sûr !';
$resultat .= '<br>';
// On ajoute un espacement
break;
case 'possible':
$resv_css = 'possible';
$resv_text = 'C\'est possible.';
$resultat .= '<br>';
break;
case 'surement_faux':
$resv_css = 'surement_faux';
$resv_text = 'C\'est sûrement faux ...';
$resultat .= '<br>';
break;
case 'faux':
$resv_css = 'faux';
$resv_text = 'C\'est faux !';
$resultat .= '<br>';
break;
case 'calomnie':
$resv_css = 'calomnie';
$resv_text = 'Ce n\'est que pure calomnie !';
$resultat .= '<br>';
break;
default:
$resv_css = 'none';
$resv_text = '';
break;
}
$resultat .= '<div class="potin-vote-wrapper">';
// Affichage de la véracité du potin
//.........这里部分代码省略.........
示例11: getPost
function getPost()
{
if ($this->tank_auth->is_logged_in()) {
$user_id = $this->tank_auth->get_user_id();
} else {
$user_id = 1;
}
$PostId = $_POST['str'];
$data['get_post_by_id'] = $this->post_model->get_post_by_id($PostId);
$noofcomment = $this->post_model->get_Nocomment_by_Postid($PostId);
foreach ($data['get_post_by_id'] as $value) {
if ($value->postBG != "") {
$style = "width:558px;height:61px;padding:20px;word-wrap:break-word;color:#fff;background-image:url('" . asset_url() . "img/bg/" . $value->postBG . "')";
} else {
$style = "width:558px;height:61px;padding:20px;word-wrap:break-word;";
}
//we can add gender after username in comment by adding this line (<small><a href='#'>Gender</a></small>)
$show = "\n\t <div class='modal-dialog'>\n <div class='modal-content'>\n <div class='modal-header'>\n <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>\n <h4 class='modal-title text-primary'><a type='button' class='btn btn-primary btn-circle'><i class='fa fa-comment'></i></a> \t\t\t\t\t\t\t\t <strong>POST</strong></h4>\n </div>\n \n <div class='modal-body'>\n <h3 class='timeline-header'><a href='#'>" . $value->categories_name . "</a> By " . $value->username . "</h3>\n <div class='timeline-body text-center' style=" . $style . "> " . parse_smileys($value->postContent, asset_url() . "smileys/") . "</div> \n\t\t\t\t\t\t\t\t\t\t <!-- Chat box -->\n <div class='box box-success'>\n <div class='box-header'> \n <span style='margin-top:6px;' class='btn btn-primary btn-circle pull-left' ><i class='fa fa-comments'></i></span>\n <h3 class='box-title'> Comments</h3>\n </div>\n\t\t\t\t\t\t\t\t<div class='box-body chat scroll' id='chat-box'><!--open chat item -->";
if ($noofcomment > 0) {
$data['getCommentBYPostId'] = $this->post_model->get_comment_by_Postid($PostId);
foreach ($data['getCommentBYPostId'] as $commentvalue) {
$date = explode(' ', $commentvalue->commentAt);
$userimg = $commentvalue->user_image;
if ($userimg == '') {
$userpath = "img/avatar3.png";
} else {
$userpath = "img/profile_pics/" . $userimg;
}
$show .= "<div class='item'>\n <img src='" . asset_url() . $userpath . "' alt='user image' class='offline'/>\n <p class='message'>\n <a href='#' class='name'>\n <small class='text-muted pull-right'><i class='fa fa-clock-o'></i> " . $date[1] . "</small>\n " . $commentvalue->username . "\n </a>\n " . $commentvalue->commentText . "\n </p>\n </div>";
}
}
$show .= "</div>\n\t\t\t <div class='box-footer'>\n\t\t\t <form action='" . base_url() . "Posts/doComment' method='post' onclick='return getlocaltimeComment()'>\n <div class='input-group'>\n\t\t\t\t\t\t\t\t\t<input type='hidden' name='gettimeComment' id='gettimeComment' value=''/>\n <input type='hidden' name='userid' id='userid' value='" . $user_id . "'/>\n <input type='hidden' name='postid' id='postid' value='" . $PostId . "'/>\n <input class='form-control' name='commentText' type='text' placeholder='Type comment...'/>\n <div class='input-group-btn'>\n <button type='submit' class='btn btn-success'><i class='fa fa-plus'></i></button>\n </div>\n </div></form>\n </div><!-- /.footer -->\n </div><!-- /.box (chat box) -->\n </div>\n \n </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->";
echo $show;
}
}
示例12: get_all_data
/**
*
*
* @global string $db_url
* @global dom $dom
* @param boolean $parse_smileys Defaults to TRUE
* @param boolean $filter_words Defaults to FALSE
* @param boolean $processUsername Defaults to FALSE
* @param boolean $processTime Defaults to FALSE
* @param boolean $apply_filter Defaults to TRUE
* @return array
*/
function get_all_data($parse_smileys = true, $filter_words = false, $processUsername = false, $processTime = false, $apply_filter = true)
{
global $db_url;
global $dom;
$db = YDB::factory($db_url);
$data = array();
$data = $db->queryAll(parse_tbprefix("SELECT p.pid AS id, p.ip AS ip , p.uid AS uid ,p.uname AS uname,p.content AS post_content,p.post_time AS time,r.content AS reply_content,r.r_time AS reply_time ,u.username AS b_username FROM <post> AS p LEFT JOIN <reply> AS r ON p.pid=r.pid LEFT JOIN <sysuser> AS u ON p.uid=u.uid ORDER BY p.post_time DESC"));
foreach ($data as &$_data) {
if ($apply_filter && ZFramework::app()->filter_type == ConfigController::FILTER_TRIPTAGS) {
if (strstr(ZFramework::app()->allowed_tags, 'code')) {
$_data['post_content'] = preg_replace_callback('|<code>(.*)</code>|sU', create_function('$matches', 'return "<pre class=\'prettyprint\'>".str_replace(">",">",str_replace("<","<",$matches[1]))."</pre>";'), $_data['post_content']);
$_data['reply_content'] = preg_replace_callback('|<code>(.*)</code>|sU', create_function('$matches', 'return "<pre class=\'prettyprint\'>".str_replace(">",">",str_replace("<","<",$matches[1]))."</pre>";'), $_data['reply_content']);
if (!strstr(ZFramework::app()->allowed_tags, 'pre')) {
ZFramework::app()->allowed_tags .= "<pre>";
}
}
$_data['post_content'] = strip_tags($_data['post_content'], ZFramework::app()->allowed_tags);
$_data['reply_content'] = strip_tags($_data['reply_content'], ZFramework::app()->allowed_tags);
} else {
$_data['post_content'] = htmlentities($_data['post_content'], ENT_COMPAT, 'UTF-8');
$_data['reply_content'] = htmlentities($_data['reply_content'], ENT_COMPAT, 'UTF-8');
}
if ($parse_smileys) {
$dom->loadHTML($_data['post_content']);
$_data['post_content'] = html_entity_decode(parse_smileys($_data['post_content'], SMILEYDIR, getSmileys()));
if ($_data['reply_content']) {
$dom->loadHTML($_data['reply_content']);
$_data['reply_content'] = html_entity_decode(parse_smileys($_data['reply_content'], SMILEYDIR, getSmileys()));
}
}
if ($filter_words) {
$_data['post_content'] = filter_words($_data['post_content']);
}
if ($processUsername) {
$_data['user'] = $_data['uname'] == ZFramework::app()->admin ? "<font color='red'>{$_data['uname']}</font>" : $_data['uname'];
}
if ($processTime) {
$_data['time'] = date('m-d H:i', $_data['time'] + ZFramework::app()->timezone * 60 * 60);
$_data['reply_time'] = date('m-d H:i', $_data['reply_time'] + ZFramework::app()->timezone * 60 * 60);
}
}
return $data;
}
示例13: postParse
function postParse($message, $smileys = 1)
{
$message = parse_bbcode($message);
if ($smileys) {
$message = parse_smileys($message);
}
$message = nl2br(stripslashes($message));
return $message;
}
示例14: parse_smileys
</section>
</section>
<div id="fadeandscale" style="">
<div class="box">
<div id="type">
<h3>What's New</h3>
<?php
$str = '
-> Improved User Interface :)<br>
-> More Secure than ever. :coolsmile:<br>
-> One password for all sub-domains. All logins will now have<br>
same username and password. :cheese:<br>
-> Added Forgot Password functionality. :question:<br>
-> Performance Enhancements. Browse faster and better. :coolhmm:<br>
-> Bugs or Issues? Drop an email: saurabhgarg510@gmail.com 8-/';
$str = parse_smileys($str, base_url() . 'public/smileys');
echo $str;
?>
</div>
</div>
</div>
<!-- Include jQuery Popup Overlay -->
<script src="<?php
echo base_url();
?>
public/js/jquery.popupoverlay.js"></script>
<script>
$(document).ready(function() {
// Initialize the plugin
$('#fadeandscale').popup({
示例15: parse_smileys
echo $ins_id;
?>
">X</a></p>
<div class="imageUnit-content">
<h4><a href="#" ><?php
echo $fulln;
?>
</a></h4>
<p>0 sec ago</p>
</div>
</div>
<p class="msg_wrap"><?php
echo parse_smileys(make_clickable(nl2br(stripslashes($message))), $smiley_folder);
?>
</p>
<?php
if (!empty($video)) {
?>
<iframe width="400" height="300" src="http://www.youtube.com/embed/<?php
echo get_youtubeid($video);
?>
" frameborder="0" allowfullscreen></iframe>
<?php
} elseif (!empty($image)) {
?>
<img src="<?php
echo $base_url;
?>