1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

FAQ tags are now included in the twitter share url.

This commit is contained in:
Cameron 2015-06-07 19:45:19 -07:00
parent f90e09114a
commit b90e0abcd9
2 changed files with 34 additions and 4 deletions

@ -91,7 +91,7 @@ class faqs_shortcodes extends e_shortcode
if($this->share == true)
{
$text .= "<div class='faq-share'>".$tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=".$url."&title=".$question."}",true)."</div>";
$text .= "<div class='faq-share'>".$tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=".$url."&title=".$question."&tags=".$this->var['faq_tags']."}",true)."</div>";
}
$text .= "</div></div>

@ -118,6 +118,30 @@ class social_shortcodes extends e_shortcode
}
private function getHashtags($extraTags='')
{
$hashtags = e107::pref('social','sharing_hashtags','');
$hashtags = str_replace(array(" ",'#'),"", $hashtags);
$ret = explode(',',$hashtags);
if(!empty($extraTags))
{
$extraTags = str_replace(array(" ",'#'),"", $extraTags);
$tmp = explode(',',$extraTags);
foreach($tmp as $v)
{
$ret[] = $v;
}
}
if(!empty($ret))
{
return implode(',',$ret);
}
}
/**
@ -138,7 +162,7 @@ class social_shortcodes extends e_shortcode
return '';
}
$hashtags = vartrue($pref['sharing_hashtags']);
// $hashtags = vartrue($pref['sharing_hashtags']);
$defaultUrl = vartrue($this->var['url'], e_REQUEST_URL);
$defaultTitle = vartrue($this->var['title'], deftrue('e_PAGETITLE'). " | ". SITENAME);
@ -170,7 +194,8 @@ class social_shortcodes extends e_shortcode
$label = varset($parm['label'], $tp->toGlyph('e-social-spread'));
$size = varset($parm['size'], 'md');
$tags = varset($parm['tags'], '');
@ -190,9 +215,14 @@ class social_shortcodes extends e_shortcode
$opt = array();
// $hashtags = '';
// $hashtags .= str_replace(array(" ",'#'),"", $hashtags); // "#mytweet";
$hashtags = $this->getHashtags($tags);
$hashtags = str_replace(array(" ",'#'),"", $hashtags); // "#mytweet";
$twitterAccount = basename(XURL_TWITTER);
// return print_a($hashtags,true);