From 1fdac57d617bc16d3c784f8d6a2a82026b34b085 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 Apr 2016 09:58:44 +0200 Subject: jot: cleanup unused variables --- include/conversation.php | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 7d80b08fc..96207da8e 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1160,7 +1160,6 @@ function status_editor($a, $x, $popup = false) { $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'] : ''), @@ -1168,12 +1167,8 @@ function status_editor($a, $x, $popup = false) { '$nickname' => $x['nickname'], '$ispublic' => t('Visible to everybody'), '$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,10 +1176,8 @@ 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')) $preview = ''; @@ -1201,7 +1194,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 +1210,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'), '$voting' => t('Toggle voting'), '$feature_voting' => $voting, '$consensus' => 0, '$noloc' => ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : ''), - '$shortnoloc' => t('clear location'), '$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' => "", '$placeholdercategory' => t('Categories (optional, comma-separated list)'), - '$wait' => t('Please wait'), '$permset' => t('Permission settings'), - '$shortpermset' => t('permissions'), '$ptyp' => '', '$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''), '$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''), '$post_id' => '', - '$baseurl' => z_root(), '$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, -- cgit v1.2.3 From b797528b78107b707dc1c56d70e07136d7c31028 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 Apr 2016 13:18:42 +0200 Subject: some work on making mod editpost use status_editor() - if you find anything related to jot broken please revert this commit --- include/conversation.php | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 96207da8e..14fee19b2 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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 = ''; } - if(array_key_exists('channel_select',$x) && $x['channel_select']) { require_once('include/identity.php'); $id_select = identity_selector(); @@ -1154,7 +1165,6 @@ function status_editor($a, $x, $popup = false) { else $id_select = ''; - $webpage = ((x($x,'webpage')) ? $x['webpage'] : ''); $tpl = get_markup_template('jot-header.tpl'); @@ -1165,7 +1175,7 @@ function status_editor($a, $x, $popup = false) { '$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''), '$geotag' => $geotag, '$nickname' => $x['nickname'], - '$ispublic' => t('Visible to everybody'), + '$ispublic' => ((x($x,'ispublic')) ? $x['ispublic'] : t('Visible to everybody')), '$linkurl' => t('Please enter a link URL:'), '$term' => t('Tag term:'), '$whereareu' => t('Where are you right now?'), @@ -1212,21 +1222,21 @@ function status_editor($a, $x, $popup = false) { '$code' => t('Code'), '$attach' => t('Attach file'), '$weblink' => t('Insert web link'), - '$setloc' => t('Set your 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') : ''), + '$clearloc' => $clearloc, '$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''), '$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')), '$catsenabled' => ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''), - '$category' => "", + '$category' => ((x($x, 'category')) ? $x['category'] : ''), '$placeholdercategory' => t('Categories (optional, comma-separated list)'), '$permset' => t('Permission settings'), - '$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' => '', + '$post_id' => ((x($x, 'post_id')) ? $x['post_id'] : ''), '$defloc' => $x['default_location'], '$visitor' => $x['visitor'], '$lockstate' => $x['lockstate'], @@ -1240,10 +1250,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'), -- cgit v1.2.3 From 9d079e5d2b3dad4e9d0ce962ba2cd8a815a297db Mon Sep 17 00:00:00 2001 From: Treer Date: Thu, 28 Apr 2016 23:48:50 +1000 Subject: Add definition lists to bbcode --- include/bbcode.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index b8cd23f59..1640307f8 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -345,6 +345,46 @@ function bb_spoilertag($match) { return ''; } +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 =>
term-text
description-text + // then after all replacements have been made, the
remaining the start of the + // string can be removed. HTML5 allows the missing end tag. + // Using '(?\n"; + $listElements = preg_replace( + '/\[\*=([[:print:]]*?)(?$1
', + $match[2] + ); + // Unescape any \] inside the
tags + $listElements = preg_replace_callback('/
(.*?)<\/dt>/ism', 'bb_definitionList_unescapeBraces', $listElements); + + // Remove the extra at the start of the string, if there is one. + $firstOpenTag = strpos($listElements, '
'); + $firstCloseTag = strpos($listElements, $closeDescriptionTag); + if ($firstCloseTag !== false && ($firstOpenTag === false || ($firstCloseTag < $firstOpenTag))) { + $listElements = preg_replace( '/<\/dd>/ism', '', $listElements, 1); + } + + return '
' . $listElements . '
';; +} +function bb_definitionList_unescapeBraces($match) { + return '
' . str_replace('\]', ']', $match[1]) . '
'; +} + /** * @brief Sanitize style properties from BBCode to HTML. * @@ -713,6 +753,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", '
    $1
