Skip to content

Commit

Permalink
Merge branch 'release/7.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
breakdancingcat committed Jan 3, 2022
2 parents 8bf301e + 858b741 commit 46aac99
Show file tree
Hide file tree
Showing 257 changed files with 9,719 additions and 9,101 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ WSUAPI_ENDPOINT=
NEWS_API_KEY=
NEWS_API_CACHE=../storage/app/newsapi/

PEOPLE_API_KEY=
PEOPLE_API_CACHE=../storage/app/peopleapi/

TTL=0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ npm-debug.log
yarn-error.log
cs_fixer_tmp*
.php_cs.cache
.php-cs-fixer.cache
/public/mix-manifest.json
/*.diff
.phpunit.result.cache
.env.backup
/tools
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v16
20 changes: 13 additions & 7 deletions .php_cs → .php-cs-fixer.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
->in(__DIR__ . '/config')
->in(__DIR__ . '/routes')
->in(__DIR__ . '/styleguide')
->in(__DIR__ . '/tests');
->in(__DIR__ . '/tests')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

$fixers = [
'@PSR2' => true,
Expand All @@ -20,26 +23,29 @@
'indentation_type' => true,
'array_indentation' => true,
'line_ending' => true,
'method_argument_space' => ['ensure_fully_multiline' => true],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline'
],
'no_break_comment' => true,
'no_closing_tag' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'single_blank_line_at_eof' => true,
'single_class_element_per_statement' => ['elements' => ['property']],
'single_class_element_per_statement' => [
'elements' => ['property']
],
'single_import_per_statement' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'visibility_required' => true,
'no_trailing_comma_in_singleline_array' => true,
'whitespace_after_comma_in_array' => true,
'no_whitespace_before_comma_in_array' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
];

return Config::create()
return (new Config())
->setFinder($finder)
->setRules($fixers)
->setUsingCache(true);
->setRules($fixers);
2 changes: 1 addition & 1 deletion .phpbrewrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
phpbrew use 7.3.20
phpbrew use 8.0.10
18 changes: 9 additions & 9 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exceptions;

use Exception;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Facades\View;
use Symfony\Component\HttpKernel\Exception\HttpException;
Expand Down Expand Up @@ -33,32 +33,32 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Throwable $e
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $e)
{
parent::report($exception);
parent::report($e);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $e)
{
// Add custom errors when debug is not enabled
if (config('app.debug') == false) {
if ($exception instanceof HttpException && View::exists('errors.'.$exception->getStatusCode())) {
return response(view('errors.'.$exception->getStatusCode(), compact('request')), $exception->getStatusCode());
if ($e instanceof HttpException && View::exists('errors.'.$e->getStatusCode())) {
return response(view('errors.'.$e->getStatusCode(), compact('request')), $e->getStatusCode());
} else {
return response(view('errors.500', compact('request')), 500);
}
}

return parent::render($request, $exception);
return parent::render($request, $e);
}
}
34 changes: 22 additions & 12 deletions app/Http/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ public function __construct(ArticleRepositoryContract $article, TopicRepositoryC
*
* @param Request $request
* @return \Illuminate\View\View
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function index(Request $request)
{
$topics = $this->topic->listing($request->data['site']['news']['application_id'], $request->data['site']['subsite-folder']);
$topics = $this->topic->listing($request->data['base']['site']['news']['application_id'], $request->data['base']['site']['subsite-folder']);

if (!empty($topics['topics']['data'])) {
$topics['topics']['data'] = $this->topic->setSelected($topics['topics']['data'], $request->slug);
Expand All @@ -42,18 +45,18 @@ public function index(Request $request)
}

if (!empty($request->slug) && empty($selected_topic['selected'])) {
return abort('404');
abort('404');
}

$articles = $this->article->listing($request->data['site']['news']['application_id'], 25, $request->query('page'), !empty($selected_topic['topic_id']) ? $selected_topic['topic_id'] : null);
$articles = $this->article->listing($request->data['base']['site']['news']['application_id'], 25, $request->query('page'), !empty($selected_topic['topic_id']) ? $selected_topic['topic_id'] : null);

if (!empty($articles['articles']['meta'])) {
$articles['articles']['meta'] = $this->article->setPaging($articles['articles']['meta'], $request->query('page'));
}

// Force the menu to be shown if categories are found
if (!empty($topics['topics']['data'])) {
$request->data['show_site_menu'] = true;
$request->data['base']['show_site_menu'] = true;
}

return view('articles', merge($request->data, $articles, $topics));
Expand All @@ -64,31 +67,38 @@ public function index(Request $request)
*
* @param Request $request
* @return \Illuminate\View\View
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function show(Request $request)
{
$article = $this->article->find($request->id, $request->data['site']['news']['application_id'], $request->preview);
if (empty($request->data['base']['site']['news']['application_id'])) {
abort('404');
}

$article = $this->article->find($request->id, $request->data['base']['site']['news']['application_id'], $request->preview);

if (empty($article['article']['data'])) {
if ($request->preview) {
return redirect($request->server->get('REDIRECT_URL'));
}

return abort('404');
abort('404');
}

$request->data['page']['title'] = $article['article']['data']['title'];
$request->data['base']['page']['title'] = $article['article']['data']['title'];

if (!empty($article['article']['data']['hero_image']['url'])) {
$request->data['hero'][]['relative_url'] = $article['article']['data']['hero_image']['url'];
$request->data['base']['hero'][]['relative_url'] = $article['article']['data']['hero_image']['url'];
}

$image = $this->article->getImage($article['article']['data']);

$request->data['meta']['image'] = $image['url'];
$request->data['meta']['image_alt'] = $image['alt_text'];
$request->data['base']['meta']['image'] = $image['url'];
$request->data['base']['meta']['image_alt'] = $image['alt_text'];

$topics = $this->topic->listing($request->data['site']['news']['application_id']);
$topics = $this->topic->listing($request->data['base']['site']['news']['application_id']);

if (!empty($topics['topics']['data'])) {
$topics['topics']['data'] = $this->topic->setSelected($topics['topics']['data'], $request->slug);
Expand All @@ -98,7 +108,7 @@ public function show(Request $request)

// Force the menu to be shown if categories are found
if (!empty($topics['topics']['data'])) {
$request->data['show_site_menu'] = true;
$request->data['base']['show_site_menu'] = true;
}

return view('article', merge($request->data, $article, $topics));
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/ContactTableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public function __construct(ProfileRepositoryContract $profile)
public function index(Request $request)
{
// Determine what site to pull profiles from
$site_id = !empty($request->data['data']['profile_site_id']) ? $request->data['data']['profile_site_id'] : $request->data['site']['id'];
$site_id = $this->profile->getSiteID($request->data['base']);

$profiles = $this->profile->getProfilesByGroupOrder($site_id, $request->data['data']['profile_group_id']);
$profiles = $this->profile->getProfilesByGroupOrder($site_id, $request->data['base']['data']['profile_group_id']);

// show table of contents if custom field 'table_of_contents' is not set to 'hide'
if (isset($request->data['data']['table_of_contents']) && $request->data['data']['table_of_contents'] === 'hide') {
if (isset($request->data['base']['data']['table_of_contents']) && $request->data['base']['data']['table_of_contents'] === 'hide') {
$profiles['anchors'] = [];
}

Expand Down
7 changes: 4 additions & 3 deletions app/Http/Controllers/DirectoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ public function __construct(ProfileRepositoryContract $profile)
*/
public function index(Request $request)
{
$site_id = !empty($request->data['data']['profile_site_id']) ? $request->data['data']['profile_site_id'] : $request->data['site']['id'];
// Determine what site to pull profiles from
$site_id = $this->profile->getSiteID($request->data['base']);

if (!empty($request->data['data']['profile_group_id'])) {
$profiles = $this->profile->getProfilesByGroupOrder($site_id, $request->data['data']['profile_group_id']);
if (!empty($request->data['base']['data']['profile_group_id'])) {
$profiles = $this->profile->getProfilesByGroupOrder($site_id, $request->data['base']['data']['profile_group_id']);
} else {
$profiles = $this->profile->getProfilesByGroup($site_id);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/HomepageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public function index(Request $request)
{
// $promos = $this->promo->getHomepagePromos();

$articles = $this->article->listing($request->data['site']['news']['application_id']);
$articles = $this->article->listing($request->data['base']['site']['news']['application_id']);

$events = $this->event->getEvents($request->data['site']['id']);
$events = $this->event->getEvents($request->data['base']['site']['id']);

return view('homepage', merge($request->data, $articles, $events));
}
Expand Down
22 changes: 12 additions & 10 deletions app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function __construct(ProfileRepositoryContract $profile)
public function index(Request $request)
{
// Determine what site to pull profiles from
$site_id = !empty($request->data['data']['profile_site_id']) ? $request->data['data']['profile_site_id'] : $request->data['site']['id'];
$site_id = $this->profile->getSiteID($request->data['base']);

// Determine if we are forcing the profiles from custom page data
$forced_profile_group_id = !empty($request->data['data']['profile_group_id']) ? $request->data['data']['profile_group_id'] : null;
$forced_profile_group_id = !empty($request->data['base']['data']['profile_group_id']) ? $request->data['base']['data']['profile_group_id'] : null;

// Get the groups for the dropdown
$dropdown_groups = $this->profile->getDropdownOfGroups($site_id);
Expand All @@ -52,7 +52,7 @@ public function index(Request $request)
$profiles = $this->profile->getProfiles($site_id, $group_ids);

// Disable hero images
$request->data['hero'] = false;
$request->data['base']['hero'] = false;

return view('profile-listing', merge($request->data, $profiles, $dropdown_groups, $dropdown_group_options));
}
Expand All @@ -61,40 +61,42 @@ public function index(Request $request)
* Display the individual profile view.
*
* @param Request $request
* @param int $accessid
* @return \Illuminate\View\View
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function show(Request $request)
{
if (empty($request->accessid)) {
abort(404);
abort('404');
}

// Determine what site to pull profiles from
$site_id = !empty($request->data['data']['profile_site_id']) ? $request->data['data']['profile_site_id'] : $request->data['site']['id'];
$site_id = $this->profile->getSiteID($request->data['base']);

// Get the profile information
$profile = $this->profile->getProfile($site_id, $request->accessid);

// Make sure the profile exists
if (empty($profile['profile'])) {
return abort('404');
abort('404');
}

// Get the fields to display
$fields = $this->profile->getFields();

// Change page title to profile name
$request->data['page']['title'] = $this->profile->getPageTitleFromName($profile);
$request->data['base']['page']['title'] = $this->profile->getPageTitleFromName($profile);

// Set the back URL
$request->data['back_url'] = $this->profile->getBackToProfileListUrl($request->server->get('HTTP_REFERER'), $request->server->get('REQUEST_SCHEME'), $request->server->get('HTTP_HOST'), $request->server->get('REQUEST_URI'));

// Make it a full width view
$request->data['show_site_menu'] = false;
$request->data['base']['show_site_menu'] = false;

// Disable hero images
$request->data['hero'] = false;
$request->data['base']['hero'] = false;

return view('profile-view', merge($request->data, $profile, $fields));
}
Expand Down
Loading

0 comments on commit 46aac99

Please sign in to comment.