mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Include hashtags and account in twitter share.
This commit is contained in:
@@ -84,6 +84,7 @@ class social_ui extends e_admin_ui
|
|||||||
'twitter_menu_limit' => array('title'=> 'Limit', 'type'=>'number', 'tab'=>2, 'data' => 'int','help'=>'Number of tweets to display.'),
|
'twitter_menu_limit' => array('title'=> 'Limit', 'type'=>'number', 'tab'=>2, 'data' => 'int','help'=>'Number of tweets to display.'),
|
||||||
|
|
||||||
'sharing_mode' => array('title'=> 'Display Mode', 'type'=>'dropdown', 'tab'=>0, 'writeParms'=>array('optArray'=>array('normal'=>'Normal','dropdown'=>'Dropdown','off'=>'Disabled')), 'data' => 'str','help'=>''),
|
'sharing_mode' => array('title'=> 'Display Mode', 'type'=>'dropdown', 'tab'=>0, 'writeParms'=>array('optArray'=>array('normal'=>'Normal','dropdown'=>'Dropdown','off'=>'Disabled')), 'data' => 'str','help'=>''),
|
||||||
|
'sharing_hashtags' => array('title'=> 'Hashtags', 'type'=>'tags', 'tab'=>0, 'data' => 'str','help'=>'Excluding the # symbol.'),
|
||||||
'sharing_providers' => array('title'=> 'Providers', 'type'=>'checkboxes', 'tab'=>0, 'writeParms'=>array(), 'data' => 'str','help'=>''),
|
'sharing_providers' => array('title'=> 'Providers', 'type'=>'checkboxes', 'tab'=>0, 'writeParms'=>array(), 'data' => 'str','help'=>''),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@@ -138,7 +138,7 @@ class social_shortcodes extends e_shortcode
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hashtags = vartrue($pref['sharing_hashtags']);
|
||||||
|
|
||||||
$defaultUrl = vartrue($this->var['url'], e_REQUEST_URL);
|
$defaultUrl = vartrue($this->var['url'], e_REQUEST_URL);
|
||||||
$defaultTitle = vartrue($this->var['title'], deftrue('e_PAGETITLE'). " | ". SITENAME);
|
$defaultTitle = vartrue($this->var['title'], deftrue('e_PAGETITLE'). " | ". SITENAME);
|
||||||
@@ -190,6 +190,12 @@ class social_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
$opt = array();
|
$opt = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$hashtags = str_replace(array(" ",'#'),"", $hashtags); // "#mytweet";
|
||||||
|
$twitterAccount = basename(XURL_TWITTER);
|
||||||
|
|
||||||
|
// return print_a($hashtags,true);
|
||||||
foreach($providers as $k=>$val)
|
foreach($providers as $k=>$val)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -202,6 +208,22 @@ class social_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
$shareUrl = $tp->lanVars($pUrl,$data);
|
$shareUrl = $tp->lanVars($pUrl,$data);
|
||||||
|
|
||||||
|
if($k == 'twitter')
|
||||||
|
{
|
||||||
|
if(!empty($hashtags))
|
||||||
|
{
|
||||||
|
$shareUrl .= "&hashtags=".rawurlencode($hashtags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($twitterAccount))
|
||||||
|
{
|
||||||
|
$shareUrl .= "&via=".$twitterAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$opt[$k] = "<a class='e-tip btn ".$butSize." btn-default social-share' target='_blank' title='".$val["title"]."' href='".$shareUrl."'>".$tp->toIcon($val["icon"])."</a>";
|
$opt[$k] = "<a class='e-tip btn ".$butSize." btn-default social-share' target='_blank' title='".$val["title"]."' href='".$shareUrl."'>".$tp->toIcon($val["icon"])."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +271,7 @@ class social_shortcodes extends e_shortcode
|
|||||||
{
|
{
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
|
|
||||||
$account = dirname(XURL_TWITTER);
|
$account = basename(XURL_TWITTER);
|
||||||
//data-related="twitterapi,twitter"
|
//data-related="twitterapi,twitter"
|
||||||
$text = '<a class="twitter-timeline" href="'.XURL_TWITTER.'" data-widget-id="'.varset($parm['id']).'" data-theme="'.varset($parm['theme'],'light').'" data-link-color="#cc0000" data-aria-polite="assertive" width="100%" height="'.varset($parm['height'],300).'" lang="'.e_LAN.'">Tweets by @'.$account.'</a>';
|
$text = '<a class="twitter-timeline" href="'.XURL_TWITTER.'" data-widget-id="'.varset($parm['id']).'" data-theme="'.varset($parm['theme'],'light').'" data-link-color="#cc0000" data-aria-polite="assertive" width="100%" height="'.varset($parm['height'],300).'" lang="'.e_LAN.'">Tweets by @'.$account.'</a>';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user