/
foundry.php
executable file
·97 lines (78 loc) · 2.25 KB
/
foundry.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
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
92
93
94
95
96
97
<?php
/**
* @package Komento
* @copyright Copyright (C) 2010 - 2012 Stack Ideas Sdn Bhd. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Komento is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined( '_JEXEC' ) or die( 'Unauthorized Access' );
class FD31_FoundryCompiler_Komento extends FD31_FoundryCompiler_Foundry
{
public $name = 'Komento';
public $path = KOMENTO_MEDIA;
public function __construct($compiler)
{
$this->loadLanguage();
return parent::__construct($compiler);
}
public function createModule($moduleName, $moduleType, $adapterName)
{
// Rollback to foundry script when the module type if library
if ($moduleType=='library') {
$adapterName = 'Foundry';
$moduleType = 'script';
}
if ($adapterName=='Komento') {
if ($moduleType!=='language') {
$moduleName = 'komento/' . $moduleName;
}
}
$module = new FD31_FoundryModule($this->compiler, $adapterName, $moduleName, $moduleType);
return $module;
}
public function getPath($name, $type='script', $extension='')
{
switch ($type) {
case 'script':
$folder = 'scripts';
break;
case 'stylesheet':
$folder = 'styles';
break;
case 'template':
$folder = 'scripts';
break;
}
return $this->path . '/' . $folder . '/' . str_replace('komento/', '', $name) . '.' . $extension;
}
public function getLanguage($name)
{
return JText::_($name);
}
public function getView( $name )
{
// Due to compatibility, we had to append komento/ infront of the views, but we do not want this when fetching template
if( strpos( 'komento/', $name ) >= 0 )
{
$name = substr( $name, 8 );
}
$template = Komento::getTheme();
$out = $template->fetch($name . '.ejs');
$contents = '';
if ($out !== false)
{
$contents = $out;
}
return $contents;
}
private function loadLanguage()
{
// Load up language files
JFactory::getLanguage()->load( 'com_komento' , JPATH_ROOT );
JFactory::getLanguage()->load( 'com_komento' , JPATH_ROOT . '/administrator' );
}
}