Changeset 1693


Ignore:
Timestamp:
05/14/10 13:44:19 (3 years ago)
Author:
shibuya246
Message:

[branch 1.3] added a smartloader class for class libs to the core

Location:
branches/1.3
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/Hotaru.php

    r1686 r1693  
    7070        public function __construct($start = '') 
    7171        { 
     72            require_once(LIBS . 'smartloader.class.php'); 
    7273                // initialize Hotaru 
    73                 if (!$start) {  
    74                         require_once(LIBS . 'Initialize.php'); 
     74                if (!$start) { 
     75                         
    7576                        $init = new Initialize($this); 
     77                         
    7678                        $this->db           = $init->db;            // database object 
    7779                        $this->cage         = $init->cage;          // Inspekt cage 
     
    102104                // Set up debugging: 
    103105                if ($this->isDebug) {  
    104                         require_once(LIBS . 'Debug.php'); 
    105106                        $this->debug = new Debug(); 
    106107                } 
     
    378379        public function pagination($query, $total_items, $items_per_page = 10, $cache_table = '') 
    379380        { 
    380                 require_once(LIBS . 'Paginator.php'); 
    381381                $paginator = new Paginator(); 
    382382                return $paginator->pagination($this, $query, $total_items, $items_per_page, $cache_table); 
     
    393393        public function paginationFull($data, $items_per_page = 10) 
    394394        { 
    395                 require_once(LIBS . 'Paginator.php'); 
    396395                $paginator = new Paginator(); 
    397396                return $paginator->paginationFull($this, $data, $items_per_page); 
     
    423422        public function breadcrumbs() 
    424423        { 
    425                 require_once(LIBS . 'Breadcrumbs.php'); 
    426424                $breadcrumbs = new Breadcrumbs(); 
    427425                return $breadcrumbs->buildBreadcrumbs($this); 
     
    438436        public function rssBreadcrumbsLink($status = '', $vars = array()) 
    439437        { 
    440                 require_once(LIBS . 'Breadcrumbs.php'); 
    441438                $breadcrumbs = new Breadcrumbs(); 
    442439                return $breadcrumbs->rssBreadcrumbsLink($this, $status, $vars); 
     
    593590        public function getUserNameFromId($id = 0) 
    594591        { 
    595                 require_once(LIBS . 'UserInfo.php'); 
    596592                $userInfo = new UserInfo(); 
    597593                return $userInfo->getUserNameFromId($this, $id); 
     
    607603        public function getUserIdFromName($username = '') 
    608604        { 
    609                 require_once(LIBS . 'UserInfo.php'); 
    610605                $userInfo = new UserInfo(); 
    611606                return $userInfo->getUserIdFromName($this, $username); 
     
    621616        public function getEmailFromId($userid = 0) 
    622617        { 
    623                 require_once(LIBS . 'UserInfo.php'); 
    624618                $userInfo = new UserInfo(); 
    625619                return $userInfo->getEmailFromId($this, $userid); 
     
    635629        public function getUserIdFromEmail($email = '') 
    636630        { 
    637                 require_once(LIBS . 'UserInfo.php'); 
    638631                $userInfo = new UserInfo(); 
    639632                return $userInfo->getUserIdFromEmail($this, $email); 
     
    648641        public function isAdmin($username) 
    649642        { 
    650                 require_once(LIBS . 'UserInfo.php'); 
    651643                $userInfo = new UserInfo(); 
    652644                return $userInfo->isAdmin($this->db, $username); 
     
    665657        public function userExists($id = 0, $username = '', $email = '') 
    666658        { 
    667                 require_once(LIBS . 'UserInfo.php'); 
    668659                $userInfo = new UserInfo(); 
    669660                return $userInfo->userExists($this->db, $id, $username, $email); 
     
    681672        public function nameExists($username = '', $role = '', $exclude = 0) 
    682673        { 
    683                 require_once(LIBS . 'UserInfo.php'); 
    684674                $userInfo = new UserInfo(); 
    685675                return $userInfo->nameExists($this, $username, $role, $exclude); 
     
    697687        public function emailExists($email = '', $role = '', $exclude = 0) 
    698688        { 
    699                 require_once(LIBS . 'UserInfo.php'); 
    700689                $userInfo = new UserInfo(); 
    701690                return $userInfo->emailExists($this, $email, $role, $exclude); 
     
    712701        public function getMods($permission = 'can_access_admin', $value = 'yes') 
    713702        { 
    714                 require_once(LIBS . 'UserInfo.php'); 
    715703                $userInfo = new UserInfo(); 
    716704                return $userInfo->getMods($this, $permission, $value); 
     
    725713        public function getUniqueRoles()  
    726714        { 
    727                 require_once(LIBS . 'UserInfo.php'); 
    728715                $userInfo = new UserInfo(); 
    729716                return $userInfo->getUniqueRoles($this); 
     
    739726        public function userIdNameList($role = '') 
    740727        { 
    741                 require_once(LIBS . 'UserInfo.php'); 
    742728                $userInfo = new UserInfo(); 
    743729                return $userInfo->userIdNameList($this, $role); 
     
    755741        public function userListFull($id_array = array(), $start = 0, $range = 0) 
    756742        { 
    757                 require_once(LIBS . 'UserInfo.php'); 
    758743                $userInfo = new UserInfo(); 
    759744                return $userInfo->userListFull($this, $id_array, $start, $range); 
     
    769754        public function userSettingsList($userid = 0) 
    770755        { 
    771                 require_once(LIBS . 'UserInfo.php'); 
    772756                $userInfo = new UserInfo(); 
    773757                return $userInfo->userSettingsList($this, $userid); 
     
    10371021        public function readThemeMeta($theme = 'default') 
    10381022        { 
    1039                 require_once(LIBS . 'ThemeSettings.php'); 
    10401023                $themeSettings = new ThemeSettings(); 
    10411024                return $themeSettings->readThemeMeta($this, $theme); 
     
    10521035        public function getThemeSettings($theme = '', $return = 'value') 
    10531036        { 
    1054                 require_once(LIBS . 'ThemeSettings.php'); 
    10551037                $themeSettings = new ThemeSettings(); 
    10561038                return $themeSettings->getThemeSettings($this, $theme, $return); 
     
    10681050        public function updateThemeSettings($settings = array(), $theme = '', $column = 'value') 
    10691051        { 
    1070                 require_once(LIBS . 'ThemeSettings.php'); 
    10711052                $themeSettings = new ThemeSettings(); 
    10721053                return $themeSettings->updateThemeSettings($this, $settings, $theme, $column); 
     
    11551136        public function showMessage($msg = '', $msg_type = 'green') 
    11561137        { 
    1157                 require_once(LIBS . 'Messages.php'); 
    11581138                $messages = new Messages(); 
    11591139                $messages->showMessage($this, $msg, $msg_type); 
     
    11661146        public function showMessages() 
    11671147        { 
    1168                 require_once(LIBS . 'Messages.php'); 
    11691148                $messages = new Messages(); 
    11701149                $messages->showMessages($this); 
     
    11871166        public function checkAnnouncements($announcement = '')  
    11881167        { 
    1189                 require_once(LIBS . 'Announcements.php'); 
    11901168                $announce = new Announcements(); 
    11911169                if ($this->isAdmin) { 
     
    12091187        public function showQueriesAndTime() 
    12101188        { 
    1211                 if ($this->isDebug) { 
    1212                         $this->debug->showQueriesAndTime($this); 
     1189                if ($this->isDebug) {               
     1190                   $this->debug->showQueriesAndTime($this); 
    12131191                } 
    12141192        } 
     
    12571235        { 
    12581236                if (!is_object($this->debug)) {  
    1259                         require_once(LIBS . 'Debug.php'); 
    12601237                        $this->debug = new Debug(); 
    12611238                } 
     
    12821259        public function newSimplePie($feed='', $cache=RSS_CACHE, $cache_duration=RSS_CACHE_DURATION) 
    12831260        { 
    1284                 require_once(LIBS . 'Feeds.php'); 
    12851261                $feeds = new Feeds(); 
    12861262                return $feeds->newSimplePie($feed, $cache, $cache_duration); 
     
    12971273        public function adminNews($max_items = 10, $items_with_content = 3, $max_chars = 300) 
    12981274        { 
    1299                 require_once(LIBS . 'Feeds.php'); 
    13001275                $feeds = new Feeds(); 
    13011276                $feeds->adminNews($this->lang, $max_items, $items_with_content, $max_chars); 
     
    13131288        public function rss($title = '', $link = '', $description = '', $items = array()) 
    13141289        { 
    1315                 require_once(LIBS . 'Feeds.php'); 
    13161290                $feeds = new Feeds(); 
    13171291                $feeds->rss($this, $title, $link, $description, $items); 
     
    13311305        public function adminPages($page = 'admin_login') 
    13321306        { 
    1333                 require_once(LIBS . 'AdminPages.php'); 
    13341307                $admin = new AdminPages(); 
    13351308                $admin->pages($this, $page); 
     
    13441317        public function adminLoginLogout($action = 'logout') 
    13451318        { 
    1346                 require_once(LIBS . 'AdminAuth.php'); 
    13471319                $admin = new AdminAuth(); 
    13481320                return ($action == 'login') ? $admin->adminLogin($this) : $admin->adminLogout($this); 
     
    13551327        public function adminLoginForm() 
    13561328        { 
    1357                 require_once(LIBS . 'AdminAuth.php'); 
    13581329                $admin = new AdminAuth(); 
    13591330                $admin->adminLoginForm($this); 
     
    13821353                if ($this->pageName == 'admin_login') { return true; } 
    13831354                 
    1384                 require_once(LIBS . 'Maintenance.php'); 
    1385                 $maintenance = new Maintenance(); 
     1355                                $maintenance = new Maintenance(); 
    13861356                return $maintenance->siteClosed($this, $this->lang); // displays "Site Closed for Maintenance" 
    13871357        } 
     
    13951365        public function openCloseSite($switch = 'open') 
    13961366        { 
    1397                 require_once(LIBS . 'Maintenance.php'); 
    13981367                $maintenance = new Maintenance(); 
    13991368                $maintenance->openCloseSite($this, $switch); 
     
    14061375        public function optimizeTables() 
    14071376        { 
    1408                 require_once(LIBS . 'Maintenance.php'); 
    14091377                $maintenance = new Maintenance(); 
    14101378                $maintenance->optimizeTables($this); 
     
    14201388        public function emptyTable($table_name = '', $msg = true) 
    14211389        { 
    1422                 require_once(LIBS . 'Maintenance.php'); 
    14231390                $maintenance = new Maintenance(); 
    14241391                $maintenance->emptyTable($this, $table_name, $msg); 
     
    14341401        public function dropTable($table_name = '', $msg = true) 
    14351402        { 
    1436                 require_once(LIBS . 'Maintenance.php'); 
    14371403                $maintenance = new Maintenance(); 
    14381404                $maintenance->dropTable($this, $table_name, $msg); 
     
    14481414        public function removeSettings($folder = '', $msg = true) 
    14491415        { 
    1450                 require_once(LIBS . 'Maintenance.php'); 
    14511416                $maintenance = new Maintenance(); 
    14521417                $maintenance->removeSettings($this, $folder, $msg); 
     
    14621427        public function deleteSettings($setting = '', $folder = '') 
    14631428        { 
    1464                 require_once(LIBS . 'Maintenance.php'); 
    14651429                $maintenance = new Maintenance(); 
    14661430                $maintenance->deleteSettings($this, $setting, $folder); 
     
    14761440        public function deleteFiles($dir = '') 
    14771441        { 
    1478                 require_once(LIBS . 'Maintenance.php'); 
    14791442                $maintenance = new Maintenance(); 
    14801443                $maintenance->deleteFiles($dir); 
     
    14901453        public function clearCache($folder = '', $msg = true) 
    14911454        { 
    1492                 require_once(LIBS . 'Maintenance.php'); 
    14931455                $maintenance = new Maintenance(); 
    14941456                $maintenance->clearCache($this, $folder, $msg); 
     
    15051467        public function getFiles($dir = '', $exclude = array()) 
    15061468        { 
    1507                 require_once(LIBS . 'Maintenance.php'); 
    15081469                $maintenance = new Maintenance(); 
    15091470                return $maintenance->getFiles($dir, $exclude); 
     
    15401501        public function smartCache($switch = 'off', $table = '', $timeout = 0, $html_sql = '', $label = '') 
    15411502        { 
    1542                 require_once(LIBS . 'Caching.php'); 
    15431503                $caching = new Caching(); 
    15441504                return $caching->smartCache($this, $switch, $table, $timeout, $html_sql, $label); 
     
    15581518        public function cacheHTML($timeout = 0, $html = '', $label = '') 
    15591519        { 
    1560                 require_once(LIBS . 'Caching.php'); 
    15611520                $caching = new Caching(); 
    15621521                return $caching->cacheHTML($this, $timeout, $html, $label); 
     
    15801539        public function isBlocked($type = '', $value = '', $operator = '=') 
    15811540        { 
    1582                 require_once(LIBS . 'Blocked.php'); 
    15831541                $blocked = new Blocked(); 
    15841542                return $blocked->isBlocked($this->db, $type, $value, $operator); 
     
    15961554        public function addToBlockedList($type = '', $value = 0, $msg = false) 
    15971555        { 
    1598                 require_once(LIBS . 'Blocked.php'); 
    15991556                $blocked = new Blocked(); 
    16001557                return $blocked->addToBlockedList($this, $type, $value, $msg); 
     
    16201577        public function includeLanguage($folder = '', $filename = '') 
    16211578        { 
    1622                 require_once(LIBS . 'Language.php'); 
    16231579                $language = new Language(); 
    16241580                $language->includeLanguage($this, $folder, $filename); 
     
    16361592        public function includeThemeLanguage($filename = 'main') 
    16371593        { 
    1638                 require_once(LIBS . 'Language.php'); 
    16391594                $language = new Language(); 
    16401595                $language->includeThemeLanguage($this, $filename); 
     
    18441799        public function sendTrackback() 
    18451800        { 
    1846                 require_once(LIBS . 'Trackback.php'); 
    18471801                $trackback = new Trackback(); 
    18481802                return $trackback->sendTrackback($this); 
     
    19171871        public function getCatId($cat_safe_name = '') 
    19181872        { 
    1919                 require_once(LIBS . 'Category.php'); 
    19201873                $category = new Category(); 
    19211874                return $category->getCatId($this, $cat_safe_name); 
     
    19321885        public function getCatName($cat_id = 0, $cat_safe_name = '') 
    19331886        { 
    1934                 require_once(LIBS . 'Category.php'); 
    19351887                $category = new Category(); 
    19361888                return $category->getCatName($this, $cat_id, $cat_safe_name); 
     
    19461898        public function getCatSafeName($cat_id = 0) 
    19471899        { 
    1948                 require_once(LIBS . 'Category.php'); 
    19491900                $category = new Category(); 
    19501901                return $category->getCatSafeName($this, $cat_id); 
     
    19601911        public function getCatParent($cat_id = 0) 
    19611912        { 
    1962                 require_once(LIBS . 'Category.php'); 
    19631913                $category = new Category(); 
    19641914                return $category->getCatParent($this, $cat_id); 
     
    19741924        public function getCatChildren($cat_parent_id = 0) 
    19751925        { 
    1976                 require_once(LIBS . 'Category.php'); 
    19771926                $category = new Category(); 
    19781927                return $category->getCatChildren($this, $cat_parent_id); 
     
    19871936        public function getCategories($args = array()) 
    19881937        { 
    1989                 require_once(LIBS . 'Category.php'); 
    19901938                $category = new Category(); 
    19911939                return $category->getCategories($this, $args); 
     
    20011949        public function getCatMeta($cat_id = 0) 
    20021950        { 
    2003                 require_once(LIBS . 'Category.php'); 
    20041951                $category = new Category(); 
    20051952                return $category->getCatMeta($this, $cat_id); 
     
    20141961         * @return bool 
    20151962         */ 
    2016         public function addNewCategory($parent = 0, $new_cat_name = '') 
    2017         { 
    2018                 require_once(LIBS . 'Category.php'); 
     1963        public function addCategory($parent = 0, $new_cat_name = '') 
     1964        { 
    20191965                $category = new Category(); 
    2020                 return $category->addNewCategory($this, $parent, $new_cat_name); 
     1966                return $category->addCategory($this, $parent, $new_cat_name); 
    20211967        } 
    20221968 
     
    20311977        public function rebuildTree($parent_id = 0, $left = 0) 
    20321978        { 
    2033                 require_once(LIBS . 'Category.php'); 
    20341979                $category = new Category(); 
    20351980                return $category->rebuildTree($this, $parent_id, $left); 
     
    20451990        function deleteCategory($delete_category = 0) 
    20461991        { 
    2047                 require_once(LIBS . 'Category.php'); 
    20481992                $category = new Category(); 
    20491993                return $category->deleteCategories($this, $delete_category); 
     
    20662010        function countComments($digits_only = true, $no_comments_text = '') 
    20672011        { 
    2068                 require_once(LIBS . 'Comment.php'); 
    20692012                $comment = new Comment(); 
    20702013                return $comment->countComments($this, $digits_only, $no_comments_text); 
     
    20802023        function countUserComments($user_id = 0) 
    20812024        { 
    2082                 require_once(LIBS . 'Comment.php'); 
    20832025                $comment = new Comment(); 
    20842026                return $comment->countUserComments($this, $user_id); 
     
    20942036        public function deleteComments($user_id)  
    20952037        { 
    2096                 require_once(LIBS . 'Comment.php'); 
    20972038                $comment = new Comment(); 
    20982039                return $comment->deleteComments($this, $user_id); 
     
    21082049        function getComment($comment_id = 0) 
    21092050        { 
    2110                 require_once(LIBS . 'Comment.php'); 
    21112051                $comment = new Comment(); 
    21122052                return $comment->getComment($this, $comment_id); 
     
    21212061        function readComment($comment_row = array()) 
    21222062        { 
    2123                 require_once(LIBS . 'Comment.php'); 
    21242063                $comment = new Comment(); 
    21252064                return $comment->readComment($this, $comment_row); 
     
    21422081        public function addWidget($plugin = '', $function = '', $args = '') 
    21432082        { 
    2144                 require_once(LIBS . 'Widget.php'); 
    21452083                $widget = new Widget(); 
    21462084                $widget->addWidget($this, $plugin, $function, $args); 
     
    21592097        public function getArrayWidgets($widget_name = '') 
    21602098        { 
    2161                 require_once(LIBS . 'Widget.php'); 
    21622099                $widget = new Widget(); 
    21632100                return $widget->getArrayWidgets($this, $widget_name); 
     
    21722109        public function deleteWidget($function) 
    21732110        { 
    2174                 require_once(LIBS . 'Widget.php'); 
    21752111                $widget = new Widget(); 
    21762112                $widget->deleteWidget($this, $function); 
     
    21852121        public function getPluginFromFunction($function) 
    21862122        { 
    2187                 require_once(LIBS . 'Widget.php'); 
    21882123                $widget = new Widget(); 
    21892124                return $widget->getPluginFromFunction($this, $function); 
     
    22102145        { 
    22112146                if (!is_object($this->email)) {  
    2212                         require_once(LIBS . 'EmailFunctions.php'); 
    22132147                        $this->email = new EmailFunctions(); 
    22142148                } 
     
    22382172        public function countFollowers($user_id = 0) 
    22392173        { 
    2240                 require_once(LIBS . 'Friends.php'); 
    22412174                $friends = new Friends(); 
    22422175                return $friends->countFriends($this, $user_id, 'follower'); 
     
    22522185        public function countFollowing($user_id = 0) 
    22532186        { 
    2254                 require_once(LIBS . 'Friends.php'); 
    22552187                $friends = new Friends(); 
    22562188                return $friends->countFriends($this, $user_id, 'following'); 
     
    22672199        public function getFollowers($user_id = 0, $return = 'array') 
    22682200        { 
    2269                 require_once(LIBS . 'Friends.php'); 
    22702201                $friends = new Friends(); 
    22712202                return $friends->getFriends($this, $user_id, 'follower', $return); 
     
    22822213        public function getFollowing($user_id = 0, $return = 'array') 
    22832214        { 
    2284                 require_once(LIBS . 'Friends.php'); 
    22852215                $friends = new Friends(); 
    22862216                return $friends->getFriends($this, $user_id, 'following', $return); 
     
    22962226        public function isFollower($user_id = 0) 
    22972227        { 
    2298                 require_once(LIBS . 'Friends.php'); 
    22992228                $friends = new Friends(); 
    23002229                return $friends->checkFriends($this, $user_id, 'follower'); 
     
    23102239        public function isFollowing($user_id = 0) 
    23112240        { 
    2312                 require_once(LIBS . 'Friends.php'); 
    23132241                $friends = new Friends(); 
    23142242                return $friends->checkFriends($this, $user_id, 'following'); 
     
    23242252        public function follow($user_id = 0) 
    23252253        { 
    2326                 require_once(LIBS . 'Friends.php'); 
    23272254                $friends = new Friends(); 
    23282255                return $friends->updateFriends($this, $user_id, 'follow'); 
     
    23382265        public function unfollow($user_id = 0) 
    23392266        { 
    2340                 require_once(LIBS . 'Friends.php'); 
    23412267                $friends = new Friends(); 
    23422268                return $friends->updateFriends($this, $user_id, 'unfollow'); 
     
    23612287        public function getLatestActivity($limit = 0, $userid = 0, $type = '') 
    23622288        { 
    2363                 require_once(LIBS . 'UserActivity.php'); 
    23642289                $activity = new UserActivity(); 
    23652290                return $activity->getLatestActivity($this, $limit, $userid, $type); 
     
    23752300        public function activityExists($args = array()) 
    23762301        { 
    2377                 require_once(LIBS . 'UserActivity.php'); 
    23782302                $activity = new UserActivity(); 
    23792303                return $activity->activityExists($this, $args); 
     
    23882312        public function insertActivity($args = array()) 
    23892313        { 
    2390                 require_once(LIBS . 'UserActivity.php'); 
    23912314                $activity = new UserActivity(); 
    23922315                return $activity->insertActivity($this, $args); 
     
    24012324        public function updateActivity($args = array()) 
    24022325        { 
    2403                 require_once(LIBS . 'UserActivity.php'); 
    24042326                $activity = new UserActivity(); 
    24052327                return $activity->updateActivity($this, $args); 
     
    24142336        public function removeActivity($args = array()) 
    24152337        { 
    2416                 require_once(LIBS . 'UserActivity.php'); 
    24172338                $activity = new UserActivity(); 
    24182339                return $activity->removeActivity($this, $args); 
     
    24362357        public function getMessages($box = 'inbox', $type = '') 
    24372358        { 
    2438                 require_once(LIBS . 'PrivateMessaging.php'); 
    24392359                $pm = new PrivateMessaging(); 
    24402360                return $pm->getMessages($this, $box, $type); 
     
    24502370        public function getMessage($message_id = 0) 
    24512371        { 
    2452                 require_once(LIBS . 'PrivateMessaging.php'); 
    24532372                $pm = new PrivateMessaging(); 
    24542373                return $pm->getMessage($this, $message_id); 
     
    24632382        public function markRead($message_id = 0) 
    24642383        { 
    2465                 require_once(LIBS . 'PrivateMessaging.php'); 
    24662384                $pm = new PrivateMessaging(); 
    24672385                $pm->markRead($this, $message_id); 
     
    24782396        public function deleteMessage($message_id = 0, $box = 'inbox') 
    24792397        { 
    2480                 require_once(LIBS . 'PrivateMessaging.php'); 
    24812398                $pm = new PrivateMessaging(); 
    24822399                $pm->deleteMessage($this, $message_id, $box); 
     
    24952412        public function sendMessage($to = '', $from = '', $subject = '', $body = '') 
    24962413        { 
    2497                 require_once(LIBS . 'PrivateMessaging.php'); 
    24982414                $pm = new PrivateMessaging(); 
    24992415                return $pm->sendMessage($this, $to, $from, $subject, $body); 
Note: See TracChangeset for help on using the changeset viewer.