-
Notifications
You must be signed in to change notification settings - Fork 1
/
FancyAdminMode.module
59 lines (49 loc) · 1.72 KB
/
FancyAdminMode.module
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* ProcessWire Fancy Admin Mode
*
* 15/12/2012 by Philipp "Soma" Urlich
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
* http://www.processwire.com
* http://www.ryancramer.com
*
*/
class FancyAdminMode extends WireData implements Module {
/**
* getModuleInfo is a module required by all modules to tell ProcessWire about them
*
* @return array
*
*/
public static function getModuleInfo() {
return array(
'title' => 'Fancy Admin Mode',
'version' => 1,
'summary' => 'Have fun with Fancybox in PW admin. All, except "Pages" will open in Fancybox Iframe mode.',
'href' => '',
'autoload' => true
);
}
public function init() {
$this->addHookBefore("ProcessPageView::execute", $this, "addModal");
$this->addHookAfter("Process::execute", $this, "addScripts");
}
public function addModal($event){
if(!isset($_GET['modal'])
&& ("/" . $_GET['it'] != $this->config->urls->admin . "page/")
&& ("/" . $_GET['it'] != $this->config->urls->admin)
&& (strpos($_GET['it'], ltrim($this->config->urls->admin,"/") . "page/search/") === false )
&& (strpos($_GET['it'], ltrim($this->config->urls->admin,"/") . "page/list/") === false )
&& (strpos($_GET['it'], ltrim($this->config->urls->admin,"/") . "profile/") === false )){
$_GET['modal'] = 1;
}
}
public function addScripts($event) {
$this->modules->get("JqueryFancybox");
$this->config->scripts->append($this->config->urls->FancyAdminMode . "FancyAdminMode.js");
}
}