| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/nice/plugins/community/twitter/ |
Upload File : |
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;
require_once( JPATH_ROOT . '/components/com_community/libraries/core.php');
if (!class_exists('plgCommunityTwitter')) {
class plgCommunityTwitter extends CApplications {
public $name = "Twitter";
public $_name = 'twitter';
public $_path = '';
public $timelines = array(
'public' => '1.1/statuses/public_timeline.json',
'friends' => '1.1/statuses/friends_timeline.json',
'home' => '1.1/statuses/home_timeline.json',
'user' => '1.1/statuses/user_timeline.json',
'update' => '1.1/statuses/update.json'
);
public $users = array(
'show' => '1.1/users/show.json'
);
static public function getConsumer() {
static $consumer = null;
if (is_null($consumer)) {
$my = CFactory::getUser();
//$consumer = new Zend_Oauth_Consumer(self::getConfiguration());
$configuration = self::getConfiguration();
//$consumer = new TwitterOAuth( $configuration['consumerKey'],$configuration['consumerSecret'] );
$consumer = new tmhOAuth(self::getConfiguration());
}
return $consumer;
}
static public function getConfiguration($userid = '') {
static $configuration = null;
if (is_null($configuration)) {
$plugin = PluginHelper::getPlugin('community', 'twitter');
$params = new CParameter($plugin->params);
$consumer_key = $params->get('consumerKey');
$consumer_secret = $params->get('consumerSecret');
$configuration = array(
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret,
'bearer' => base64_encode($consumer_key.':'.$consumer_secret),
'curl_ssl_verifypeer' => true
);
}
return $configuration;
}
public function onProfileDisplay() {
CMSPlugin::loadLanguage('plg_community_twitter', JPATH_ADMINISTRATOR);
$user = CFactory::getRequestUser();
$document = Factory::getDocument();
$css = Uri::base() . 'plugins/community/twitter/twitter/style.css';
$document->addStyleSheet($css);
$my = CFactory::getUser();
$oauth = Table::getInstance('Oauth', 'CTable');
if (!$oauth->load($user->id, 'twitter')) {
return Text::_('PLG_TWITTER_NOT_SET');
}
return $this->_getTwitterHTML($user->id);
}
protected function _getTwitterHTML($userId) {
$this->loadUserParams();
$my = CFactory::getUser($userId);
$this->userparams = $my->getAppParams($this->_name);
ob_start();
$accountId = $this->userparams->get('accountid');
if(!empty($accountId) && ($accountId || $accountId != '')){
?>
<div class="content-nopost">
<a class="twitter-timeline" style="text-decoration: none; cursor: default; color: black" data-height="470" data-theme="light" href="https://twitter.com/<?php echo $accountId ?>?ref_src=twsrc%5Etfw">Twitter by <?php echo $accountId ?></a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<?php }else{ ?>
<div class="content-nopost">
<?php echo Text::_('PLG_TWITTER_NOT_UPDATES'); ?>
</div>
<?php } ?>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
static public function replaceAliasURL($message) {
$pattern = '/@(("(.*)")|([A-Z0-9][A-Z0-9_-]+)([A-Z0-9][A-Z0-9_-]+))/i';
preg_match_all($pattern, $message, $matches);
if (isset($matches[0]) && !empty($matches[0])) {
//CFactory::load('helpers', 'user');
//CFactory::load('helpers', 'linkgenerator');
$usernames = $matches[0];
for ($i = 0; $i < count($usernames); $i++) {
$username = $usernames[$i];
$username = JString::str_ireplace('"', '', $username);
$username = explode('@', $username);
$username = $username[1];
$message = JString::str_ireplace($username, '<a href="http://twitter.com/' . $username . '" target="_blank" rel="nofollow">' . $username . '</a>', $message);
}
}
return $message;
}
}
}