plaintext default - richtext is a feature

This commit is contained in:
friendica 2012-11-05 01:25:08 -08:00
parent 5f85f65dcc
commit 2752b58f33
11 changed files with 31 additions and 64 deletions

View File

@ -480,8 +480,8 @@
return null; return null;
} }
/*Waitman Gobble Mod*/
function api_statuses_mediap(&$a, $type) { function api_statuses_mediap(&$a, $type) {
if (local_user()===false) { if (local_user()===false) {
logger('api_statuses_update: no user'); logger('api_statuses_update: no user');
return false; return false;
@ -508,7 +508,7 @@
$a->argv[1]=$user_info['screen_name']; //should be set to username? $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'); require_once('mod/wall_upload.php');
$bebop = wall_upload_post($a); $bebop = wall_upload_post($a);
@ -521,7 +521,7 @@
return api_status_show($a,$type); return api_status_show($a,$type);
} }
api_register_func('api/statuses/mediap','api_statuses_mediap', true); api_register_func('api/statuses/mediap','api_statuses_mediap', true);
/*Waitman Gobble Mod*/
function api_statuses_update(&$a, $type) { function api_statuses_update(&$a, $type) {
@ -575,7 +575,7 @@
$_REQUEST['type'] = 'wall'; $_REQUEST['type'] = 'wall';
if(x($_FILES,'media')) { if(x($_FILES,'media')) {
// upload the image if we have one // 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'); require_once('mod/wall_upload.php');
$media = wall_upload_post($a); $media = wall_upload_post($a);
if(strlen($media)>0) if(strlen($media)>0)

View File

@ -1661,9 +1661,9 @@ function status_editor($a,$x,$popup=false) {
$geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : ''); $geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
$plaintext = false; $plaintext = true;
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) if(feature_enabled(local_user(),'richtext'))
$plaintext = true; $plaintext = false;
$tpl = get_markup_template('jot-header.tpl'); $tpl = get_markup_template('jot-header.tpl');

View File

@ -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('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('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('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); call_hooks('get_features',$arr);

View File

@ -289,9 +289,9 @@ EOT;
$contact_id = $a->data['abook']['abook_id']; $contact_id = $a->data['abook']['abook_id'];
$contact = $a->data['abook']; $contact = $a->data['abook'];
$editselect = 'exact'; $editselect = 'none';
if(intval(get_pconfig(local_user(),'system','plaintext'))) if(feature_enabled(local_user(),'richtext'))
$editselect = 'none'; $editselect = 'exact';
$a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array( $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),

View File

@ -28,9 +28,9 @@ function editpost_content(&$a) {
return; return;
} }
$plaintext = false; $plaintext = true;
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) if(feature_enabled(local_user(),'richtext'))
$plaintext = true; $plaintext = false;
$o .= '<h2>' . t('Edit post') . '</h2>'; $o .= '<h2>' . t('Edit post') . '</h2>';

View File

@ -283,7 +283,7 @@ function item_post(&$a) {
// First figure out if it's a status post that would've been // First figure out if it's a status post that would've been
// created using tinymce. Otherwise leave it alone. // 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)) { if((! $parent) && (! $api_source) && (! $plaintext)) {
$body = fix_mce_lf($body); $body = fix_mce_lf($body);
} }

View File

@ -50,10 +50,7 @@ function message_post(&$a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 ); $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 );
// Work around doubled linefeeds in Tinymce 3.5b2 if(feature_enabled(local_user(),'richtext')) {
$plaintext = intval(get_pconfig(local_user(),'system','plaintext'));
if(! $plaintext) {
$body = fix_mce_lf($body); $body = fix_mce_lf($body);
} }

View File

@ -237,12 +237,8 @@ function parse_url_content(&$a) {
$text = null; $text = null;
$str_tags = ''; $str_tags = '';
$textmode = false;
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
$textmode = true;
//if($textmode) $br = "\n";
$br = (($textmode) ? "\n" : '<br />');
if(x($_GET,'binurl')) if(x($_GET,'binurl'))
$url = trim(hex2bin($_GET['binurl'])); $url = trim(hex2bin($_GET['binurl']));
@ -265,10 +261,7 @@ function parse_url_content(&$a) {
logger('parse_url: ' . $url); logger('parse_url: ' . $url);
if($textmode) $template = $br . '[url=%s]%s[/url]%s' . $br;
$template = $br . '[url=%s]%s[/url]%s' . $br;
else
$template = "<br /><a href=\"%s\" >%s</a>%s<br />";
$arr = array('url' => $url, 'text' => ''); $arr = array('url' => $url, 'text' => '');
@ -282,10 +275,8 @@ function parse_url_content(&$a) {
if($url && $title && $text) { if($url && $title && $text) {
if($textmode)
$text = $br . '[quote]' . trim($text) . '[/quote]' . $br; $text = $br . '[quote]' . trim($text) . '[/quote]' . $br;
else
$text = '<br /><blockquote>' . trim($text) . '</blockquote><br />';
$title = str_replace(array("\r","\n"),array('',''),$title); $title = str_replace(array("\r","\n"),array('',''),$title);
@ -320,10 +311,7 @@ function parse_url_content(&$a) {
$max_images = intval($max_images); $max_images = intval($max_images);
foreach ($siteinfo["images"] as $imagedata) { foreach ($siteinfo["images"] as $imagedata) {
if($textmode) $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
$image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
else
$image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" /><br />';
$total_images ++; $total_images ++;
if($max_images && $max_images >= $total_images) if($max_images && $max_images >= $total_images)
break; break;
@ -331,10 +319,7 @@ function parse_url_content(&$a) {
} }
if(strlen($text)) { if(strlen($text)) {
if($textmode) $text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
$text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
else
$text = '<br /><blockquote>'.trim($text).'</blockquote><br />';
} }
if($image) { if($image) {

View File

@ -454,9 +454,9 @@ function profiles_content(&$a) {
require_once('include/profile_selectors.php'); require_once('include/profile_selectors.php');
$editselect = 'textareas'; $editselect = 'none';
if(intval(get_pconfig(local_user(),'system','plaintext'))) if(feature_enabled(local_user(),'richtext'))
$editselect = 'none'; $editselect = 'textareas';
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),

View File

@ -135,12 +135,7 @@ function wall_attach_post(&$a) {
killme(); killme();
} }
$lf = '<br />'; echo "\n\n" . '[attachment]' . $r[0]['hash'] . '[/attachment]' . "\n";
if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
$lf = "\n";
echo $lf . $lf . '[attachment]' . $r[0]['hash'] . '[/attachment]' . $lf;
killme(); killme();
// NOTREACHED // NOTREACHED

View File

@ -155,23 +155,13 @@ function wall_upload_post(&$a) {
$basename = basename($filename); $basename = basename($filename);
/* mod Waitman Gobble NO WARRANTY */ if($_REQUEST['silent']) {
//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 '<br /><br /><a href="' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."\" alt=\"$basename\" /></a><br /><br />";
/*existing code*/
} else {
$m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]"; $m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
return($m); 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(); killme();
// NOTREACHED // NOTREACHED