Wiki source for ShareOnLinkedIn


Show raw source

=====Share Page on ""LinkedIn""=====
----
>>{{image url="http://static02.linkedin.com/img/pic/pic_widgets_shareonlinkedin_115x93.gif" title="Share on LinkedIn"}}>>
A new action for adding a //Share on [[http://LinkedIn.com LinkedIn]]//, link to your website or blog allowing your users to share your content with their [[http://LinkedIn.com LinkedIn]] connections or networks. This gives your content legs: one user visits your site and can notify literally tens, hundreds, or thousands of others. Works great for news sites, blogs, and other content–rich sites. See [[http://www.linkedin.com/static?key=developers_widget_shareonlinkedin here]] for the ""LinkedIn"" description of this functionality.


%%(php)
<?php
/**
* Display "Share on LinkedIn"
*
* @package Actions
* @author Roland Stens
* @version 1.0
* @license LinkedIn Widgets License Agreement
* By using a LinkedIn widget, you are entering into a legally binding agreement with LinkedIn Corporation that includes provisions that:
* 1. Allow your use of a LinkedIn widget under certain terms and conditions
* 2. Make it clear that your use of the widget does not indicate a partnership relationship with LinkedIn
* 3. Make it clear that you can not sell access to the LinkedIn widget, and
* 4. Allow LinkedIn to terminate this Agreement and your use of the widgets at any time.
* http://www.linkedin.com/static?key=developers_widgets_agreement
*/

// default Link Text
$text = "Share on LinkedIn";

// getting params
if (is_array($vars))
{
foreach ($vars as $param => $value)
{
if ($param == 'text')
{
$text = $value;
}
}
}

//Get the url of the page, for https servers simply change http to https.
$url = urlencode('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
$title = urlencode($this->PageTitle());

//Get the summary from the content but strip the title and just send the first 200 characters
$summary = urlencode(strip_tags($this->Format($this->page["body"])));
$summary = substr(trim(str_replace($title, "", $summary)),0,200);

//The name of your WikkaWiki installation
$source = urlencode($this->GetConfigValue("wakka_name"));

$output = '<a href="http://www.linkedin.com/shareArticle?mini=true&url='.$url.'&title='.$title.'&summary='.$summary.'&source='.$source.'" target="_blank">'.$text.'</a>';

print $output;

?>
%%

Save file as **linkedinshare.php** in your \plugins\actions directory.

====Usage====
""{{linkedinshare}}"" This will show a link on your page that says "Share on ""LinkedIn""" and will open a new window when clicked.
or
""{{linkedinshare text="Your Custom Link Text"}}"", same but this version gives you the opportunity to specify your own link name.

{{image url="http://static02.linkedin.com/img/pic/pic_widgets_shareonlinkedin_115x93.gif" title="Share on LinkedIn"}}
----
CategoryUserContributions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki