From 2752b58f3323a15b964f6518b7720cb81ccf1b0e Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 5 Nov 2012 01:25:08 -0800 Subject: plaintext default - richtext is a feature --- include/api.php | 10 +++++----- include/conversation.php | 6 +++--- include/features.php | 2 +- mod/connections.php | 6 +++--- mod/editpost.php | 6 +++--- mod/item.php | 2 +- mod/message.php | 5 +---- mod/parse_url.php | 27 ++++++--------------------- mod/profiles.php | 6 +++--- mod/wall_attach.php | 7 +------ mod/wall_upload.php | 18 ++++-------------- 11 files changed, 31 insertions(+), 64 deletions(-) diff --git a/include/api.php b/include/api.php index 428c17957..ec3e9404a 100644 --- a/include/api.php +++ b/include/api.php @@ -480,8 +480,8 @@ return null; } -/*Waitman Gobble Mod*/ - function api_statuses_mediap(&$a, $type) { + + function api_statuses_mediap(&$a, $type) { if (local_user()===false) { logger('api_statuses_update: no user'); return false; @@ -508,7 +508,7 @@ $a->argv[1]=$user_info['screen_name']; //should be set to username? - $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo + $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo require_once('mod/wall_upload.php'); $bebop = wall_upload_post($a); @@ -521,7 +521,7 @@ return api_status_show($a,$type); } api_register_func('api/statuses/mediap','api_statuses_mediap', true); -/*Waitman Gobble Mod*/ + function api_statuses_update(&$a, $type) { @@ -575,7 +575,7 @@ $_REQUEST['type'] = 'wall'; if(x($_FILES,'media')) { // upload the image if we have one - $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo + $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo require_once('mod/wall_upload.php'); $media = wall_upload_post($a); if(strlen($media)>0) diff --git a/include/conversation.php b/include/conversation.php index e9e550a12..532fe0ba1 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1661,9 +1661,9 @@ function status_editor($a,$x,$popup=false) { $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : ''); - $plaintext = false; - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) - $plaintext = true; + $plaintext = true; + if(feature_enabled(local_user(),'richtext')) + $plaintext = false; $tpl = get_markup_template('jot-header.tpl'); diff --git a/include/features.php b/include/features.php index efd9c3455..dfed4ad02 100644 --- a/include/features.php +++ b/include/features.php @@ -26,7 +26,7 @@ array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comme array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')), array('preview', t('Post Preview'), t('Preview posts and comments before publishing them')), array('edit_posts', t('Edit Sent Posts'), t('Edit/correct posts and comments after sending')), - +array('richtext', t('Richtext Editor'), t('Use richtext/visual editor where applicable')), ); call_hooks('get_features',$arr); diff --git a/mod/connections.php b/mod/connections.php index 5af8e1212..152395679 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -289,9 +289,9 @@ EOT; $contact_id = $a->data['abook']['abook_id']; $contact = $a->data['abook']; - $editselect = 'exact'; - if(intval(get_pconfig(local_user(),'system','plaintext'))) - $editselect = 'none'; + $editselect = 'none'; + if(feature_enabled(local_user(),'richtext')) + $editselect = 'exact'; $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array( '$baseurl' => $a->get_baseurl(true), diff --git a/mod/editpost.php b/mod/editpost.php index b705afa4b..73faa59c5 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -28,9 +28,9 @@ function editpost_content(&$a) { return; } - $plaintext = false; - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) - $plaintext = true; + $plaintext = true; + if(feature_enabled(local_user(),'richtext')) + $plaintext = false; $o .= '

' . t('Edit post') . '

'; diff --git a/mod/item.php b/mod/item.php index 3e0384aa2..811537be2 100644 --- a/mod/item.php +++ b/mod/item.php @@ -283,7 +283,7 @@ function item_post(&$a) { // First figure out if it's a status post that would've been // created using tinymce. Otherwise leave it alone. - $plaintext = (local_user() ? intval(get_pconfig(local_user(),'system','plaintext')) : 0); + $plaintext = ((feature_enabled($profile_uid,'richtext')) ? false : true); if((! $parent) && (! $api_source) && (! $plaintext)) { $body = fix_mce_lf($body); } diff --git a/mod/message.php b/mod/message.php index d501f3b54..2e4f175e2 100644 --- a/mod/message.php +++ b/mod/message.php @@ -50,10 +50,7 @@ function message_post(&$a) { $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 ); - // Work around doubled linefeeds in Tinymce 3.5b2 - - $plaintext = intval(get_pconfig(local_user(),'system','plaintext')); - if(! $plaintext) { + if(feature_enabled(local_user(),'richtext')) { $body = fix_mce_lf($body); } diff --git a/mod/parse_url.php b/mod/parse_url.php index 962c3e368..600d3dc8b 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -237,12 +237,8 @@ function parse_url_content(&$a) { $text = null; $str_tags = ''; - $textmode = false; - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) - $textmode = true; - //if($textmode) - $br = (($textmode) ? "\n" : '
'); + $br = "\n"; if(x($_GET,'binurl')) $url = trim(hex2bin($_GET['binurl'])); @@ -265,10 +261,7 @@ function parse_url_content(&$a) { logger('parse_url: ' . $url); - if($textmode) - $template = $br . '[url=%s]%s[/url]%s' . $br; - else - $template = "
%s%s
"; + $template = $br . '[url=%s]%s[/url]%s' . $br; $arr = array('url' => $url, 'text' => ''); @@ -282,10 +275,8 @@ function parse_url_content(&$a) { if($url && $title && $text) { - if($textmode) - $text = $br . '[quote]' . trim($text) . '[/quote]' . $br; - else - $text = '
' . trim($text) . '

'; + + $text = $br . '[quote]' . trim($text) . '[/quote]' . $br; $title = str_replace(array("\r","\n"),array('',''),$title); @@ -320,10 +311,7 @@ function parse_url_content(&$a) { $max_images = intval($max_images); foreach ($siteinfo["images"] as $imagedata) { - if($textmode) - $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n"; - else - $image .= 'photo
'; + $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n"; $total_images ++; if($max_images && $max_images >= $total_images) break; @@ -331,10 +319,7 @@ function parse_url_content(&$a) { } if(strlen($text)) { - if($textmode) - $text = $br.'[quote]'.trim($text).'[/quote]'.$br ; - else - $text = '
'.trim($text).'

'; + $text = $br.'[quote]'.trim($text).'[/quote]'.$br ; } if($image) { diff --git a/mod/profiles.php b/mod/profiles.php index f1e67b86b..9661fac69 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -454,9 +454,9 @@ function profiles_content(&$a) { require_once('include/profile_selectors.php'); - $editselect = 'textareas'; - if(intval(get_pconfig(local_user(),'system','plaintext'))) - $editselect = 'none'; + $editselect = 'none'; + if(feature_enabled(local_user(),'richtext')) + $editselect = 'textareas'; $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( '$baseurl' => $a->get_baseurl(true), diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 1b539031b..5d9331ed0 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -135,12 +135,7 @@ function wall_attach_post(&$a) { killme(); } - $lf = '
'; - - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) - $lf = "\n"; - - echo $lf . $lf . '[attachment]' . $r[0]['hash'] . '[/attachment]' . $lf; + echo "\n\n" . '[attachment]' . $r[0]['hash'] . '[/attachment]' . "\n"; killme(); // NOTREACHED diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 8abb7e5a7..c695f9b3e 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -155,23 +155,13 @@ function wall_upload_post(&$a) { $basename = basename($filename); -/* mod Waitman Gobble NO WARRANTY */ - -//if we get the signal then return the image url info in BBCODE, otherwise this outputs the info and bails (for the ajax image uploader on wall post) - if ($_REQUEST['hush']!='yeah') { - - /*existing code*/ - if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) - echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n"; - else - echo '

getExt()."\" alt=\"$basename\" />

"; - /*existing code*/ - - } else { + if($_REQUEST['silent']) { $m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]"; return($m); } -/* mod Waitman Gobble NO WARRANTY */ + else { + echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n"; + } killme(); // NOTREACHED -- cgit v1.2.3