-
Notifications
You must be signed in to change notification settings - Fork 17
/
joomlaoverride.php
74 lines (63 loc) · 2.07 KB
/
joomlaoverride.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
<?php
/**
* @package Joomla.Plugin
* @subpackage System.joomlaoverride
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
require_once 'helper/override.php';
require_once 'core/loader.php';
require_once 'helper/codepool.php';
require_once 'helper/component.php';
JoomlaOverrideHelperCodepool::initialize();
/**
* Joomla! Override Plugin
*
* @package Joomla.Plugin
* @subpackage System.joomlaoverride
* @since 1.5
*/
class PlgSystemJoomlaOverride extends JPlugin
{
/**
* onAfterRoute function.
*
* @access public
* @return void
*/
public function onAfterRoute()
{
//template name
$template = JFactory::getApplication()->getTemplate();
//code pools
$includePath = array();
//global extensions path
$customPath = JPath::clean($this->params->get('global_path','override'));
$basePath = JPATH_SITE.DIRECTORY_SEPARATOR.$customPath;
//add administrator scope
if (JFactory::getApplication()->isAdmin())
{
$basePath .= '/administrator';
}
$includePath[] = $basePath;
//template code path
$includePath[] = JPATH_THEMES.'/'.$template.'/code';
JoomlaOverrideHelperCodepool::addCodePath($includePath);
$this->option = JFactory::getApplication()->input->get('option');
$this->extension = JFactory::getApplication()->input->get('extension');
if( empty($this->option) && JFactory::getApplication()->isSite() ) {
$menuDefault = JFactory::getApplication()->getMenu()->getDefault();
if ($menuDefault == 0) return;
$componentID = $menuDefault->componentid;
$component = JTable::getInstance('extension');
$component->load($componentID);
$this->option = $component->element;
}
JoomlaOverrideHelperComponent::preload($this->option, $this->params);
JoomlaOverrideHelperComponent::includeInitialize($this->option,$this->extension);
}
}