DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:webcomics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:webcomics [2011-11-25 22:24] – [Download] 2001:738:2001:2072:2150:3900::plugin:webcomics [2023-10-31 00:34] (current) Klap-in
Line 1: Line 1:
-====== webcomics plugin ======+====== webcomics Plugin ======
  
 ---- plugin ---- ---- plugin ----
 description: It displays various Webcomics. Based on Dilbert Plugin. description: It displays various Webcomics. Based on Dilbert Plugin.
-author     : Christoph Lang +author     : LarsDW223 
-email      : calbity@gmx.de +email      : - 
-type       :  +type       : syntax 
-lastupdate : 2009-07-09 +lastupdate : 2019-02-16 
-compatible : +compatible : Greebo, Hogfather
 depends    :  depends    : 
 conflicts  conflicts 
 similar    : garfield, dil, xkcd similar    : garfield, dil, xkcd
-tags       : comic +tags       : comic,
-----+
  
-===== Purpose =====+downloadurl: https://github.com/LarsGit223/dokuwiki-plugin-webcomics/archive/2019-02-16.zip 
 +bugtracker : https://github.com/LarsGit223/dokuwiki-plugin-webcomics/issues 
 +sourcerepo : https://github.com/LarsGit223/dokuwiki-plugin-webcomics 
 +donationurl: 
  
-I love comics, and so does all other people on my private Wiki. I like to have a new comic every day.+screenshot_img:  
 +----
  
-The plugin includes the same functionality as the [[:plugin:dil|dilbert-plugin]] **and** the [[:plugin:garfield|garfield-plugin]]. +===== Description =====
-Also the plugin is extended with two new comics. Check the (static) examples below. +
-===== Download=====+
  
-Copy into **webcomics/syntax.php** in lib folder. +This plugin lets the user add a comic to a page taken from an RSS feedThe list of supported/known RSS feeds is configurable.
-<code php> +
-<?php +
-/** +
- * Webcomics Plugin +
- * +
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) +
- * @author     Christoph Lang <calbity@gmx.de> +
- */+
  
-// based on http://wiki.splitbrain.org/plugin:tutorial+===== History =====
  
-// must be run within Dokuwiki +The plugin was created by Christoph Lang in 2013.
-if (!defined('DOKU_INC')) die();+
  
-if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); +===== Installation =====
-require_once(DOKU_PLUGIN . 'syntax.php');+
  
-/** +Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
- * All DokuWiki plugins to extend the parser/rendering mechanism +
- * need to inherit from this class +
- */ +
-class syntax_plugin_webcomics extends DokuWiki_Syntax_Plugin { +
-    function getInfo() { +
-        return array( +
-        'author'  => 'Christoph Lang', +
-        'email'   => 'calbity@gmx.de', +
-        'date'    => '2009-07-09', +
-        'name'    => 'Webcomics Plugin', +
-        'desc'    => 'It displays various Webcomics. Based on Dilbert Plugin.', +
-        'url'     => 'http://www.dokuwiki.org/plugin:webcomics' +
-        ); +
-    }+
  
-    private function _listhd($type) { +===== Configuration =====
-        require_once(DOKU_INC . 'inc/HTTPClient.php');+
  
-    //print_r($type); +The configuration contains a list of comic names assigned to RSS feedsThe format per entry is  
- switch($type){ +<code> 
- case "XKCD": +comicname="feeduri"; 
-         $url = 'http://xkcd.com/rss.xml'; +</code> 
-         $pre  = 'http://imgs.xkcd.com/comics/'; +A linebreak after a semicolon is allowed.
-         $post '.png'; +
-         break; +
-                                  case "GARFIELD"+
-                                        $url = 'http://www.arcamax.com/thefunnies/garfield/rss'+
-                                        $pre  = 'http://www.arcamax.com/newspics/'; +
-                                        $post = '.gif'; +
-                                        break;+
  
-                                  case "DILBERT": +For example see the default configuration below: 
-                                        $url 'http://feedproxy.google.com/DilbertDailyStrip'+<code> 
-                                        $pre  'http://dilbert.com/dyn/str_strip/'+xkcd="https://xkcd.com/rss.xml"; 
-                                        $post '.gif'+dilbert="https://www.comicsrss.com/rss/dilbert.rss"
-                                        break;+peanuts="https://www.comicsrss.com/rss/peanuts.rss"
 +garfield="https://www.comicsrss.com/rss/garfield.rss"
 +</code>
  
-                                  case "CYANIDE": +===== Syntax =====
-                                        $url 'http://henrik.nyh.se/scrapers/cyanide_and_happiness.rss'; +
-                                        $pre  'http://www.flashasylum.com/db/files/Comics/'; +
-                                        $post '.png'; +
-                                        break;+
  
-          +The syntax is ''<comic="comic-name">''.
-   case "SHACKLES":  +
-         $url = 'http://feeds2.feedburner.com/virtualshackles';            +
-         $pre  = 'http://www.virtualshackles.com/img/'; +
-         $post = '.jpg'; +
-         break;                  +
-   default: return $type." will be supported soon!"; +
-    +
- }+
  
-        $ch new DokuHTTPClient(); +===== Examples =====
-        $piece $ch->get($url); +
- +
-        $xml simplexml_load_string($piece); +
- +
-        $a explode($pre,  (string)$xml->channel->item->description); +
-        $b explode($post, $a[1]); +
- +
-        $feed_contents .'<a href="' . $url . '/" alt="XKCD">'+
-        '<img src="' . $pre . $b[0] . $post . '" alt="XKCD"/></a>'. "\n"; +
- +
-        return $feed_contents; +
-    } +
- +
-    function connectTo($mode) { +
-        $this->Lexer->addSpecialPattern('\[XKCD\]', $mode, 'plugin_webcomics'); +
-        $this->Lexer->addSpecialPattern('\[GARFIELD\]', $mode, 'plugin_webcomics'); +
-        $this->Lexer->addSpecialPattern('\[DILBERT\]', $mode, 'plugin_webcomics'); +
-        $this->Lexer->addSpecialPattern('\[SHACKLES\]', $mode, 'plugin_webcomics'); +
-        $this->Lexer->addSpecialPattern('\[CYANIDE\]', $mode, 'plugin_webcomics'); +
-         +
-    } +
- +
-    function getType() { return 'substition';+
- +
-    function getSort() { return 667; } +
- +
-    function handle($match, $state, $pos, &$handler) { +
-    $match = str_replace(array("[","]"),array("",""),$match); +
-        return array($match, $state, $pos); +
-    } +
- +
-    function render($mode, &$renderer, $data) { +
- +
-        if ($mode == 'xhtml') { +
-            $renderer->doc .= $this->_listhd($data[0]); +
-            return true; +
-        } +
-        return false; +
-    } +
-}+
  
 +<code>
 +<comic="garfield">
 </code> </code>
- 
-===== Example ===== 
-^ Exampe Iamge ^ Syntax ^ 
-| {{http://www.virtualshackles.com/img/dantes_inferno_fraud.jpg|}} | [SHACKLES] | 
-| {{http://imgs.xkcd.com/comics/revolutionary.png|}} | [XKCD] | 
-| {{http://images.ucomics.com/comics/ga/2009/ga091215.gif|}} | [GARFIELD] | 
-| {{http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/000000/70000/6000/700/76732/76732.strip.print.gif|}} | [DILBERT] | 
- 
- 
  
plugin/webcomics.1322256259.txt.gz · Last modified: 2011-11-25 22:24 by 2001:738:2001:2072:2150:3900::

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki