[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/_core/ -> _class4.funcs.php (source)

   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.3 2007/11/04 21:22:56 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.3  2007/11/04 21:22:56  fplanque

 152   * version bump

 153   *

 154   * Revision 1.1  2007/06/25 10:58:52  fplanque

 155   * MODULES (refactored MVC)

 156   *

 157   * Revision 1.19  2007/06/20 14:25:00  fplanque

 158   * fixes

 159   *

 160   * Revision 1.18  2007/06/18 21:25:48  fplanque

 161   * one class per core widget

 162   *

 163   * Revision 1.17  2007/05/14 02:43:05  fplanque

 164   * Started renaming tables. There probably won't be a better time than 2.0.

 165   *

 166   * Revision 1.16  2007/04/26 00:11:07  fplanque

 167   * (c) 2007

 168   *

 169   * Revision 1.15  2007/03/18 03:43:19  fplanque

 170   * EXPERIMENTAL

 171   * Splitting Item/ItemLight and ItemList/ItemListLight

 172   * Goal: Handle Items with less footprint than with their full content

 173   * (will be even worse with multiple languages/revisions per Item)

 174   *

 175   * Revision 1.14  2007/01/11 20:44:19  fplanque

 176   * skin containers proof of concept

 177   * (no params handling yet though)

 178   *

 179   * Revision 1.13  2007/01/11 02:57:25  fplanque

 180   * implemented removing widgets from containers

 181   *

 182   * Revision 1.12  2006/12/29 01:10:06  fplanque

 183   * basic skin registering

 184   *

 185   * Revision 1.11  2006/12/07 20:03:32  fplanque

 186   * Woohoo! File editing... means all skin editing.

 187   *

 188   * Revision 1.10  2006/12/05 01:35:27  blueyed

 189   * Hooray for less complexity and the 8th param for DataObjectCache()

 190   *

 191   * Revision 1.9  2006/12/05 00:59:46  fplanque

 192   * doc

 193   *

 194   * Revision 1.8  2006/12/05 00:34:39  blueyed

 195   * Implemented custom "None" option text in DataObjectCache; Added for $ItemStatusCache, $GroupCache, UserCache and BlogCache; Added custom text for Item::priority_options()

 196   *

 197   * Revision 1.7  2006/12/01 20:55:45  blueyed

 198   * Fixed load_Class() for $Plugins_admin

 199   *

 200   * Revision 1.6  2006/12/01 02:01:38  blueyed

 201   * Added "Plugins_admin" to get_Cache() + doc

 202   *

 203   * Revision 1.5  2006/11/30 22:34:15  fplanque

 204   * bleh

 205   *

 206   * Revision 1.4  2006/11/24 18:27:27  blueyed

 207   * Fixed link to b2evo CVS browsing interface in file docblocks

 208   */
 209  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics