DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:socialmark

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:socialmark [2006-03-21 16:52] 84.96.84.106plugin:socialmark [2023-12-21 16:16] (current) – new download url Aleksandr
Line 1: Line 1:
 +====== SocialMark Plugin ======
  
 +---- plugin ----
 +description: Add link to “social bookmark” a page
 +author     : iDo
 +email      : ido@woow-fr.com
 +type       : syntax
 +lastupdate : 2006-03-21
 +compatible : 
 +depends    : 
 +conflicts 
 +similar    : 
 +tags       : bookmark, links, social
 +downloadurl:https://trello.com/1/cards/5d5015f58c33fc8d391fd1ae/attachments/5d501937eee4ac6144453558/download/socialmark.zip
 +----
 +
 +This plugin add some link to "social-bookmark" a page.
 +
 +===== Syntax =====
 +
 +Simply write ''%%{{socialmark}}%%'' where you want links appear.
 +
 +===== Example =====
 +
 +You can see it in action [[https://web.archive.org/web/20170106072225/http://www.wikistuce.info/doku.php/php/creer_une_shoutbox|here]] (end of page).
 +
 +===== Installation =====
 +
 +With Plugin Manager: [[https://trello.com/1/cards/5d5015f58c33fc8d391fd1ae/attachments/5d501937eee4ac6144453558/download/socialmark.zip|socialmark.zip]]
 +
 +Or manually: Download and unzip the plugin_manager archive then put folder in you're 'lib/plugins/' directory.
 +
 +===== Source =====
 +
 +(if plugin_manager URL does not work)
 +
 +<file php lib/plugins/socialmark/syntax.php>
 +<?php
 + 
 +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
 +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 +require_once(DOKU_PLUGIN.'syntax.php');
 + 
 +/**
 + * All DokuWiki plugins to extend the parser/rendering mechanism
 + * need to inherit from this class
 + */
 +class syntax_plugin_socialmark extends DokuWiki_Syntax_Plugin {
 + 
 +    /**
 +     * return some info
 +     */
 +    function getInfo(){
 +        return array(
 +            'author' => 'iDo',
 +            'email'  => 'iDo@woow-fr.com',
 +            'date'   => '21/03/2006',
 +            'name'   => 'Social Mark Plugin',
 +            'desc'   => 'Add some link to social bookmarking page. Syntax: {{socialmark}}',
 +            'url'    => 'https://www.dokuwiki.org/plugin:socialmark',
 +        );
 +    }
 +    
 +    /**
 +     * What kind of syntax are we?
 +     */
 +    function getType(){
 +        return 'substition';
 +    }
 + 
 +    /**
 +     * Where to sort in?
 +     */
 +    function getSort(){
 +        return 108;
 +    }
 + 
 +    /**
 +     * Connect pattern to lexer
 +     */
 +    function connectTo($mode) {
 +      $this->Lexer->addSpecialPattern("{{socialmark}}",$mode,'plugin_socialmark');
 +    }
 +      
 +    /**
 +     * Handle the match
 +     */
 +    function handle($match, $state, $pos, &$handler){
 + return true;
 +    }  
 + 
 +    /**
 +     * Create output
 +     */
 +    function render($mode, &$renderer, $data) {
 +        if($mode == 'xhtml'){       
 + $renderer->doc .= '<div>';
 +            $renderer->doc .= $this->_socialmark();
 +            $renderer->doc .= '</div>';
 +            return true;
 +        }
 +        return false;
 +    }
 +
 + function _socialmark() {
 + global $conf;
 + $r='<ul id="socialmark">';
 + $g=@file(DOKU_PLUGIN.'socialmark/list.txt');
 + foreach ($g as $v) {
 + if ($v{0}=='#') continue; /*comments line starts by #*/
 + $v=explode('|',$v,2);
 + if (@$v[1])
 + $h=$v[1];
 + else {
 + $h=parse_url($v[0]);
 + $h=$h['host'];
 + }
 +
 + $r.='<li><a href="'.$v[0].$this->_getfullURL().'" '.(($conf['target']['extern']!='')?'target="'.$conf['target']['extern'].'"':'').'>'.$h."</a></li>\n";
 + }
 + return $r.'</ul>';
 + }
 + function _getfullURL() {
 + return 'http'.(($_SERVER['HTTPS']=='on')?'s':'').'://'.$_SERVER['HTTP_HOST'].(($_SERVER['SERVER_PORT']!='80')?':'.$_SERVER['SERVER_PORT']:'').$_SERVER['REQUEST_URI'];
 + }
 +}
 +
 +//Setup VIM: ex: et ts=4 enc=utf-8 :
 +?>
 +</file>
 +
 +<file txt lib/plugins/socialmark/list.txt>
 +#Start a line whit a sharp to put it in comment
 +#Syntaxe for URL is :
 +#URL|link text
 +#ex :
 +#http://blogmarks.net/my/new.php?mini=1&simple=1&url=|Blogmarks it !
 +#if link text is not specified, the host name is used.
 +#Note :
 +#Always put the URL param at the end of the url
 +http://www.connectedy.com/add-link.php?remote=1&url=|Connectedy it !
 +http://blogmarks.net/my/new.php?mini=1&simple=1&url=|Blogmark it !
 +http://www.netvouz.com/action/submitBookmark?url=|Netvouz it !
 +http://scuttle.org/bookmarks.php/?action=add&address=|Scuttle it !
 +http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=|Blinklist it !
 +http://www.spurl.net/spurl.php?v=3&url=|Spurl it !
 +http://del.icio.us/post?v=4;url=|Del.icio.us it !
 +http://www.connotea.org/addpopup?continue=confirm&uri=|Connotea it !
 +http://www.linkroll.com/index.php?action=insertLink&url=|Linkroll it !
 +http://www.openbm.de/bm.php?outside=1&link=|Openbm it !
 +http://simpy.com/simpy/LinkAdd.do?href=|Simpy it !
 +http://feedmelinks.com/categorize?from=toolbar&op=submit&url=|FeedmeLinks it !
 +</file>
 +
 +====== Customize ======
 +
 +===== links =====
 +You can add, delete and modify links : \\
 +just edit 'list.txt' in 'lib/plugins/socialmark/' \\
 +Comments line start by # \\
 +URL and textlink are separated by | \\
 +
 +===== style =====
 +
 +Links are displayed in an <ul>.
 +
 +You can customize style by changing css:
 +
 +<code css>
 +#socialmark {
 +/*ul element */
 +}
 +#socialmark li {
 +
 +}
 +#socialmark li a {
 +
 +}
 +</code>
 +
 +====== Comments ======
 +
 +I don't see the link between this plugin and the "Social Bookmarking". With the "Social Bookmarking", you have tags that refers to a URL. With socialmark, there's no tags or it doesn't work for me.
 +
 +Need help !

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