?(.*?)\])", $string, $links); $links = isset($links[0]) ? $links[0] : FALSE; if ($links) { foreach ($links as $link) { $idAndLink = mb_substr($link, 2, -1); $idAndLink = explode('>', $idAndLink); $linkId = $idAndLink[0]; $linkName = isset($idAndLink[1])?$idAndLink[1]:''; if ($linkId) { $linkPoint = Point::model()->getByPK($linkId); if ($linkPoint->id) { $linkPoint->name = str_replace('"', 'ʺ', $linkPoint->name); $string = str_replace($link, ''.$linkName.'', $string); } } } } return $string; } public static function buildOG($point) { $og = array(); $og['title'] = str_replace('"', 'ʺ', $point->name) . ' [wikipoints.ru]'; $point->description = str_replace('"', 'ʺ', $point->description); $og['description'] = mb_substr($point->description, 0, 97, 'UTF-8').'...'; $og['site_name'] = 'WikiPoints: Лучшие выходные - это выходные в путешествии!'; $og['type'] = 'website'; $og['url'] = 'http://wikipoints.ru/?point=' . $point->id; $og['image'] = $point->getImg('middle'); return $og; } }