Changeset 8926


Ignore:
Timestamp:
Feb 4, 2009, 11:58:03 AM (16 years ago)
Author:
Alexander Trofimov
Message:

bx_import function for easy including Dolphin and modules class files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/inc/utils.inc.php

    r8858 r8926  
    10101010    return preg_replace( "/(&|&){$sExceptParam}=([a-z0-9\_\-]{1,})/i",'', $sString); 
    10111011} 
     1012 
     1013/** 
     1014 * import class file, it detect class path by its prefix or module array 
     1015 * 
     1016 * @param $sClassName - full class name or class postfix in a case of module class 
     1017 * @param $aModule - module array or true to get module array from global variable 
     1018 */ 
     1019function bx_import ($sClassName, $aModule = array())  
     1020{ 
     1021    if (class_exists($sClassName))  
     1022        return; 
     1023 
     1024    if ($aModule)  
     1025    { 
     1026        $a = (true === $aModule) ? $GLOABLS['aModule'] : $aModule; 
     1027        if (class_exists($a['class_prefix'] . $sClassName))  
     1028            return; 
     1029        require_once (BX_DIRECTORY_PATH_MODULES . $a['path'] . '/classes/' . $a['class_prefix'] . $sClassName . '.php'); 
     1030    } 
     1031 
     1032    if (0 == strncmp($sClassName, 'BxDol', 5))  
     1033    { 
     1034        require_once(BX_DIRECTORY_PATH_CLASSES . $sClassName . '.php'); 
     1035        return; 
     1036    } 
     1037    if (0 == strncmp($sClassName, 'BxBase', 6))  
     1038    { 
     1039        require_once(BX_DIRECTORY_PATH_BASE . 'scripts/' . $sClassName . '.php'); 
     1040        return; 
     1041    }     
     1042    if (0 == strncmp($sClassName, 'BxTmpl', 6))  
     1043    { 
     1044        require_once(BX_DIRECTORY_PATH_ROOT . "templates/tmpl_{$GLOBALS['tmpl']}/scripts/" . $sClassName . '.php'); 
     1045        return; 
     1046    } 
     1047} 
     1048 
    10121049?> 
Note: See TracChangeset for help on using the changeset viewer.
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
Fork me on GitHub