The intelligent shortening for social media systems like Twitter, GNU Social and App.net can now be disabled.

This commit is contained in:
Michael Vogel 2015-05-15 20:56:05 +02:00
parent a138d5d8c0
commit d995fc3994
2 changed files with 23 additions and 2 deletions

View file

@ -182,6 +182,8 @@ function plaintext($a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2) {
$post["url"] = $b["plink"]; $post["url"] = $b["plink"];
} elseif (strpos($b["body"], "[share") !== false) } elseif (strpos($b["body"], "[share") !== false)
$post["url"] = $b["plink"]; $post["url"] = $b["plink"];
elseif (get_pconfig($b["uid"], "system", "no_intelligent_shortening"))
$post["url"] = $b["plink"];
$msg = shortenmsg($msg, $limit); $msg = shortenmsg($msg, $limit);
} }

View file

@ -177,7 +177,9 @@ function settings_post(&$a) {
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors'); check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
if(x($_POST, 'imap-submit')) { if(x($_POST, 'general-submit')) {
set_pconfig(local_user(), 'system', 'no_intelligent_shortening', $_POST['no_intelligent_shortening']);
} elseif(x($_POST, 'imap-submit')) {
$mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : ''); $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
$mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : ''); $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
@ -733,7 +735,24 @@ function settings_content(&$a) {
if(($a->argc > 1) && ($a->argv[1] === 'connectors')) { if(($a->argc > 1) && ($a->argv[1] === 'connectors')) {
$settings_connectors = ""; $settings_connectors = '<span id="settings_general_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_general_expanded\'); openClose(\'settings_general_inflated\');">';
$settings_connectors .= '<h3 class="connector">'. t('General Social Media Settings').'</h3>';
$settings_connectors .= '</span>';
$settings_connectors .= '<div id="settings_general_expanded" class="settings-block" style="display: none;">';
$settings_connectors .= '<span class="fakelink" onclick="openClose(\'settings_general_expanded\'); openClose(\'settings_general_inflated\');">';
$settings_connectors .= '<h3 class="connector">'. t('General Social Media Settings').'</h3>';
$settings_connectors .= '</span>';
$checked = ((get_pconfig(local_user(), 'system', 'no_intelligent_shortening')) ? ' checked="checked" ' : '');
$settings_connectors .= '<div id="general-shortening-wrapper">';
$settings_connectors .= '<label id="general-shortening-label" for="shortening-checkbox">'. t('Disable intelligent shortening'). '</label>';
$settings_connectors .= '<input id="shortening-checkbox" type="checkbox" name="no_intelligent_shortening" value="1" ' . $checked . '/>';
$settings_connectors .= '</div>';
$settings_connectors .= '<div class="settings-submit-wrapper" ><input type="submit" name="general-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>';
$settings_connectors .= '</div><div class="clear"></div>';
call_hooks('connector_settings', $settings_connectors); call_hooks('connector_settings', $settings_connectors);