Merge remote-tracking branch 'upstream/develop' into 1409-shadow-items
This commit is contained in:
commit
1a0a80c310
20 changed files with 15805 additions and 15606 deletions
|
@ -56,6 +56,8 @@ function diaspora2bb($s) {
|
|||
|
||||
function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
|
||||
|
||||
$OriginalText = $Text;
|
||||
|
||||
// Since Diaspora is creating a summary for links, this function removes them before posting
|
||||
if ($fordiaspora)
|
||||
$Text = bb_remove_share_information($Text);
|
||||
|
@ -73,12 +75,24 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
|
|||
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
|
||||
|
||||
// Convert it to HTML - don't try oembed
|
||||
if ($fordiaspora)
|
||||
if ($fordiaspora) {
|
||||
$Text = bbcode($Text, $preserve_nl, false, 3);
|
||||
else {
|
||||
|
||||
// Add all tags that maybe were removed
|
||||
if (preg_match_all("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",$OriginalText, $tags)) {
|
||||
$tagline = "";
|
||||
foreach($tags[2] as $tag)
|
||||
if (!strpos($Text, "#".$tag))
|
||||
$tagline .= "#".$tag." ";
|
||||
|
||||
$Text = $Text."<br />".$tagline;
|
||||
}
|
||||
|
||||
} else {
|
||||
$Text = bbcode($Text, $preserve_nl, false, 4);
|
||||
|
||||
// Libertree doesn't convert a harizontal rule if there isn't a linefeed
|
||||
$Text = str_replace("<hr />", "<br /><hr />", $Text);
|
||||
$Text = str_replace(array("<hr />", "<hr>"), array("<br /><hr />", "<br><hr>"), $Text);
|
||||
}
|
||||
|
||||
// Now convert HTML to Markdown
|
||||
|
|
|
@ -3,10 +3,10 @@ require_once("include/oembed.php");
|
|||
require_once('include/event.php');
|
||||
|
||||
function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
||||
$Text = preg_replace_callback("/\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
|
||||
$Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
|
||||
function ($match) use ($plaintext){
|
||||
|
||||
$attributes = $match[1];
|
||||
$attributes = $match[2];
|
||||
|
||||
$type = "";
|
||||
preg_match("/type='(.*?)'/ism", $attributes, $matches);
|
||||
|
@ -65,6 +65,11 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
|||
$preview = $matches[1];
|
||||
}
|
||||
|
||||
if (((strpos($match[1], "[img=") !== false) OR (strpos($match[1], "[img]") !== false)) AND ($image != "")) {
|
||||
$preview = $image;
|
||||
$image = "";
|
||||
}
|
||||
|
||||
if ($plaintext)
|
||||
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $url, $title);
|
||||
else {
|
||||
|
@ -83,10 +88,10 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
|
|||
|
||||
$text .= $oembed;
|
||||
|
||||
$text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[2]));
|
||||
$text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
|
||||
}
|
||||
|
||||
return($text);
|
||||
return($match[1].$text);
|
||||
},$Text);
|
||||
|
||||
return($Text);
|
||||
|
|
|
@ -10,7 +10,7 @@ function gprobe_run(&$argv, &$argc){
|
|||
if(is_null($a)) {
|
||||
$a = new App;
|
||||
}
|
||||
|
||||
|
||||
if(is_null($db)) {
|
||||
@include(".htconfig.php");
|
||||
require_once("include/dba.php");
|
||||
|
@ -37,6 +37,8 @@ function gprobe_run(&$argv, &$argc){
|
|||
dbesc(normalise_link($url))
|
||||
);
|
||||
|
||||
logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
|
||||
|
||||
if(! count($r)) {
|
||||
|
||||
$arr = probe_url($url);
|
||||
|
@ -55,7 +57,8 @@ function gprobe_run(&$argv, &$argc){
|
|||
}
|
||||
if(count($r))
|
||||
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
|
||||
|
||||
|
||||
logger("gprobe end for ".normalise_link($url), LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -872,9 +872,18 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
|||
}
|
||||
|
||||
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
|
||||
$res["body"] = $res["title"].add_page_info($res['plink'], false, "", ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']);
|
||||
$preview = "";
|
||||
|
||||
// Handle enclosures and treat them as preview picture
|
||||
if (isset($attach))
|
||||
foreach ($attach AS $attachment)
|
||||
if ($attachment->type == "image/jpeg")
|
||||
$preview = $attachment->link;
|
||||
|
||||
$res["body"] = $res["title"].add_page_info($res['plink'], false, $preview, ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']);
|
||||
$res["title"] = "";
|
||||
$res["object-type"] = ACTIVITY_OBJ_BOOKMARK;
|
||||
unset($res["attach"]);
|
||||
} elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS))
|
||||
$res["body"] = add_page_info_to_body($res["body"]);
|
||||
elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND strstr($res['plink'], ".app.net/")) {
|
||||
|
@ -903,6 +912,12 @@ function add_page_info_data($data) {
|
|||
if ($no_photos AND ($data["type"] == "photo"))
|
||||
return("");
|
||||
|
||||
// If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
|
||||
if (strpos($data["url"], '[') OR strpos($data["url"], ']')) {
|
||||
require_once("include/network.php");
|
||||
$data["url"] = short_link($data["url"]);
|
||||
}
|
||||
|
||||
if (($data["type"] != "photo") AND is_string($data["title"]))
|
||||
$text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]";
|
||||
|
||||
|
@ -935,6 +950,9 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false,
|
|||
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
|
||||
if ($photo != "")
|
||||
$data["images"][0]["src"] = $photo;
|
||||
|
||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
|
||||
if (!$keywords AND isset($data["keywords"]))
|
||||
|
|
|
@ -1130,7 +1130,7 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
if (in_array($param, array("utm_source", "utm_medium", "utm_term", "utm_content", "utm_campaign",
|
||||
"wt_mc", "pk_campaign", "pk_kwd", "mc_cid", "mc_eid",
|
||||
"fb_action_ids", "fb_action_types", "fb_ref",
|
||||
"awesm",
|
||||
"awesm", "wtrid",
|
||||
"woo_campaign", "woo_source", "woo_medium", "woo_content", "woo_term"))) {
|
||||
|
||||
$pair = $param."=".urlencode($value);
|
||||
|
|
|
@ -78,6 +78,11 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
|
|||
if (!is_object($j))
|
||||
return false;
|
||||
|
||||
// Always embed the SSL version
|
||||
if (isset($j->html))
|
||||
$j->html = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
|
||||
array("https://www.youtube.com/", "https://player.vimeo.com/"), $j->html);
|
||||
|
||||
$j->embedurl = $embedurl;
|
||||
|
||||
// If fetching information doesn't work, then improve via internal functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue