Also, URL shortening now consistently uses 'maxurllength'...
-Everybody loves URL shorteners. These are some options for fine-tuning
-how and when the server shortens URLs.
+These are some options for fine-tuning how and when the server will
+shorten URLs.
shortener: URL shortening service to use by default. Users can override
shortener: URL shortening service to use by default. Users can override
- individually. 'ur1.ca' by default.
-maxlength: If an URL is strictly longer than this limit, it will be
+ individually. 'internal' by default.
+maxurllength: If an URL is strictly longer than this limit, it will be
shortened. Note that the URL shortener service may return an
shortened. Note that the URL shortener service may return an
- URL longer than this limit. Defaults to 25. Users can
+ URL longer than this limit. Defaults to 100. Users can
override. If set to 0, all URLs will be shortened.
maxnoticelength: If a notice is strictly longer than this limit, all
URLs in the notice will be shortened. Users can override.
override. If set to 0, all URLs will be shortened.
maxnoticelength: If a notice is strictly longer than this limit, all
URLs in the notice will be shortened. Users can override.
'xmpp' => array('enabled', 'server', 'port', 'user'),
'integration' => array('source'),
'attachments' => array('uploads', 'file_quota'),
'xmpp' => array('enabled', 'server', 'port', 'user'),
'integration' => array('source'),
'attachments' => array('uploads', 'file_quota'),
- 'url' => array('maxlength', 'maxnoticelength'),
+ 'url' => array('maxurllength', 'maxnoticelength'),
(!is_null($this->arg('maxurllength'))) ?
$this->arg('maxurllength') : User_urlshortener_prefs::maxUrlLength($user),
// TRANS: Field title in URL settings in profile.
(!is_null($this->arg('maxurllength'))) ?
$this->arg('maxurllength') : User_urlshortener_prefs::maxUrlLength($user),
// TRANS: Field title in URL settings in profile.
- _('URLs longer than this will be shortened, 0 means always shorten.'));
+ _('URLs longer than this will be shortened, -1 means never shorten because a URL is long.'));
$this->elementEnd('li');
$this->elementStart('li');
$this->input('maxnoticelength',
$this->elementEnd('li');
$this->elementStart('li');
$this->input('maxnoticelength',
(!is_null($this->arg('maxnoticelength'))) ?
$this->arg('maxnoticelength') : User_urlshortener_prefs::maxNoticeLength($user),
// TRANS: Field title in URL settings in profile.
(!is_null($this->arg('maxnoticelength'))) ?
$this->arg('maxnoticelength') : User_urlshortener_prefs::maxNoticeLength($user),
// TRANS: Field title in URL settings in profile.
- _('URLs in notices longer than this will always be shortened, -1 means shorten only if notice text exceeds maximum length.'));
+ _('URLs in notices longer than this will always be shortened, -1 means only shorten if the full post exceeds maximum length.'));
$this->elementEnd('li');
$this->elementEnd('ul');
// TRANS: Button text for saving "Other settings" in profile.
$this->elementEnd('li');
$this->elementEnd('ul');
// TRANS: Button text for saving "Other settings" in profile.
$maxurllength = $this->trimmed('maxurllength');
$maxurllength = $this->trimmed('maxurllength');
- if (!Validate::number($maxurllength, array('min' => 0))) {
+ if (!Validate::number($maxurllength, array('min' => -1))) {
// TRANS: Client exception thrown when the maximum URL settings value is invalid in profile URL settings.
throw new ClientException(_('Invalid number for maximum URL length.'));
}
// TRANS: Client exception thrown when the maximum URL settings value is invalid in profile URL settings.
throw new ClientException(_('Invalid number for maximum URL length.'));
}
static function maxUrlLength($user)
{
static function maxUrlLength($user)
{
- $def = common_config('url', 'maxlength');
+ $def = common_config('url', 'maxurllength');
$prefs = self::getPrefs($user);
$prefs = self::getPrefs($user);
'external' => 'sometimes'), // Options: 'sometimes', 'never', default = 'sometimes'
'url' =>
array('shortener' => 'internal',
'external' => 'sometimes'), // Options: 'sometimes', 'never', default = 'sometimes'
'url' =>
array('shortener' => 'internal',
'maxnoticelength' => -1),
'http' => // HTTP client settings when contacting other sites
array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
'maxnoticelength' => -1),
'http' => // HTTP client settings when contacting other sites
array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
// $force forces shortening even if it's not strictly needed
// I doubt URL shortening is ever 'strictly' needed. - ESP
// $force forces shortening even if it's not strictly needed
// I doubt URL shortening is ever 'strictly' needed. - ESP
- if (mb_strlen($long_url) < $maxUrlLength && !$force) {
+ if (($maxUrlLength == -1 || mb_strlen($long_url) < $maxUrlLength) && !$force) {