mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 22:27:34 +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.'),
|
||||
|
||||
'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'=>''),
|
||||
|
||||
);
|
||||
|
@@ -138,7 +138,7 @@ class social_shortcodes extends e_shortcode
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
$hashtags = vartrue($pref['sharing_hashtags']);
|
||||
|
||||
$defaultUrl = vartrue($this->var['url'], e_REQUEST_URL);
|
||||
$defaultTitle = vartrue($this->var['title'], deftrue('e_PAGETITLE'). " | ". SITENAME);
|
||||
@@ -190,6 +190,12 @@ class social_shortcodes extends e_shortcode
|
||||
|
||||
$opt = array();
|
||||
|
||||
|
||||
|
||||
$hashtags = str_replace(array(" ",'#'),"", $hashtags); // "#mytweet";
|
||||
$twitterAccount = basename(XURL_TWITTER);
|
||||
|
||||
// return print_a($hashtags,true);
|
||||
foreach($providers as $k=>$val)
|
||||
{
|
||||
|
||||
@@ -202,6 +208,22 @@ class social_shortcodes extends e_shortcode
|
||||
|
||||
$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>";
|
||||
}
|
||||
|
||||
@@ -249,7 +271,7 @@ class social_shortcodes extends e_shortcode
|
||||
{
|
||||
$ns = e107::getRender();
|
||||
|
||||
$account = dirname(XURL_TWITTER);
|
||||
$account = basename(XURL_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>';
|
||||
|
||||
|
Reference in New Issue
Block a user