use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
+use Friendica\Util\Temporal;
-require_once 'include/bbcode.php';
-require_once 'include/tags.php';
require_once 'include/text.php';
-require_once 'include/threads.php';
require_once 'mod/share.php';
require_once 'include/enotify.php';
-function add_page_info_data($data) {
+function add_page_info_data($data, $no_photos = false) {
Addon::callHooks('page_info_data', $data);
// It maybe is a rich content, but if it does have everything that a link has,
// then treat it that way
if (($data["type"] == "rich") && is_string($data["title"]) &&
- is_string($data["text"]) && (sizeof($data["images"]) > 0)) {
+ is_string($data["text"]) && !empty($data["images"])) {
$data["type"] = "link";
}
$text .= " title='".$data["title"]."'";
}
- if (sizeof($data["images"]) > 0) {
+ if (!empty($data["images"])) {
$preview = str_replace(["[", "]"], ["[", "]"], htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false));
// if the preview picture is larger than 500 pixels then show it in a larger mode
// But only, if the picture isn't higher than large (To prevent huge posts)
return "\n".$text.$hashtags;
}
-function query_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
+function query_page_info($url, $photo = "", $keywords = false, $keyword_blacklist = "") {
$data = ParseUrl::getSiteinfoCached($url, true);
return $data;
}
-function add_page_keywords($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
- $data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
+function add_page_keywords($url, $photo = "", $keywords = false, $keyword_blacklist = "") {
+ $data = query_page_info($url, $photo, $keywords, $keyword_blacklist);
$tags = "";
if (isset($data["keywords"]) && count($data["keywords"])) {
}
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
- $data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
+ $data = query_page_info($url, $photo, $keywords, $keyword_blacklist);
- $text = add_page_info_data($data);
+ $text = add_page_info_data($data, $no_photos);
return $text;
}
*
* @TODO find proper type-hints
*/
-function consume_feed($xml, $importer, &$contact, &$hub, $datedir = 0, $pass = 0) {
+function consume_feed($xml, $importer, $contact, &$hub, $datedir = 0, $pass = 0) {
if ($contact['network'] === NETWORK_OSTATUS) {
if ($pass < 2) {
// Test - remove before flight
return;
}
- $push_url = Config::get('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
+ $push_url = System::baseUrl() . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
// Use a single verify token, even if multiple hubs
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string());
if (count($items)) {
foreach ($items as $item) {
- $owner = Item::delete($item);
+ $owner = Item::deleteById($item);
if ($owner && !$uid)
$uid = $owner;
}
}
// delete the item
- Item::delete($item['id']);
+ Item::deleteById($item['id']);
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
//NOTREACHED
while (substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
$dyear = intval(substr($dnow, 0, 4));
$dstart = substr($dnow, 0, 8) . '01';
- $dend = substr($dnow, 0, 8) . get_dim(intval($dnow), intval(substr($dnow, 5)));
+ $dend = substr($dnow, 0, 8) . Temporal::getDaysInMonth(intval($dnow), intval(substr($dnow, 5)));
$start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
$end_month = DateTimeFormat::utc($dend, 'Y-m-d');
$str = day_translate(DateTimeFormat::utc($dnow, 'F'));