Skip to content

Commit

Permalink
T3 Re-structure: Change t3import => T3::import
Browse files Browse the repository at this point in the history
Fix t3import conflict with JA T3v2
Need to find a shortcut function
  • Loading branch information
joomlart committed Mar 11, 2013
1 parent 518d7cc commit e7aba9f
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 54 deletions.
2 changes: 1 addition & 1 deletion source/plg_system_t3/admin/layout/layout.tpl.php
Expand Up @@ -12,7 +12,7 @@
*------------------------------------------------------------------------------
*/

t3import('admin/layout');
T3::import('admin/layout');
?>

<!-- LAYOUT CONFIGURATION PANEL -->
Expand Down
2 changes: 1 addition & 1 deletion source/plg_system_t3/includes/admin/megamenu.php
Expand Up @@ -14,7 +14,7 @@

class T3AdminMegamenu {
public static function display () {
t3import('menu/megamenu');
T3::import('menu/megamenu');
$input = JFactory::getApplication()->input;
$menutype = $input->get ('t3menu', 'mainmenu');
$tplparams = $input->get('tplparams', '', 'raw');
Expand Down
6 changes: 3 additions & 3 deletions source/plg_system_t3/includes/admin/theme.php
Expand Up @@ -50,7 +50,7 @@ public static function save($path)
$file = $path . '/less/themes/' . $theme . '/variables-custom.less';

if(!class_exists('JRegistryFormatLESS')){
t3import('format/less');
T3::import('format/less');
}
$variables = new JRegistry();
$variables->loadObject($_POST);
Expand Down Expand Up @@ -85,7 +85,7 @@ public static function save($path)
}

//LessHelper::compileForTemplate(T3_TEMPLATE_PATH, $theme);
t3import ('core/less');
T3::import ('core/less');
T3Less::compileAll($theme);
return self::response($result);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public static function duplicate($path)
}

