3 if (!defined('AT_INCLUDE_PATH')) { exit; }
4 include_once(AT_INCLUDE_PATH.'../mods/_standard/social/lib/friends.inc.php');
6 function substring($str, $length)
8 preg_match_all("|(.*)((<[^>]+>)(.*)(</[^>]+>))|U", $str, $matches, PREG_SET_ORDER);
13 if (is_array($matches))
16 foreach ($matches as $i => $tag)
18 if (($curr_len + strlen($tag[1])) > $length)
20 $rtn .= substr($tag[1], 0, ($length - $curr_len)) . ' ...';
26 $curr_len += strlen($tag[1]);
29 if (($curr_len + strlen($tag[4])) > $length)
31 $rtn .= $tag[3].substr($tag[4], 0, ($length - $curr_len)).'...'.$tag[5];
37 $curr_len += strlen($tag[4]);
41 $pos_after_last_match = strpos($str, $tag[0]) + strlen($tag[0]);
42 $str_after_last_match = substr($str, $pos_after_last_match);
44 if (($curr_len + strlen($str_after_last_match)) > $length)
45 $rtn .= substr($str_after_last_match, 0, ($length - $curr_len)).' ...';
50 $rtn = substr($str, 0, $length);
57 $link_limit = 3; //Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
60 $actvity_obj = new Activity();
61 $activities = $actvity_obj->getFriendsActivities($_SESSION['member_id']);
63 if (is_array($activities)) {
64 foreach ($activities as $i => $activity) {
65 if ($cnt >= $link_limit) break;
68 $link_title = printSocialName($activity['member_id']).' '. $activity['title'];
70 $list[] = '<span title="'.strip_tags($link_title).'">'.substring($link_title, SUBLINK_TEXT_LEN)."</span>";