diff --git a/serendipity_plugin_twitter/serendipity_event_twitter.php b/serendipity_plugin_twitter/serendipity_event_twitter.php index 40933ced..921c7db1 100644 --- a/serendipity_plugin_twitter/serendipity_event_twitter.php +++ b/serendipity_plugin_twitter/serendipity_event_twitter.php @@ -24,7 +24,7 @@ require_once dirname(__FILE__) . '/classes/TwitterPluginFileAccess.php'; require_once dirname(__FILE__) . '/classes/twitter_entry_defs.include.php'; // writes a debug log into templates_c -@define('PLUGIN_TWITTER_DEBUG', TRUE); +@define('PLUGIN_TWITTER_DEBUG', FALSE); // Consumer settings for the S9Y webapp @define('PLUGIN_TWITTER_OAUTH_TWITTER_CONSUMERKEY', 'ScXsM6UiDU1nDl8u6tacrw'); @@ -1755,19 +1755,13 @@ a.twitter_update_time { global $serendipity; require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; - $this->log("parts: " . print_r($parts,true)); - if (count($parts)<5) return time() + (60 * 60); // params corrupted next try allowed one minute later // Do we need to do OAuth? if (count($parts)>6) { - $this->log("NEW OUATH FETCH"); $idx_twitter = $parts[5]; - $this->log("idx: $idx_twitter"); $idxmd5 = $parts[6]; - $this->log("idxmd5: $idxmd5"); $idxmd5_test = md5(serendipity_event_twitter::pluginSecret() . "_{$idx_twitter}"); - $this->log("$idxmd5=?=$idxmd5_test"); if ($idxmd5_test != $idxmd5) { // Seems to be a hack! return time() + (60 * 60); // params corrupted next try allowed one minute later } @@ -1797,14 +1791,12 @@ a.twitter_update_time { $error=200; // Default is: All OK if (!empty($idx_twitter)) { - $this->log("Loading timeline via OAUTH"); $search_twitter_uri = 'http://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=' . $username . '&count=' . $number . '&trim_user=true'; if (!$show_rt) $search_twitter_uri .= '&include_rts=false'; if ($idx_twitter=='1') $idx_twitter=''; // First cfg is saved with empty suffix! $connection = $this->twitteroa_connect($idx_twitter); $connection->decode_json = false; $response = $connection->get($search_twitter_uri); - $this->log(print_r(json_decode($response), true)); } else { if ($service == 'identi.ca') diff --git a/serendipity_plugin_twitter/serendipity_plugin_twitter.php b/serendipity_plugin_twitter/serendipity_plugin_twitter.php index 69e882d3..9628392b 100644 --- a/serendipity_plugin_twitter/serendipity_plugin_twitter.php +++ b/serendipity_plugin_twitter/serendipity_plugin_twitter.php @@ -225,6 +225,12 @@ class serendipity_plugin_twitter extends serendipity_plugin { // Remove Cachefile @unlink($cachefile); + + // Recreate cache + serendipity_request_start(); + $title = "#caching#"; + $this->generate_content($title); + serendipity_request_end(); } function output($out) { @@ -237,7 +243,9 @@ class serendipity_plugin_twitter extends serendipity_plugin { function generate_content(&$title) { global $serendipity; - + + $hideDisplay = "#caching#" == $title; + $number = $this->get_config('number'); $service = $this->get_config('service', 'twitter.com'); $username = $this->get_config('username'); @@ -269,11 +277,6 @@ class serendipity_plugin_twitter extends serendipity_plugin { $timelineurl = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' . $username . '&count=' . $number . '&callback=' . $JSONcallback; $api = new Twitter(false); } - /* - else { - $api = new Twitter(false); // We only need Twitter object for replacements - } - */ if (!$dateformat || strlen($dateformat) < 1) { $dateformat = '%A, %B %e %Y'; @@ -338,30 +341,34 @@ class serendipity_plugin_twitter extends serendipity_plugin { } $str_output[] = ''; // Display only, if we have something meaningful: - if (count($str_output)>2) { + if (!$hideDisplay && count($str_output)>2) { $output = implode('', $str_output); $this->output($output); } } else { - echo '
' . PLUGIN_TWITTER_FOLLOWME_LINK_TEXT . '
' . "\n"; - } - if ($service == 'twitter.com' && serendipity_db_bool($this->get_config('followme_widget', false))) { - $extra_style = ''; - if (serendipity_db_bool($this->get_config('followme_widget_dark', false))) { - $extra_style .= ' data-button="grey" data-text-color="#FFFFFF" data-link-color="#00AEFF"'; + if (!$hideDisplay) { + echo '