Move more Setting facades into AppComposer

This commit is contained in:
James Brooks 2015-11-21 23:05:20 +00:00
parent a2d7c49c2a
commit b31cab0654
3 changed files with 16 additions and 12 deletions

View File

@ -28,6 +28,10 @@ class AppComposer
public function compose(View $view)
{
$view->withAboutApp(Markdown::convertToHtml(Setting::get('app_about')));
$view->withAppAnalytics(Setting::get('app_analytics'));
$view->withAppAnalyticsGoSquared(Setting::get('app_analytics_gs'));
$view->withAppAnalyticsPiwikUrl(Setting::get('app_analytics_piwik_url'));
$view->withAppAnalyticsPiwikSiteId(Setting::get('app_analytics_piwik_siteid'));
$view->withAppBanner(Setting::get('app_banner'));
$view->withAppBannerType(Setting::get('app_banner_type'));
$view->withAppDomain(Setting::get('app_domain'));

View File

@ -21,7 +21,7 @@
<div class="col-xs-12">
<div class="form-group">
<label>{{ trans('forms.settings.analytics.analytics_google') }}</label>
<input type="text" name="app_analytics" class="form-control" value="{{ Setting::get('app_analytics') }}" placeholder="UA-12345-12">
<input type="text" name="app_analytics" class="form-control" value="{{ $app_analytics }}" placeholder="UA-12345-12">
</div>
</div>
</div>
@ -29,7 +29,7 @@
<div class="col-xs-12">
<div class="form-group">
<label>{{ trans('forms.settings.analytics.analytics_gosquared') }}</label>
<input type="text" name="app_analytics_gs" class="form-control" value="{{ Setting::get('app_analytics_gs') }}" placeholder="GSN-12345-A">
<input type="text" name="$app_analytics_go_squared" class="form-control" value="{{ $app_analytics_go_squared }}" placeholder="GSN-12345-A">
</div>
</div>
</div>
@ -37,7 +37,7 @@
<div class="col-xs-12">
<div class="form-group">
<label>{{ trans('forms.settings.analytics.analytics_piwik_url') }}</label>
<input type="text" name="app_analytics_pi_url" class="form-control" value="{{ Setting::get('app_analytics_pi_url') }}" placeholder="piwik.example.org">
<input type="text" name="app_analytics_pi_url" class="form-control" value="{{ $app_analytics_piwik_url }}" placeholder="piwik.example.org">
</div>
</div>
</div>
@ -45,7 +45,7 @@
<div class="col-xs-12">
<div class="form-group">
<label>{{ trans('forms.settings.analytics.analytics_piwik_siteid') }}</label>
<input type="number" min="1" max="100" name="app_analytics_pi_siteid" class="form-control" value="{{ Setting::get('app_analytics_pi_siteid') ?: 1 }}">
<input type="number" min="1" max="100" name="app_analytics_pi_siteid" class="form-control" value="{{ $app_analytics_piwik_siteid ?: 1 }}">
</div>
</div>
</div>

View File

@ -1,36 +1,36 @@
@if($googleTracking = Setting::get('app_analytics'))
@if($app_analytics)
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ $googleTracking }}', '{{ $_SERVER['SERVER_NAME'] or '' }}');
ga('create', '{{ $app_analytics }}', '{{ $_SERVER['SERVER_NAME'] or '' }}');
ga('send', 'pageview');
</script>
@endif
@if($gosquaredTracking = Setting::get('app_analytics_gs'))
@if($app_analytics_go_squared)
<script>
!function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
d.src='//d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
insertBefore(d,q)}(window,document,'script','_gs');
_gs('{{ $gosquaredTracking }}');
_gs('{{ $app_analytics_go_squared }}');
</script>
@endif
@if($piwikTracking = Setting::get('app_analytics_pi_url'))
@if($app_analytics_piwik_url)
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{{ $piwikTracking }}";
var u="//{{ $app_analytics_piwik_url }}";
_paq.push(['setTrackerUrl', u+'/piwik.php']);
_paq.push(['setSiteId', {{ Setting::get('app_analytics_pi_siteid', 1) }}]);
_paq.push(['setSiteId', {{ $app_analytics_piwik_siteid }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'/piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//{{ $piwikTracking }}/piwik.php?idsite={{ Setting::get('app_analytics_pi_siteid', 1) }}" style="border:0;" alt="" /></p></noscript>
<noscript><p><img src="//{{ $app_analytics_piwik_url }}/piwik.php?idsite={{ $app_analytics_piwik_siteid }}" style="border:0;" alt="" /></p></noscript>
@endif