From 57af6000b2ddc795d89d205a8824480c029021a5 Mon Sep 17 00:00:00 2001 From: Patrick LEFEVRE Date: Sat, 23 Apr 2016 11:30:51 +0200 Subject: [PATCH] Update pat_article_social.php Removes a function. Restores the omitted external javascripts for the embedded statuses. --- pat_article_social.php | 44 ++++-------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/pat_article_social.php b/pat_article_social.php index 05a0e2e..470a03a 100644 --- a/pat_article_social.php +++ b/pat_article_social.php @@ -415,10 +415,10 @@ function twttr($atts) // Display json result. if ($datas) $out = ' ' . str_replace( - array(' align="center"', ' width="500"', ''), + array(' align="center"', ' width="500"'), array('', ' style="width:500px"', ''), $datas['html'] - )._injectjs(1); + ); } else { @@ -452,7 +452,7 @@ function fb($atts) if( preg_match('#^https:\/\/w{3}\.facebook\.com\/[a-z-A-Z-0-9.]*\/posts\/[0-9]*(.*)?$#i', $status) ) { - return '
'._injectjs(2, $locale).'
'; + return '
'; } @@ -478,7 +478,7 @@ function gplus($atts) if ( !gps('txpreview') ) { if( preg_match('#^https:\/\/plus\.google\.com\/[a-z-A-Z-0-9+]*\/posts\/[a-z-A-Z-0-9]*$#i', $status) ) { - return ' ' . _injectjs(3) . '
'; + return '
'; } return trigger_error(gTxt('invalid_attribute_value', array('{name}' => 'status')), E_USER_WARNING); @@ -486,42 +486,6 @@ function gplus($atts) } -// TO DO: better function -/** - * Inject js script only once. - * - * @type integer 1: Twitter, 2: facebook, 3: G+ - * @param locale Locale country code - * @return script social network script link - */ -function _injectjs($type, $locale = NULL) { - - static $cache = array(); - - // Function has never run. - if ( empty($cache[$type]) ) { - // Assign variable. - switch ( $cache[$type] ) { - - case '1': - $cache[$type] = ''; - break; - - case '2': - $cache['type'] = ''; - break; - - case '3': - $cache['type'] = ''; - break; - - } - - return $cache[$type]; - } - -} - /** * Display Instagram embedded post