/** * Return the HTML formatted activity content */ static function getActivityContent($act) { $cache = CFactory::getFastCache(); $cacheid = __FILE__ . __LINE__ . serialize(func_get_args()); if ($data = $cache->get($cacheid)) { return $data; } // Return empty content or content with old, invalid data // In some old version, some content might have 'This is the body' if ($act->content == 'This is the body') { return ''; } $html = $act->content; // For known core, apps, we can simply call the content command switch ($act->app) { case 'videos': CFactory::load('libraries', 'videos'); $html = CVideos::getActivityContentHTML($act); break; case 'photos': CFactory::load('libraries', 'photos'); $html = CPhotos::getActivityContentHTML($act); break; case 'events': CFactory::load('libraries', 'events'); $html = CEvents::getActivityContentHTML($act); break; case 'groups.wall': case 'groups': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); break; case 'groups.discussion.reply': case 'groups.discussion': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); break; case 'groups.bulletin': CFactory::load('libraries', 'groups'); $html = CGroups::getActivityContentHTML($act); case 'system': CFactory::load('libraries', 'adminstreams'); $html = CAdminstreams::getActivityContentHTML($act); break; case 'walls': // If a wall does not have any content, do not // display the summary if ($act->app == 'walls' && $act->cid == 0) { $html = ''; return $html; } if ($act->cid != 0) { CFactory::load('libraries', 'wall'); $html = CWall::getActivityContentHTML($act); } break; default: // for other unknown apps, we include the plugin see if it is is callable // we call the onActivityContentDisplay(); CFactory::load('libraries', 'apps'); $apps =& CAppPlugins::getInstance(); $plugin =& $apps->get($act->app); $method = 'onActivityContentDisplay'; if (is_callable(array($plugin, $method))) { $args = array(); $args[] = $act; $html = call_user_func_array(array($plugin, $method), $args); } else { $html = $act->content; } } $cache->store($html, $cacheid, array('activities')); return $html; }