-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathArtsPlugin.php
More file actions
91 lines (70 loc) · 2.13 KB
/
Copy pathArtsPlugin.php
File metadata and controls
91 lines (70 loc) · 2.13 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
namespace APP\plugins\generic\arts;
use PKP\plugins\GenericPlugin;
use PKP\plugins\Hook;
use PKP\config\Config;
use PKP\linkAction\LinkAction;
use PKP\linkAction\request\AjaxAction;
use PKP\linkAction\request\RedirectAction;
require_once(dirname(__FILE__) . '/vendor/autoload.php');
class ArtsPlugin extends GenericPlugin
{
public function __construct()
{
parent::__construct();
}
public function register($category, $path, $mainContextId = null)
{
$this->addLocaleData();
$success = parent::register($category, $path, $mainContextId);
if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) return true;
if ($success && $this->getEnabled()) {
// Add a handler to process the biography page
Hook::add('LoadHandler', array($this, 'callbackHandleContent'));
}
return $success;
}
public function callbackHandleContent($hookName, $args)
{
$page = &$args[0];
$op = &$args[1];
$handler = &$args[3];
if ($page == 'ARTS') {
$handler = new ArtsHandler($this);
return true;
}
return false;
}
/**
* @copydoc Plugin::getDisplayName()
*/
public function getDisplayName()
{
return __('plugins.generic.arts.displayName');
}
/**
* @copydoc Plugin::getDescription()
*/
public function getDescription()
{
return __('plugins.generic.arts.displayName');
}
/**
* @copydoc Plugin::getActions()
*/
public function getActions($request, $actionArgs): array
{
$actions = parent::getActions($request, $actionArgs);
if ($this->getEnabled()) {
$journalPath = $request->getContext()->getPath();
$baseUrl = $request->getBaseUrl();
$url = $baseUrl . '/index.php/' . $journalPath . '/ARTS/report';
array_unshift($actions, new LinkAction(
'reload',
new RedirectAction($url),
__('plugins.generic.arts.configurations')
));
}
return $actions;
}
}