Пример #1
0
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // We don't want to show the link to the same user
     if ($my->id == $bloggerid) {
         return;
     }
     if ($config->get('main_jomsocial_friends')) {
         $file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
         $file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'friends.php';
         jimport('joomla.filesystem.file');
         if (JFile::exists($file_core) && JFile::exists($file_messaging)) {
             require_once $file_core;
             require_once $file_messaging;
             $user = CFactory::getUser();
             $model = CFactory::getModel('Friends');
             $friends = $model->getFriendIds($bloggerid);
             if (!in_array($my->id, $friends)) {
                 CFriends::load();
                 $html = '<a href="javascript:void(0);" onclick="' . CFriends::getPopup($bloggerid) . '" class="author-friend"><span>' . JText::_('COM_EASYBLOG_ADD_FRIEND') . '</span></a>';
             }
         }
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_friends') && $easysocial->exists()) {
         $user = Foundry::user($bloggerid);
         // Check if the user is friends with the current viewer.
         if ($user->isFriends($my->id)) {
             return;
         }
         $easysocial->init();
         $theme = new CodeThemes();
         $theme->set('id', $bloggerid);
         $html = $theme->fetch('easysocial.friends.php');
     }
     return $html;
 }
Пример #2
0
 /**
  * Get link to popup window
  */
 public function getPopup($id)
 {
     CFriends::load();
     return "joms.friends.connect('{$id}')";
 }