@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | // Check if comments exists for this post |
| 68 | 68 | $cmts = $this->app->get('commentsdir') . $permlink . '.comments'; |
| 69 | - if ((! file_exists($cmts)) || (file_exists($cmts)) && (time() - filemtime($cmts) > 120)) { |
|
| 69 | + if ((!file_exists($cmts)) || (file_exists($cmts)) && (time() - filemtime($cmts) > 120)) { |
|
| 70 | 70 | $api = new HiveCondenser($apiConfig); |
| 71 | 71 | $replies = $api->getContentReplies($article['author'], $permlink); |
| 72 | 72 | $result = json_encode($replies, JSON_PRETTY_PRINT); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $posts = []; |
| 111 | 111 | $result = []; |
| 112 | 112 | |
| 113 | - if (! isset($tag)) { |
|
| 113 | + if (!isset($tag)) { |
|
| 114 | 114 | $result = []; |
| 115 | 115 | } else { |
| 116 | 116 | $matches = []; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $file = $this->app->get('blogfile'); |
| 50 | 50 | |
| 51 | 51 | // if the JSON file doesn't exist or if it's old, take it from API |
| 52 | - if (! file_exists($file) || (time() - filemtime($file) > 120)) { |
|
| 52 | + if (!file_exists($file) || (time() - filemtime($file) > 120)) { |
|
| 53 | 53 | // Prepare API call according to displayed posts type |
| 54 | 54 | $displayType = $settings['displayType']['type']; |
| 55 | 55 | if ($displayType === 'author') { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /* |
| 56 | 56 | * Get Hive engine tokens from account |
| 57 | 57 | */ |
| 58 | - if ((! file_exists($heFile)) || ($current_time - filemtime($heFile) > $cache_interval)) { |
|
| 58 | + if ((!file_exists($heFile)) || ($current_time - filemtime($heFile) > $cache_interval)) { |
|
| 59 | 59 | $config = [ |
| 60 | 60 | 'debug' => false, |
| 61 | 61 | 'heNode' => 'api.hive-engine.com/rpc', |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | ]; |
| 81 | 81 | $api = new HiveCondenser($apiConfig); |
| 82 | 82 | |
| 83 | - if ((! file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) { |
|
| 83 | + if ((!file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) { |
|
| 84 | 84 | $result = json_encode($api->getAccounts($settings['author']), JSON_PRETTY_PRINT); |
| 85 | 85 | file_put_contents($accountFile, $result); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if ((! file_exists($bcFile)) || ($current_time - filemtime($bcFile) > 600)) { |
|
| 88 | + if ((!file_exists($bcFile)) || ($current_time - filemtime($bcFile) > 600)) { |
|
| 89 | 89 | $result = json_encode($api->getDynamicGlobalProperties(), JSON_PRETTY_PRINT); |
| 90 | 90 | file_put_contents($bcFile, $result); |
| 91 | 91 | } |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | $bcVars = json_decode(file_get_contents($bcFile), true); |
| 99 | 99 | $vests = []; |
| 100 | - $vests['tvfh'] = (float) $bcVars['total_vesting_fund_hive']; |
|
| 101 | - $vests['tvs'] = (float) $bcVars['total_vesting_shares']; |
|
| 100 | + $vests['tvfh'] = (float)$bcVars['total_vesting_fund_hive']; |
|
| 101 | + $vests['tvs'] = (float)$bcVars['total_vesting_shares']; |
|
| 102 | 102 | $vests['totalVests'] = $vests['tvfh'] / $vests['tvs']; |
| 103 | - $vests['userHP'] = round((float) $account[0]['vesting_shares'] * $vests['totalVests'], 3); |
|
| 104 | - $vests['delegHP'] = round((float) $account[0]['delegated_vesting_shares'] * $vests['totalVests'], 3); |
|
| 103 | + $vests['userHP'] = round((float)$account[0]['vesting_shares'] * $vests['totalVests'], 3); |
|
| 104 | + $vests['delegHP'] = round((float)$account[0]['delegated_vesting_shares'] * $vests['totalVests'], 3); |
|
| 105 | 105 | |
| 106 | 106 | /* |
| 107 | 107 | * Just render the view with vars |
@@ -222,7 +222,7 @@ |
||
| 222 | 222 | $file = $this->app->get('blogfile'); |
| 223 | 223 | $articles = json_decode(file_get_contents($file), true); |
| 224 | 224 | |
| 225 | - if($tag !== null) { |
|
| 225 | + if ($tag !== null) { |
|
| 226 | 226 | foreach ($articles as $article) { |
| 227 | 227 | $metadata = json_decode($article['json_metadata'], true); |
| 228 | 228 | $tags = implode(',', $metadata['tags']); |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $container->set('themesdir', __DIR__ . '/../public/themes/'); |
| 45 | 45 | |
| 46 | 46 | // Rename config.sample.json to config.json |
| 47 | -$confDir = __DIR__ . '/../config/'; |
|
| 47 | +$confDir = __DIR__ . '/../config/'; |
|
| 48 | 48 | if ((file_exists($confDir . 'config.sample.json')) && (!file_exists($confDir . 'config.json'))) { |
| 49 | 49 | copy($confDir . 'config.sample.json', $confDir . 'config.json'); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Set settings array in container for use in all routes |
| 53 | -$container->set('settings', static function () { |
|
| 53 | +$container->set('settings', static function() { |
|
| 54 | 54 | $config = file_get_contents(__DIR__ . '/../config/config.json'); |
| 55 | 55 | return json_decode($config, true); |
| 56 | 56 | }); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | //AppFactory::setContainer($container); |
| 109 | 109 | |
| 110 | 110 | // Set Twig engine for templating |
| 111 | -$container->set('view', static function () { |
|
| 111 | +$container->set('view', static function() { |
|
| 112 | 112 | $settings = json_decode(file_get_contents(__DIR__ . '/../config/config.json'), true); |
| 113 | 113 | $tpls = [ |
| 114 | 114 | __DIR__ . '/../resources/views/', |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | }); |
| 134 | 134 | |
| 135 | 135 | //Set Session engine |
| 136 | -$container->set('session', static function () { |
|
| 136 | +$container->set('session', static function() { |
|
| 137 | 137 | return new Helper(); |
| 138 | 138 | }); |
| 139 | 139 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $app->post('/login', HomeController::class . ':loginPost')->setName('login-post'); |
| 191 | 191 | |
| 192 | 192 | // Admin routes |
| 193 | -$app->group('/admin', static function (RouteCollectorProxy $group): void { |
|
| 193 | +$app->group('/admin', static function(RouteCollectorProxy $group): void { |
|
| 194 | 194 | $group->get('', AdminController::class . ':adminIndex')->setName('admin'); |
| 195 | 195 | |
| 196 | 196 | $group->get('/settings', AdminController::class . ':adminSettings')->setName('admin-settings'); |