-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPlugin.php
44 lines (40 loc) · 1.13 KB
/
Plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php namespace HeathDutton\Cloudflare;
use App;
use Event;
use System\Classes\PluginBase;
/**
* Plugin Information File
*/
class Plugin extends PluginBase
{
public $elevated = true;
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'Cloudflare',
'description' => 'Puts October in HTTPS protocol correctly when behind the cloudflare reverse proxy.',
'author' => 'TheDMSGrp',
'icon' => 'icon-leaf'
];
}
/**
* Boot the plugin
*/
public function boot()
{
// Prevent CloudFlare's Rocket Loader from breaking scripts in the backend
// @see octobercms/october#4611, octobercms/october#4092, octobercms/october#3841, octobercms/october#3839
if (App::runningInBackend()) {
Event::listen('system.assets.beforeAddAsset', function ($type, $path, &$attributes) {
if ($type === 'js') {
$attributes['data-cfasync'] = 'false';
}
});
}
}
}