-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddCtECitationStyle.inc.php
50 lines (43 loc) · 1.27 KB
/
AddCtECitationStyle.inc.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
45
46
47
48
49
50
<?php
import('lib.pkp.classes.plugins.GenericPlugin');
class AddCtECitationStyle extends GenericPlugin {
/**
* @copydoc Plugin::register()
*/
public function register($category, $path, $mainContextId = null) {
$success = parent::register($category, $path, $mainContextId);
if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) return $success;
if ($success && $this->getEnabled($mainContextId)) {
HookRegistry::register('CitationStyleLanguage::citationStyleDefaults', array($this, 'addCSLStyle'));
}
return $success;
}
/**
* Add a CSL style to the list of default styles
*
* @param string $hookname
* @param array $args [$defaults, CitationStyleLanguagePlugin]
*/
public function addCSLStyle($hookName, $args) {
$defaults =& $args[0];
$defaults[] = array(
'id' => 'custom-citation-style',
'title' => 'Custom Citation Style',
'isEnabled' => true,
'useCsl' => Core::getBaseDir() . '/' . $this->getPluginPath() . '/custom_citation_style.csl',
);
}
/**
* @copydoc Plugin::getDisplayName()
*/
function getDisplayName() {
return ('Custom Citation Style');
}
/**
* @copydoc Plugin::getDescription()
*/
function getDescription() {
return ('Add the custom citation style to the Citation Style Language.');
}
}
?>