86 lines
3.8 KiB
PHP
86 lines
3.8 KiB
PHP
<?php
|
|
/**
|
|
* @version $Id: example.php 14401 2010-01-26 14:10:00Z louis $
|
|
* @package Joomla
|
|
* @subpackage Content
|
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
|
|
* @license GNU/GPL, see LICENSE.php
|
|
* Joomla! is free software. This version may have been modified pursuant
|
|
* to the GNU General Public License, and as distributed it includes or
|
|
* is derivative of works licensed under the GNU General Public License or
|
|
* other free or open source software licenses.
|
|
* See COPYRIGHT.php for copyright notices and details.
|
|
*/
|
|
|
|
// Check to ensure this file is included in Joomla!
|
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
|
|
|
jimport( 'joomla.plugin.plugin' );
|
|
|
|
/**
|
|
* Event Calendar Content Plugin
|
|
*
|
|
* @package Joomla
|
|
* @subpackage Content
|
|
* @since 1.5
|
|
*/
|
|
|
|
function EventCalendar_replacer( &$matches ) {
|
|
$id = (int)$matches[1];
|
|
$document =& JFactory::getDocument();
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/utilities.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/button.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/container.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/yahoo.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/event.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/dom.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/calendar.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/element.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/DCEventCalendar.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/intervalcalendar.js");
|
|
$document->addScript("components/com_cpeventcalendar/DC_EventCalendar/calendarcolors.js");
|
|
$document->addStyleSheet("components/com_cpeventcalendar/DC_EventCalendar/fonts-min.css");
|
|
$document->addStyleSheet("components/com_cpeventcalendar/DC_EventCalendar/button.css");
|
|
$document->addStyleSheet("components/com_cpeventcalendar/DC_EventCalendar/container.css");
|
|
$document->addStyleSheet("components/com_cpeventcalendar/DC_EventCalendar/calendar.css");
|
|
$document->addStyleSheet("components/com_cpeventcalendar/DC_EventCalendar/DCEventCalendar.css");
|
|
$container = "plg".mt_rand();
|
|
$styletext = "#".$container." .yui-calendar td.calcell {width:".(int)$matches[3]."px;height:".(int)$matches[4]."px;}";
|
|
$document->addStyleDeclaration($styletext);
|
|
$document->addScriptDeclaration("var pathCalendarCPE = \"".JURI::base(true)."/components/com_cpeventcalendar/DC_EventCalendar/\";\n".
|
|
"var pathCalendarCPEJB = \"".JURI::base(true)."/\";\n".
|
|
"initEventCalendar(\"".$id."\",\"".$container."\",".(int)$matches[5].",2,\"".$matches[2]."\",{},".(int)$matches[3].",".(int)$matches[4].");");
|
|
$str = '<div style="z-index:1000;">
|
|
<div id="'.$container.'"></div>
|
|
<div style="clear:both"></div>
|
|
</div>
|
|
';
|
|
return $str;
|
|
}
|
|
|
|
class plgContentEventcalendar extends JPlugin
|
|
{
|
|
public function __construct(& $subject, $config)
|
|
{
|
|
parent::__construct($subject, $config);
|
|
$this->loadLanguage();
|
|
}
|
|
|
|
|
|
/**
|
|
* Example prepare content method
|
|
*
|
|
* Method is called by the view
|
|
*
|
|
* @param object The article object. Note $article->text is also available
|
|
* @param object The article params
|
|
* @param int The 'page' number
|
|
*/
|
|
public function onContentPrepare($context, &$article, &$params, $limitstart)
|
|
{
|
|
// define the regular expression for the bot
|
|
$regex = "#\{eventcalendar\:(\d{1,2})\:(\S{5})\:(\d{1,3})\:(\d{1,3})\:(\d{1,2})\}#s";
|
|
$article->text = preg_replace_callback( $regex, 'EventCalendar_replacer', $article->text );
|
|
return true;
|
|
}
|
|
} |