From 2cae6cd2733b83e2fd39db07631a28210ccb660f Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 25 Apr 2020 21:36:28 +0100 Subject: [PATCH] format --- core/polyfills.php | 3 ++- core/tests/init.test.php | 3 ++- core/urls.php | 16 +++++++++++----- ext/help_pages/test.php | 1 - ext/index/test.php | 3 +-- ext/pools/main.php | 12 +++++++----- ext/source_history/theme.php | 12 +++++++++++- ext/tag_history/theme.php | 12 +++++++++++- tests/bootstrap.php | 5 ++--- 9 files changed, 47 insertions(+), 20 deletions(-) diff --git a/core/polyfills.php b/core/polyfills.php index 332f3112..8a54ac2d 100644 --- a/core/polyfills.php +++ b/core/polyfills.php @@ -409,7 +409,8 @@ function get_base_href(): string /** * The opposite of the standard library's parse_url */ -function unparse_url($parsed_url) { +function unparse_url($parsed_url) +{ $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; diff --git a/core/tests/init.test.php b/core/tests/init.test.php index 50c3752e..c7008e9b 100644 --- a/core/tests/init.test.php +++ b/core/tests/init.test.php @@ -2,7 +2,8 @@ use PHPUnit\Framework\TestCase; -class TestInit extends TestCase { +class TestInit extends TestCase +{ public function testInitExt() { send_event(new InitExtEvent()); diff --git a/core/urls.php b/core/urls.php index 7e1f58cc..1dd6a7ca 100644 --- a/core/urls.php +++ b/core/urls.php @@ -60,7 +60,9 @@ function modify_url(string $url, array $changes): string $parts = parse_url($url); $params = []; - if(isset($parts['query'])) parse_str($parts['query'], $params); + if (isset($parts['query'])) { + parse_str($parts['query'], $params); + } foreach ($changes as $k => $v) { if (is_null($v) and isset($params[$k])) { unset($params[$k]); @@ -98,10 +100,14 @@ function make_http(string $link): string */ function referer_or(string $dest, ?array $blacklist=null): string { - if(empty($_SERVER['HTTP_REFERER'])) return $dest; - if($blacklist) { - foreach($blacklist as $b) { - if(strstr($_SERVER['HTTP_REFERER'], $b)) return $dest; + if (empty($_SERVER['HTTP_REFERER'])) { + return $dest; + } + if ($blacklist) { + foreach ($blacklist as $b) { + if (strstr($_SERVER['HTTP_REFERER'], $b)) { + return $dest; + } } } return $_SERVER['HTTP_REFERER']; diff --git a/ext/help_pages/test.php b/ext/help_pages/test.php index 40eac815..5e6706dc 100644 --- a/ext/help_pages/test.php +++ b/ext/help_pages/test.php @@ -2,7 +2,6 @@ class HelpPagesTest extends ShimmiePHPUnitTestCase { - public function test_list() { send_event(new HelpPageListBuildingEvent()); diff --git a/ext/index/test.php b/ext/index/test.php index 152d8eb7..74d786f4 100644 --- a/ext/index/test.php +++ b/ext/index/test.php @@ -198,9 +198,8 @@ class IndexTest extends ShimmiePHPUnitTestCase send_event(new UserLoginEvent(User::by_name(self::$user_name))); send_event(new PageNavBuildingEvent()); // just a few common parents - foreach(["help", "posts", "system", "user"] as $parent) { + foreach (["help", "posts", "system", "user"] as $parent) { send_event(new PageSubNavBuildingEvent($parent)); - } $this->assertTrue(true); } diff --git a/ext/pools/main.php b/ext/pools/main.php index 6fe0edb7..132e0b5a 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -47,8 +47,7 @@ class PoolCreationEvent extends Event User $pool_user = null, bool $public = false, string $description = "" - ) - { + ) { parent::__construct(); global $user; @@ -59,7 +58,8 @@ class PoolCreationEvent extends Event } } -class Pool { +class Pool +{ public $id; public $user_id; public $user_name; @@ -81,7 +81,8 @@ class Pool { $this->posts = (int)$row['posts']; } - public static function makePool(array $row): Pool { + public static function makePool(array $row): Pool + { return new Pool($row); } } @@ -316,7 +317,8 @@ class Pools extends Extension case "import": if ($this->have_permission($user, $pool)) { $images = Image::find_images( - 0, $config->get_int(PoolsConfig::MAX_IMPORT_RESULTS, 1000), + 0, + $config->get_int(PoolsConfig::MAX_IMPORT_RESULTS, 1000), Tag::explode($_POST["pool_tag"]) ); $this->theme->pool_result($page, $images, $pool); diff --git a/ext/source_history/theme.php b/ext/source_history/theme.php index 306fc6f7..a483d6f6 100644 --- a/ext/source_history/theme.php +++ b/ext/source_history/theme.php @@ -1,5 +1,15 @@ $v) { - if(is_array($v)) { + if (is_array($v)) { $args[$k] = $v; - } - else { + } else { $args[$k] = (string)$v; } }