X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fitems.php;h=88eec1dc48794de8faa89f91ac80aeaaedf91ac0;hb=4375edd63e44b71913bd45bf25a4a554582b581e;hp=c3113836138c1ff8c25784a109ca22dc2b0d355d;hpb=5437e99090b53c0c8d48c57812211f755fff5800;p=friendica.git diff --git a/include/items.php b/include/items.php index c311383613..88eec1dc48 100644 --- a/include/items.php +++ b/include/items.php @@ -5,8 +5,8 @@ use Friendica\BaseObject; use Friendica\Content\Feature; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; @@ -24,13 +24,10 @@ use Friendica\Util\ParseUrl; use Friendica\Util\Strings; use Friendica\Util\Temporal; -require_once 'include/text.php'; require_once 'mod/share.php'; -require_once 'include/enotify.php'; - function add_page_info_data(array $data, $no_photos = false) { - Addon::callHooks('page_info_data', $data); + Hook::callAll('page_info_data', $data); if (empty($data['type'])) { return ''; @@ -206,8 +203,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) $body = $removedlink; } - $url = str_replace(['/', '.'], ['\/', '\.'], $matches[1]); - $removedlink = preg_replace("/\[url\=" . $url . "\](.*?)\[\/url\]/ism", '', $body); + $removedlink = preg_replace("/\[url\=" . preg_quote($matches[1], '/') . "\](.*?)\[\/url\]/ism", '', $body); if (($removedlink == "") || strstr($body, $removedlink)) { $body = $removedlink; } @@ -246,26 +242,26 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) * model where comments can have sub-threads. That would require some massive sorting * to get all the feed items into a mostly linear ordering, and might still require * recursion. + * + * @param $xml + * @param array $importer + * @param array $contact + * @param $hub + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ -function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0, $pass = 0) +function consume_feed($xml, array $importer, array $contact, &$hub) { if ($contact['network'] === Protocol::OSTATUS) { - if ($pass < 2) { - // Test - remove before flight - //$tempfile = tempnam(get_temppath(), "ostatus2"); - //file_put_contents($tempfile, $xml); - Logger::log("Consume OStatus messages ", Logger::DEBUG); - OStatus::import($xml, $importer, $contact, $hub); - } + Logger::log("Consume OStatus messages ", Logger::DEBUG); + OStatus::import($xml, $importer, $contact, $hub); return; } if ($contact['network'] === Protocol::FEED) { - if ($pass < 2) { - Logger::log("Consume feeds", Logger::DEBUG); - Feed::import($xml, $importer, $contact, $hub); - } + Logger::log("Consume feeds", Logger::DEBUG); + Feed::import($xml, $importer, $contact, $hub); return; } @@ -297,8 +293,6 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub return; } - $a = BaseObject::getApp(); - $user = DBA::selectFirst('user', ['nickname'], ['uid' => $importer['uid']]); // No user, no nickname, we quit @@ -352,7 +346,7 @@ function drop_item($id, $return = '') // locate item to be deleted - $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', parent]; + $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent']; $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]); if (!DBA::isResult($item)) {