function onAfterVote($poll, $option_id) { $user =& JFactory::getUser(); $api = JPATH_ROOT . '/components/com_community/api.php'; if ($this->params->get('points', '0') == '1' && file_exists($api)) { require_once $api; JSCommunityApi::increaseKarma($user->id, $this->params->get('points_value', '0')); } if ($this->params->get('activity', '0') == '1' && file_exists($api)) { require_once $api; $icon = 'media/acepolls/images/acepolls.png'; $link = JRoute::_('index.php?option=com_acepolls&view=poll&id=' . $poll->id . ":" . $poll->alias . self::getItemid($poll->id)); $text = JText::_('COM_ACEPOLLS_ACTIVITY_TEXT') . ' <a href="' . $link . '">' . $poll->title . '</a>'; $capi = new JSCommunityApi(); $capi->registerActivity(0, $text, $user->id, $icon, 'user', null, 'com_acepolls', '', 'Polls'); } }
public function addActivity($blog, $new = false) { $config = EasyBlogHelper::getConfig(); // We do not want to add activities if new blog activity is disabled. if ($new && !$config->get('integrations_mighty_activity_new_blog')) { return false; } // We do not want to add activities if update blog activity is disabled. if (!$new && !$config->get('integrations_mighty_activity_update_blog')) { return false; } $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'api.php'; if (!JFile::exists($file)) { return false; } require_once $file; $date = EasyBlogHelper::getDate(); $priority = 0; $title = $blog->title; $content = ''; if ($config->get('integrations_mighty_submit_content')) { $requireVerification = false; if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) { $row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $blog->title); $requireVerification = true; } if ($requireVerification && !EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) { $theme = new CodeThemes(); $theme->set('id', $blog->id); $theme->set('return', base64_encode($this->getBlogLink($blog))); $output = $theme->fetch('blog.protected.php'); } else { $content = $blog->intro . $blog->content; $content = EasyBlogHelper::getHelper('Videos')->strip($content); $pattern = '#<img[^>]*>#i'; preg_match($pattern, $content, $matches); // Remove all html tags from the content as we want to chop it down. $content = strip_tags($content); $content = JString::substr($content, 0, $config->get('integrations_mighty_blogs_length', 250)) . ' ...'; $output = '<div style="background: #f4f4f4;border: 1px solid #eeee;border-radius: 5px;padding: 5px;margin-top:5px;">'; if ($matches) { $matches[0] = JString::str_ireplace('img ', 'img style="margin: 0 5px 5px 0;float: left; height: auto; width: 120px !important;"', $matches[0]); $output .= $matches[0] . $content . '<div style="clear: both;"></div>'; } else { $output .= $content; } $output .= '<div style="text-align: right;"><a href="' . $this->getBlogLink($blog) . '">' . JText::_('COM_EASYBLOG_CONTINUE_READING') . '</a></div>'; $output .= '</div>'; } } if ($new) { $title = JText::sprintf('COM_EASYBLOG_MIGHTY_ACTIVITY_BLOG', $this->getBlogLink($blog), $this->getBlogTitle($blog)); } else { $title = JText::sprintf('COM_EASYBLOG_MIGHTY_ACTIVITY_BLOG_UPDATE', $this->getBlogLink($blog), $this->getBlogTitle($blog)); } if ($config->get('integrations_mighty_show_category')) { $title .= JText::sprintf('COM_EASYBLOG_MIGHTY_ACTIVITY_IN_CATEGORY', $this->getCategoryLink($blog), $this->getCategoryTitle($blog)); } JSCommunityApi::registerActivity(0, $title . $output, $blog->created_by, null, 'user', null, 'com_easyblog', null, JText::_('COM_EASYBLOG_MIGHTYTOUCH_FILTER_BLOGS')); return true; }
function streamActivity($action, $obj) { global $option; $app =& JFactory::getApplication(); $cwConfig = $app->getUserState(SESSION_CONFIG); $user =& JFactory::getUser(); $menu =& JSite::getMenu(); $mnuitems = $menu->getItems('link', 'index.php?option=' . $option . '&view=crosswords'); $itemid = isset($mnuitems[0]) ? '&Itemid=' . $mnuitems[0]->id : ''; if (strcasecmp($cwConfig[ACTIVITY_STREAM_TYPE], COMPONENT_JOMSOCIAL) == 0) { $API = JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php'; if (file_exists($API)) { include_once $API; $act = new stdClass(); $act->cmd = 'wall.write'; $act->actor = $user->id; $act->target = 0; // no target $act->content = ''; $act->app = 'wall'; $act->cid = 0; switch ($action) { case 1: // New question $act->title = JText::_('{actor} ' . JText::_('TXT_SUBMITTED_CROSSWORD_QUESTION')); break; case 2: // Solved crossword $text = JText::_('TXT_SOLVED_CROSSWORD'); $link = JRoute::_('index.php?option=' . $option . '&view=crosswords&task=view&id=' . $obj->id . ':' . $obj->alias . $itemid); $act->title = JText::_('{actor} ' . $text . ' <a href="' . $link . '">' . $obj->title . '</a>'); break; } CFactory::load('libraries', 'activities'); CActivityStream::add($act); } } else { if (strcasecmp($cwConfig[ACTIVITY_STREAM_TYPE], 'touch') == 0) { $API = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php'; if (file_exists($API)) { require_once $API; $capi = new JSCommunityApi(); if ($user->id) { $link = JRoute::_('index.php?option=' . $option . '&view=crosswords&task=view&id=' . $obj->id . ":" . $obj->alias . $itemid); $icon = JURI::base() . 'components/' . $option . '/assets/images/logo.png'; $text = ''; switch ($action) { case 1: // New question $text = $user->{$cwConfig}[USER_NAME] . ' ' . JText::_('TXT_SUBMITTED_CROSSWORD_QUESTION'); break; case 2: // solved crossword $text = $user->{$cwConfig}[USER_NAME] . ' ' . JText::_('TXT_SOLVED_CROSSWORD') . ' <a href="' . $link . '">' . $obj->title . '</a>'; break; } $capi->registerActivity(0, $text, $user->get('id'), $icon, 'user', null, $option, '', 'Crosswords'); } } } } }