DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:socialmark

This is an old revision of the document!


SocialMark Plugin

Compatible with DokuWiki

No compatibility info given!

plugin Add link to “social bookmark” a page

Last updated on
2006-03-21
Provides
Syntax

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with bookmark, links, social

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 here : http://www.wikistuce.info/doku.php/php/creer_une_shoutbox (end of page)

Installation

With Plugin Manager: http://dokuplugins.idotech.info/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)

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. syntaxe : {{socialmark}}',
            'url'    => 'http://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 :
?>
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 !

Customize

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:

#socialmark {
/*ul element */
}
#socialmark li {
 
}
#socialmark li a {
 
}

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 !

plugin/socialmark.1565530435.txt.gz · Last modified: 2019-08-11 15:33 by Aleksandr

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