16 import(
'lib.pkp.classes.plugins.ThemePlugin');
23 if (defined(
'SESSION_DISABLE_INIT'))
return true;
24 return parent::isActive();
36 $this->
addOption(
'typography',
'FieldOptions', [
38 'label' => __(
'plugins.themes.default.option.typography.label'),
39 'description' => __(
'plugins.themes.default.option.typography.description'),
42 'value' =>
'notoSans',
43 'label' => __(
'plugins.themes.default.option.typography.notoSans'),
46 'value' =>
'notoSerif',
47 'label' => __(
'plugins.themes.default.option.typography.notoSerif'),
50 'value' =>
'notoSerif_notoSans',
51 'label' => __(
'plugins.themes.default.option.typography.notoSerif_notoSans'),
54 'value' =>
'notoSans_notoSerif',
55 'label' => __(
'plugins.themes.default.option.typography.notoSans_notoSerif'),
59 'label' => __(
'plugins.themes.default.option.typography.lato'),
63 'label' => __(
'plugins.themes.default.option.typography.lora'),
66 'value' =>
'lora_openSans',
67 'label' => __(
'plugins.themes.default.option.typography.lora_openSans'),
70 'default' =>
'notoSans',
72 $this->
addOption(
'useHomepageImageAsHeader',
'FieldOptions', [
73 'label' => __(
'plugins.themes.default.option.useHomepageImageAsHeader.label'),
74 'description' => __(
'plugins.themes.default.option.useHomepageImageAsHeader.description'),
78 'label' => __(
'plugins.themes.default.option.useHomepageImageAsHeader.option')
84 $this->
addOption(
'baseColour',
'FieldColor', [
85 'label' => __(
'plugins.themes.default.option.colour.label'),
86 'description' => __(
'plugins.themes.default.option.colour.description'),
87 'default' =>
'#1E6292',
91 $this->
addStyle(
'stylesheet',
'styles/index.less');
94 $additionalLessVariables = array();
101 if ($this->
getOption(
'typography') ===
'notoSerif') {
104 '//fonts.googleapis.com/css?family=Noto+Serif:400,400i,700,700i',
105 array(
'baseUrl' =>
'')
107 $additionalLessVariables[] =
'@font: "Noto Serif", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;';
109 } elseif (strpos($this->
getOption(
'typography'),
'notoSerif') !==
false) {
111 'fontNotoSansNotoSerif',
112 '//fonts.googleapis.com/css?family=Noto+Sans:400,400i,700,700i|Noto+Serif:400,400i,700,700i',
113 array(
'baseUrl' =>
'')
117 if ($this->
getOption(
'typography') ==
'notoSerif_notoSans') {
118 $additionalLessVariables[] =
'@font-heading: "Noto Serif", serif;';
119 } elseif ($this->
getOption(
'typography') ==
'notoSans_notoSerif') {
120 $additionalLessVariables[] =
'@font: "Noto Serif", serif;@font-heading: "Noto Sans", serif;';
123 } elseif ($this->
getOption(
'typography') ==
'lato') {
126 '//fonts.googleapis.com/css?family=Lato:400,400i,900,900i',
127 array(
'baseUrl' =>
'')
129 $additionalLessVariables[] =
'@font: Lato, sans-serif;';
131 } elseif ($this->
getOption(
'typography') ==
'lora') {
134 '//fonts.googleapis.com/css?family=Lora:400,400i,700,700i',
135 array(
'baseUrl' =>
'')
137 $additionalLessVariables[] =
'@font: Lora, serif;';
139 } elseif ($this->
getOption(
'typography') ==
'lora_openSans') {
142 '//fonts.googleapis.com/css?family=Lora:400,400i,700,700i|Open+Sans:400,400i,700,700i',
143 array(
'baseUrl' =>
'')
145 $additionalLessVariables[] =
'@font: "Open Sans", sans-serif;@font-heading: Lora, serif;';
150 '//fonts.googleapis.com/css?family=Noto+Sans:400,400italic,700,700italic',
151 array(
'baseUrl' =>
'')
157 if ($this->
getOption(
'baseColour') !==
'#1E6292') {
158 $additionalLessVariables[] =
'@bg-base:' . $this->
getOption(
'baseColour') .
';';
160 $additionalLessVariables[] =
'@text-bg-base:rgba(0,0,0,0.84);';
161 $additionalLessVariables[] =
'@bg-base-border-color:rgba(0,0,0,0.2);';
166 if (!empty($additionalLessVariables)) {
167 $this->
modifyStyle(
'stylesheet', array(
'addLessVariables' => join($additionalLessVariables)));
174 $url =
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css';
176 $url =
$request->getBaseUrl() .
'/lib/pkp/styles/fontawesome/fontawesome.css';
181 array(
'baseUrl' =>
'')
186 if ($context && $this->
getOption(
'useHomepageImageAsHeader')) {
189 $publicFilesDir =
$request->getBaseUrl() .
'/' . $publicFileManager->getContextFilesPath($context->getId());
191 $homepageImage = $context->getLocalizedData(
'homepageImage');
193 $homepageImageUrl = $publicFilesDir .
'/' . $homepageImage[
'uploadName'];
197 '.pkp_structure_head { background: center / cover no-repeat url("' . $homepageImageUrl .
'");}',
203 $min =
Config::getVar(
'general',
'enable_minified') ?
'.min' :
'';
206 $jquery =
'//ajax.googleapis.com/ajax/libs/jquery/' . CDN_JQUERY_VERSION .
'/jquery' . $min .
'.js';
207 $jqueryUI =
'//ajax.googleapis.com/ajax/libs/jqueryui/' . CDN_JQUERY_UI_VERSION .
'/jquery-ui' . $min .
'.js';
210 $jquery =
$request->getBaseUrl() .
'/lib/pkp/lib/vendor/components/jquery/jquery' . $min .
'.js';
211 $jqueryUI =
$request->getBaseUrl() .
'/lib/pkp/lib/vendor/components/jqueryui/jquery-ui' . $min .
'.js';
215 $this->
addScript(
'jQuery', $jquery, array(
'baseUrl' =>
''));
216 $this->
addScript(
'jQueryUI', $jqueryUI, array(
'baseUrl' =>
''));
217 $this->
addScript(
'jQueryTagIt',
$request->getBaseUrl() .
'/lib/pkp/js/lib/jquery/plugins/jquery.tag-it.js', array(
'baseUrl' =>
''));
220 $this->
addScript(
'popper',
'js/lib/popper/popper.js');
221 $this->
addScript(
'bsUtil',
'js/lib/bootstrap/util.js');
222 $this->
addScript(
'bsDropdown',
'js/lib/bootstrap/dropdown.js');
225 $this->
addScript(
'default',
'js/main.js');
254 return __(
'plugins.themes.default.name');
262 return __(
'plugins.themes.default.description');