-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewcountermt.php
63 lines (52 loc) · 1.87 KB
/
viewcountermt.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
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
import('lib.pkp.classes.plugins.GenericPlugin');
class viewcountermt extends GenericPlugin {
public function register($category, $path, $mainContextId = NULL) {
$success = parent::register($category, $path);
if ($success && $this->getEnabled()) {
HookRegistry::register('TemplateResource::getFilename', array($this, '_overridePluginTemplates'));
HookRegistry::register('TemplateResource::getFilename', array($this, '_overridearticle_summary'));
}
return $success;
}
/**
* Provide a name for this plugin
*
* The name will appear in the plugins list where editors can
* enable and disable plugins.
*/
public function getDisplayName() {
return __('plugins.generic.viewcountermt.displayName');
}
/**
* Provide a description for this plugin
*PluginTemplates
* The description will appear in the plugins list where editors can
* enable and disable plugins.
*/
public function getDescription() {
return __('plugins.generic.viewcountermt.description');
}
/**
* Get the name of the settings file to be installed on new context
* creation.
* @return string
*/
function getContextSpecificPluginSettingsFile() {
return $this->getPluginPath() . '/settings.xml';
}
public function _overridePluginTemplates($hookName, $args) {
$templatePath = $args[0];
if ($templatePath === 'plugins/themes/material/templates/frontend/objects/article_details.tpl') {
$args[0] = 'plugins/generic/viewcountermt/templates/frontend/objects/article_details.tpl';
}
return false;
}
public function _overridearticle_summary($hookName, $args) {
$templatePath = $args[0];
if ($templatePath === 'plugins/themes/material/templates/frontend/objects/article_summary.tpl') {
$args[0] = 'plugins/generic/viewcountermt/templates/frontend/objects/article_summary.tpl';
}
return false;
}
}