本文整理汇总了PHP中format_event_html函数的典型用法代码示例。如果您正苦于以下问题:PHP format_event_html函数的具体用法?PHP format_event_html怎么用?PHP format_event_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_event_html函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bbtovcal
function bbtovcal($s)
{
$o = '';
$ev = bbtoevent($s);
if ($ev['description']) {
$o = format_event_html($ev);
}
return $o;
}
开发者ID:Mauru,项目名称:red,代码行数:9,代码来源:event.php
示例2: get
//.........这里部分代码省略.........
}
$nextyear = $y;
$nextmonth = $m + 1;
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear++;
}
$prevyear = $y;
if ($m > 1) {
$prevmonth = $m - 1;
} else {
$prevmonth = 12;
$prevyear--;
}
$dim = get_dim($y, $m);
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
if (argv(2) === 'json') {
if (x($_GET, 'start')) {
$start = $_GET['start'];
}
if (x($_GET, 'end')) {
$finish = $_GET['end'];
}
}
$start = datetime_convert('UTC', 'UTC', $start);
$finish = datetime_convert('UTC', 'UTC', $finish);
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
if (x($_GET, 'id')) {
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n\t from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d {$sql_extra} limit 1", intval($channel['channel_id']), intval($_GET['id']));
} else {
// fixed an issue with "nofinish" events not showing up in the calendar.
// There's still an issue if the finish date crosses the end of month.
// Noting this for now - it will need to be fixed here and in Friendica.
// Ultimately the finish date shouldn't be involved in the query.
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n\t from event left join item on event_hash = resource_id \n\t\t\t\t\twhere resource_type = 'event' and event.uid = %d {$ignored} \n\t\t\t\t\tAND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) \n\t\t\t\t\tOR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) {$sql_extra} ", intval($channel['channel_id']), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
}
$links = array();
if ($r) {
xchan_query($r);
$r = fetch_post_tags($r, true);
$r = sort_by_date($r);
}
if ($r) {
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'j') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'j');
if (!x($links, $j)) {
$links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j;
}
}
}
$events = array();
$last_date = '';
$fmt = t('l, F j');
if ($r) {
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'j') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'j');
$d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], $fmt) : datetime_convert('UTC', 'UTC', $rr['dtstart'], $fmt);
$d = day_translate($d);
$start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c');
if ($rr['nofinish']) {
$end = null;
} else {
$end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c');
}
$is_first = $d !== $last_date;
$last_date = $d;
$edit = false;
$drop = false;
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
if (!$title) {
list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
$title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
}
$html = format_event_html($rr);
$rr['desc'] = bbcode($rr['desc']);
$rr['location'] = bbcode($rr['location']);
$events[] = array('id' => $rr['id'], 'hash' => $rr['event_hash'], 'start' => $start, 'end' => $end, 'drop' => $drop, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('Link to Source'), '', ''));
}
}
if (argv(2) === 'json') {
echo json_encode($events);
killme();
}
// links: array('href', 'text', 'extra css classes', 'title')
if (x($_GET, 'id')) {
$tpl = get_markup_template("event_cal.tpl");
} else {
$tpl = get_markup_template("events_cal-js.tpl");
}
$nick = $channel['channel_address'];
$o = replace_macros($tpl, array('$baseurl' => z_root(), '$new_event' => array(z_root() . '/cal', $event_id ? t('Edit Event') : t('Create Event'), '', ''), '$previus' => array(z_root() . "/cal/{$nick}/{$prevyear}/{$prevmonth}", t('Previous'), '', ''), '$next' => array(z_root() . "/cal/{$nick}/{$nextyear}/{$nextmonth}", t('Next'), '', ''), '$export' => array(z_root() . "/cal/{$nick}/{$y}/{$m}/export", t('Export'), '', ''), '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events, '$upload' => t('Import'), '$submit' => t('Submit'), '$prev' => t('Previous'), '$next' => t('Next'), '$today' => t('Today'), '$form' => $form, '$expandform' => x($_GET, 'expandform') ? true : false, '$tabs' => $tabs));
if (x($_GET, 'id')) {
echo $o;
killme();
}
return $o;
}
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:101,代码来源:Cal.php
示例3: bbcode
//.........这里部分代码省略.........
// Try to Oembed
if ($tryoembed) {
$Text = preg_replace("/\\[video\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4))\\[\\/video\\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text);
$Text = preg_replace("/\\[audio\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4|mp3))\\[\\/audio\\]/ism", '<audio src="$1" controls="controls"><a href="$1">$1</a></audio>', $Text);
$Text = preg_replace_callback("/\\[video\\](.*?)\\[\\/video\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[audio\\](.*?)\\[\\/audio\\]/ism", 'tryoembed', $Text);
} else {
$Text = preg_replace("/\\[video\\](.*?)\\[\\/video\\]/", '<a href="$1" target="_blank">$1</a>', $Text);
$Text = preg_replace("/\\[audio\\](.*?)\\[\\/audio\\]/", '<a href="$1" target="_blank">$1</a>', $Text);
}
// html5 video and audio
if ($tryoembed) {
$Text = preg_replace("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", '<iframe src="$1" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></iframe>', $Text);
} else {
$Text = preg_replace("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", '<a href="$1">$1</a>', $Text);
}
// Youtube extensions
if ($tryoembed) {
$Text = preg_replace_callback("/\\[youtube\\](https?:\\/\\/www.youtube.com\\/watch\\?v\\=.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[youtube\\](www.youtube.com\\/watch\\?v\\=.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[youtube\\](https?:\\/\\/youtu.be\\/.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
}
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/www.youtube.com\\/watch\\?v\\=(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/www.youtube.com\\/embed\\/(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/youtu.be\\/(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
if ($tryoembed) {
$Text = preg_replace("/\\[youtube\\]([A-Za-z0-9\\-_=]+)(.*?)\\[\\/youtube\\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="https://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
} else {
$Text = preg_replace("/\\[youtube\\]([A-Za-z0-9\\-_=]+)(.*?)\\[\\/youtube\\]/ism", '<a href="https://www.youtube.com/watch?v=$1" target="_blank">https://www.youtube.com/watch?v=$1</a>', $Text);
}
if ($tryoembed) {
$Text = preg_replace_callback("/\\[vimeo\\](https?:\\/\\/player.vimeo.com\\/video\\/[0-9]+).*?\\[\\/vimeo\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[vimeo\\](https?:\\/\\/vimeo.com\\/[0-9]+).*?\\[\\/vimeo\\]/ism", 'tryoembed', $Text);
}
$Text = preg_replace("/\\[vimeo\\]https?:\\/\\/player.vimeo.com\\/video\\/([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '[vimeo]$1[/vimeo]', $Text);
$Text = preg_replace("/\\[vimeo\\]https?:\\/\\/vimeo.com\\/([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '[vimeo]$1[/vimeo]', $Text);
if ($tryoembed) {
$Text = preg_replace("/\\[vimeo\\]([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="https://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
} else {
$Text = preg_replace("/\\[vimeo\\]([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '<a href="https://vimeo.com/$1" target="_blank">https://vimeo.com/$1</a>', $Text);
}
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
// oembed tag
$Text = oembed_bbcode2html($Text);
// Avoid triple linefeeds through oembed
$Text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span><br />", $Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
// Replace the event-start section with the entire formatted event. The other bbcode is stripped.
// Summary (e.g. title) is required, earlier revisions only required description (in addition to
// start which is always required). Allow desc with a missing summary for compatibility.
if ((x($ev, 'desc') || x($ev, 'summary')) && x($ev, 'start')) {
$sub = format_event_html($ev, $simplehtml);
$Text = preg_replace("/\\[event\\-summary\\](.*?)\\[\\/event\\-summary\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-description\\](.*?)\\[\\/event\\-description\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-start\\](.*?)\\[\\/event\\-start\\]/ism", $sub, $Text);
$Text = preg_replace("/\\[event\\-finish\\](.*?)\\[\\/event\\-finish\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-location\\](.*?)\\[\\/event\\-location\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-adjust\\](.*?)\\[\\/event\\-adjust\\]/ism", '', $Text);
}
//replace oneliner <code> with <key>
$Text = preg_replace_callback("|(?!<br[^>]*>)<code>([^<]*)</code>(?!<br[^>]*>)|ism", 'bb_onelinecode_cb', $Text);
// Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
$Text = preg_replace_callback("/\\[noparse\\](.*?)\\[\\/noparse\\]/ism", 'bb_unspacefy_and_trim', $Text);
$Text = preg_replace_callback("/\\[nobb\\](.*?)\\[\\/nobb\\]/ism", 'bb_unspacefy_and_trim', $Text);
$Text = preg_replace_callback("/\\[pre\\](.*?)\\[\\/pre\\]/ism", 'bb_unspacefy_and_trim', $Text);
$Text = preg_replace('/\\[\\&\\;([#a-z0-9]+)\\;\\]/', '&$1;', $Text);
$Text = preg_replace('/\\&\\#039\\;/', '\'', $Text);
$Text = preg_replace('/\\"\\;/', '"', $Text);
// fix any escaped ampersands that may have been converted into links
$Text = preg_replace("/\\<([^>]*?)(src|href)=(.*?)\\&\\;(.*?)\\>/ism", '<$1$2=$3&$4>', $Text);
$Text = preg_replace("/\\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|gopher|cid)(.*?)\\>/ism", '<$1$2="">', $Text);
if ($saved_image) {
$Text = bb_replace_images($Text, $saved_image);
}
// Clean up the HTML by loading and saving the HTML with the DOM.
// Bad structured html can break a whole page.
// For performance reasons do it only with ativated item cache or at export.
if (!$tryoembed or get_itemcachepath() != "") {
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8");
$doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">';
$encoding = '<?xml encoding="UTF-8">';
@$doc->loadHTML($encoding . $doctype . "<html><body>" . $Text . "</body></html>");
$doc->encoding = 'UTF-8';
$Text = $doc->saveHTML();
$Text = str_replace(array("<html><body>", "</body></html>", $doctype, $encoding), array("", "", "", ""), $Text);
$Text = str_replace('<br></li>', '</li>', $Text);
//$Text = mb_convert_encoding($Text, "UTF-8", 'HTML-ENTITIES');
}
// Clean up some useless linebreaks in lists
//$Text = str_replace('<br /><ul','<ul ', $Text);
//$Text = str_replace('</ul><br />','</ul>', $Text);
//$Text = str_replace('</li><br />','</li>', $Text);
//$Text = str_replace('<br /><li>','<li>', $Text);
// $Text = str_replace('<br /><ul','<ul ', $Text);
call_hooks('bbcode', $Text);
return trim($Text);
}
开发者ID:vinzv,项目名称:friendica,代码行数:101,代码来源:bbcode.php
示例4: events_content
//.........这里部分代码省略.........
$r = fetch_post_tags($r, true);
$r = sort_by_date($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
if (!x($links, $j)) {
$links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}
}
$events = array();
$last_date = '';
$fmt = t('l, F j');
if ($r) {
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
$d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
$d = day_translate($d);
$start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c');
if ($rr['nofinish']) {
$end = null;
} else {
$end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['finish'], 'c') : datetime_convert('UTC', 'UTC', $rr['finish'], 'c');
}
$is_first = $d !== $last_date;
$last_date = $d;
// FIXME
$edit = $rr['item_flags'] & ITEM_WALL ? array($a->get_baseurl() . '/events/event/' . $rr['event_hash'], t('Edit event'), '', '') : null;
$drop = array($a->get_baseurl() . '/events/drop/' . $rr['event_hash'], t('Delete event'), '', '');
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
if (!$title) {
list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
$title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
}
$html = format_event_html($rr);
$rr['desc'] = bbcode($rr['desc']);
$rr['location'] = bbcode($rr['location']);
$events[] = array('id' => $rr['id'], 'hash' => $rr['event_hash'], 'start' => $start, 'end' => $end, 'drop' => $drop, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('Link to Source'), '', ''));
}
}
if ($export) {
header('Content-type: text/calendar');
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"');
echo ical_wrapper($r);
killme();
}
if ($a->argv[1] === 'json') {
echo json_encode($events);
killme();
}
// links: array('href', 'text', 'extra css classes', 'title')
if (x($_GET, 'id')) {
$tpl = get_markup_template("event.tpl");
} else {
$tpl = get_markup_template("events-js.tpl");
}
$o = replace_macros($tpl, array('$baseurl' => $a->get_baseurl(), '$tabs' => $tabs, '$title' => t('Events'), '$new_event' => array($a->get_baseurl() . '/events/new', t('Create New Event'), '', ''), '$previus' => array($a->get_baseurl() . "/events/{$prevyear}/{$prevmonth}", t('Previous'), '', ''), '$next' => array($a->get_baseurl() . "/events/{$nextyear}/{$nextmonth}", t('Next'), '', ''), '$export' => array($a->get_baseurl() . "/events/{$y}/{$m}/export", t('Export'), '', ''), '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events));
if (x($_GET, 'id')) {
echo $o;
killme();
}
return $o;
}
if ($mode === 'drop' && $event_id) {
$r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1", dbesc($event_id), intval(local_channel()));
if ($r) {
$r = q("delete from event where event_hash = '%s' and uid = %d limit 1", dbesc($event_id), intval(local_channel()));
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:67,代码来源:events.php
示例5: bbcode
//.........这里部分代码省略.........
}
if (strpos($Text, '[/app]') !== false) {
$Text = preg_replace_callback("/\\[app\\](.*?)\\[\\/app\\]/ism", 'bb_parse_app', $Text);
}
if (strpos($Text, '[/element]') !== false) {
$Text = preg_replace_callback("/\\[element\\](.*?)\\[\\/element\\]/ism", 'bb_parse_element', $Text);
}
// html5 video and audio
if (strpos($Text, '[/video]') !== false) {
$Text = preg_replace_callback("/\\[video\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\\[\\/video\\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text, '[/audio]') !== false) {
$Text = preg_replace_callback("/\\[audio\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4|mp3|opus))\\[\\/audio\\]/ism", 'tryzrlaudio', $Text);
}
if (strpos($Text, '[/zvideo]') !== false) {
$Text = preg_replace_callback("/\\[zvideo\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\\[\\/zvideo\\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text, '[/zaudio]') !== false) {
$Text = preg_replace_callback("/\\[zaudio\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4|mp3|opus))\\[\\/zaudio\\]/ism", 'tryzrlaudio', $Text);
}
// Try to Oembed
if ($tryoembed) {
if (strpos($Text, '[/video]') !== false) {
$Text = preg_replace_callback("/\\[video\\](.*?)\\[\\/video\\]/ism", 'tryoembed', $Text);
}
if (strpos($Text, '[/audio]') !== false) {
$Text = preg_replace_callback("/\\[audio\\](.*?)\\[\\/audio\\]/ism", 'tryoembed', $Text);
}
if (strpos($Text, '[/zvideo]') !== false) {
$Text = preg_replace_callback("/\\[zvideo\\](.*?)\\[\\/zvideo\\]/ism", 'tryoembed', $Text);
}
if (strpos($Text, '[/zaudio]') !== false) {
$Text = preg_replace_callback("/\\[zaudio\\](.*?)\\[\\/zaudio\\]/ism", 'tryoembed', $Text);
}
}
// if video couldn't be embedded, link to it instead.
if (strpos($Text, '[/video]') !== false) {
$Text = preg_replace("/\\[video\\](.*?)\\[\\/video\\]/", '<a href="$1" target="_blank" >$1</a>', $Text);
}
if (strpos($Text, '[/audio]') !== false) {
$Text = preg_replace("/\\[audio\\](.*?)\\[\\/audio\\]/", '<a href="$1" target="_blank" >$1</a>', $Text);
}
if (strpos($Text, '[/zvideo]') !== false) {
$Text = preg_replace("/\\[zvideo\\](.*?)\\[\\/zvideo\\]/", '<a class="zid" href="$1" target="_blank" >$1</a>', $Text);
}
if (strpos($Text, '[/zaudio]') !== false) {
$Text = preg_replace("/\\[zaudio\\](.*?)\\[\\/zaudio\\]/", '<a class="zid" href="$1" target="_blank" >$1</a>', $Text);
}
if ($tryoembed) {
if (strpos($Text, '[/iframe]') !== false) {
$Text = preg_replace_callback("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", 'bb_iframe', $Text);
}
} else {
if (strpos($Text, '[/iframe]') !== false) {
$Text = preg_replace("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", '<a href="$1" target="_blank" >$1</a>', $Text);
}
}
// oembed tag
$Text = oembed_bbcode2html($Text);
// Avoid triple linefeeds through oembed
$Text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span><br />", $Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
// Replace the event-start section with the entire formatted event. The other bbcode is stripped.
// Summary (e.g. title) is required, earlier revisions only required description (in addition to
// start which is always required). Allow desc with a missing summary for compatibility.
if ((x($ev, 'desc') || x($ev, 'summary')) && x($ev, 'start')) {
$sub = format_event_html($ev);
$sub = str_replace('$', "", $sub);
$Text = preg_replace("/\\[event\\-start\\](.*?)\\[\\/event\\-start\\]/ism", $sub, $Text);
$Text = preg_replace("/\\[event\\-summary\\](.*?)\\[\\/event\\-summary\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-description\\](.*?)\\[\\/event\\-description\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-finish\\](.*?)\\[\\/event\\-finish\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-id\\](.*?)\\[\\/event\\-id\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-location\\](.*?)\\[\\/event\\-location\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-adjust\\](.*?)\\[\\/event\\-adjust\\]/ism", '', $Text);
$Text = str_replace("", '$', $Text);
}
// Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
if (strpos($Text, '[noparse]') !== false) {
$Text = preg_replace_callback("/\\[noparse\\](.*?)\\[\\/noparse\\]/ism", 'bb_unspacefy_and_trim', $Text);
}
if (strpos($Text, '[nobb]') !== false) {
$Text = preg_replace_callback("/\\[nobb\\](.*?)\\[\\/nobb\\]/ism", 'bb_unspacefy_and_trim', $Text);
}
if (strpos($Text, '[pre]') !== false) {
$Text = preg_replace_callback("/\\[pre\\](.*?)\\[\\/pre\\]/ism", 'bb_unspacefy_and_trim', $Text);
}
$Text = preg_replace('/\\[\\&\\;([#a-z0-9]+)\\;\\]/', '&$1;', $Text);
// fix any escaped ampersands that may have been converted into links
if (strpos($Text, '&') !== false) {
$Text = preg_replace("/\\<(.*?)(src|href)=(.*?)\\&\\;(.*?)\\>/ism", '<$1$2=$3&$4>', $Text);
}
// This is subtle - it's an XSS filter. It only accepts links with a protocol scheme and where
// the scheme begins with z (zhttp), h (http(s)), f (ftp), m (mailto), and named anchors.
$Text = preg_replace("/\\<(.*?)(src|href)=\"[^zhfm#](.*?)\\>/ism", '<$1$2="">', $Text);
$Text = bb_replace_images($Text, $saved_images);
call_hooks('bbcode', $Text);
return $Text;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:101,代码来源:bbcode.php
示例6: bbcode
//.........这里部分代码省略.........
$Text = preg_replace("/\\[url\\=([{$URLSearchString}]*)\\](.*?)\\[\\/url\\]/ism", '<a href="$1" target="external-link">$2</a>', $Text);
//$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $Text);
// Perform MAIL Search
$Text = preg_replace("/\\[mail\\]([{$MAILSearchString}]*)\\[\\/mail\\]/", '<a href="mailto:$1">$1</a>', $Text);
$Text = preg_replace("/\\[mail\\=([{$MAILSearchString}]*)\\](.*?)\\[\\/mail\\]/", '<a href="mailto:$1">$2</a>', $Text);
// Check for bold text
$Text = preg_replace("(\\[b\\](.*?)\\[\\/b\\])ism", '<strong>$1</strong>', $Text);
// Check for Italics text
$Text = preg_replace("(\\[i\\](.*?)\\[\\/i\\])ism", '<em>$1</em>', $Text);
// Check for Underline text
$Text = preg_replace("(\\[u\\](.*?)\\[\\/u\\])ism", '<u>$1</u>', $Text);
// Check for strike-through text
$Text = preg_replace("(\\[s\\](.*?)\\[\\/s\\])ism", '<strike>$1</strike>', $Text);
// Check for over-line text
$Text = preg_replace("(\\[o\\](.*?)\\[\\/o\\])ism", '<span class="overline">$1</span>', $Text);
// Check for colored text
$Text = preg_replace("(\\[color=(.*?)\\](.*?)\\[\\/color\\])ism", "<span style=\"color: \$1;\">\$2</span>", $Text);
// Check for sized text
$Text = preg_replace("(\\[size=(.*?)\\](.*?)\\[\\/size\\])ism", "<span style=\"font-size: \$1;\">\$2</span>", $Text);
// Check for list text
if (stristr($Text, '[/list]')) {
$Text = str_replace("[*]", "<li>", $Text);
}
if (stristr($Text, '[/list]')) {
$Text = str_replace("[*]", "<li>", $Text);
}
$Text = preg_replace("/\\[list\\](.*?)\\[\\/list\\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>', $Text);
$Text = preg_replace("/\\[list=\\](.*?)\\[\\/list\\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>', $Text);
$Text = preg_replace("/\\[list=1\\](.*?)\\[\\/list\\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>', $Text);
$Text = preg_replace("/\\[list=i\\](.*?)\\[\\/list\\]/sm", '<ul class="listlowerroman" style="list-style-type: lower-roman;">$1</ul>', $Text);
$Text = preg_replace("/\\[list=I\\](.*?)\\[\\/list\\]/sm", '<ul class="listupperroman" style="list-style-type: upper-roman;">$1</ul>', $Text);
$Text = preg_replace("/\\[list=a\\](.*?)\\[\\/list\\]/sm", '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$1</ul>', $Text);
$Text = preg_replace("/\\[list=A\\](.*?)\\[\\/list\\]/sm", '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$1</ul>', $Text);
$Text = preg_replace("/\\[li\\](.*?)\\[\\/li\\]/sm", '<li>$1</li>', $Text);
$Text = preg_replace("/\\[td\\](.*?)\\[\\/td\\]/sm", '<td>$1</td>', $Text);
$Text = preg_replace("/\\[tr\\](.*?)\\[\\/tr\\]/sm", '<tr>$1</tr>', $Text);
$Text = preg_replace("/\\[table\\](.*?)\\[\\/table\\]/sm", '<table>$1</table>', $Text);
$Text = preg_replace("/\\[table border=1\\](.*?)\\[\\/table\\]/sm", '<table border="1" >$1</table>', $Text);
$Text = preg_replace("/\\[table border=0\\](.*?)\\[\\/table\\]/sm", '<table border="0" >$1</table>', $Text);
// Check for font change text
$Text = preg_replace("/\\[font=(.*?)\\](.*?)\\[\\/font\\]/sm", "<span style=\"font-family: \$1;\">\$2</span>", $Text);
// Declare the format for [code] layout
$Text = preg_replace_callback("/\\[code\\](.*?)\\[\\/code\\]/ism", 'stripcode_br_cb', $Text);
$CodeLayout = '<code>$1</code>';
// Check for [code] text
$Text = preg_replace("/\\[code\\](.*?)\\[\\/code\\]/ism", "{$CodeLayout}", $Text);
// Declare the format for [quote] layout
$QuoteLayout = '<blockquote>$1</blockquote>';
// Check for [quote] text
$Text = preg_replace("/\\[quote\\](.*?)\\[\\/quote\\]/ism", "{$QuoteLayout}", $Text);
// [img=widthxheight]image source[/img]
$Text = preg_replace("/\\[img\\=([0-9]*)x([0-9]*)\\](.*?)\\[\\/img\\]/ism", '<img src="$3" style="height: $2px; width: $1px;" >', $Text);
// Images
// [img]pathtoimage[/img]
$Text = preg_replace("/\\[img\\](.*?)\\[\\/img\\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);
// Try to Oembed
$Text = preg_replace_callback("/\\[video\\](.*?)\\[\\/video\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[audio\\](.*?)\\[\\/audio\\]/ism", 'tryoembed', $Text);
// html5 video and audio
$Text = preg_replace("/\\[video\\](.*?)\\[\\/video\\]/ism", '<video src="$1" controls="controls" width="425" height="350"><a href="$1">$1</a></video>', $Text);
$Text = preg_replace("/\\[audio\\](.*?)\\[\\/audio\\]/ism", '<audio src="$1" controls="controls"><a href="$1">$1</a></audio>', $Text);
$Text = preg_replace("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", '<iframe src="$1" width="425" height="350"><a href="$1">$1</a></iframe>', $Text);
/*if (get_pconfig(local_user(), 'oembed', 'use_for_youtube' )==1){
// use oembed for youtube links
$Text = preg_replace("/\[youtube\]/",'[embed]',$Text);
$Text = preg_replace("/\[\/youtube\]/",'[/embed]',$Text);
} else {*/
// Youtube extensions
$Text = preg_replace_callback("/\\[youtube\\](https?:\\/\\/www.youtube.com\\/watch\\?v\\=.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[youtube\\](https?:\\/\\/youtu.be\\/.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/www.youtube.com\\/watch\\?v\\=(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/www.youtube.com\\/embed\\/(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/youtu.be\\/(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]([A-Za-z0-9\\-_=]+)(.*?)\\[\\/youtube\\]/ism", '<iframe width="425" height="350" src="http://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
//}
$Text = preg_replace_callback("/\\[vimeo\\](https?:\\/\\/player.vimeo.com\\/video\\/[0-9]+).*?\\[\\/vimeo\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[vimeo\\](https?:\\/\\/vimeo.com\\/[0-9]+).*?\\[\\/vimeo\\]/ism", 'tryoembed', $Text);
$Text = preg_replace("/\\[vimeo\\]https?:\\/\\/player.vimeo.com\\/video\\/([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '[vimeo]$1[/vimeo]', $Text);
$Text = preg_replace("/\\[vimeo\\]https?:\\/\\/vimeo.com\\/([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '[vimeo]$1[/vimeo]', $Text);
$Text = preg_replace("/\\[vimeo\\]([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '<iframe width="425" height="350" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
// oembed tag
$Text = oembed_bbcode2html($Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
if (x($ev, 'desc') && x($ev, 'start')) {
$sub = format_event_html($ev);
$Text = preg_replace("/\\[event\\-description\\](.*?)\\[\\/event\\-description\\]/ism", $sub, $Text);
$Text = preg_replace("/\\[event\\-start\\](.*?)\\[\\/event\\-start\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-finish\\](.*?)\\[\\/event\\-finish\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-location\\](.*?)\\[\\/event\\-location\\]/ism", '', $Text);
$Text = preg_replace("/\\[event\\-adjust\\](.*?)\\[\\/event\\-adjust\\]/ism", '', $Text);
}
// fix any escaped ampersands that may have been converted into links
$Text = preg_replace("/\\<(.*?)(src|href)=(.*?)\\&\\;(.*?)\\>/ism", '<$1$2=$3&$4>', $Text);
if (strlen($saved_image)) {
$Text = str_replace('[$#saved_image#$]', '<img src="' . $saved_image . '" alt="' . t('Image/photo') . '" />', $Text);
}
call_hooks('bbcode', $Text);
return $Text;
}
开发者ID:ryivhnn,项目名称:friendica,代码行数:101,代码来源:bbcode.php
示例7: events_content
function events_content(&$a)
{
if (!local_user()) {
notice(t('Permission denied.') . EOL);
return;
}
$o = "";
// tabs
$o .= profile_tabs($a, True);
$o .= '<h2>' . t('Events') . '</h2>';
$mode = 'view';
$y = 0;
$m = 0;
if ($a->argc > 1) {
if ($a->argc > 2 && $a->argv[1] == 'event') {
$mode = 'edit';
$event_id = intval($a->argv[2]);
}
if ($a->argv[1] === 'new') {
$mode = 'new';
$event_id = 0;
}
if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
$mode = 'view';
$y = intval($a->argv[1]);
$m = intval($a->argv[2]);
}
}
if ($mode == 'view') {
$thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
$thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
if (!$y) {
$y = intval($thisyear);
}
if (!$m) {
$m = intval($thismonth);
}
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
if ($y < 1901) {
$y = 1900;
}
if ($y > 2099) {
$y = 2100;
}
$nextyear = $y;
$nextmonth = $m + 1;
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear++;
}
$prevyear = $y;
if ($m > 1) {
$prevmonth = $m - 1;
} else {
$prevmonth = 12;
$prevyear--;
}
$dim = get_dim($y, $m);
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
$start = datetime_convert('UTC', 'UTC', $start);
$finish = datetime_convert('UTC', 'UTC', $finish);
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\tWHERE `event`.`uid` = %d\n\t\t\tAND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' ) \n\t\t\tOR ( `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ", intval(local_user()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
$links = array();
if (count($r)) {
$r = sort_by_date($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
if (!x($links, $j)) {
$links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}
}
$o .= '<div id="new-event-link"><a href="' . $a->get_baseurl() . '/events/new' . '" >' . t('Create New Event') . '</a></div>';
$o .= '<div id="event-calendar-wrapper">';
$o .= '<a href="' . $a->get_baseurl() . '/events/' . $prevyear . '/' . $prevmonth . '" class="prevcal"><div id="event-calendar-prev" class="icon prev" title="' . t('Previous') . '"></div></a>';
$o .= cal($y, $m, $links, ' eventcal');
$o .= '<a href="' . $a->get_baseurl() . '/events/' . $nextyear . '/' . $nextmonth . '" class="nextcal"><div id="event-calendar-next" class="icon next" title="' . t('Next') . '"></div></a>';
$o .= '</div>';
$o .= '<div class="event-calendar-end"></div>';
$last_date = '';
$fmt = t('l, F j');
if (count($r)) {
$r = sort_by_date($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
$d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
$d = day_translate($d);
if ($d !== $last_date) {
$o .= '<hr /><a name="link-' . $j . '" ><div class="event-list-date">' . $d . '</div></a>';
}
$last_date = $d;
if ($rr['author-name']) {
$o .= '<a href="' . $rr['author-link'] . '" ><img src="' . $rr['author-avatar'] . '" height="32" width="32" />' . $rr['author-name'] . '</a>';
}
$o .= format_event_html($rr);
$o .= !$rr['cid'] ? '<a href="' . $a->get_baseurl() . '/events/event/' . $rr['id'] . '" title="' . t('Edit event') . '" class="edit-event-link icon pencil"></a>' : '';
//.........这里部分代码省略.........
开发者ID:nphyx,项目名称:friendica,代码行数:101,代码来源:events.php
示例8: events_content
//.........这里部分代码省略.........
$links = array();
if (count($r)) {
$r = sort_by_date($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
if (!x($links, $j)) {
$links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
}
}
}
$events = array();
$last_date = '';
$fmt = t('l, F j');
if (count($r)) {
$r = sort_by_date($r);
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
$d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
$d = day_translate($d);
$start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c');
if ($rr['nofinish']) {
$end = null;
} else {
$end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['finish'], 'c') : datetime_convert('UTC', 'UTC', $rr['finish'], 'c');
}
$is_first = $d !== $last_date;
$last_date = $d;
$edit = !$rr['cid'] ? array($a->get_baseurl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null;
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
if (!$title) {
list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
$title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
}
$html = format_event_html($rr);
$rr['desc'] = bbcode($rr['desc']);
$rr['location'] = bbcode($rr['location']);
$events[] = array('id' => $rr['id'], 'start' => $start, 'end' => $end, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('link to source'), '', ''));
}
}
if ($a->argv[1] === 'json') {
echo json_encode($events);
killme();
}
// links: array('href', 'text', 'extra css classes', 'title')
if (x($_GET, 'id')) {
$tpl = get_markup_template("event.tpl");
} else {
// if (get_config('experimentals','new_calendar')==1){
$tpl = get_markup_template("events-js.tpl");
// } else {
// $tpl = get_markup_template("events.tpl");
// }
}
// Get rid of dashes in key names, Smarty3 can't handle them
foreach ($events as $key => $event) {
$event_item = array();
foreach ($event['item'] as $k => $v) {
$k = str_replace('-', '_', $k);
$event_item[$k] = $v;
}
$events[$key]['item'] = $event_item;
}
$o = replace_macros($tpl, array('$baseurl' => $a->get_baseurl(), '$tabs' => $tabs, '$title' => t('Events'), '$new_event' => array($a->get_baseurl() . '/events/new', t('Create New Event'), '', ''), '$previus' => array($a->get_baseurl() . "/events/{$prevyear}/{$prevmonth}", t('Previous'), '', ''), '$next' => array($a->get_baseurl() . "/events/{$nextyear}/{$nextmonth}", t('Next'), '', ''), '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events));
if (x($_GET, 'id')) {
echo $o;
killme();
开发者ID:vinzv,项目名称:friendica,代码行数:67,代码来源:events.php
示例9: bbcode
//.........这里部分代码省略.........
}
if (strpos($Text, '[/app]') !== false) {
$Text = preg_replace_callback("/\\[app\\](.*?)\\[\\/app\\]/ism", 'bb_parse_app', $Text);
}
// html5 video and audio
if (strpos($Text, '[/video]') !== false) {
$Text = preg_replace_callback("/\\[video\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4))\\[\\/video\\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text, '[/audio]') !== false) {
$Text = preg_replace_callback("/\\[audio\\](.*?\\.(ogg|ogv|oga|ogm|webm|mp4|mp3))\\[\\/audio\\]/ism", 'tryzrlaudio', $Text);
}
// Try to Oembed
if ($tryoembed) {
if (strpos($Text, '[/video]') !== false) {
$Text = preg_replace_callback("/\\[video\\](.*?)\\[\\/video\\]/ism", 'tryoembed', $Text);
}
if (strpos($Text, '[/audio]') !== false) {
$Text = preg_replace_callback("/\\[audio\\](.*?)\\[\\/audio\\]/ism", 'tryoembed', $Text);
}
}
// if video couldn't be embedded, link to it instead.
if (strpos($Text, '[/video]') !== false) {
$Text = preg_replace("/\\[video\\](.*?)\\[\\/video\\]/", '<a href="$1">$1</a>', $Text);
}
if (strpos($Text, '[/audio]') !== false) {
$Text = preg_replace("/\\[audio\\](.*?)\\[\\/audio\\]/", '<a href="$1">$1</a>', $Text);
}
if ($tryoembed) {
if (strpos($Text, '[/iframe]') !== false) {
$Text = preg_replace_callback("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", 'bbiframe', $Text);
}
} else {
if (strpos($Text, '[/iframe]') !== false) {
$Text = preg_replace("/\\[iframe\\](.*?)\\[\\/iframe\\]/ism", '<a href="$1">$1</a>', $Text);
}
}
// Youtube extensions
if (strpos($Text, '[youtube]') !== false) {
if ($tryoembed) {
$Text = preg_replace_callback("/\\[youtube\\](https?:\\/\\/www.youtube.com\\/watch\\?v\\=.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[youtube\\](www.youtube.com\\/watch\\?v\\=.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[youtube\\](https?:\\/\\/youtu.be\\/.*?)\\[\\/youtube\\]/ism", 'tryoembed', $Text);
}
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/www.youtube.com\\/watch\\?v\\=(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/www.youtube.com\\/embed\\/(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
$Text = preg_replace("/\\[youtube\\]https?:\\/\\/youtu.be\\/(.*?)\\[\\/youtube\\]/ism", '[youtube]$1[/youtube]', $Text);
if ($tryoembed) {
$Text = preg_replace("/\\[youtube\\]([A-Za-z0-9\\-_=]+)(.*?)\\[\\/youtube\\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
} else {
$Text = preg_replace("/\\[youtube\\]([A-Za-z0-9\\-_=]+)(.*?)\\[\\/youtube\\]/ism", "http://www.youtube.com/watch?v=\$1", $Text);
}
}
if (strpos($Text, '[vimeo]') !== false) {
if ($tryoembed) {
$Text = preg_replace_callback("/\\[vimeo\\](https?:\\/\\/player.vimeo.com\\/video\\/[0-9]+).*?\\[\\/vimeo\\]/ism", 'tryoembed', $Text);
$Text = preg_replace_callback("/\\[vimeo\\](https?:\\/\\/vimeo.com\\/[0-9]+).*?\\[\\/vimeo\\]/ism", 'tryoembed', $Text);
}
$Text = preg_replace("/\\[vimeo\\]https?:\\/\\/player.vimeo.com\\/video\\/([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '[vimeo]$1[/vimeo]', $Text);
$Text = preg_replace("/\\[vimeo\\]https?:\\/\\/vimeo.com\\/([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '[vimeo]$1[/vimeo]', $Text);
if ($tryoembed) {
$Text = preg_replace("/\\[vimeo\\]([0-9]+)(.*?)\\[\\/vimeo\\]/ism", '<iframe width="' . $a->videowidth . '" height="' . $a->videoheight . '" src="http://player.vimeo.com/video/$1" frameborder="0" ></iframe>', $Text);
} else {
$Text = preg_replace("/\\[vimeo\\]([0-9]+)(.*?)\\[\\/vimeo\\]/ism", "http://vimeo.com/\$1", $Text);
}
}
// oembed tag
$Text = oembed_bbcode2html($Text);
// Avoid triple linefeeds through oembed
$Text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span><br />", $Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
// Replace the event-start section with the enti
|
请发表评论