primo commit
This commit is contained in:
77
plugins/system/tabulizercsslegacy/tabulizercsslegacy.php
Normal file
77
plugins/system/tabulizercsslegacy/tabulizercsslegacy.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* @version 6.2.6 tabulizer $
|
||||
* @package tabulizer
|
||||
* @copyright Copyright © 2011 - All rights reserved.
|
||||
* @license GNU/GPL
|
||||
* @author Dimitrios Mourloukos
|
||||
* @author mail info@alterora.gr
|
||||
* @website www.tabulizer.com
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport( 'joomla.plugin.plugin' );
|
||||
|
||||
if(!defined('DS')){define('DS',DIRECTORY_SEPARATOR);}
|
||||
|
||||
|
||||
class plgSystemtabulizercsslegacy extends JPlugin
|
||||
{
|
||||
function __construct(& $subject, $config) {
|
||||
parent::__construct($subject, $config);
|
||||
$this->loadLanguage();
|
||||
}
|
||||
|
||||
function onAfterRoute() {
|
||||
$JApplication=JFactory::getApplication();
|
||||
|
||||
if(!$JApplication->isAdmin()) {
|
||||
# add all css files in folder
|
||||
$cssfiles = array();
|
||||
$relative_dir = $this->params->get('csspath');
|
||||
|
||||
// remove starting slash, if needed
|
||||
$first_char = substr($relative_dir, 0, 1);
|
||||
if (($first_char == '/') || ($first_char == '\\')) {
|
||||
$relative_dir = substr($relative_dir, 1);
|
||||
}
|
||||
|
||||
// add missing ending slash, if needed
|
||||
$last_char = substr($relative_dir, -1);
|
||||
if (($last_char != '/') && ($last_char != '\\')) {
|
||||
$relative_dir .= '/';
|
||||
}
|
||||
|
||||
$dir = JPATH_ROOT .DIRECTORY_SEPARATOR. $relative_dir;
|
||||
if (is_dir($dir)) {
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if (is_file($dir . $file)) {
|
||||
if (preg_match('/().css$/',$file)) {
|
||||
$cssfiles[] = $relative_dir . $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($cssfiles)) {
|
||||
$doc=JFactory::getDocument();
|
||||
foreach ($cssfiles as $cssfile) {
|
||||
$doc->addStyleSheet($cssfile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user