Stuttmann-Karikaturen.de plugin for big pictures

Post plugins and custom CSS snippets here
jeena
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 24 Apr 2013, 22:01

Stuttmann-Karikaturen.de plugin for big pictures

Postby jeena » 08 May 2016, 14:12

I'm following http://www.stuttmann-karikaturen.de/ which is a German political comic strip and they only give you a thumbnail of the comic but it is easy to get the real path of the image, you just remove "/thumbs" from the url, so I made a plugin which does just that:

Code: Select all

<?php

class Jp_Stuttmann extends Plugin {

        function about() {
                return array(1.0,
                        "Replace to big images in stuttmann-karikaturen.de",
                        "Jeena");
        }

        function init($host) {
                $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
        }

        function hook_article_filter($article) {

                if (strpos($article["guid"], "www.stuttmann-karikaturen.de") !== FALSE) {
                        if (strpos($article["plugin_data"], "stuttmann,$owner_uid:") === FALSE) {
                                $article["content"] = str_replace("/thumbs/", "/", $article["content"]);
                                $article["plugin_data"] = "stuttmann,$owner_uid:" . $article["plugin_data"];
                        } else if (isset($article["stored"]["content"])) {
                                $article["content"] = $article["stored"]["content"];
                        }
                }

                return $article;
        }

        function api_version() {
                return 2;
        }

}


Installation: in your plugins directory create a directory called jp_stuttmann and then save this source code above into this directory under the name init.php. After that go to the Preferences and open plugins, you should be able to see the plugin jp_stuttmann which you have to enable. After that resubscribe to the RSS feed again so the plugin can process it.

masgo
Bear Rating Trainee
Bear Rating Trainee
Posts: 15
Joined: 11 Feb 2015, 18:53

Re: Stuttmann-Karikaturen.de plugin for big pictures

Postby masgo » 23 May 2016, 13:27

works great. Thank you.

Bernd
Bear Rating Trainee
Bear Rating Trainee
Posts: 25
Joined: 06 May 2008, 15:46

Re: Stuttmann-Karikaturen.de plugin for big pictures

Postby Bernd » 20 Oct 2016, 19:33

Works for me. Thank you!


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 1 guest