-
Notifications
You must be signed in to change notification settings - Fork 6
/
controller.php
46 lines (41 loc) · 955 Bytes
/
controller.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
<?php
defined( '_JEXEC' ) or die; // No direct access
/**
* Default Controller
* @author CB9TOIIIA
*/
class MyjbzoostatController extends JControllerLegacy
{
/**
* Method to display a view.
* @param bool $cachable
* @param array $urlparams
* @return JControllerLegacy
*/
function display( $cachable = false, $urlparams = array() )
{
$this->default_view = 'index';
parent::display( $cachable, $urlparams );
return $this;
}
/**
* Call AJAX method
* @throws Exception
*/
public function getAjax()
{
$input = JFactory::getApplication()->input;
$model = $this->getModel( 'ajax' );
$action = $input->getCmd( 'action' );
$reflection = new ReflectionClass( $model );
$methods = $reflection->getMethods( ReflectionMethod::IS_PUBLIC );
$methodList = array();
foreach ( $methods as $method ) {
$methodList[] = $method->name;
}
if ( in_array( $action, $methodList ) ) {
$model->$action();
}
exit;
}
}