PHPStan: Fix missing requires/namespaces

This commit is contained in:
Hypolite Petovan 2017-12-17 15:24:57 -05:00
parent e40917b792
commit 10b72b0e9e
35 changed files with 89 additions and 37 deletions

View file

@ -8,7 +8,6 @@
*/
namespace Friendica\Protocol;
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
@ -22,8 +21,10 @@ use Friendica\Util\XML;
use dba;
use DOMDocument;
use DomXPath;
use DOMXPath;
require_once 'boot.php';
require_once 'include/dba.php';
require_once "include/enotify.php";
require_once "include/threads.php";
require_once "include/items.php";
@ -1298,7 +1299,7 @@ class DFRN
case 2:
// RINO 2 based on php-encryption
try {
$key = \Crypto::createNewRandomKey();
$key = \Crypto::CreateNewRandomKey();
} catch (\CryptoTestFailedException $ex) {
logger('Cannot safely create a key');
return -4;
@ -1307,7 +1308,7 @@ class DFRN
return -5;
}
try {
$data = \Crypto::encrypt($postvars['data'], $key);
$data = \Crypto::Encrypt($postvars['data'], $key);
} catch (\CryptoTestFailedException $ex) {
logger('Cannot safely perform encryption');
return -6;
@ -2505,13 +2506,13 @@ class DFRN
$item['body'] = oembed_html2bbcode($item['body']);
$config = HTMLPurifier_Config::createDefault();
$config = \HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
// we shouldn't need a whitelist, because the bbcode converter
// will strip out any unsupported tags.
$purifier = new HTMLPurifier($config);
$purifier = new \HTMLPurifier($config);
$item['body'] = $purifier->purify($item['body']);
$item['body'] = @html2bbcode($item['body']);
@ -2977,7 +2978,7 @@ class DFRN
$doc = new DOMDocument();
@$doc->loadXML($xml);
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace("atom", NAMESPACE_ATOM1);
$xpath->registerNamespace("thr", NAMESPACE_THREAD);
$xpath->registerNamespace("at", NAMESPACE_TOMB);

View file

@ -27,6 +27,7 @@ use Friendica\Util\XML;
use dba;
use SimpleXMLElement;
require_once 'include/dba.php';
require_once 'include/items.php';
require_once 'include/bb2diaspora.php';
require_once 'include/datetime.php';

View file

@ -10,10 +10,11 @@ use Friendica\Database\DBM;
use Friendica\Core\System;
use dba;
use DOMDocument;
use DomXPath;
use DOMXPath;
require_once("include/html2bbcode.php");
require_once("include/items.php");
require_once 'include/dba.php';
require_once 'include/html2bbcode.php';
require_once 'include/items.php';
/**
* @brief This class contain functions to import feeds
@ -55,7 +56,7 @@ class Feed {
$doc = new DOMDocument();
@$doc->loadXML(trim($xml));
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', NAMESPACE_ATOM1);
$xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
$xpath->registerNamespace('content', "http://purl.org/rss/1.0/modules/content/");

View file

@ -17,8 +17,9 @@ use Friendica\Util\Lock;
use Friendica\Util\XML;
use dba;
use DOMDocument;
use DomXPath;
use DOMXPath;
require_once 'include/dba.php';
require_once 'include/threads.php';
require_once 'include/html2bbcode.php';
require_once 'include/bbcode.php';
@ -251,7 +252,7 @@ class OStatus
$doc = new DOMDocument();
@$doc->loadXML($xml);
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', NAMESPACE_ATOM1);
$xpath->registerNamespace('thr', NAMESPACE_THREAD);
$xpath->registerNamespace('georss', NAMESPACE_GEORSS);
@ -329,7 +330,7 @@ class OStatus
$doc = new DOMDocument();
@$doc->loadXML($xml);
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', NAMESPACE_ATOM1);
$xpath->registerNamespace('thr', NAMESPACE_THREAD);
$xpath->registerNamespace('georss', NAMESPACE_GEORSS);
@ -739,7 +740,7 @@ class OStatus
if (!@$doc->loadHTML($conversation_data['body'])) {
return;
}
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$links = $xpath->query('//link');
if ($links) {
@ -779,7 +780,7 @@ class OStatus
$doc = new DOMDocument();
@$doc->loadXML($xml);
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', NAMESPACE_ATOM1);
$xpath->registerNamespace('thr', NAMESPACE_THREAD);
$xpath->registerNamespace('ostatus', NAMESPACE_OSTATUS);
@ -929,7 +930,7 @@ class OStatus
if (!@$doc->loadHTML($related_data['body'])) {
return;
}
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$atom_file = '';

View file

@ -17,9 +17,10 @@ use Friendica\Model\Profile;
use Friendica\Network\Probe;
use dba;
use DOMDocument;
use DomXPath;
use DOMXPath;
use Exception;
require_once 'include/dba.php';
require_once 'include/datetime.php';
require_once 'include/network.php';
require_once 'include/html2bbcode.php';
@ -512,7 +513,7 @@ class PortableContact
$doc = new DOMDocument();
@$doc->loadXML($feedret["body"]);
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('atom', "http://www.w3.org/2005/Atom");
$entries = $xpath->query('/atom:feed/atom:entry');
@ -768,7 +769,7 @@ class PortableContact
$doc = new DOMDocument();
@$doc->loadHTML($body);
$xpath = new DomXPath($doc);
$xpath = new DOMXPath($doc);
$list = $xpath->query("//meta[@name]");