BasePlugin.php
1.3 KB
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
<?php
/**
* @package OSYouTube
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016 Joomlashack.com, All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
namespace Alledia\OSYouTube;
use Alledia\Framework\Joomla\Extension\AbstractPlugin;
use Alledia\OSYouTube\Free\Methods;
defined('_JEXEC') or die();
class BasePlugin extends AbstractPlugin
{
/**
* @var string
*/
protected $namespace = 'OSYouTube';
/**
* @var AbstractMethods
*/
protected $methods = null;
public function __construct($subject, array $config = array())
{
parent::__construct($subject, $config);
$this->init();
$baseMethods = '\\Alledia\\OSYouTube\\%s\\Methods';
$proMethods = sprintf($baseMethods, 'Pro');
if (class_exists($proMethods)) {
$this->methods = new $proMethods($this);
} else {
$this->methods = new Methods($this);
}
}
/**
* @param string $context
* @param object $article
* @param object $params
* @param int $page
*
* @return bool
*/
public function onContentPrepare($context, &$article, &$params, $page = 0)
{
return $this->methods->onContentPrepare($context, $article, $params, $page);
}
}