//LessHelper::compileForTemplate(T3_TEMPLATE_PATH , $theme);
t3import ('core/less');
T3::import ('core/less');
T3Less::compileAll($theme);
return self::response($result);
}
Expand Down
10 changes: 5 additions & 5 deletions source/plg_system_t3/includes/core/action.php
Expand Up @@ -45,7 +45,7 @@ public static function run ($action) {
public static function lessc () {
$path = JFactory::getApplication()->input->getString ('s');

t3import ('core/less');
T3::import ('core/less');
$t3less = new T3Less;
$css = $t3less->getCss($path);

Expand All @@ -55,7 +55,7 @@ public static function lessc () {
}

public static function lesscall(){
t3import ('core/less');
T3::import ('core/less');

$result = array();
try{
Expand Down Expand Up @@ -93,7 +93,7 @@ public static function theme(){
)));
}

t3import('admin/theme');
T3::import('admin/theme');

if(method_exists('T3AdminTheme', $action)){
T3AdminTheme::$action(T3_TEMPLATE_PATH);
Expand Down Expand Up @@ -178,7 +178,7 @@ public static function layout(){
}
}

t3import('admin/layout');
T3::import('admin/layout');

if(method_exists('T3AdminLayout', $action)){
T3AdminLayout::$action(T3_TEMPLATE_PATH);
Expand Down Expand Up @@ -214,7 +214,7 @@ public static function megamenu() {
}
}

t3import('admin/megamenu');
T3::import('admin/megamenu');

if(method_exists('T3AdminMegamenu', $action)){
T3AdminMegamenu::$action();
Expand Down
2 changes: 1 addition & 1 deletion source/plg_system_t3/includes/core/bot.php
Expand Up @@ -75,7 +75,7 @@ public static function afterInit () {
if (!$app->isAdmin()) {
// check if need update megamenu configuration
if ($app->getTemplate(true)->params->get ('mm_config_needupdate')) {
t3import('menu/megamenu');
T3::import('menu/megamenu');
$currentconfig = json_decode($app->getTemplate(true)->params->get ('mm_config'), true);
if (!is_array($currentconfig)) $currentconfig = array();

Expand Down
4 changes: 2 additions & 2 deletions source/plg_system_t3/includes/core/less.php
Expand Up @@ -14,8 +14,8 @@

// No direct access
defined('_JEXEC') or die();
t3import('lessphp/lessc.inc');
t3import('core/path');
T3::import('lessphp/lessc.inc');
T3::import('core/path');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');

Expand Down
4 changes: 2 additions & 2 deletions source/plg_system_t3/includes/core/minify.php
Expand Up @@ -16,8 +16,8 @@
defined('_JEXEC') or die();

jimport('joomla.filesystem.file');
t3import('minify/csscompressor');
t3import('core/path');
T3::import('minify/csscompressor');
T3::import('core/path');

/**
* T3Template class provides extended template tools used for T3 framework
Expand Down
59 changes: 27 additions & 32 deletions source/plg_system_t3/includes/core/t3.php
Expand Up @@ -13,23 +13,6 @@
*/


/**
* Import T3 Library
*
* @param string $package Object path that seperate by backslash (/)
*
* @return void
*/
function t3import($package)
{
$path = T3_ADMIN_PATH . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . strtolower($package) . '.php';
if (file_exists($path)) {
include_once $path;
} else {
trigger_error('t3import not found object: ' . $package, E_USER_ERROR);
}
}

/**
* T3 Class
* Singleton class for T3
Expand All @@ -38,6 +21,22 @@ class T3 {

protected static $t3app = null;

/**
* Import T3 Library
*
* @param string $package Object path that seperate by backslash (/)
*
* @return void
*/
public static function import($package){
$path = T3_ADMIN_PATH . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . strtolower($package) . '.php';
if (file_exists($path)) {
include_once $path;
} else {
trigger_error('T3::import not found object: ' . $package, E_USER_ERROR);
}
}

public static function getApp($tpl = null){
if(empty(self::$t3app)){
$japp = JFactory::getApplication();
Expand Down Expand Up @@ -78,27 +77,27 @@ public static function init ($template) {
}

// load core library
t3import ('core/path');
T3::import ('core/path');

$app = JFactory::getApplication();
if (!$app->isAdmin()) {
$jversion = new JVersion;
if($jversion->isCompatible('3.0')){
// override core joomla class
// JViewLegacy
if (!class_exists('JViewLegacy', false)) t3import ('joomla30/viewlegacy');
if (!class_exists('JViewLegacy', false)) T3::import ('joomla30/viewlegacy');
// JModuleHelper
if (!class_exists('JModuleHelper', false)) t3import ('joomla30/modulehelper');
if (!class_exists('JModuleHelper', false)) T3::import ('joomla30/modulehelper');
// JPagination
if (!class_exists('JPagination', false)) t3import ('joomla30/pagination');
if (!class_exists('JPagination', false)) T3::import ('joomla30/pagination');
} else {
// override core joomla class
// JViewLegacy
if (!class_exists('JView', false)) t3import ('joomla25/view');
if (!class_exists('JView', false)) T3::import ('joomla25/view');
// JModuleHelper
if (!class_exists('JModuleHelper', false)) t3import ('joomla25/modulehelper');
if (!class_exists('JModuleHelper', false)) T3::import ('joomla25/modulehelper');
// JPagination
if (!class_exists('JPagination', false)) t3import ('joomla25/pagination');
if (!class_exists('JPagination', false)) T3::import ('joomla25/pagination');
}
} else {
}
Expand All @@ -114,13 +113,13 @@ public static function init ($template) {
public static function checkAction () {
// excute action by T3
if ($action = JFactory::getApplication()->input->getCmd ('t3action')) {
t3import ('core/action');
T3::import ('core/action');
T3Action::run ($action);
}
}

public static function getAdmin(){
t3import ('core/admin');
T3::import ('core/admin');
return new T3Admin();
}

Expand All @@ -131,7 +130,7 @@ public static function getSite($tpl){
}

$type = 'Template'. JFactory::getApplication()->input->getCmd ('t3tp', '');
t3import ('core/'.$type);
T3::import ('core/'.$type);

// create global t3 template object
$class = 'T3'.$type;
Expand All @@ -149,8 +148,7 @@ public static function error($msg, $code = 500){
}
}

public static function detect()
{
public static function detect(){
static $t3;

if (!isset($t3)) {
Expand Down Expand Up @@ -220,11 +218,8 @@ public static function detect()
}
}
}

}
return $t3;
}

}

?>
8 changes: 4 additions & 4 deletions source/plg_system_t3/includes/core/template.php
Expand Up @@ -15,7 +15,7 @@
// No direct access
defined('_JEXEC') or die();

t3import ('extendable/extendable');
T3::import ('extendable/extendable');

/**
* T3Template class provides extended template tools used for T3 framework
Expand Down Expand Up @@ -247,7 +247,7 @@ function spotlight($name, $positions, array $info = array())
}

function megamenu($menutype){
t3import('menu/megamenu');
T3::import('menu/megamenu');

//$file = T3_TEMPLATE_PATH.'/etc/megamenu.ini';
//$currentconfig = json_decode(@file_get_contents ($file), true);
Expand Down Expand Up @@ -435,7 +435,7 @@ function addCss ($name, $addresponsive = true) {
$themermode = $this->getParam('themermode', 1);
$responsive = $addresponsive ? $this->getParam('responsive', 1) : false;
if (($devmode || ($themermode && defined ('T3_THEMER'))) && ($url = T3Path::getUrl('less/'.$name.'.less', '', true))) {
t3import ('core/less');
T3::import ('core/less');
T3Less::addStylesheet ($url);
} else {
$url = T3Path::getUrl ('css/'.$name.'.css');
Expand Down Expand Up @@ -582,7 +582,7 @@ function updateHead () {

//only check for minify if devmode is disabled
if(!$devmode && $minify){
t3import ('core/minify');
T3::import ('core/minify');
T3Minify::optimizecss($this);
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/plg_system_t3/includes/core/templatelayout.php
Expand Up @@ -14,7 +14,7 @@

// No direct access
defined('_JEXEC') or die();
t3import ('core/template');
T3::import ('core/template');
jimport('joomla.utilities.utility');

/**
Expand Down
2 changes: 1 addition & 1 deletion source/plg_system_t3/includes/menu/megamenu.php
Expand Up @@ -12,7 +12,7 @@
*------------------------------------------------------------------------------
*/

t3import ('menu/megamenu.tpl');
T3::import ('menu/megamenu.tpl');

class T3MenuMegamenu {
protected $children = array();
Expand Down
2 changes: 1 addition & 1 deletion source/plg_system_t3/t3.php
Expand Up @@ -49,7 +49,7 @@ function onBeforeRender(){
} else {
$params = $japp->getTemplate(true)->params;
if(defined('T3_THEMER') && $params->get('themermode', 1)){
t3import('admin/theme');
T3::import('admin/theme');
T3AdminTheme::addAssets();
}
}
Expand Down

0 comments on commit e7aba9f

Please sign in to comment.