b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _dataobjectcache.class.php

Documentation is available at _dataobjectcache.class.php

  1. <?php
  2. /**
  3.  * This file implements the DataObjectCache class.
  4.  *
  5.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  6.  * See also {@link http://sourceforge.net/projects/evocms/}.
  7.  *
  8.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  9.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10.  *  Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.
  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.  *  {@internal Open Source relicensing agreement:
  22.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  23.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  24.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  25.  *
  26.  *  PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license
  27.  *  PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project
  28.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  29.  *  }}}
  30.  *
  31.  * @package evocore
  32.  *
  33.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  34.  * @author blueyed: Daniel HAHLER.
  35.  * @author fplanque: Francois PLANQUE
  36.  *
  37.  * @version $Id: _dataobjectcache.class.php,v 1.23 2010/02/26 17:25:20 fplanque Exp $
  38.  */
  39. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  40.  
  41.  
  42. // DEBUG: (Turn switch on or off to log debug info for specified category)
  43. $GLOBALS['debug_dataobjects'false;
  44.  
  45.  
  46. load_class'_core/model/db/_sql.class.php''SQL' );
  47.  
  48.  
  49. /**
  50.  * Data Object Cache Class
  51.  *
  52.  * @todo dh> Provide iteration "interface"!
  53.  *
  54.  * @package evocore
  55.  * @version beta
  56.  */
  57. {
  58.     var $dbtablename;
  59.     var $dbprefix;
  60.     var $dbIDname;
  61.  
  62.     /**
  63.      * Class name of objects in this cache:
  64.      */
  65.     var $objtype;
  66.  
  67.     /**
  68.      * Object array by ID
  69.      */
  70.     var $cache = array();
  71.  
  72.     /**
  73.      * Copy of previous object array
  74.      * @see DataObjectCache::clear()
  75.      */
  76.     var $shadow_cache = NULL;
  77.  
  78.     /**
  79.      * NON indexed object array
  80.      * @var array of DataObjects
  81.      */
  82.     var $DataObject_array = array();
  83.  
  84.     /**
  85.      * Index of current iteration
  86.      * @see DataObjectCache::get_next()
  87.      */
  88.     var $current_idx = 0;
  89.  
  90.     var $load_all = false;
  91.     var $all_loaded = false;
  92.  
  93.  
  94.     var $name_field;
  95.     var $order_by;
  96.  
  97.     /**
  98.      * The text that gets used for the "None" option in the objects options list.
  99.      *
  100.      * This is especially useful for i18n, because there are several "None"s!
  101.      *
  102.      * @var string 
  103.      */
  104.     var $none_option_text;
  105.  
  106.     /**
  107.      * The value that gets used for the "None" option in the objects options list.
  108.      *
  109.      * @var mixed 
  110.      */
  111.     var $none_option_value;
  112.  
  113.     /**
  114.      * List of object IDs.
  115.      * @see get_ID_array()
  116.      * @access protected
  117.      */
  118.     var $ID_array;
  119.  
  120.  
  121.     /**
  122.      * Constructor
  123.      *
  124.      * @param string Name of DataObject class we are caching
  125.      * @param boolean true if it's OK to just load all items!
  126.      * @param string Name of table in database
  127.      * @param string Prefix of fields in the table
  128.      * @param string Name of the ID field (including prefix)
  129.      * @param string Name of the name field (including prefix)
  130.      * @param string field names or NULL to use name field
  131.      * @param string The text that gets used for the "None" option in the objects options list (Default: T_('None')).
  132.      * @param mixed  The value that gets used for the "None" option in the objects options list.
  133.      */
  134.     function DataObjectCache$objtype$load_all$tablename$prefix ''$dbIDname$name_field NULL$order_by ''$allow_none_text NULL$allow_none_value '' )
  135.     {
  136.         $this->objtype = $objtype;
  137.         $this->load_all = $load_all;
  138.         $this->dbtablename = $tablename;
  139.         $this->dbprefix = $prefix;
  140.         $this->dbIDname = $dbIDname;
  141.         $this->name_field = $name_field;
  142.         $this->none_option_value = $allow_none_value;
  143.  
  144.         ifempty$order_by ) )
  145.         {
  146.             ifempty$name_field ) )
  147.             {
  148.                 $this->order_by = $dbIDname;
  149.             }
  150.             else
  151.             {
  152.                 $this->order_by = $name_field;
  153.             }
  154.         }
  155.         else
  156.         {
  157.             $this->order_by = $order_by;
  158.         }
  159.  
  160.         ifisset($allow_none_text) )
  161.         {
  162.             $this->none_option_text = $allow_none_text;
  163.         }
  164.         else
  165.         {
  166.             $this->none_option_text = /* TRANS: the default value for option lists where "None" is allowed */ T_('None');
  167.         }
  168.     }
  169.  
  170.  
  171.     /**
  172.      * Instanciate a new object within this cache
  173.      */
  174.     function new_obj$row NULL )
  175.     {
  176.         $objtype $this->objtype;
  177.  
  178.         // Instantiate a custom object
  179.         $obj new $objtype$row )// COPY !!
  180.  
  181.         return $obj;
  182.     }
  183.  
  184.  
  185.     /**
  186.      * Load the cache **extensively**
  187.      */
  188.     function load_all()
  189.     {
  190.         /**
  191.          * @var DB
  192.          */
  193.         global $DB;
  194.         global $Debuglog;
  195.  
  196.         if$this->all_loaded )
  197.         // Already loaded
  198.             return false;
  199.         }
  200.  
  201.         $this->cleartrue );
  202.  
  203.         $Debuglog->addget_class($this).' - Loading <strong>'.$this->objtype.'(ALL)</strong> into cache''dataobjects' );
  204.  
  205.         $SQL $this->get_SQL_object('Loading '.$this->objtype.'(ALL) into cache');
  206.         $this->load_by_sql($SQL);
  207.  
  208.         $this->all_loaded = true;
  209.  
  210.         return true;
  211.     }
  212.  
  213.  
  214.     /**
  215.      * Load a list of objects into the cache.
  216.      *
  217.      * @param array List of IDs of objects to load
  218.      * @param boolean Invert list: Load all objects except those listed in the first parameter
  219.      */
  220.     function load_list$req_list$invert false )
  221.     {
  222.         global $Debuglog;
  223.  
  224.         if$invert )
  225.             $req_list array_diff($req_list$this->get_ID_array());
  226.  
  227.         ifempty$req_list ) )
  228.             return false;
  229.  
  230.         $SQL $this->get_SQL_object();
  231.         $SQL->WHERE_and($this->dbIDname.$invert ' NOT' '' ).' IN ('.implode(','$req_list).')');
  232.  
  233.         return $this->load_by_sql($SQL);
  234.     }
  235.  
  236.  
  237.     /**
  238.      * Load a set of objects into the cache.
  239.      *
  240.      * @param string SQL where expression
  241.      */
  242.     function load_where$sql_where )
  243.     {
  244.         $SQL $this->get_SQL_object();
  245.         $SQL->WHERE($sql_where);
  246.         return $this->load_by_sql($SQL);
  247.     }
  248.  
  249.  
  250.     /**
  251.      * Load a set of objects into the cache.
  252.      * Already loaded objects get excluded via "NOT IN()"
  253.      *
  254.      * @param SQL SQL object
  255.      * @return array List of DataObjects
  256.      */
  257.     function load_by_sql$SQL )
  258.     {
  259.         global $DB$Debuglog;
  260.  
  261.         ifis_a($Debuglog'Log') )
  262.         {
  263.             $sql_where trim($SQL->get_where(''));
  264.             ifempty($sql_where) )
  265.                 $sql_where 'ALL';
  266.             $Debuglog->add'Loading <strong>'.$this->objtype.'('.$sql_where.')</strong> into cache''dataobjects' );
  267.         }
  268.  
  269.         // Do not request already loaded objects
  270.         if$loaded_IDs $this->get_ID_array() )
  271.         {
  272.             $SQL->WHERE_and($this->dbIDname.' NOT IN ('.implode(','$loaded_IDs).')');
  273.         }
  274.         
  275.         return $this->instantiate_list($DB->get_results$SQL->get()OBJECT$SQL->title ));
  276.     }
  277.  
  278.  
  279.     /**
  280.      * Get base SQL object for queries.
  281.      * This gets used internally and is a convenient method for derived caches to override SELECT behaviour.
  282.      * @param string Optional query title
  283.      * @return SQL 
  284.      */
  285.     function get_SQL_object($title NULL)
  286.     {
  287.         $SQL new SQL$title );
  288.         $SQL->SELECT'*' );
  289.         $SQL->FROM$this->dbtablename );
  290.         $SQL->ORDER_BY$this->order_by );
  291.         return $SQL;
  292.     }
  293.  
  294.  
  295.     /**
  296.      * Get list of objects, referenced by list of IDs.
  297.      * @param array 
  298.      * @return array 
  299.      */
  300.     function get_list$ids )
  301.     {
  302.         $this->load_list($ids);
  303.         $r array();
  304.         foreach$ids as $id )
  305.         {
  306.             $r[$this->get_by_ID($id);
  307.         }
  308.         return $r;
  309.     }
  310.  
  311.  
  312.     /**
  313.      * Get an array of all (loaded) IDs.
  314.      *
  315.      * @return array 
  316.      */
  317.     function get_ID_array()
  318.     {
  319.         ifisset($this->ID_array) )
  320.         {
  321.             $this->ID_array = array();
  322.             foreach$this->cache as $obj )
  323.             {
  324.                 $this->ID_array[$obj->ID;
  325.             }
  326.         }
  327.  
  328.         return $this->ID_array;
  329.     }
  330.  
  331.  
  332.     /**
  333.      * Add a dataobject to the cache
  334.      */
  335.     function add$Obj )
  336.     {
  337.         global $Debuglog;
  338.  
  339.         ifis_null($Obj->ID) )    // value 0 is used by item preview
  340.         {
  341.             $Debuglog->add'No object to add!''dataobjects' );
  342.             return false;
  343.         }
  344.  
  345.         // fplanque: I don't want an extra (and expensive) comparison here. $this->cache[$Obj->ID] === $Obj.
  346.         // If you need this you're probably misusing the cache.
  347.         ifisset($this->cache[$Obj->ID]) )
  348.         {
  349.             $Debuglog->add$this->objtype.': Object with ID '.$Obj->ID.' is already cached''dataobjects' );
  350.             return false;
  351.         }
  352.  
  353.         // If the object is valid and not already cached:
  354.         // Add object to cache:
  355.         $this->cache[$Obj->ID$Obj;
  356.         // Add a reference in the object list:
  357.         $this->DataObject_array[$Obj;
  358.         // Add the ID to the list of IDs
  359.         $this->ID_array[$Obj->ID;
  360.  
  361.         return true;
  362.     }
  363.  
  364.  
  365.     /**
  366.      * Instantiate a DataObject from a table row and then cache it.
  367.      *
  368.      * @param Object Database row
  369.      * @return Object 
  370.      */
  371.     function instantiate$db_row )
  372.     {
  373.         ifis_null($db_row) )
  374.         {    // we can't access NULL as an object
  375.             return $db_row;
  376.         }
  377.  
  378.         // Get ID of the object we'ere preparing to instantiate...
  379.         $obj_ID $db_row->{$this->dbIDname};
  380.  
  381.         ifis_null($obj_ID) )    // value 0 is used for item preview
  382.         {
  383.             $Obj NULL;
  384.             return $Obj;
  385.         }
  386.  
  387.         ifisset$this->cache[$obj_ID) )
  388.         // Already in cache, do nothing!
  389.         }
  390.         elseifisset$this->shadow_cache[$obj_ID) )
  391.         {    // Already in shadow, recycle object:
  392.             // echo "adding shadow {$this->objtype} $obj_ID ";
  393.             $this->add$this->shadow_cache[$obj_ID);
  394.         }
  395.         else
  396.         // Not already cached, add new object:
  397.             // echo "adding new {$this->objtype} $obj_ID ";
  398.             $this->add$this->new_obj$db_row ) );
  399.         }
  400.  
  401.         return $this->cache[$obj_ID];
  402.     }
  403.  
  404.  
  405.     /**
  406.      * @access public
  407.      * @param array List of DB rows
  408.      * @return array List of DataObjects
  409.      */
  410.     function instantiate_list($db_rows)
  411.     {
  412.         $r array();
  413.         foreach$db_rows as $db_row )
  414.         {
  415.             $r[$this->instantiate($db_row);
  416.         }
  417.         return $r;
  418.     }
  419.  
  420.  
  421.     /**
  422.      * Clear the cache **extensively**
  423.      *
  424.      */
  425.     function clear$keep_shadow false )
  426.     {
  427.         if$keep_shadow )
  428.         {    // Keep copy of cache in case we try to re instantiate previous object:
  429.             $this->shadow_cache = $this->cache;
  430.         }
  431.         else
  432.         {
  433.             $this->shadow_cache = NULL;
  434.         }
  435.  
  436.         $this->cache = array();
  437.         $this->DataObject_array = array();
  438.         $this->all_loaded = false;
  439.         $this->ID_array = NULL;
  440.         $this->rewind();
  441.     }
  442.  
  443.  
  444.   /**
  445.      * This provides a simple interface for looping over the contents of the Cache.
  446.      *
  447.      * This should only be used for basic enumeration.
  448.      * If you need complex filtering of the cache contents, you should probably use a DataObjectList instead.
  449.      *
  450.      * @see DataObject::get_next()
  451.      *
  452.      * @return DataObject 
  453.      */
  454.     function get_first()
  455.     {
  456.         $this->load_all();
  457.  
  458.         $this->rewind();
  459.         return $this->get_next();
  460.     }
  461.  
  462.  
  463.     /**
  464.      * Rewind internal index to first position.
  465.      * @access public
  466.      */
  467.     function rewind()
  468.     {
  469.         $this->current_idx = 0;
  470.     }
  471.  
  472.  
  473.   /**
  474.      * This provides a simple interface for looping over the contents of the Cache.
  475.      *
  476.      * This should only be used for basic enumeration.
  477.      * If you need complex filtering of the cache contents, you should probably use a DataObjectList instead.
  478.      *
  479.      * @see DataObject::get_first()
  480.      *
  481.      * @return DataObject 
  482.      */
  483.     function get_next()
  484.     {
  485.         // echo 'getting idx:'.$this->current_idx;
  486.  
  487.         ifisset$this->DataObject_array[$this->current_idx) )
  488.         {
  489.             $this->rewind();
  490.             $r NULL;
  491.             return $r;
  492.         }
  493.  
  494.         return $this->DataObject_array[$this->current_idx++];
  495.     }
  496.  
  497.  
  498.     /**
  499.      * Get an object from cache by ID
  500.      *
  501.      * Load the cache if necessary (all at once if allowed).
  502.      *
  503.      * @param integer ID of object to load
  504.      * @param boolean true if function should die on error
  505.      * @param boolean true if function should die on empty/null
  506.      * @return DataObject reference on cached object or NULL if not found
  507.      */
  508.     function get_by_ID$req_ID$halt_on_error true$halt_on_empty true )
  509.     {
  510.         global $DB$Debuglog;
  511.  
  512.         ifempty($req_ID) )
  513.         {
  514.             if($halt_on_empty)
  515.             {
  516.                 debug_die"Requested $this->objtype from $this->dbtablename without ID!);
  517.             }
  518.             $r NULL;
  519.             return $r;
  520.         }
  521.  
  522.         if!empty$this->cache$req_ID ) )
  523.         // Already in cache
  524.             // $Debuglog->add( "Accessing $this->objtype($req_ID) from cache", 'dataobjects' );
  525.             return $this->cache$req_ID ];
  526.         }
  527.         elseif!$this->all_loaded )
  528.         // Not in cache, but not everything is loaded yet
  529.             if$this->load_all )
  530.             // It's ok to just load everything:
  531.                 $this->load_all();
  532.             }
  533.             else
  534.             // Load just the requested object:
  535.                 $Debuglog->add"Loading <strong>$this->objtype($req_ID)</strong> into cache"'dataobjects' );
  536.                 // Note: $req_ID MUST be an unsigned integer. This is how DataObject works.
  537.                 $SQL $this->get_SQL_object();
  538.                 $SQL->WHERE_and("$this->dbIDname = $req_ID");
  539.                 if$row $DB->get_row$SQL->get()OBJECT0'DataObjectCache::get_by_ID()' ) )
  540.                 {
  541.                     if$this->instantiate$row ) )
  542.                     {
  543.                         $Debuglog->add'Could not add() object to cache!''dataobjects' );
  544.                     }
  545.                 }
  546.                 else
  547.                 {
  548.                     $Debuglog->add'Could not get DataObject by ID. Query: '.$SQL->get()'dataobjects' );
  549.                 }
  550.             }
  551.         }
  552.  
  553.         ifempty$this->cache$req_ID ) )
  554.         // Requested object does not exist
  555.             // $Debuglog->add( 'failure', 'dataobjects' );
  556.             if$halt_on_error )
  557.             {
  558.                 debug_die"Requested $this->objtype does not exist!);
  559.             }
  560.             $r false;
  561.             return $r;
  562.         }
  563.  
  564.         return $this->cache$req_ID ];
  565.     }
  566.  
  567.  
  568.     /**
  569.      * Get an object from cache by name
  570.      *
  571.      * Load the cache if necessary (all at once if allowed).
  572.      *
  573.      * @param integer ID of object to load
  574.      * @param boolean true if function should die on error
  575.      * @param boolean true if function should die on empty/null
  576.      * @return reference on cached object
  577.      */
  578.     function get_by_name$req_name$halt_on_error true$halt_on_empty true )
  579.     {
  580.         global $DB$Debuglog;
  581.  
  582.         ifempty$this->name_field ) )
  583.         {
  584.             debug_die'DataObjectCache::get_by_name() : No name field to query on' );
  585.         }
  586.  
  587.         ifempty($req_name) )
  588.         {
  589.             if($halt_on_emptydebug_die"Requested $this->objtype from $this->dbtablename without name!)}
  590.             $r NULL;
  591.             return $r;
  592.         }
  593.  
  594.         // Load just the requested object:
  595.         $Debuglog->add"Loading <strong>$this->objtype($req_name)</strong>"'dataobjects' );
  596.         $SQL $this->get_SQL_object();
  597.         $SQL->WHERE_and($this->name_field.' = '.$DB->quote($req_name));
  598.  
  599.         if$db_row $DB->get_row$SQL->get()OBJECT0'DataObjectCache::get_by_name()' ) )
  600.         {
  601.             $resolved_ID $db_row->{$this->dbIDname};
  602.             $Debuglog->add'success; ID = '.$resolved_ID'dataobjects' );
  603.             ifisset$this->cache[$resolved_ID) )
  604.             {    // Object is not already in cache:
  605.                 $Debuglog->add'Adding to cache...''dataobjects' );
  606.                 //$Obj = new $this->objtype( $row ); // COPY !!
  607.                 //if( ! $this->add( $this->new_obj( $db_row ) ) )
  608.                 if$this->add$this->new_obj$db_row ) ) )
  609.                 {    // could not add
  610.                     $Debuglog->add'Could not add() object to cache!''dataobjects' );
  611.                 }
  612.             }
  613.             return $this->cache[$resolved_ID];
  614.         }
  615.         else
  616.         {
  617.             $Debuglog->add'Could not get DataObject by name.''dataobjects' );
  618.             if$halt_on_error )
  619.             {
  620.                 debug_die"Requested $this->objtype does not exist!);
  621.             }
  622.             $r NULL;
  623.             return $r;
  624.         }
  625.     }
  626.  
  627.  
  628.     /**
  629.      * Remove an object from cache by ID
  630.      *
  631.      * @param integer ID of object to remove
  632.      */
  633.     function remove_by_ID$req_ID )
  634.     {
  635.         # if( ($k = array_search($this->ID_array, $req_ID)) !== false )
  636.         #     unset($this->ID_array[$k]);
  637.         $this->ID_array = NULL;
  638.         unset$this->cache[$req_ID);
  639.     }
  640.  
  641.  
  642.     /**
  643.      * Delete an object from DB by ID.
  644.      *
  645.      * @param integer ID of object to delete
  646.      * @return boolean 
  647.      */
  648.     function dbdelete_by_ID$req_ID )
  649.     {
  650.         ifisset$this->cache[$req_ID) )
  651.         {
  652.             // Delete from db
  653.             $this->cache[$req_ID]->dbdelete();
  654.  
  655.             // Remove from cache
  656.             $this->remove_by_ID$req_ID );
  657.  
  658.             return true;
  659.         }
  660.         else
  661.         {
  662.             return false;
  663.         }
  664.     }
  665.  
  666.  
  667.     /**
  668.      * Returns form option list with cache contents
  669.      *
  670.      * Load the cache if necessary
  671.      *
  672.      * @param integer selected ID
  673.      * @param boolean provide a choice for "none" with ID ''
  674.      * @param string Callback method name
  675.      * @param array IDs to ignore.
  676.      * @return string 
  677.      */
  678.     function get_option_list$default 0$allow_none false$method 'get_name'$ignore_IDs array() )
  679.     {
  680.         if$this->all_loaded && $this->load_all )
  681.         // We have not loaded all items so far, but we're allowed to.
  682.             if empty$ignore_IDs ) )
  683.             {    // just load all items
  684.                 $this->load_all();
  685.             }
  686.             else
  687.             {    // only load those items not listed in $ignore_IDs
  688.                 $this->load_list$ignore_IDstrue );
  689.             }
  690.         }
  691.  
  692.         $r '';
  693.  
  694.         if$allow_none )
  695.         {
  696.             $r .= '<option value="'.$this->none_option_value.'"';
  697.             ifempty($default) ) $r .= ' selected="selected"';
  698.             $r .= '>'.format_to_output($this->none_option_text).'</option>'."\n";
  699.         }
  700.  
  701.         foreach$this->cache as $loop_Obj )
  702.         {
  703.             if in_array$loop_Obj->ID$ignore_IDs ) )
  704.             {    // Ignore this ID
  705.                 continue;
  706.             }
  707.  
  708.             $r .=  '<option value="'.$loop_Obj->ID.'"';
  709.             if$loop_Obj->ID == $default $r .= ' selected="selected"';
  710.             $r .= '>';
  711.             $r .= format_to_output$loop_Obj->$method()'htmlbody' );
  712.             $r .=  '</option>'."\n";
  713.         }
  714.  
  715.         return $r;
  716.     }
  717.  
  718.  
  719.     /**
  720.      * Returns option array with cache contents
  721.      *
  722.      * Load the cache if necessary
  723.      *
  724.      * @param string Callback method name
  725.      * @param array IDs to ignore.
  726.      * @return string 
  727.      */
  728.     function get_option_array$method 'get_name'$ignore_IDs array() )
  729.     {
  730.         if$this->all_loaded && $this->load_all )
  731.         // We have not loaded all items so far, but we're allowed to.
  732.             if empty$ignore_IDs ) )
  733.             {    // just load all items
  734.                 $this->load_all();
  735.             }
  736.             else
  737.             {    // only load those items not listed in $ignore_IDs
  738.                 $this->load_list$ignore_IDstrue );
  739.             }
  740.         }
  741.  
  742.         $r array();
  743.  
  744.         foreach$this->cache as $loop_Obj )
  745.         {
  746.             ifin_array$loop_Obj->ID$ignore_IDs ) )
  747.             {    // Ignore this ID
  748.                 continue;
  749.             }
  750.  
  751.             $r[$loop_Obj->ID$loop_Obj->$method();
  752.         }
  753.  
  754.         return $r;
  755.     }
  756.  
  757. }
  758.  
  759.  
  760. /*
  761.  * $Log: _dataobjectcache.class.php,v $
  762.  * Revision 1.23  2010/02/26 17:25:20  fplanque
  763.  * This one did look like a massive replace side-effect. Am I mistaken?
  764.  *
  765.  * Revision 1.22  2010/02/08 17:51:50  efy-yury
  766.  * copyright 2009 -> 2010
  767.  *
  768.  * Revision 1.21  2010/01/30 18:55:16  blueyed
  769.  * Fix "Assigning the return value of new by reference is deprecated" (PHP 5.3)
  770.  *
  771.  * Revision 1.20  2009/12/11 23:18:23  fplanque
  772.  * doc
  773.  *
  774.  * Revision 1.19  2009/12/06 22:20:29  blueyed
  775.  * DataObjectCache:
  776.  *  - Fix get_next to return first element on first call
  777.  *  - use SQL object internally, which makes it easy to extend
  778.  *  - cache ID_array (from get_ID_array)
  779.  *  - adds new methods: load_by_sql, load_where, get_SQL_object, get_list,
  780.  *    rewind
  781.  *  - Add test for get_next
  782.  *
  783.  * Revision 1.18  2009/12/01 20:53:39  blueyed
  784.  * indent
  785.  *
  786.  * Revision 1.17  2009/12/01 02:04:45  fplanque
  787.  * minor
  788.  *
  789.  * Revision 1.16  2009/11/30 22:59:32  blueyed
  790.  * DataObjectCache: Add instantiate_list. load_list: remove already loaded objects from SQL query.
  791.  *
  792.  * Revision 1.15  2009/11/30 00:22:04  fplanque
  793.  * clean up debug info
  794.  * show more timers in view of block caching
  795.  *
  796.  * Revision 1.14  2009/10/19 21:50:36  blueyed
  797.  * doc
  798.  *
  799.  * Revision 1.13  2009/09/20 13:46:47  blueyed
  800.  * doc
  801.  *
  802.  * Revision 1.12  2009/09/05 18:17:40  tblue246
  803.  * DataObjectCache/BlogCache::get_option_list(): Back again... Allow custom value for "None" option and use 0 for BlogCache.
  804.  *
  805.  * Revision 1.10  2009/09/03 15:51:51  tblue246
  806.  * Doc, "refix", use "0" instead of an empty string for the "No blog" option.
  807.  *
  808.  * Revision 1.9  2009/03/15 20:35:18  fplanque
  809.  * Universal Item List proof of concept
  810.  *
  811.  * Revision 1.8  2009/03/08 23:57:40  fplanque
  812.  * 2009
  813.  *
  814.  * Revision 1.7  2009/01/25 14:05:08  tblue246
  815.  * DataObjectCache::load_list(): Allow loading all objects except those given
  816.  *
  817.  * Revision 1.6  2009/01/23 22:08:12  tblue246
  818.  * - Filter reserved post types from dropdown box on the post form (expert tab).
  819.  * - Indent/doc fixes
  820.  * - Do not check whether a post title is required when only e. g. switching tabs.
  821.  *
  822.  * Revision 1.5  2008/12/22 01:56:54  fplanque
  823.  * minor
  824.  *
  825.  * Revision 1.4  2008/09/28 05:05:07  fplanque
  826.  * minor
  827.  *
  828.  * Revision 1.3  2008/09/26 19:02:30  tblue246
  829.  * Do not instantiate NULL "objects" in the cache (fixes http://forums.b2evolution.net/viewtopic.php?t=15973)
  830.  *
  831.  * Revision 1.2  2008/01/21 09:35:24  fplanque
  832.  * (c) 2008
  833.  *
  834.  * Revision 1.1  2007/06/25 10:58:56  fplanque
  835.  * MODULES (refactored MVC)
  836.  *
  837.  * Revision 1.31  2007/05/09 01:00:39  fplanque
  838.  * minor
  839.  *
  840.  * Revision 1.30  2007/04/26 00:11:09  fplanque
  841.  * (c) 2007
  842.  *
  843.  * Revision 1.29  2007/02/12 15:42:40  fplanque
  844.  * public interface for looping over a cache
  845.  *
  846.  * Revision 1.28  2006/12/29 01:10:06  fplanque
  847.  * basic skin registering
  848.  *
  849.  * Revision 1.27  2006/12/24 01:09:55  fplanque
  850.  * Rollback. Non geeks do not know how to use select multiple.
  851.  * Checkbox lists should be used instead.
  852.  * The core does. There is not reason for plugins not to do so also.
  853.  *
  854.  * Revision 1.24  2006/12/12 02:53:56  fplanque
  855.  * Activated new item/comments controllers + new editing navigation
  856.  * Some things are unfinished yet. Other things may need more testing.
  857.  *
  858.  * Revision 1.23  2006/12/05 01:35:27  blueyed
  859.  * Hooray for less complexity and the 8th param for DataObjectCache()
  860.  *
  861.  * Revision 1.22  2006/12/05 00:59:46  fplanque
  862.  * doc
  863.  *
  864.  * Revision 1.21  2006/12/05 00:34:39  blueyed
  865.  * Implemented custom "None" option text in DataObjectCache; Added for $ItemStatusCache, $GroupCache, UserCache and BlogCache; Added custom text for Item::priority_options()
  866.  *
  867.  * Revision 1.20  2006/11/24 18:27:24  blueyed
  868.  * Fixed link to b2evo CVS browsing interface in file docblocks
  869.  *
  870.  * Revision 1.19  2006/11/10 20:14:42  blueyed
  871.  * TODO
  872.  *
  873.  * Revision 1.18  2006/10/13 09:58:53  blueyed
  874.  * Removed bogus unset()
  875.  */
  876. ?>

Documentation generated on Sat, 06 Mar 2010 04:07:51 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).