mirror of
https://github.com/friendica/friendica
synced 2025-04-30 00:24:24 +02:00
normalise_link calls
implement normaliseLink function
This commit is contained in:
parent
5276c28a78
commit
ffc406d819
54 changed files with 248 additions and 222 deletions
|
@ -10,6 +10,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
* @brief ContactSelector class
|
||||
|
@ -106,12 +107,12 @@ class ContactSelector
|
|||
// Create the server url out of the profile url
|
||||
$parts = parse_url($profile);
|
||||
unset($parts['path']);
|
||||
$server_url = [normalise_link(Network::unparseURL($parts))];
|
||||
$server_url = [Strings::normaliseLink(Network::unparseURL($parts))];
|
||||
|
||||
// Fetch the server url
|
||||
$gcontact = DBA::selectFirst('gcontact', ['server_url'], ['nurl' => normalise_link($profile)]);
|
||||
$gcontact = DBA::selectFirst('gcontact', ['server_url'], ['nurl' => Strings::normaliseLink($profile)]);
|
||||
if (!empty($gcontact) && !empty($gcontact['server_url'])) {
|
||||
$server_url[] = normalise_link($gcontact['server_url']);
|
||||
$server_url[] = Strings::normaliseLink($gcontact['server_url']);
|
||||
}
|
||||
|
||||
// Now query the GServer for the platform name
|
||||
|
|
|
@ -62,7 +62,7 @@ class OEmbed
|
|||
|
||||
$cache_key = 'oembed:' . $a->videowidth . ':' . $embedurl;
|
||||
|
||||
$condition = ['url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth];
|
||||
$condition = ['url' => Strings::normaliseLink($embedurl), 'maxwidth' => $a->videowidth];
|
||||
$oembed_record = DBA::selectFirst('oembed', ['content'], $condition);
|
||||
if (DBA::isResult($oembed_record)) {
|
||||
$json_string = $oembed_record['content'];
|
||||
|
@ -117,7 +117,7 @@ class OEmbed
|
|||
|
||||
if (!empty($oembed->type) && $oembed->type != 'error') {
|
||||
DBA::insert('oembed', [
|
||||
'url' => normalise_link($embedurl),
|
||||
'url' => Strings::normaliseLink($embedurl),
|
||||
'maxwidth' => $a->videowidth,
|
||||
'content' => $json_string,
|
||||
'created' => DateTimeFormat::utcNow()
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Util\Map;
|
|||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
class BBCode extends BaseObject
|
||||
{
|
||||
|
@ -943,7 +944,7 @@ class BBCode extends BaseObject
|
|||
case 3: // Diaspora
|
||||
$headline = '<p><b>' . html_entity_decode('♲ ', ENT_QUOTES, 'UTF-8') . $mention . ':</b></p>' . "\n";
|
||||
|
||||
if (stripos(normalise_link($attributes['link']), 'http://twitter.com/') === 0) {
|
||||
if (stripos(Strings::normaliseLink($attributes['link']), 'http://twitter.com/') === 0) {
|
||||
$text = ($is_quote_share? '<hr />' : '') . '<p><a href="' . $attributes['link'] . '">' . $attributes['link'] . '</a></p>' . "\n";
|
||||
} else {
|
||||
$text = ($is_quote_share? '<hr />' : '') . $headline . '<blockquote>' . trim($content) . '</blockquote>' . "\n";
|
||||
|
@ -978,7 +979,7 @@ class BBCode extends BaseObject
|
|||
break;
|
||||
default:
|
||||
// Transforms quoted tweets in rich attachments to avoid nested tweets
|
||||
if (stripos(normalise_link($attributes['link']), 'http://twitter.com/') === 0 && OEmbed::isAllowedURL($attributes['link'])) {
|
||||
if (stripos(Strings::normaliseLink($attributes['link']), 'http://twitter.com/') === 0 && OEmbed::isAllowedURL($attributes['link'])) {
|
||||
try {
|
||||
$text = ($is_quote_share? '<br />' : '') . OEmbed::getHTML($attributes['link']);
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'boot.php';
|
||||
|
@ -270,11 +271,11 @@ class Widget
|
|||
if (!$cid) {
|
||||
if (Profile::getMyURL()) {
|
||||
$contact = DBA::selectFirst('contact', ['id'],
|
||||
['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]);
|
||||
['nurl' => Strings::normaliseLink(Profile::getMyURL()), 'uid' => $profile_uid]);
|
||||
if (DBA::isResult($contact)) {
|
||||
$cid = $contact['id'];
|
||||
} else {
|
||||
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
|
||||
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => Strings::normaliseLink(Profile::getMyURL())]);
|
||||
if (DBA::isResult($gcontact)) {
|
||||
$zcid = $gcontact['id'];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue