Example #1
0
 /**
  * Returns array of titles for given objects
  *
  * @static 
  * @access public
  * @param array $object_id
  * @param string $object_group
  * @return array
  */
 function getTitles($object_ids, $object_group = 'com_content', $language = null)
 {
     static $cache = null;
     $count = count($object_ids);
     $titles = array();
     if ($count) {
         if (!is_array($cache)) {
             $cache = array();
         }
         $cache_key = md5($object_group . '_' . md5(serialize($object_ids)) . '_getTitles');
         if (isset($cache[$cache_key])) {
             return $cache[$cache_key];
         }
         ob_start();
         include_once JCOMMENTS_BASE . DS . 'plugins' . DS . $object_group . '.plugin.php';
         ob_end_clean();
         $class = 'jc_' . $object_group;
         if (class_exists($class)) {
             if (is_callable(array($class, 'getTitles'))) {
                 $titles = call_user_func(array($class, 'getTitles'), $object_ids, $language);
             } else {
                 if (is_callable(array($class, 'getObjectTitle'))) {
                     foreach ($object_ids as $object_id) {
                         $titles[$object_id] = JCommentsObjectHelper::_getObjectVar($object_id, $object_group, $language, 'getObjectTitle');
                     }
                 }
             }
             $cache[$cache_key] = $titles;
         }
     }
     return $titles;
 }