-
Notifications
You must be signed in to change notification settings - Fork 0
/
27699.php
executable file
·84 lines (68 loc) · 1.95 KB
/
27699.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
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.27699
*
* @author Roberto Segura <[email protected]>
* @copyright (c) 2012 Roberto Segura. All Rights Reserved.
* @license GNU/GPL 2, http://www.gnu.org/licenses/gpl-2.0.htm
*/
defined('_JEXEC') or die;
JLoader::import('joomla.plugin.plugin');
/**
* Main plugin class
*
* @package Joomla.Plugin
* @subpackage Content.27699
* @since 3.0
*
*/
class PlgContent27699 extends JPlugin
{
private $_params = null;
// Plugin info constants
const TYPE = 'content';
const NAME = '27699';
// Url parameters
private $_option = null;
private $_view = null;
private $_id = null;
/**
* Constructor
*
* @param mixed &$subject Subject
*/
function __construct( &$subject )
{
parent::__construct($subject);
// Load plugin parameters
$this->_plugin = JPluginHelper::getPlugin(self::TYPE, self::NAME);
$this->_params = new JRegistry($this->_plugin->params);
}
function onContentPrepare($context, &$article, &$params )
{
// Required objects
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$jinput = $app->input;
// Get url parameters
$this->_option = $jinput->get('option', null);
$this->_view = $jinput->get('view', null);
$this->_id = $jinput->get('id', null);
/**
* Test Backwards Compatibility
* Old plugins only process $article->text
* New plugins should be able to access the article->title
**/
$title = isset($article->title) ? $article->title : "No title!";
$article->text .= '<h1>IT WORKS! ('.$context.'), Title='.$title.'</h1>';
//$article->introtext = str_replace('{27699}', '<h1>IT WORKS!</h1>', $article->introtext);
// Display title to ensure that the property is available
// echo var_dump($article->title);
if ($app->isSite())
{
$properties = get_object_vars($article);
echo '<h1>Context: ' . $context . ' - Properties: ' . count($properties) . '</h1>';
}
}
}