baseline
[omp.pkp.sfu.ca.git] / plugins / blocks / fontSize / FontSizeBlockPlugin.inc.php
blobfb370f23ddef8d6f9769cbe7b22c2dc5253e8fc8
1 <?php
3 /**
4 * @file FontSizeBlockPlugin.inc.php
6 * Copyright (c) 2003-2008 John Willinsky
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 * @class FontSizeBlockPlugin
10 * @ingroup plugins_blocks_fontSize
12 * @brief Class for font size block plugin
16 // $Id: FontSizeBlockPlugin.inc.php,v 1.1.1.1 2008/10/20 21:27:10 tylerl Exp $
18 import('plugins.BlockPlugin');
20 class FontSizeBlockPlugin extends BlockPlugin {
21 function register($category, $path) {
22 $success = parent::register($category, $path);
23 if ($success) {
24 $this->addLocaleData();
25 $templateMgr =& TemplateManager::getManager();
26 $templateMgr->assign('fontIconPath', 'templates/images/icons');
27 $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
29 // Add font sizer js and css if not already in header
30 if (strpos(strtolower($additionalHeadData), 'sizer.js') === false) {
31 $additionalHeadData .= $templateMgr->fetch('common/sizer.tpl');
32 $templateMgr->assign('additionalHeadData', $additionalHeadData);
35 return $success;
38 /**
39 * Determine whether the plugin is enabled. Overrides parent so that
40 * the plugin will be displayed during install.
42 function getEnabled() {
43 if (!Config::getVar('general', 'installed')) return true;
44 return parent::getEnabled();
47 /**
48 * Install default settings on system install.
49 * @return string
51 function getInstallSitePluginSettingsFile() {
52 return $this->getPluginPath() . '/settings.xml';
55 /**
56 * Install default settings on press creation.
57 * @return string
59 function getNewPressPluginSettingsFile() {
60 return $this->getPluginPath() . '/settings.xml';
63 /**
64 * Get the block context. Overrides parent so that the plugin will be
65 * displayed during install.
66 * @return int
68 function getBlockContext() {
69 if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_RIGHT_SIDEBAR;
70 return parent::getBlockContext();
73 /**
74 * Get the supported contexts (e.g. BLOCK_CONTEXT_...) for this block.
75 * @return array
77 function getSupportedContexts() {
78 return array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR);
81 /**
82 * Determine the plugin sequence. Overrides parent so that
83 * the plugin will be displayed during install.
85 function getSeq() {
86 if (!Config::getVar('general', 'installed')) return 3;
87 return parent::getSeq();
90 /**
91 * Get the name of this plugin. The name must be unique within
92 * its category.
93 * @return String name of plugin
95 function getName() {
96 return 'FontSizeBlockPlugin';
99 /**
100 * Get the display name of this plugin.
101 * @return String
103 function getDisplayName() {
104 return Locale::translate('plugins.block.fontSize.displayName');
108 * Get a description of the plugin.
110 function getDescription() {
111 return Locale::translate('plugins.block.fontSize.description');
115 * Get the HTML contents for this block.
116 * @param $templateMgr object
117 * @return string
119 function getContents(&$templateMgr) {
120 return parent::getContents($templateMgr);