/** * Add the page title and toolbar. * * @return none */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; if (isset($this->item->checked_out)) { $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); } else { $checkedOut = false; } $canDo = RedtwitterHelper::getActions(); JToolBarHelper::title(JText::_('COM_REDTWITTER_TITLE_FOLLOWED_PROFILE'), 'followed_profile.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('followed_profile.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('followed_profile.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('followed_profile.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolBarHelper::custom('followed_profile.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('followed_profile.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('followed_profile.cancel', 'JTOOLBAR_CLOSE'); } }
/** * @param array $twitterId * @param $orderType * @param $maxItemDisplayed * @return array */ public static function getTwitterList($twitterId = array(), $orderType = 0, $maxItemDisplayed = 10, $params = array()) { JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_redtwitter/models', 'redtwitterModelfollowedprofiles'); $model = JModelLegacy::getInstance('followedprofiles', 'redtwitterModel', array('ignore_request' => true)); $twitterUserList =& $model->getData($twitterId); $twitterDataTimelines = RedtwitterHelper::getAllUserTimeline($twitterUserList, $orderType, $maxItemDisplayed, $params); return $twitterDataTimelines; }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/redtwitter.php'; $state = $this->get('State'); $canDo = RedtwitterHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_REDTWITTER_TITLE_FOLLOWED_PROFILES'), 'followed_profiles.png'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/followed_profile'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('followed_profile.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('followed_profile.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('followed_profiles.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('followed_profiles.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { // If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'followed_profiles.delete', 'JTOOLBAR_DELETE'); } } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('followed_profiles.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('followed_profiles.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } // Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'followed_profiles.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('followed_profiles.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_redtwitter'); } }
/** * Get access token from twitter */ public function generateToken() { $input = JFactory::getApplication()->input; $jform = $input->get('jform', '', 'ARRAY'); if ($jform['consumer_key'] != "" && $jform['consumer_secret'] != "") { $access_token = RedtwitterHelper::getAccessToken($jform['consumer_key'], $jform['consumer_secret']); $session = JFactory::getSession(); if (!empty($access_token)) { $data['access_token'] = "Bearer " . $access_token; $data = array_merge($jform, $data); $this->getModel()->updateToken($data); $session->set('generatedFlag', true); } else { $session->set('generatedFlag', false); } $this->redirect = "index.php?option=com_redtwitter&view=oauth_info"; } }
/** * @return JException|mixed */ private static function _getOauthInfo() { $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('id, consumer_key, consumer_secret, access_token')->from($db->quoteName('#__redtwitter_oauth_info'))->where('state = 1'); // Get the authorize information $db->setQuery($query); try { $result = $db->loadObject(); if (empty($result)) { return array(); } self::$oauthInfo = $result; } catch (RuntimeException $e) { return new JException(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500); } }
?> </style> <h1 class="componentheading<?php echo $this->params->get('pageclass_sfx'); ?> "> <?php echo $this->params->get('page_title'); ?> </h1> <?php $cache = JFactory::getCache(); $cache->setCaching(1); include_once JPATH_COMPONENT_SITE . '/helpers/redtwitter.php'; echo '<div id="tweetlist">'; $array1 = RedtwitterHelper::getAllUserTimeline($this->lists); if (count($array1) > 0) { $b = 1; foreach ($array1 as $key => $val) { $date = new DateTime($val['pdate']); $dt1 = $date->format($this->params->get("date", 'Y-m-d')); $dt = strtotime($dt1); $title = $val['title']; $change_contents = $title; $change_con = explode("http://", $change_contents); if (count($change_con) > 0) { foreach ($change_con as $f) { $ifr1 = explode(" ", $f); $mytxt1 = "" . $ifr1[0] . ""; $mylink1 = str_replace($ifr1[0], ".", $ifr1[0]); $mylink1 = str_replace($mylink1, ",", $mylink1);