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);
9 // debug($matches);exit;
12 if (is_array($matches))
15 foreach ($matches as $i => $tag)
17 if (($curr_len + strlen($tag[1])) > $length)
19 $rtn .= substr($tag[1], 0, ($length - $curr_len)) . ' ...';
25 $curr_len += strlen($tag[1]);
28 if (($curr_len + strlen($tag[4])) > $length)
30 $rtn .= $tag[3].substr($tag[4], 0, ($length - $curr_len)).'...'.$tag[5];
36 $curr_len += strlen($tag[4]);
40 $pos_after_last_match = strpos($str, $tag[0]) + strlen($tag[0]);
41 $str_after_last_match = substr($str, $pos_after_last_match);
43 if (($curr_len + strlen($str_after_last_match)) > $length)
44 $rtn .= substr($str_after_last_match, 0, ($length - $curr_len)).' ...';
49 $rtn = substr($str, 0, $length);
56 $link_limit = 3; //Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
59 $actvity_obj = new Activity();
60 $activities = $actvity_obj->getFriendsActivities($_SESSION['member_id']);
62 if (is_array($activities)) {
63 foreach ($activities as $i => $activity) {
64 if ($cnt >= $link_limit) break;
67 $link_title = printSocialName($activity['member_id']).' '. $activity['title'];
69 $list[] = '<span title="'.strip_tags($link_title).'">'.substring($link_title, SUBLINK_TEXT_LEN)."</span>";