X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fpubsubhubbub%2Fpubsubhubbub.php;h=299b84fb192b3886c4d2d374725a3022a7bb117e;hb=53054b2bf6a919fd4ff9b44b6ad1986f21f488b6;hp=1872af8a1da0c20fad05e693ff82fb9b43230c47;hpb=dfc650aa239d3a2c028d0ba13132ce75b4f4c0b4;p=github%2Fshaarli%2FShaarli.git diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php index 1872af8a..299b84fb 100644 --- a/plugins/pubsubhubbub/pubsubhubbub.php +++ b/plugins/pubsubhubbub/pubsubhubbub.php @@ -12,6 +12,8 @@ use pubsubhubbub\publisher\Publisher; use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; +use Shaarli\Plugin\PluginManager; +use Shaarli\Render\TemplatePage; /** * Plugin init function - set the hub to the default appspot one. @@ -39,8 +41,8 @@ function pubsubhubbub_init($conf) */ function hook_pubsubhubbub_render_feed($data, $conf) { - $feedType = $data['_PAGE_'] == Router::$PAGE_FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; - $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.'. $feedType .'.xml'); + $feedType = $data['_PAGE_'] == TemplatePage::FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; + $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.' . $feedType . '.xml'); $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL')); return $data; @@ -57,10 +59,10 @@ function hook_pubsubhubbub_render_feed($data, $conf) */ function hook_pubsubhubbub_save_link($data, $conf) { - $feeds = array( - index_url($_SERVER) .'?do=atom', - index_url($_SERVER) .'?do=rss', - ); + $feeds = [ + index_url($_SERVER) . 'feed/atom', + index_url($_SERVER) . 'feed/rss', + ]; $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post'; try { @@ -85,11 +87,11 @@ function hook_pubsubhubbub_save_link($data, $conf) */ function nocurl_http_post($url, $postString) { - $params = array('http' => array( + $params = ['http' => [ 'method' => 'POST', 'content' => $postString, 'user_agent' => 'PubSubHubbub-Publisher-PHP/1.0', - )); + ]]; $context = stream_context_create($params); $fp = @fopen($url, 'rb', false, $context);