~edb/quam-plures/item_show_attachments

« back to all changes in this revision

Viewing changes to blogs/inc/_core/_class4.funcs.php

  • Committer: fplanque
  • Date: 2007-06-25 08:58:47 UTC
  • Revision ID: cvs-1:fplanque-20070625085847-ppxlq1z5v1quf1zi
MODULES (refactored MVC)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Function for handling Classes in PHP 4.
 
4
 *
 
5
 * Note: in PHP 5, another file should be included. It shoudl handle clone for example.
 
6
 *
 
7
 * This file is part of the evoCore framework - {@link http://evocore.net/}
 
8
 * See also {@link http://sourceforge.net/projects/evocms/}.
 
9
 *
 
10
 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
 
11
 *
 
12
 * {@internal License choice
 
13
 * - If you have received this file as part of a package, please find the license.txt file in
 
14
 *   the same folder or the closest folder above for complete license terms.
 
15
 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
 
16
 *   then you must choose one of the following licenses before using the file:
 
17
 *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
 
18
 *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
 
19
 * }}
 
20
 *
 
21
 * @package evocore
 
22
 *
 
23
 * @author fplanque: Francois PLANQUE
 
24
 *
 
25
 * @version $Id: _class4.funcs.php,v 1.1 2007/06/25 10:58:52 fplanque Exp $
 
26
 */
 
27
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
 
28
 
 
29
 
 
30
/**
 
31
 * Load class file
 
32
 */
 
33
function load_class( $class_path, $require = true )
 
34
{
 
35
        global $inc_path;
 
36
        if( ! $require && ! file_exists( $inc_path.$class_path ) )
 
37
        {
 
38
                return false;
 
39
        }
 
40
        require_once $inc_path.$class_path;
 
41
        return true;
 
42
}
 
43
 
 
44
 
 
45
/**
 
46
 * Load functions file
 
47
 */
 
48
function load_funcs( $funcs_path )
 
49
{
 
50
        global $inc_path;
 
51
        require_once $inc_path.$funcs_path;
 
52
}
 
53
 
 
54
 
 
55
/**
 
56
 * @todo fp> split into 1 function per case. (typed @return values)
 
57
 *
 
58
 * @return DataObjectCache
 
59
 */
 
60
function & get_Cache( $objectName )
 
61
{
 
62
        global $Plugins;
 
63
        global $$objectName;
 
64
 
 
65
        if( isset( $$objectName ) )
 
66
        {       // Cache already exists:
 
67
                return $$objectName;
 
68
        }
 
69
 
 
70
        switch( $objectName )
 
71
        {
 
72
                case 'BlogCache':
 
73
                        load_class( 'collections/model/_blogcache.class.php' );
 
74
                        $BlogCache = new BlogCache(); // COPY (FUNC)
 
75
                        return $BlogCache;
 
76
 
 
77
                case 'ChapterCache':
 
78
      load_class( 'chapters/model/_chaptercache.class.php' );
 
79
                        $ChapterCache = new ChapterCache(); // COPY (FUNC)
 
80
                        return $ChapterCache;
 
81
 
 
82
                case 'FileCache':
 
83
                        load_class( 'files/model/_filecache.class.php' );
 
84
                        $FileCache = new FileCache(); // COPY (FUNC)
 
85
                        return $FileCache;
 
86
 
 
87
                case 'FileRootCache':
 
88
                        load_class( 'files/model/_filerootcache.class.php' );
 
89
                        $Plugins->get_object_from_cacheplugin_or_create( 'FileRootCache' );
 
90
                        return $FileRootCache;
 
91
 
 
92
                case 'FiletypeCache':
 
93
                        load_class( 'files/model/_filetypecache.class.php' );
 
94
                        $Plugins->get_object_from_cacheplugin_or_create( 'FiletypeCache' );
 
95
                        return $FiletypeCache;
 
96
 
 
97
                case 'GroupCache':
 
98
                        $Plugins->get_object_from_cacheplugin_or_create( 'GroupCache', 'new DataObjectCache( \'Group\', true, \'T_groups\', \'grp_\', \'grp_ID\', \'grp_name\', \'\', T_(\'No group\') )' );
 
99
                        return $GroupCache;
 
100
 
 
101
                case 'ItemCacheLight';
 
102
                        $ItemCacheLight = new DataObjectCache( 'ItemLight', false, 'T_items__item', 'post_', 'post_ID' ); // COPY (FUNC)
 
103
                        return $ItemCacheLight;
 
104
 
 
105
                case 'ItemCache';
 
106
                        load_class( 'items/model/_itemcache.class.php' );
 
107
                        $ItemCache = new ItemCache(); // COPY (FUNC)
 
108
                        return $ItemCache;
 
109
 
 
110
                case 'ItemStatusCache':
 
111
                        $Plugins->get_object_from_cacheplugin_or_create( 'ItemStatusCache', 'new GenericCache( \'GenericElement\', true, \'T_items__status\', \'pst_\', \'pst_ID\', NULL, \'\', T_(\'No status\') )' );
 
112
                        return $ItemStatusCache;
 
113
 
 
114
                case 'ItemTypeCache':
 
115
                        load_class( 'items/model/_itemtypecache.class.php' );
 
116
                        $Plugins->get_object_from_cacheplugin_or_create( 'ItemTypeCache', 'new ItemTypeCache( \'ptyp_\', \'ptyp_ID\' )' );
 
117
                        return $ItemTypeCache;
 
118
 
 
119
                case 'LinkCache':
 
120
                        load_class( 'items/model/_linkcache.class.php' );
 
121
                        $LinkCache = new LinkCache(); // COPY (FUNC)
 
122
                        return $LinkCache;
 
123
 
 
124
                case 'Plugins_admin':
 
125
                        load_class('plugins/model/_plugins_admin.class.php');
 
126
                        $Plugins_admin = new Plugins_admin(); // COPY (FUNC)
 
127
                        return $Plugins_admin;
 
128
 
 
129
                case 'SkinCache':
 
130
                        load_class( 'skins/model/_skincache.class.php' );
 
131
                        $SkinCache = new SkinCache(); // COPY (FUNC)
 
132
                        return $SkinCache;
 
133
 
 
134
                case 'UserCache':
 
135
                        load_class( 'users/model/_usercache.class.php' );
 
136
                        $UserCache = new UserCache(); // COPY (FUNC)
 
137
                        return $UserCache;
 
138
 
 
139
                case 'WidgetCache':
 
140
                        load_class( 'widgets/model/_widgetcache.class.php' );
 
141
                        $WidgetCache = new WidgetCache(); // COPY (FUNC)
 
142
                        return $WidgetCache;
 
143
 
 
144
                default:
 
145
                        debug_die( 'getCache(): Unknown Cache type:'.$objectName );
 
146
        }
 
147
}
 
148
 
 
149
/*
 
150
 * $Log: _class4.funcs.php,v $
 
151
 * Revision 1.1  2007/06/25 10:58:52  fplanque
 
152
 * MODULES (refactored MVC)
 
153
 *
 
154
 * Revision 1.19  2007/06/20 14:25:00  fplanque
 
155
 * fixes
 
156
 *
 
157
 * Revision 1.18  2007/06/18 21:25:48  fplanque
 
158
 * one class per core widget
 
159
 *
 
160
 * Revision 1.17  2007/05/14 02:43:05  fplanque
 
161
 * Started renaming tables. There probably won't be a better time than 2.0.
 
162
 *
 
163
 * Revision 1.16  2007/04/26 00:11:07  fplanque
 
164
 * (c) 2007
 
165
 *
 
166
 * Revision 1.15  2007/03/18 03:43:19  fplanque
 
167
 * EXPERIMENTAL
 
168
 * Splitting Item/ItemLight and ItemList/ItemListLight
 
169
 * Goal: Handle Items with less footprint than with their full content
 
170
 * (will be even worse with multiple languages/revisions per Item)
 
171
 *
 
172
 * Revision 1.14  2007/01/11 20:44:19  fplanque
 
173
 * skin containers proof of concept
 
174
 * (no params handling yet though)
 
175
 *
 
176
 * Revision 1.13  2007/01/11 02:57:25  fplanque
 
177
 * implemented removing widgets from containers
 
178
 *
 
179
 * Revision 1.12  2006/12/29 01:10:06  fplanque
 
180
 * basic skin registering
 
181
 *
 
182
 * Revision 1.11  2006/12/07 20:03:32  fplanque
 
183
 * Woohoo! File editing... means all skin editing.
 
184
 *
 
185
 * Revision 1.10  2006/12/05 01:35:27  blueyed
 
186
 * Hooray for less complexity and the 8th param for DataObjectCache()
 
187
 *
 
188
 * Revision 1.9  2006/12/05 00:59:46  fplanque
 
189
 * doc
 
190
 *
 
191
 * Revision 1.8  2006/12/05 00:34:39  blueyed
 
192
 * Implemented custom "None" option text in DataObjectCache; Added for $ItemStatusCache, $GroupCache, UserCache and BlogCache; Added custom text for Item::priority_options()
 
193
 *
 
194
 * Revision 1.7  2006/12/01 20:55:45  blueyed
 
195
 * Fixed load_Class() for $Plugins_admin
 
196
 *
 
197
 * Revision 1.6  2006/12/01 02:01:38  blueyed
 
198
 * Added "Plugins_admin" to get_Cache() + doc
 
199
 *
 
200
 * Revision 1.5  2006/11/30 22:34:15  fplanque
 
201
 * bleh
 
202
 *
 
203
 * Revision 1.4  2006/11/24 18:27:27  blueyed
 
204
 * Fixed link to b2evo CVS browsing interface in file docblocks
 
205
 */
 
206
?>
 
 
b'\\ No newline at end of file'