Browse Source

Fix activation error.

pull/25/head
Ned Zimmerman 7 years ago
parent
commit
6ddd07140c
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 2
      app/activation.php
  2. 8
      app/controllers/App.php
  3. 8
      app/controllers/FrontPage.php
  4. 2
      resources/views/front-page.blade.php
  5. 8
      resources/views/partials/footer.blade.php

2
app/activation.php

@ -3,6 +3,7 @@
namespace Aldine; namespace Aldine;
add_action('admin_init', function () { add_action('admin_init', function () {
if (! get_option('pb_aldine_activated')) {
$extra = new \ParsedownExtra(); $extra = new \ParsedownExtra();
$about = $extra->text(file_get_contents(get_stylesheet_directory() . '/docs/about.md')); $about = $extra->text(file_get_contents(get_stylesheet_directory() . '/docs/about.md'));
$help = $extra->text(file_get_contents(get_stylesheet_directory() . '/docs/help.md')); $help = $extra->text(file_get_contents(get_stylesheet_directory() . '/docs/help.md'));
@ -26,7 +27,6 @@ add_action('admin_init', function () {
], ],
]; ];
if (! get_option('pb_aldine_activated')) {
// Add our pages // Add our pages
$pages = []; $pages = [];

8
app/controllers/App.php

@ -38,14 +38,14 @@ class App extends Controller
|| get_option('pb_network_twitter') || get_option('pb_network_twitter')
|| is_active_sidebar("network-footer-block-$index") || is_active_sidebar("network-footer-block-$index")
) { ) {
return "network-footer__block--$index"; return $index;
} else { } else {
return 'network-footer__block--empty'; return 'empty';
} }
} }
return (is_active_sidebar("network-footer-block-$index")) ? return (is_active_sidebar("network-footer-block-$index")) ?
"network-footer__block--$index" : $index :
'network-footer__block--empty'; 'empty';
} }
public static function title() public static function title()

8
app/controllers/FrontPage.php

@ -9,12 +9,8 @@ class FrontPage extends Controller
public function blockCount() public function blockCount()
{ {
global $_wp_sidebars_widgets; global $_wp_sidebars_widgets;
if (empty($_wp_sidebars_widgets)) { if (!empty($_wp_sidebars_widgets['front-page-block'])) {
$_wp_sidebars_widgets = get_option('sidebars_widgets', []); return count($_wp_sidebars_widgets['front-page-block']);
}
$sidebars_widgets_count = $_wp_sidebars_widgets;
if (isset($sidebars_widgets_count['front-page-block'])) {
return count($sidebars_widgets_count['front-page-block']);
} }
return 1; return 1;
} }

2
resources/views/front-page.blade.php

@ -5,7 +5,7 @@
@if(is_active_sidebar('front-page-block')) @if(is_active_sidebar('front-page-block'))
@php(dynamic_sidebar('front-page-block')) @php(dynamic_sidebar('front-page-block'))
@else @else
@component('page-block') @component('partials.page-block')
@slot('title') @slot('title')
{{ __('About Pressbooks', 'aldine') }} {{ __('About Pressbooks', 'aldine') }}
@endslot @endslot

8
resources/views/partials/footer.blade.php

@ -4,15 +4,11 @@
@include('partials.contact-form') @include('partials.contact-form')
@endif @endif
<section class="network-footer"> <section class="network-footer">
<div class="network-footer__block {{ App::networkFooter(1) }}"> <div class="network-footer__block network-footer__block--{{ App::networkFooter(1) }}">
@if(App::networkFooter(1) !== 'empty')
@php(dynamic_sidebar('network-footer-block-1')) @php(dynamic_sidebar('network-footer-block-1'))
@endif
</div> </div>
<div class="network-footer__block {{ App::networkFooter(2) }}"> <div class="network-footer__block network-footer__block--{{ App::networkFooter(2) }}">
@if(App::networkFooter(2) !== 'empty')
@php(dynamic_sidebar('network-footer-block-2')) @php(dynamic_sidebar('network-footer-block-2'))
@endif
<div class="social-media"> <div class="social-media">
@if($network_facebook) @if($network_facebook)
<a class="link near-black hover-silver dib h2 w2 mr3" href="{{ $network_facebook }}" title="{{ sprintf(__('%s on Facebook', 'aldine'), get_bloginfo('name', 'display')) }}"> <a class="link near-black hover-silver dib h2 w2 mr3" href="{{ $network_facebook }}" title="{{ sprintf(__('%s on Facebook', 'aldine'), get_bloginfo('name', 'display')) }}">

Loading…
Cancel
Save