', $Text); $Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '
    $1
', $Text); @@ -724,6 +765,13 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '
    $1
', $Text); $Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '
    $1
', $Text); $Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '
  • $1
  • ', $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" "]" "[/dl]" + // where optional-termStyles are: "terms=" + $Text = preg_replace_callback('/\[dl[[:space:]]*(?:terms=(?:"|")?([a-zA-Z]+)(?:"|")?)?\](.*?)\[\/dl\]/ism', 'bb_definitionList', $Text); } if (strpos($Text,'[th]') !== false) { $Text = preg_replace("/\[th\](.*?)\[\/th\]/sm", '$1', $Text); -- cgit v1.2.3 From b5b21ecad7b164168fbc75792c7285700cee5c9f Mon Sep 17 00:00:00 2001 From: Treer Date: Sat, 30 Apr 2016 02:03:38 +1000 Subject: improve whitespace control around definition list ([dl]) bbcode --- include/bbcode.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 1640307f8..5bd5301cc 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -360,14 +360,16 @@ function bb_definitionList($match) { // The bbcode transformation will be: // [*=term-text] description-text =>
    term-text
    description-text - // then after all replacements have been made, the
    remaining the start of the - // string can be removed. HTML5 allows the missing end tag. + // then after all replacements have been made, the extra 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 '(?\n"; + $eatLeadingSpaces = '(?: |[ \t])*'; // prevent spaces infront of [*= from adding another line to the previous element + $listElements = preg_replace('/^(\n|
    )/', '', $match[2]); // ltrim the first newline $listElements = preg_replace( - '/\[\*=([[:print:]]*?)(?$1
    ', - $match[2] + $listElements ); // Unescape any \] inside the
    tags $listElements = preg_replace_callback('/
    (.*?)<\/dt>/ism', 'bb_definitionList_unescapeBraces', $listElements); -- cgit v1.2.3 From 931a4fafe316b23bacf92ac1ff35f9b8467415dd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 Apr 2016 21:38:36 +0200 Subject: get rid of the unused ispublic variable --- include/conversation.php | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 14fee19b2..b1b47df39 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1175,7 +1175,6 @@ function status_editor($a, $x, $popup = false) { '$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''), '$geotag' => $geotag, '$nickname' => $x['nickname'], - '$ispublic' => ((x($x,'ispublic')) ? $x['ispublic'] : t('Visible to everybody')), '$linkurl' => t('Please enter a link URL:'), '$term' => t('Tag term:'), '$whereareu' => t('Where are you right now?'), -- cgit v1.2.3 From 8f16e9ad33e17fcdf5c0b4586b384ea12eeb0716 Mon Sep 17 00:00:00 2001 From: Treer Date: Sun, 1 May 2016 04:39:57 +1000 Subject: update icon names in include/ --- include/ItemObject.php | 4 ++-- include/conversation.php | 2 +- include/event.php | 2 +- include/text.php | 52 ++++++++++++++++++++++++------------------------ include/widgets.php | 6 +++--- 5 files changed, 33 insertions(+), 33 deletions(-) (limited to 'include') 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/conversation.php b/include/conversation.php index b1b47df39..94f1e7da7 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') 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 = '
    ' . "\r\n"; - $o .= '

     ' . bbcode($ev['summary']) . '

    ' . "\r\n"; + $o .= '

     ' . bbcode($ev['summary']) . '

    ' . "\r\n"; $o .= '
    ' . t('Starts:') . '  ' . t('Rate Me') . ''; + $o .= ' ' . t('Rate Me') . ''; else - $o .= '
    ' . t('Rate Me') . '
    '; + $o .= '
    ' . t('Rate Me') . '
    '; } - $o .= ' ' . t('View Ratings') . ''; + $o .= ' ' . t('View Ratings') . ''; $o .= '
    '; return $o; -- cgit v1.2.3 From c96b20c55969f96ba191d40908cf005b7f6a58da Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 30 Apr 2016 21:56:52 +0200 Subject: make mod editlayout use status_editor() --- include/conversation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index b1b47df39..2c1e18099 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1187,7 +1187,7 @@ function status_editor($a, $x, $popup = false) { $jotplugins = ''; $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 : ''); -- cgit v1.2.3