Installation instructions have changed from version 2.2 to 2.3!
Share can be setup in two different environments. It can work both with PHP (and some additional plugins) and without PHP. If you are using the Wordpress plugin you do not need to do any configuration, as it is automatic. The first thing you will need to do, however, with either configuration, is to include the files in your website's header with three lines:
<link rel="stylesheet" type="text/css" media="screen" href="media/share/share.css" /> <script src="media/share/share.js" type="text/javascript"></script> <script type="text/javascript">iBeginShare.base_url = 'media/share/';</script>
These should be the correct paths to the CSS and JavaScript files. These can be either absolute or relative to the current directory. You also need to make sure you set base_url
to be the base directory which contains share.js
and share.php
. Make sure this includes the trailing slash.
The plugins which require PHP are Email, My PC, and Print. If you do not wish to use these then you may disable them in share.js
(at the end of the file).
As of Share 2.3 we now include an optional statistics module. This will gather and display statistics on how your users interact with the Share module. Enabling the stats module consists of two steps, again, if you are using Wordpress, this is handled within the Wordpress plugin options.
You first need to setup your database, using either PostgreSQL or MySQL. You will find the appropriate SQL dump under sql/
. Import this into your database server:
mysql -u<username> -p -D<database_name> < path/to/database.mysql
psql -U <username> -W -f path/to/database.pgsql <database_name>
Next you need enable logging in the JavaScript file. This is done by adding another line in your header:
<script type="text/javascript">iBeginShare.enableStats();</script>
This tells the plugins (that are applicable) to redirect all requests to share.php
first so that it can log clicks.
The next step requires you to edit includes/config.inc.php
. Open it in your favorite text editor, and input the databae settings. Both MySQL and PostgreSQL configurations are available. Also make sure you adjust IBEGIN_SHARE_ENABLE_LOGS
and set it to true
.
define(IBEGIN_SHARE_ENABLE_LOGS, true); $db = array( 'username' => 'root', 'password' => '', 'host' => 'localhost', 'port' => '', 'database' => 'my_database', 'type' => 'mysql', // or postgresql );
The email plugin includes a few basic configuration options, which you can change by opening plugins/email/email.php
in a text editor.
// The subject of the email to send. (Eg. "You've got new message about Share") function generateEmailSubject($title, $link, $from_name, $from_email, $to_name, $to_email) { return "{$from_name} wants you to see this link"; } // The plain text body of the email to send function generateEmailBody($title, $link, $from_name, $from_email, $to_name, $to_email, $message=null) { $output = array(); $output[] = $from_name . ' thought you might find this link interesting:'; $output[] = ''; $output[] = 'Title: ' . $title; $output[] = 'Link: ' . $link; if ($message) $output[] = 'Message: ' . messageFilter($message); $output[] = ''; $output[] = '-----------------------------'; $output[] = $from_name . ' is using Share (http://www.enthropia.com/labs/share/)'; $output[] = '-----------------------------'; return implode("\r\n", $output); }
There are three variables you will need to pass to attach a button. All variables are optional, but most likely you will want to at least specify link
and title
. If these are not present they default to the current page's title and url.
The third variable, content
variable should be the full URL as described in PHP's fopen()
documentation to the page which produces the trimmed content. If you pass the content
parameter it will enable two additional plugins, My Computer and Print.
The attachLink
method accepts several parameters via the standard params
which you can pass to customize how your link shows on the page.
link_style
(New in Share 2.4)
'text'
share-link-[style]
. The built-in options are text
and button
, which is the default.
link_skin
(New in Share 2.4)
'default'
share-link-[style]-[style_skin]
. The built-in options are the same as the built-in skin options.
link_label
(New in Share 2.4)
'Share'
iBeginShare.text_link_label
.
Below are several common examples.
This example inserts the default button link, using the default skin.
<span id="share-tool"><script type="text/javascript">iBeginShare.attachLink('share-tool', { link: 'http://www.enthropia.com/labs/share/', title: 'Local Space Innovation', link_style: 'button' });</script></span>
This example inserts a normal text link, using the red skin, and the green link skin.
<span id="share-tool"><script type="text/javascript">iBeginShare.attachLink('share-tool2', { link: 'http://www.enthropia.com/labs/share/', title: 'Local Space Innovation', skin: 'red', link_style: 'text', link_skin: 'green' });</script></span>
Copyright (c) 2008-2023 Enthropia Inc
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.