From b90e0abcd9283ff930533be0dade871ba2fa92c5 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 7 Jun 2015 19:45:19 -0700 Subject: [PATCH] FAQ tags are now included in the twitter share url. --- e107_plugins/faqs/faqs_shortcodes.php | 2 +- e107_plugins/social/e_shortcode.php | 36 ++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index f741472b7..c999e3b5d 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -91,7 +91,7 @@ class faqs_shortcodes extends e_shortcode if($this->share == true) { - $text .= "
".$tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=".$url."&title=".$question."}",true)."
"; + $text .= "
".$tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=".$url."&title=".$question."&tags=".$this->var['faq_tags']."}",true)."
"; } $text .= " diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php index 5d6e1bb71..9b24de0bd 100644 --- a/e107_plugins/social/e_shortcode.php +++ b/e107_plugins/social/e_shortcode.php @@ -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);