Merge branch 'master' into develop

This commit is contained in:
Hypolite Petovan 2018-03-23 06:15:55 -04:00
commit 27d94023ee
70 changed files with 27138 additions and 26508 deletions

View file

@ -10,17 +10,23 @@ use Friendica\Core\Addon;
* Leaflet Map related functions
*/
class Map {
public static function byCoordinates($coord) {
public static function byCoordinates($coord, $html_mode = 0) {
$coord = trim($coord);
$coord = str_replace([',','/',' '],[' ',' ',' '],$coord);
$arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''];
$arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'mode' => $html_mode, 'html' => ''];
Addon::callHooks('generate_map',$arr);
return ($arr['html']) ? $arr['html'] : $coord;
}
public static function byLocation($location) {
$arr = ['location' => $location, 'html' => ''];
public static function byLocation($location, $html_mode = 0) {
$arr = ['location' => $location, 'mode' => $html_mode, 'html' => ''];
Addon::callHooks('generate_named_map',$arr);
return ($arr['html']) ? $arr['html'] : $location;
}
public static function getCoordinates($location) {
$arr = ['location' => $location, 'lat' => false, 'lon' => false];
Addon::callHooks('Map::getCoordinates', $arr);
return $arr;
}
}

View file

@ -217,7 +217,7 @@ class Network
$newurl = $curl_info['redirect_url'];
if (($new_location_info['path'] == '') && ( $new_location_info['host'] != '')) {
if (($new_location_info['path'] == '') && ($new_location_info['host'] != '')) {
$newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path'];
}
@ -229,6 +229,11 @@ class Network
if (strpos($newurl, '/') === 0) {
$newurl = $old_location_info["scheme"]."://".$old_location_info["host"].$newurl;
}
$old_location_query = @parse_url($url, PHP_URL_QUERY);
if ($old_location_query != '') {
$newurl .= '?' . $old_location_query;
}
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
$redirects++;