Merge branch 'Art4/fix-phpstan-error-level-2' into develop
commit
04c402607b
|
@ -29,10 +29,10 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
|
|||
$now = new DateTime();
|
||||
|
||||
if (!is_null($cached)) {
|
||||
$cdate = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'last');
|
||||
$cdate = (int) DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'last');
|
||||
$cached = unserialize($cached);
|
||||
|
||||
if ($cdate + $cachetime > $now->getTimestamp()) {
|
||||
if ($cdate + (int) $cachetime > $now->getTimestamp()) {
|
||||
return $cached;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class qqFileUploader {
|
|||
|
||||
private function toBytes(string $str): int
|
||||
{
|
||||
$val = trim($str);
|
||||
$val = (int) trim($str);
|
||||
$last = strtolower($str[strlen($str) - 1]);
|
||||
|
||||
switch($last) {
|
||||
|
|
|
@ -60,7 +60,7 @@ function js_upload_post_init(array &$b)
|
|||
// max file size in bytes
|
||||
$sizeLimit = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
|
||||
|
||||
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
|
||||
$uploader = new js_upload_qqFileUploader($allowedExtensions, $sizeLimit);
|
||||
|
||||
$result = $uploader->handleUpload();
|
||||
|
||||
|
@ -101,7 +101,7 @@ function js_upload_post_end(int &$b)
|
|||
/**
|
||||
* Handle file uploads via XMLHttpRequest
|
||||
*/
|
||||
class qqUploadedFileXhr
|
||||
class js_upload_qqUploadedFileXhr
|
||||
{
|
||||
private $pathnm = '';
|
||||
|
||||
|
@ -155,7 +155,7 @@ class qqUploadedFileXhr
|
|||
/**
|
||||
* Handle file uploads via regular form post (uses the $_FILES array)
|
||||
*/
|
||||
class qqUploadedFileForm
|
||||
class js_upload_qqUploadedFileForm
|
||||
{
|
||||
/**
|
||||
* Save the file to the specified path
|
||||
|
@ -183,7 +183,7 @@ class qqUploadedFileForm
|
|||
}
|
||||
}
|
||||
|
||||
class qqFileUploader
|
||||
class js_upload_qqFileUploader
|
||||
{
|
||||
private $allowedExtensions;
|
||||
private $sizeLimit;
|
||||
|
@ -197,9 +197,9 @@ class qqFileUploader
|
|||
$this->sizeLimit = $sizeLimit;
|
||||
|
||||
if (isset($_GET['qqfile'])) {
|
||||
$this->file = new qqUploadedFileXhr();
|
||||
$this->file = new js_upload_qqUploadedFileXhr();
|
||||
} elseif (isset($_FILES['qqfile'])) {
|
||||
$this->file = new qqUploadedFileForm();
|
||||
$this->file = new js_upload_qqUploadedFileForm();
|
||||
} else {
|
||||
$this->file = false;
|
||||
}
|
||||
|
|
|
@ -1519,7 +1519,6 @@ class PHPMailer
|
|||
public function getSMTPInstance()
|
||||
{
|
||||
if (!is_object($this->smtp)) {
|
||||
/** @phpstan-ignore-next-line file class.smtp.php does not exist */
|
||||
$this->smtp = new SMTP;
|
||||
}
|
||||
return $this->smtp;
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
* Status: Unsupported
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
function membersince_install()
|
||||
|
@ -19,7 +19,19 @@ function membersince_install()
|
|||
|
||||
function membersince_display(array &$b)
|
||||
{
|
||||
if (DI::app()->getCurrentTheme() == 'frio') {
|
||||
$uid = DI::userSession()->getLocalUserId();
|
||||
|
||||
if ($uid === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getById($uid, ['register_date']);
|
||||
|
||||
if ($user === false || !array_key_exists('register_date', $user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DI::appHelper()->getCurrentTheme() == 'frio') {
|
||||
// Works in Frio.
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8'));
|
||||
|
@ -39,7 +51,7 @@ function membersince_display(array &$b)
|
|||
$label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted');
|
||||
|
||||
// The div for the register date of the profile owner.
|
||||
$entry = $doc->createElement('div', DateTimeFormat::local(DI::app()->profile['register_date']));
|
||||
$entry = $doc->createElement('div', DateTimeFormat::local($user['register_date']));
|
||||
$entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry');
|
||||
|
||||
$div->appendChild($hr);
|
||||
|
@ -50,6 +62,6 @@ function membersince_display(array &$b)
|
|||
$b = $doc->saveHTML();
|
||||
} else {
|
||||
// Works in Vier.
|
||||
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local(DI::app()->profile['register_date']) . "</dd>\n</dl>", $b, 1);
|
||||
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($user['register_date']) . "</dd>\n</dl>", $b, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class phpnut
|
|||
/**
|
||||
* Constructs an phpnut PHP object with the specified client ID and
|
||||
* client secret.
|
||||
* @param string $client_id The client ID you received from pnut.io when
|
||||
* @param string $client_id_or_token The client ID you received from pnut.io when
|
||||
* creating your app.
|
||||
* @param string $client_secret The client secret you received from
|
||||
* pnut.io when creating your app.
|
||||
|
@ -161,7 +161,7 @@ class phpnut
|
|||
* or not access to your app. Usually you would place this as a link for
|
||||
* the user to client, or a redirect to send them to the auth URL.
|
||||
* Also can be called after authentication for additional scopes
|
||||
* @param string $callbackUri Where you want the user to be directed
|
||||
* @param string $callback_uri Where you want the user to be directed
|
||||
* after authenticating with pnut.io. This must be one of the URIs
|
||||
* allowed by your pnut.io application settings.
|
||||
* @param array $scope An array of scopes (permissions) you wish to obtain
|
||||
|
@ -748,7 +748,7 @@ class phpnut
|
|||
* Delete a Post. The current user must be the same user who created the Post.
|
||||
* It returns the deleted Post on success.
|
||||
* @param integer $post_id The ID of the post to delete
|
||||
* @param array An associative array representing the post that was deleted
|
||||
* @return array An associative array representing the post that was deleted
|
||||
*/
|
||||
public function deletePost(int $post_id)
|
||||
{
|
||||
|
@ -1296,7 +1296,7 @@ class phpnut
|
|||
|
||||
/**
|
||||
* List the users who match a specific search term
|
||||
* @param string $search The search query. Supports @username or #tag searches as
|
||||
* @param string $query The search query. Supports @username or #tag searches as
|
||||
* well as normal search terms. Searches username, display name, bio information.
|
||||
* Does not search posts.
|
||||
* @return array|false An array of associative arrays, each representing one user.
|
||||
|
@ -2023,7 +2023,7 @@ class phpnut
|
|||
/**
|
||||
* Responds to a poll.
|
||||
* @param integer $poll_id The ID of the poll to respond to
|
||||
* @param array list of positions for the poll response
|
||||
* @param array $positions list of positions for the poll response
|
||||
* @param array $params An associative array of optional general parameters.
|
||||
*/
|
||||
public function respondToPoll(int $poll_id, array $positions, array $params=[])
|
||||
|
@ -2098,8 +2098,6 @@ class phpnut
|
|||
* List the polls that match a specific search term
|
||||
* @param array $params a list of filter, search query, and general Poll parameters
|
||||
* see: https://docs.pnut.io/resources/channels/search
|
||||
* @param string $query The search query. Supports
|
||||
* normal search terms.
|
||||
* @return array An array of associative arrays, each representing one poll.
|
||||
* or false on error
|
||||
*/
|
||||
|
@ -2179,14 +2177,12 @@ class phpnut
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Registers your function (or an array of object and method) to be called
|
||||
* whenever an event is received via an open pnut.io stream. Your function
|
||||
* will receive a single parameter, which is the object wrapper containing
|
||||
* the meta and data.
|
||||
* @param mixed A PHP callback (either a string containing the function name,
|
||||
* @param mixed $function A PHP callback (either a string containing the function name,
|
||||
* or an array where the first element is the class/object and the second
|
||||
* is the method).
|
||||
*/
|
||||
|
@ -2247,7 +2243,6 @@ class phpnut
|
|||
|
||||
/**
|
||||
* Close the currently open stream.
|
||||
* @return true;
|
||||
*/
|
||||
public function closeStream(): void
|
||||
{
|
||||
|
@ -2460,7 +2455,7 @@ class phpnut
|
|||
* Process an open stream for x microseconds, then return. This is useful if you want
|
||||
* to be doing other things while processing the stream. If you just want to
|
||||
* consume the stream without other actions, you can call processForever() instead.
|
||||
* @param float @microseconds The number of microseconds to process for before
|
||||
* @param null|float $microseconds The number of microseconds to process for before
|
||||
* returning. There are 1,000,000 microseconds in a second.
|
||||
*
|
||||
* @return void
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
@ -79,6 +78,7 @@ function get_body_length($body)
|
|||
* Checking any possible syntax of the style attribute with xpath is impossible
|
||||
* So we just get any element with a style attribute, and check them with a regexp
|
||||
*/
|
||||
/** @var DOMNodeList $xr */
|
||||
$xr = $xpath->query('//*[@style]');
|
||||
foreach ($xr as $node) {
|
||||
if (preg_match('/.*display: *none *;.*/',$node->getAttribute('style'))) {
|
||||
|
|
|
@ -54,6 +54,8 @@ unset($id);
|
|||
*
|
||||
* @package codebird
|
||||
* @subpackage codebird-php
|
||||
*
|
||||
* @method object statuses_update(array $postdata)
|
||||
*/
|
||||
class CodebirdSN
|
||||
{
|
||||
|
@ -116,7 +118,7 @@ class CodebirdSN
|
|||
* Returns singleton class instance
|
||||
* Always use this method unless you're working with multiple authenticated users at once
|
||||
*
|
||||
* @return Codebird The instance
|
||||
* @return CodebirdSN The instance
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
|
@ -420,6 +422,7 @@ class CodebirdSN
|
|||
}
|
||||
break;
|
||||
case CODEBIRD_RETURNFORMAT_OBJECT:
|
||||
/** @var object $reply */
|
||||
$reply->httpstatus = $httpstatus;
|
||||
if ($httpstatus == 200) {
|
||||
self::setBearerToken($reply->access_token);
|
||||
|
@ -490,7 +493,7 @@ class CodebirdSN
|
|||
/**
|
||||
* Generates a (hopefully) unique random string
|
||||
*
|
||||
* @param int optional $length The length of the string to generate
|
||||
* @param int $length The optional length of the string to generate
|
||||
*
|
||||
* @return string The random string
|
||||
*/
|
||||
|
@ -505,9 +508,9 @@ class CodebirdSN
|
|||
/**
|
||||
* Generates an OAuth signature
|
||||
*
|
||||
* @param string $httpmethod Usually either 'GET' or 'POST' or 'DELETE'
|
||||
* @param string $method The API method to call
|
||||
* @param array optional $params The API call parameters, associative
|
||||
* @param string $httpmethod Usually either 'GET' or 'POST' or 'DELETE'
|
||||
* @param string $method The API method to call
|
||||
* @param array $params optional The API call parameters, associative
|
||||
*
|
||||
* @return string Authorization HTTP header
|
||||
*/
|
||||
|
@ -871,12 +874,12 @@ class CodebirdSN
|
|||
/**
|
||||
* Calls the API using cURL
|
||||
*
|
||||
* @param string $httpmethod The HTTP method to use for making the request
|
||||
* @param string $method The API method to call
|
||||
* @param string $method_template The templated API method to call
|
||||
* @param array optional $params The parameters to send along
|
||||
* @param bool optional $multipart Whether to use multipart/form-data
|
||||
* @param bool optional $app_only_auth Whether to use app-only bearer authentication
|
||||
* @param string $httpmethod The HTTP method to use for making the request
|
||||
* @param string $method The API method to call
|
||||
* @param string $method_template The templated API method to call
|
||||
* @param array $params optional The parameters to send along
|
||||
* @param bool $multipart optional Whether to use multipart/form-data
|
||||
* @param bool $app_only_auth optional Whether to use app-only bearer authentication
|
||||
*
|
||||
* @return mixed The API reply, encoded in the set return_format
|
||||
*/
|
||||
|
@ -959,6 +962,7 @@ class CodebirdSN
|
|||
$httpstatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$reply = $this->_parseApiReply($method_template, $reply);
|
||||
if ($this->_return_format == CODEBIRD_RETURNFORMAT_OBJECT) {
|
||||
/** @var object $reply */
|
||||
$reply->httpstatus = $httpstatus;
|
||||
} elseif ($this->_return_format == CODEBIRD_RETURNFORMAT_ARRAY) {
|
||||
$reply['httpstatus'] = $httpstatus;
|
||||
|
|
|
@ -52,11 +52,6 @@ class StatusNetOAuth extends TwitterOAuth
|
|||
*
|
||||
* Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $host
|
||||
* @param string $path
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array|object API results
|
||||
*/
|
||||
function http($url, $method, $postfields = NULL)
|
||||
|
|
|
@ -93,7 +93,7 @@ class TwitterOAuth
|
|||
/**
|
||||
* Get a request_token
|
||||
*
|
||||
* @param callback $oauth_callback
|
||||
* @param callable $oauth_callback
|
||||
* @return array
|
||||
*/
|
||||
function getRequestToken($oauth_callback = null)
|
||||
|
@ -112,8 +112,6 @@ class TwitterOAuth
|
|||
/**
|
||||
* Get the authorize URL
|
||||
*
|
||||
* @param array $token
|
||||
* @param bool $sign_in_with_tumblr
|
||||
* @return string
|
||||
*/
|
||||
function getAuthorizeURL($token, $sign_in_with_twitter = TRUE)
|
||||
|
|
|
@ -26,6 +26,7 @@ function tesseract_ocr_detection(&$media)
|
|||
try {
|
||||
$languages = $ocr->availableLanguages();
|
||||
if ($languages) {
|
||||
/** @phpstan-ignore-next-line ignore call of \thiagoalessio\TesseractOCR\Option::lang() */
|
||||
$ocr->lang(implode('+', $languages));
|
||||
}
|
||||
$ocr->tempDir(System::getTempPath());
|
||||
|
|
Loading…
Reference in New Issue