Skip to content

Commit 0a6dc86

Browse files
committed
Minor: Social: Format code
1 parent fdd1c83 commit 0a6dc86

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

main/inc/ajax/social.ajax.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@
320320
break;
321321
// Read the Url using OpenGraph and returns the hyperlinks content
322322
case 'read_url_with_open_graph':
323-
$url = isset($_POST['social_wall_new_msg_main']) ? $_POST['social_wall_new_msg_main'] : '';
323+
$url = $_POST['social_wall_new_msg_main'] ?? '';
324324
$url = trim($url);
325325
$html = '';
326-
if (SocialManager::verifyUrl($url) == true) {
326+
if (SocialManager::verifyUrl($url)) {
327327
$html = Security::remove_XSS(
328328
SocialManager::readContentWithOpenGraph($url)
329329
);

main/inc/lib/social.lib.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,12 +2059,8 @@ public static function formatWallMessages($messages)
20592059

20602060
/**
20612061
* get html data with OpenGrap passing the URL.
2062-
*
2063-
* @param $link url
2064-
*
2065-
* @return string data html
20662062
*/
2067-
public static function readContentWithOpenGraph($link)
2063+
public static function readContentWithOpenGraph(string $link): string
20682064
{
20692065
if (strpos($link, "://") === false && substr($link, 0, 1) != "/") {
20702066
$link = "http://".$link;
@@ -2094,12 +2090,8 @@ public static function readContentWithOpenGraph($link)
20942090

20952091
/**
20962092
* verify if Url Exist - Using Curl.
2097-
*
2098-
* @param $uri url
2099-
*
2100-
* @return bool
21012093
*/
2102-
public static function verifyUrl($uri)
2094+
public static function verifyUrl(string $uri): bool
21032095
{
21042096
$curl = curl_init($uri);
21052097
curl_setopt($curl, CURLOPT_FAILONERROR, true);
@@ -2368,7 +2360,7 @@ function ($a, $b) {
23682360
/**
23692361
* @return string Get the JS code necessary for social wall to load open graph from URLs.
23702362
*/
2371-
public static function getScriptToGetOpenGraph()
2363+
public static function getScriptToGetOpenGraph(): string
23722364
{
23732365
return '<script>
23742366
$(function() {
@@ -2836,7 +2828,7 @@ public static function getExtraFieldBlock($user_id, $isArray = false)
28362828
break;
28372829
case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
28382830
$icon_path = UserManager::get_favicon_from_url($data);
2839-
if (self::verifyUrl($icon_path) == false) {
2831+
if (!self::verifyUrl($icon_path)) {
28402832
break;
28412833
}
28422834
$bottom = '0.2';

0 commit comments

Comments
 (0)