forked from juliopontes/joomla-override
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mvcoverride.php
62 lines (52 loc) · 1.57 KB
/
mvcoverride.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
<?php
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
require_once 'helper/override.php';
require_once 'helper/component.php';
/**
* PlgSystemMVCOverride class.
*
* @extends JPlugin
*/
class PlgSystemMVCOverride extends JPlugin
{
public function onAfterInitialise()
{
MVCOverrideHelperOverride::initialize();
//template name
$template = JFactory::getApplication()->getTemplate();
//code pools
$includePath = array();
//base extensions path
$includePath[] = JPATH_BASE.'/code';
//template code path
$includePath[] = JPATH_THEMES.'/'.$template.'/code';
MVCOverrideHelperOverride::addCodePath($includePath);
}
/**
* onAfterRoute function.
*
* @access public
* @return void
*/
public function onAfterRoute()
{
$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;
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM #__extensions WHERE id ='.$db->quote($componentID));
$component = $db->loadObject();
$this->option = $component->element;
}
MVCOverrideHelperComponent::preload($this->option, $this->params);
}
public function onAfterDispatch()
{
MVCOverrideHelperComponent::includeSubmenu($this->option,$this->extension);
}
}