Avoid use of assignments bare inside statements
Either use them in a subroutine call or put parentheses around the assignment.
This commit is contained in:
@@ -598,7 +598,7 @@ class ActivityPubPlugin extends Plugin
|
||||
if ($result === false) {
|
||||
common_log(LOG_ERR, __METHOD__ . ': Error parsing webfinger IDs from text (preg_last_error=='.preg_last_error().').');
|
||||
return [];
|
||||
} elseif ($n_matches = count($wmatches)) {
|
||||
} elseif (($n_matches = count($wmatches)) != 0) {
|
||||
common_debug(sprintf('Found %d matches for WebFinger IDs: %s', $n_matches, _ve($wmatches)));
|
||||
}
|
||||
return $wmatches[1];
|
||||
@@ -891,10 +891,12 @@ class ActivityPubPlugin extends Plugin
|
||||
// Local user can be ignored
|
||||
}
|
||||
|
||||
$other = array_merge($other,
|
||||
$other = array_merge(
|
||||
$other,
|
||||
Activitypub_profile::from_profile_collection(
|
||||
$notice->getAttentionProfiles()
|
||||
));
|
||||
)
|
||||
);
|
||||
|
||||
if ($notice->reply_to) {
|
||||
try {
|
||||
@@ -906,10 +908,12 @@ class ActivityPubPlugin extends Plugin
|
||||
// Local user can be ignored
|
||||
}
|
||||
|
||||
$other = array_merge($other,
|
||||
$other = array_merge(
|
||||
$other,
|
||||
Activitypub_profile::from_profile_collection(
|
||||
$parent_notice->getAttentionProfiles()
|
||||
));
|
||||
)
|
||||
);
|
||||
} catch (NoParentNoticeException $e) {
|
||||
// This is not a reply to something (has no parent)
|
||||
} catch (NoResultException $e) {
|
||||
|
@@ -115,7 +115,13 @@ class OEmbedAction extends Action
|
||||
// TRANS: %d is an attachment ID.
|
||||
$this->clientError(sprintf(_('Attachment %s not found.'), $id), 404);
|
||||
}
|
||||
if (empty($attachment->filename) && $file_oembed = File_oembed::getKV('file_id', $attachment->id)) {
|
||||
if (
|
||||
empty($attachment->filename)
|
||||
&& !empty($file_oembed = File_oembed::getKV(
|
||||
'file_id',
|
||||
$attachment->id
|
||||
))
|
||||
) {
|
||||
// Proxy the existing oembed information
|
||||
$oembed['type']=$file_oembed->type;
|
||||
$oembed['provider']=$file_oembed->provider;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -964,7 +964,10 @@ class Ostatus_profile extends Managed_DataObject
|
||||
$best = false;
|
||||
// Take the exact-size avatar, or the largest avatar, or the first avatar if all sizeless
|
||||
foreach ($object->avatarLinks as $avatar) {
|
||||
if ($avatar->width == AVATAR_PROFILE_SIZE && $avatar->height = AVATAR_PROFILE_SIZE) {
|
||||
if (
|
||||
$avatar->width === AVATAR_PROFILE_SIZE
|
||||
&& $avatar->height === AVATAR_PROFILE_SIZE
|
||||
) {
|
||||
// Exact match!
|
||||
$best = $avatar;
|
||||
break;
|
||||
|
@@ -1,44 +1,38 @@
|
||||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Superclass for sitemap-generating actions
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Sitemap
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* superclass for sitemap actions
|
||||
*
|
||||
* @category Sitemap
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Sitemap
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class SitemapAction extends Action
|
||||
{
|
||||
@@ -49,7 +43,7 @@ class SitemapAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle()
|
||||
public function handle()
|
||||
{
|
||||
parent::handle();
|
||||
|
||||
@@ -58,8 +52,8 @@ class SitemapAction extends Action
|
||||
|
||||
$this->elementStart('urlset', array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'));
|
||||
|
||||
while (list($url, $lm, $cf, $p) = $this->nextUrl()) {
|
||||
$this->showUrl($url, $lm, $cf, $p);
|
||||
while (!is_null($next = $this->nextUrl())) {
|
||||
$this->showUrl(...$next);
|
||||
}
|
||||
|
||||
$this->elementEnd('urlset');
|
||||
@@ -67,7 +61,7 @@ class SitemapAction extends Action
|
||||
$this->endXML();
|
||||
}
|
||||
|
||||
function lastModified()
|
||||
public function lastModified()
|
||||
{
|
||||
$y = $this->trimmed('year');
|
||||
|
||||
@@ -88,8 +82,12 @@ class SitemapAction extends Action
|
||||
}
|
||||
}
|
||||
|
||||
function showUrl($url, $lastMod=null, $changeFreq=null, $priority=null)
|
||||
{
|
||||
public function showUrl(
|
||||
$url,
|
||||
$lastMod = null,
|
||||
$changeFreq = null,
|
||||
$priority = null
|
||||
) {
|
||||
$this->elementStart('url');
|
||||
$this->element('loc', null, $url);
|
||||
if (!is_null($lastMod)) {
|
||||
@@ -104,12 +102,12 @@ class SitemapAction extends Action
|
||||
$this->elementEnd('url');
|
||||
}
|
||||
|
||||
function nextUrl()
|
||||
public function nextUrl()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
function isReadOnly()
|
||||
public function isReadOnly()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,29 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package WebFingerPlugin
|
||||
* @author James Walker <james@status.net>
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @package WebFingerPlugin
|
||||
* @author James Walker <james@status.net>
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class OwnerxrdAction extends WebfingerAction
|
||||
{
|
||||
@@ -36,7 +35,7 @@ class OwnerxrdAction extends WebfingerAction
|
||||
$nick = common_canonical_nickname($user->nickname);
|
||||
$args['resource'] = 'acct:' . $nick . '@' . common_config('site', 'server');
|
||||
|
||||
// We have now set $args['resource'] to the configured value, since
|
||||
// We have now set $args['resource'] to the configured value, since
|
||||
// only this local site configuration knows who the owner is!
|
||||
parent::prepare($args);
|
||||
|
||||
@@ -49,7 +48,7 @@ class OwnerxrdAction extends WebfingerAction
|
||||
|
||||
// Check to see if a $config['webfinger']['owner'] has been set
|
||||
// and then make sure 'subject' is set to that primary identity.
|
||||
if ($owner = common_config('webfinger', 'owner')) {
|
||||
if (!empty($owner = common_config('webfinger', 'owner'))) {
|
||||
$this->xrd->aliases[] = $this->xrd->subject;
|
||||
$this->xrd->subject = Discovery::normalize($owner);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user