aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-30 15:02:45 -0700
committerredmatrix <git@macgirvin.com>2016-04-30 15:02:45 -0700
commit84d93cca6e2ac0b552a6f5c570fbcfce766200a1 (patch)
treea8a9c46ee6f70dd4b8824499a49b1e39e2980dc6 /include
parent45512e6aba602604143e946cca49c363ae88aa1e (diff)
parent9446d0cbb463af6a256efebf97e10618469f1193 (diff)
downloadvolse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.tar.gz
volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.tar.bz2
volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php4
-rw-r--r--include/bbcode.php50
-rw-r--r--include/conversation.php70
-rw-r--r--include/event.php2
-rw-r--r--include/text.php52
-rw-r--r--include/widgets.php6
6 files changed, 109 insertions, 75 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 9d5acd95f..019fa87ad 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -75,7 +75,7 @@ class Item extends BaseObject {
$buttons = '';
$dropping = false;
$star = false;
- $isstarred = "unstarred icon-star-empty";
+ $isstarred = "unstarred fa-star-o";
$indent = '';
$osparkle = '';
$total_children = $this->count_descendants();
@@ -214,7 +214,7 @@ class Item extends BaseObject {
'toggle' => t("Toggle Star Status"),
'classdo' => (intval($item['item_starred']) ? "hidden" : ""),
'classundo' => (intval($item['item_starred']) ? "" : "hidden"),
- 'isstarred' => (intval($item['item_starred']) ? "starred icon-star" : "unstarred icon-star-empty"),
+ 'isstarred' => (intval($item['item_starred']) ? "starred fa-star" : "unstarred fa-star-o"),
'starred' => t('starred'),
);
diff --git a/include/bbcode.php b/include/bbcode.php
index b8cd23f59..5bd5301cc 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -345,6 +345,48 @@ function bb_spoilertag($match) {
return '<div onclick="openClose(\'opendiv-' . $rnd . '\'); return false;" class="fakelink">' . $openclose . '</div><blockquote id="opendiv-' . $rnd . '" style="display: none;">' . $text . '</blockquote>';
}
+function bb_definitionList($match) {
+ // $match[1] is the markup styles for the "terms" in the definition list.
+ // $match[2] is the content between the [dl]...[/dl] tags
+
+ $classes = '';
+ if (stripos($match[1], "b") !== false) $classes .= 'dl-terms-bold ';
+ if (stripos($match[1], "i") !== false) $classes .= 'dl-terms-italic ';
+ if (stripos($match[1], "u") !== false) $classes .= 'dl-terms-underline ';
+ if (stripos($match[1], "l") !== false) $classes .= 'dl-terms-large ';
+ if (stripos($match[1], "m") !== false) $classes .= 'dl-terms-monospace ';
+ if (stripos($match[1], "h") !== false) $classes .= 'dl-horizontal '; // dl-horizontal is already provided by bootstrap
+ if (strlen($classes) === 0) $classes = "dl-terms-plain";
+
+ // The bbcode transformation will be:
+ // [*=term-text] description-text => </dd> <dt>term-text<dt><dd> description-text
+ // then after all replacements have been made, the extra </dd> at the start of the
+ // first line can be removed. HTML5 allows the tag to be missing from the end of the last line.
+ // Using '(?<!\\\)' to allow backslash-escaped closing braces to appear in the term-text.
+ $closeDescriptionTag = "</dd>\n";
+ $eatLeadingSpaces = '(?:&nbsp;|[ \t])*'; // prevent spaces infront of [*= from adding another line to the previous element
+ $listElements = preg_replace('/^(\n|<br \/>)/', '', $match[2]); // ltrim the first newline
+ $listElements = preg_replace(
+ '/' . $eatLeadingSpaces . '\[\*=([[:print:]]*?)(?<!\\\)\]/ism',
+ $closeDescriptionTag . '<dt>$1</dt><dd>',
+ $listElements
+ );
+ // Unescape any \] inside the <dt> tags
+ $listElements = preg_replace_callback('/<dt>(.*?)<\/dt>/ism', 'bb_definitionList_unescapeBraces', $listElements);
+
+ // Remove the extra </dd> at the start of the string, if there is one.
+ $firstOpenTag = strpos($listElements, '<dd>');
+ $firstCloseTag = strpos($listElements, $closeDescriptionTag);
+ if ($firstCloseTag !== false && ($firstOpenTag === false || ($firstCloseTag < $firstOpenTag))) {
+ $listElements = preg_replace( '/<\/dd>/ism', '', $listElements, 1);
+ }
+
+ return '<dl class="bb-dl ' . rtrim($classes) . '">' . $listElements . '</dl>';;
+}
+function bb_definitionList_unescapeBraces($match) {
+ return '<dt>' . str_replace('\]', ']', $match[1]) . '</dt>';
+}
+
/**
* @brief Sanitize style properties from BBCode to HTML.
*
@@ -713,6 +755,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false)) ||
+ ((strpos($Text, "[/dl]") !== false) && (strpos($Text, "[dl") !== false)) ||
((strpos($Text, "[/li]") !== false) && (strpos($Text, "[li]") !== false))) && (++$endlessloop < 20)) {
$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);
@@ -724,6 +767,13 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>', $Text);
$Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>', $Text);
$Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '<li>$1</li>', $Text);
+
+ // [dl] tags have an optional [dl terms="bi"] form where bold/italic/underline/mono/large
+ // etc. style may be specified for the "terms" in the definition list. The quotation marks
+ // are also optional. The regex looks intimidating, but breaks down as:
+ // "[dl" <optional-whitespace> <optional-termStyles> "]" <matchGroup2> "[/dl]"
+ // where optional-termStyles are: "terms=" <optional-quote> <matchGroup1> <optional-quote>
+ $Text = preg_replace_callback('/\[dl[[:space:]]*(?:terms=(?:&quot;|")?([a-zA-Z]+)(?:&quot;|")?)?\](.*?)\[\/dl\]/ism', 'bb_definitionList', $Text);
}
if (strpos($Text,'[th]') !== false) {
$Text = preg_replace("/\[th\](.*?)\[\/th\]/sm", '<th>$1</th>', $Text);
diff --git a/include/conversation.php b/include/conversation.php
index 7d80b08fc..ba9d551a7 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -658,7 +658,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
);
$star = false;
- $isstarred = "unstarred icon-star-empty";
+ $isstarred = "unstarred fa-star-o";
$lock = (($item['item_private'] || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']))
? t('Private Message')
@@ -1115,16 +1115,28 @@ function status_editor($a, $x, $popup = false) {
if($c && $c['channel_moved'])
return $o;
- $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
-
$plaintext = true;
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
- $voting = feature_enabled(local_channel(), 'consensus_tools');
- if(x($x, 'novoting'))
- $voting = false;
+ $feature_voting = feature_enabled($x['profile_uid'], 'consensus_tools');
+ if(x($x, 'hide_voting'))
+ $feature_voting = false;
+
+ $feature_expire = ((feature_enabled($x['profile_uid'], 'content_expire') && (! $webpage)) ? true : false);
+ if(x($x, 'hide_expire'))
+ $feature_expire = false;
+
+ $feature_future = ((feature_enabled($x['profile_uid'], 'delayed_posting') && (! $webpage)) ? true : false);
+ if(x($x, 'hide_future'))
+ $feature_future = false;
+
+ $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
+ $setloc = t('Set your location');
+ $clearloc = ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : '');
+ if(x($x, 'hide_location'))
+ $geotag = $setloc = $clearloc = '';
$mimeselect = '';
if(array_key_exists('mimetype', $x) && $x['mimetype']) {
@@ -1146,7 +1158,6 @@ function status_editor($a, $x, $popup = false) {
$layoutselect = '<input type="hidden" name="layout_mid" value="' . $x['layout'] . '" />';
}
-
if(array_key_exists('channel_select',$x) && $x['channel_select']) {
require_once('include/identity.php');
$id_select = identity_selector();
@@ -1154,26 +1165,19 @@ function status_editor($a, $x, $popup = false) {
else
$id_select = '';
-
$webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
$tpl = get_markup_template('jot-header.tpl');
App::$page['htmlhead'] .= replace_macros($tpl, array(
- '$newpost' => 'true',
'$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
- '$ispublic' => t('Visible to <strong>everybody</strong>'),
'$linkurl' => t('Please enter a link URL:'),
- '$vidurl' => t('Please enter a video link/URL:'),
- '$audurl' => t('Please enter an audio link/URL:'),
'$term' => t('Tag term:'),
- '$fileas' => t('Save to Folder:'),
'$whereareu' => t('Where are you right now?'),
- '$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
'$editor_autocomplete'=> ((x($x,'editor_autocomplete')) ? $x['editor_autocomplete'] : ''),
'$bbco_autocomplete'=> ((x($x,'bbco_autocomplete')) ? $x['bbco_autocomplete'] : ''),
));
@@ -1181,11 +1185,9 @@ function status_editor($a, $x, $popup = false) {
$tpl = get_markup_template('jot.tpl');
$jotplugins = '';
- $jotnets = '';
$preview = t('Preview');
-// $preview = ((feature_enabled($x['profile_uid'],'preview')) ? t('Preview') : '');
- if(x($x, 'nopreview'))
+ if(x($x, 'hide_preview'))
$preview = '';
$defexpire = ((($z = get_pconfig($x['profile_uid'], 'system', 'default_post_expire')) && (! $webpage)) ? $z : '');
@@ -1201,7 +1203,6 @@ function status_editor($a, $x, $popup = false) {
$cipher = 'aes256';
call_hooks('jot_tool', $jotplugins);
- call_hooks('jot_networks', $jotnets);
$o .= replace_macros($tpl, array(
'$return_path' => ((x($x, 'return_path')) ? $x['return_path'] : App::$query_string),
@@ -1218,42 +1219,25 @@ function status_editor($a, $x, $popup = false) {
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
- '$upload' => t('Upload photo'),
- '$shortupload' => t('upload photo'),
'$attach' => t('Attach file'),
- '$shortattach' => t('attach file'),
'$weblink' => t('Insert web link'),
- '$shortweblink' => t('web link'),
- '$video' => t('Insert video link'),
- '$shortvideo' => t('video link'),
- '$audio' => t('Insert audio link'),
- '$shortaudio' => t('audio link'),
- '$setloc' => t('Set your location'),
- '$shortsetloc' => t('set location'),
+ '$setloc' => $setloc,
'$voting' => t('Toggle voting'),
- '$feature_voting' => $voting,
+ '$feature_voting' => $feature_voting,
'$consensus' => 0,
- '$noloc' => ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : ''),
- '$shortnoloc' => t('clear location'),
+ '$clearloc' => $clearloc,
'$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''),
'$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')),
- '$hidetitle' => ((x($x, 'hidetitle')) ? $x['hidetitle'] : false),
'$catsenabled' => ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''),
- '$category' => "",
+ '$category' => ((x($x, 'category')) ? $x['category'] : ''),
'$placeholdercategory' => t('Categories (optional, comma-separated list)'),
- '$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
- '$shortpermset' => t('permissions'),
- '$ptyp' => '',
+ '$ptyp' => ((x($x, 'ptyp')) ? $x['ptyp'] : ''),
'$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
'$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''),
- '$post_id' => '',
- '$baseurl' => z_root(),
+ '$post_id' => ((x($x, 'post_id')) ? $x['post_id'] : ''),
'$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
- '$public' => t('Public post'),
- '$jotnets' => $jotnets,
- '$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $x['lockstate'],
'$acl' => $x['acl'],
'$mimeselect' => $mimeselect,
@@ -1265,10 +1249,10 @@ function status_editor($a, $x, $popup = false) {
'$source' => ((x($x, 'source')) ? $x['source'] : ''),
'$jotplugins' => $jotplugins,
'$defexpire' => $defexpire,
- '$feature_expire' => ((feature_enabled($x['profile_uid'], 'content_expire') && (! $webpage)) ? true : false),
+ '$feature_expire' => $feature_expire,
'$expires' => t('Set expiration date'),
'$defpublish' => $defpublish,
- '$feature_future' => ((feature_enabled($x['profile_uid'], 'delayed_posting') && (! $webpage)) ? true : false),
+ '$feature_future' => $feature_future,
'$future_txt' => t('Set publish date'),
'$feature_encrypt' => ((feature_enabled($x['profile_uid'], 'content_encrypt') && (! $webpage)) ? true : false),
'$encrypt' => t('Encrypt text'),
diff --git a/include/event.php b/include/event.php
index 7a99bc746..e54a172c2 100644
--- a/include/event.php
+++ b/include/event.php
@@ -25,7 +25,7 @@ function format_event_html($ev) {
$o = '<div class="vevent">' . "\r\n";
- $o .= '<div class="event-title"><h3><i class="icon-calendar"></i>&nbsp;' . bbcode($ev['summary']) . '</h3></div>' . "\r\n";
+ $o .= '<div class="event-title"><h3><i class="fa fa-calendar"></i>&nbsp;' . bbcode($ev['summary']) . '</h3></div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
. datetime_convert('UTC', 'UTC', $ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
diff --git a/include/text.php b/include/text.php
index f8bc4b6b0..c61c5fbd4 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2603,41 +2603,41 @@ function linkify_tags($a, &$body, $uid, $diaspora = false) {
function getIconFromType($type) {
$iconMap = array(
//Folder
- t('Collection') => 'icon-folder-close',
- 'multipart/mixed' => 'icon-folder-close', //dirs in attach use this mime type
+ t('Collection') => 'fa-folder',
+ 'multipart/mixed' => 'fa-folder', //dirs in attach use this mime type
//Common file
- 'application/octet-stream' => 'icon-file-alt',
+ 'application/octet-stream' => 'fa-file-o',
//Text
- 'text/plain' => 'icon-file-text-alt',
- 'application/msword' => 'icon-file-text-alt',
- 'application/pdf' => 'icon-file-text-alt',
- 'application/vnd.oasis.opendocument.text' => 'icon-file-text-alt',
- 'application/epub+zip' => 'icon-book',
+ 'text/plain' => 'fa-file-text-o',
+ 'application/msword' => 'fa-file-text-o',
+ 'application/pdf' => 'fa-file-text-o',
+ 'application/vnd.oasis.opendocument.text' => 'fa-file-text-o',
+ 'application/epub+zip' => 'fa-book',
//Spreadsheet
- 'application/vnd.oasis.opendocument.spreadsheet' => 'icon-table',
- 'application/vnd.ms-excel' => 'icon-table',
+ 'application/vnd.oasis.opendocument.spreadsheet' => 'fa-table',
+ 'application/vnd.ms-excel' => 'fa-table',
//Image
- 'image/jpeg' => 'icon-picture',
- 'image/png' => 'icon-picture',
- 'image/gif' => 'icon-picture',
- 'image/svg+xml' => 'icon-picture',
+ 'image/jpeg' => 'fa-picture-o',
+ 'image/png' => 'fa-picture-o',
+ 'image/gif' => 'fa-picture-o',
+ 'image/svg+xml' => 'fa-picture-o',
//Archive
- 'application/zip' => 'icon-archive',
- 'application/x-rar-compressed' => 'icon-archive',
+ 'application/zip' => 'fa-archive',
+ 'application/x-rar-compressed' => 'fa-archive',
//Audio
- 'audio/mpeg' => 'icon-music',
- 'audio/wav' => 'icon-music',
- 'application/ogg' => 'icon-music',
- 'audio/ogg' => 'icon-music',
- 'audio/webm' => 'icon-music',
- 'audio/mp4' => 'icon-music',
+ 'audio/mpeg' => 'fa-music',
+ 'audio/wav' => 'fa-music',
+ 'application/ogg' => 'fa-music',
+ 'audio/ogg' => 'fa-music',
+ 'audio/webm' => 'fa-music',
+ 'audio/mp4' => 'fa-music',
//Video
- 'video/quicktime' => 'icon-film',
- 'video/webm' => 'icon-film',
- 'video/mp4' => 'icon-film'
+ 'video/quicktime' => 'fa-film',
+ 'video/webm' => 'fa-film',
+ 'video/mp4' => 'fa-film'
);
- $iconFromType = 'icon-file-alt';
+ $iconFromType = 'fa-file-o';
if (array_key_exists($type, $iconMap)) {
$iconFromType = $iconMap[$type];
diff --git a/include/widgets.php b/include/widgets.php
index 0355ebd8c..fa92901ae 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1203,12 +1203,12 @@ function widget_rating($arr) {
if((($remote) || (local_channel())) && (! $self)) {
if($remote)
- $o .= '<a class="btn btn-block btn-primary btn-sm" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
+ $o .= '<a class="btn btn-block btn-primary btn-sm" href="' . $url . '"><i class="fa fa-pencil"></i> ' . t('Rate Me') . '</a>';
else
- $o .= '<div class="btn btn-block btn-primary btn-sm" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
+ $o .= '<div class="btn btn-block btn-primary btn-sm" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="fa fa-pencil"></i> ' . t('Rate Me') . '</div>';
}
- $o .= '<a class="btn btn-block btn-default btn-sm" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
+ $o .= '<a class="btn btn-block btn-default btn-sm" href="ratings/' . $hash . '"><i class="fa fa-eye"></i> ' . t('View Ratings') . '</a>';
$o .= '</div>';
return $o;