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;
}
/*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)

View File

@ -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');

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('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);

View File

@ -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),

View File

@ -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 .= '<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
// 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);
}

View File

@ -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);
}

View File

@ -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 />');
$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 = "<br /><a href=\"%s\" >%s</a>%s<br />";
$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 = '<br /><blockquote>' . trim($text) . '</blockquote><br />';
$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 .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" /><br />';
$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 = '<br /><blockquote>'.trim($text).'</blockquote><br />';
$text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
}
if($image) {

View File

@ -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),

View File

@ -135,12 +135,7 @@ function wall_attach_post(&$a) {
killme();
}
$lf = '<br />';
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

View File

@ -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 '<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 {
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